/* ══════════════════════════════════════════════════════════════════════════
   JMT 2027 — SOUTHERN HALF · "High alpine granite & ice"

   Ten days above treeline. Cold slate, glacier blue, snow white — deliberately
   the opposite pole from the 2026 app's warm forest green and photo hero.
   NO green in the chrome (the only green is the semantic --ok status colour),
   no amber fills, no photographs. All art is original SVG (site/art/), inlined
   through site/art.js so its currentColor text follows the theme.

   THEMING CONTRACT (do not break it):
     • The COMPLETE light palette is defined on bare `:root`. Every token has a
       bare-:root definition — never define a colour only inside a media query.
     • The dark palette is declared TWICE, identically: once under
       `@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) }`
       so the OS setting wins by default, and once under
       `:root[data-theme="dark"]` so the in-app toggle wins in both directions.
       KEEP THE TWO BLOCKS IN SYNC — they are literal copies on purpose.
     • Nothing below the token block uses a raw hex except (a) pure white/black
       at an alpha (scrims, casings, ring strokes) and (b) the map-layer colours,
       which are theme-invariant because they sit on topo tiles, not on a theme
       background.

   BRIGHT-SUN RULE (structural, not stylistic): this gets read on a phone at
   12,000′ in glare. Boundaries come from BORDERS and FILLS, never from shadows;
   shadows are faint decoration only. Body text is 17px. Nothing functional is
   rendered below --muted contrast.

   Measured contrast (WCAG): fg/bg 14.9:1 light · 15.9:1 dark; muted/bg 6.0:1;
   accent/card 5.9:1 light, 8.5:1 dark; danger/card 6.4:1; every pair AA+.
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  /* ── core surfaces ── */
  --bg:          #F2F6F9;   /* snowfield — page background */
  --card:        #FFFFFF;   /* cards, sheets, modals */
  --card-sunken: #E8EFF4;   /* inset wells, table stripes, art frames */
  --fg:          #17222C;   /* night granite — primary text (14.9:1 on bg) */
  --muted:       #4C6072;   /* storm slate — secondary text (6.0:1 on bg) */
  --line:        #C9D5DE;   /* hairlines, card borders */
  --line-strong: #A9BAC7;   /* input outlines, emphasised borders */

  /* ── accent: glacier blue ── */
  --accent:          #1B6A99;  /* links, active nav, primary fills (5.9:1) */
  --accent-strong:   #14526F;  /* hover / pressed / headings on ice wash */
  --accent-ink:      #FFFFFF;  /* text on an --accent fill */
  --accent-soft:     #DCEBF5;  /* ice wash: chips, callouts, selected rows */
  --accent-soft-ink: #14526F;  /* text on --accent-soft (7.0:1) */

  /* ── semantic ── */
  --ok:          #2E6B4F;   /* the ONLY green — dots and badges, nothing more */
  --danger:      #B02E2B;   /* first aid, destructive, alerts */
  --danger-soft: #F6E2E1;
  --warn-ink:    #7A4A12;   /* caution TEXT + borders. Never an amber fill. */

  /* ── altitude ramp (elevation data viz, valley → summit) ── */
  --alt-1: #8FA6B8;  --alt-2: #6F93AE;  --alt-3: #4E7FA3;
  --alt-4: #2F6D97;  --alt-5: #7FC2E8;

  /* ── artwork constants: identical in both themes, matching the SVGs' hexes,
        so UI can echo the art (hero captions, knock-out labels) ── */
  --granite-deep: #16222D;
  --granite:      #33475A;
  --granite-lt:   #55708A;
  --ice:          #A8D4EA;
  --snow:         #F4FAFD;

  /* ── map layer: THEME-INVARIANT. These sit on OpenTopoMap tiles, not on a
        theme background, so they must not flip. Never reuse them for chrome,
        and never put --accent on the map canvas: accent is chrome, these are
        tiles, and keeping them apart is what makes the GPS dot unmistakable. */
  --route: #E8702A;   /* trail line, 4px over a 60%-white casing */
  --gps:   #1A73E8;   /* this phone's GPS dot — ALWAYS with a 2.5px white ring */
  --track: #16222D;   /* Zoleo reported check-ins (hours old, not live) */
  --mark-term:  #14526F;   /* trailhead / portal */
  --mark-pass:  #2F6D97;   /* the six passes */
  --mark-peak:  #55708A;   /* highlights: Rae Lakes, Guitar Lake, Whitney */
  --mark-camp:  #8FA6B8;   /* nightly camps */
  --mark-resup: #7A4A12;   /* Kearsarge resupply hand-off */

  /* ── geometry ── */
  --radius: 12px;        /* cards */
  --radius-s: 7px;       /* buttons, inputs, wells */
  --radius-pill: 999px;
  --maxw: 1180px;

  /* ── elevation: faint on purpose (see BRIGHT-SUN RULE) ── */
  --shadow-s: 0 1px 2px rgba(23, 34, 44, .08);
  --shadow-m: 0 2px 8px rgba(23, 34, 44, .12);

  /* ── type: system stack only, zero webfonts (nothing to fetch offline) ── */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;
  --fs-xs: 13px;   /* captions, axis labels, tracked caps */
  --fs-s:  15px;   /* secondary text */
  --fs-m:  17px;   /* body — deliberately large: gloved thumbs, tired eyes */
  --fs-l:  20px;   /* card titles, pass names */
  --fs-xl: 24px;   /* page titles */
  --fs-hero: 30px; /* dashboard numerals (always tabular) */
  --lh-body: 1.55;
  --lh-tight: 1.25;

  /* ── spacing, 4px base ── */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px;
  --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
}

