/* Caliber Code — design system.
   Built for a gloved thumb on a bouncing ambulance bench at 3am:
   minimum 56px targets, high contrast, no thin type, no hover-only affordances.

   Colour has four meanings and no others: green = the dose, amber = caution
   (capped, base order), red = danger (high alert, action due), Caliber gold =
   where you are (never an alert). Every colour signal also carries a word, because fatigue and red-green
   colour blindness both erase colour. Broselow zone colours are never reused.
   Candidate schemes and their scores: design/palette.html. */

:root {
  /* Caliber brand (calibermedtraining.com): near-black panels, warm off-white
     text, gold as the brand and "where you are" colour. Clinical meanings are
     unchanged: mint = dose, amber = caution, red = danger. */
  --bg:        #070708;
  --surface:   #111114;
  --surface-2: #16161A;
  --surface-3: #1E1E23;
  --line:      #2c261a;   /* site border: gold at 15% on panel */
  --text:      #EAE6DC;
  --text-dim:  #adaaa4;   /* site --muted (72%) on panel: 8.1:1 */
  --text-mute: #989590;   /* site --subtle (62%) on panel: 6.3:1 */
  --stripe:    #3a3a42;   /* neutral med stripe; only HIGH ALERT gets colour */

  --accent:    #C49A3C;   /* Caliber gold — selection only, never an alert */
  --accent-dk: #6b521c;
  --gold-light:#E2B96A;
  --danger:    #ff4d4f;
  --danger-dk: #8f1f21;
  --warn:      #ffb020;   /* caution stays amber: gold vs amber deutan ΔE 25 */
  --warn-dk:   #6b4a06;
  --go:        #3ddc97;   /* mint: stays distinct from --danger for red-green colour-blind eyes */
  --go-dk:     #0f4d33;
  --violet:    #a06ee1;

  --radius: 14px;
  --tap: 56px;
  --pad: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --display: "Barlow Condensed", "Inter", -apple-system, system-ui, sans-serif;
  --logo: "Libre Baskerville", Georgia, "Times New Roman", serif;   /* the wordmark only */
  --mono: var(--font);   /* no typewriter face: times and hashes use Inter's even-width digits */
}

/* Brand fonts ship with the app (fonts/, SIL OFL 1.1) — offline is the operating assumption. */
@font-face { font-family: "Inter"; src: url("../fonts/Inter-400-800-latin.woff2") format("woff2");
             font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("../fonts/BarlowCondensed-700-latin.woff2") format("woff2");
             font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("../fonts/BarlowCondensed-800-latin.woff2") format("woff2");
             font-weight: 800; font-style: normal; font-display: swap; }
/* Logo face only — the calibermedtraining.com wordmark serif. Never used for text. */
@font-face { font-family: "Libre Baskerville"; src: url("../fonts/LibreBaskerville-700-latin.woff2") format("woff2");
             font-weight: 700; font-style: normal; font-display: block; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 17px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
main  { flex: 1; padding: var(--pad); padding-bottom: 96px; max-width: 900px; margin: 0 auto; width: 100%; }

/* ── Banner: unapproved content ───────────────────────────────────────────── */
/* Required until a medical director signs (CLAUDE.md rule 1). Caliber gold on
   black — on-brand, but still a full-width line that cannot be missed. */
.gate-banner {
  background: var(--bg); color: var(--accent); padding: 9px var(--pad);
  font-size: 14px; font-weight: 700; text-align: center; letter-spacing: .03em;
  border-top: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
}
.gate-banner strong { color: var(--gold-light); font-family: var(--display); font-size: 16px; letter-spacing: .08em; }

/* ── Banner: new version installed ───────────────────────────────────────── */
.update-banner {
  display: block; width: 100%; min-height: var(--tap);
  background: var(--accent-dk); color: #fff; padding: 10px var(--pad);
  font-size: 15px; font-weight: 700; text-align: center; border-bottom: 2px solid var(--accent);
}

/* ── Patient bar ──────────────────────────────────────────────────────────── */
.patient-bar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: stretch; gap: 1px;
  top: env(safe-area-inset-top);
}
.patient-bar button {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 10px 12px; min-height: var(--tap); background: var(--surface);
  border-left: 4px solid transparent; text-align: left;
}
.patient-bar button:active { background: var(--surface-2); }
.patient-bar .pb-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mute); }
.patient-bar .pb-value { font-size: 20px; font-weight: 750; line-height: 1.15; }
.patient-bar .pb-sub   { font-size: 12px; color: var(--text-dim); }
.zone-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3);
}
.zone-dot { width: 10px; height: 10px; border-radius: 50%; }

/* No patient is a call to act, not an emergency: Caliber gold, never alarm red.
   The header carries no zone colour either — the zone is named in words. */
.patient-bar .has-patient, .patient-bar .no-patient { border-left-color: var(--accent); }
.patient-bar.unset { box-shadow: inset 0 -2px 0 var(--accent); }
.no-patient { background: var(--surface) !important; }
.no-patient .pb-label, .no-patient .pb-value { color: var(--accent); }
.zone-chip { text-transform: uppercase; letter-spacing: .06em; color: var(--text); }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; min-height: 62px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-mute); font-size: 11px; font-weight: 600;
}
.tabbar button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.tabbar button[aria-selected="true"] { color: var(--accent); background: var(--surface-2); }
.tabbar button.alarm[aria-selected="true"] { color: var(--danger); }

