/* ==========================================================================
   Hornk — mobile-first shell.
   Layout is a full-bleed map with a draggable bottom sheet over it.
   Theme is driven by [data-theme="day"|"night"] on <html>, set by theme.js
   from the sun position (or a manual override).
   ========================================================================== */

/* Hornk brand palette, sampled from the brand sheet.
   Fill tokens carry the exact brand hue; the matching `-text` tokens are the
   same hue darkened until they clear 4.5:1 on a light surface. Brand orange is
   2.7:1 on white, so it can never be text in day mode — only a fill. */
:root {
  --brand-navy: #08415F;
  --brand-teal: #0E939A;
  --brand-blue: #087EAC;
  --brand-orange: #F77B23;
  --brand-cream: #FAFAF8;

  --bg: #F7F9F8;
  --surface: #FFFFFF;
  --surface-2: #EDF2F3;
  --surface-3: #DCE6E9;
  --text: #08415F;
  --text-dim: #52707F;
  --border: #CFDDE3;
  --accent: #F77B23;
  --accent-ink: #0D1117;      /* dark ink on orange = 7.04:1 (white was 2.69:1) */
  --accent-text: #BD5307;
  --good: #0E939A;
  --good-text: #0C7F86;
  --info: #087EAC;
  --info-text: #087BA8;
  --warn: #B8730A;
  --warn-text: #A26509;
  --bad: #C62828;
  --bad-text: #C62828;
  --on-good: #0D1117;         /* ink on a teal fill  */
  --on-bad: #FFFFFF;          /* ink on a red fill   */
  --shadow: 0 6px 28px rgba(8, 65, 95, .16);
  --sheet-radius: 20px;
  --tabbar-h: 58px;
  --appbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --map-filter: none;
  color-scheme: light;
}

/* Night is the brand navy taken almost to black. Keeping the hue ties the dark
   theme to the identity; taking it this dark keeps orange at 6.4:1 and teal at
   4.6:1, which the airy teal-and-white of the brand sheet could not do. */
html[data-theme="night"] {
  --bg: #051E2B;
  --surface: #0A2A3A;
  --surface-2: #103446;
  --surface-3: #1A4257;
  --text: #E9F1F5;
  --text-dim: #8FA9B8;
  --border: #1C4055;
  --accent: #FF8B3D;
  --accent-ink: #051E2B;
  --accent-text: #FF8B3D;
  --good: #17B0B8;
  --good-text: #17B0B8;
  --info: #4FB3DE;
  --info-text: #4FB3DE;
  --warn: #E8B23A;
  --warn-text: #E8B23A;
  --bad: #FF6B6B;
  --bad-text: #FF6B6B;
  --on-good: #051E2B;
  --on-bad: #051E2B;          /* night reds are light, so ink goes dark */
  --shadow: 0 6px 28px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .95rem; margin: 0; }
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; }

/* ─────────────────────────────────────────────────────────────── map ───── */

#map {
  position: fixed;
  inset: calc(var(--safe-t) + var(--appbar-h)) 0 0 0;
  background: var(--surface-2);
}

.leaflet-container { background: var(--surface-2); font: inherit; }
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--surface) 80%, transparent) !important;
  color: var(--text-dim) !important;
  font-size: 10px !important;
  /* Keep OSM/CARTO attribution clear of the sheet. */
  margin-bottom: calc(var(--tabbar-h) + var(--safe-b)) !important;
}
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-bar a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* ────────────────────────────────────────────────────────────  app bar ─── */

/* Solid chrome above the map rather than controls floating over terrain. The
   map is inset below it, so Leaflet's own controls no longer collide with it. */
.appbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 540;
  height: calc(var(--safe-t) + var(--appbar-h));
  padding: var(--safe-t) 12px 0;
  display: flex;
  gap: 9px;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  user-select: none;
  /* Clips the goose's neck flush with the bar's bottom edge. Deliberately on
     .brand and not .appbar — the bar has to let the search dropdown hang out. */
  height: var(--appbar-h);
  overflow: hidden;
}
.brand img {
  height: 64px;              /* taller than the bar; the neck runs off the bottom */
  width: auto;
  align-self: flex-start;
  margin-top: 8px;           /* puts the beak on the wordmark's centre line */
  border-radius: 0;          /* never round this: it clips the honk waves */
}
.appbar .wordmark { font-size: 17px; }