/* DARK — copy A of 2. OS preference wins unless the user forced light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E141B; --card: #161F29; --card-sunken: #0B1117;
    --fg: #E8EFF4; --muted: #9CB0C0;
    --line: #273543; --line-strong: #3A4C5C;
    --accent: #7FC2E8; --accent-strong: #A9D8F2; --accent-ink: #0B2331;
    --accent-soft: #1B3140; --accent-soft-ink: #A9D8F2;
    --ok: #6FBE95; --danger: #F0837A; --danger-soft: #3A1F1D; --warn-ink: #E0B276;
    --alt-1: #4C6070; --alt-2: #5C7A93; --alt-3: #6F97B5;
    --alt-4: #8FB9D6; --alt-5: #C2E2F5;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-m: 0 2px 10px rgba(0, 0, 0, .6);
    /* --route / --gps / --track / --mark-* deliberately unchanged: map tiles. */
  }
}
/* DARK — copy B of 2. The in-app toggle, which must win over the OS setting. */
:root[data-theme="dark"] {
  --bg: #0E141B; --card: #161F29; --card-sunken: #0B1117;
  --fg: #E8EFF4; --muted: #9CB0C0;
  --line: #273543; --line-strong: #3A4C5C;
  --accent: #7FC2E8; --accent-strong: #A9D8F2; --accent-ink: #0B2331;
  --accent-soft: #1B3140; --accent-soft-ink: #A9D8F2;
  --ok: #6FBE95; --danger: #F0837A; --danger-soft: #3A1F1D; --warn-ink: #E0B276;
  --alt-1: #4C6070; --alt-2: #5C7A93; --alt-3: #6F97B5;
  --alt-4: #8FB9D6; --alt-5: #C2E2F5;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-m: 0 2px 10px rgba(0, 0, 0, .6);
}

/* ── Base ───────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-m);
  color: var(--fg);
  background: var(--bg);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font); font-weight: 700;
  line-height: var(--lh-tight); margin: 0 0 .4em; letter-spacing: -.01em;
  color: var(--fg);
}
h3, h4 { font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-strong); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Every elevation / mileage numeral in this app is tabular — columns of feet
   that jitter as they update read as noise on a small screen. */
.n, .v, .cd-box .n, .stat .v, .chip, .fa-dose td, table td, .prof-stats {
  font-variant-numeric: tabular-nums;
}

/* Tracked-caps caption — the system's signature label style. */
.eyebrow, .day-badge .d, .cd-box .l, .stat .k, th, .fa-lbl, .sheet-h,
.login-eyebrow, .brand .s, .prov-badge, .prov-tag, .fa-sev, .live-badge {
  text-transform: uppercase; letter-spacing: 1.5px;
}

/* ── Inlined SVG art helpers ─────────────────────────────────────────────
 * Every asset except mark/hero draws in `currentColor`, so the CONTAINER's
 * colour is what themes it. Set `color` here, never `fill` — an <img src> would
 * render the same files' text black (that's why art.js exists). */
[data-art] svg, .art svg { display: block; width: 100%; height: auto; }

.divider { color: var(--muted); margin: var(--sp-5) 0; line-height: 0; }
.divider svg { width: 100%; height: 24px; }

/* Topo-contour watermark: corner motif on long cards, kept under the text. */
.contour-mark {
  position: absolute; right: -18px; bottom: -18px; width: 140px;
  color: var(--accent); opacity: .12; pointer-events: none; z-index: 0;
}
.contour-mark svg { width: 100%; height: auto; }
.card > *:not(.contour-mark) { position: relative; z-index: 1; }

/* 24px currentColor glyph used inline in chips, nav and map pins. */
.glyph { display: inline-flex; width: 1.05em; height: 1.05em; vertical-align: -.16em; }
.glyph svg { width: 100%; height: 100%; }

