:root {
  --bg: #f4f6f9; --surface: #ffffff; --text: #1b2530; --muted: #46566a; --accent: #1f4f7d; --on-accent: #ffffff;
  --border: #7d8ca0; --soft: #e3e9f0;
  --amber-bg: #fff1d6; --amber-text: #5c3b00; --amber-border: #a45f00;
  --red-bg: #fde4e1; --red-text: #7a1212; --red-border: #b3261e;
  --band: #5b86b0; --focus: #0b57d0;
  --r: 14px; --tap: 3rem;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #10151c; --surface: #1a222c; --text: #e8edf3; --muted: #aab7c6; --accent: #8bbcf0; --on-accent: #0b1a2b;
  --border: #66778c; --soft: #263140;
  --amber-bg: #3a2a08; --amber-text: #ffd88a; --amber-border: #d99a2b;
  --red-bg: #3d1412; --red-text: #ffb4ab; --red-border: #ff8a80;
  --band: #5f93c8; --focus: #9cc2ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: .75rem 1rem; z-index: 50; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 1rem; max-width: 46rem; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; }
.top-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
main { max-width: 46rem; margin: 0 auto; padding: 0 1rem 1rem; }
main:focus { outline: none; }
.tagline { margin: .25rem 0 1rem; color: var(--muted); }
section { background: var(--surface); border: 1px solid var(--soft); border-radius: var(--r); padding: 1rem; margin: 0 0 1rem; }
section[hidden] { display: none; }
h2 { font-size: 1.25rem; margin: 0 0 .5rem; line-height: 1.25; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
button, .btn, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.chip, .btn, .btn-ghost, .pill { min-height: var(--tap); min-width: var(--tap); border-radius: 999px; padding: .5rem 1rem; border: 1.5px solid var(--border); background: var(--surface); }
.chip { min-height: 2.75rem; font-size: .9rem; }
.btn { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; border-radius: var(--r); padding: .75rem 1.25rem; width: 100%; }
.btn-ghost { border-radius: var(--r); }
.pill[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: .75rem 0; padding: 0; list-style: none; }
.tile { display: block; width: 100%; min-height: 5rem; text-align: left; padding: .7rem .8rem; border-radius: var(--r); border: 1.5px solid var(--border); background: var(--surface); }
.tile:active { background: var(--soft); }
.tile b { display: block; font-size: 1.02rem; }
.tile span { display: block; font-size: .82rem; color: var(--muted); }
.strip { background: var(--soft); border-radius: var(--r); padding: .6rem .8rem; margin: .5rem 0; }
.dose { position: sticky; top: 0; background: var(--soft); border-radius: var(--r); padding: .6rem .8rem; font-weight: 700; z-index: 5; }
ul.drinks { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .5rem; }
ul.drinks li { border: 1px solid var(--soft); border-radius: var(--r); padding: .6rem; }
.row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .4rem; }
.row .pill, .row .btn-ghost { min-height: 2.75rem; padding: .3rem .8rem; font-size: .9rem; }
label { display: block; font-weight: 600; margin: .6rem 0 .2rem; }
input[type=number], input[type=text], input[type=time], input[type=tel], select { min-height: var(--tap); width: 100%; padding: .4rem .7rem; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); }
input[type=checkbox], input[type=radio] { width: 1.5rem; height: 1.5rem; margin-right: .6rem; flex: none; accent-color: var(--accent); }
.check { display: flex; align-items: flex-start; font-weight: 400; margin: .75rem 0; min-height: var(--tap); }
.err { color: var(--red-text); background: var(--red-bg); border-left: 4px solid var(--red-border); padding: .4rem .6rem; border-radius: 6px; margin: .3rem 0; }
.radios { display: grid; gap: .4rem; }
.radios label { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: var(--r); padding: .4rem .8rem; min-height: var(--tap); font-weight: 600; margin: 0; }
.range { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin: .3rem 0; }
.range-box { border: 2px solid var(--border); border-radius: var(--r); padding: .8rem; background: var(--surface); }
.range-box.amber { background: var(--amber-bg); color: var(--amber-text); border: 3px dashed var(--amber-border); }
.range-box.red { background: var(--red-bg); color: var(--red-text); border: 4px solid var(--red-border); }
.level-label { font-weight: 800; margin: .2rem 0; }
.trend { font-weight: 700; font-size: 1.1rem; }
.safety { border: 2px solid var(--border); border-radius: var(--r); padding: .8rem; margin: .8rem 0; background: var(--soft); font-weight: 600; }
.tag { display: inline-block; border: 1.5px solid var(--border); border-radius: 999px; padding: 0 .6rem; font-size: .85rem; font-weight: 700; }
.chart { width: 100%; height: auto; display: block; margin-top: .5rem; }
.chart .grid { stroke: var(--soft); stroke-width: 1; }
.chart .tick { stroke: var(--muted); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .band { fill: var(--band); fill-opacity: .35; stroke: var(--band); stroke-width: 1.2; }
.chart .band.future { fill-opacity: .2; stroke-dasharray: 5 4; }
.chart .mid { fill: none; stroke: var(--text); stroke-width: 1; }
.chart .now { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 2 3; }
.chart .read { stroke: var(--accent); stroke-width: 2; }
.chart .legal { stroke: var(--red-border); stroke-width: 1.5; stroke-dasharray: 8 3; }
.chart .legal-t { fill: var(--red-text); font-size: 11px; font-weight: 700; }
.chart .drink { stroke: var(--text); stroke-width: 2; }
.chart .drink-dot { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
input[type=range] { width: 100%; min-height: var(--tap); accent-color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--soft); }
details { border-top: 1px solid var(--soft); padding: .4rem 0; }
summary { cursor: pointer; font-weight: 700; min-height: var(--tap); display: flex; align-items: center; }
pre.steps { white-space: pre-wrap; font: inherit; margin: .4rem 0; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--soft); z-index: 20; }
.btn-return { display: block; width: 100%; max-width: 46rem; margin: 0 auto; min-height: 3.25rem; border-radius: var(--r); border: 2px solid var(--accent); background: var(--surface); color: var(--text); font-weight: 800; }
.spacer { height: 5rem; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
dialog { width: min(40rem, calc(100vw - 1rem)); max-height: calc(100vh - 1rem); border: 2px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); padding: 1rem; overflow-y: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dir { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .5rem; }
.dir li { border: 1px solid var(--soft); border-radius: var(--r); padding: .6rem; }
.dir a.btn-ghost, .dir a.pill { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); font-weight: 700; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .range { font-size: 2.3rem; } }
@media (prefers-reduced-motion: no-preference) { .tile, .btn, .pill { transition: background-color .15s; } }

.bare { border: 0; padding: 0; margin: 0; }
.mt0 { margin-top: 0; }
.mt1 { margin-top: 1rem; }
.mt6 { margin-top: .6rem; }
.wauto { width: auto; }
.grow { flex: 1; min-width: 6rem; }
.notice { background: var(--soft); border: 2px solid var(--accent); border-radius: var(--r); padding: .7rem; margin: .5rem 0; }
.chart { touch-action: pan-y; cursor: crosshair; }

.top { flex-wrap: nowrap; padding: .4rem 1rem; }
.top-actions { flex-wrap: nowrap; }
.chip { min-width: 0; padding: .3rem .8rem; }
.tagline { margin: 0 0 .6rem; }
.tile { min-height: 4.2rem; padding: .55rem .7rem; }
section { padding: .85rem; margin-bottom: .75rem; }
.unit { min-height: var(--tap); min-width: 4rem; border-radius: 999px; border: 2px solid var(--accent); background: var(--surface); color: var(--text); font-weight: 800; padding: 0 .9rem; }
.linkbtn { background: none; border: 0; color: var(--accent); text-decoration: underline; min-height: var(--tap); padding: 0; font-weight: 600; }