/* Typing needs the width more than the logo does. */
body.searching .brand .wordmark { display: none; }

/* Locate, floating over the map under the zoom control. */
.map-fab {
  position: fixed;
  right: 10px;
  top: calc(var(--safe-t) + var(--appbar-h) + 78px);
  z-index: 500;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.map-fab:active { transform: scale(.95); }

.icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}
.icon-btn:active { transform: scale(.96); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.searchwrap { position: relative; flex: 1 1 auto; min-width: 0; }

#searchInput {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* 16px stops iOS zooming on focus */
}
#searchInput:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.search-results {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 50vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.search-results li {
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.search-results li:active,
.search-results li[aria-selected="true"] { background: var(--surface-2); }
.search-results .r-name { font-weight: 600; }
.search-results .r-sub { font-size: 12px; color: var(--text-dim); }

.statuschips {
  position: fixed;
  top: calc(var(--safe-t) + var(--appbar-h) + 8px);
  left: 8px;
  right: 8px;
  z-index: 480;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  pointer-events: none;
}
.chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.chip.warn { border-color: var(--warn); color: var(--warn-text); }
.chip.bad { border-color: var(--bad); color: var(--bad-text); }
.chip.live::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: .25; } }

/* ─────────────────────────────────────────────────────────  bottom sheet ─ */

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 600;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: height .28s cubic-bezier(.22, .9, .3, 1);
  touch-action: none;
}
.sheet[data-state="peek"] { height: 108px; }
.sheet[data-state="half"] { height: 52vh; }
.sheet[data-state="full"] { height: calc(100vh - var(--safe-t) - var(--tabbar-h) - var(--safe-b) - 12px); }
.sheet.dragging { transition: none; }

.sheet-grip {
  flex: 0 0 auto;
  height: 26px;
  width: 100%;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: grab;
}
.sheet-grip span {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 20px;
  touch-action: pan-y;
}

.panel { display: flex; flex-direction: column; gap: 12px; }
.panel[hidden] { display: none; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-label {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 4px;
}

.hint { margin: 0; font-size: 12.5px; color: var(--text-dim); }

/* ───────────────────────────────────────────────────────────── controls ── */

.primary-btn {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.primary-btn:disabled { opacity: .5; }
.primary-btn:active:not(:disabled) { transform: scale(.99); }

.ghost-btn {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ghost-btn:active { background: var(--surface-3); }
.ghost-btn.danger { color: var(--bad-text); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }

.pill {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.pill.danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.segmented button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
}
.segmented button span { font-weight: 700; font-size: 14px; }
.segmented button small { color: var(--text-dim); font-size: 11px; }
.segmented button[aria-checked="true"] {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-color: var(--accent);
}
.segmented button[aria-checked="true"] small { color: var(--text); }

.row-toggles { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); }

.depart-row { display: flex; gap: 8px; align-items: center; }
.depart-row input {
  flex: 1;
  min-height: 44px;
  padding: 0 10px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}

.field {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}
textarea.field { min-height: 76px; resize: vertical; }

/* ──────────────────────────────────────────────────────────── waypoints ── */

.waypoints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.waypoints li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.wp-dot {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-3);
}
.wp-dot.start { background: var(--good); color: var(--on-good); }
.wp-dot.end { background: var(--accent); color: var(--accent-ink); }
.wp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.wp-btn {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}
.wp-btn:active { background: var(--surface-3); }
.wp-empty { color: var(--text-dim); font-size: 13px; }
.wp-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ──────────────────────────────────────────────────── route options/detail */

.route-options { display: flex; flex-direction: column; gap: 8px; }

.route-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--rc, var(--text-dim));
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.route-card[aria-pressed="true"] {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.route-card .rc-title { font-weight: 700; font-size: 14px; }
.route-card .rc-main { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.route-card .rc-sub { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-dim);
}
.tag.good { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good-text); }
.tag.warn { background: color-mix(in srgb, var(--warn) 24%, transparent); color: var(--warn-text); }
.tag.bad  { background: color-mix(in srgb, var(--bad) 20%, transparent);  color: var(--bad-text); }

