/* my.labzeus.app — patient/family app.
   Design law (docs/DESIGN.md): instrument-not-brochure, data-ink over
   chrome, NO accent-border cards, hairlines not shadows, light default +
   dark "microscope room", every control >=44px tappable, no idle
   animation. Patient register: warmer application of the same tokens —
   16px base, 16px radius, icons over words. Mobile-first: this exact UI
   is bundled by the Tauri mobile app later (ADR-013).

   The range band is THE motif here, echoed four ways: the flag strip on
   every report card, the mini band on every trend row, the green band in
   the chart, and the tiny active-tab indicator. */

/* ---------------- fonts (self-hosted, OFL — never hotlinked) --------- */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-ext.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20BF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-ext.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20BF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Noto Sans Tamil";
  src: url("/fonts/noto-sans-tamil.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC;
}

/* ---------------- tokens ---------------- */
:root {
  --paper: #F7F9FB;
  --surface: #FFFFFF;
  --ink: #111C2E;
  --ink-soft: #55627A;
  --line: #E2E8F0;
  --primary: #0B7285;
  --primary-ink: #FFFFFF;
  --flag-normal: #199A5B;
  --flag-low: #3B6FD4;
  --flag-high: #D97706;
  --flag-crit: #DC2626;
  --band-normal: #DCF2E7;
  --danger: #DC2626;
  --tab-h: 62px;
  --pad: 1.25rem;
  --radius: 16px;
  --font: "IBM Plex Sans", "Noto Sans Tamil", system-ui, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* tube-cap categoricals (DESIGN.md) — family avatars only here */
  --cap-0: #8E7CC3;  /* lavender EDTA */
  --cap-1: #C9A227;  /* gold SST */
  --cap-2: #7C8797;  /* grey fluoride */
  --cap-3: #4A90D9;  /* light-blue citrate */
  --cap-4: #4C9A66;  /* green heparin */
  --cap-5: #C0504D;  /* red plain serum */
  --cap-6: #D8B23A;  /* yellow container */
  --cap-7: #4A4F5A;  /* charcoal swab */
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0D1420; --surface: #131C2B; --ink: #E8EDF5;
    --ink-soft: #93A1B8; --line: #24304A; --primary: #35B5C9;
    --primary-ink: #06222A; --band-normal: #10352A;
    --flag-normal: #34C17E; --flag-low: #6E97E8; --flag-high: #F0A03C;
    --flag-crit: #F26666; --danger: #F26666;
  }
}
[data-theme="dark"] {
  --paper: #0D1420; --surface: #131C2B; --ink: #E8EDF5;
  --ink-soft: #93A1B8; --line: #24304A; --primary: #35B5C9;
  --primary-ink: #06222A; --band-normal: #10352A;
  --flag-normal: #34C17E; --flag-low: #6E97E8; --flag-high: #F0A03C;
  --flag-crit: #F26666; --danger: #F26666;
}
[data-theme="light"] {
  --paper: #F7F9FB; --surface: #FFFFFF; --ink: #111C2E;
  --ink-soft: #55627A; --line: #E2E8F0; --primary: #0B7285;
  --primary-ink: #FFFFFF; --band-normal: #DCF2E7;
  --flag-normal: #199A5B; --flag-low: #3B6FD4; --flag-high: #D97706;
  --flag-crit: #DC2626; --danger: #DC2626;
}

/* ---------------- base ---------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 34rem; margin: 0 auto; }

h1 { font-size: 1.375rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; margin: 1.5rem 0 .6rem; }
.eyebrow {
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.error { color: var(--flag-crit); margin-top: .6rem; font-size: .9rem; }
.loading { padding: .5rem 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------------- auth screens ---------------- */
.auth { padding: 3rem var(--pad) 2rem; }
.auth-brand { margin-bottom: 1.5rem; text-align: left; }
.auth-brand p { margin-top: .4rem; max-width: 26rem; }
.auth-hint { margin-top: 1rem; }