/* ── Login splash ───────────────────────────────────────────────── */
.login-screen {
  display: none; position: fixed; inset: 0; z-index: 2000;
  align-items: center; justify-content: center; padding: var(--sp-5);
  background: linear-gradient(180deg, var(--granite-deep) 0%, var(--granite) 100%);
}
body.locked .login-screen { display: flex; }
body.locked .app, body.locked .mobile-top { display: none; }
.login-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11, 17, 23, .25), rgba(11, 17, 23, .72));
}
.login-card {
  position: relative; z-index: 1; width: 410px; max-width: 100%; text-align: center;
  color: var(--snow);
  background: rgba(22, 34, 45, .62); backdrop-filter: blur(12px);
  border: 1px solid rgba(168, 212, 234, .22); border-radius: var(--radius);
  padding: 40px 34px;
}
.login-badge {
  width: 72px; height: 72px; margin: 0 auto var(--sp-4);
  border-radius: 18px; overflow: hidden;
}
.login-badge svg { width: 100%; height: 100%; display: block; }
.login-eyebrow { font-size: 11.5px; color: var(--ice); font-weight: 700; margin-bottom: 7px; }
.login-card h1 { font-size: 40px; color: var(--snow); margin: 0 0 2px; }
.login-sub { opacity: .92; margin: 0 0 26px; font-size: var(--fs-s); }
.login-card form { display: flex; flex-direction: column; gap: var(--sp-3); }
.login-card input {
  text-align: center; font-size: 16px; padding: 13px;
  background: rgba(244, 250, 253, .95); color: var(--granite-deep); border: none;
}
.login-btn { justify-content: center; padding: 13px; font-size: var(--fs-s); }
.login-err { color: #F3A9A2; font-size: 13.5px; min-height: 18px; font-weight: 600; }
.login-foot { margin-top: var(--sp-5); font-size: 12px; color: rgba(244, 250, 253, .78); }
.login-credit { position: absolute; bottom: 12px; right: 14px; z-index: 1;
  font-size: 10.5px; color: rgba(244, 250, 253, .6); }
@media (max-width: 540px) { .login-card { padding: 32px 22px; } .login-card h1 { font-size: 32px; } }

/* ── Layout shell ───────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--granite-deep);
  border-right: 1px solid var(--granite);
  color: var(--snow);
  padding: 22px var(--sp-4);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--sp-1);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px var(--sp-2) 18px; }
.brand .logo { width: 40px; height: 40px; border-radius: 10px; flex: none; overflow: hidden; }
.brand .logo svg { width: 100%; height: 100%; display: block; }
.brand .t { font-size: 19px; font-weight: 700; line-height: 1.05; color: var(--snow); }
.brand .s { font-size: 11px; color: var(--ice); }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--radius-s); min-height: 44px;
  color: #C6D8E4; font-size: 14.5px; font-weight: 500;
  border: none; border-left: 3px solid transparent; background: none;
  width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-link .ic { font-size: 17px; width: 22px; text-align: center; }
.nav-link:hover { background: rgba(168, 212, 234, .10); color: var(--snow); text-decoration: none; }
.nav-link.active {
  background: rgba(168, 212, 234, .16); color: var(--snow);
  border-left-color: var(--ice); font-weight: 600;
}
.nav-sep { height: 1px; background: rgba(168, 212, 234, .16); margin: var(--sp-3) var(--sp-2); }
.sidebar .foot { margin-top: auto; font-size: 11.5px; color: #A9C0D0; padding: 14px var(--sp-2) 2px; }
.sidebar .foot a { color: var(--ice); }

.main { min-width: 0; }
.view { display: none; }
.view.active { display: block; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: var(--sp-6) var(--sp-6) 80px; }

.page-head { margin-bottom: var(--sp-5); }
.page-head h1 { font-size: 32px; }
.page-head .sub { color: var(--muted); font-size: var(--fs-s); max-width: 64ch; }
.eyebrow { font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 6px; }

/* Theme toggle (sidebar foot + mobile bar). Cycles auto → light → dark. */
.theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid rgba(168, 212, 234, .30);
  color: #C6D8E4; border-radius: var(--radius-pill);
  padding: 5px 11px; font-size: 11.5px; font-weight: 600; margin-bottom: var(--sp-2);
}
.theme-btn:hover { background: rgba(168, 212, 234, .12); color: var(--snow); }
.mobile-top .theme-btn { margin: 0 0 0 auto; border-color: rgba(168, 212, 234, .35); }

/* ── Hero (dashboard centrepiece) ───────────────────────────────────────
 * hero.svg is self-lit — it owns its own night sky — so it is identical in
 * both themes and the caption always sits on granite. Snow text + a faint
 * bottom scrim; the scrim is a legibility aid, not a boundary. */
.hero {
  position: relative; border-radius: var(--radius); overflow: hidden;
  min-height: 240px; display: flex; align-items: flex-end;
  color: var(--snow); border: 1px solid var(--granite);
}
.hero-art { position: absolute; inset: 0; }
.hero-art svg { width: 100%; height: 100%; display: block; }
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15, 27, 38, 0) 35%, rgba(15, 27, 38, .78) 100%);
}
.hero .inner { position: relative; padding: var(--sp-6); width: 100%; }
.hero .eyebrow { color: var(--ice); }
.hero h1 { font-size: 38px; color: var(--snow); margin-bottom: 6px;
  text-shadow: 0 1px 12px rgba(11, 17, 23, .55); }
.hero .tag { font-size: var(--fs-s); max-width: 60ch; color: #DCEBF5;
  text-shadow: 0 1px 10px rgba(11, 17, 23, .6); }
.hero .route {
  display: inline-flex; gap: var(--sp-2); align-items: center; margin-top: 14px;
  font-weight: 600; font-size: 13.5px; color: var(--snow);
  background: rgba(11, 17, 23, .55); border: 1px solid rgba(168, 212, 234, .3);
  padding: 7px 14px; border-radius: var(--radius-pill);
}
@media (max-width: 540px) { .hero h1 { font-size: 27px; } .hero .inner { padding: var(--sp-4); } }

/* countdown — big tabular numerals */
.countdown { display: flex; gap: 14px; margin: 22px 0 4px; flex-wrap: wrap; }
.cd-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; text-align: center; min-width: 96px;
}
.cd-box .n { font-size: var(--fs-hero); font-weight: 700; color: var(--accent); line-height: 1; }
.cd-box .l { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: var(--sp-5) 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .v { font-size: 26px; font-weight: 700; color: var(--fg); line-height: 1.15; }
.stat .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 4px; }
.stat .ic { font-size: 20px; }

/* ── Cards & grids ──────────────────────────────────────────────── */
.grid { display: grid; gap: var(--sp-4); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
}
.card h3 { font-size: 18px; }
.card .meta { color: var(--muted); font-size: var(--fs-xs); }

.section { margin-bottom: var(--sp-6); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; margin: 0; }

/* ── Itinerary day cards ────────────────────────────────────────────────
 * The spine of the app: a chain of pass profiles getting taller until
 * Forester, then the Whitney summit mark. */
.day-card { display: grid; grid-template-columns: 62px 1fr; gap: var(--sp-4); align-items: start; }
.day-badge {
  background: var(--accent-soft); color: var(--accent-soft-ink);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 10px 6px; text-align: center;
}
.day-badge .d { font-size: 10px; opacity: .85; }
.day-badge .n { font-size: 24px; font-weight: 700; line-height: 1.05; }
.day-badge.travel { background: var(--card-sunken); color: var(--muted); }
.day-body h3 { margin-bottom: 4px; font-size: var(--fs-l); }
.leg { color: var(--muted); font-size: 14px; margin-bottom: var(--sp-2); }
.leg b { color: var(--fg); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: var(--sp-2) 0; }
.chip {
  font-size: 12.5px; padding: 4px 11px; border-radius: var(--radius-pill);
  background: var(--card-sunken); border: 1px solid var(--line);
  color: var(--fg); font-weight: 600;
}
.chip.miles { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-soft-ink); }
.chip.gain  { color: var(--accent-strong); }
.chip.loss  { color: var(--muted); }
.chip.pass  { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-soft-ink); }
.chip.resupply { color: var(--warn-ink); border-color: var(--warn-ink); background: var(--card-sunken); }
.day-notes { font-size: 14.5px; color: var(--fg); margin-top: 6px; }
.day-meals {
  display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted);
  background: var(--card-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 7px 11px; margin: var(--sp-2) 0 2px;
}