.route-detail { display: flex; flex-direction: column; gap: 12px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  padding: 8px;
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
}
.stat b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }

/* weather strip */
.weather-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}
.wx {
  flex: 0 0 84px;
  scroll-snap-align: start;
  padding: 9px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-align: center;
}
.wx.alert { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface-2)); }
.wx .wx-when { font-size: 10.5px; color: var(--text-dim); }
.wx .wx-icon { font-size: 22px; line-height: 1.3; }
.wx .wx-temp { font-weight: 700; font-variant-numeric: tabular-nums; }
.wx .wx-meta { font-size: 10.5px; color: var(--text-dim); }
.wx .wx-place { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* turn list */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: 0; }
.steps .s-icon { font-size: 19px; text-align: center; color: var(--text-dim); }
.steps .s-text { font-size: 13.5px; }
.steps .s-dist { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.disclosure > summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "▸ "; color: var(--text-dim); }
.disclosure[open] > summary::before { content: "▾ "; }

/* ──────────────────────────────────────────────────────────────── lists ── */

.list { display: flex; flex-direction: column; gap: 8px; }
.list:empty::after {
  content: attr(data-empty);
  color: var(--text-dim);
  font-size: 13px;
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.item .grow { flex: 1; min-width: 0; }
.item .i-title { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .i-sub { font-size: 12px; color: var(--text-dim); }
.item .i-actions { display: flex; gap: 6px; flex-shrink: 0; }

.dot-live {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent);
}

.poi-cats { display: flex; gap: 7px; flex-wrap: wrap; }
.poi-cats button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  cursor: pointer;
}
.poi-cats button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border-color: var(--accent);
  font-weight: 650;
}

/* ─────────────────────────────────────────────────────────────── tabbar ── */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 700;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar button {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}
.tabbar button.active { color: var(--accent-text); }

/* ─────────────────────────────────────────────────────────────  nav HUD ── */

