/* ========================================================
   Karen · Baby Sleep Tracker Stylesheet
   Modern iOS / Human Interface Design Style
   ======================================================== */

:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Palette directly matching the user's uploaded reference image */
  --chart-sleep-blue: #4e73d5;     /* Solid Royal Blue for Night Sleep */
  --chart-nap-purple: #b5a8f4;     /* Lavender / Periwinkle for Naps */
  --chart-awake-lilac: #efecfd;    /* Very Pale Lilac for Awake Spaces */
  --chart-grid-dash: #eeebfd;      /* Subtle Dashed Guide Lines */
  
  --color-sleep-blue: #2563eb;
  --color-sleep-blue-light: #3b82f6;
  --color-sleep-blue-bg: #eff6ff;
  --color-sleep-blue-border: #bfdbfe;
  
  --color-wake-orange: #ea580c;
  --color-wake-orange-bg: #fff7ed;
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08);
  --shadow-blue: 0 6px 20px rgba(37, 99, 235, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #0b0f19;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  -webkit-font-smoothing: antialiased;
}

/* App Viewport Container (iOS mobile wrapper) */
.app-viewport {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,0.5);
  overflow-x: hidden;
}

/* HEADER */
.app-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-card);
  border-bottom: 1px solid #edf2f7;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.baby-avatar-wrap {
  position: relative;
}

.baby-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
  border: 2px solid var(--color-sleep-blue-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: var(--shadow-sm);
}

.online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #10b981;
  border: 2px solid #ffffff;
}

.header-text {
  display: flex;
  flex-direction: column;
}

.greeting-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.baby-meta {
  margin-top: 3px;
}

.baby-name-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  background-color: var(--color-sleep-blue-bg);
  color: var(--color-sleep-blue);
  border-radius: var(--radius-pill);
  font-size: 0.73rem;
  font-weight: 700;
  border: 1px solid var(--color-sleep-blue-border);
}

.icon-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--bg-subtle);
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.icon-circle-btn:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

/* DATE CONTROLLER */
.date-controller {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #edf2f7;
}

.date-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-subtle);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  transition: all 0.2s ease;
}

.date-nav-btn:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.date-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-display-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.date-badge {
  padding: 2px 7px;
  background-color: #eff6ff;
  color: #2563eb;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
}

/* MAIN CONTENT */
.app-main-content {
  flex: 1;
  padding: 16px 16px 85px; /* bottom pad for 3-item fixed nav */
  overflow-y: auto;
}

/* VIEW PANELS */
.view-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.view-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* PAGE TITLE */
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.period-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

/* HERO SLEEPING BABY CARD */
.hero-baby-card {
  position: relative;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-blue);
}

.hero-cloud-decor {
  position: absolute;
  font-size: 2.2rem;
  opacity: 0.25;
  pointer-events: none;
}
.cloud-1 { top: -6px; right: 14px; }
.cloud-2 { bottom: -8px; left: 16px; font-size: 3rem; }

.hero-star-decor {
  position: absolute;
  font-size: 1.1rem;
  pointer-events: none;
  animation: pulseStar 2s infinite alternate;
}
.star-1 { top: 16px; left: 130px; }
.star-2 { bottom: 24px; right: 80px; }

@keyframes pulseStar {
  from { opacity: 0.4; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.1); }
}

