:root {
  --bg: #fbf6f1;
  --card: rgba(255, 255, 255, .62);   /* frosted glass: the background shows through, blurred */
  --solid: #ffffff;                   /* the few places that must not be see-through */
  --edge: rgba(255, 255, 255, .8);    /* thin light rim on glass */
  --sheet: rgba(251, 246, 241, .9);   /* windows that slide up: frosted but firm enough to read */
  --ink: #2a2420;
  --muted: #675b54;                   /* darker than before so grey text stays readable on glass (4.5:1) */
  --line: #ece3da;
  --accent: #963a5e;   /* darker than before so pink text stays readable on glass and on the bare page */
  --toast-btn: #f2a3bd; /* Undo on the dark message bar */
  --accent-soft: rgba(248, 222, 231, .78);
  --ok: #256a4b;
  --ok-soft: rgba(220, 241, 230, .78);
  --warn: #8a4f00;
  --warn-soft: rgba(253, 238, 214, .82);
  --bad: #a5301f;
  --bad-soft: rgba(251, 224, 220, .82);
  --blue: #2d5d9a;
  --blue-soft: rgba(222, 234, 249, .78);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 6px 22px rgba(80, 40, 50, .08);
  --glow-a: rgba(236, 160, 185, .45);  /* the soft colour washes behind the glass */
  --glow-b: rgba(150, 185, 235, .38);
  --glow-c: rgba(250, 210, 160, .35);
  --r: 22px;
  --on-accent: #ffffff;
  --b1: #176a64; --b1-soft: rgba(214, 240, 236, .8);   /* twins: the first baby's colour (tabs, strip, window titles) */
  --b2: #6f44a8; --b2-soft: rgba(233, 222, 247, .8);   /* the second baby's */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917; --card: rgba(48, 42, 40, .58); --solid: #292524; --edge: rgba(255, 255, 255, .09); --sheet: rgba(30, 26, 24, .9); --toast-btn: #963a5e;
    --ink: #f5efe9; --muted: #b3ada9; --line: rgba(255, 255, 255, .1);
    --accent: #e88aa8; --accent-soft: rgba(90, 44, 60, .62); --ok: #6fcf9f; --ok-soft: rgba(31, 70, 52, .62);
    --warn: #f0b45a; --warn-soft: rgba(80, 58, 26, .66); --bad: #f08a7e; --bad-soft: rgba(88, 38, 34, .66);
    --blue: #8fb6ea; --blue-soft: rgba(35, 54, 82, .62);
    --shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 22px rgba(0, 0, 0, .35);
    --glow-a: rgba(160, 60, 100, .30); --glow-b: rgba(50, 90, 150, .30); --glow-c: rgba(120, 80, 40, .22);
    --on-accent: #1c1917;
    --b1: #6fd0c4; --b1-soft: rgba(23, 74, 68, .62); --b2: #c3a3ee; --b2-soft: rgba(60, 44, 92, .62);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { margin: 0; background: var(--bg); color: var(--ink); }
body { margin: 0; background: transparent; color: var(--ink); } /* transparent so the colour washes below show */
/* Glass look (always on): soft colour washes sit behind everything and show, blurred, through the frosted cards. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 10% 5%, var(--glow-a), transparent 70%),
    radial-gradient(55% 45% at 95% 40%, var(--glow-b), transparent 70%),
    radial-gradient(60% 45% at 20% 95%, var(--glow-c), transparent 70%),
    var(--bg);
}
.card, .tile, .sheet, .kv, .tour-card, .side, .btn.secondary, .chip, .pill, .tab, .strip {
  -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
}
.card, .tile, .kv { border: 1px solid var(--edge); }
body {
  font: 15.5px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 520px; margin: 0 auto; padding: 12px 16px 40px; }
.loading { text-align: center; color: var(--muted); margin-top: 40vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
/* no double-tap-zoom wait on iPhone: taps register at once */
button, a, label, input, .chip, [data-act] { touch-action: manipulation; }

header.top { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
header.top h1 { font-size: 19.5px; margin: 0; letter-spacing: -.01em; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; } /* one line beside four buttons; on a very narrow phone the name is cut with … rather than pushing ⚙️ off screen */
header.top .icons { display: flex; gap: 0; flex: none; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; font-size: 20px; display: grid; place-items: center; }
.iconbtn:active { background: var(--line); }
.back { font-size: 15.5px; color: var(--accent); padding: 10px 4px; font-weight: 600; }
.env-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; background: var(--warn-soft); color: var(--warn); padding: 2px 6px; border-radius: 6px; margin-left: 5px; vertical-align: middle; }

.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.ok { background: var(--ok-soft); }
.card.soon, .card.late { background: var(--warn-soft); }
.card.due { background: var(--warn-soft); }
.card.overdue { background: var(--bad-soft); }
.card.feeding { background: var(--accent-soft); }
.card.sleeping { background: var(--blue-soft); }
.card.mumsleeping { background: var(--blue-soft); }
.label { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 4px; }
.big { font-size: 27px; font-weight: 600; letter-spacing: -.02em; margin: 0; line-height: 1.15; }
.sub { color: var(--muted); margin: 4px 0 0; }
.state-ok .big { color: var(--ok); }
.overdue .big { color: var(--bad); }
.due .big, .soon .big { color: var(--warn); }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 600; margin-top: 10px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.spread { justify-content: space-between; }
.d3 { display: flex; align-items: center; gap: 12px; }
.d3 .mark { font-size: 26px; }
.d3 b { display: block; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 4px 0 14px; }
.tile {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-weight: 650; font-size: 14.5px;
}
.tile .e { font-size: 28px; line-height: 1; }
.tile:active { transform: scale(.97); }
.tile.on { background: var(--accent-soft); }
.tile.sleepon { background: var(--blue-soft); }

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.side { background: var(--card); border-radius: 14px; padding: 14px 8px; text-align: center; font-weight: 700; font-size: 16px; border: 2px solid transparent; }
.side small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.side.active { border-color: var(--accent); color: var(--accent); }
.sheet .side { background: var(--card); border-color: var(--line); }
.sheet .side.active { border-color: var(--accent); }
.sheet .big { margin: 6px 0 2px; }
.btn { display: block; width: 100%; padding: 15px; border-radius: 14px; font-weight: 700; font-size: 15.5px; background: var(--accent); color: var(--on-accent); text-align: center; margin-top: 12px; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--bad); border: 1px solid var(--bad-soft); }
.btn.blue { background: var(--blue); color: var(--on-accent); }
.btn:disabled { opacity: .5; }
.link { color: var(--accent); font-weight: 600; padding: 8px 0; }

