/* Moomoni: the app's styles. Dark by design: a near-black ground, charcoal cards with a 20px radius and no borders,
   bold figures, teal sentence-case section headings, pill buttons, and a tab bar with the entry as its centre button. Teal is the
   primary action and the selected state; mood keeps the chart's blue (low) to amber (high); red is risk alone. */
:root {
  color-scheme: dark;
  --bg: #0b0e11; --panel: #161b21; --panel-2: #212830; --panel-3: #2b333c; --text: #eef1f4; --muted: #96a0aa; --faint: #5f6973;
  --border: rgba(255, 255, 255, .07); --accent: #5cc8b8; --accent-ink: #062521; --accent-soft: rgba(92, 200, 184, .16);
  --warm: #3a2d1c; --warm-ink: #ffd9a8; --warm-line: #a05a00; --risk: #ef6b64; --neg: #3987e5; --pos: #e0a441; --violet: #9085e9; --sleep: #3987e5;
  --radius: 20px; --radius-s: 14px; --tap: 52px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f4; --panel: #ffffff; --panel-2: #eaeeec; --panel-3: #dfe5e2; --text: #14181c; --muted: #5f6b75; --faint: #8a949c;
  --border: rgba(20, 24, 28, .1); --accent: #1f7f73; --accent-ink: #ffffff; --accent-soft: rgba(31, 127, 115, .12);
  --warm: #fff1dc; --warm-ink: #6b4300; --warm-line: #e2a84a; --risk: #b8322b; --neg: #2a78d6; --pos: #d98324; --violet: #6b5fd6;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 17px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0 0 8px; }

/* ---- shell ---- */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; padding-top: env(safe-area-inset-top); }
#topbar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 6px 8px; gap: 8px; }
#title { flex: 1; text-align: center; color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#progress { min-width: 3.4em; text-align: right; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.iconbtn { background: none; border: 0; padding: 8px 10px; border-radius: var(--radius-s); font-size: 16px; color: var(--accent); min-height: 44px; }
.iconbtn:active { background: var(--panel); }
#back.ghost { visibility: hidden; }
#restart { font-size: 22px; padding: 4px 10px; min-width: 44px; }
#bar { height: 3px; background: transparent; margin: 0 16px; }
#barfill { height: 100%; width: 0; background: var(--accent); transition: width .2s ease; border-radius: 2px; }
#view { flex: 1; display: flex; flex-direction: column; padding: 8px 16px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen { display: flex; flex-direction: column; flex: 1; min-height: 0; }

#tabbar { display: flex; align-items: flex-end; justify-content: space-around; background: var(--panel); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
#tabbar[hidden] { display: none; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--faint); font-size: 11px; font-weight: 600; border-radius: var(--radius-s); min-height: 52px; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--text); }
.tab.new { flex: 0 0 auto; }
.tab.new .plus { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; margin-bottom: 2px; box-shadow: 0 6px 18px rgba(92, 200, 184, .35); }
.tab.new .plus svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.4; }
.tab.new span { color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 23px; letter-spacing: -.01em; padding: 4px 8px; }

@media (min-width: 800px) {
  body { font-size: 16px; }
  #app { max-width: 720px; }
  #tabbar { order: -1; justify-content: flex-start; gap: 6px; border-radius: 0; background: transparent; padding: 0 8px 6px; border-bottom: 1px solid var(--border); align-items: center; }
  .tab { flex: 0 0 auto; flex-direction: row; gap: 8px; padding: 8px 12px; font-size: 14px; min-height: 40px; }
  .tab[aria-current="page"] { background: var(--panel); }
  .tab.new .plus { width: 36px; height: 36px; margin: 0; box-shadow: none; }
  .tab.new .plus svg { width: 20px; height: 20px; }
  #view { padding: 16px 16px 32px; }
}