/* ── Cards & lists ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.card-head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.card-body { padding: 14px; }
.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-mute); font-weight: 700; margin: 22px 0 10px;
}
.section-title:first-child { margin-top: 4px; }

/* ── The med row — the single most important object in the product ────────── */
.med {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--stripe); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; min-height: var(--tap);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
}
/* A long word ("asthma/anaphylaxis") must wrap, never push the volume off-screen. */
.med-name, .med-ind { overflow-wrap: break-word; }
.med:active { background: var(--surface-2); }
.med-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.med-ind  { font-size: 13px; color: var(--text-dim); grid-column: 1; }
.med-volume {
  grid-row: 1 / span 2; grid-column: 2; text-align: right;
  font-variant-numeric: tabular-nums;
}
.med-volume .v-big {
  font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em;
  color: var(--go); display: block;
}
.med-volume .v-unit { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.med-volume .v-dose { font-size: 13px; color: var(--text-dim); display: block; margin-top: 2px; }
.med.high-alert { border-left-color: var(--danger); }
.med.high-alert .med-name::after {
  content: "HIGH ALERT"; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  background: var(--danger-dk); color: var(--danger-text); padding: 2px 6px; border-radius: 4px;
  margin-left: 8px; vertical-align: middle; white-space: nowrap;
}
.med.capped .v-big { color: var(--warn); }
.med .tag {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 2px 6px; border-radius: 4px;
  margin-left: 8px; vertical-align: middle; white-space: nowrap;
  background: var(--warn-dk); color: var(--warn-text);
}
.med.infusion .v-big { color: var(--violet); font-size: 24px; }

/* ── Adult / Pediatric list picker ── */
.list-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.list-btn {
  min-height: 64px; border-radius: var(--radius); background: var(--surface-2);
  border: 2px solid var(--line); font-size: 19px; font-weight: 800; letter-spacing: .01em;
}
.list-btn[aria-pressed="true"] { background: var(--accent-dk); border-color: var(--accent); color: #fff; }
.med.locked .v-lock {
  display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px;
}

/* ── Data rows ────────────────────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row-label { color: var(--text-dim); font-size: 15px; }
.row-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.row-sub   { font-size: 12px; color: var(--text-mute); display: block; font-weight: 400; }
.row.alert { background: var(--danger-tint); }
.row.alert .row-value { color: var(--danger); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--radius);
  background: var(--surface-3); color: var(--text); font-weight: 700; font-size: 16px;
  border: 1px solid var(--line);
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent-dk); border-color: var(--accent); }
.btn-danger  { background: var(--danger-dk); border-color: var(--danger); color: var(--danger-text); }
.btn-go      { background: var(--go-dk); border-color: var(--go); }
.btn-block   { display: flex; width: 100%; }
.btn-ghost   { background: transparent; }
.btn-row     { display: flex; gap: 10px; margin-bottom: 12px; }
.btn-row .btn { flex: 1; }

/* ── Patient picker ───────────────────────────────────────────────────────── */
.age-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.age-btn {
  min-height: 68px; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--line); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  border-top: 4px solid var(--zone, var(--line));
}
.age-btn:active, .age-btn[aria-pressed="true"] { background: var(--accent-dk); border-color: var(--accent); }
.age-btn .a-label { font-size: 16px; font-weight: 750; }
.age-btn .a-kg    { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 0 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); font-size: 17px;
}
.field textarea { padding: 12px 14px; min-height: 100px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface-3);
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* ── Sheet / modal ────────────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; background: var(--backdrop); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--surface); width: 100%; max-width: 620px;
  border-radius: 20px 20px 0 0; max-height: 92dvh; overflow-y: auto;
  border-top: 1px solid var(--line); animation: slideUp .18s ease-out;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6 } to { transform: none; opacity: 1 } }
.sheet-head {
  position: sticky; top: 0; background: var(--surface); z-index: 2;
  padding: 16px var(--pad) 12px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.sheet-title { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.sheet-sub   { font-size: 13px; color: var(--text-dim); }
.sheet-body  { padding: var(--pad); }
.sheet-close { min-width: 44px; min-height: 44px; border-radius: 50%; background: var(--surface-3); font-size: 20px; }

/* The number the clinician actually reads. */
.dose-hero {
  text-align: center; padding: 26px 16px; background: var(--surface-2);
  border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--line);
}
.dose-hero .hero-vol {
  font-size: 58px; font-weight: 850; line-height: 1; letter-spacing: -.035em;
  color: var(--go); font-variant-numeric: tabular-nums;
}
.dose-hero.capped .hero-vol   { color: var(--warn); }
.dose-hero.infusion .hero-vol { color: var(--violet); font-size: 44px; }
.dose-hero .hero-dose { font-size: 19px; font-weight: 700; margin-top: 8px; }
.dose-hero .hero-conc {
  font-size: 14px; color: var(--text-dim); margin-top: 6px;
  font-family: var(--mono); background: var(--bg); display: inline-block;
  padding: 4px 10px; border-radius: 6px;
}
.dose-hero .hero-perkg { font-size: 13px; color: var(--text-mute); margin-top: 8px; }

.warnings { margin-bottom: 14px; }
.warning {
  display: flex; gap: 10px; padding: 11px 13px; border-radius: 10px;
  background: var(--warn-tint-2); border: 1px solid var(--warn-dk);
  color: var(--warn-text); font-size: 14px; margin-bottom: 8px; line-height: 1.4;
}
.warning.critical { background: var(--danger-tint); border-color: var(--danger-dk); color: var(--danger-soft); }
.warning::before { content: "⚠"; font-size: 16px; flex-shrink: 0; }

/* ── CPR Assist ───────────────────────────────────────────────────────────── */
.cpr { text-align: center; }
.cpr-clock {
  font-size: 76px; font-weight: 850; font-variant-numeric: tabular-nums;
  letter-spacing: -.04em; line-height: 1; margin: 8px 0;
}
.cpr-cycle { font-size: 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.cpr-ring {
  position: relative; width: 220px; height: 220px; margin: 18px auto;
  display: flex; align-items: center; justify-content: center;
}
.cpr-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }  /* without a size WebKit draws nothing */
.cpr-ring circle { fill: none; stroke-width: 12; stroke-linecap: round; }
.cpr-ring .track { stroke: var(--surface-3); }
.cpr-ring .prog  { stroke: var(--accent); transition: stroke-dashoffset .3s linear; }   /* gold: progress, not a dose */
.cpr-ring.due .prog { stroke: var(--danger); }
.cpr-timers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.cpr-timer {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; text-align: center;
}
.cpr-timer.due { border-color: var(--danger); background: var(--danger-tint); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .62 } }