/* The pass-profile treatment: data made graphic. The SVG's numerals and
   baseline are currentColor, so the frame's `color` themes them. */
.pass-art {
  margin: var(--sp-3) 0 0; padding: var(--sp-3) var(--sp-3) var(--sp-2);
  background: var(--card-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-s); color: var(--fg);
}
.pass-art svg { width: 100%; height: auto; display: block; }
/* Full-width on a phone (the device this is built for). On a wide screen an
   unbounded profile scales the 20px crest numeral to ~55px and the card stops
   reading as a card — so cap the drawing, not the frame. */
@media (min-width: 700px) {
  .pass-art { max-width: 584px; }     /* 560 drawing + 2 x 12px frame padding */
  .summit-art { max-width: 404px; }
}
.pass-cap {
  margin-top: 6px; font-size: 11.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.2px;
}
.summit-art { border-color: var(--accent); }
.summit-art .pass-cap { color: var(--accent-soft-ink); }

/* ── Tables ─────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th {
  text-align: left; font-size: 11px; color: var(--muted);
  padding: 13px 14px; border-bottom: 2px solid var(--line);
  white-space: nowrap; background: var(--card-sunken); position: sticky;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--card-sunken); }
.row-actions { display: flex; gap: 6px; }

/* ── Buttons & pills ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; border: 1px solid var(--line-strong); background: var(--card);
  color: var(--accent); padding: 9px 15px; border-radius: var(--radius-s);
  font-size: 14.5px; font-weight: 600; transition: .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; background: var(--accent-soft); }
.btn.primary, .btn.gold {   /* .gold is a legacy class name — it is glacier now */
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.btn.primary:hover, .btn.gold:hover {
  background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink);
}
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 12.5px; }
.btn.ghost { background: none; }
.icon-btn {
  border: none; background: none; color: var(--muted);
  padding: 6px 8px; border-radius: var(--radius-s); font-size: 14px; min-height: 34px;
}
.icon-btn:hover { background: var(--card-sunken); color: var(--fg); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.tag-pill {
  font-size: 11.5px; padding: 3px 9px; border-radius: var(--radius-pill);
  background: var(--card-sunken); border: 1px solid var(--line);
  color: var(--fg); font-weight: 600;
}
.kind-mail  { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: var(--accent-soft); }
.kind-store { background: var(--card-sunken); color: var(--muted); }
.kind-spur, .kind-cache { color: var(--warn-ink); border-color: var(--warn-ink); }

/* category filter bar */
.filterbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.filterbar button {
  border: 1px solid var(--line-strong); background: var(--card); color: var(--fg);
  padding: 8px 15px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 600; min-height: 38px;
}
.filterbar button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* meal columns */
.meal-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); }
.meal-col h3 { display: flex; align-items: center; gap: var(--sp-2); font-size: 17px; padding-bottom: var(--sp-2); border-bottom: 2px solid var(--line); }
.meal-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 13px; margin-bottom: 10px; }
.meal-item .nm { font-weight: 600; font-size: 15px; }
.meal-item .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.meal-item .nums { display: flex; gap: 10px; font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 6px; }

/* side hikes */
.hike-card { border-left: 3px solid var(--line-strong); }
.hike-card.star { border-left-color: var(--accent); }
.hike-card .star-tag { color: var(--accent); font-weight: 700; font-size: 12px; }

/* gallery */
.gallery { columns: 3; column-gap: var(--sp-4); }
.gallery figure { margin: 0 0 var(--sp-4); break-inside: avoid; border-radius: var(--radius); overflow: hidden; position: relative; background: var(--card-sunken); border: 1px solid var(--line); }
.gallery img { width: 100%; transition: transform .4s; display: block; }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 12px;
  color: var(--snow); font-size: 13px;
  background: linear-gradient(transparent, rgba(11, 17, 23, .85));
}
.gallery figcaption b { display: block; font-size: 15px; }

/* ── Map ────────────────────────────────────────────────────────────────
 * Chrome recedes here: everything is tiles. The ONLY colours on the canvas
 * are the theme-invariant map tokens — no accent overlays. */
#map { height: 560px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.leaflet-container { background: var(--card-sunken); font-family: var(--font); }

/* Waypoint pins: a small --card roundel, per the design's map notes. Shape
 * carries the type as well as colour, so they stay distinguishable on busy
 * shaded-relief tiles (and for colour-blind readers). */