.hero-illustration {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.cloud-bed {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-flex;
  align-items: center;
}

.sleeping-baby-graphic {
  display: flex;
  align-items: center;
  gap: 8px;
}

.baby-body {
  font-size: 2.3rem;
}

.zzzs {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 2px;
}

.hero-info {
  text-align: center;
}

.hero-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.hero-headline {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.hero-subtext {
  font-size: 0.78rem;
  opacity: 0.85;
}

/* 4 STAT CARDS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  border: 1px solid #edf2f7;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.stat-total .stat-card-icon {
  background-color: var(--color-sleep-blue-bg);
  color: var(--color-sleep-blue);
}

.stat-night .stat-card-icon {
  background-color: #ede9fe;
  color: #7c3aed;
}

.stat-day .stat-card-icon {
  background-color: var(--color-wake-orange-bg);
  color: var(--color-wake-orange);
}

.stat-sessions .stat-card-icon {
  background-color: #ecfdf5;
  color: #059669;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: block;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin: 3px 0 6px;
  display: block;
}

.stat-progress-bar {
  width: 100%;
  height: 6px;
  background-color: #f1f5f9;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 5px;
}

.stat-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

.stat-fill-night {
  background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

.stat-fill-day {
  background: linear-gradient(90deg, #fb923c, #ea580c);
}

.stat-hint {
  font-size: 0.68rem;
  color: var(--text-light);
  font-weight: 600;
}

.stat-pill-tag {
  display: inline-block;
  padding: 2px 7px;
  background-color: #f1f5f9;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}

/* ACTION BUTTON */
.action-btn-container {
  margin-bottom: 18px;
}

.btn-add-sleep {
  width: 100%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-blue);
  transition: all 0.2s ease;
}

.btn-add-sleep:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.btn-add-sleep-compact {
  background-color: var(--color-sleep-blue);
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* SECTION CARDS */
.section-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid #edf2f7;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.section-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.section-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--color-sleep-blue);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

/* TIMELINE SESSION ITEMS */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  background-color: #fafbfc;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.session-item-card:hover {
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.session-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.type-sleep .session-badge-icon {
  background-color: #ede9fe;
  color: #7c3aed;
}

.type-nap .session-badge-icon {
  background-color: #f3f0ff;
  color: #8b5cf6;
}

.type-wake .session-badge-icon {
  background-color: var(--color-wake-orange-bg);
  color: var(--color-wake-orange);
}

.session-title-text {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.session-time-text {
  font-size: 0.73rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.session-item-right {
  text-align: right;
}

.session-duration-badge {
  display: inline-block;
  padding: 3px 9px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-main);
}

.session-quality-tag {
  font-size: 0.68rem;
  color: var(--text-light);
  display: block;
  margin-top: 3px;
}

/* ========================================================
   TRENDS PAGE & DETAILED 24H SLIDABLE BAR CHART
   ======================================================== */

.segmented-control {
  display: flex;
  background-color: #e2e8f0;
  padding: 4px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}

.seg-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.seg-tab.active {
  background-color: #ffffff;
  color: var(--color-sleep-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.trends-sub-panel {
  display: none;
}

.trends-sub-panel.active {
  display: block;
}

/* DETAILED CONTAINER CARD */
.detailed-container-card {
  background-color: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px 14px;
  border: 1px solid #edf2f7;
  box-shadow: var(--shadow-sm);
}

.detailed-mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background-color: #eff6ff;
  color: #2563eb;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.detailed-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.detailed-card-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dynamic Zoom Status Bar */
.zoom-status-bar {
  margin-top: 10px;
  padding: 6px 10px;
  background-color: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  font-size: 0.72rem;
  color: #6d28d9;
  font-weight: 700;
  display: flex;
  align-items: center;
}

/* ========================================================
   SLIDABLE 24H BAR CHART COMPONENT (MATCHING IMAGE)
   ======================================================== */

.slidable-chart-outer-wrap {
  display: flex;
  position: relative;
  height: 490px;
  margin-top: 14px;
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #f1f5f9;
}

/* Sticky Y-Axis on the Left */
.y-axis-container {
  width: 62px;
  flex-shrink: 0;
  height: 430px; /* leaves 50px at bottom for day labels */
  margin-top: 10px;
  position: relative;
  border-right: 1px solid #f1f5f9;
  background-color: #ffffff;
  z-index: 10;
}

.y-axis-tick {
  position: absolute;
  right: 8px;
  transform: translateY(50%);
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}

/* Slidable Day Bars Area */
.slidable-bars-scroll-area {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  scroll-behavior: smooth;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}

.slidable-bars-scroll-area:active {
  cursor: grabbing;
}

.slidable-bars-inner-track {
  display: flex;
  height: 100%;
  position: relative;
  padding: 10px 10px 0 10px;
}

/* Background Guide Grid Lines spanning the track */
.chart-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed var(--chart-grid-dash);
  pointer-events: none;
  z-index: 1;
}

/* Individual Day Column */
.day-bar-column {
  width: 52px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 0 5px;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.day-bar-column:hover {
  transform: translateY(-2px);
}

.day-bar-column.active-inspect .day-bar-pill {
  box-shadow: 0 0 0 2px #2563eb;
}

/* The Vertical Day Bar Pill Container (matching image) */
.day-bar-pill {
  width: 42px;
  height: 430px;
  background-color: var(--chart-awake-lilac);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column-reverse; /* Bottom is 6:00 AM, top is 6:00 AM tomorrow */
  border: 1px solid rgba(181, 168, 244, 0.25);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}

/* Bar Segments */
.bar-segment {
  width: 100%;
  position: absolute;
  left: 0;
  right: 0;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1), bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.segment-sleep {
  background-color: var(--chart-sleep-blue); /* #4e73d5 */
}

.segment-nap {
  background-color: var(--chart-nap-purple); /* #b5a8f4 */
}

.segment-awake {
  background-color: var(--chart-awake-lilac); /* #efecfd */
}

/* Day Label at Bottom */
.day-bar-label {
  margin-top: 8px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.day-bar-column.active-inspect .day-bar-label {
  color: var(--color-sleep-blue);
  font-weight: 800;
}

/* ========================================================
   4 FILTER BUTTONS BENEATH THE CHART
   ======================================================== */

.detailed-filter-buttons-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-filter-pill {
  flex: 1;
  background-color: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  padding: 8px 6px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-filter-pill:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.btn-filter-pill.active {
  background-color: #ffffff;
  border-color: #2563eb;
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-sleep { background-color: var(--chart-sleep-blue); }
.dot-nap { background-color: var(--chart-nap-purple); }
.dot-awake { background-color: #c4b5fd; }

/* Image Colors Legend */
.image-color-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Inspect Day Card */
.inspect-day-card {
  margin-top: 14px;
  padding: 12px;
  background-color: #fafbfc;
  border: 1px solid #edf2f7;
  border-radius: var(--radius-sm);
}

.inspect-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.inspect-day-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
}

.inspect-day-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-sleep-blue);
  background-color: #eff6ff;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.inspect-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.inspect-stat-item {
  display: flex;
  flex-direction: column;
}

.inspect-label {
  font-size: 0.64rem;
  color: var(--text-muted);
  font-weight: 600;
}

.inspect-val {
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 1px;
}

.inspect-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.btn-inspect-action {
  flex: 1;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-inspect-action:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

.btn-inspect-action.primary {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.btn-inspect-action.primary:hover {
  background-color: #1d4ed8;
}

/* Day preset picker for modals */
.day-preset-pill-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.btn-day-preset {
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-day-preset:hover {
  background-color: #e2e8f0;
}

.btn-day-preset.active {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* Cycle Notice Box */
.cycle-notice-box {
  margin-top: 12px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 0.72rem;
  color: #1e40af;
  line-height: 1.35;
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.cycle-notice-box i {
  margin-top: 2px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.date-center {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.date-center:hover .date-display-text {
  color: #2563eb;
}

.date-picker-icon-btn {
  font-size: 0.72rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
}

/* ========================================================
   SLIDABLE CHARTS (TOTAL, SLEEP, NAPS)
   ======================================================== */

.slidable-chart-canvas-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.slidable-canvas-inner {
  height: 220px;
  min-width: 100%;
}

/* ========================================================
   BOTTOM NAVIGATION (3 CLEAN TABS)
   ======================================================== */

.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: 62px;
  background-color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.03);
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-light);
  cursor: pointer;
  height: 100%;
  transition: all 0.2s ease;
}

.nav-item i {
  font-size: 1.15rem;
  transition: transform 0.2s ease;
}

.nav-item span {
  font-size: 0.68rem;
  font-weight: 700;
}

.nav-item.active {
  color: var(--color-sleep-blue);
}

.nav-item.active i {
  transform: translateY(-1px);
}

/* ========================================================
   MODALS (PERIOD FILTER & ADD SLEEP)
   ======================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background-color: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 30px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}

.period-presets-row {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.preset-chip {
  flex: 1;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-pill);
  padding: 6px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.preset-chip:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.btn-total-history {
  width: 100%;
  background-color: #eff6ff;
  border: 1.5px solid #3b82f6;
  color: #1d4ed8;
  padding: 12px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-total-history:hover {
  background-color: #dbeafe;
}

.form-group {
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.col-half { flex: 1; }

.form-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  background-color: #fafbfc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-sleep-blue);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-primary-save {
  width: 100%;
  background-color: var(--color-sleep-blue);
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s ease;
}

.btn-primary-save:hover {
  background-color: #1d4ed8;
}

.btn-danger-outline {
  flex: 1;
  background: none;
  border: 1.5px solid #ef4444;
  color: #ef4444;
  padding: 11px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-danger-outline:hover {
  background-color: #fef2f2;
}

.type-segmented-control {
  display: flex;
  background-color: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-pill);
}

.type-seg-option {
  flex: 1;
  cursor: pointer;
}

.type-seg-option input[type="radio"] {
  display: none;
}

.type-pill-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.type-seg-option input[type="radio"]:checked + .type-pill-box {
  background-color: #ffffff;
  color: var(--color-sleep-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.calc-duration-box {
  margin-top: 10px;
  padding: 8px 12px;
  background-color: var(--color-sleep-blue-bg);
  border: 1px solid var(--color-sleep-blue-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--color-sleep-blue);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

.modal-actions-dual {
  display: flex;
  gap: 10px;
}