/* CPR actions: one tile style. Colour only when something is due — and then
   the label says so in words. */
.cpr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cpr-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 76px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
}
.cpr-btn.wide { grid-column: 1 / -1; min-height: 84px; }
.cpr-btn:active { transform: scale(.985); background: var(--surface-3); }
.cpr-btn:disabled { opacity: .55; }
.cpr-btn-label { font-family: var(--display); font-size: 21px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.cpr-btn-sub { font-size: 13px; color: var(--text-dim); }
.cpr-btn.primary { border-color: var(--accent); }
.cpr-btn.primary .cpr-btn-label { color: var(--accent); }
.cpr-btn.rosc .cpr-btn-label { color: var(--go); }
.cpr-btn.due { background: var(--danger-dk); border-color: var(--danger); }
.cpr-btn.due .cpr-btn-label, .cpr-btn.due .cpr-btn-sub { color: #ffe1e1; }
.cpr-end {
  grid-column: 1 / -1; margin-top: 8px; min-height: 48px; border-radius: var(--radius);
  background: transparent; border: 1px dashed var(--line); color: var(--text-mute);
  font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.cpr-timer .t-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mute); font-weight: 700; }
.cpr-timer .t-value { font-size: 27px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ── Event log ────────────────────────────────────────────────────────────── */
.event {
  display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: baseline;
  padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.event:last-child { border-bottom: none; }
.event-time { font-family: var(--mono); font-size: 13px; color: var(--text-mute); }
.event-what { font-weight: 600; }
.event-detail { font-size: 13px; color: var(--text-dim); grid-column: 2; }
.event-el { font-size: 13px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.event.med-event { border-left: 3px solid var(--go); }
.event.shock-event { border-left: 3px solid var(--warn); }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.search { position: relative; margin-bottom: 12px; }
.search input { padding-left: 42px; }
.search::before {
  content: "⌕"; position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--text-mute); font-size: 21px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 9px 15px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: 14px; font-weight: 650; white-space: nowrap; min-height: 42px;
}
.chip[aria-pressed="true"] { background: var(--accent-dk); border-color: var(--accent); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-mute); }
/* Monochrome glyphs in Caliber gold — colour emoji would bring their own reds. */
.empty-icon { font-size: 42px; color: var(--accent); opacity: .55; margin-bottom: 12px;
              font-variant-emoji: text; font-family: var(--font); }
.pill {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: 5px; background: var(--surface-3); color: var(--text-dim);
  letter-spacing: .04em; text-transform: uppercase;
}
.pill.ok    { background: var(--go-dk); color: var(--go-pill); }
.pill.warn  { background: var(--warn-dk); color: var(--warn-text); }
.pill.bad   { background: var(--danger-dk); color: var(--danger-text); }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--text-dim); font-size: 14px; }
.mono { font-family: var(--font); font-variant-numeric: tabular-nums; }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; }
.protocol-step { padding: 11px 0 11px 26px; position: relative; border-bottom: 1px solid var(--line); line-height: 1.5; }
.protocol-step:last-child { border-bottom: none; }
.protocol-step::before {
  content: ""; position: absolute; left: 6px; top: 19px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.checkitem { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); min-height: var(--tap); }
.checkitem input { width: 26px; height: 26px; accent-color: var(--go); flex-shrink: 0; }
.checkitem.done span { text-decoration: line-through; color: var(--text-mute); }
@media (min-width: 720px) { .age-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); } }

/* ── Caliber display type ─────────────────────────────────────────────── */
.section-title, .sheet-title, .list-btn, .cpr-cycle, .patient-bar .pb-label, .tabbar button {
  font-family: var(--display); letter-spacing: .06em;
}
.section-title { color: var(--accent); font-weight: 800; font-size: 13px; }
.sheet-title   { font-weight: 800; font-size: 24px; letter-spacing: .02em; text-transform: uppercase; }
.list-btn      { font-size: 22px; font-weight: 800; text-transform: uppercase; }
.list-btn[aria-pressed="true"] { color: var(--on-accent); }
.tabbar button { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.tabbar button[aria-selected="true"] { box-shadow: inset 0 3px 0 var(--accent); }
.chip[aria-pressed="true"], .age-btn[aria-pressed="true"] { color: var(--on-accent); }
.btn-primary   { color: var(--on-accent); }

/* ── Protocol PDFs (Reference → Protocol PDFs) ── */
.doc-policy { font-family: var(--display); font-weight: 800; letter-spacing: .08em; color: var(--accent); font-size: 13px; text-transform: uppercase; }
.doc-title { font-size: 19px; font-weight: 800; margin: 2px 0 4px; }
.doc-hash { font-size: 11px; word-break: break-all; font-weight: 500; }
.doc-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 6px; }
.doc-section {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px;
}
.doc-section .doc-page { margin-left: auto; color: var(--text-mute); font-size: 12px; }
a.btn { text-decoration: none; color: var(--text); }
.source-link { margin-bottom: 12px; border-color: var(--accent); color: var(--accent) !important; }