/* ---- text ---- */
/* Type hierarchy, the same on every screen (and mirrored in report.html):
     1  page title        .q                                   24px 700 text colour, sentence case
     2  card title        .card h2                             17px 700 text colour
     3  section heading   .micro .subhead2 .group h3 (.sec)    15px 650 teal, sentence case
     4  field label       .settings label, table headings      13px 600 muted, sentence case
     -  explanatory       .hint 15px / .small 14px muted
   No capitals anywhere in headings; teal is kept for level 3 so it reads as structure, not decoration. */
:root { --fs-title: 24px; --fs-card: 17px; --fs-section: 15px; --fs-label: 13px; }
.q { font-size: var(--fs-title); font-weight: 700; line-height: 1.22; margin: 4px 0 8px; letter-spacing: -.01em; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 6px; }
.small { color: var(--muted); font-size: 14px; }
.subhead, .micro, .sec { color: var(--accent); font-size: var(--fs-section); font-weight: 650; text-transform: none; letter-spacing: 0; margin: 14px 0 6px; }
.qhead { flex: 0 0 auto; margin-bottom: 10px; }
.datechip { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.prevhint { color: var(--accent); font-size: 14px; }
.hint.medhint { color: var(--text); font-weight: 600; }

/* ---- cards ---- */
.card { background: var(--panel); border-radius: var(--radius); padding: 16px 18px; }
.card + .card { margin-top: 12px; }
.card h2 { font-size: var(--fs-card); font-weight: 700; margin-bottom: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--panel); border-radius: var(--radius); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 600; }
.tile .v { font-size: 28px; font-weight: 750; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .d { color: var(--muted); font-size: 12px; }
.tile .bar { height: 6px; border-radius: 3px; background: var(--panel-3); margin-top: 8px; overflow: hidden; }
.tile .bar i { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--accent)); }