.wp {
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--card); border: 2px solid var(--line-strong);
  box-shadow: 0 1px 3px rgba(11, 17, 23, .5);
}
.wp svg { width: 13px; height: 13px; display: block; }
.wp-pass  { color: var(--mark-pass); border-color: var(--mark-pass); }
.wp-term  { background: var(--mark-term); border-color: #fff; width: 24px; height: 24px; }
.wp-peak  { background: var(--mark-peak); border-color: #fff; border-radius: 4px; transform: rotate(45deg); width: 18px; height: 18px; }
.wp-camp  { background: var(--mark-camp); border-color: #fff; width: 14px; height: 14px; }
.wp-resup { background: var(--mark-resup); border-color: #fff; border-radius: 4px; width: 20px; height: 20px; }

/* Fullscreen map (#200/#202): the toggle is DISABLED for this trip — both iOS
 * attempts failed and a map you cannot escape is the worst on-trail failure.
 * The rules stay so re-enabling is one line (#fsBtn) plus real-device testing. */
#map.map-fs {
  position: fixed; inset: 0; width: 100vw;
  height: 100vh; height: 100svh; height: 100dvh;
  max-width: none; margin: 0; border: none; border-radius: 0; z-index: 1200;
}
body.map-fs-active { overflow: hidden; }
#fsBtn { display: none !important; }

/* Exit + re-center controls: body-level fixed (so Leaflet never reads the taps
 * as drags) and inside the safe area so they clear the Dynamic Island (#41). */
.map-fs-exit, .map-fs-recenter { display: none; }
body.map-fs-active .map-fs-exit {
  display: flex; align-items: center; justify-content: center; position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 2400; width: 46px; height: 46px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .92); background: rgba(22, 34, 45, .88);
  color: #fff; font-size: 21px; line-height: 1;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
body.map-fs-active .map-fs-recenter {
  display: flex; align-items: center; justify-content: center; position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(16px, env(safe-area-inset-right));
  z-index: 2400; width: 52px; height: 52px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .92); background: var(--gps);
  color: #fff; font-size: 24px; line-height: 1;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
body.map-fs-active .map-fs-exit:active,
body.map-fs-active .map-fs-recenter:active { transform: scale(.94); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
/* Legend swatches reproduce the marker exactly as it looks on a pale topo
   tile — white ring and all. The outer ring is a THEME colour so the white
   ring itself stays visible when the legend sits on a dark page. */
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); }
.dot.sq { border-radius: 3px; }
.dot.dia { border-radius: 3px; transform: rotate(45deg); }
.dot.line { width: 20px; height: 5px; border-radius: 2px; border: none; box-shadow: 0 0 0 2px #fff; }

/* ── Chat ───────────────────────────────────────────────────────────────
 * An expedition log, not a consumer messenger: rectangular-ish bubbles. */
.chat-wrap {
  display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 200px); min-height: 440px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden;
}
.chat-log { overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--bg); }
.msg { max-width: 76%; }
.msg .bubble {
  background: var(--card); border: 1px solid var(--line); color: var(--fg);
  padding: 10px 14px; border-radius: var(--radius-s); font-size: 15px;
}
.msg .who { font-size: 12px; color: var(--muted); margin: 0 6px 4px; font-weight: 600; }
.msg.me { align-self: flex-end; }
.msg.me .who { text-align: right; }
.msg.me .bubble { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--fg); }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: var(--card); }
.chat-input input[type=text] { flex: 1; }
.edited { color: var(--muted); }

/* ── Forms ──────────────────────────────────────────────────────── */
input[type=text], input[type=number], input[type=url], input[type=password], textarea, select {
  font-family: inherit; font-size: 16px; color: var(--fg);
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--card); width: 100%; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
textarea { resize: vertical; min-height: 70px; }
label.field { display: block; margin-bottom: 14px; }
label.field .lab { font-size: 12.5px; font-weight: 700; color: var(--fg); margin-bottom: 5px; display: block; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-back {
  position: fixed; inset: 0; background: rgba(11, 17, 23, .62); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-back.open { display: flex; animation: fade .2s; }
.modal {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  width: 540px; max-width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-m);
}
.modal header {
  padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex;
  justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--card);
}
.modal header h3 { margin: 0; font-size: var(--fs-l); }
.modal .body { padding: 22px 24px; }
.modal footer {
  padding: var(--sp-4) 24px; border-top: 1px solid var(--line); display: flex;
  justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--card);
}

/* ── Resources ──────────────────────────────────────────────────── */
.link-card { display: flex; align-items: flex-start; gap: var(--sp-3); }
.link-card .lic {
  font-size: 20px; flex: none; width: 38px; height: 38px; border-radius: var(--radius-s);
  display: grid; place-items: center; background: var(--card-sunken); border: 1px solid var(--line);
}
.link-card .lt { font-weight: 600; font-size: 15px; }
.link-card .ln { font-size: 13px; color: var(--muted); }

/* ── Misc ───────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.callout {
  background: var(--accent-soft); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: var(--radius-s);
  padding: 14px 16px; font-size: 14.5px; color: var(--fg); margin: var(--sp-4) 0;
}
/* Caution, without an amber fill: the ink and the rule carry it. */
.callout.warn { background: var(--card-sunken); border-color: var(--line); border-left-color: var(--warn-ink); color: var(--fg); }
.callout.crit { background: var(--danger-soft); border-color: var(--line); border-left-color: var(--danger); color: var(--fg); }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.banner {
  background: var(--granite-deep); border: 1px solid var(--granite);
  color: var(--snow); border-radius: var(--radius); padding: 26px 30px;
}
.banner h2 { color: var(--snow); }
.banner a { color: var(--ice); }
.mobile-top { display: none; }

/* ── Long-form / reference pages (First-Aid siblings, printable sheet) ── */
.sheet-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius-s); padding: 10px 14px; font-size: 13px;
  color: var(--accent-soft-ink); margin: 0 0 20px;
}
.sheet-bar.warn { background: var(--card-sunken); border-left-color: var(--warn-ink); color: var(--fg); }
.sheet-bar .sb-actions { display: flex; gap: var(--sp-2); flex: none; }
.sheet-tbl { margin: var(--sp-3) 0 20px; }
.sheet-h { font-size: 15px; color: var(--accent); font-weight: 700; margin: var(--sp-5) 0 10px; }
.sheet-p { font-size: 14.5px; color: var(--fg); max-width: 88ch; }
.sheet-check {
  display: inline-grid; place-items: center; width: 20px; height: 20px;
  border: 2px solid var(--line-strong); border-radius: 5px; color: transparent; background: var(--card);
}
.sheet-check.done { border-color: var(--ok); color: var(--ok); background: var(--card-sunken); font-weight: 700; }