/* ── Brand bar ─────────────────────────────────────────────────────────── */
.brand-bar {
  display: flex; align-items: baseline; gap: 10px; padding: 10px var(--pad) 8px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
/* Wordmark: CALIBER · EKG · CODE (calibermedtraining.com style). */
.logo { display: inline-flex; align-items: center; gap: 9px; line-height: 1;
        font-family: var(--logo); font-weight: 700; font-size: 17px; letter-spacing: .14em; text-transform: uppercase; }
.logo-caliber { color: var(--accent); }
.logo-code    { color: var(--text); }
.logo-ekg     { display: inline-flex; width: 38px; height: 18px; }
.logo-ekg svg { width: 100%; height: 100%; overflow: visible; }
.logo-ekg polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round;
                     vector-effect: non-scaling-stroke; stroke-dasharray: 80; stroke-dashoffset: 0; }
.logo.animate .logo-ekg polyline { stroke-dashoffset: 80; animation: ekg-draw 1.6s ease forwards .2s; }
@keyframes ekg-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .logo.animate .logo-ekg polyline { animation: none; stroke-dashoffset: 0; } }
.brand-region { margin-left: auto; font-size: 12px; color: var(--text-mute); letter-spacing: .04em; text-align: right; }

/* ── Search: full width, dark, one icon ────────────────────────────────── */
.search input {
  width: 100%; min-height: 48px; padding: 0 14px 0 42px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--text-mute); }
.search input::-webkit-search-decoration, .search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search input:focus { outline: none; border-color: var(--accent); }

/* ══ Type system — two families, one rule each ═════════════════════════════
   Barlow Condensed: every label, heading, button, tab and tag — capitals.
   Inter: every sentence and every number (tabular figures, so digits align).
   Sizes: eyebrow 13 · tag 11 · button 18–21 · title 22–24 · body 15–17.   */
.section-title, .cpr-cycle, .t-label, .pb-label, .tabbar button, .lbl, .doc-policy,
.zone-chip, .sheet-title, .list-btn, .cpr-btn-label, .cpr-end, .btn, .chip,
.tag, .pill, .med.high-alert .med-name::after, .gate-banner, .update-banner, .age-btn .a-label,
.v-lock, .warning.critical strong {
  font-family: var(--display); text-transform: uppercase; font-style: normal;
}

/* Eyebrow labels — the small word above a value. */
.section-title, .cpr-cycle, .cpr-timer .t-label, .patient-bar .pb-label, .doc-policy {
  font-size: 13px; font-weight: 700; letter-spacing: .1em;
}
.cpr-timer .t-label, .patient-bar .pb-label { color: var(--text-mute); }
.section-title, .doc-policy { color: var(--accent); }
.cpr-cycle { color: var(--text-dim); font-size: 15px; }

/* Tags — never below 11px. */
.tag, .pill, .med.high-alert .med-name::after { font-size: 11px; font-weight: 800; letter-spacing: .08em; }

/* Buttons, chips, tabs. */
.btn          { font-size: 18px; font-weight: 800; letter-spacing: .05em; }
.chip         { font-size: 15px; font-weight: 700; letter-spacing: .05em; }
.tabbar button{ font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.cpr-end      { font-size: 15px; font-weight: 700; letter-spacing: .08em; }
.zone-chip    { font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.age-btn .a-label { font-size: 19px; font-weight: 800; letter-spacing: .03em; }
.gate-banner  { font-size: 15px; font-weight: 700; letter-spacing: .05em; }
.gate-banner strong { font-size: 15px; }
.update-banner{ font-size: 17px; letter-spacing: .05em; }

/* Numbers stay Inter with aligned digits; a word in a number's place uses the label face. */
.t-value, .cpr-clock, .v-big, .hero-vol, .row-value, .event-time, .pb-value, .a-kg {
  font-family: var(--font); font-variant-numeric: tabular-nums;
}
.cpr-timer .t-value.word { font-family: var(--display); text-transform: uppercase; font-size: 24px; letter-spacing: .04em; color: var(--text-dim); }
.hero-conc { font-family: var(--font); font-weight: 600; }

/* ══ Screen fitting ═══════════════════════════════════════════════════════
   Checked with scripts/screenfit.swift at 320–1280 px wide (npm run screenfit). */

/* Notch / Dynamic Island: a solid strip under the status bar, so content that
   scrolls up never shows through it. Only the brand bar pads for it. */
.app::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top);
               background: var(--bg); z-index: 45; }