.brand-mark { width: 84px; height: 56px; margin-bottom: 1rem; display: block; }
.bm-tube  { fill: none; stroke: var(--ink-soft); stroke-width: 2.5; }
.bm-cap   { fill: var(--primary); }
.bm-fill  { fill: var(--band-normal); }
.bm-band  { fill: var(--band-normal); }
.bm-dot   { fill: var(--flag-normal); }
.bm-shield { fill: var(--band-normal); stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; }
.bm-key   { fill: var(--primary); }

.form-card { padding: 1.1rem var(--pad) 1.35rem; }

form label {
  display: block;
  font-size: .85rem;
  color: var(--ink-soft);
  margin: 1rem 0 .3rem;
}
form label:first-child { margin-top: 0; }
input {
  width: 100%;
  min-height: 48px;
  padding: .55rem .8rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}
input.mono { font-family: var(--mono); }
input.pin-input { letter-spacing: .35em; }
input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
input::placeholder { color: var(--ink-soft); opacity: .7; letter-spacing: normal; }

.tel-wrap { display: flex; align-items: stretch; gap: .5rem; }
.tel-prefix {
  display: flex; align-items: center;
  padding: 0 .7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-soft);
}
.tel-input { flex: 1 1 auto; }

button {
  font: inherit;
  font-weight: 500;
  min-height: 48px;
  min-width: 48px;
  padding: .6rem 1.2rem;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-ink);
  cursor: pointer;
}
form button[type="submit"] { width: 100%; margin-top: 1.35rem; }
button:disabled { opacity: .6; }
button.ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--line);
}
button.danger { color: var(--danger); }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------------- shell + views ---------------- */
.view { padding: 1.25rem var(--pad) calc(var(--tab-h) + 1.75rem + env(safe-area-inset-bottom, 0px)); }
.view-head { margin-bottom: .9rem; }
.view-head .small { margin-top: .15rem; }
.detail-head { display: flex; align-items: center; gap: .6rem; }
.back { min-width: 48px; padding: .4rem; font-size: 1.25rem; flex: 0 0 auto; }

/* one action-only entrance: content fades up 150ms, once */
.view.enter { animation: rise 150ms ease-out; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view.enter { animation: none; }
}

/* ---------------- family switcher: member chips ---------------- */
.chips {
  display: flex;
  gap: .6rem;
  overflow-x: auto;
  padding: .15rem 0 .9rem;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 48px;
  padding: .3rem .95rem .3rem .35rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: .95rem;
  font-weight: 500;
  white-space: nowrap;
}
.chip.active {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
}
.chip .who { font-size: .78rem; font-weight: 400; opacity: .85; }