/* ---- buttons ---- */
.btn { min-height: var(--tap); border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 700; width: 100%; padding: 12px 20px; }
.btn:disabled { opacity: .45; }
.btn.secondary { background: var(--panel-2); color: var(--text); font-weight: 600; }
.btn.subtle { background: none; color: var(--muted); min-height: 44px; font-weight: 500; }
.btnrow { display: flex; gap: 10px; margin-top: 10px; }
/* the review's Submit stays in view while the answers scroll past, so it is never missed at the foot of a long list */
.review .btnrow { position: sticky; bottom: -1px; margin-top: 12px; padding: 10px 0 8px; background: linear-gradient(to bottom, transparent, var(--bg) 28%); z-index: 2; }
.btnrow .btn { flex: 1; }
a.btn { display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; box-sizing: border-box; }
.stackbtns { display: flex; flex-direction: column; gap: 10px; }
.linkbtn { background: none; border: 0; padding: 6px 2px; font: inherit; font-size: 15px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 15px; padding: 9px 14px; border-radius: 999px; border: 0; background: var(--panel-2); color: var(--text); min-height: 44px; }
.chip:active, .chip.on { background: var(--accent); color: var(--accent-ink); }
.spacer { flex: 1; }
/* the weekly check-in and the questions list */
.weekly .group { margin-top: 14px; background: var(--panel); border-radius: var(--radius); padding: 12px 14px 10px; }
.weekly .group h3 { color: var(--accent); font-size: var(--fs-section); font-weight: 650; margin: 0 0 8px; }
.weekly .group p { margin: 6px 0; }
.weekly .wkrow { padding: 8px 0; border-top: 1px solid var(--border); }
.weekly .wkrow:first-of-type { border-top: 0; }
.weekly .wkrow p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.weekly .wkrow .iconbtn { margin-left: auto; }
.weekly .chips { margin: 6px 0; }
.weekly input[type=text] { width: 100%; margin-top: 6px; }
/* the boxes people type into on these screens look like boxes: a teal edge, which brightens on focus */
.weekly input[type=text], .bloods input[type=text] { background: var(--panel-2); }
.weekly .sugg:empty { display: none; }
.today .qline { margin: 2px 0 8px; font-size: 15px; }
/* the rescue pack */
.rpbtn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--panel); border: 0; border-radius: var(--radius); padding: 12px 14px; font: inherit; color: var(--text); min-height: 56px; }
.rpbtn .rpicon { width: 30px; height: 30px; flex: none; }
.rpbtn .rplabel { flex: 1; font-size: 16px; font-weight: 600; }
.rpbtn .chev { color: var(--muted); font-size: 22px; }
.rpoffer:empty { display: none; }
.rpoffer { background: var(--panel); border-radius: var(--radius); padding: 14px; }
.rpoffer p { margin: 0 0 10px; }
.rpoffer .btn { display: inline-flex; align-items: center; gap: 8px; width: auto; }
.rpoffer .rpicon { width: 22px; height: 22px; }
.rpgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.rptile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--panel-2); }
.rptile .rpphoto { width: 100%; height: 100%; border: 0; padding: 0; background: none; display: block; cursor: pointer; }
.rptile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rptile.busy img { opacity: .5; }
.rptile .spin.small { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.rptile .rpx { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 18px; line-height: 28px; padding: 0; text-align: center; min-height: 0; }
.rptile.rpadd { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px dashed var(--border); background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.rptile.rpadd .plus { font-size: 30px; line-height: 1; color: var(--accent); }
.rescue .btn { margin-top: 12px; }
.rpview { position: fixed; inset: 0; z-index: 200; background: #000; color: #fff; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.rpview .rpbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 16px; }
.rpview .rpintro { color: #bbb; font-size: 15px; }
.rpview .rpbar .iconbtn { color: #fff; font-size: 28px; }
.rpview .rpimg { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.rpview .rpimg img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rpdots { display: flex; justify-content: center; gap: 8px; padding: 14px; }
.rpdots span { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.rpdots span.on { background: #fff; }
/* the compact clinician card on the Today page */
.card.clin .cline { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--border); padding: 9px 0; font: inherit; font-size: 15px; color: var(--text); min-height: 40px; }
.card.clin .cline:first-of-type { border-top: 0; }
.card.clin .cline > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.clin .cline .clab { flex: 0 0 7em; color: var(--accent); font-weight: 650; font-size: 14px; }
.card.clin .cline .ctext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.card.clin .cline.due > span:first-child { font-weight: 600; }
.card.clin .cline .chev { color: var(--muted); font-size: 20px; }
.card.clin .cline .chips { gap: 6px; flex: none; } .card.clin .cline .chip { min-height: 34px; padding: 6px 12px; font-size: 14px; }
/* blood results */
.bloods .group { margin-top: 14px; background: var(--panel); border-radius: var(--radius); padding: 12px 14px 10px; }
.bloods .group h3 { color: var(--accent); font-size: var(--fs-section); font-weight: 650; margin: 0 0 8px; }
.bloods .group label { margin-top: 8px; }
.bloods .btrow { border-top: 1px solid var(--border); }
.bloods .btrow:first-of-type { border-top: 0; }
.bloods .btmain { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 0; background: none; border: 0; font: inherit; color: var(--text); text-align: left; min-height: 40px; }
.bloods .bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bloods .bval { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; }
.bloods .bdate { flex: none; min-width: 5.2em; text-align: right; }
.bloods .bspark { flex: none; color: var(--accent); display: inline-flex; }
.bdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--panel-3); margin-right: 6px; flex: none; }
.bdot.in { background: #3a9d5d; } .bdot.out { background: #d98324; } .bdot.far { background: #c62828; }
.bloods .bhist { padding: 0 0 8px 4px; }
.bloods .bhrow { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 4px 0; color: var(--muted); flex-wrap: wrap; }
.bloods .bhrow .bhdate { min-width: 5.2em; }
.bloods .bhrow .bhval { color: var(--text); font-variant-numeric: tabular-nums; }
.bloods .bhrow .bhact { margin-left: auto; display: inline-flex; gap: 10px; }
.linkbtn.tiny { min-height: 0; padding: 0; font-size: 13px; }
.bloods .trow { padding: 8px 0; border-top: 1px solid var(--border); }
.bloods .trow:first-of-type { border-top: 0; }
.bloods .blab { font-weight: 600; margin-bottom: 4px; }
.bloods .inrow { display: flex; gap: 6px; align-items: center; min-width: 0; }
.bloods .inrow > * { min-width: 0; }
.bloods .inrow select { padding: 8px 6px; font-size: 14px; flex: 0 1 auto; max-width: 38%; }
.bloods .inrow .bnum { flex: 1 1 64px; width: auto; font-size: 16px; padding: 10px 10px; font-variant-numeric: tabular-nums; }
.bloods .inrow .bineq { font-size: 18px; color: var(--muted); padding: 0 2px; }
.bloods .inrow .bnum { max-width: 12em; }
.bloods .blab { display: flex; align-items: center; gap: 6px; }
.bloods .blab .iconbtn { margin-left: auto; min-height: 32px; padding: 2px 8px; }
.bloods .group .row2 input { flex: 1 1 140px; width: auto; }
.bloods .chips.small .chip { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.bloods.reading { align-items: center; text-align: center; padding-top: 10vh; }
.spin { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--panel-2); border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.bloods .wkrow { padding: 8px 0; border-top: 1px solid var(--border); }
.bloods .wkrow p { margin: 3px 0; }
.bloods .rawtext { white-space: pre-wrap; font-size: 12px; max-height: 40vh; overflow: auto; background: var(--panel-2); padding: 8px; border-radius: var(--radius-s); }
.bloods details { margin-top: 14px; }
.bloods .chips { margin-top: 6px; }
/* the warning before a chart is shared, and the sharing code a person reads out */
dialog.agree { border: 0; border-radius: 20px; padding: 20px; width: min(92vw, 440px); max-height: 90vh; overflow: auto; background: var(--panel); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
dialog.agree::backdrop { background: rgba(0, 0, 0, .55); }
dialog.agree h2 { margin: 0 0 10px; font-size: 20px; }
dialog.agree p { margin: 0 0 10px; font-size: 15px; line-height: 1.4; }
dialog.agree ul { margin: 0 0 10px 20px; padding: 0; font-size: 15px; line-height: 1.4; }
dialog.agree .btnrow { margin-top: 14px; }
.codebox { text-align: center; padding: 14px 12px 10px; margin-top: 10px; background: var(--panel-2); border-radius: var(--radius-s); }
.codebox p.small { margin: 0 0 2px; }
.codebox .codeurl { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.codebox .code { font-size: 30px; font-weight: 700; letter-spacing: .08em; font-family: ui-monospace, Consolas, "Roboto Mono", monospace; font-variant-numeric: tabular-nums; margin: 2px 0 6px; color: var(--accent); }

/* ---- answers ---- */
.opts { display: flex; flex-direction: column; gap: 8px; flex: 1; justify-content: flex-end; }
.opt { min-height: var(--tap); border-radius: var(--radius-s); background: var(--panel); border: 2px solid transparent; color: var(--text); font-size: 17px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; width: 100%; transition: background .08s, transform .08s; }
.opts.stack .opt { flex: 1 1 0; max-height: 76px; }
.opt:active { transform: scale(.985); background: var(--panel-2); }
.opt .num { font-weight: 700; min-width: 2.4em; font-variant-numeric: tabular-nums; }
.opt .num.pill { min-width: 0; width: 44px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel-3); color: var(--text); font-size: 15px; }
.opt .num.pill.m-3 { background: #1f4f93; color: #fff; } .opt .num.pill.m-2 { background: #2d6fc6; color: #fff; } .opt .num.pill.m-1 { background: #4d8fe0; color: #0b1a2c; }
.opt .num.pill.p1 { background: #e6b96a; color: #2b1d04; } .opt .num.pill.p2 { background: #d9922f; color: #2b1d04; } .opt .num.pill.p3 { background: #b86f14; color: #fff; }
.opt .lbl { color: var(--muted); font-size: 15px; }
.opt.zero { border-color: var(--faint); background: transparent; }
.opt.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.opt.sel .lbl { color: var(--accent-ink); }
.opt.sel .num.pill { background: rgba(6, 37, 33, .22); color: var(--accent-ink); }
.opt.prev { background: transparent; border: 2px dashed var(--accent); }
.opt.center { justify-content: center; text-align: center; padding: 10px 8px; }
.opt.small { min-height: 44px; padding: 10px 14px; font-size: 16px; justify-content: flex-start; }
.opt.small.other { color: var(--muted); }
.grid { display: grid; gap: 8px; flex: 0 0 auto; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c6 { grid-template-columns: repeat(6, 1fr); }
.grid .opt { min-height: 52px; font-size: 16px; }
.grid .opt .num { min-width: 0; }

/* ---- inputs ---- */
/* Every box that takes typing shows a thin teal edge while it is empty, so it reads as a place to type; once it
   holds text the edge turns white. The app marks filled boxes with .filled (see markFilled in app.js). */
input[type=text], input[type=tel], input[type=url], input[type=date], input[type=search], input[type=email], input[type=number], textarea {
  width: 100%; font: inherit; font-size: 17px; padding: 13px 14px; border-radius: var(--radius-s); background: var(--panel); border: 1px solid var(--accent); color: var(--text); outline: none;
}
input.filled, textarea.filled { border-color: rgba(255, 255, 255, .75); }
input:focus, textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
textarea { flex: 1; min-height: 36vh; resize: none; line-height: 1.4; }
input[type=date] { padding: 8px 12px; font-size: 16px; width: auto; }
input[type=time] { font: inherit; font-size: 16px; padding: 9px 12px; border-radius: var(--radius-s); background: var(--panel-2); border: 1px solid var(--accent); color: var(--text); }
input[type=time].filled { border-color: rgba(255, 255, 255, .75); }
select.sel, select { font: inherit; font-size: 16px; padding: 11px 14px; border-radius: var(--radius-s); background: var(--panel-2); border: 0; color: var(--text); width: 100%; }
label.inline { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; margin: 0; min-height: 44px; }
label.inline input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
.row2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row2 > div { flex: 1 1 140px; }
.row2 > div label { margin-top: 12px; }
input[type=date].full, .row2 input[type=date] { width: 100%; font-size: 16px; padding: 12px 14px; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 28px; padding: 18px 0; }
.stepper button { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--panel); font-size: 34px; font-weight: 600; }
.stepper button:active { background: var(--panel-2); }
.stepper .val { font-size: 56px; font-weight: 750; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.timeval { text-align: center; margin: 10px 0 4px; min-height: 1.4em; }
.timeval small { display: block; font-size: 16px; color: var(--muted); }
.wheels { position: relative; display: flex; justify-content: center; align-items: stretch; gap: 6px; margin: 6px auto 0; width: 100%; max-width: 300px; }
.wheel { flex: 1 1 0; height: 240px; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; touch-action: pan-y; -webkit-mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent); mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent); }
.wheel::-webkit-scrollbar { display: none; }
.wpad { height: 96px; flex: 0 0 96px; }
.witem { height: 48px; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--muted); font-variant-numeric: tabular-nums; cursor: pointer; }
.witem.on { color: var(--text); font-weight: 700; }
.colon { display: flex; align-items: center; font-size: 32px; font-weight: 700; padding-bottom: 4px; }
.band { position: absolute; left: 0; right: 0; top: 96px; height: 48px; border-top: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); border-radius: 8px; pointer-events: none; opacity: .7; }

/* ---- notices ---- */
.err { background: var(--warm); color: var(--warm-ink); padding: 10px 14px; border-radius: var(--radius-s); margin: 0 0 10px; font-size: 15px; }
.note { background: var(--panel); border-radius: var(--radius-s); padding: 12px 14px; color: var(--muted); font-size: 15px; margin: 10px 0; }
.banner { background: var(--warm); color: var(--warm-ink); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; font-size: 16px; }
.banner.offer { text-align: left; } .banner.offer p { margin: 0 0 10px; } .banner.offer .btnrow { margin: 0; }
.warnline { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; font-size: 15px; padding: 12px 14px; margin: 0; border-radius: var(--radius-s); border: 0; background: var(--warm); color: var(--warm-ink); text-decoration: none; }
.warnline::before { content: "!"; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.badge { display: inline-block; background: var(--warm); color: var(--warm-ink); border-radius: 999px; padding: 2px 10px; font-size: 13px; margin-left: 6px; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }

/* ---- Today ---- */
.today { display: flex; flex-direction: column; gap: 14px; }
.today .greet h1 { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 0; }
.today .greet .date { color: var(--muted); font-size: 15px; margin-top: 2px; }
.today .entry .status { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 2px 0 14px; }
.today .entry .status .lead { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.today .entry .status .when { color: var(--muted); font-size: 14px; text-align: right; }
.today .alerts { display: flex; flex-direction: column; gap: 8px; }
.today .card.privacy p { margin: 0 0 12px; font-size: 16px; }
.linkbtn.inline { min-height: 0; padding: 0; font-size: inherit; }
.today .missed h2 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.today .missed .hint { margin: 8px 0 0; }

.today .chartcard { cursor: pointer; }
.today .chartcard svg.mini { width: 100%; height: auto; display: block; margin: 4px 0 6px; }
.today .chartcard svg.mini text { font-variant-numeric: tabular-nums; }

/* ---- Review ---- */
.review .group { margin-top: 14px; background: var(--panel); border-radius: var(--radius); padding: 10px 14px 4px; }
.review .group h3 { color: var(--accent); font-size: var(--fs-section); font-weight: 650; margin: 2px 0 4px; }
.review .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; border: 0; border-bottom: 1px solid var(--border); width: 100%; background: none; text-align: left; min-height: 48px; }
.review .row:last-child { border-bottom: 0; }
.review .row:active { background: var(--panel-2); }
.review .row .k { color: var(--muted); font-size: 15px; }
.review .row .v { text-align: right; font-weight: 600; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review .row .v.empty { color: var(--muted); font-weight: 400; }
.review .row.missing .v { color: var(--warm-ink); }
.review .row.missing .v::before { content: "○ "; }

/* ---- Saved, Safety ---- */
.saved { text-align: center; display: flex; flex-direction: column; justify-content: center; flex: 1; gap: 10px; }
.saved .mark { display: flex; justify-content: center; }
.brandmark circle { fill: none; stroke: var(--accent); stroke-width: 2.6; }
.brandmark path { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.safety { display: flex; flex-direction: column; gap: 14px; flex: 1; justify-content: center; }
.safety h2 { font-size: 22px; font-weight: 700; }
.safety p { margin: 0; font-size: 17px; }
.safety a.call { display: block; text-align: center; background: var(--panel); border-radius: var(--radius); padding: 16px; font-size: 18px; text-decoration: none; color: var(--text); }
.safety a.call b { color: var(--accent); }

/* ---- Settings and Share ---- */
.settings { gap: 0; }
.settings .card h2 { font-size: var(--fs-card); font-weight: 700; margin-bottom: 2px; }
.settings label { display: block; color: var(--muted); font-size: var(--fs-label); margin: 14px 0 6px; font-weight: 600; }
.settings .small { color: var(--muted); font-size: 14px; }
.settings input[readonly] { color: var(--muted); font-size: 14px; }
.settings .btn.secondary { margin-top: 8px; }
.settings .subhead { display: none; }
.settings .subhead2 { color: var(--accent); font-size: var(--fs-section); font-weight: 650; margin: 18px 0 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.medlist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.medrow { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; background: var(--panel-2); border-radius: var(--radius-s); padding: 10px 12px; }
.medrow .medname { font-weight: 600; grid-column: 1; }
.medrow input { grid-column: 1; padding: 8px 10px; font-size: 15px; background: var(--panel-3); }
.medrow .iconbtn { grid-column: 2; grid-row: 1 / span 2; font-size: 22px; color: var(--muted); }
.medsbox .row2 { flex-direction: column; align-items: stretch; }
.row3 { display: grid; grid-template-columns: 1.2fr 1fr 1.6fr; gap: 8px; }
.row3 input, .row3 select { width: 100%; min-width: 0; }
.medrow.full { display: flex; flex-direction: column; gap: 6px; }
.medrow.full .medhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.medrow.full .medtext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.medrow.full { overflow: hidden; }
.medrow.full .btnrow { justify-content: flex-start; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.medrow.full .btnrow .btn { flex: 0 0 auto; width: auto; padding: 6px 12px; min-height: 40px; font-size: 15px; }
.medstart { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.medstart input[type=date] { width: auto; font-size: 15px; padding: 7px 10px; }
.medrow.full .iconbtn { flex: none; font-size: 22px; color: var(--muted); margin: -6px -6px 0 0; }
.medrow.past { opacity: .75; }
.mededit { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.mededit[hidden] { display: none; }
.addmed { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.medpicker { display: flex; flex-direction: column; gap: 8px; }
.medpicker input[type=search] { width: 100%; font-size: 16px; padding: 12px 14px; }
.medresults { display: flex; flex-direction: column; gap: 6px; }
.meddose { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--panel-2); border-radius: var(--radius-s); }
.meddose .medname { font-weight: 700; font-size: 16px; }
.versionline { margin-top: 14px; color: var(--muted); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

/* ---- Research and Welcome ---- */
.research h2, .welcome h2 { font-size: 24px; font-weight: 750; margin: 6px 0 4px; letter-spacing: -.01em; }
.research h3 { font-size: 17px; margin: 18px 0 2px; }
.research .lead { font-weight: 600; }
.research .counts { line-height: 1.6; }
.research .counts b { color: var(--accent); font-size: 20px; }
.bigswitch { display: flex; align-items: center; gap: 16px; width: 100%; margin: 18px 0 8px; padding: 14px 16px; border-radius: 40px; border: 2px solid transparent; background: var(--panel); color: var(--text); font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; text-align: left; }
.bigswitch .knob { flex: 0 0 auto; width: 84px; height: 44px; border-radius: 22px; background: var(--panel-3); position: relative; transition: background .15s; }
.bigswitch .knob::after { content: ""; position: absolute; top: 4px; left: 4px; width: 36px; height: 36px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.bigswitch.on { border-color: var(--accent); }
.bigswitch.on .knob { background: var(--accent); }
.bigswitch.on .knob::after { left: 44px; }
.research .statusline { margin-top: 0; }
.research details.consent { margin: 14px 0; padding: 10px 14px; background: var(--panel); border-radius: var(--radius); }
.research details.consent summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.research details.consent h4 { margin: 12px 0 2px; font-size: 16px; }
.welcome p { line-height: 1.55; }
.welcome .safetynote { margin: 16px 0 18px; padding: 12px 14px; background: var(--panel); border-radius: var(--radius); }
.welcome .safetynote p { margin: 0; font-size: 15px; }
.welcome .safetynote a { color: var(--accent); font-weight: 600; }
.welcome .stackbtns a.btn { text-align: center; text-decoration: none; }

/* ---- How much tonight ---- */
.pick .picktrack { position: relative; margin: 14px 0 4px; }
.pick .picktrack::before { content: ''; position: absolute; left: 19px; top: 26px; bottom: 26px; width: 4px; border-radius: 2px; background: var(--panel-3); }
.pick .picknode { display: flex; align-items: center; gap: 16px; width: 100%; padding: 9px 4px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius-s); }
.pick .picknode .dot { position: relative; z-index: 1; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--accent); background: var(--bg); transition: background .15s, box-shadow .15s; }
.pick .picknode.on .dot { background: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.pick .picknode .lbl { display: flex; flex-direction: column; gap: 2px; }
.pick .picknode .t { font-weight: 700; font-size: 17px; }
.pick .picknode.on .t { color: var(--accent); }
.pick .picknode .s { color: var(--muted); font-size: 14px; line-height: 1.3; }

/* ---- misc ---- */
svg.chart { width: 100%; height: auto; background: var(--panel); border-radius: var(--radius-s); }
.legend { color: var(--muted); font-size: 13px; margin-top: 6px; }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--panel-3); color: var(--text); padding: 12px 16px; border-radius: var(--radius-s); max-width: 88vw; font-size: 15px; opacity: 0; transition: opacity .18s; pointer-events: none; z-index: 10; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