/* ── Toasts ─────────────────────────────────────────────────────── */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  background: var(--granite-deep); color: var(--snow); font-size: 14px; font-weight: 600;
  border: 1px solid var(--granite); padding: 11px 18px; border-radius: var(--radius-s);
  opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; max-width: 340px;
}
.toast.show { opacity: 1; transform: none; }
.toast.warn { border-color: var(--warn-ink); }
.toast.err { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ── Lightbox ───────────────────────────────────────────────────── */
#lightbox {
  position: fixed; inset: 0; z-index: 2500; background: rgba(11, 17, 23, .94);
  display: none; align-items: center; justify-content: center; flex-direction: column;
  gap: 14px; padding: 30px; cursor: zoom-out;
}
#lightbox.open { display: flex; animation: fade .2s; }
#lightbox img { max-width: min(1200px, 94vw); max-height: 82vh; border-radius: var(--radius); }
#lightbox .lb-cap { color: var(--snow); font-size: 14px; text-align: center; max-width: 70ch; }
#lightbox .lb-cap b { font-size: 16px; margin-right: 8px; }
#lightbox .lb-close {
  position: absolute; top: 16px; right: 18px; background: rgba(168, 212, 234, .18);
  border: none; color: var(--snow); font-size: 18px; width: 44px; height: 44px; border-radius: 50%;
}

/* ── Boot overlay ───────────────────────────────────────────────── */
#bootLoad { position: fixed; inset: 0; z-index: 1500; display: none; align-items: center; justify-content: center; background: var(--bg); }
body.booting #bootLoad { display: flex; }
#bootLoad .bl-card { display: grid; justify-items: center; gap: var(--sp-3); font-size: var(--fs-l); color: var(--muted); animation: pulse 1.4s ease-in-out infinite; }
#bootLoad .bl-mark { width: 56px; color: var(--accent); }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ── Offline mode ───────────────────────────────────────────────── */
#offlineBar { display: none; }
body.offline #offlineBar {
  display: block; position: sticky; top: 0; z-index: 950;
  background: var(--granite-deep); color: var(--ice); font-size: 13px; text-align: center;
  padding: 8px 14px; border-bottom: 1px solid var(--granite);
  padding-top: max(8px, env(safe-area-inset-top));
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}
body.offline .mobile-top { top: 0; padding-top: 12px; }
#offlineKit { border-left: 4px solid var(--accent); }

/* ── Live trail tracking ────────────────────────────────────────────────
 * These dots live on the MAP, so they use the theme-invariant map tokens. */
.track-card { border-left: 4px solid var(--track); }
.live-badge { flex: none; font-size: 11px; font-weight: 800; color: var(--route); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.live-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--route); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(11, 17, 23, .5); animation: ping 1.8s ease-out infinite;
}
/* GPS: vivid azure, MANDATORY 2.5px white ring so it never merges into a tile. */
.me-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--gps); border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(11, 17, 23, .5); animation: ping-blue 2s ease-out infinite;
}
/* #58 stale-GPS: grey the dot + kill the ping so an old fix reads honestly. */
.me-dot.stale { background: var(--alt-1); animation: none; opacity: .85; }
@keyframes ping-blue {
  0%   { box-shadow: 0 0 0 0 rgba(26, 115, 232, .5), 0 1px 4px rgba(11, 17, 23, .5); }
  100% { box-shadow: 0 0 0 14px rgba(26, 115, 232, 0), 0 1px 4px rgba(11, 17, 23, .5); }
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(232, 112, 42, .55), 0 1px 4px rgba(11, 17, 23, .5); }
  100% { box-shadow: 0 0 0 18px rgba(232, 112, 42, 0), 0 1px 4px rgba(11, 17, 23, .5); }
}

/* ── Guest role badge ───────────────────────────────────────────── */
.role-badge.guest {
  display: inline-block; margin-bottom: 10px; padding: 4px 10px; border-radius: var(--radius-pill);
  background: rgba(168, 212, 234, .14); color: var(--ice); font-size: 11px; font-weight: 700;
  border: 1px solid rgba(168, 212, 234, .35);
}
.fam-chip { background: var(--card-sunken); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 2px 8px; white-space: nowrap; }
.fam-chip a { color: var(--accent); font-weight: 700; }

/* trip mode */
.cd-box.trip-now { background: var(--accent); border-color: var(--accent); }
.cd-box.trip-now .n, .cd-box.trip-now .l { color: var(--accent-ink); }
.day-today { border: 2px solid var(--accent); }
.today-tag {
  position: absolute; top: 0; left: 16px; background: var(--accent); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 800; letter-spacing: 1.5px; padding: 3px 10px;
  border-radius: 0 0 var(--radius-s) var(--radius-s);
}

/* ── Toggle switch (digest admin) ───────────────────────────────── */
.switch { position: relative; display: inline-block; width: 48px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--line-strong); border-radius: var(--radius-pill); transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 21px; width: 21px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(21px); }
#digestPreview .sheet-tbl, #digestPreview table { font-size: 13px; }