/* initials in tube-cap-coloured circles */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: .9rem;
  font-weight: 650;
  letter-spacing: .02em;
  flex: 0 0 auto;
  color: #FFFFFF;
}
.avatar-lg { width: 52px; height: 52px; font-size: 1.15rem; }
.cap-0 { background: var(--cap-0); }
.cap-1 { background: var(--cap-1); color: #111C2E; }
.cap-2 { background: var(--cap-2); }
.cap-3 { background: var(--cap-3); }
.cap-4 { background: var(--cap-4); }
.cap-5 { background: var(--cap-5); }
.cap-6 { background: var(--cap-6); color: #111C2E; }
.cap-7 { background: var(--cap-7); }

/* ---------------- report list: specimen cards ---------------- */
ul.reports, ul.params, ul.points { list-style: none; }
ul.reports { display: grid; gap: .7rem; }
ul.reports a {
  display: block;
  padding: .85rem 1rem .9rem;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
ul.reports a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.r-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
}
.r-lab {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.r-when { font-family: var(--mono); font-size: .8rem; color: var(--ink-soft); flex: 0 0 auto; }
.r-line {
  margin: .3rem 0 .1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.r-name { font-weight: 650; font-size: 1.02rem; }
.r-order { font-family: var(--mono); font-size: .8rem; color: var(--ink-soft); }
.r-amended {
  font-size: .72rem;
  color: var(--flag-high);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 .5rem;
  line-height: 1.4;
}
/* the flag strip: a mini range band summarising the report's results */
.r-band {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: .6rem;
  background: var(--line);
}
.r-band span { display: block; height: 100%; }
.r-band .seg-normal { background: var(--flag-normal); }
.r-band .seg-low    { background: var(--flag-low); }
.r-band .seg-high   { background: var(--flag-high); }
.r-band .seg-crit   { background: var(--flag-crit); }
.r-counts { margin-top: .35rem; font-size: .78rem; color: var(--ink-soft); }
.r-counts .c-normal { color: var(--flag-normal); }
.r-counts .c-low    { color: var(--flag-low); }
.r-counts .c-high   { color: var(--flag-high); }
.r-counts .c-crit   { color: var(--flag-crit); }

#home-seeall { width: 100%; margin-top: .9rem; }

/* ---------------- trends list: band rows ---------------- */
ul.params { display: grid; gap: .7rem; }
ul.params button.param {
  display: block;
  width: 100%;
  text-align: left;
  padding: .85rem 1rem .95rem;
  min-height: 56px;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
}
.p-top { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.p-name { font-weight: 650; }
.p-latest {
  font-family: var(--mono);
  font-size: 1.05rem;
  flex: 0 0 auto;
}
.p-latest .p-unit { font-size: .78rem; color: var(--ink-soft); margin-left: .2rem; }
.p-meta { font-size: .8rem; color: var(--ink-soft); margin-top: .1rem; }
.p-band { margin-top: .55rem; }
.p-band svg { display: block; width: 100%; height: 16px; }

.flag-high, .flag-abnormal { color: var(--flag-high); }
.flag-low { color: var(--flag-low); }
.flag-normal { color: var(--flag-normal); }
.flag-crit { color: var(--flag-crit); }

/* ---------------- home stat tiles (family at a glance) ---------------- */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: .7rem;
  margin-bottom: 1.1rem;
}
.stats.two { grid-template-columns: 1fr 1fr; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .8rem 1rem .7rem;
  min-width: 0;
}
.stat .n {
  font-family: var(--mono);
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.stat .n-date { font-size: 1.3rem; padding-top: .5rem; white-space: nowrap; }
.stat .l {
  margin-top: .1rem;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------------- booking entry card (home) ---------------- */
.book-card { padding: 1rem var(--pad) 1.1rem; margin-bottom: 1.4rem; }
.book-lead { margin: .25rem 0 .8rem; }
.book-choices { display: grid; gap: .7rem; }
.choice {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  min-height: 72px;
  padding: .8rem .95rem;
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.choice-icon {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  color: var(--primary);
}
.ci-stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ci-fill { fill: var(--band-normal); stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.c-text { display: block; min-width: 0; }
.c-title { display: block; font-weight: 650; font-size: 1rem; }
.c-sub { display: block; font-size: .82rem; color: var(--ink-soft); font-weight: 400; margin-top: .1rem; }

/* ---------------- booking wizard ---------------- */
.bstep h2.eyebrow { margin: 1.1rem 0 .6rem; }
.bstep h2.eyebrow:first-child { margin-top: .2rem; }

/* Stacked big option chips: one tap each (lab, who, time). */
.opt-col { display: grid; gap: .7rem; }
.opt {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  min-height: 60px;
  padding: .7rem .95rem;
  text-align: left;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.opt .o-title { font-weight: 650; font-size: 1rem; min-width: 0; }
.opt .o-hint {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--ink-soft);
  margin-left: auto;
  flex: 0 0 auto;
}
.opt.selected {
  border-color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.opt.selected .o-title { color: var(--primary); }

/* Day chips: 7 chips in two columns — Today / Tomorrow / weekday DD/MM. */
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.date-grid .opt { min-height: 64px; flex-direction: column; align-items: flex-start; justify-content: center; gap: .1rem; padding: .55rem .9rem; }
.date-grid .o-hint { margin-left: 0; }

/* Where: lab line / address. */
.lab-line { padding: .9rem var(--pad) 1rem; margin-bottom: .4rem; }
.lab-name { font-weight: 650; font-size: 1.05rem; margin-top: .25rem; }
textarea {
  width: 100%;
  min-height: 88px;
  padding: .55rem .8rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
textarea::placeholder { color: var(--ink-soft); opacity: .7; }
#bs-place label {
  display: block;
  font-size: .85rem;
  color: var(--ink-soft);
  margin: 1rem 0 .3rem;
}
#bs-place label:first-child { margin-top: 0; }

/* Confirm: plain summary rows the user can read out loud. */
.confirm { padding: .35rem var(--pad); list-style: none; }
.confirm li {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  padding: .65rem 0;
}
.confirm li + li { border-top: 1px solid var(--line); }
.confirm .cf-label {
  flex: 0 0 auto;
  width: 5.2rem;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.confirm .cf-value { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Success state. */
.bs-done { padding: 1.5rem 0 .5rem; text-align: center; }
.bs-done p + p { margin-top: .35rem; }
.bs-done .muted { max-width: 22rem; margin-left: auto; margin-right: auto; }
.ea-okring { fill: var(--band-normal); }
.ea-check { fill: none; stroke: var(--flag-normal); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

.book-next { width: 100%; margin-top: 1.35rem; }

/* ---------------- your visits ---------------- */
ul.visits { list-style: none; display: grid; gap: .7rem; margin-bottom: 1.4rem; }
.visit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem 1rem .9rem;
}
.v-top { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.v-kind {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.v-when { font-family: var(--mono); font-size: .85rem; flex: 0 0 auto; }
.v-line { margin: .3rem 0 .15rem; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.v-name { font-weight: 650; font-size: 1.02rem; }
.v-lab { font-size: .8rem; color: var(--ink-soft); }
.v-addr { font-size: .82rem; color: var(--ink-soft); margin-top: .1rem; overflow-wrap: anywhere; }
.v-status {
  display: inline-block;
  margin-top: .5rem;
  font-size: .78rem;
  font-weight: 500;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: .05rem .6rem;
}
.st-wait { color: var(--flag-high); }
.st-ok { color: var(--flag-normal); }
.st-muted { color: var(--ink-soft); }
.v-cancel {
  display: block;
  margin-top: .6rem;
  min-height: 44px;
  width: 100%;
  font-size: .9rem;
}
.v-cancel.armed { color: var(--danger); border-color: var(--danger); }

/* ---------------- empty states (designed states) ---------------- */
.empty { padding: 1.5rem 0 1rem; text-align: center; }
.empty p + p { margin-top: .35rem; }
.empty .muted { max-width: 22rem; margin-left: auto; margin-right: auto; }
.empty-art { width: 128px; height: auto; margin: 0 auto 1rem; display: block; }
.ea-sheet { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.ea-title { fill: var(--ink-soft); opacity: .85; }
.ea-line  { fill: var(--line); }
.ea-band  { fill: var(--band-normal); }
.ea-dot   { fill: var(--flag-normal); }
.ea-qr rect { fill: var(--ink-soft); }
.ea-qr .ea-qrbox { fill: none; stroke: var(--ink-soft); stroke-width: 2; }
.ea-spark { fill: none; stroke: var(--ink-soft); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- trend detail ---------------- */
#trend-hero {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  flex-wrap: wrap;
  margin: .4rem 0 .2rem;
}
.h-value { font-family: var(--mono); font-size: 2.4rem; line-height: 1.1; }
.h-unit { font-family: var(--mono); font-size: 1rem; color: var(--ink-soft); }
.h-flag {
  font-size: .78rem;
  font-weight: 500;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: .05rem .6rem;
}
.h-meta { flex-basis: 100%; font-size: .85rem; color: var(--ink-soft); }

.bleed { margin: .6rem calc(-1 * var(--pad)) 1rem; }
#trend-chart svg { width: 100%; height: auto; display: block; }

ul.points { border-top: 1px solid var(--line); }
.points li {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  padding: .7rem .1rem;
  border-bottom: 1px solid var(--line);
}
.points .pt-value {
  font-family: var(--mono);
  font-size: 1rem;
  flex: 0 0 auto;
  order: 2;
  margin-left: auto;
}
.points .pt-when { font-family: var(--mono); font-size: .85rem; }
.points .pt-lab { font-size: .8rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.points .pt-text { min-width: 0; }

/* ---------------- profile ---------------- */
.profile-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1rem var(--pad);
}
.profile-name { font-size: 1.15rem; font-weight: 650; }
#logout-btn { margin-top: 2rem; width: 100%; }

/* ---------------- guided tour ("How this works") ---------------- */
/* Entry links: quiet ghost buttons on the login footer and in Profile. */
.tour-link { width: 100%; margin-top: 1rem; }
#tour-profile-link { margin-top: 2rem; }
#tour-profile-link + #logout-btn { margin-top: .75rem; }

/* The overlay root never intercepts the page (pointer-events: none) —
   only the caption card is interactive, so the tour can never trap. */
#tour-root {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
}

/* Highlight ring: primary hairline + a page-dimming spotlight. It moves
   between targets with one short glide (action motion, not idle). */
#tour-ring {
  position: fixed;
  border: 2px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35);
  transition: left .25s ease-out, top .25s ease-out,
    width .25s ease-out, height .25s ease-out;
}
[data-theme="dark"] #tour-ring { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .5); }
@media (prefers-color-scheme: dark) {
  #tour-ring { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .5); }
}
[data-theme="light"] #tour-ring { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); }

/* Caption card: bottom-anchored, thumb reach at 390px; sits above the
   tab bar (the same offset works on the tab-less login screen). */
#tour-card {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tab-h) + .9rem + env(safe-area-inset-bottom, 0px));
  width: min(30rem, calc(100vw - 2 * var(--pad)));
  padding: .35rem 1rem .95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25); /* modal elevation (allowed) */
  pointer-events: auto;
}
.tour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.tour-count { font-size: .8rem; color: var(--ink-soft); }
.tour-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 1.45rem;
  line-height: 1;
  border-radius: 50%;
  margin-right: -.5rem;
}
.tour-text { font-size: .95rem; margin: .05rem 0 .85rem; }
.tour-nav { display: flex; gap: .6rem; }
.tour-nav .tour-back { flex: 1 1 0; }
.tour-nav .tour-next { flex: 2 1 0; }

@media (prefers-reduced-motion: reduce) {
  #tour-ring { transition: none; }
}

/* ---------------- bottom tabs ---------------- */
#tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  max-width: 34rem;
  margin: 0 auto;
}
.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  color: var(--ink-soft);
  border: none;
  border-radius: 0;
  font-size: .72rem;
  min-height: var(--tab-h);
  position: relative;
  padding: 0;
}
.tab svg {
  width: 24px; height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.active { color: var(--primary); font-weight: 500; }
/* active indicator: the tiny range band with its dot (THE motif) */
.tab.active::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  margin-left: -16px;
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--band-normal);
}
.tab.active::after {
  content: "";
  position: absolute;
  top: 4.5px;
  left: 50%;
  margin-left: -2.5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

/* ------------------------------------------------------------ language --
   Picker lives in the Profile tab (the switcher never sits in a header —
   house law). Native select, native-script names, >=44px tap target. */
.lang-card { padding: 0.35rem var(--pad); }
.lz-lang-select {
  width: 100%;
  min-height: 44px;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: none;
}
.lz-lang-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-radius: 8px;
}
