/* SimpleBaby — warm oat & ink, one-handed, calm at 3am. */

@font-face { font-family: Figtree; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/figtree-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Figtree; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/figtree-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Figtree; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/figtree-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Figtree; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/figtree-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Figtree; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/figtree-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: Fraunces; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/fraunces-latin-600-normal.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --ground: #F5F0E8;
  --card: #FFFFFF;
  --soft: #EFE8DE;
  --chip: #F1ECE4;
  --btn: #EAE2D6;
  --field: #F5F0E8;
  --ink: #26211D;
  --muted: #5E554D;
  --line: #E7DFD3;
  --faint: #DDD4C7;

  --feed: #1F6E8C;
  --feed-ink: #16546B;
  --feed-tint: #E4F0F4;
  --feed-window: #CBE2EA;
  --feed-tick: #8FBFD0;
  --active: #1F6E8C;
  --active-ink: #FFFFFF;
  --active-sub: #D5ECF4;

  --wet: #4F46E5;
  --wet-ink: #3730A3;
  --wet-tint: #E8E7FB;
  --dirty: #C7892F;
  --dirty-ink: #7A4210;
  --dirty-tint: #F6E8D6;

  --amber: #B45309;
  --amber-bar: #C2610C;
  --amber-window: #F8DDBB;
  --amber-ring: #E9B97A;
  --amber-tint: #FBE6CC;
  --amber-ink: #5C2E06;
  --red: #B42318;
  --red-ring: #E8A59D;

  --primary: #26211D;
  --primary-ink: #FFFFFF;
  --toast: #26211D;
  --toast-ink: #F5F0E8;
  --toast-btn: #3A332E;
  --toast-accent: #9FD0E3;
  --scrim: rgba(20, 17, 15, 0.5);
  --shadow: 0 1px 2px rgba(38, 33, 29, 0.06), 0 8px 24px rgba(38, 33, 29, 0.05);
  --dock-shadow: 0 -6px 24px rgba(38, 33, 29, 0.08);
  --swatch-ring: rgba(38, 33, 29, 0.16);

  --band-outer: #F1EBE2;
  --band-inner: #E3D9CA;
  --median: #8C7F6E;
  --grid: #F1EBE2;
  --axis: #DDD4C7;
  --chart-halo: #FFFFFF;

  --radius: 22px;
  --dock-h: 190px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Dark: follows the device unless this device picked Light or Dark in Settings. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #100E0D;
    --card: #1C1917;
    --soft: #2A2522;
    --chip: #2A2522;
    --btn: #221E1B;
    --field: #2A2522;
    --ink: #EAE3D9;
    --muted: #A69D92;
    --line: #2F2A26;
    --faint: #3A342F;

    --feed: #7FC0D8;
    --feed-ink: #9CCFE0;
    --feed-tint: #16323C;
    --feed-window: #1F3F4A;
    --feed-tick: #3F7A8E;
    --active: #1D4452;
    --active-ink: #CDE8F2;
    --active-sub: #9CCFE0;

    --wet: #8B87F5;
    --wet-ink: #B9B6FA;
    --wet-tint: #22213D;
    --dirty: #D9A35C;
    --dirty-ink: #E8C48E;
    --dirty-tint: #33261A;

    --amber: #E8A33D;
    --amber-bar: #E8A33D;
    --amber-window: #3D2A12;
    --amber-ring: #7A5217;
    --amber-tint: #3A2A14;
    --amber-ink: #F3D7A8;
    --red: #F07A6E;
    --red-ring: #7E2E26;

    --primary: #EAE3D9;
    --primary-ink: #100E0D;
    --toast: #34302C;
    --toast-ink: #EAE3D9;
    --toast-btn: #45403B;
    --toast-accent: #7FC0D8;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow: inset 0 0 0 1px #2C2724;
    --dock-shadow: inset 0 1px 0 #2C2724;
    --swatch-ring: rgba(234, 227, 217, 0.22);

    --band-outer: #231F1C;
    --band-inner: #332D28;
    --median: #8C7F6E;
    --grid: #262220;
    --axis: #3A342F;
    --chart-halo: #1C1917;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #100E0D;
  --card: #1C1917;
  --soft: #2A2522;
  --chip: #2A2522;
  --btn: #221E1B;
  --field: #2A2522;
  --ink: #EAE3D9;
  --muted: #A69D92;
  --line: #2F2A26;
  --faint: #3A342F;

  --feed: #7FC0D8;
  --feed-ink: #9CCFE0;
  --feed-tint: #16323C;
  --feed-window: #1F3F4A;
  --feed-tick: #3F7A8E;
  --active: #1D4452;
  --active-ink: #CDE8F2;
  --active-sub: #9CCFE0;

  --wet: #8B87F5;
  --wet-ink: #B9B6FA;
  --wet-tint: #22213D;
  --dirty: #D9A35C;
  --dirty-ink: #E8C48E;
  --dirty-tint: #33261A;

  --amber: #E8A33D;
  --amber-bar: #E8A33D;
  --amber-window: #3D2A12;
  --amber-ring: #7A5217;
  --amber-tint: #3A2A14;
  --amber-ink: #F3D7A8;
  --red: #F07A6E;
  --red-ring: #7E2E26;

  --primary: #EAE3D9;
  --primary-ink: #100E0D;
  --toast: #34302C;
  --toast-ink: #EAE3D9;
  --toast-btn: #45403B;
  --toast-accent: #7FC0D8;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow: inset 0 0 0 1px #2C2724;
  --dock-shadow: inset 0 1px 0 #2C2724;
  --swatch-ring: rgba(234, 227, 217, 0.22);

  --band-outer: #231F1C;
  --band-inner: #332D28;
  --median: #8C7F6E;
  --grid: #262220;
  --axis: #3A342F;
  --chart-halo: #1C1917;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a, label, summary { touch-action: manipulation; }
button { cursor: pointer; }
a { color: var(--feed); }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
svg { flex-shrink: 0; }
:focus-visible { outline: 3px solid var(--feed); outline-offset: 2px; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(24px + var(--safe-b));
}
body.home .app { padding-bottom: calc(var(--dock-h) + 20px + var(--safe-b)); }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 8px; padding: max(18px, env(safe-area-inset-top)) 16px 14px 20px; }
.top-title { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.top h1, .page-head h1 {
  font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 28px; letter-spacing: -0.01em; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top p { font-size: 14px; color: var(--muted); }
.icon-btn, .avatar, .round {
  width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 14px; background: var(--btn); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn svg, .round svg { width: 22px; height: 22px; }
.avatar { border-radius: 22px; background: var(--primary); color: var(--primary-ink); font-weight: 800; font-size: 16px; }
.round { border-radius: 22px; }

.page-head { display: flex; align-items: center; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 16px 12px; }
.page-head h1 { font-size: 26px; flex-grow: 1; }

/* ---------- cards ---------- */
.card { margin: 0 16px; padding: 16px 18px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.stack > * + * { margin-top: 12px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pill { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--chip); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.rule { height: 1px; background: var(--soft); }

/* ---------- next-feed card ---------- */
.feed { display: flex; flex-direction: column; gap: 12px; }
.feed-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.feed .eyebrow { color: var(--feed); }
.feed-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big { font-size: 46px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.caption { font-size: 16px; color: var(--muted); }
.state-none .big { font-size: 30px; }
.bar { position: relative; height: 22px; }
.bar > div { position: absolute; top: 7px; height: 8px; }
.bar-track { left: 0; right: 0; border-radius: 4px; background: var(--soft); }
.bar-window { right: 0; border-radius: 0 4px 4px 0; background: var(--feed-window); }
.bar-window::before { content: ""; position: absolute; left: -1px; top: -4px; width: 2px; height: 16px; border-radius: 1px; background: var(--feed-tick); }
.bar-fill { left: 0; border-radius: 4px; background: var(--feed); }
.bar > .bar-dot { top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 8px; background: var(--card); border: 3px solid var(--feed); }
.bar-labels { display: flex; justify-content: space-between; gap: 8px; margin-top: -6px; font-size: 13px; color: var(--muted); }
.feed-last { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; row-gap: 2px; font-size: 14px; color: var(--muted); }
.feed-last strong { color: var(--ink); font-weight: 700; }
.feed-last .ago { margin-left: auto; }

.state-open { box-shadow: inset 0 0 0 2px var(--amber-ring), var(--shadow); }
.state-open .eyebrow { color: var(--amber); }
.state-open .bar-window { background: var(--amber-window); }
.state-open .bar-window::before { display: none; }
.state-open .bar-fill { background: var(--amber-bar); }
.state-open .bar-dot { border-color: var(--amber-bar); }

.state-past { box-shadow: inset 0 0 0 2px var(--red-ring), var(--shadow); }
.state-past .eyebrow { color: var(--red); }
.state-past .bar-track { background: var(--red); }
.state-past .bar-window, .state-past .bar-fill { display: none; }
.state-past .bar-dot { border-color: var(--red); margin-left: -12px; }

/* running timer card */
.live-dot { display: inline-flex; align-items: center; gap: 8px; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--feed); box-shadow: 0 0 0 4px color-mix(in srgb, var(--feed) 22%, transparent); }
.started { font-size: 13px; color: var(--muted); text-align: right; }
.timer-open { all: unset; cursor: pointer; display: flex; align-items: baseline; gap: 10px; border-radius: 12px; }
.timer-open .big { font-size: 52px; }
.sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.side { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--chip); font-size: 15px; }
.side span:first-child { font-weight: 700; }
.side span:last-child { color: var(--muted); }
.side.on { background: var(--active); color: var(--active-ink); }
.side.on span:last-child { color: var(--active-ink); font-weight: 700; }
.timer-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.timer-actions button, .btn {
  height: 48px; border: 0; border-radius: 14px; background: var(--chip); font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink);
}
.timer-actions svg { width: 18px; height: 18px; }
.primary { background: var(--primary) !important; color: var(--primary-ink) !important; }

/* ---------- today's totals ---------- */
.totals { margin: 10px 16px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--card); border-radius: 18px; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-num { font-size: 28px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.stat-num small { font-size: 13px; font-weight: 600; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.dot.wet { background: var(--wet); }
.dot.dirty { background: var(--dirty); }
.dot.feed { background: var(--feed); }

/* ---------- entries ---------- */
.section { padding: 14px 16px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 8px; }
.section-head h2 { font-size: 15px; font-weight: 700; }
.section-head a { font-size: 14px; font-weight: 600; text-decoration: none; }
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.entry {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: 16px;
  background: var(--card); text-align: left; box-shadow: var(--shadow); color: var(--ink);
}
.ei { flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.ei svg { width: 20px; height: 20px; }
.ei.wet { background: var(--wet-tint); color: var(--wet-ink); }
.ei.dirty { background: var(--dirty-tint); color: var(--dirty-ink); }
.ei.both { background: var(--chip); }
.ei.both svg { width: 15px; height: 15px; stroke-width: 2.4; }
.ei.feed { background: var(--feed-tint); color: var(--feed-ink); }
.c-wet { color: var(--wet-ink); display: flex; }
.c-dirty { color: var(--dirty-ink); display: flex; }
.entry-text { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.entry-title { font-size: 15px; font-weight: 700; }
.entry-detail { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.entry-detail svg { width: 14px; height: 14px; }
.entry-detail .warn { color: var(--amber); }
.entry-meta { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.entry-time { font-size: 14px; font-weight: 600; }
.who { min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.empty { padding: 18px 4px; color: var(--muted); font-size: 15px; }
.past-link { display: block; margin: 12px 4px 0; font-size: 14px; font-weight: 600; background: none; border: 0; padding: 8px 0; color: var(--feed); text-align: left; }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 14px calc(14px + max(16px, var(--safe-b)));
  background: var(--card); border-radius: 26px 26px 0 0; box-shadow: var(--dock-shadow);
}
.dock-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dk {
  position: relative; height: 68px; border: 0; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 15px; font-weight: 700; color: var(--ink); background: var(--chip);
  -webkit-user-select: none; user-select: none;
  transition: transform 0.08s ease;
}
.dk:active { transform: scale(0.96); }
.dk svg { width: 24px; height: 24px; }
.dk.wet { background: var(--wet-tint); color: var(--wet-ink); }
.dk.dirty { background: var(--dirty-tint); color: var(--dirty-ink); }
.dk .pair { display: flex; gap: 2px; }
.dk .pair svg { width: 20px; height: 20px; stroke-width: 2.2; }
.dk.breast { background: var(--feed-tint); color: var(--feed-ink); }
.dk.next { box-shadow: inset 0 0 0 2px var(--feed); }
.dk.active { background: var(--active); color: var(--active-ink); box-shadow: inset 0 0 0 2px var(--feed); }
.letter { width: 24px; height: 24px; border-radius: 12px; border: 2px solid currentColor; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }
.badge { position: absolute; top: 6px; right: 6px; padding: 2px 7px; border-radius: 999px; background: var(--feed); color: var(--card); font-size: 11px; font-weight: 800; letter-spacing: 0.02em; }
.dk-time { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 800; }
.dk-time .dot { background: currentColor; }
.dk.paused .dk-time .dot { background: var(--amber); }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(24px + var(--safe-b)); z-index: 30; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
body.home #toasts { bottom: calc(var(--dock-h) + 12px + var(--safe-b)); }
.toast {
  pointer-events: auto; width: 100%; max-width: 448px; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 8px 8px 16px; border-radius: 16px;
  background: var(--toast); color: var(--toast-ink); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.18s ease-out;
}
.toast svg { width: 18px; height: 18px; color: var(--toast-accent); }
.toast.error svg { color: #F4A88F; }
.toast span { flex-grow: 1; font-size: 15px; font-weight: 600; }
.toast button { height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--toast-btn); color: var(--toast-accent); font-size: 15px; font-weight: 800; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- sheets ---------- */
dialog.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 480px; max-height: calc(100dvh - 40px);
  padding: 0; border: 0; border-radius: 28px 28px 0 0; background: var(--card); color: var(--ink);
  overflow: auto; overscroll-behavior: contain;
}
dialog.sheet[open] { animation: sheet-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.sheet::backdrop { background: var(--scrim); }
dialog.sheet.full { inset: 0; height: 100dvh; max-height: 100dvh; border-radius: 0; background: var(--ground); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) {
  dialog.sheet[open], .toast { animation: none; }
}
.sheet-body { display: flex; flex-direction: column; gap: 18px; padding: 8px 20px calc(24px + var(--safe-b)); }
.grabber { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--faint); }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head h2 { flex-grow: 1; font-family: Fraunces, Georgia, serif; font-size: 26px; font-weight: 600; }
.sheet-head .round { width: 40px; height: 40px; border-radius: 20px; background: var(--chip); }
.sheet-head .round svg { width: 18px; height: 18px; }
.chip {
  position: relative; height: 40px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--chip);
  display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; white-space: nowrap; color: var(--ink);
  text-decoration: none;
}
.chip svg { width: 18px; height: 18px; }
.time-chip input[type="datetime-local"] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer;
}
.form-error { padding: 10px 14px; border-radius: 14px; background: var(--amber-tint); color: var(--amber-ink); font-size: 15px; font-weight: 600; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field-head > :first-child { font-size: 15px; font-weight: 700; }
.field-head > :last-child { font-size: 13px; color: var(--muted); }
.group { display: flex; flex-direction: column; gap: 10px; }

.seg { margin: 0; padding: 4px; border: 0; border-radius: 16px; background: var(--chip); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: var(--muted); }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(38, 33, 29, 0.14); }
.seg input:focus-visible + span { outline: 3px solid var(--feed); }
.seg button { height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 16px; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(38, 33, 29, 0.14); }

.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.swatch { position: relative; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch-dot { width: 44px; height: 44px; border-radius: 22px; box-shadow: inset 0 0 0 1px var(--swatch-ring); display: flex; align-items: center; justify-content: center; }
.swatch-check { width: 20px; height: 20px; opacity: 0; }
.swatch-label { font-size: 13px; font-weight: 500; text-align: center; }
.swatch input:checked + .swatch-dot { box-shadow: inset 0 0 0 1px var(--swatch-ring), 0 0 0 3px var(--card), 0 0 0 5.5px var(--ink); }
.swatch input:checked + .swatch-dot .swatch-check { opacity: 1; }
.swatch input:checked ~ .swatch-label { font-weight: 700; }
.swatch input:focus-visible + .swatch-dot { outline: 3px solid var(--feed); outline-offset: 4px; }

.flag { display: none; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--amber-tint); color: var(--amber-ink); }
.flag svg { width: 22px; height: 22px; color: var(--amber); margin-top: 1px; }
.flag div { display: flex; flex-direction: column; gap: 2px; }
.flag strong { font-size: 15px; }
.flag span { font-size: 14px; line-height: 1.4; }
.diaper-form:has(input[name="color"][value="pale"]:checked) .flag-pale,
.diaper-form:has(input[name="color"][value="red"]:checked) .flag-red,
.diaper-form:has(input[name="color"][value="black"]:checked) .flag-black { display: flex; }
.diaper-form:has(input[name="type"][value="wet"]:checked) .details { display: none; }
.save-wet, .save-dirty, .save-both { display: none; }
.diaper-form:has(input[name="type"][value="wet"]:checked) .save-wet,
.diaper-form:has(input[name="type"][value="dirty"]:checked) .save-dirty,
.diaper-form:has(input[name="type"][value="both"]:checked) .save-both { display: inline; }

.photo-add {
  height: 60px; border: 1.5px dashed var(--faint); border-radius: 16px; background: var(--field);
  display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; font-weight: 700; cursor: pointer;
}
.photo-add svg { width: 22px; height: 22px; }
.photo-has { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; background: var(--field); }
.photo-has img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--soft); }
.photo-has .text { flex-grow: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.photo-has .text strong { font-size: 15px; }
.photo-has .text a { font-size: 13px; color: var(--muted); }
.photo-has button { height: 40px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--chip); font-size: 14px; font-weight: 700; }

.sheet-actions { display: flex; gap: 10px; }
.wide { flex-grow: 1; }
.sheet-actions button, .button {
  height: 56px; padding: 0 18px; border: 0; border-radius: 18px; font-size: 17px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--chip); color: var(--ink); text-decoration: none;
}
.danger { color: var(--red) !important; }

/* bottle */
.amount { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.amount .round { width: 60px; height: 60px; border-radius: 30px; background: var(--chip); }
.amount .round svg { width: 24px; height: 24px; }
.amount-val { display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; }
.amount-val input {
  width: 3.4ch; border: 0; background: transparent; text-align: right; padding: 0;
  font-size: 68px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; -moz-appearance: textfield; appearance: textfield;
}
.amount-val span { font-size: 22px; font-weight: 700; color: var(--muted); }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pick { height: 52px; border: 0; border-radius: 16px; background: var(--chip); font-size: 17px; font-weight: 700; }
.pick[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }
.hint { font-size: 14px; color: var(--muted); text-align: center; }

/* number fields (weight, minutes) */
.num-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.num { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 16px; border-radius: 16px; background: var(--field); cursor: text; }
.num input { width: 100%; min-width: 0; border: 0; background: transparent; font-size: 30px; font-weight: 800; outline: none; padding: 0; -moz-appearance: textfield; appearance: textfield; }
.num input::placeholder { color: var(--faint); }
.num span { font-size: 18px; font-weight: 700; color: var(--muted); }
.num-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.num:focus-within { box-shadow: inset 0 0 0 2px var(--feed); }

/* ---------- full-screen timer ---------- */
.timer { min-height: 100dvh; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; }
.timer-head { display: flex; align-items: flex-start; gap: 8px; padding: max(14px, env(safe-area-inset-top)) 16px 14px; }
.timer-title { flex-grow: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding-top: 2px; text-align: center; }
.timer-title h2 { font-size: 17px; font-weight: 700; }
.timer-title span { font-size: 13px; color: var(--muted); }
.timer-edit { position: relative; }
.timer-edit summary { list-style: none; height: 44px; border-radius: 14px; background: var(--btn); font-weight: 700; }
.timer-edit summary::-webkit-details-marker { display: none; }
.timer-edit-panel {
  position: absolute; right: 0; top: 52px; z-index: 5; width: min(300px, calc(100vw - 32px)); padding: 16px; border-radius: 18px;
  background: var(--card); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.timer-edit-panel label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.timer-edit-panel input { height: 48px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--field); font-size: 16px; }
.timer-edit-panel button { height: 48px; border: 0; border-radius: 14px; font-weight: 700; background: var(--chip); }
.timer-main { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; }
.timer-total { font-size: 88px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.status-pill { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--card); font-size: 15px; font-weight: 600; }
.status-pill .dot { background: var(--feed); }
.status-pill .dot.paused { background: var(--amber); }
.timer-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 16px; }
.tside {
  height: 160px; padding: 16px; border: 0; border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left;
}
.tside.on { background: var(--active); color: var(--active-ink); box-shadow: none; }
.tside-name { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; }
.tside-name .letter { width: 34px; height: 34px; border-radius: 17px; font-size: 16px; }
.tside-time { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.tside-cap { font-size: 14px; font-weight: 600; color: var(--muted); }
.tside.on .tside-cap { color: var(--active-sub); }
.timer-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px 16px calc(24px + var(--safe-b)); }
.timer-controls button { height: 60px; border: 0; border-radius: 18px; background: var(--btn); font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.timer-controls svg { width: 20px; height: 20px; }

/* ---------- weight ---------- */
.date-chip input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; cursor: pointer; }
.latest { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.latest strong { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.latest span { font-size: 14px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.wbadge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--chip); font-size: 13px; font-weight: 700; }
.wbadge.good { background: var(--feed-tint); color: var(--feed-ink); }
.wbadge svg { width: 14px; height: 14px; stroke-width: 2.8; }
.note { padding: 10px 14px; border-radius: 14px; background: var(--amber-tint); color: var(--amber-ink); font-size: 14px; font-weight: 600; }
.note.plain { background: var(--chip); color: var(--muted); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-line { width: 16px; height: 2px; border-radius: 1px; background: var(--feed); }
.lg-dash { width: 16px; height: 0; border-top: 2px dashed var(--median); }
.lg-box { width: 12px; height: 12px; border-radius: 3px; }
.lg-inner { background: var(--band-inner); }
.lg-outer { background: var(--band-outer); box-shadow: inset 0 0 0 1px var(--band-inner); }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .c-grid { stroke: var(--grid); stroke-width: 1; }
.chart .c-axis { stroke: var(--axis); stroke-width: 1; }
.chart .c-outer { fill: var(--band-outer); }
.chart .c-inner { fill: var(--band-inner); }
.chart .c-median { fill: none; stroke: var(--median); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .c-birth { stroke: var(--feed); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.55; }
.chart .c-line { fill: none; stroke: var(--feed); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .c-pt { fill: var(--feed); stroke: var(--card); stroke-width: 2; }
.chart text { font-family: inherit; font-size: 10px; fill: var(--muted); }
.chart .lbl { font-size: 11px; font-weight: 700; fill: var(--ink); stroke: var(--chart-halo); stroke-width: 3px; paint-order: stroke; }
.chart .birth-lbl { fill: var(--muted); stroke: var(--chart-halo); stroke-width: 3px; paint-order: stroke; }
.list-card { padding: 6px 18px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--soft); background: none; text-align: left; color: var(--ink); }
.row:last-child { border-bottom: 0; }
.row-main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.row-main strong { font-size: 15px; }
.row-main span { font-size: 13px; color: var(--muted); }
.row-val { font-size: 16px; font-weight: 700; white-space: nowrap; }
.row-delta { width: 64px; text-align: right; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.row-delta.up { color: var(--feed-ink); font-weight: 700; }

/* ---------- history ---------- */
.days-legend { display: flex; gap: 14px; margin: 0 20px 10px; font-size: 13px; color: var(--muted); }
.days-legend span { display: inline-flex; align-items: center; gap: 6px; }
.days { list-style: none; margin: 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.day-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.day-row .row-main strong { font-size: 16px; }
.day-stats { display: flex; gap: 10px; font-size: 14px; font-weight: 700; }
.day-stats span { display: inline-flex; align-items: center; gap: 5px; }
.day-row svg { width: 18px; height: 18px; color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 16px; }
.pager a, .pager span { flex: 1; }
.day-extra { margin: 8px 20px 0; font-size: 14px; color: var(--muted); }
.day-sub { margin: -6px 20px 10px; font-size: 14px; color: var(--muted); }

/* ---------- forms: setup, settings, who ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field legend { font-size: 13px; font-weight: 700; color: var(--muted); }
.field small { font-size: 13px; color: var(--muted); }
.field input[type="text"], .field input[type="date"], .field select, .input {
  width: 100%; height: 52px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--field); color: var(--ink); font-size: 17px;
  -webkit-appearance: none; appearance: none;
}
.field select {
  padding-right: 40px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C7F6E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 18px 18px;
}
.field input:focus, .field select:focus, .input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--feed); }
fieldset.field { margin: 0; padding: 0; border: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.intro { margin: 4px 20px 16px; color: var(--muted); font-size: 15px; }
.welcome h1 { font-family: Fraunces, Georgia, serif; font-size: 32px; font-weight: 600; }
.banner { margin: 0 16px 12px; padding: 12px 14px; border-radius: 14px; background: var(--feed-tint); color: var(--feed-ink); font-weight: 600; }
.banner.err { background: var(--amber-tint); color: var(--amber-ink); }
.h2 { margin: 24px 20px 10px; font-size: 15px; font-weight: 700; }
.people { display: flex; flex-direction: column; gap: 10px; }
.person-row { display: flex; gap: 8px; align-items: center; }
.person-row form { display: contents; }
.person-row .input { flex-grow: 1; }
.person-row button { height: 52px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--chip); font-weight: 700; white-space: nowrap; }
.who-list { display: flex; flex-direction: column; gap: 10px; margin: 0 16px; }
.who-btn { display: flex; align-items: center; gap: 14px; height: 68px; padding: 0 16px; border: 0; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); font-size: 18px; font-weight: 700; text-align: left; width: 100%; }
.who-btn .avatar { width: 40px; height: 40px; font-size: 16px; }
.small { font-size: 13px; }
.foot { margin: 28px 20px 0; font-size: 13px; color: var(--muted); }
.foot p + p { margin-top: 6px; }
.linkish { background: none; border: 0; padding: 0; color: var(--feed); font-weight: 600; font-size: 14px; }