/* ── Print (emergency sheet) — always black on white, ink-cheap ─── */
#printSheet { display: none; }
@media print {
  body.printing .app, body.printing .mobile-top, body.printing .login-screen,
  body.printing #toasts, body.printing #offlineBar, body.printing .modal-back,
  body.printing #lightbox, body.printing .scrim-back { display: none !important; }
  body.printing #printSheet { display: block; font-size: 10.5px; color: #000; }
  body.printing #printSheet h1 { font-size: 16px; margin: 0 0 2px; color: #000; }
  body.printing #printSheet .sheet-h { font-size: 11px; margin: 10px 0 4px; color: #000; }
  body.printing #printSheet .sheet-p, body.printing #printSheet .callout { font-size: 10px; margin: 3px 0; padding: 0; background: none; border: none; color: #000; }
  body.printing #printSheet table { width: 100%; border-collapse: collapse; font-size: 9.5px; }
  body.printing #printSheet th, body.printing #printSheet td { border: 1px solid #999; padding: 3px 5px; background: none; color: #000; }
  body.printing #printSheet .tbl-wrap { border: none; overflow: visible; margin: 4px 0; }
  body.printing #printSheet .ps-meta { font-size: 9px; color: #444; }
  body.printing #printSheet .pfa-sec { break-inside: avoid; margin: 6px 0; }
  body.printing #printSheet .pfa-evac { font-weight: 700; }
  body.printing #printSheet .fa-dose { display: table; overflow: visible; font-size: 8.5px; }
  body.printing #printSheet .fa-dose td, body.printing #printSheet .fa-dose th { padding: 2px 4px; }
}

/* ── First Aid page ─────────────────────────────────────────────────────
 * The one place --danger leads. Read in bad moments: maximum legibility,
 * body stays at full size, no decorative art beyond a divider ridge. */
.fa-disclaimer {
  background: var(--danger-soft); border: 1px solid var(--line); border-left: 5px solid var(--danger);
  border-radius: var(--radius-s); padding: 16px 18px; margin: 0 0 20px; position: sticky; top: 8px; z-index: 5;
}
.fa-disc-head { font-weight: 800; color: var(--danger); font-size: 15px; line-height: 1.35; }
.fa-disc-body { color: var(--fg); font-size: 14px; margin-top: 6px; line-height: 1.5; }
@media (max-width: 880px) { .fa-disclaimer { position: static; } }

.fa-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 var(--sp-4); }

.fa-toc { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 22px; }
.fa-toc-item {
  font-size: 13px; font-weight: 600; color: var(--accent-soft-ink); background: var(--accent-soft);
  border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 7px 13px;
  text-decoration: none; white-space: nowrap;
}
.fa-toc-item:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); text-decoration: none; }

.fa-card { margin: 0 0 var(--sp-4); scroll-margin-top: 80px; }
.fa-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--sp-2); }
.fa-ic { font-size: 22px; line-height: 1; }
.fa-head h3 { font-size: 18px; flex: 1; min-width: 180px; }
.fa-sev { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; border: 1px solid transparent; }
.fa-sev.crit { background: var(--danger); color: #fff; border-color: var(--danger); }
.fa-sev.warn { background: var(--card-sunken); color: var(--warn-ink); border-color: var(--warn-ink); }
.fa-sev.ok   { background: var(--card-sunken); color: var(--ok); border-color: var(--ok); }
.fa-note { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 2px 0 var(--sp-3); }
.fa-block { margin: 0 0 10px; }
.fa-lbl { display: block; font-size: 11.5px; font-weight: 800; color: var(--accent); margin-bottom: 3px; }
.fa-body { font-size: 15px; color: var(--fg); line-height: 1.55; }
.fa-body b { color: var(--fg); }
.fa-dose { width: 100%; border-collapse: collapse; margin: 6px 0 2px; font-size: 13.5px; display: block; overflow-x: auto; }
.fa-dose thead th { text-align: left; font-size: 11px; color: var(--muted); border-bottom: 2px solid var(--line); padding: 6px 10px 6px 0; white-space: nowrap; background: none; }
.fa-dose td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.45; background: none; }
.fa-dose td:first-child { font-weight: 700; color: var(--fg); min-width: 130px; }
.fa-dose td:nth-child(2) { min-width: 150px; color: var(--fg); }
.fa-dose td:last-child { color: var(--muted); }
.fa-golden { font-size: 13.5px; }
.fa-evac {
  display: flex; flex-direction: column; gap: 4px; margin-top: var(--sp-3); padding: 12px 14px;
  background: var(--danger-soft); border: 1px solid var(--line); border-left: 4px solid var(--danger);
  border-radius: var(--radius-s);
}
.fa-evac-lbl { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px; color: var(--danger); }
.fa-evac div { font-size: 14px; color: var(--fg); line-height: 1.5; }
.fa-evac a { color: var(--danger); }

.cm-wrap { margin: var(--sp-5) 0 var(--sp-4); }
.cm-card { padding: var(--sp-4); }
.cm-num { font-weight: 800; color: var(--accent); font-size: 13.5px; margin-bottom: var(--sp-2); text-transform: uppercase; letter-spacing: 1.2px; }
.cm-row { display: flex; align-items: baseline; gap: var(--sp-2); padding: 5px 0; border-bottom: 1px dashed var(--line); }
.cm-lab { font-size: 12.5px; color: var(--muted); min-width: 150px; font-weight: 600; }
.cm-fill { flex: 1; border-bottom: 1px solid var(--line); height: 16px; }

.fa-footer { margin-top: var(--sp-5); padding: var(--sp-4) 18px; background: var(--card-sunken); border: 1px dashed var(--line-strong); border-radius: var(--radius-s); }
.fa-review { font-size: 14.5px; color: var(--fg); line-height: 2.1; }
.fa-review-note { font-size: 12.5px; color: var(--muted); margin-top: var(--sp-2); line-height: 1.5; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 248px; z-index: 900;
    transform: translateX(-100%); transition: transform .25s; height: 100vh;
    /* Dynamic Island: pad the slide-out nav below the cutout when open (#41). */
    padding-top: max(22px, env(safe-area-inset-top));
    padding-left: max(16px, env(safe-area-inset-left));
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  /* Mobile bar carries the hamburger; without the inset the button sits under
     the Island and is untappable. max() = unchanged on desktop/Android. */
  .mobile-top {
    display: flex; align-items: center; gap: var(--sp-3); padding: 12px var(--sp-4);
    padding-top: max(12px, env(safe-area-inset-top));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    background: var(--granite-deep); color: var(--snow); position: sticky; top: 0; z-index: 800;
    border-bottom: 1px solid var(--granite);
  }
  .mobile-top .logo { width: 32px; height: 32px; border-radius: 8px; overflow: hidden; flex: none; }
  .mobile-top .logo svg { width: 100%; height: 100%; display: block; }
  .hamburger { font-size: 24px; background: none; border: none; color: var(--snow); min-width: 44px; min-height: 44px; }
  .scrim-back { position: fixed; inset: 0; background: rgba(11, 17, 23, .55); z-index: 850; display: none; }
  .scrim-back.open { display: block; }
  .wrap { padding: 22px 18px 70px; }
  .gallery { columns: 2; }
}
@media (max-width: 540px) {
  .gallery { columns: 1; }
  .page-head h1 { font-size: 26px; }
  .day-card { grid-template-columns: 52px 1fr; gap: var(--sp-3); }
}

