/* Cradle Clock — dark-first, calm night palette. Light mode overrides under [data-theme="light"]. */
/* Six color schemes. :root = Midnight (default). The others override via [data-theme]. */
:root, :root[data-theme="midnight"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1f242d; --surface-3: #262c37;
  --text: #e7ecf3; --muted: #9aa4b2; --border: #2a3038;
  --accent: #8aa1ff; --accent-text: #0f1115; --link: #8aa1ff;
  --good: #6fcf97; --warn: #f2c14e; --bad: #eb6f6f; --danger: #eb6f6f;
}
:root { --radius: 14px; --radius-lg: 22px; --deco: color-mix(in srgb, var(--accent) 34%, transparent); }

:root[data-theme="daylight"] {
  --bg: #f5f6fb; --surface: #ffffff; --surface-2: #eef0f7; --surface-3: #e4e7f1;
  --text: #1c2230; --muted: #5b6473; --border: #d9dce6;
  --accent: #5566e6; --accent-text: #ffffff; --link: #3f51d6;
  --good: #2f9e63; --warn: #c98a14; --bad: #cf4b4b; --danger: #cf4b4b;
}
:root[data-theme="nursery"] {
  --bg: #faf7f0; --surface: #ffffff; --surface-2: #f1ece1; --surface-3: #e7e0d2;
  --text: #2c2a24; --muted: #6f6a5d; --border: #e0d8c8;
  --accent: #7faf86; --accent-text: #ffffff; --link: #4f8f6a;
  --good: #5aa777; --warn: #c79a3e; --bad: #cf6f5f; --danger: #cf6f5f;
}
:root[data-theme="blush"] {
  --bg: #fdf4f6; --surface: #ffffff; --surface-2: #f8e9ee; --surface-3: #f1dbe3;
  --text: #2e2329; --muted: #7a6770; --border: #eed3dc;
  --accent: #e07a99; --accent-text: #ffffff; --link: #c45a7e;
  --good: #4caf7d; --warn: #d39a3c; --bad: #d9536b; --danger: #d9536b;
}
:root[data-theme="amber"] {
  --bg: #15110b; --surface: #1d1810; --surface-2: #261f15; --surface-3: #30271a;
  --text: #f0e7d8; --muted: #b09a7e; --border: #34291b;
  --accent: #f0a85a; --accent-text: #15110b; --link: #f0a85a;
  --good: #9bc46a; --warn: #e8b54e; --bad: #e07a5a; --danger: #e07a5a;
}
:root[data-theme="lavender"] {
  --bg: #f6f5fc; --surface: #ffffff; --surface-2: #efecf8; --surface-3: #e6e1f2;
  --text: #2a2440; --muted: #6b6480; --border: #e2dcf0;
  --accent: #7c5fd3; --accent-text: #ffffff; --link: #6a4fc0;
  --good: #4caf7d; --warn: #c98a14; --bad: #d9536b; --danger: #d9536b;
}
:root[data-theme="ocean"] {
  --bg: #0c1418; --surface: #121c22; --surface-2: #17242c; --surface-3: #1f2f39;
  --text: #e2eef2; --muted: #8aa3ac; --border: #223038;
  --accent: #3fc2d4; --accent-text: #06232a; --link: #6fd6e4;
  --good: #6fcf97; --warn: #e9c45f; --bad: #e88a7a; --danger: #e88a7a;
}
:root[data-theme="sunshine"] {
  --bg: #fffdf3; --surface: #ffffff; --surface-2: #fbf4dc; --surface-3: #f6ecc8;
  --text: #3a3320; --muted: #7a6f4d; --border: #efe3c0;
  --accent: #eab308; --accent-text: #2a2200; --link: #b88a06;
  --good: #4caf7d; --warn: #cf8a14; --bad: #d9536b; --danger: #d9536b;
}
:root[data-theme="bubblegum"] {
  --bg: #fff1f7; --surface: #ffffff; --surface-2: #fde3ef; --surface-3: #fbd3e5;
  --text: #3a1f2c; --muted: #86616f; --border: #f6cfe0;
  --accent: #ec4899; --accent-text: #ffffff; --link: #d02d80;
  --good: #4caf7d; --warn: #cf9a3c; --bad: #d9536b; --danger: #d9536b;
}
:root[data-theme="cottoncandy"] {
  --bg: #fbf3fb; --surface: #ffffff; --surface-2: #f4e8f6; --surface-3: #ecdcf0;
  --text: #33263a; --muted: #756880; --border: #ecd8f0;
  --accent: #c563cf; --accent-text: #ffffff; --link: #a94fc0;
  --good: #4caf7d; --warn: #cf9a3c; --bad: #d9536b; --danger: #d9536b;
}