.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.totals div { background: rgba(255, 255, 255, .45); border-radius: 12px; padding: 8px 2px; }
.totals div:last-child:nth-child(3n+1) { grid-column: 1 / -1; } /* a lone last box (Vomits) spans the row */
.totals b { display: block; font-size: 18px; font-weight: 600; }
.totals span { font-size: 11.5px; color: var(--muted); }
.card .totals div { background: var(--card); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); align-items: center; }
.list li:last-child { border-bottom: 0; }
.list .t { width: 74px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.list .w { flex: 1; min-width: 0; }
.list .w small { color: var(--muted); display: block; font-size: 13px; }
.list .who { font-size: 11.5px; color: var(--muted); flex: none; }
.list .e { font-size: 20px; flex: none; }
.daylabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin: 14px 0 2px; }

/* bottom sheet */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 10; animation: fade .15s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; background: var(--sheet); border-top: 1px solid var(--edge);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; max-width: 560px; margin: 0 auto; animation: up .2s ease-out;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { margin: 0 0 12px; font-size: 19px; }
@keyframes up { from { transform: translateY(30px); } }
@keyframes fade { from { opacity: 0; } }

.field { margin: 0 0 14px; }
.field > label, .field > .flabel { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input[type=number], .field input[type=text], .field input[type=datetime-local], .field input[type=time], .field input[type=date], .field input[type=password], .field input[type=tel], .field textarea, .field select {
  width: 100%; padding: 13px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 16px; /* 16px or more, or iPhone zooms in when the box is tapped */
}
.field textarea { min-height: 70px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(0,0,0,.15); }
.photo-prev { max-width: 100%; border-radius: 12px; margin-top: 8px; display: block; }
.photo-prev[hidden] { display: none; } /* "display: block" above would otherwise win over the hidden attribute and show the empty picture's caption (18 Nov 2026) */
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.err { color: var(--bad); font-weight: 600; margin: 8px 0 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 52px; height: 30px; }

#toast {
  position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%) translateY(-160px);
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; z-index: 20; display: flex; gap: 14px; align-items: center;
  transition: transform .2s; max-width: calc(100% - 32px); font-size: 14.5px;
}
#toast.show { transform: translateX(-50%) translateY(0); }
/* The message lets taps through to the buttons under it (it sits over the header for 3 to 6 seconds); only its own
   Undo takes a tap. Click robot, 9 Nov 2026: a tap on Tour landed on "Photo saved" instead. */
#toast { pointer-events: none; }
#toast button { color: var(--toast-btn); font-weight: 700; padding: 0; pointer-events: auto; }

.center { text-align: center; }
.login { margin-top: 18vh; }
.login h1 { font-size: 25px; }
.welcome p { font-size: 16px; line-height: 1.5; }
.welcome .sign { font-style: italic; color: var(--muted); margin-top: 6px; }
.steps { padding-left: 22px; line-height: 1.5; } .steps li { margin-bottom: 10px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mini th, table.mini td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; }
table.mini th:first-child, table.mini td:first-child { text-align: left; }
table.mini th { color: var(--muted); font-weight: 600; font-size: 12px; }
.offline { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }

