/* ---------- Theme tokens ---------- */
:root {
  --brand: #3f7d72;
  --brand-soft: #e3f0ec;
  --bg: #f5f6f9;
  --card: #ffffff;
  --card-2: #f0f2f6;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e6e8ee;
  --shadow: 0 1px 3px rgba(20, 22, 28, .06), 0 6px 18px rgba(20, 22, 28, .05);

  --feed: #2e9e8f;
  --diaper: #d9952f;
  --sleep: #7c6cd6;
  --pump: #d2689b;
  --note: #6b7280;
  --med: #c2657a;

  --radius: 18px;
  --tap: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"], :root[data-theme="dark"] {
  --brand: #5fb3a4;
  --brand-soft: #1d2a28;
  --bg: #121419;
  --card: #1d212b;
  --card-2: #262b37;
  --text: #e7e9ee;
  --muted: #9aa0ad;
  --line: #2c313d;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.35);

  --feed: #46b9a8;
  --diaper: #e0aa55;
  --sleep: #9a8bf0;
  --pump: #e285b3;
  --note: #9aa0ad;
  --med: #d98199;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #5fb3a4;
    --brand-soft: #1d2a28;
    --bg: #121419;
    --card: #1d212b;
    --card-2: #262b37;
    --text: #e7e9ee;
    --muted: #9aa0ad;
    --line: #2c313d;
    --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.35);
    --feed: #46b9a8;
    --diaper: #e0aa55;
    --sleep: #9a8bf0;
    --pump: #e285b3;
    --note: #9aa0ad;
    --med: #d98199;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.4;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 17px; }

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.baby-summary { flex: 1; min-width: 0; }
.baby-summary .name { font-weight: 700; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.baby-summary .age { color: var(--muted); font-size: 14px; }
.ask-btn { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 15px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 15px; box-shadow: var(--shadow); flex: 0 0 auto; }
.ask-btn:active { transform: scale(.97); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  font-size: 20px; color: var(--muted);
  display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow);
}

/* ---------- Main view ---------- */
#view { flex: 1; padding: 16px 16px 96px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 10px; font-weight: 700; }
.section-title:first-child { margin-top: 4px; }