/* Clean, solid palettes — paired with data-plain to drop all background art (see below). */
:root[data-theme="snow"] {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #eef1f5; --surface-3: #e3e8ef;
  --text: #14181f; --muted: #5a6472; --border: #dce1e8;
  --accent: #4f46e5; --accent-text: #ffffff; --link: #4338ca;
  --good: #16a34a; --warn: #b45309; --bad: #dc2626; --danger: #dc2626;
}
:root[data-theme="slate"] {
  --bg: #0f172a; --surface: #1a2439; --surface-2: #222e46; --surface-3: #2c3a56;
  --text: #e6ecf5; --muted: #93a1b8; --border: #2a3750;
  --accent: #38bdf8; --accent-text: #06202e; --link: #7dd3fc;
  --good: #34d399; --warn: #fbbf24; --bad: #f87171; --danger: #f87171;
}
:root[data-theme="mint"] {
  --bg: #f1faf5; --surface: #ffffff; --surface-2: #e6f4ec; --surface-3: #d7ece0;
  --text: #15271e; --muted: #5a7365; --border: #d2e7db;
  --accent: #10b981; --accent-text: #ffffff; --link: #059669;
  --good: #16a34a; --warn: #b45309; --bad: #dc2626; --danger: #dc2626;
}
:root[data-theme="graphite"] {
  --bg: #121317; --surface: #1b1d22; --surface-2: #23262d; --surface-3: #2d313a;
  --text: #eceef2; --muted: #9aa1ad; --border: #2b2f37;
  --accent: #a5b4fc; --accent-text: #10131a; --link: #c7d2fe;
  --good: #6ee7b7; --warn: #fcd34d; --bad: #fca5a5; --danger: #fca5a5;
}
:root[data-theme="sky"] {
  --bg: #f1f6fd; --surface: #ffffff; --surface-2: #e6eefb; --surface-3: #d7e4f7;
  --text: #16202e; --muted: #566072; --border: #d4e0f0;
  --accent: #2563eb; --accent-text: #ffffff; --link: #1d4ed8;
  --good: #16a34a; --warn: #b45309; --bad: #dc2626; --danger: #dc2626;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  /* Soft multi-hue gradient washes (recolor per scheme via accent/good/warn). */
  background-image:
    radial-gradient(42rem 42rem at 6% -8%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%),
    radial-gradient(36rem 36rem at 106% 4%, color-mix(in srgb, var(--good) 26%, transparent), transparent 60%),
    radial-gradient(40rem 40rem at 50% 114%, color-mix(in srgb, var(--warn) 22%, transparent), transparent 62%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* Clean palettes (data-plain): no motif, no sheep, no gradient washes — just the solid color. */
:root[data-plain] body { background-image: none; }
:root[data-plain] .bg-deco, :root[data-plain] .sheep-layer { display: none; }

/* Decorative baby-motif pattern layer — behind all content, drifts gently. */
.bg-deco { position: fixed; top: -6%; left: -6%; width: 112%; height: 112%; z-index: -1; pointer-events: none; opacity: 0.9; animation: bw-drift 26s ease-in-out infinite alternate; }
.bg-deco .deco-motif { fill: var(--deco); }
@keyframes bw-drift { from { transform: translate(0, 0); } to { transform: translate(2.2%, 1.8%); } }
@media (prefers-reduced-motion: reduce) { .bg-deco { animation: none; } }

/* Counting sheep — a few that hop gently in the background. Transform-only (GPU), 4 elements, so it's
   basically free. Recolors per scheme; sits behind all content. */
.sheep-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sheep { position: absolute; width: 54px; height: 40px; opacity: 0.8; will-change: transform; animation: sheep-hop 8s ease-in-out infinite; }
.sheep .sheep-wool { fill: color-mix(in srgb, var(--accent) 26%, var(--surface)); }
.sheep .sheep-face { fill: color-mix(in srgb, var(--text) 55%, transparent); }
.sheep .sheep-eye  { fill: var(--surface); }
.sheep .sheep-legs { fill: color-mix(in srgb, var(--text) 45%, transparent); }
.sheep-1 { left: 7%;  top: 20%; }
.sheep-2 { left: 70%; top: 37%; width: 42px; height: 31px; animation-delay: 2s; }
.sheep-3 { left: 24%; top: 70%; width: 48px; height: 35px; animation-delay: 4.2s; }
.sheep-4 { left: 78%; top: 77%; width: 38px; height: 28px; animation-delay: 6s; }
.sheep-5 { left: 84%; top: 13%; width: 40px; height: 29px; animation-delay: 1s; }
.sheep-6 { left: 4%;  top: 48%; width: 46px; height: 34px; animation-delay: 3s; }
.sheep-7 { left: 45%; top: 85%; width: 44px; height: 32px; animation-delay: 5.2s; }
.sheep-8 { left: 88%; top: 60%; width: 34px; height: 25px; animation-delay: 7.2s; }
@keyframes sheep-hop {
  0%, 68%, 100% { transform: translateY(0); }
  74% { transform: translateY(-15px); }
  80% { transform: translateY(0); }
  84% { transform: translateY(-7px); }
  88% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .sheep { animation: none; } }

/* Screen-flash when a feeding is due (respects reduced-motion). */
@keyframes cc-flash { 0%,100% { background: var(--bg); } 50% { background: color-mix(in srgb, var(--warn) 28%, var(--bg)); } }
body.cc-flash { animation: cc-flash 0.9s ease-in-out 4; }
@media (prefers-reduced-motion: reduce) { body.cc-flash { animation: none; } }

/* Layout shell */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.app-header .brandrow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-header .app-logo { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.app-header .baby { display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-header .headright { display: flex; align-items: center; gap: 8px; flex: none; }

/* Baby-photo avatar (header button) + big version in the profile menu. Center-crops via object-fit. */
.avatarbtn { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; line-height: 0; -webkit-tap-highlight-color: transparent; }
.avatar { border-radius: 50%; object-fit: cover; display: block; background: var(--surface-2); }
.avatar.sm { width: 46px; height: 46px; border: 2px solid color-mix(in srgb, var(--accent) 60%, var(--border)); }
.avatar.lg { width: 128px; height: 128px; border: 3px solid color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
.avatar.ph { display: grid; place-items: center; font-weight: 800; color: var(--accent-text); background: var(--accent); }
.avatar.sm.ph { font-size: 1.25rem; }
.avatar.lg.ph { font-size: 3.4rem; }
.profile-sheet { text-align: center; }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 14px; }
.profile-name { font-weight: 800; font-size: 1.25rem; }
.profile-sheet .btn { margin-top: 8px; }
.app-header h1 { font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .baby select { max-width: 46vw; }
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 16px 96px; }

/* Bottom tab nav — one-handed */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  background: none; border: 0; color: var(--muted); padding: 10px 4px 12px;
  font-size: 0.72rem; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 56px;
}
.tabbar button .ico { font-size: 1.25rem; line-height: 1; }
.tabbar button.active { color: var(--accent); }

/* Buttons */
button { font: inherit; cursor: pointer; }
.btn {
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); padding: 12px 16px; min-height: 48px; width: 100%;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: transparent; }
.btn.sm { min-height: 40px; padding: 8px 12px; width: auto; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; min-height: 40px; min-width: 40px; padding: 6px 10px; font-size: 1.1rem; line-height: 1; }
.row { display: flex; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Inputs */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 64px; resize: vertical; }
label.field { display: block; }
label.field > span { display: block; font-size: 0.82rem; color: var(--muted); margin: 0 0 4px 2px; }

/* Home — hero feeding button + countdown */
.hero { text-align: center; padding: 8px 0 4px; }
.bigbtn {
  width: 220px; height: 220px; max-width: 64vw; max-height: 64vw; aspect-ratio: 1;
  border-radius: 50%; border: 0; margin: 8px auto; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.bigbtn .lbl { font-size: 1.35rem; font-weight: 800; letter-spacing: 0.3px; }
.bigbtn .sub { font-size: 0.85rem; opacity: 0.8; margin-top: 4px; }
.bigbtn.feeding { background: var(--good); }
.bigbtn.sleeping { background: var(--surface-2); color: var(--text); border: 2px solid var(--border); }

/* Idle home: two co-equal, always-available actions — Start Feeding + Start Sleep. */
.actgrid { display: flex; gap: 12px; margin: 6px 0 10px; }
.actbtn {
  flex: 1; min-height: 132px; border: 0; border-radius: 22px; cursor: pointer; padding: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.16); -webkit-tap-highlight-color: transparent;
}
.actbtn:active { transform: translateY(1px); }
.actbtn .ico { font-size: 2.6rem; line-height: 1; }
.actbtn .lbl { font-weight: 800; font-size: 1.06rem; }
.actbtn.feed  { background: var(--accent); color: var(--accent-text); }
.actbtn.sleep { background: color-mix(in srgb, #6a5acd 78%, var(--surface)); color: #ffffff; }
/* Sleeping: a live stopwatch, tracked just like a feeding. */
.sleepnow { text-align: center; padding: 12px 0 2px; }
.sleepnow .moon { font-size: 2.6rem; line-height: 1; margin-bottom: 4px; }

.stopwatch { font-variant-numeric: tabular-nums; font-size: 3rem; font-weight: 800; letter-spacing: 1px; }
.stopwatch.paused { color: var(--warn); }

/* Countdown card */
.count {
  margin: 14px 0; padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface); text-align: center;
}
.count .due { font-size: 1.05rem; }
.count .big { font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0; }
.count.early .big { color: var(--text); }
.count.window .big { color: var(--warn); }
.count.overdue .big { color: var(--bad); }
.count .win { font-size: 0.85rem; color: var(--muted); }

/* Today's rhythm (day plan) */
.plan { margin: 14px 0; }
.plan .planhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.planlist { display: flex; flex-direction: column; }
.planrow { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.planrow:last-child { border-bottom: 0; }
.planrow .pi { width: 18px; text-align: center; color: var(--muted); font-weight: 700; }
.planrow .pt { font-variant-numeric: tabular-nums; font-weight: 600; }
.planrow .pl { color: var(--muted); font-size: 0.82rem; margin-left: auto; }
.planrow .pedit-btn { background: none; border: 0; padding: 2px 6px; margin-left: 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; min-height: auto; }
.planrow .pedit-btn .pico { font-size: 1.15rem; line-height: 1; color: var(--accent); }
.planrow .pedit-btn .plbl { font-size: 0.62rem; color: var(--muted); }
.planrow .plog-btn .pico { color: #b08bd8; }
.planrow.done .pt { color: var(--muted); }
.planrow.done .pi { color: var(--good); }
.planrow.past { opacity: 0.5; }
.planrow.next { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 10px; border-bottom-color: transparent; padding-left: 8px; padding-right: 8px; }
.planrow.next .pi, .planrow.next .pt { color: var(--accent); }
.planrow.next .pl { color: var(--accent); font-weight: 600; }
.planrow.dream .pi, .planrow.dream .pl { color: #b08bd8; }
.planrow.dream .pt { color: var(--text); }
.planfoot { font-size: 0.75rem; margin-top: 8px; }
/* Two-column "Today's rhythm" (reuses .rc-table styles). */
.plan-table { margin-top: 6px; }
.plan-table .pedit-btn { background: none; border: 0; padding: 0 4px; margin-left: 6px; display: inline-flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; min-height: auto; vertical-align: middle; }
.plan-table .pedit-btn .pico { font-size: 1.05rem; line-height: 1; color: var(--accent); }
.plan-table .pedit-btn .plbl { font-size: 0.58rem; color: var(--muted); }
.plan-table .plog-btn .pico { color: #b08bd8; }
.plan-table tr.plan-next td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.plan-table .rc-nextcell { color: var(--accent); font-weight: 700; }
.plan-table .rc-next-i { margin-right: 1px; }
.plan-table tr.plan-night .rc-nlabel { font-size: 0.82rem; }

/* Warning banner */
.warnbar {
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 15;
  background: color-mix(in srgb, var(--warn) 22%, var(--surface)); border: 1px solid var(--warn);
  border-radius: 12px; padding: 12px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px;
}
.warnbar .msg { flex: 1; font-weight: 600; }

/* Cards / timeline */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-card { display: flex; gap: 12px; align-items: flex-start; }
.tl-card .when { width: 64px; flex: none; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.tl-card .body { flex: 1; min-width: 0; }
.tl-card .head { display: flex; align-items: center; gap: 8px; }
.tl-card .title { font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.none { background: var(--muted); }
.kind-feeding { border-left: 3px solid var(--accent); }
.kind-sleep { border-left: 3px solid #b08bd8; }
.kind-note { border-left: 3px solid var(--muted); }
.kind-diaper { border-left: 3px solid var(--warn); }
/* One-tap diaper row (Home) */
.diaperbar { display: flex; flex-direction: column; gap: 4px; align-items: center; margin-top: 10px; }
.diaperbar .row { width: 100%; }
.btn.dbtn { flex: 1; min-height: 44px; padding: 8px 4px; font-size: .92rem; }
.diapercount { font-size: .78rem; }
/* Solids (Home) — a full-width THIRD action tile, a peer of Start Feeding / Start Sleep, sitting
   directly beneath them. Shorter than those two (row layout, not column) so it reads as the third
   action without dominating the screen. */
.kind-solids { border-left: 3px solid #79b473; }
.solidbar { display: flex; flex-direction: column; gap: 6px; margin: -4px 0 12px; }
.actbtn.solids {
  flex: none; width: 100%; min-height: 78px; flex-direction: row; gap: 12px;
  background: color-mix(in srgb, #79b473 84%, var(--surface)); color: #ffffff;
}
.actbtn.solids .ico { font-size: 2rem; }
.actbtn.solids .lbl { font-size: 1.04rem; }
.solidmeta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.solidmeta .muted { font-size: .78rem; }
.btn.sm.sbtn { width: auto; flex: none; min-height: 32px; padding: 5px 10px; font-size: .78rem; }
/* A solid folded into its feeding card: one compact line, full editor behind ✎. */
.solid-sub { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.ss-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ss-check { color: #79b473; font-weight: 800; }
.ss-food { font-weight: 700; font-size: .92rem; }
.ss-meta { font-size: .8rem; }
.ss-head .pedit-btn { margin-left: auto; }
/* The 3-day allergy watch line — quiet, but the accent color makes it findable. */
.solidwatch { font-size: .78rem; font-weight: 600; color: color-mix(in srgb, var(--accent) 80%, var(--text)); }
.tag.tag-bad { background: color-mix(in srgb, var(--bad) 18%, var(--surface-2)); border-color: var(--bad); color: var(--bad); }
/* Severe symptom -> red "call your pediatrician". Mild symptom / two-new-foods -> amber caution. */
.solid-alert { background: color-mix(in srgb, var(--bad) 16%, var(--surface)); border: 1px solid var(--bad); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: .84rem; line-height: 1.45; }
.solid-alert strong { display: block; margin-bottom: 3px; }
.solid-caution { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); border: 1px solid var(--warn); color: color-mix(in srgb, var(--warn) 80%, var(--text)); border-radius: 10px; padding: 8px 10px; font-size: .8rem; line-height: 1.45; }
.detailline { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.cardactions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

/* Side toggle + steppers */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { background: var(--surface-2); border: 0; color: var(--text); padding: 8px 14px; min-height: 40px; }
.seg button.on { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.seg.seg-wrap { display: flex; flex-wrap: wrap; gap: 6px; border: 0; overflow: visible; }
.seg.seg-wrap button { border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; }
.seg.seg-wrap button.on { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.seg.seg-wrap .chip-other { border-style: dashed; color: var(--muted); }

/* The whole fill-in form sits on a solid panel (like the app's cards) so the animated background
   decorations don't bleed through the fields and labels — on the busy light schemes the transparent
   form was unreadable. */
.logform {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.logform > .screen-title { margin-top: 0; }
/* The post-feeding fill-in form (and the feeding editor): tint the boxes toward the scheme's accent
   with a stronger border so the fields stand out on every background — the plain surface-2 fill was
   nearly invisible on the light schemes. Selected toggles keep the solid-accent look. */
.logform input, .logform select, .logform textarea {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  border-width: 1.5px;
}
.logform input::placeholder, .logform textarea::placeholder { color: color-mix(in srgb, var(--text) 55%, transparent); }
.logform .seg { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); border-width: 1.5px; }
.logform .seg button:not(.on) { background: color-mix(in srgb, var(--accent) 20%, var(--surface-2)); }
.logform .seg.seg-wrap button:not(.on) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
}
/* "Write today's summary" + "Done" get the same accent tint as the fields so they don't disappear. */
.logform .btn.hilite {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  border-width: 1.5px;
}
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 1.2rem; }
.stepper .val { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }

/* Day header */
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dayhead .date { font-weight: 700; }

/* Start-side cue (which breast to start on) — prominent on Home */
.sidecue { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; padding: 12px 14px; border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--border)); }
.sidecue-ico { font-size: 1.7rem; color: var(--accent); line-height: 1; }
.sidecue-txt { flex: 1; }
.sidecue-k { font-size: 0.78rem; color: var(--muted); }
.sidecue-v { font-size: 1.25rem; font-weight: 800; color: var(--text); letter-spacing: 0.2px; }
.sidecue-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sidecue-toggle .sc-btn { background: var(--surface-2); border: 0; color: var(--muted); width: 40px; min-height: 40px; font-weight: 800; }
.sidecue-toggle .sc-btn.on { background: var(--accent); color: var(--accent-text); }
.sidenow { text-align: center; font-weight: 700; color: var(--accent); margin: 2px 0 10px; }

/* Rhythm plan-vs-actual — two columns (planned | actual) in the daily summary */
.rhythm { margin: 4px 0 12px; }
.rc-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; font-size: 0.95rem; }
.rc-title .rc-sub { font-size: 0.74rem; font-weight: 400; white-space: nowrap; }
.rc-table { width: 100%; border-collapse: collapse; margin: 8px 0 6px; }
.rc-table th { text-align: left; font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px 6px; border-bottom: 1px solid var(--border); }
.rc-table td { padding: 6px 8px; font-size: 0.98rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); vertical-align: middle; }
.rc-table tr:last-child td { border-bottom: 0; }
.rc-table th:last-child, .rc-table td:last-child { border-left: 1px solid var(--border); width: 52%; }
.rc-ptime { color: var(--muted); }
.rc-actcell { display: inline-flex; align-items: center; gap: 8px; }
.rc-dot2 { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.rc-dot2.on { background: var(--good); }
.rc-dot2.close { background: var(--warn); }
.rc-dot2.off { background: var(--bad); }
.rc-dot2.none { background: var(--muted); }
.rc-atime { font-weight: 600; }
.rc-delta { font-size: 0.72rem; color: var(--muted); }
.rc-blank { color: var(--muted); opacity: 0.5; }
.rc-legend { font-size: 0.74rem; }
.rc-legend .lg-on { color: var(--good); }
.rc-legend .lg-close { color: var(--warn); }
.rc-legend .lg-off { color: var(--bad); }
/* Longest sleep — the key metric (sleeping through the night), called out at the bottom of the rhythm */
.rc-night { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); font-weight: 600; }
.rc-night b { font-weight: 800; color: var(--accent); font-size: 1.05rem; }
.rc-night.goal8 { background: color-mix(in srgb, var(--good) 20%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--good) 55%, transparent); }
.rc-night.goal8 b { color: var(--good); }

/* 8-hour celebration overlay */
.cele-back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0,0,0,0.55); overflow: hidden; padding: 20px; }
.cele-confetti { position: absolute; inset: 0; pointer-events: none; }
.cele-confetti i { position: absolute; top: -24px; width: 10px; height: 14px; border-radius: 2px; opacity: 0.92; animation: cele-fall linear infinite; }
@keyframes cele-fall { 0% { transform: translateY(-24px) rotate(0); } 100% { transform: translateY(108vh) rotate(760deg); } }
.cele-card { position: relative; z-index: 1; background: var(--surface); border-radius: 22px; padding: 26px 22px; max-width: 340px; width: 88%; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,0.45); animation: cele-pop 0.5s cubic-bezier(.2,1.5,.4,1); }
@keyframes cele-pop { 0% { transform: scale(0.55); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.cele-trophy { font-size: 3.6rem; line-height: 1; animation: cele-bounce 1.1s ease-in-out infinite; }
@keyframes cele-bounce { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-9px) scale(1.09); } }
.cele-h { font-size: 2rem; font-weight: 900; margin: 8px 0 4px; background: linear-gradient(90deg, var(--accent), var(--good)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cele-sub { color: var(--text); margin-bottom: 14px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .cele-confetti i, .cele-trophy, .cele-card { animation: none; } }

/* Paused state */
.paused-hero { text-align: center; padding: 26px 18px; margin: 8px 0; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.paused-hero .ph-badge { font-size: 2.6rem; line-height: 1; }
.paused-hero .ph-title { font-size: 1.3rem; font-weight: 800; margin: 10px 0 6px; }
.paused-hero .ph-sub { font-size: 0.92rem; line-height: 1.5; margin: 0 auto 16px; max-width: 34ch; }
.paused-hero .ph-resume { max-width: 280px; margin: 0 auto; }
.paused-hero .ph-foot { font-size: 0.78rem; margin: 12px 0 0; }
.pausecard.on { border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }

/* Summary card */
.summary { margin-top: 16px; border: 1px dashed var(--border); }
.summary .metrics { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.summary .final { font-size: 1.02rem; }

/* History */
.hist-day { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.hist-day .d { font-weight: 700; }
.hist-day .s { color: var(--muted); font-size: 0.9rem; }

/* Weekly summary grid */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.week-nav .wk-label { font-weight: 700; }
.week-nav button { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; min-height: 40px; width: 46px; font-size: 1.2rem; line-height: 1; }
.week-nav button:disabled { opacity: 0.35; }
.week-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
table.week { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
table.week th, table.week td { padding: 9px 10px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.week tbody tr:last-child td { border-bottom: 0; }
table.week thead th { background: var(--surface-2); font-weight: 600; }
table.week thead .dow { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.02em; }
table.week thead .dnum { color: var(--text); font-weight: 700; font-size: 1rem; }
table.week .rowlabel { text-align: left; font-weight: 600; color: var(--text); position: sticky; left: 0; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
table.week thead .rowlabel { background: var(--surface-2); }
table.week .col-total { font-weight: 700; background: var(--surface-2); }
table.week .col-today { background: color-mix(in srgb, var(--accent) 14%, transparent); }
table.week thead .col-today .dnum { color: var(--accent); }
table.week .z { color: var(--muted); }
/* Rhythm-detail cell: small dot + actual feed time */
table.week .owc { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
table.week .owc .rc-dot2 { width: 9px; height: 9px; box-shadow: none; }
table.week.rhythm-week td, table.week.rhythm-week th { font-size: 0.82rem; }
/* Night sleep — the goal row: bolder, separated, accent label. */
table.week tr.week-goal td { font-weight: 700; border-top: 2px solid var(--border); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
table.week tr.week-goal .rowlabel { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
table.week tr.week-goal .col-today { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
table.week .rec { color: var(--accent); white-space: nowrap; }
table.week .rec-badge { margin-left: 3px; }
.week-note { font-size: 0.78rem; line-height: 1.5; margin-top: 4px; }

/* Sheet / modal */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; width: 100%; max-width: 640px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0 0 12px; }
@media (min-width: 560px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; border-bottom: 1px solid var(--border); } }
.fb-preview { display: flex; flex-direction: column; gap: 4px; }
.fb-thumb { max-width: 100%; max-height: 240px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.fb-item { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
/* The solids sheet + foods-tried list are tall — let them scroll instead of running off a phone. */
.solids-sheet, .foods-sheet { max-height: 92vh; overflow-y: auto; }
.foods-list { gap: 8px; }
.fb-inbox { max-height: 60vh; overflow: auto; }
/* The daily-summary sheet is meant to be read at a glance — give it room so the whole recap shows
   without scrolling. The editor textarea auto-grows to its content (capped at 60vh) in app.js. */
.summary-sheet { max-width: 720px; max-height: 92vh; overflow-y: auto; }
.summary-sheet .summary { border: 0; margin-top: 0; }
.summary-sheet .summary .final { font-size: 1.1rem; line-height: 1.62; }
.summary-sheet .summary .metrics { font-size: 0.95rem; }
.summary-sheet textarea.sum-ta { min-height: 220px; font-size: 1.06rem; line-height: 1.55; }

/* Guide TL;DR list */
.tldr { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 7px; }
.tldr li { font-size: 0.9rem; line-height: 1.5; color: var(--text); }
.tldr li b { color: var(--text); }
.card.stack a, .wwfeedback a { color: var(--link); text-decoration: underline; }

/* Age-aware wake-window coach (Home) */
.awakecoach { text-align: center; margin: 10px auto 2px; padding: 8px 14px; border-radius: 12px; max-width: 330px; }
.awakecoach .ac-main { font-weight: 700; font-size: 1.02rem; }
.awakecoach .ac-sub { font-size: 0.8rem; margin-top: 2px; color: var(--muted); }
.awakecoach.ac-window { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.awakecoach.ac-window .ac-main { color: color-mix(in srgb, var(--warn) 82%, var(--text)); }
.awakecoach.ac-window .ac-sub { color: color-mix(in srgb, var(--warn) 72%, var(--text)); }
.awakecoach.ac-late { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.awakecoach.ac-late .ac-main, .awakecoach.ac-late .ac-sub { color: var(--bad); }

/* Wake-window feedback line in the daily summary */
.wwfeedback { font-size: 0.84rem; color: var(--muted); margin: 4px 0 6px; line-height: 1.45; }
/* Ideal wake-window reference line shown in the rhythm sections */
.plan-wake { font-size: 0.8rem; color: color-mix(in srgb, var(--accent) 80%, var(--text)); margin: -2px 0 8px; font-weight: 600; }

/* Disclaimer */
.disclaimer { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 78px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.toast-undo { display: flex; align-items: center; gap: 12px; }
.toast-btn { background: none; border: 0; color: var(--link, #6ea8fe); font-weight: 700; padding: 2px 4px; min-height: auto; cursor: pointer; }
.pending { font-size: 0.78rem; color: var(--warn); }
.app-footer { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 8px 0 2px; }
h2.screen-title { font-size: 1.2rem; margin: 4px 0 14px; }

/* Color-scheme swatch picker */
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 62px; min-height: auto; cursor: pointer; }
.swatch .chip { width: 46px; height: 46px; border-radius: 50%; border: 2px solid; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
.swatch .chip .acc { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,0.18); }
.swatch.on .chip { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch .nm { font-size: 0.72rem; color: var(--muted); }
.swatch.on .nm { color: var(--text); font-weight: 700; }

/* Install prompt bar */
.installbar { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; }
.installbar .msg { flex: 1; font-weight: 600; font-size: 0.92rem; }

/* Loading indicator */
.loadingbox { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 72vh; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