/* ── Elevation profile strip (#37) ──────────────────────────────────────
 * Always dark: it is a night-granite chart panel in both themes, so the
 * altitude ramp and the grade colours keep one meaning. */
#profile {
  display: none; margin-top: 14px; border-radius: var(--radius); overflow: hidden;
  background: var(--granite-deep); border: 1px solid var(--granite);
}
#profile.on { display: block; }
#profile .prof-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px 4px; font-size: 13px; color: var(--ice); }
#profile .prof-head b { font-size: 14.5px; color: var(--snow); }
#profile .prof-stats { color: #A9C0D0; font-size: 12.5px; }
#profile .prof-stats .up { color: #F0A374; }
#profile .prof-stats .down { color: #9DD3F0; }
#profile .prof-stats .here { color: var(--ice); font-weight: 700; }
#profile .prof-stats .offtrail { color: #E8A55E; font-weight: 700; }
.pg-hi { fill: var(--ice); font-weight: 700; }
.grade-legend { margin-left: auto; font-size: 10.5px; color: #8FA6B8; white-space: nowrap; }
.grade-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 3px 0 7px; vertical-align: -1px; }
.prof-wrap { position: relative; }
#profile .prof-svg { display: block; width: 100%; height: 150px; touch-action: none; cursor: crosshair; }
.pg-line { stroke: rgba(232, 239, 244, .10); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pg-lab { fill: #8FA6B8; font: 10px var(--font); }
#scrubTip {
  display: none; position: absolute; top: 6px; transform: translateX(12px);
  background: rgba(11, 17, 23, .96); color: var(--snow); border: 1px solid rgba(168, 212, 234, .3);
  border-radius: var(--radius-s); padding: 6px 10px; font-size: 12px; line-height: 1.45;
  pointer-events: none; white-space: nowrap; z-index: 5;
}
#scrubTip.flip { transform: translateX(calc(-100% - 12px)); }
#scrubTip b { font-size: 13px; }
.scrub-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--route); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(11, 17, 23, .6); }
.prof-note { padding: 1px 14px 10px; font-size: 11px; color: #8FA6B8; line-height: 1.4; }
@media (max-width: 540px) { #profile .prof-svg { height: 132px; } .grade-legend { margin-left: 0; } }

/* ══════════════════════════════════════════════════════════════════════════
   2027 components — did not exist in the 2026 app.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Provisional-mileage marker ──────────────────────────────────────────
 * Days 1-2 (the Bishop Pass approach) carry ESTIMATED miles/gain/loss. On a
 * route page an unmarked estimate is a safety problem, so this is deliberately
 * loud — ink + rule, no amber fill (the identity's rule, kept). */
.prov-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: var(--radius-pill);
  white-space: nowrap; color: var(--warn-ink); background: var(--card-sunken);
  border: 1.5px solid var(--warn-ink);
}
.prov-note {
  margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-s);
  font-size: 13.5px; color: var(--fg); background: var(--card-sunken);
  border-left: 3px solid var(--warn-ink);
}
.card.day-prov { border-left: 3px solid var(--warn-ink); }

/* Crew avatar. */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 17px; font-weight: 700;
  color: var(--snow); background: var(--granite);
}

/* A card flagged as the recommended option / the resupply window. */
.card.star { border-left: 3px solid var(--accent); }
.card.day-resup { border-left: 3px solid var(--warn-ink); }

/* iPhone Dynamic Island / notch — carried forward from 2026 (#41). */
.mobile-top { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.sidebar    { padding-top: calc(22px + env(safe-area-inset-top, 0px)); }
.login-screen { padding-top: calc(24px + env(safe-area-inset-top, 0px)); }
body { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ── Provenance tags (Resupply page) ─────────────────────────────────────
 * VERIFIED / VERIFY BEFORE RELYING / ESTIMATE. Every cost figure on that page
 * is derived, not quoted; these badges are what keep that visible. Load-bearing,
 * not decoration — do not soften them. */
.prov-tag {
  display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 800;
  padding: 3px 9px; border-radius: var(--radius-pill); white-space: nowrap; cursor: help;
  background: var(--card-sunken); border: 1px solid transparent;
}
.prov-tag.ok   { color: var(--ok); border-color: var(--ok); }
.prov-tag.warn { color: var(--warn-ink); border-color: var(--warn-ink); }
.prov-tag.crit { color: var(--danger); border-color: var(--danger); }

/* Section accents on the resupply cards. */
.resup-card.k-risk     { border-left: 3px solid var(--danger); }
.resup-card.k-rule     { border-left: 3px solid var(--accent); }
.resup-card.k-canister { border-left: 3px solid var(--warn-ink); }
.resup-card.k-plan     { border-left: 3px solid var(--ok); }
.resup-card.k-fallback { border-left: 3px solid var(--muted); }
.resup-card.k-action   { border-left: 3px solid var(--accent-strong); }