.chip { min-height: 44px; }
.brand-region { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand-bar { align-items: center; }

/* Phones: one-line header, so the screen is for the patient, not the chrome. */
@media (max-width: 520px) {
  .brand-bar { padding: 8px 12px 7px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 8px; }
  .logo { font-size: 14px; letter-spacing: .1em; gap: 6px; }
  .logo-ekg { width: 28px; height: 14px; }
  .brand-region { font-size: 11px; }
  .brand-suffix { display: none; }
  .gate-banner { font-size: 13px; padding: 6px 10px; }
  .gate-banner strong { font-size: 13px; }
  .gate-more { display: none; }
  .patient-bar button { padding: 8px 10px; }
  .patient-bar .pb-value { font-size: 18px; }
}

/* Short screens (small phones, phones in landscape): CPR controls stay in view. */
@media (max-height: 760px) {
  .cpr-ring { width: 150px; height: 150px; margin: 6px auto; }
  .cpr-clock { font-size: 50px; margin: 4px 0; }
  .cpr-timers { margin: 10px 0; }
  .cpr-timer { padding: 8px; }
  .cpr-timer .t-value { font-size: 22px; }
  .cpr-btn { min-height: 62px; }
  .cpr-btn.wide { min-height: 66px; }
  .cpr-btn-label { font-size: 18px; }
}
@media (max-height: 460px) {           /* landscape phone */
  .cpr-ring { width: 120px; height: 120px; }
  .cpr-clock { font-size: 40px; }
  .gate-banner { padding: 4px 10px; }
}

/* Very short phones (≤ 640 tall): drop the ring, keep a compact clock so the
   first CPR controls are visible without scrolling. */
@media (max-height: 640px) {
  .cpr-ring { width: auto; height: auto; margin: 2px 0 4px; }
  .cpr-ring svg { display: none; }
  .cpr-clock { font-size: 44px; }
  .cpr-timers { margin: 6px 0 8px; gap: 8px; }
  .cpr-timer { padding: 6px 8px; }
  .cpr-timer .t-value { font-size: 20px; }
  .cpr-timer .t-value.word { font-size: 16px; }
  .cpr-btn { min-height: 56px; padding: 6px 10px; }
  .cpr-btn.wide { min-height: 60px; }
  .cpr-btn-label { font-size: 17px; }
  .cpr-btn-sub { font-size: 12px; }
}
@media (max-width: 380px) { .cpr-timer .t-value.word { font-size: 16px; } }

/* Phone held sideways: compact header, clock and timers left, controls right. */
@media (max-height: 460px) and (min-width: 600px) {
  .brand-bar { padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top)); }
  .logo { font-size: 14px; }
  .logo-ekg { width: 28px; height: 14px; }
  .brand-suffix, .gate-more { display: none; }
  .gate-banner { font-size: 13px; }
  .patient-bar button { padding: 6px 10px; min-height: 48px; }
  .cpr { display: grid; grid-template-columns: minmax(220px, 1fr) 1.5fr; gap: 12px; align-items: start; text-align: center; }
  .cpr > .cpr-ring, .cpr > .cpr-timers, .cpr > div:not(.cpr-grid):not(.cpr-timers):not(.cpr-ring) { grid-column: 1; }
  .cpr > .cpr-grid { grid-column: 2; grid-row: 1 / span 4; }
  .cpr-ring svg { display: none; }
  .cpr-ring { width: auto; height: auto; margin: 0; }
  .cpr-btn { min-height: 52px; }
  .cpr-btn.wide { min-height: 56px; }
}

/* The clock sits inside the 220 px ring; 76 px digits collided with it. */
.cpr-ring .cpr-clock { font-size: 58px; }
@media (max-height: 760px) { .cpr-ring .cpr-clock { font-size: 40px; } }
@media (max-height: 640px) { .cpr-ring .cpr-clock { font-size: 44px; } }

/* Med list: indications clamp to two lines so a phone shows several drugs at
   once. The full indication is on the dose screen, one tap away. */