.nav-hud {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 800;
  padding: calc(var(--safe-t) + 10px) 12px 12px;
  background: linear-gradient(180deg, var(--surface) 78%, transparent);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nav-hud[hidden] { display: none; }

.nav-primary { display: flex; align-items: center; gap: 14px; }
.maneuver {
  flex: 0 0 auto;
  width: 62px; height: 62px;
  display: grid;
  place-items: center;
  font-size: 34px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
}
.nav-text { min-width: 0; }
.nav-distance { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.nav-street { font-size: 15px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-then {
  font-size: 12.5px;
  color: var(--text-dim);
  padding-left: 76px;
  margin-top: -6px;
}

.nav-bottom {
  position: fixed;
  left: 8px; right: 8px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.speedbox { text-align: center; min-width: 54px; }
.speed-now { font-size: 26px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.speed-now.over { color: var(--bad-text); }
.speed-unit { font-size: 10px; color: var(--text-dim); }

.limit-sign {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid #d0021b;
  display: grid;
  place-items: center;
  color: #111;
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.limit-sign[hidden] { display: none; }

.nav-eta { flex: 1; text-align: right; line-height: 1.2; }
.nav-eta strong { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.nav-eta span { font-size: 11.5px; color: var(--text-dim); }
.nav-actions { display: flex; gap: 6px; }

.nav-group {
  position: fixed;
  right: 8px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 82px);
  max-width: 190px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nav-group[hidden] { display: none; }
.nav-group .g-row { display: flex; align-items: center; gap: 6px; }
.nav-group .g-swatch { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.nav-group .g-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group .g-gap { color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Navigating hides the planner chrome. */
body.navigating .appbar,
body.navigating .map-fab,
body.navigating .statuschips { display: none; }
/* The bar is gone while riding, so give its 56px back to the map. */
body.navigating #map { inset: 0; }
body.navigating .sheet { display: none; }

/* ──────────────────────────────────────────────────────────────  modals ── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, .5);
  display: grid;
  place-items: end center;
  padding: 0;
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 16px calc(20px + var(--safe-b));
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideup .22s cubic-bezier(.22, .9, .3, 1);
}
@keyframes slideup { from { transform: translateY(16px); opacity: .6; } }
.modal h2 { margin-bottom: 2px; }
.modal label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); display: block; margin-bottom: 4px; }
.modal .row { display: flex; gap: 8px; }
.modal .row > * { flex: 1; }

/* ──────────────────────────────────────────────────────────────  toasts ── */

.toasts {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  align-self: center;
  max-width: 100%;
  padding: 11px 15px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: slideup .2s;
}
.toast.bad { background: var(--bad); color: var(--on-bad); }
.toast.good { background: var(--good); color: var(--on-good); }

/* ──────────────────────────────────────────────────────  map decorations ─ */

.rider-marker {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.me-marker {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--info);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--info) 45%, transparent), 0 2px 6px rgba(0,0,0,.4);
}
.poi-marker {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(45deg);
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.poi-marker > span { transform: rotate(-45deg); font-size: 13px; }
.wp-marker {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  border: 2px solid var(--surface);
  font-size: 12px;
  font-weight: 800;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.popup-title { font-weight: 700; margin-bottom: 2px; }
.popup-actions { display: flex; gap: 6px; margin-top: 8px; }


/* ──────────────────────────────────────────────────────────────── brand ─── */

/* Wordmark: HOR navy / N teal / K orange, per the brand sheet. Navy is
   invisible on the night background, so the first run swaps to body text. */
:root { --wm-1: #08415F; --wm-2: #0E939A; --wm-3: #F77B23; }
html[data-theme="night"] { --wm-1: #E9F1F5; --wm-2: #17B0B8; --wm-3: #FF8B3D; }

.wordmark {
  display: inline-flex;
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -.01em;
  user-select: none;
}
.wordmark i { font-style: normal; }
.wordmark .w1 { color: var(--wm-1); }
.wordmark .w2 { color: var(--wm-2); }
.wordmark .w3 { color: var(--wm-3); }
.wordmark.sm { font-size: 19px; }

.brand-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.brand-head img { width: 38px; height: 38px; flex: 0 0 auto; }
.brand-head .tagline { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }

/* Empty states get the goose rather than a bare line of grey text. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 14px 22px;
  text-align: center;
}
.empty-state img {
  width: 74px;
  height: auto;
  opacity: .92;
}
.empty-state .es-title { font-weight: 700; font-size: 14px; }
.empty-state .es-body { font-size: 12.5px; color: var(--text-dim); max-width: 34ch; }

/* ─────────────────────────────────────────────────────  larger screens ─── */

@media (min-width: 760px) {
  .sheet {
    left: 12px;
    right: auto;
    width: 400px;
    bottom: 12px;
    border-radius: var(--sheet-radius);
    border: 1px solid var(--border);
  }
  .sheet[data-state="peek"] { height: 120px; }
  .sheet[data-state="half"] { height: 60vh; }
  .sheet[data-state="full"] { height: calc(100vh - var(--safe-t) - var(--appbar-h) - 96px); }

  .tabbar {
    left: 12px;
    width: 400px;
    bottom: auto;
    top: calc(var(--safe-t) + var(--appbar-h) + 8px);
    height: var(--tabbar-h);
    padding-bottom: 0;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .appbar { padding-inline: 16px; }
  .appbar .wordmark { font-size: 19px; }
  .statuschips { left: 424px; right: 12px; }
  .leaflet-control-attribution { margin-bottom: 0 !important; }
  .nav-bottom { left: auto; right: 12px; width: 420px; bottom: 12px; }
  .nav-group { bottom: 90px; }
  .toasts { left: auto; right: 12px; width: 420px; }
  .modal-backdrop { place-items: center; }
  .modal { border-radius: 16px; }
  .segmented { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