/* Since-last cards */
.since-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.since-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); border-left: 4px solid var(--line);
}
.since-card .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.since-card .big { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.since-card .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.since-card.feed { border-left-color: var(--feed); }
.since-card.diaper { border-left-color: var(--diaper); }
.since-card.sleep { border-left-color: var(--sleep); }
.since-card.pump { border-left-color: var(--pump); }
.since-card.med { border-left-color: var(--med); }
.since-card .due { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--brand); }
.since-card .due.over { color: #d9534f; }

/* "Since last" header row with the widget-editor button */
.st-row { display: flex; align-items: center; justify-content: space-between; }
.st-edit { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }

/* Widget editor rows */
.wg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.wg-row select { flex: 1; min-width: 110px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.wg-row input[type=text] { flex: 1 1 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.wg-period { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.wg-period input { width: 64px; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-align: center; }
.wg-del { width: 38px; height: 38px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: #d9534f; font-weight: 700; }

/* Medicine name chips in the med log sheet */
.med-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.med-chip { padding: 9px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; color: var(--text); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.feed{background:var(--feed)} .dot.diaper{background:var(--diaper)} .dot.sleep{background:var(--sleep)} .dot.pump{background:var(--pump)} .dot.note{background:var(--note)} .dot.med{background:var(--med)}

/* Quick actions */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-btn {
  min-height: var(--tap); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 18px; font-weight: 600; padding: 16px;
  border: 1px solid var(--line);
  transition: transform .06s ease;
}
.quick-btn:active { transform: scale(.97); }
.quick-btn .qi { width: 12px; height: 12px; border-radius: 50%; }
.quick-btn.feed .qi{background:var(--feed)} .quick-btn.diaper .qi{background:var(--diaper)} .quick-btn.sleep .qi{background:var(--sleep)} .quick-btn.pump .qi{background:var(--pump)} .quick-btn.more .qi{background:var(--note)}

/* ---------- Timeline / events ---------- */
.day-head { font-size: 14px; font-weight: 700; color: var(--muted); margin: 18px 4px 8px; }
.event {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow); margin-bottom: 8px;
}
.event .ev-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.event .ev-body { flex: 1; min-width: 0; }
.event .ev-title { font-weight: 600; }
.event .ev-meta { font-size: 14px; color: var(--muted); }
.event .ev-time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.event .ev-edit { color: var(--muted); font-size: 18px; padding: 4px 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- Sleep banner ---------- */
.sleep-banner {
  position: fixed; left: 0; right: 0; bottom: calc(72px + var(--safe-bottom));
  max-width: 560px; margin: 0 auto;
  background: var(--sleep); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-radius: 14px; width: calc(100% - 24px);
  left: 50%; transform: translateX(-50%);
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 25;
}
.sleep-banner.hidden { display: none; }
.sleep-banner .sb-txt { font-weight: 600; }
.sleep-banner .sb-sub { font-size: 13px; opacity: .85; font-weight: 400; }
.sleep-banner button { background: rgba(255,255,255,.22); color:#fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  display: flex; background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  z-index: 30;
}
.tab {
  flex: 1; padding: 10px 0 8px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600;
}
.tab .tab-ico { font-size: 20px; }
.tab.active { color: var(--brand); }

/* ---------- Milestones ---------- */
.ms-disclaimer { font-size: 13px; color: var(--muted); background: var(--card-2); padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.ms-stage { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.ms-stage-head { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-left: 4px solid var(--line); }
.ms-stage.current .ms-stage-head { border-left-color: var(--brand); background: var(--brand-soft); }
.ms-stage-head .st-name { font-weight: 700; }
.ms-stage-head .st-tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.st-tag.now { background: var(--brand); color: #fff; }
.st-tag.past { background: var(--card-2); color: var(--muted); }
.st-tag.next { background: var(--card-2); color: var(--muted); }
.ms-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); }
.ms-item input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--brand); flex: 0 0 auto; }
.ms-item label { flex: 1; }
.ms-item.done label { color: var(--muted); text-decoration: line-through; }

/* ---------- Calendar / pattern chart ---------- */
.cal-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-chip {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600;
  opacity: .45; transition: opacity .12s ease;
}
.cal-chip.active { opacity: 1; border-color: var(--brand); }
.cal-ranges { display: flex; gap: 8px; }
.cal-rbtn { padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 14px; color: var(--muted); }
.cal-rbtn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.cal-hint { font-size: 12px; color: var(--muted); margin: 2px 2px 8px; }

.cal-axisrow { display: flex; margin-bottom: 4px; }
.cal-axis-spacer { width: 50px; flex: 0 0 50px; }
.cal-axis { flex: 1; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.cal-grid { display: flex; flex-direction: column; gap: 3px; }
.cal-row { display: flex; align-items: stretch; gap: 8px; }
.cal-row:active .cal-track { outline: 2px solid var(--brand); }
.cal-daylabel { width: 50px; flex: 0 0 50px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.05; font-size: 11px; color: var(--muted); }
.cal-daylabel b { font-size: 15px; color: var(--text); }
.cal-daylabel.today b { color: var(--brand); }
.cal-daylabel em { font-style: normal; color: var(--sleep); font-size: 10px; font-weight: 700; margin-top: 1px; }
.cal-track {
  position: relative; flex: 1; height: 30px; background: var(--card);
  border: 1px solid var(--line); border-radius: 7px; overflow: hidden;
  background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 25% 100%; background-origin: content-box;
}
.cal-sleep { position: absolute; top: 5px; bottom: 5px; background: var(--sleep); opacity: .85; border-radius: 4px; min-width: 2px; }
.cal-pt { position: absolute; top: 4px; bottom: 4px; width: 3px; margin-left: -1px; border-radius: 2px; }
.cal-pt.feed { background: var(--feed); }
.cal-pt.diaper { background: var(--diaper); }
.cal-pt.pump { background: var(--pump); }
.cal-pt.note { background: var(--note); }
.cal-pt.med { background: var(--med); }

/* ---------- Milestones (enhanced) ---------- */
.ms-assistant { display: flex; align-items: center; gap: 14px; background: var(--brand); color: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.ms-assistant:active { transform: scale(.99); }
.ms-assistant-ico { font-size: 26px; width: 48px; height: 48px; background: rgba(255,255,255,.18); border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto; }
.ms-assistant-t { font-weight: 700; font-size: 18px; }
.ms-assistant-s { font-size: 13px; opacity: .9; }
.ms-assistant-go { margin-left: auto; font-size: 26px; opacity: .8; }

.ms-safety { background: var(--card); border: 1px solid var(--line); border-left: 4px solid #d9534f; border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.ms-safety-head { padding: 14px 16px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.ms-safety-head .chev { transition: transform .15s ease; color: var(--muted); }
.ms-safety-head.open .chev { transform: rotate(90deg); }
.ms-safety-body { padding: 0 16px 6px; }
.ms-safety-body ul { margin: 4px 0 12px; padding-left: 20px; }
.ms-safety-body li { margin-bottom: 5px; font-size: 14px; }
.safe-911 { background: rgba(217,83,79,.12); border-radius: 10px; padding: 10px 12px 4px; margin: 10px 0 12px; }
.safe-911 b { color: #d9534f; }

.ms-progress { margin-bottom: 16px; }
.ms-progress-bar { height: 10px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.ms-progress-bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s ease; }
.ms-progress-txt { font-size: 13px; color: var(--muted); margin-top: 6px; text-align: center; }

.ms-badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: var(--brand-soft); flex: 0 0 auto; }
.ms-stage .ms-stage-head { display: flex; align-items: center; gap: 12px; }
.ms-stage-meta { flex: 1; min-width: 0; }
.ms-stage-meta .st-prog { font-size: 12px; color: var(--muted); font-weight: 600; }

.ms-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); }
.ms-item-emoji { font-size: 22px; width: 30px; text-align: center; flex: 0 0 auto; }
.ms-item-txt { flex: 1; }
.ms-item input { width: 24px; height: 24px; accent-color: var(--brand); flex: 0 0 auto; pointer-events: none; }
.ms-item.done .ms-item-txt { color: var(--muted); text-decoration: line-through; }
.ms-item.done .ms-item-emoji { filter: grayscale(.4); opacity: .7; }

.ms-flags { border-top: 1px solid var(--line); }
.ms-flags summary { padding: 11px 16px; font-weight: 600; font-size: 14px; color: #c9742e; list-style: none; }
.ms-flags summary::-webkit-details-marker { display: none; }
.ms-flags ul { margin: 0 16px 8px; padding-left: 20px; }
.ms-flags li { font-size: 14px; margin-bottom: 4px; }
.ms-flags-note { font-size: 12px; color: var(--muted); padding: 0 16px 14px; }

/* Baby Answers assistant */
#faqSearch { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); margin-bottom: 10px; }
#faqCat { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); margin-bottom: 14px; font-weight: 600; }
.faq-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.faq-chip { padding: 8px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 13px; border: 1px solid var(--line); }
.faq-cat { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 16px 2px 8px; }
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.faq-item summary { padding: 14px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--muted); font-size: 22px; line-height: 1; flex: 0 0 auto; }
.faq-item[open] summary::after { content: '\2013'; }
.faq-a { padding: 0 14px 14px; font-size: 15px; line-height: 1.5; color: var(--text); }
.faq-foot { font-size: 12px; color: var(--muted); margin: 16px 0 4px; text-align: center; }

/* Achievement celebration */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 300; }
.celebrate { position: fixed; inset: 0; display: grid; place-items: center; z-index: 301; background: rgba(10,12,16,.35); animation: fade .2s ease; padding: 24px; }
.celebrate.out { opacity: 0; transition: opacity .3s ease; }
.celebrate-card { background: var(--card); border-radius: 22px; padding: 28px 32px; text-align: center; box-shadow: var(--shadow); max-width: 320px; animation: pop .35s cubic-bezier(.2,1.25,.4,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.celebrate-emoji { font-size: 64px; line-height: 1; }
.celebrate-title { font-size: 22px; font-weight: 800; margin-top: 8px; color: var(--brand); }
.celebrate-text { margin-top: 6px; font-size: 16px; }
.celebrate-sub { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* ---------- Next nap / wake window ---------- */
.wake-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border-left: 4px solid var(--sleep); }
.wake-card.due { border-left-color: var(--brand); background: var(--brand-soft); }
.wake-card.over { border-left-color: var(--diaper); }
.wake-window { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.wake-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Trends stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.stat.wide { grid-column: 1 / -1; }
.stat { background: var(--card); border-radius: 14px; padding: 14px 12px; box-shadow: var(--shadow); text-align: center; }
.stat-v { font-size: 23px; font-weight: 800; }
.stat-l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Per-day action counts table (Calendar) */
.dc-table { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 12px; }
.dc-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr 1.2fr; align-items: center; padding: 8px 2px; font-size: 14px; text-align: center; border-top: 1px solid var(--line); }
.dc-row:first-child { border-top: 0; }
.dc-row .dc-day { text-align: left; font-weight: 600; font-size: 13px; }
.dc-row.today .dc-day { color: var(--brand); }
.dc-head { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 6px 2px 2px; }

/* ---------- Growth ---------- */
.growth-add { margin-bottom: 14px; }
.growth-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.growth-card h3 { margin: 0 0 2px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.growth-latest { font-size: 26px; font-weight: 800; }
.growth-delta { font-size: 13px; color: var(--muted); }
.growth-chart { width: 100%; height: auto; margin-top: 12px; display: block; overflow: visible; }
.growth-chart polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.growth-chart .band { stroke: var(--line); stroke-width: 1; }
.growth-chart .band50 { stroke: var(--muted); stroke-dasharray: 4 3; }
.growth-chart .childline { stroke: var(--brand); stroke-width: 2.6; }
.growth-chart circle { fill: var(--brand); }
.growth-chart text { fill: var(--muted); font-size: 9px; }
.growth-pct { font-size: 14px; color: var(--brand); font-weight: 700; margin-left: 8px; }
.growth-hint { font-size: 13px; color: var(--muted); background: var(--card-2); padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; }

/* ---------- Memories (photo journal) ---------- */

/* ---------- Modal / bottom sheet ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,16,.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px;
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(20px + var(--safe-bottom));
  max-height: 92vh; overflow-y: auto;
  animation: slideup .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideup { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 5px; background: var(--line); border-radius: 3px; margin: 8px auto 12px; }
.sheet h2 { margin: 0 0 16px; font-size: 22px; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.field input[type=text], .field input[type=number], .field input[type=datetime-local], .field input[type=time], .field input[type=date], .field textarea, .field select {
  width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text);
}
.field textarea { min-height: 70px; resize: vertical; }

/* Time-first "When" control: big time, small date, quick nudge chips */
.when-row { display: flex; gap: 10px; }
.when-row input[type=time] {
  flex: 1.4; min-height: 52px; font-size: 20px; font-weight: 700; text-align: center;
}
.when-row input[type=date] {
  flex: 1; min-height: 52px; font-size: 14px; color: var(--muted); text-align: center;
}
.nudges { display: flex; gap: 8px; margin-top: 8px; }
.nudge {
  flex: 1; min-height: 40px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.nudge.now { background: var(--brand); color: #fff; border-color: var(--brand); }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.seg {
  flex: 1; min-width: 70px; padding: 14px 10px; border-radius: 12px; text-align: center;
  background: var(--card); border: 1px solid var(--line); font-weight: 600;
}
.seg.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.sheet-actions { display: flex; gap: 12px; margin-top: 8px; }
.btn {
  flex: 1; min-height: var(--tap); border-radius: 14px; font-size: 18px; font-weight: 700;
  display: grid; place-items: center;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: var(--card); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: transparent; color: #d9534f; flex: 0 0 auto; padding: 0 18px; }

.hidden { display: none !important; }
.toast {
  position: fixed; bottom: calc(84px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px;
  font-weight: 600; z-index: 200; box-shadow: var(--shadow); animation: fade .15s ease;
}

/* ---------- First-run setup / install guide ---------- */
.setup-card {
  position: relative;
  background: var(--brand-soft); border: 1px solid var(--brand);
  border-radius: var(--radius); padding: 14px 40px 14px 16px;
  margin: 12px 16px 4px; box-shadow: var(--shadow);
}
.setup-card .setup-title { font-weight: 700; font-size: 15px; }
.setup-card .setup-sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.setup-x {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; color: var(--muted);
  font-size: 15px; padding: 6px; cursor: pointer; line-height: 1;
}
.guide-list { margin: 0 0 4px; padding-left: 20px; font-size: 14px; line-height: 1.55; }
.guide-list li { margin-bottom: 6px; }
.linklike {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--brand); text-decoration: underline; cursor: pointer;
}

/* ---------- Breast readiness ---------- */
.nurse-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-left: 4px solid var(--feed); }
.ng-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ng-lab { width: 74px; flex: 0 0 auto; font-size: 14px; font-weight: 600; }
.ng-tag { display: block; font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.ng-bar { flex: 1; height: 12px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; }
.ng-bar span { display: block; height: 100%; background: var(--muted); border-radius: 999px; }
.ng-row.done .ng-bar span { background: var(--brand); }
.ng-val { width: 96px; flex: 0 0 auto; text-align: right; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ng-row.done .ng-val { color: var(--brand); }
.ng-val span { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.nurse-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.fieldnote { font-size: 12px; color: var(--muted); margin: -6px 0 14px; line-height: 1.45; }

/* ---------- Demo mode (?demo) ---------- */
.demo-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 16px 0; padding: 10px 14px;
  background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 12px;
  font-size: 13px; line-height: 1.4;
}
.demo-bar .demo-txt { flex: 1 1 200px; }
.demo-bar .demo-actions { display: flex; gap: 14px; }
.setup-card a.btn { text-decoration: none; }