.med .med-ind { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ══ Elevated (design direction B, chosen by Zeke 2026-10-31) ══════════════
   Warm, premium, tactile. Soft depth and larger radii; the dose lives in a mint
   capsule; gold is used as light. The four colour meanings are unchanged:
   mint = dose, amber = caution, red = danger, gold = where you are.
   Review page: design/field.html#B. */
:root {
  --r-lg: 22px; --r-md: 18px; --r-sm: 14px;
  /* Surfaces and edges */
  --edge: #25252b;  --edge-2: #2a2a30;  --hair: #1f1f24;  --split: #222228;
  --flat: #121215;  --sunk: #16161a;    --press: #18181d; --round: #1b1b20;
  --card-grad:  linear-gradient(180deg, #151519, #111114);
  --raise-grad: linear-gradient(180deg, #17171b, #121215);
  --tabbar-grad: linear-gradient(180deg, #121215, #0c0c0e);
  --tabbar-shadow: 0 -10px 24px rgba(0,0,0,.45);
  --sheet-head-bg: rgba(17,17,20,.9);
  --backdrop: rgba(0,0,0,.68);
  --page-glow: #1a1610;  --sheet-glow: #0f1d16;
  --lift: 0 6px 18px rgba(0,0,0,.28);    /* resting card */
  --lift-hi: 0 10px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
  /* Gold (where you are) */
  --band-grad: linear-gradient(90deg, #17120a, #1e170b, #17120a);  --band-edge: #5a4415;
  --gold-tint: rgba(196,154,60,.1);  --gold-tint-2: rgba(196,154,60,.14);  --gold-tint-3: rgba(196,154,60,.06);
  --gold-ring: rgba(196,154,60,.28); --gold-ring-2: rgba(196,154,60,.45);
  --gold-glow: rgba(196,154,60,.25); --gold-glow-2: rgba(196,154,60,.35);
  --gold-panel: #18130a; --gold-edge: #6b521c;
  --on-accent: #F8F5EE;   /* text on the dark gold buttons */
  /* Mint (the dose) */
  --go-tint: rgba(61,220,151,.09);  --go-ring: rgba(61,220,151,.28);
  --go-soft: #9fe7c6;  --go-soft-2: #a9d8c2;  --go-eyebrow: #8fd9b6;  --go-pill: #b6f0c4;
  --mint-glow: rgba(61,220,151,.25);  --hero-glow: rgba(61,220,151,.25);
  /* Amber (caution) */
  --warn-tint: rgba(255,176,32,.09);  --warn-tint-2: rgba(255,176,32,.11);  --warn-ring: rgba(255,176,32,.32);
  --warn-text: #ffd98a;  --warn-soft: #f2cf8c;  --warn-glow: rgba(255,176,32,.22);
  /* Violet (drips) */
  --violet-tint: rgba(160,110,225,.1);  --violet-ring: rgba(160,110,225,.32);  --violet-soft: #cdb4ef;  --violet-glow: rgba(160,110,225,.22);
  /* Red (danger) */
  --danger-tint: rgba(255,77,79,.12);  --danger-text: #ffd7d7;  --danger-soft: #ffcaca;
  --danger-edge: #6d2023;  --danger-edge-2: #4a1d1f;  --danger-panel: #1a0a0b;
  --danger-grad: linear-gradient(180deg, #2a0f11, #1d0a0b);  --danger-glow: rgba(255,77,79,.35);
}
body { background: radial-gradient(120% 420px at 50% -120px, var(--page-glow) 0%, var(--bg) 70%) no-repeat, var(--bg); }

/* Header: the county as a gold pill; the warning as an inset gold band. */
.brand-bar { background: transparent; border-bottom: none; }
.brand-region {
  font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); background: var(--gold-tint); border: 1px solid var(--gold-ring);
  padding: 5px 10px; border-radius: 999px; max-width: 58%;
}
.gate-banner {
  margin: 0 12px; border-radius: 12px; border: 1px solid var(--band-edge);
  background: var(--band-grad);
}

/* Patient: a raised card. Sticky, with the page colour behind its margin so
   scrolled content never shows through the gap. Zone stays words only. */
.patient-bar {
  margin: 10px 12px 0; border: 1px solid var(--edge-2); border-radius: var(--r-lg); overflow: hidden;
  background: var(--raise-grad); box-shadow: var(--lift-hi), 0 -10px 0 var(--bg);
  gap: 0;
}
.patient-bar button, .patient-bar .no-patient { background: transparent !important; border-left: none; }
.patient-bar button + button { border-left: 1px solid var(--split); }
.patient-bar .has-patient .pb-value { font-size: 26px; letter-spacing: -.03em; line-height: 1.05; }
.patient-bar .pb-value { font-weight: 800; }
.patient-bar.unset { box-shadow: var(--lift-hi), 0 -10px 0 var(--bg), inset 0 0 0 1px var(--gold-ring-2); }
.zone-chip { background: transparent; padding: 0; font-size: 15px; font-weight: 800; letter-spacing: .1em; }
main { padding-top: 14px; }

/* Adult / Pediatric: the chosen list glows gold. */
.list-btn { min-height: 58px; border-radius: var(--r-md); background: var(--flat); border: 1px solid var(--edge-2); color: var(--text-dim); }
.list-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #d4aa4b, #b38a32); color: #120d03; border-color: transparent;
  box-shadow: 0 8px 24px var(--gold-glow);
}
.search input { min-height: 50px; border-radius: 16px; background: var(--flat); border-color: var(--edge-2); }
.chip { border-radius: 14px; background: var(--flat); border-color: var(--edge-2); color: var(--text-dim); }
.chip[aria-pressed="true"] { background: var(--gold-tint-2); border-color: var(--accent); color: var(--gold-light); }

/* Category headings: light gold with a count. */
.section-title { color: var(--gold-light); font-size: 14px; letter-spacing: .14em; margin-left: 6px; display: flex; align-items: baseline; gap: 8px; }
.section-count { color: var(--text-mute); font-size: 12px; letter-spacing: .1em; }

/* The med card. */
.med {
  grid-template-columns: minmax(0, 1fr) auto; border-radius: 20px; border: 1px solid var(--edge);
  border-left: 1px solid var(--edge); background: var(--card-grad); box-shadow: var(--lift);
  padding: 14px 14px 14px 16px;
}
.med:active { background: var(--press); }
.med-name, .med-ind { overflow-wrap: break-word; }
.med-name { font-size: 17px; line-height: 1.22; }
.med .med-ind { color: var(--text-mute); margin-top: 2px; }
.med.high-alert { border-color: var(--danger-edge-2); box-shadow: var(--lift), inset 3px 0 0 var(--danger); }

/* The dose capsule: number and unit on one line, the dose beneath. */
.med-volume.capsule {
  min-width: 86px; text-align: center; padding: 8px 10px; border-radius: 16px;
  background: var(--go-tint); border: 1px solid var(--go-ring);
}
.med-volume.capsule .v-big { display: inline; font-size: 24px; line-height: 1.05; }
.med-volume.capsule .v-unit { color: var(--go-soft); margin-left: 3px; }
.med-volume.capsule .v-dose { color: var(--go-soft-2); font-size: 12px; white-space: nowrap; }
.med.capped .med-volume.capsule { background: var(--warn-tint); border-color: var(--warn-ring); }
.med.capped .med-volume.capsule .v-unit, .med.capped .med-volume.capsule .v-dose { color: var(--warn-soft); }
.med.infusion .med-volume.capsule { background: var(--violet-tint); border-color: var(--violet-ring); }
.med.infusion .med-volume.capsule .v-big { font-size: 20px; }
.med.infusion .med-volume.capsule .v-unit, .med.infusion .med-volume.capsule .v-dose { color: var(--violet-soft); }
.med.locked .v-lock { border-radius: 14px; padding: 8px 12px; background: var(--sunk); }

/* Cards everywhere else follow the same language. */
.card { border-radius: 20px; border-color: var(--edge); background: var(--card-grad); box-shadow: var(--lift); }
.card-head { background: transparent; }
.row { border-bottom-color: var(--hair); }
.btn { border-radius: var(--r-sm); }
.warning { border-radius: var(--r-sm); }
.warning.critical { background: var(--danger-grad); border-color: var(--danger-edge); color: var(--danger-soft); }

/* ── Dose screen ── */
.sheet {
  border-radius: 26px 26px 0 0; border: 1px solid var(--edge); border-bottom: none;
  background: radial-gradient(120% 360px at 50% 0%, var(--sheet-glow) 0%, var(--surface) 70%) no-repeat, var(--surface);
}
.sheet-head { background: var(--sheet-head-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom-color: var(--hair); }
.sheet-close { background: var(--round); border: 1px solid var(--edge-2); color: var(--text-dim); }
.dose-hero { background: transparent; border: none; padding: 18px 8px 6px; margin-bottom: 10px; }
.hero-eyebrow { font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--go-eyebrow); }
.dose-hero .hero-vol { font-size: 84px; font-weight: 800; letter-spacing: -.05em; margin-top: 2px; text-shadow: 0 0 40px var(--hero-glow); }
.hero-unit { font-size: 32px; letter-spacing: -.01em; color: var(--go-soft); }
.dose-hero.capped .hero-eyebrow, .dose-hero.capped .hero-unit { color: var(--warn-soft); }
.dose-hero.capped .hero-vol { text-shadow: 0 0 40px var(--warn-glow); }
.dose-hero.infusion .hero-eyebrow, .dose-hero.infusion .hero-unit { color: var(--violet-soft); }
.dose-hero.infusion .hero-vol { font-size: 60px; text-shadow: 0 0 40px var(--violet-glow); }
.dose-hero .hero-dose { font-size: 20px; }
.dose-hero .hero-conc { border-radius: 999px; padding: 7px 14px; background: var(--flat); border: 1px solid var(--edge-2); font-size: 13.5px; }
.dose-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.dose-tile { padding: 12px 14px; border-radius: var(--r-md); background: var(--flat); border: 1px solid var(--edge); min-width: 0; }
.dose-tile.wide { grid-column: 1 / -1; }
.tile-label { display: block; font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-mute); }
.tile-value { display: block; margin-top: 2px; font-size: 15px; line-height: 1.42; overflow-wrap: break-word; }
.source-link { border-radius: var(--r-md); background: var(--gold-tint-3); }
/* "Mark given" stays in reach at the bottom of the dose screen. */
.btn-go {
  background: linear-gradient(180deg, #4fe6a4, #2fc584); border-color: transparent; color: #03130b;
  box-shadow: 0 10px 30px var(--mint-glow);
}
.give-btn { position: sticky; bottom: 12px; z-index: 3; min-height: 62px; border-radius: 20px; font-size: 21px; margin-top: 4px; }

/* ── CPR ── */
.cpr-ring svg { filter: drop-shadow(0 0 14px var(--gold-glow-2)); }
.cpr-ring.due svg { filter: drop-shadow(0 0 14px var(--danger-glow)); }
.cpr-ring .track { stroke: var(--round); }
.cpr-timer { border-radius: var(--r-md); background: var(--flat); border-color: var(--edge); }
.cpr-timer.due { background: var(--danger-panel); border-color: var(--danger-edge); }
.cpr-btn { border-radius: var(--r-md); background: var(--flat); border-color: var(--edge); box-shadow: var(--lift); }
.cpr-btn.primary { background: var(--gold-panel); border-color: var(--gold-edge); }
.cpr-btn.primary .cpr-btn-label { color: var(--gold-light); }
.cpr-btn.due {
  background: linear-gradient(180deg, #ff5a5c, #e23b3e); border-color: transparent;
  box-shadow: 0 10px 30px var(--danger-glow);
}
.cpr-btn.due .cpr-btn-label, .cpr-btn.due .cpr-btn-sub { color: #fff; }
.cpr-end { border-radius: var(--r-md); }

/* ── Protocols ── */
.protocol-step { border-bottom-color: var(--hair); }

/* ── Tab bar ── */
.tabbar { background: var(--tabbar-grad); border-top-color: var(--hair); box-shadow: var(--tabbar-shadow); }
.tabbar button[aria-selected="true"] { background: transparent; box-shadow: inset 0 3px 0 var(--accent); text-shadow: 0 0 18px var(--gold-glow); }

/* Phones: keep the header compact. */
@media (max-width: 520px) {
  .brand-region { font-size: 11px; padding: 4px 8px; }
  .gate-banner { margin: 0 10px; }
  .patient-bar { margin: 8px 10px 0; }
  .patient-bar .has-patient .pb-value { font-size: 22px; }
  .dose-hero .hero-vol { font-size: 72px; }
  .hero-unit { font-size: 28px; }
}
@media (max-height: 460px) and (min-width: 600px) {
  .patient-bar { margin-top: 6px; }
  .dose-hero .hero-vol { font-size: 52px; }
}

/* ── Crew sign-in, notice, decision sheets (2026-10-31) ── */
main.signin { max-width: 480px; padding-top: 28px; }
.signin-title { font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 6px; }
.signin form { margin-top: 18px; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice li { margin-bottom: 8px; line-height: 1.45; font-size: 15px; }
.notice p { margin: 0; }
.choose { display: flex; flex-direction: column; gap: 10px; }
.choose-btn { min-height: 64px; flex-direction: column; gap: 2px; border-radius: var(--r-md); }
.choose-label { font-size: 19px; }
.choose-sub { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.btn-ghost.choose-btn { border-style: dashed; }
.row-remove {
  flex: 0 0 auto; min-height: 44px; padding: 0 14px; border-radius: 12px; margin-left: 8px;
  font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--sunk); border: 1px solid var(--edge); color: var(--text-dim);
}
.row:has(.row-remove) { align-items: center; }
.event-tap { width: 100%; text-align: left; background: transparent; border-left: none; border-right: none; border-top: none; color: inherit; }
.event-tap.med-event { border-left: 3px solid var(--go); }
.event-tap.shock-event { border-left: 3px solid var(--warn); }
.event-tap:active { background: var(--press); }

/* ══ Light mode (2026-10-31) ═════════════════════════════════════════════
   For daylight and glare. Same four colour meanings, darkened so each passes
   the same rules as dark: muted text ≥ 4.5:1, secondary ≥ 7:1, the dose
   ≥ 7:1 on cards, and dose / danger / caution stay apart for a deuteranope
   (tests/design.test.js checks both themes). Chosen in Settings → Appearance;
   html[data-theme] is set before first paint (index.html) so there is no flash. */
:root { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --bg:        #F5F3EE;
  --surface:   #FFFFFF;
  --surface-2: #F2F0EB;
  --surface-3: #E9E6DF;
  --line:      #E2DCCD;
  --text:      #16140F;
  --text-dim:  #45413A;
  --text-mute: #615C53;
  --stripe:    #D8D4CB;

  --accent:    #8C6516;   /* Caliber gold, deepened to read on white */
  --accent-dk: #8C6516;
  --gold-light:#7A5810;
  --danger:    #C4161C;
  --danger-dk: #FBE1E1;
  --warn:      #9A5300;
  --warn-dk:   #F6E3C4;
  --go:        #05663F;
  --go-dk:     #DDF2E7;
  --violet:    #5E3AA6;

  --edge: #E2DED5;  --edge-2: #DAD5CA;  --hair: #ECE8DF;  --split: #E6E2D9;
  --flat: #FBFAF7;  --sunk: #F0EEE8;    --press: #ECE9E2; --round: #EFECE6;
  --card-grad:  linear-gradient(180deg, #FFFFFF, #FCFBF8);
  --raise-grad: linear-gradient(180deg, #FFFFFF, #FAF8F4);
  --tabbar-grad: linear-gradient(180deg, #FFFFFF, #F7F5F0);
  --tabbar-shadow: 0 -6px 18px rgba(40,32,15,.08);
  --sheet-head-bg: rgba(255,255,255,.92);
  --backdrop: rgba(22,20,15,.45);
  --page-glow: #F7EBD3;  --sheet-glow: #E3F4EB;
  --lift: 0 4px 14px rgba(40,32,15,.08);
  --lift-hi: 0 8px 24px rgba(40,32,15,.10);

  --band-grad: linear-gradient(90deg, #FBF1DC, #F8EACB, #FBF1DC);  --band-edge: #D8BC78;
  --gold-tint: rgba(140,101,22,.08);  --gold-tint-2: rgba(140,101,22,.12);  --gold-tint-3: rgba(140,101,22,.05);
  --gold-ring: rgba(140,101,22,.30);  --gold-ring-2: rgba(140,101,22,.50);
  --gold-glow: rgba(196,154,60,.28);  --gold-glow-2: rgba(196,154,60,.30);
  --gold-panel: #FBF3E1; --gold-edge: #D3B26C;
  --on-accent: #FFFFFF;

  --go-tint: rgba(5,102,63,.07);  --go-ring: rgba(5,102,63,.30);
  --go-soft: #1E6F4B;  --go-soft-2: #2E6B50;  --go-eyebrow: #1E6F4B;  --go-pill: #05663F;
  --mint-glow: rgba(47,197,132,.30);  --hero-glow: transparent;

  --warn-tint: rgba(154,83,0,.07);  --warn-tint-2: rgba(154,83,0,.09);  --warn-ring: rgba(154,83,0,.30);
  --warn-text: #7A4300;  --warn-soft: #8A4F00;  --warn-glow: transparent;

  --violet-tint: rgba(94,58,166,.07);  --violet-ring: rgba(94,58,166,.30);  --violet-soft: #5E3AA6;  --violet-glow: transparent;

  --danger-tint: rgba(196,22,28,.07);  --danger-text: #9B1116;  --danger-soft: #9B1116;
  --danger-edge: #EDB4B4;  --danger-edge-2: #F0C4C4;  --danger-panel: #FDEDED;
  --danger-grad: linear-gradient(180deg, #FDEFEF, #FBE6E6);  --danger-glow: rgba(196,22,28,.25);
}
/* The CPR ring's glow reads as smudge on white. */
:root[data-theme="light"] .cpr-ring svg, :root[data-theme="light"] .cpr-ring.due svg { filter: none; }
:root[data-theme="light"] .tabbar button[aria-selected="true"] { text-shadow: none; }
/* Installed on an iPhone, the status bar always draws white text: keep a dark
   strip under it in light mode so the clock and battery stay readable. */
:root[data-theme="light"] .app::before { background: #16140F; }