/* read-only entry view */
.kv { margin: 0 0 6px; background: var(--card); border-radius: 14px; padding: 4px 14px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); margin: 0; flex: none; }
.kv dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
/* iPhone draws date/time boxes wider than the screen unless told otherwise */
.field input[type=datetime-local], .field input[type=time], .field input[type=date] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; min-height: 50px; text-align: left;
}
.field input::-webkit-date-and-time-value { text-align: left; }
.row > .field { min-width: 0; }

/* guided tour: a card that explains, and a ring around what it is talking about */
#tour { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
#tour.dim { background: rgba(0, 0, 0, .45); }
.tour-ring { position: fixed; border-radius: 14px; box-shadow: 0 0 0 3px var(--accent), 0 0 0 9999px rgba(0, 0, 0, .45); transition: top .2s, left .2s, width .2s, height .2s; }
.tour-card {
  position: fixed; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top)); max-width: 536px; margin: 0 auto;
  background: var(--solid); color: var(--ink); border-radius: 18px; padding: 14px 16px 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  pointer-events: auto; max-height: 48vh; overflow-y: auto;
}
.tour-card.low { top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); }
.tour-card h3 { margin: 0 0 6px; font-size: 17px; }
.tour-card p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.4; }
.tour-card .tour-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tour-foot { display: flex; gap: 10px; }
.tour-foot .btn { margin: 0; flex: 1; padding: 13px; }
.tour-card .link { display: block; margin: 4px auto 0; }
.topup-btn { margin-top: 10px; }
.topup-btn.on { border: 2px solid var(--accent); color: var(--accent); font-weight: 700; }

/* Twins (slice 2d, 11 Nov 2026): a tab per baby, a strip for the other baby, the baby's name on every window. */
.tabs { display: flex; gap: 8px; margin: 0 0 10px; }
.tab { flex: 1; padding: 12px 10px; border-radius: 14px; font-weight: 700; font-size: 14.5px; background: var(--card); border: 2px solid var(--line); min-height: 48px; }
.tab.b1.on { background: var(--b1); border-color: var(--b1); color: var(--on-accent); }
.tab.b2.on { background: var(--b2); border-color: var(--b2); color: var(--on-accent); }
.strip { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 14px; margin: 0 0 12px; border-radius: 14px; font-size: 14px; min-height: 48px; border: 1px solid var(--edge); }
.strip.b1 { background: var(--b1-soft); } .strip.b2 { background: var(--b2-soft); }
.strip.b1 b { color: var(--b1); } .strip.b2 b { color: var(--b2); }
.strip span:nth-of-type(1) { flex: 1; }
.strip.due span:nth-of-type(1) { color: var(--warn); font-weight: 700; }
.strip.overdue span:nth-of-type(1) { color: var(--bad); font-weight: 700; }
.babytag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; color: var(--on-accent); }
.babytag.b1 { background: var(--b1); } .babytag.b2 { background: var(--b2); }
.sheet-baby { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.card.both { margin-bottom: 14px; }

/* Charts page */
.seg { display: flex; gap: 6px; background: var(--card); border-radius: 14px; padding: 4px; margin: 0 0 12px; box-shadow: var(--shadow); }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 0; border-radius: 10px; }
.seg button.on { background: var(--accent-soft); color: var(--ink); }
.chead { font-size: 17px; margin: 18px 4px 8px; }
.chart .unit { font-weight: 400; }
.chart .bubble { background: var(--bg); border-radius: 10px; padding: 6px 10px; margin: 4px 0 6px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart .bubble b { color: var(--ink); margin-left: 4px; }
.chart .bubble .more { display: block; font-size: 13px; }
.chartsvg { width: 100%; height: auto; display: block; overflow: visible; }
.chartsvg .cg { stroke: var(--line); stroke-width: 1; }
.chartsvg .cline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; opacity: .55; }
.chartsvg .csel { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chartsvg .cdot { fill: var(--accent); }
.chartsvg .cdot.partial { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.chartsvg .chit { fill: transparent; }
.chartsvg .cval { font-size: 11px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.chartsvg .cax { font-size: 10px; fill: var(--muted); text-anchor: middle; }
.chartsvg rect[data-act] { cursor: pointer; } /* iPhones only send taps on drawings to the page when this is set */

.phone-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(128,128,128,.2); }
.phone-row:first-of-type { border-top: 0; }
.phone-row .btn { width: auto; margin: 0; padding: 10px 14px; flex: none; }
.phone-row .pill { margin-top: 0; font-size: 12px; padding: 2px 8px; }

/* Delete our data (18 Nov 2026) */
ul.plain { margin: 8px 0; padding-left: 20px; }
ul.plain li { margin: 4px 0; }
.delete-banner { display: block; }
.delete-banner .row { margin-top: 8px; }
.delete-banner .btn { margin: 0; padding: 10px 14px; }
.delete-banner .link { display: inline; padding: 0 4px; }
