/* app.css — design tokens + layout ported 1:1 from the claude.ai artifact (reference/artifact-index.html),
   plus PWA additions (safe areas, login, sync bar, theme toggle). System fonts; no external font dependency. */
:root {
  --bg: #e9eef2;
  --surface: #f8fafb;
  --surface-2: #dfe6ec;
  --ink: #18222d;
  --muted: #566474;
  --line: #cdd6df;
  --accent: #33698a;
  --feed: #33698a;
  --pump: #6d5f9e;
  --diaper: #8c6a22;
  --temp: #3f7c60;
  --other: #5f6873;
  --warn: #a8402a;
  --warn-bg: #f6dfd8;
  --ok-bg: #d9ebe1;
  --scrim: rgba(16, 24, 32, .38);
  --shadow: 0 10px 30px rgba(20, 34, 48, .16);
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1319; --surface: #161e27; --surface-2: #1f2a35; --ink: #dfe6ec; --muted: #8e9cab; --line: #283440;
    --accent: #86b2cf; --feed: #86b2cf; --pump: #b2a6dc; --diaper: #d5b46c; --temp: #8cc4a6; --other: #a3adb8;
    --warn: #f0947a; --warn-bg: #3a221c; --ok-bg: #1b3027; --scrim: rgba(0, 0, 0, .55); --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1319; --surface: #161e27; --surface-2: #1f2a35; --ink: #dfe6ec; --muted: #8e9cab; --line: #283440;
  --accent: #86b2cf; --feed: #86b2cf; --pump: #b2a6dc; --diaper: #d5b46c; --temp: #8cc4a6; --other: #a3adb8;
  --warn: #f0947a; --warn-bg: #3a221c; --ok-bg: #1b3027; --scrim: rgba(0, 0, 0, .55); --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.app {
  max-width: 540px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 120px;
  display: flex; flex-direction: column; gap: 16px;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand b { font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.brand span { font-size: 14px; color: var(--muted); }
.icon-btn {
  min-width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; font-size: 14px; color: var(--muted);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.banner { border-radius: 12px; padding: 12px 14px; background: var(--surface-2); color: var(--ink); font-size: 15px; }
.banner.warn { background: var(--warn-bg); }

/* Status */
.status { background: var(--surface); border-radius: var(--r); padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 14px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
.since-big { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; font-size: clamp(44px, 14vw, 64px); line-height: 1; letter-spacing: -.02em; color: var(--feed); }
.since-big small { font-family: var(--font-body); font-size: 18px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.since-big.dim { color: var(--muted); font-family: var(--font-body); font-size: 26px; letter-spacing: 0; padding-block: 6px; }
.meta { color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.minis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.mini { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mini .v { font-size: 17px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mini .t { font-size: 14px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: 13px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.ok { background: var(--ok-bg); color: var(--temp); }
.chip.soft { background: var(--surface-2); color: var(--muted); }

/* Quick add */
.quick { display: flex; flex-direction: column; gap: 10px; }
.qgroup { display: flex; flex-direction: column; gap: 6px; }
.qgroup .label { padding-left: 2px; }
.qrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qrow.four { grid-template-columns: repeat(4, 1fr); }
.qbtn {
  --c: var(--other);
  min-height: 68px; border-radius: 14px; border: 0; padding: 8px 6px;
  background: color-mix(in srgb, var(--c) 15%, var(--surface));
  color: var(--ink); font-size: 18px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .08s ease, background .15s ease;
}
.qbtn small { font-size: 12px; font-weight: 600; color: var(--muted); }
.qbtn:active { transform: scale(.96); background: color-mix(in srgb, var(--c) 30%, var(--surface)); }
.qbtn.next { box-shadow: inset 0 0 0 2px var(--c); }
.qrow.four .qbtn { min-height: 56px; font-size: 16px; }
.qbtn:disabled { opacity: .45; cursor: not-allowed; }
.t-feed { --c: var(--feed); } .t-pump { --c: var(--pump); } .t-diaper { --c: var(--diaper); } .t-temp { --c: var(--temp); } .t-other { --c: var(--other); }

/* Day */
.day { display: flex; flex-direction: column; gap: 12px; }
.dayswitch { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 8px; }
.dayswitch button { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; color: var(--ink); }
.dayswitch button:disabled { opacity: .3; cursor: default; }
.dayname { text-align: center; min-width: 0; }
.dayname b { display: block; font-size: 20px; }
.dayname span { font-size: 14px; color: var(--muted); }
.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stat { background: var(--surface); border-radius: 12px; padding: 10px 4px 8px; text-align: center; min-width: 0; }
.stat .n { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat .n small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat .l { font-size: 12px; color: var(--muted); line-height: 1.2; margin-top: 2px; }
@media (max-width: 380px) { .summary { grid-template-columns: repeat(3, 1fr); } }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.entry {
  --c: var(--other);
  width: 100%; text-align: left; border: 0; border-radius: 12px; background: var(--surface);
  display: grid; grid-template-columns: 58px 10px 1fr; gap: 10px; align-items: start; padding: 12px 14px; min-height: 56px;
}
.entry .time { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 700; padding-top: 1px; }
.entry .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-top: 6px; }
.entry .body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.entry .what { font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; overflow-wrap: anywhere; }
.entry .sub { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.entry.pending { opacity: .7; }
.empty { background: var(--surface); border-radius: var(--r); padding: 22px 18px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.empty b { color: var(--ink); font-size: 17px; }

/* Sheet */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; margin: 0 auto; max-width: 560px;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  max-height: calc(92dvh - env(safe-area-inset-top, 0px)); overflow-y: auto; overscroll-behavior: contain;
  padding-top: 8px;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .qbtn { transition: none; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet form { display: flex; flex-direction: column; gap: 16px; }
.sheet h2 { margin: 0; font-size: 21px; text-wrap: balance; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.inrow { display: flex; align-items: center; gap: 8px; }
.inrow .unit { color: var(--muted); font-weight: 600; min-width: 28px; }
.sheet input[type=text], .sheet input[type=datetime-local], .sheet input[type=date], .sheet input[type=time], .sheet textarea {
  width: 100%; min-width: 0; min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  padding: 10px 12px; font-size: 18px;
}
.sheet textarea { min-height: 84px; resize: vertical; font-size: 16px; }
.sheet input.big { font-family: var(--font-num); font-size: 26px; font-weight: 700; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg.wrap { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.seg button {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; font-size: 16px; padding: 6px 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.seg button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-color: var(--accent); }
.swatch { width: 16px; height: 16px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.15); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { min-height: 40px; min-width: 52px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); padding: 4px 12px; font-family: var(--font-num); font-size: 15px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint { font-size: 14px; color: var(--muted); }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.btn { min-height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; font-size: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.danger { color: var(--warn); }
.btn.danger-solid { background: var(--warn); border-color: var(--warn); color: var(--surface); }
.confirm { display: flex; flex-direction: column; gap: 8px; background: var(--warn-bg); border-radius: 14px; padding: 12px; }
.confirm p { margin: 0; font-weight: 600; }
.confirm .actions { grid-template-columns: 1fr 1fr; }
.err { color: var(--warn); font-weight: 600; font-size: 15px; }

/* Toast */
.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(520px, calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  background: var(--ink); color: var(--bg); border-radius: 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; min-height: 56px;
}
.toast .msg { flex: 1; min-width: 0; font-weight: 600; }
.toast button { min-height: 44px; border: 0; border-radius: 10px; padding: 0 12px; background: transparent; color: var(--bg); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- babylog additions ---------- */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
.app { padding-top: max(12px, env(safe-area-inset-top, 0px)); padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
.top-actions { display: flex; gap: 8px; flex: none; }
.icon-btn svg .half { fill: currentColor; stroke: none; }
:root[data-theme="light"] .icon-btn svg .half { opacity: 0; }
:root[data-theme="dark"] #themeBtn svg circle { fill: currentColor; }
.qbtn > span { pointer-events: none; }

.syncbar { display: flex; align-items: center; gap: 8px; border-radius: 12px; padding: 10px 14px; background: var(--surface-2); color: var(--ink); font-size: 15px; font-weight: 600; }
.syncbar .syncdot { width: 9px; height: 9px; border-radius: 50%; background: var(--diaper); flex: none; }
.syncbar.offline .syncdot { background: var(--warn); }
.syncbar.offline { background: var(--warn-bg); }

.entry.t-feed { --c: var(--feed); } .entry.t-pump { --c: var(--pump); } .entry.t-diaper { --c: var(--diaper); } .entry.t-temp { --c: var(--temp); }
.stat .n { white-space: nowrap; }
.login-mark { display: block; width: 56px; height: 56px; border-radius: 14px; }
.entry .pend { color: var(--diaper); font-weight: 700; }

.sw-meconium { background: #2b3324; } .sw-transitional { background: #6b6a2a; } .sw-yellow { background: #d6a72c; } .sw-other { background: #9aa3ad; }

.sheet .acct { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.sheet .acct span { color: var(--muted); font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.sheet .acct .btn { min-height: 48px; padding: 0 16px; font-size: 16px; }
.sheet h3 { margin: 4px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* Login */
.login {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; padding: 28px 22px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 26px; }
.login-card .hint { margin: 0; }
.login input, .sheet select {
  width: 100%; min-width: 0; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  padding: 10px 12px; font-size: 18px;
}
.login .btn { width: 100%; margin-top: 4px; }
.login .field > label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* ---------- round log (landing) + tab bar ---------- */
.app { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.tab { display: flex; flex-direction: column; gap: 16px; }
.logtab { gap: 10px; }
.rhead { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 8px; }
.rnav { height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 26px; color: var(--ink); }
.rnav:disabled { opacity: .3; cursor: default; }
.rtitle { text-align: center; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rtitle h1 { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 30px; line-height: 1.1; letter-spacing: -.01em; }
.rtitle span { font-size: 14px; color: var(--muted); }
.rtitle span.done { color: var(--temp); font-weight: 700; }
.rtitle span.due { color: var(--feed); font-weight: 700; }
.rform { display: flex; flex-direction: column; gap: 10px; }
.rcard { background: var(--surface); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.rcard.done { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--temp) 55%, transparent); }
.rgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rfield { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rfield > label, .rfield > .label { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
.rin { display: flex; align-items: center; gap: 8px; }
.rin input {
  width: 100%; min-width: 0; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  padding: 8px 12px; font-family: var(--font-num); font-size: 24px; font-weight: 700;
}
.rin .unit { color: var(--muted); font-weight: 600; min-width: 26px; }
.chips { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.chips button {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  font-family: var(--font-num); font-size: 16px; font-weight: 600; padding: 0 4px;
}
.chips.text button { font-family: var(--font-body); min-height: 52px; font-size: 16px; line-height: 1.15; }
.chips button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chips.diaper button[aria-pressed="true"] { background: color-mix(in srgb, var(--diaper) 22%, var(--surface)); border-color: var(--diaper); box-shadow: inset 0 0 0 1px var(--diaper); }
.rfield .hint { font-size: 13px; min-height: 18px; }
.rmore { min-height: 46px; border-radius: 12px; border: 1px dashed var(--line); background: transparent; color: var(--muted); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.rmore[aria-expanded="true"] { border-style: solid; }
.rmore svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .15s ease; }
.rmore[aria-expanded="true"] svg { transform: rotate(180deg); }
.rform textarea, .rform input[type=datetime-local] {
  width: 100%; min-width: 0; min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px 12px; font-size: 17px;
}
.rform textarea { min-height: 72px; resize: vertical; font-size: 16px; }
.rform .presets button { min-height: 40px; }
.rsave { min-height: 58px; font-size: 19px; width: 100%; }
.rform .err { text-align: center; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
}
.tabbar button { min-height: 60px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
.sheet .split3 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet input[type=number] { width: 100%; min-width: 0; min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px 12px; font-size: 18px; }
@media (prefers-reduced-motion: reduce) { .rmore svg { transition: none; } }
.chips.wrap2 { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.chips .swatch { margin-right: 6px; vertical-align: -2px; display: inline-block; }
.rform .btn.danger { width: 100%; }
.rin input::placeholder { color: var(--muted); opacity: .5; font-weight: 500; }

/* ---------- round log v2: wheel picker + section cards ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wheel { container-type: inline-size; position: relative; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; touch-action: pan-x; }
.wheel:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wheel-track {
  display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding-inline: 40cqi; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.wheel-track::-webkit-scrollbar { display: none; }
.wheel-item {
  flex: 0 0 20cqi; min-width: 0; min-height: 64px; scroll-snap-align: center; scroll-snap-stop: normal;
  border: 0; background: none; padding: 0; color: var(--muted); opacity: .45;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 600;
  transition: opacity .12s ease, transform .12s ease, color .12s ease;
}
.wheel-item.near { opacity: .8; font-size: 22px; }
.wheel-item.sel { opacity: 1; color: var(--ink); font-size: 30px; font-weight: 700; }
.wheel-frame {
  position: absolute; top: 6px; bottom: 6px; left: 40%; width: 20%; pointer-events: none;
  border-radius: 12px; background: color-mix(in srgb, var(--feed) 16%, transparent); box-shadow: inset 0 0 0 2px var(--feed);
}
.wheel-frame::after { content: "ml"; position: absolute; right: 6px; bottom: 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.rpair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rsec h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.rsec h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--other)); }
.diaper-card { --c: var(--diaper); background: color-mix(in srgb, var(--diaper) 8%, var(--surface)); }
.pump-card { --c: var(--pump); background: color-mix(in srgb, var(--pump) 8%, var(--surface)); }
.diaper-card .chips button { padding: 0 2px; }
.rtitle span.soon { color: var(--ink); font-weight: 700; background: var(--surface-2); border-radius: 999px; padding: 1px 10px; align-self: center; }
.rtitle span.due { background: color-mix(in srgb, var(--feed) 14%, var(--surface)); border-radius: 999px; padding: 1px 10px; align-self: center; }
.rtitle span.done { background: var(--ok-bg); border-radius: 999px; padding: 1px 10px; align-self: center; }
@media (prefers-reduced-motion: reduce) { .wheel-item { transition: none; } }

/* "Next in N h" save row: −/+ flank the big button (thumb reach on both sides) */
.nextrow { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: stretch; }
.nextrow .rsave { min-height: 64px; font-size: 20px; }
.nextstep { min-height: 64px; border-radius: 14px; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font-size: 30px; font-weight: 700; line-height: 1; }
.nextstep:disabled { opacity: .35; }
.nextrow .rsave { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; font-size: clamp(16px, 5vw, 20px); }
.rtitle span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Today tab: fixed day grid */
.daygrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gslot { width: 100%; min-height: 56px; border: 0; border-radius: 12px; background: var(--surface); text-align: left; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; padding: 8px 10px; align-items: center; }
.gslot .glabel { font-family: var(--font-num); font-weight: 700; font-size: 16px; grid-row: 1 / span 2; }
.gslot .gbody { display: flex; flex-direction: column; min-width: 0; }
.gslot .gmain { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.gslot .gsub { font-size: 12px; color: var(--muted); }
.gslot .gchips { grid-column: 2; display: flex; gap: 4px; flex-wrap: wrap; }
.gslot .gchips .chip { font-size: 11px; padding: 0 6px; }
.gslot.st-done { box-shadow: inset 3px 0 0 var(--feed); }
.gslot.st-missed .gmain { color: var(--warn); font-weight: 600; }
.gslot.st-due { box-shadow: inset 0 0 0 2px var(--feed); }
.gslot.st-upcoming .gmain { color: var(--muted); }
.chip.dwet { background: color-mix(in srgb, var(--feed) 18%, var(--surface)); color: var(--ink); }
.chip.ddirty { background: color-mix(in srgb, var(--diaper) 22%, var(--surface)); color: var(--ink); }

/* Extended feed (collapsed checkbox in the Feed card) */
.extrow { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; font-weight: 600; color: var(--muted); }
.extrow input { width: 22px; height: 22px; accent-color: var(--accent); }
.rform input[type=time] { width: 100%; min-width: 0; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 8px 12px; font-size: 20px; font-family: var(--font-num); }

/* r3 fixes: wrapping warning chip, 44 px checkbox row, compact time field, one-column day grid */
.rform .hint .chip, .sheet .hint .chip { white-space: normal; line-height: 1.35; padding: 3px 10px; }
.extrow { min-height: 44px; }
.extrow input { width: 24px; height: 24px; flex: none; }
.rform input[type=time] { font-size: 18px; padding: 8px 10px; }
.daygrid { grid-template-columns: 1fr; gap: 4px; }
.gslot { min-height: 48px; grid-template-columns: 56px 1fr auto; grid-template-rows: auto; padding: 6px 12px; }
.gslot .glabel { grid-row: auto; }
.gslot .gmain { font-size: 15px; }
.gslot .gchips { grid-column: auto; justify-content: flex-end; }
.gslot .gchips .chip { font-size: 12px; padding: 1px 8px; }
/* Toasts at the top so they never cover the Next-in row or the tab bar */
.toast { top: calc(76px + env(safe-area-inset-top, 0px)); bottom: auto; }
.sheet input[type=time] { width: 100%; min-width: 0; min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px 12px; font-size: 18px; }

/* Today: calm day list; Details toggle; Graphs */
.gslot.st-missed .gmain { color: var(--muted); font-weight: 600; }
.gslot.st-upcoming { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.gslot .gmain { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.detailsbtn { width: 100%; }
#tabToday > .day { gap: 10px; }
.graphs { display: flex; flex-direction: column; gap: 12px; }
.grange { margin: 0; color: var(--muted); font-size: 14px; }
.gcard { background: var(--surface); border-radius: var(--r); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.ghead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ghead h2 { margin: 0; font-size: 16px; }
.gsub { font-size: 13px; color: var(--muted); }
.gempty { margin: 0; color: var(--muted); font-size: 15px; padding: 10px 2px; }
.gtable summary { font-size: 13px; color: var(--muted); cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.gtable table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.gtable th, .gtable td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.glegend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.glegend span { display: inline-flex; align-items: center; gap: 6px; }
.glegend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
svg.viz { width: 100%; height: auto; display: block; overflow: visible; }
.viz-grid line { stroke: var(--line); stroke-width: 1; }
.viz-tick { fill: var(--muted); font-size: 10px; font-family: var(--font-num); }
.viz-label { fill: var(--ink); font-size: 11px; font-weight: 700; font-family: var(--font-num); }
.viz-label.muted { fill: var(--muted); font-weight: 600; font-family: var(--font-body); }
.viz-ref { stroke: var(--muted); stroke-width: 1.5; }
.viz-band { fill: var(--viz-band); }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-line.c1 { stroke: var(--viz-1); }
.viz-dot { stroke: var(--surface); stroke-width: 2; }
.viz-dot.c1 { fill: var(--viz-1); }
.viz-c1 { fill: var(--viz-1); } .viz-c2 { fill: var(--viz-2); }
.glegend .sw.c1 { background: var(--viz-1); } .glegend .sw.c2 { background: var(--viz-2); }
/* chart tokens (dataviz reference palette slots 1–3, validated on these surfaces) */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-band: color-mix(in srgb, #1baf7a 14%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-1: #3987e5; --viz-2: #d95926; --viz-band: color-mix(in srgb, #199e70 18%, transparent); } }
:root[data-theme="dark"] { --viz-1: #3987e5; --viz-2: #d95926; --viz-band: color-mix(in srgb, #199e70 18%, transparent); }
.tabbar { grid-template-columns: 1fr 1fr 1fr; }
.viz-label, .viz-tick { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }

/* ---------- thumb layout: Log tab anchored to the bottom ---------- */
#tabLog:not([hidden]) {
  display: flex; flex-direction: column; gap: 10px;
  height: calc(100vh - 160px); height: calc(100svh - 150px - env(safe-area-inset-bottom, 0px)); /* JS refines via visualViewport */
}
#tabLog .rhead { flex: none; }
#tabLog #roundForm { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; }
#tabLog .rscroll {
  flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 -4px; padding: 0 4px 2px; /* room for focus rings */
}
#tabLog .nextrow { flex: none; }
body.kb-open .tabbar { display: none; }
.app:has(#tabLog:not([hidden])) { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 700px) { #tabLog:not([hidden]) { max-height: 900px; } }

/* Daily supplements */
.supp-card { --c: var(--temp); background: color-mix(in srgb, var(--temp) 7%, var(--surface)); }
.suppgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.supprow { color: var(--ink); }
.supprow-today { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 15px; color: var(--muted); padding: 2px 4px; }
.supprow-today .supp.given { color: var(--ink); }
.supprow-today .supp.given .mark { color: var(--temp); font-weight: 700; }
.supprow-today .supp.open .mark { color: var(--muted); }
.supprow-today .sep { margin-right: 8px; color: var(--muted); }

/* Round ID + read-only round note */
.rtitle .rid { font-family: var(--font-num); font-size: 12px; color: var(--muted); letter-spacing: .04em; min-height: 14px; }
.rtitle .rid.provisional { opacity: .6; font-style: italic; }
.rnote h2 { margin: 0; font-size: 16px; }
.rnote-main { margin: 0; font-size: 20px; font-weight: 700; font-family: var(--font-num); }
.gnote { margin: 0; padding: 10px 12px; color: var(--muted); font-size: 15px; }
.gslot.st-standalone { background: transparent; box-shadow: inset 0 0 0 1px var(--line); cursor: default; }

/* Bonus feeds */
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 14px; min-height: 32px; padding: 2px 8px; align-self: center; }
.gslot.st-bonus { background: transparent; box-shadow: none; min-height: 40px; padding: 2px 12px; }
.gslot.st-bonus .glabel, .gslot.st-bonus .gmain { color: var(--muted); font-size: 14px; }

/* Bonus feed: small muted outlined secondary action, pinned above the Next row */
#tabLog .bonusrow { flex: none; display: flex; justify-content: center; margin-bottom: 6px; }
.bonusbtn {
  min-height: 44px; padding: 0 18px; border-radius: 999px; background: transparent;
  border: 1px solid var(--line); color: var(--muted); font-size: 15px; font-weight: 600;
}
.bonusbtn:active { background: var(--surface-2); }
.sheet .wheel { margin-top: 2px; }
/* The round subtitle may wrap (never an ellipsis on the start info) */
.rtitle #rSub { white-space: normal; overflow: visible; text-overflow: clip; border-radius: 12px; line-height: 1.25; padding: 2px 10px; }
