:root {
    --bg: #eceae4;
    --surface: #faf9f5;
    --surface-2: #f3f1eb;
    --surface-3: #e9ebe5;
    --ink: #182019;
    --ink-soft: #334039;
    --muted: #6c756f;
    --line: #d4d8d1;
    --line-strong: #bbc3bb;
    --green: #2f6a4d;
    --green-strong: #1f5038;
    --green-soft: #dce8df;
    --blue: #2f526f;
    --blue-soft: #e0e8ef;
    --warm: #9a6740;
    --warm-soft: #eee1d4;
    --danger: #a8443e;
    --danger-soft: #f2dddb;
    --success: #2f6a4d;
    --radius-xs: 4px;
    --radius-sm: 7px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-float: 0 18px 50px rgba(34, 42, 36, .14);
    --sidebar-width: 224px;
    --topbar-height: 64px;
    --bottom-nav-height: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100%;
    font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-variant-numeric: tabular-nums lining-nums;
    text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 500; background: var(--ink); color: white; padding: .7rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }

/* Authentication */
.auth-body { min-height: 100svh; background: #11241d; }
.auth-layout { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); }
.auth-story { position: relative; overflow: hidden; padding: clamp(28px, 5vw, 72px); color: #f3f1e9; display: flex; flex-direction: column; isolation: isolate; }
.auth-story::before { content: ""; position: absolute; inset: 0; background: linear-gradient(145deg, #13271f 0%, #244333 50%, #355748 100%); z-index: -3; }
.auth-story::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 78% 18%, rgba(245,224,168,.16), transparent 22%), linear-gradient(transparent 70%, rgba(0,0,0,.15)); z-index: -2; }
.auth-brand { display: inline-flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.25rem; width: max-content; }
.brand-mark { position: relative; display: inline-block; width: 27px; height: 30px; }
.brand-mark::before { content: ""; position: absolute; left: 12px; bottom: 2px; width: 2px; height: 20px; border-radius: 2px; background: currentColor; transform: rotate(-5deg); }
.brand-mark i { position: absolute; width: 13px; height: 7px; border: 2px solid currentColor; border-radius: 100% 0 100% 0; background: transparent; }
.brand-mark i:first-child { left: 1px; top: 8px; transform: rotate(25deg); }
.brand-mark i:last-child { right: 0; top: 3px; transform: rotate(155deg); }
.auth-story-copy { margin: auto 0 20%; max-width: 720px; }
.overline { margin: 0 0 .45rem; text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; font-weight: 700; color: var(--muted); }
.auth-story .overline { color: rgba(255,255,255,.62); }
.auth-story h1 { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(2.6rem, 5.2vw, 5.6rem); line-height: .98; font-weight: 500; letter-spacing: -.035em; max-width: 12ch; }
.auth-story-copy > p:last-child { max-width: 52ch; font-size: clamp(1rem, 1.4vw, 1.22rem); line-height: 1.55; color: rgba(255,255,255,.72); }
.auth-landscape { position: absolute; inset: auto 0 0; height: 34%; z-index: -1; }
.auth-hill { position: absolute; left: -8%; right: -8%; bottom: -24%; height: 92%; border-radius: 50% 50% 0 0 / 48% 48% 0 0; }
.auth-hill-back { background: #4d6f5c; transform: translateX(-10%) rotate(2deg); opacity: .68; }
.auth-hill-front { background: #294737; transform: translateX(12%) rotate(-2deg); }
.auth-moon { position: absolute; width: 96px; height: 96px; right: 15%; top: -36%; border-radius: 50%; background: #f0d995; box-shadow: 0 0 60px rgba(240,217,149,.24); }
.auth-sprout { position: absolute; left: 50%; bottom: 12%; width: 80px; height: 150px; transform: translateX(-50%); }
.auth-sprout i { position: absolute; left: 39px; bottom: 0; width: 4px; height: 118px; border-radius: 5px; background: #aec468; transform: rotate(-3deg); transform-origin: bottom; }
.auth-sprout b { position: absolute; top: 24px; width: 44px; height: 22px; background: #9bb65f; border-radius: 100% 0 100% 0; }
.auth-sprout b:nth-of-type(1) { left: 0; transform: rotate(16deg); }
.auth-sprout b:nth-of-type(2) { right: 0; transform: scaleX(-1) rotate(16deg); }
.auth-panel { background: var(--surface); display: grid; place-items: center; padding: clamp(24px, 5vw, 64px); }
.auth-panel-inner { width: min(420px, 100%); }
.auth-panel h2 { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: 2.2rem; font-weight: 600; letter-spacing: -.025em; }
.auth-intro { color: var(--muted); line-height: 1.5; margin-bottom: 1.5rem; }
.auth-form { display: grid; gap: 1rem; }
.auth-form label:not(.check-row), .form-grid label, .form-stack label { display: grid; gap: .4rem; }
.auth-form label > span, .form-grid label > span, .form-stack label > span { font-size: .86rem; color: var(--ink-soft); font-weight: 600; }
.check-row, .switch-row { display: flex; gap: .7rem; align-items: center; color: var(--muted); }
.check-row input, .switch-row input { width: 18px; height: 18px; accent-color: var(--green); }
.form-alert { padding: .8rem .9rem; background: var(--warm-soft); border-left: 3px solid var(--warm); color: var(--ink-soft); }
.form-alert.error { background: var(--danger-soft); border-color: var(--danger); }
.quiet-link { display: inline-block; margin-top: 1.2rem; color: var(--muted); text-underline-offset: .2em; }

/* App shell */
.care-app { min-height: 100svh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); grid-template-rows: var(--topbar-height) minmax(0, 1fr); }
.side-nav { grid-row: 1 / -1; position: sticky; top: 0; height: 100svh; background: #17251e; color: #eef1ec; border-right: 1px solid rgba(255,255,255,.08); padding: 24px 14px 18px; display: flex; flex-direction: column; z-index: 50; }
.app-brand { display: inline-flex; align-items: center; gap: .7rem; padding: 0 12px 24px; text-decoration: none; font-size: 1.2rem; font-weight: 700; }
.primary-nav { display: grid; gap: 3px; }
.primary-nav button, .night-entry { appearance: none; border: 0; background: transparent; color: rgba(255,255,255,.64); min-height: 44px; display: flex; align-items: center; gap: .8rem; padding: 0 12px; border-radius: var(--radius-sm); text-align: left; }
.primary-nav button:hover, .night-entry:hover { background: rgba(255,255,255,.06); color: white; }
.primary-nav button.active { background: rgba(255,255,255,.11); color: white; font-weight: 600; }
.primary-nav svg, .night-entry svg { width: 19px; height: 19px; }
.nav-footer { margin-top: auto; display: grid; gap: .25rem; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.nav-footer a { color: rgba(255,255,255,.52); font-size: .87rem; padding: .65rem .75rem; }
.app-topbar { grid-column: 2; position: sticky; top: 0; z-index: 40; min-width: 0; height: var(--topbar-height); background: rgba(250,249,245,.94); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 0 24px; }
.topbar-child { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.topbar-child > div { display: grid; line-height: 1.05; }
.topbar-child strong { font-size: .95rem; }
.topbar-child span:last-child { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); flex: none; }
.status-dot.sleeping { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.status-dot.waking { background: var(--warm); box-shadow: 0 0 0 4px var(--warm-soft); }
.topbar-center time { color: var(--muted); font-size: .88rem; }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: .55rem; }
.icon-btn { position: relative; appearance: none; border: 1px solid var(--line); background: var(--surface); width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--radius-sm); }
.icon-btn:hover { border-color: var(--line-strong); background: white; }
.notification-badge { position: absolute; right: -3px; top: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: white; display: grid; place-items: center; font-size: .67rem; font-weight: 700; }
.user-button { appearance: none; border: 0; background: transparent; display: flex; align-items: center; gap: .55rem; padding: .2rem .4rem; }
.user-button > span:first-child { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green-strong); font-weight: 700; }
.user-button > span:last-child { font-size: .88rem; }
.app-main { grid-column: 2; min-width: 0; padding: 28px clamp(20px, 3vw, 44px) 54px; }
.app-view { display: none; width: min(1500px, 100%); margin: 0 auto; }
.app-view.active { display: block; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(2rem, 3vw, 3.2rem); line-height: .98; letter-spacing: -.035em; font-weight: 600; }
.heading-actions { display: flex; gap: .65rem; flex-wrap: wrap; justify-content: flex-end; }

/* Shared components */
.button { appearance: none; border: 1px solid transparent; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem .9rem; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none; line-height: 1; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: var(--green-strong); }
.button.secondary { background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover, .button.ghost:hover { background: white; border-color: var(--line-strong); }
.button.ghost { background: transparent; border-color: var(--line); }
.button.danger { background: var(--danger); color: white; }
.button.small { min-height: 34px; padding: .4rem .65rem; font-size: .84rem; }
.button.wide { width: 100%; }
.text-action { appearance: none; border: 0; background: transparent; color: var(--green-strong); padding: .2rem 0; font-weight: 600; font-size: .86rem; }
.state-chip { display: inline-flex; align-items: center; min-height: 28px; padding: .2rem .55rem; border: 1px solid var(--line); border-radius: var(--radius-xs); font-size: .78rem; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.state-chip.sleeping { color: var(--blue); background: var(--blue-soft); border-color: #c4d3df; }
.state-chip.awake { color: var(--green-strong); background: var(--green-soft); border-color: #bfd2c4; }
.state-chip.waking { color: #784d2e; background: var(--warm-soft); border-color: #d9c1aa; }
.panel-heading-line { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.panel-heading-line h2, .status-header h2 { margin: 0; font-size: 1.12rem; line-height: 1.15; font-weight: 650; }
.panel-heading-line select, .filter-row select { min-height: 34px; }

/* Today */
.today-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.status-panel, .prediction-panel, .metric-strip, .day-rhythm, .age-note, .quick-log,
.current-sleep-panel, .plan-panel, .history-panel, .prediction-details,
.care-actions, .feeding-timer-panel, .care-summary, .care-history,
.chart-panel, .rhythm-panel, .accuracy-panel, .care-correlation,
.development-age, .development-copy, .development-preview,
.settings-section, .stats-overview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
.status-panel { grid-column: span 7; min-height: 280px; padding: clamp(20px, 2.4vw, 32px); display: grid; align-content: start; }
.prediction-panel { grid-column: span 5; min-height: 280px; padding: clamp(20px, 2.4vw, 30px); }
.status-header { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.timer-display { margin: 1.35rem 0 .25rem; font-size: clamp(3.5rem, 7vw, 7.2rem); line-height: .9; font-weight: 600; letter-spacing: -.055em; color: var(--ink); white-space: nowrap; }
.status-copy { margin: .8rem 0 1.4rem; color: var(--muted); max-width: 54ch; line-height: 1.5; }
.primary-actions, .secondary-actions { display: flex; gap: .65rem; flex-wrap: wrap; }
.secondary-actions { margin-top: .65rem; }
.primary-actions .button { min-height: 46px; padding-inline: 1.15rem; }
.prediction-window { margin: 1.5rem 0 1rem; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(2rem, 3.8vw, 3.8rem); line-height: 1; letter-spacing: -.035em; }
.confidence-line { display: grid; grid-template-columns: auto minmax(80px, 1fr) auto; align-items: center; gap: .65rem; color: var(--muted); font-size: .82rem; }
.confidence-line strong { color: var(--ink-soft); }
.confidence-meter { height: 4px; background: var(--surface-3); overflow: hidden; }
.confidence-meter i { display: block; width: 0; height: 100%; background: var(--green); transition: width .35s ease; }
.prediction-reason { color: var(--ink-soft); line-height: 1.45; min-height: 2.9em; }
.prediction-meta { margin: 1.1rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.prediction-meta > div { padding: .85rem .6rem 0 0; }
.prediction-meta dt { color: var(--muted); font-size: .75rem; }
.prediction-meta dd { margin: .2rem 0 0; font-weight: 600; font-size: .9rem; }
.metric-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); }
.metric-strip article { padding: 18px 20px; border-right: 1px solid var(--line); min-width: 0; }
.metric-strip article:last-child { border-right: 0; }
.metric-strip span, .metric-strip small { display: block; color: var(--muted); font-size: .78rem; }
.metric-strip strong { display: block; margin: .2rem 0; font-size: 1.35rem; line-height: 1; }
.day-rhythm { grid-column: span 8; padding: 22px; min-height: 260px; }
.age-note { grid-column: span 4; padding: 22px; background: #e8ece6; }
.age-note h2 { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: 1.6rem; line-height: 1.05; }
.age-note p:last-child { color: var(--ink-soft); line-height: 1.55; }
.quick-log { grid-column: span 4; padding: 22px; }
.day-rhythm + .age-note + .quick-log { display: none; }
.timeline { position: relative; height: 92px; margin-top: 24px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); background: repeating-linear-gradient(90deg, transparent 0, transparent calc(4.166% - 1px), rgba(31,49,39,.06) calc(4.166% - 1px), rgba(31,49,39,.06) 4.166%); overflow: hidden; }
.timeline-block { position: absolute; top: 16px; height: 48px; min-width: 3px; background: var(--blue); border-left: 1px solid rgba(255,255,255,.4); }
.timeline-block.nap { background: #6d889d; }
.timeline-block.predicted { top: 68px; height: 7px; background: repeating-linear-gradient(90deg, var(--green) 0 5px, transparent 5px 9px); }
.timeline-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 5; }
.timeline-hour { position: absolute; bottom: 2px; transform: translateX(-50%); color: var(--muted); font-size: .66rem; }
.timeline-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: .75rem; }
.timeline-legend i { display: inline-block; width: 14px; height: 5px; margin-right: .35rem; vertical-align: middle; }
.legend-sleep { background: var(--blue); }
.legend-wake { background: var(--surface-3); border: 1px solid var(--line); }
.legend-predict { background: var(--green); }
.quick-log-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 18px; }
.quick-log-grid button { appearance: none; border: 1px solid var(--line); background: var(--surface-2); min-height: 58px; display: flex; align-items: center; gap: .55rem; padding: .8rem; border-radius: var(--radius-sm); text-align: left; }
.quick-log-grid button:hover { background: white; border-color: var(--line-strong); }
.quick-log-grid svg { color: var(--green); }

/* Sleep */
.sleep-layout, .care-layout, .stats-layout, .settings-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.current-sleep-panel { grid-column: span 4; padding: 22px; min-height: 220px; }
.plan-panel { grid-column: span 8; padding: 22px; min-height: 220px; }
.history-panel { grid-column: span 7; padding: 22px; }
.prediction-details { grid-column: span 5; padding: 22px; }
.current-sleep-content { margin-top: 1.25rem; }
.current-sleep-content .large-time { font-size: clamp(2.7rem, 5vw, 4.8rem); line-height: 1; font-weight: 600; letter-spacing: -.045em; }
.day-plan { position: relative; min-height: 128px; margin-top: 18px; border-left: 1px solid var(--line-strong); background: repeating-linear-gradient(90deg, transparent 0, transparent calc(4.166% - 1px), rgba(31,49,39,.055) calc(4.166% - 1px), rgba(31,49,39,.055) 4.166%); }
.plan-row { position: relative; height: 34px; border-bottom: 1px solid var(--line); }
.plan-row-label { position: absolute; left: 6px; top: 8px; color: var(--muted); font-size: .72rem; z-index: 2; }
.plan-block { position: absolute; top: 7px; height: 20px; background: var(--blue); color: white; font-size: .68rem; padding: 2px 4px; overflow: hidden; white-space: nowrap; }
.plan-block.nap { background: #6d889d; }
.plan-block.waking { background: var(--warm); }
.plan-block.prediction { background: transparent; border: 2px dashed var(--green); color: var(--green-strong); }
.event-list { display: grid; gap: 0; margin-top: 16px; border-top: 1px solid var(--line); }
.event-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.event-row:hover { background: rgba(255,255,255,.5); }
.event-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--blue-soft); color: var(--blue); }
.event-icon.nap { background: #e6ebee; color: #5b778b; }
.event-icon.care { background: var(--green-soft); color: var(--green); }
.event-main { min-width: 0; }
.event-main strong { display: block; line-height: 1.15; }
.event-main span { display: block; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-meta { text-align: right; }
.event-meta strong { display: block; }
.event-meta small { color: var(--muted); }
.empty-state { padding: 28px 10px; text-align: center; color: var(--muted); }
.prediction-detail-grid { margin-top: 18px; }
.prediction-big { display: grid; gap: .35rem; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.prediction-big strong { font-family: "Source Serif 4", Georgia, serif; font-size: 2rem; line-height: 1.05; }
.prediction-big span { color: var(--muted); }
.factor-list { display: grid; gap: 10px; margin-top: 14px; }
.factor-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; }
.factor-minute { color: var(--green-strong); font-weight: 700; font-size: .82rem; }
.factor-item p { margin: 0; color: var(--ink-soft); line-height: 1.4; }
.prediction-history { margin-top: 18px; border-top: 1px solid var(--line); }
.prediction-history-row { display: flex; justify-content: space-between; gap: 12px; padding: .75rem 0; border-bottom: 1px solid var(--line); font-size: .84rem; }

/* Care */
.care-actions { grid-column: span 8; padding: 22px; }
.feeding-timer-panel { grid-column: span 4; padding: 22px; }
.care-summary { grid-column: span 4; padding: 22px; }
.care-history { grid-column: span 8; padding: 22px; }
.care-action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.care-action-grid button { appearance: none; border: 1px solid var(--line); background: var(--surface-2); padding: 14px; min-height: 104px; text-align: left; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; gap: 3px 8px; border-radius: var(--radius-sm); }
.care-action-grid button:hover { background: white; border-color: var(--line-strong); }
.care-action-grid svg { grid-row: 1 / span 2; color: var(--green); width: 22px; height: 22px; }
.care-action-grid strong { line-height: 1.1; }
.care-action-grid span { font-size: .76rem; color: var(--muted); line-height: 1.25; }
.feeding-timer { margin-top: 18px; }
.feeding-timer .large-time { font-size: 3.2rem; font-weight: 600; letter-spacing: -.04em; }
.feeding-side-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 16px; }
.feeding-side-actions button { min-height: 42px; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); }
.feeding-side-actions button.active { background: var(--green); color: white; border-color: var(--green); }
.care-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 18px; background: var(--line); border: 1px solid var(--line); }
.care-summary-grid article { background: var(--surface); padding: 14px; }
.care-summary-grid span { color: var(--muted); font-size: .76rem; display: block; }
.care-summary-grid strong { font-size: 1.35rem; }

/* Statistics */
.stats-overview { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); overflow: hidden; }
.stats-overview article { padding: 18px; border-right: 1px solid var(--line); }
.stats-overview article:last-child { border-right: 0; }
.stats-overview span { display: block; color: var(--muted); font-size: .75rem; }
.stats-overview strong { display: block; margin: .3rem 0; font-size: 1.45rem; }
.stats-overview small { color: var(--muted); }
.chart-panel { grid-column: span 8; padding: 22px; }
.rhythm-panel { grid-column: span 4; padding: 22px; }
.accuracy-panel { grid-column: span 6; padding: 22px; }
.care-correlation { grid-column: span 6; padding: 22px; }
.segmented-control { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.segmented-control button { appearance: none; border: 0; border-right: 1px solid var(--line); min-height: 36px; padding: .4rem .8rem; background: var(--surface); }
.segmented-control button:last-child { border-right: 0; }
.segmented-control button.active { background: var(--ink); color: white; }
.sleep-chart { display: flex; align-items: end; gap: 8px; min-height: 250px; margin-top: 20px; padding: 16px 0 26px; border-bottom: 1px solid var(--line); }
.chart-day { flex: 1; min-width: 16px; height: 210px; display: flex; flex-direction: column; justify-content: end; position: relative; }
.chart-stack { width: 100%; display: flex; flex-direction: column; justify-content: end; min-height: 2px; }
.chart-night { background: var(--blue); }
.chart-nap { background: #7d9b85; }
.chart-label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--muted); }
.chart-value { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .66rem; white-space: nowrap; color: var(--muted); }
.rhythm-list { display: grid; gap: 14px; margin-top: 20px; }
.rhythm-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.rhythm-row span { color: var(--muted); }
.accuracy-gauge { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 22px; margin-top: 20px; }
.gauge-ring { --value: 0; width: 120px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--value) * 1%), var(--surface-3) 0); position: relative; }
.gauge-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.gauge-ring strong { position: relative; font-size: 1.8rem; }

/* Development */
.development-layout { display: grid; grid-template-columns: .75fr 1.25fr 1fr; gap: 14px; }
.development-age, .development-copy, .development-preview { padding: 28px; min-height: 340px; }
.development-age strong { display: block; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(3rem, 5vw, 5.4rem); line-height: .9; letter-spacing: -.05em; }
.development-age p:last-child { color: var(--muted); }
.development-copy h2 { font-family: "Source Serif 4", Georgia, serif; font-size: 2rem; line-height: 1.05; margin-top: 0; }
.development-copy p, .development-copy li { color: var(--ink-soft); line-height: 1.55; }
.development-preview { position: relative; overflow: hidden; background: #dfe9e2; }
.growth-line { position: absolute; left: 14%; right: 14%; bottom: 62px; height: 2px; background: rgba(31,80,56,.25); display: flex; justify-content: space-between; }
.growth-line i { width: 10px; height: 10px; border-radius: 50%; background: var(--green); transform: translateY(-4px); }
.growth-plant { position: absolute; left: 50%; bottom: 60px; width: 120px; height: 180px; transform: translateX(-50%); }
.growth-plant b { position: absolute; left: 58px; bottom: 0; width: 5px; height: 150px; background: var(--green); transform: rotate(-4deg); border-radius: 4px; }
.growth-plant em { position: absolute; top: 25px; width: 68px; height: 34px; background: #6c9b77; border-radius: 100% 0 100% 0; }
.growth-plant em:nth-of-type(1) { left: 0; transform: rotate(13deg); }
.growth-plant em:nth-of-type(2) { right: -6px; transform: scaleX(-1) rotate(13deg); }

/* Settings */
.settings-section { grid-column: span 6; padding: 22px; min-width: 0; }
.settings-section.wide { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.form-grid > .button { align-self: end; justify-self: start; }
.form-grid.compact-form { grid-template-columns: 1fr 1fr auto; }
.form-stack { display: grid; gap: 14px; margin-top: 18px; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); background: white; border-radius: var(--radius-sm); padding: .55rem .7rem; outline: none; }
textarea { min-height: 100px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,106,77,.12); }
.settings-details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.settings-details summary { cursor: pointer; font-weight: 600; color: var(--green-strong); }
.member-list, .device-list, .trash-list, .audit-list, .notification-list { display: grid; margin-top: 16px; border-top: 1px solid var(--line); }
.member-row, .device-row, .trash-row, .audit-row, .notification-row { display: grid; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.member-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
.member-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green-strong); font-weight: 700; }
.member-row strong, .device-row strong { display: block; }
.member-row small, .device-row small, .trash-row small, .audit-row small { color: var(--muted); }
.device-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
.device-row svg { color: var(--muted); }
.trash-row { grid-template-columns: 1fr auto; }
.audit-row { grid-template-columns: 150px minmax(0, 1fr); }
.audit-row time { color: var(--muted); font-size: .8rem; }
.notification-row { grid-template-columns: minmax(0, 1.3fr) auto auto auto; }
.notification-row label { display: flex; gap: .5rem; align-items: center; }
.notification-row input[type="checkbox"] { width: 18px; min-height: 18px; }
.notification-row input[type="number"], .notification-row input[type="time"] { width: 88px; }
.data-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 18px; }

/* Dialogs */
.app-dialog { width: min(680px, calc(100vw - 24px)); max-height: min(90svh, 820px); padding: 0; border: 0; border-radius: var(--radius-lg); background: transparent; color: var(--ink); box-shadow: var(--shadow-float); }
.app-dialog::backdrop, .night-dialog::backdrop { background: rgba(17,27,21,.58); backdrop-filter: blur(5px); }
.dialog-shell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; max-height: min(90svh, 820px); }
.dialog-shell > header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.dialog-shell > header h2 { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: 1.7rem; line-height: 1; }
.dialog-body { padding: 20px 22px; overflow: auto; }
.dialog-shell > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.dialog-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dialog-form .full { grid-column: 1 / -1; }
.dialog-form fieldset { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.choice-grid label { position: relative; }
.choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid span { min-height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.choice-grid label:has(input:checked) span { background: var(--green); color: white; border-color: var(--green); }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-list div { padding: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: .76rem; }
.detail-list dd { margin: .2rem 0 0; font-weight: 600; }
.night-dialog { width: 100vw; max-width: none; height: 100svh; max-height: none; padding: 0; border: 0; background: #07110d; color: #f0f2ee; }
.night-shell { min-height: 100%; display: grid; place-items: center; align-content: center; text-align: center; padding: 28px; position: relative; }
.night-close { position: absolute; right: 18px; top: 18px; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.15); background: transparent; color: white; border-radius: var(--radius-sm); }
.night-shell .overline { color: rgba(255,255,255,.5); }
.night-shell h2 { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(2rem, 7vw, 4.5rem); }
.night-timer { margin: 18px 0; font-size: clamp(4rem, 17vw, 9rem); line-height: .9; font-weight: 600; letter-spacing: -.055em; }
.night-shell > p:not(.overline) { color: rgba(255,255,255,.62); }
.night-actions { display: flex; gap: 10px; margin-top: 24px; }
.night-actions .button { min-height: 58px; padding-inline: 1.4rem; }
.night-undo { margin-top: 18px; border: 0; background: transparent; color: rgba(255,255,255,.66); display: inline-flex; gap: .45rem; align-items: center; }

/* Notifications and toasts */
.notification-drawer { position: fixed; z-index: 120; top: var(--topbar-height); right: 16px; width: min(390px, calc(100vw - 32px)); max-height: calc(100svh - var(--topbar-height) - 20px); overflow: auto; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-float); border-radius: var(--radius-md); padding: 18px; }
.drawer-head { display: flex; justify-content: space-between; align-items: start; }
.drawer-head h2 { margin: 0; font-size: 1.2rem; }
.notification-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.notification-item strong { display: block; }
.notification-item p { margin: .25rem 0; color: var(--ink-soft); }
.notification-item time { color: var(--muted); font-size: .78rem; }
.toast-region { position: fixed; z-index: 200; right: 18px; bottom: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 260px; max-width: 420px; padding: .85rem 1rem; background: #17251e; color: white; border-radius: var(--radius-sm); box-shadow: var(--shadow-float); animation: toast-in .22s ease; }
.toast.error { background: #7a2f2b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.loading-screen { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; align-content: center; gap: 18px; background: var(--surface); }
.loading-screen p { color: var(--muted); }
.loading-sprout { position: relative; width: 40px; height: 56px; }
.loading-sprout i { position: absolute; left: 19px; bottom: 0; width: 3px; height: 42px; background: var(--green); transform: rotate(-4deg); }
.loading-sprout b { position: absolute; top: 8px; width: 23px; height: 11px; background: #7fa483; border-radius: 100% 0 100% 0; }
.loading-sprout b:nth-of-type(1) { left: 0; transform: rotate(15deg); }
.loading-sprout b:nth-of-type(2) { right: 0; transform: scaleX(-1) rotate(15deg); }

/* Dark theme */
.care-app[data-theme="dark"] {
    --bg: #111714;
    --surface: #18211c;
    --surface-2: #202b25;
    --surface-3: #2a352f;
    --ink: #eff2ee;
    --ink-soft: #c8d0ca;
    --muted: #95a098;
    --line: #334139;
    --line-strong: #45564c;
    --green: #72a988;
    --green-strong: #a4d1b4;
    --green-soft: #233b2e;
    --blue: #7ea1bd;
    --blue-soft: #223443;
    --warm: #d09a6c;
    --warm-soft: #3a2e25;
    --danger-soft: #402725;
    color-scheme: dark;
}
.care-app[data-theme="dark"] input,
.care-app[data-theme="dark"] select,
.care-app[data-theme="dark"] textarea { background: #121a16; }
.care-app[data-theme="dark"] .app-topbar { background: rgba(24,33,28,.94); }
.care-app[data-theme="dark"] .button.secondary,
.care-app[data-theme="dark"] .button.ghost,
.care-app[data-theme="dark"] .icon-btn { background: var(--surface-2); }

.bottom-nav { display: none; }

@media (min-width: 1180px) {
    .day-rhythm { grid-column: span 8; }
    .age-note { grid-column: span 4; }
    .quick-log { display: none; }
}

@media (max-width: 1180px) {
    .status-panel, .prediction-panel { grid-column: span 6; }
    .day-rhythm { grid-column: 1 / -1; }
    .age-note { grid-column: span 6; }
    .quick-log { grid-column: span 6; display: block !important; }
    .current-sleep-panel, .prediction-details { grid-column: span 5; }
    .plan-panel, .history-panel { grid-column: span 7; }
    .care-actions, .care-history { grid-column: span 7; }
    .feeding-timer-panel, .care-summary { grid-column: span 5; }
    .care-action-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-overview { grid-template-columns: repeat(3, 1fr); }
    .stats-overview article:nth-child(3) { border-right: 0; }
    .stats-overview article:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 900px) {
    :root { --topbar-height: 58px; }
    .care-app { display: block; min-height: 100svh; padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom)); }
    .side-nav { display: none; }
    .app-topbar { position: sticky; grid-template-columns: 1fr auto; height: var(--topbar-height); padding: 0 14px; }
    .topbar-center { display: none; }
    .user-button > span:last-child { display: none; }
    .app-main { padding: 18px 12px 32px; }
    .bottom-nav { position: fixed; z-index: 80; left: 0; right: 0; bottom: 0; height: calc(var(--bottom-nav-height) + var(--safe-bottom)); padding: 7px 6px var(--safe-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(250,249,245,.97); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
    .bottom-nav button { appearance: none; border: 0; background: transparent; color: var(--muted); display: grid; justify-items: center; align-content: center; gap: 2px; font-size: .68rem; border-radius: var(--radius-sm); }
    .bottom-nav button.active { color: var(--green-strong); background: var(--green-soft); }
    .bottom-nav svg { width: 19px; height: 19px; }
    .page-heading { margin-bottom: 14px; align-items: center; }
    .page-heading h1 { font-size: 2rem; }
    .page-heading .overline { display: none; }
    .heading-actions .button { font-size: .8rem; min-height: 36px; padding: .45rem .65rem; }
    .today-layout, .sleep-layout, .care-layout, .stats-layout, .settings-layout { grid-template-columns: 1fr; gap: 10px; }
    .status-panel, .prediction-panel, .metric-strip, .day-rhythm, .age-note, .quick-log,
    .current-sleep-panel, .plan-panel, .history-panel, .prediction-details,
    .care-actions, .feeding-timer-panel, .care-summary, .care-history,
    .stats-overview, .chart-panel, .rhythm-panel, .accuracy-panel, .care-correlation,
    .settings-section, .settings-section.wide { grid-column: 1; }
    .status-panel { min-height: 0; padding: 18px; }
    .prediction-panel { min-height: 0; padding: 18px; }
    .timer-display { font-size: clamp(3.2rem, 16vw, 5.2rem); margin-top: .8rem; }
    .status-copy { margin: .55rem 0 1rem; }
    .prediction-window { font-size: clamp(2rem, 9vw, 3rem); margin: 1rem 0 .8rem; }
    .prediction-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .prediction-meta dd { font-size: .82rem; }
    .metric-strip { grid-template-columns: repeat(2, 1fr); }
    .metric-strip article { border-bottom: 1px solid var(--line); }
    .metric-strip article:nth-child(2n) { border-right: 0; }
    .metric-strip article:nth-last-child(-n+2) { border-bottom: 0; }
    .day-rhythm, .age-note, .quick-log { padding: 18px; }
    .day-rhythm + .age-note + .quick-log { display: block; }
    .care-action-grid { grid-template-columns: repeat(2, 1fr); }
    .care-action-grid button { min-height: 88px; }
    .stats-overview { grid-template-columns: repeat(2, 1fr); }
    .stats-overview article { border-bottom: 1px solid var(--line); }
    .stats-overview article:nth-child(2n) { border-right: 0; }
    .stats-overview article:nth-last-child(-n+2) { border-bottom: 0; }
    .development-layout { grid-template-columns: 1fr; }
    .development-age, .development-copy, .development-preview { min-height: 220px; }
    .form-grid, .form-grid.compact-form { grid-template-columns: 1fr; }
    .form-grid > .button { width: 100%; }
    .notification-row { grid-template-columns: 1fr 80px; }
    .notification-row > *:nth-child(n+3) { margin-top: 4px; }
    .notification-drawer { top: 64px; right: 8px; }
    .toast-region { left: 12px; right: 12px; bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 12px); }
    .toast { min-width: 0; max-width: none; }
}

@media (max-width: 560px) {
    .topbar-child span:last-child { max-width: 150px; }
    .page-heading { gap: 8px; }
    .heading-actions { gap: 5px; }
    .status-header, .panel-heading-line { gap: 8px; }
    .timer-display { font-size: clamp(3rem, 17vw, 4.7rem); }
    .primary-actions .button { flex: 1; min-width: 130px; }
    .prediction-meta { grid-template-columns: 1fr; }
    .prediction-meta > div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: .7rem 0; }
    .prediction-meta > div:last-child { border-bottom: 0; }
    .prediction-meta dd { margin: 0; }
    .metric-strip article { padding: 14px; }
    .metric-strip strong { font-size: 1.18rem; }
    .timeline { height: 82px; }
    .quick-log-grid { grid-template-columns: repeat(4, 1fr); }
    .quick-log-grid button { min-height: 62px; display: grid; justify-items: center; gap: 3px; padding: .5rem .2rem; font-size: .72rem; text-align: center; }
    .event-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px; }
    .event-icon { width: 34px; height: 34px; }
    .care-action-grid button { grid-template-columns: 24px 1fr; padding: 11px; }
    .care-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-overview article { padding: 14px; }
    .sleep-chart { gap: 4px; min-height: 210px; }
    .chart-day { height: 170px; }
    .accuracy-gauge { grid-template-columns: 90px 1fr; }
    .gauge-ring { width: 90px; }
    .gauge-ring::before { inset: 9px; }
    .data-actions { grid-template-columns: 1fr; }
    .audit-row { grid-template-columns: 1fr; gap: 2px; }
    .app-dialog { width: calc(100vw - 12px); max-height: 94svh; }
    .dialog-shell { max-height: 94svh; }
    .dialog-shell > header, .dialog-body, .dialog-shell > footer { padding-left: 16px; padding-right: 16px; }
    .dialog-form { grid-template-columns: 1fr; }
    .dialog-form .full { grid-column: 1; }
    .choice-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-list { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
    .app-main { padding-left: 8px; padding-right: 8px; }
    .topbar-actions .icon-btn { width: 34px; height: 34px; }
    .user-button { display: none; }
    .metric-strip { grid-template-columns: 1fr; }
    .metric-strip article { border-right: 0; border-bottom: 1px solid var(--line) !important; }
    .metric-strip article:last-child { border-bottom: 0 !important; }
    .care-action-grid { grid-template-columns: 1fr 1fr; }
    .bottom-nav button { font-size: .62rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Extended sleep, import and generated content */
.sleep-tools, .knowledge-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 22px;
    min-width: 0;
}
.sleep-tools { grid-column: span 5; }
.knowledge-panel { grid-column: span 7; }
.muted-copy { color: var(--muted); line-height: 1.5; margin: .7rem 0 0; }
.sound-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 16px; }
.sound-controls button {
    appearance: none;
    min-height: 42px;
    padding: .55rem .7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    text-align: left;
}
.sound-controls button:hover { border-color: var(--line-strong); background: var(--surface); }
.sound-controls button.active { color: white; background: var(--green); border-color: var(--green); }
.volume-row { display: grid; grid-template-columns: auto minmax(100px, 1fr); gap: 12px; align-items: center; margin-top: 14px; color: var(--muted); font-size: .84rem; }
.volume-row input { min-height: 28px; padding: 0; accent-color: var(--green); }
.knowledge-list { display: grid; margin-top: 14px; border-top: 1px solid var(--line); }
.knowledge-list details { border-bottom: 1px solid var(--line); }
.knowledge-list summary { cursor: pointer; padding: .85rem 0; font-weight: 650; list-style-position: inside; }
.knowledge-list p { margin: 0 0 1rem; color: var(--ink-soft); line-height: 1.52; max-width: 72ch; }
.import-status { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); line-height: 1.45; }
.feeding-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.feeding-live { display: grid; gap: 12px; }
.feeding-live .large-time { font-size: clamp(2.7rem, 5vw, 4.8rem); line-height: 1; font-weight: 650; letter-spacing: -.045em; }
.feeding-sides { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); }
.feeding-sides span { display: flex; justify-content: space-between; gap: 8px; padding: .7rem .8rem; color: var(--muted); }
.feeding-sides span + span { border-left: 1px solid var(--line); }
.feeding-sides strong { color: var(--ink); }
.dialog-action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dialog-action-grid button { appearance: none; min-height: 92px; display: grid; place-items: center; align-content: center; gap: 8px; padding: .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.dialog-action-grid button:hover { background: var(--green-soft); border-color: var(--line-strong); }
.dialog-action-grid svg { width: 24px; height: 24px; color: var(--green); }
.detail-note { margin: 16px 0 0; padding: 13px 14px; border-left: 3px solid var(--green); background: var(--surface-2); color: var(--ink-soft); line-height: 1.5; }
.detail-note strong { color: var(--ink); }
.detail-note p { margin: .35rem 0 0; }
.detail-subsection { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.detail-subsection h3 { margin: 0; font-size: 1rem; }
.subevent-row { appearance: none; width: 100%; display: flex; justify-content: space-between; gap: 16px; padding: .75rem 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.subevent-row:hover { color: var(--green-strong); }
.detail-highlight { margin-bottom: 16px; padding: 18px; background: var(--green-soft); color: var(--green-strong); font-family: "Source Serif 4", Georgia, serif; font-size: 1.45rem; line-height: 1.2; }
.wide-field { grid-column: 1 / -1; }
.timeline-block:is(button) { appearance: none; padding: 0; border-top: 0; border-right: 0; border-bottom: 0; cursor: pointer; }
.chart-column { min-width: 0; display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 8px; }
.chart-column > span { color: var(--muted); font-size: .68rem; text-align: center; white-space: nowrap; }
.chart-stack { height: 210px; width: min(28px, 70%); display: flex; flex-direction: column-reverse; justify-content: flex-start; border-bottom: 1px solid var(--line-strong); overflow: hidden; }
.chart-stack i { display: block; width: 100%; min-height: 0; }
.chart-stack i.night { background: var(--blue); }
.chart-stack i.day { background: #90a8b8; }
.is-saving { cursor: progress; }
.is-saving button { cursor: progress; }

@media (max-width: 1180px) {
    .sleep-tools, .knowledge-panel { grid-column: span 6; }
}

@media (max-width: 900px) {
    .sleep-tools, .knowledge-panel { grid-column: 1; }
    .sound-controls { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .dialog-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dialog-action-grid button { min-height: 76px; }
    .feeding-sides { grid-template-columns: 1fr; }
    .feeding-sides span + span { border-left: 0; border-top: 1px solid var(--line); }
    .sound-controls { grid-template-columns: 1fr 1fr; }
    .volume-row { grid-template-columns: 1fr; gap: 4px; }
}

.transition-note {
    display: grid;
    gap: .35rem;
    margin-bottom: .75rem;
    padding: .85rem .95rem;
    border-left: 3px solid var(--accent, #64745f);
    background: color-mix(in srgb, var(--accent, #64745f) 8%, transparent);
}
.transition-note strong { font-size: .95rem; }
.transition-note p,
.transition-note small { margin: 0; }
.transition-note p { line-height: 1.45; }
.transition-note small { color: var(--muted, #6f6b63); }

.module-link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
}
.module-link-grid > * {
    min-width: 0;
    min-height: 76px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 18px;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.module-link-grid > * + * { border-left: 1px solid var(--line); }
.module-link-grid svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.module-link-grid .chevron { width: 16px; height: 16px; color: var(--muted); }
.module-link-grid span { display: grid; gap: .15rem; }
.module-link-grid strong { font-size: .95rem; }
.module-link-grid small { color: var(--muted); line-height: 1.35; }
@media (max-width: 620px) {
    .module-link-grid { grid-template-columns: 1fr; }
    .module-link-grid > * + * { border-left: 0; border-top: 1px solid var(--line); }
}


.visitor-manage-card {
    margin-top: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.05rem;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-alt) 72%, white 28%);
}
.visitor-manage-card strong {
    display: block;
    margin-bottom: .35rem;
    font-size: .98rem;
}
.visitor-manage-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}
.visitor-manage-card .button {
    white-space: nowrap;
}
@media (max-width: 720px) {
    .visitor-manage-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .visitor-manage-card .button {
        width: 100%;
        justify-content: center;
    }
}


.visitor-management-callout {
    border-left: 3px solid var(--accent);
}
.visitor-admin-link {
    color: inherit;
}
.visitor-admin-link strong {
    color: #8e3f34;
}
.visitor-manage-card {
    margin-top: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.05rem;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-alt) 72%, white 28%);
}
.visitor-manage-card strong {
    display: block;
    margin-bottom: .35rem;
    font-size: .98rem;
}
.visitor-manage-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}
.visitor-manage-card .button {
    white-space: nowrap;
}
@media (max-width: 720px) {
    .visitor-manage-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .visitor-manage-card .button {
        width: 100%;
        justify-content: center;
    }
}

/* V20 Wachstum */
.growth-app-layout {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}
.growth-birth-panel,
.growth-current-panel,
.growth-reference-panel,
.growth-history-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    min-width: 0;
}
.growth-birth-panel {
    grid-column: 1 / -1;
    padding: 22px;
}
.growth-current-panel {
    grid-column: span 7;
    padding: 22px;
}
.growth-reference-panel {
    grid-column: span 5;
    padding: 22px;
}
.growth-history-panel {
    grid-column: 1 / -1;
    padding: 22px;
}
.growth-birth-grid,
.growth-current-grid,
.growth-app-reference-grid {
    display: grid;
    gap: 0;
    margin-top: 16px;
    border: 1px solid var(--line);
}
.growth-birth-grid,
.growth-current-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.growth-birth-grid article,
.growth-current-grid article,
.growth-app-reference-grid article {
    min-width: 0;
    padding: 1rem;
}
.growth-birth-grid article + article,
.growth-current-grid article + article {
    border-left: 1px solid var(--line);
}
.growth-birth-grid span,
.growth-current-grid small,
.growth-app-reference-grid span,
.growth-app-reference-grid small {
    display: block;
    color: var(--muted);
    font-size: .76rem;
}
.growth-birth-grid strong,
.growth-current-grid strong {
    display: block;
    margin: .28rem 0;
    font-size: clamp(1.35rem, 2.8vw, 2.15rem);
    font-variant-numeric: tabular-nums;
}
.growth-birth-grid small,
.growth-current-grid em {
    color: var(--muted);
    font-size: .76rem;
    font-style: normal;
    line-height: 1.35;
}
.growth-current-grid article {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: .65rem;
}
.growth-current-grid article > span {
    font-size: 1.15rem;
}
.growth-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.growth-quick-actions button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--surface-2);
    color: var(--ink-soft);
    font-weight: 650;
    cursor: pointer;
}
.growth-app-reference-grid article {
    display: grid;
    gap: .22rem;
    border-bottom: 1px solid var(--line);
}
.growth-app-reference-grid article:last-child {
    border-bottom: 0;
}
.growth-app-reference-grid strong {
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}
.growth-app-note {
    margin: 1rem 0 0;
    padding-left: .8rem;
    border-left: 3px solid var(--green);
    color: var(--ink-soft);
    line-height: 1.5;
}
.growth-history-list {
    display: grid;
    margin-top: 16px;
    border-top: 1px solid var(--line);
}
.growth-history-row {
    appearance: none;
    width: 100%;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    padding: .85rem .25rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.growth-history-row > span {
    font-size: 1.05rem;
}
.growth-history-row div {
    display: grid;
    gap: .12rem;
}
.growth-history-row small {
    color: var(--muted);
}
.growth-history-row b {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 820px) {
    .growth-current-panel,
    .growth-reference-panel,
    .growth-birth-panel,
    .growth-history-panel {
        grid-column: 1 / -1;
    }
}
@media (max-width: 620px) {
    .growth-app-layout { grid-template-columns: 1fr; gap: 10px; }
    .growth-birth-panel,
    .growth-current-panel,
    .growth-reference-panel,
    .growth-history-panel { padding: 16px; }
    .growth-birth-grid,
    .growth-current-grid { grid-template-columns: 1fr; }
    .growth-birth-grid article + article,
    .growth-current-grid article + article { border-left: 0; border-top: 1px solid var(--line); }
    .growth-quick-actions { grid-template-columns: 1fr; }
    .growth-history-row { grid-template-columns: 28px minmax(0, 1fr) auto; }
}
