/* YAOTU v0.2 — full-screen map, floating controls, bottom sheet. No framework, no build step. */
:root {
  /* Dark is the shipping look. Every colour below is semantic, never a literal: a second palette
   * only has to redefine these names (see [data-theme="light"] further down). */
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d2230;
  --line: #262b35;
  --line-2: #2b3240;
  --field: #131720;
  --field-2: #1a1f2b;
  --btn: #232a38;
  --btn-line: #3c4557;
  --text: #e8eaed;
  --text-2: #dbe3ee;
  --muted: #9aa3b2;
  --muted-2: #6f7787;
  --accent: #f0b429;          /* fills: buttons, rings, selected borders */
  --accent-text: #f0b429;     /* the accent used AS TEXT on a panel */
  --accent-press: #d9a021;
  --accent-line: rgba(240, 180, 41, .62);
  --accent-ring: rgba(240, 180, 41, .18);
  --accent-ring-2: rgba(240, 180, 41, .50);
  --accent-ring-3: rgba(240, 180, 41, .70);
  --on-accent: #12161e;
  --ok: #6ee7a0;
  --ok-soft: #8fbfa5;
  --warn: #f0b95c;
  --warn-bg: #1a1b12;
  --err: #ff8f8f;
  --map-bg: #0b0d11;
  --float: rgba(23, 26, 33, .92);
  --topbar-grad: linear-gradient(180deg, rgba(15, 17, 21, .94), rgba(15, 17, 21, .55) 70%, transparent);
  --sheet-grad: linear-gradient(180deg, transparent, rgba(15, 17, 21, .9) 24px, rgba(15, 17, 21, .97) 60px);
  --sheet-fade-grad: linear-gradient(180deg, rgba(23, 26, 33, 0), rgba(23, 26, 33, .97));
  --mapfail-bg: rgba(15, 17, 21, .85);
  --hover: rgba(255, 255, 255, .08);
  --shadow-text: 0 2px 8px #000;
  --pill-neutral: rgba(255, 255, 255, .07);
  --float-strong: rgba(23, 26, 33, .96);
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
}

/* Daylight. Panels go white, text goes near-black, and the accent splits in two: the fill stays
 * the same amber (and keeps its dark ink), but anything that used amber AS TEXT gets a darker
 * value — #f0b429 on white is a 1.9:1 contrast ratio, i.e. unreadable in a car. */
[data-theme="light"] {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f1f4f8;
  --line: #dbe1ea;
  --line-2: #c7d0dd;
  --field: #ffffff;
  --field-2: #ffffff;
  --btn: #eef2f7;
  --btn-line: #cfd7e2;
  --text: #10151d;
  --text-2: #22303f;
  --muted: #59647a;
  --muted-2: #6d7789;
  --accent: #f0b429;
  --accent-text: #8a5a00;
  --accent-press: #d9a021;
  --accent-line: rgba(176, 114, 0, .55);
  --accent-ring: rgba(176, 114, 0, .18);
  --accent-ring-2: rgba(176, 114, 0, .45);
  --accent-ring-3: rgba(176, 114, 0, .6);
  --on-accent: #1a1204;
  --ok: #0d6b3c;
  --ok-soft: #17694a;
  --warn: #8a5f00;
  --warn-bg: #fff6df;
  --err: #b3261e;
  --map-bg: #dfe6ee;
  --float: rgba(255, 255, 255, .94);
  --topbar-grad: linear-gradient(180deg, rgba(238, 241, 245, .95), rgba(238, 241, 245, .6) 70%, transparent);
  --sheet-grad: linear-gradient(180deg, transparent, rgba(238, 241, 245, .92) 24px, rgba(238, 241, 245, .98) 60px);
  --sheet-fade-grad: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .97));
  --mapfail-bg: rgba(238, 241, 245, .9);
  --hover: rgba(16, 24, 40, .07);
  --shadow-text: 0 1px 3px rgba(255, 255, 255, .85);
  --pill-neutral: rgba(16, 24, 40, .06);
  --float-strong: rgba(255, 255, 255, .97);
  --shadow: 0 6px 24px rgba(16, 24, 40, .14);
}

* { box-sizing: border-box; }
/* iOS Safari zooms the whole page in when you focus an input whose font-size is under
   16 px — and it does not zoom back out by itself. That is the "everything looks bigger and
   is cut on all four sides" report: the zoom is a visual-viewport change, so it cannot be
   fixed with min-width or overflow rules. The only real fix is 16 px inputs.
   (`-webkit-text-size-adjust` stops the other iOS habit: inflating small text in landscape.) */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
  overscroll-behavior: none; }
body { overflow: hidden; }

/* ---------- map takes the whole screen ---------- */
#map { position: fixed; inset: 0; background: var(--map-bg); }
/* The planner panel is as wide as the phone, so the zoom buttons sit under it, not beside
 * it: --ctrl-top is measured from the panel's real bottom (app.js::placeMapControls). */
.maplibregl-ctrl-top-right { top: var(--ctrl-top, 74px); right: 8px; transition: top .18s ease; }
.maplibregl-ctrl-group { background: var(--float); border: 1px solid var(--line); }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
/* MapLibre ships black icons; on a dark control they vanish. Invert only the icon glyphs —
 * and NOT in the light theme, where inverting puts white icons on a white control: the zoom
 * buttons become invisible (caught in the light-theme pass, v0.19.0). */
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1); }
[data-theme="light"] .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: none; }
.maplibregl-ctrl button.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon,
.maplibregl-ctrl button.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon {
  filter: none;
}
.maplibregl-ctrl-group button { background: transparent; }
.maplibregl-ctrl-group button:hover { background: var(--hover); }

/* The attribution chip is the one element that ignored the theme: MapLibre hard-codes a white pill
 * with black text, so at night it sat on the dark map like a lit window. Same tokens as everything
 * else now, and the expand/collapse glyph is inverted only in the dark theme. */
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib.maplibregl-compact {
  background-color: var(--float) !important;
  color: var(--muted);
}
.maplibregl-ctrl-attrib a,
.maplibregl-ctrl-attrib a:hover { color: var(--muted); }
.maplibregl-ctrl-attrib-button { background-color: transparent; }
.maplibregl-ctrl-attrib-button:hover { background-color: var(--hover); }
[data-theme="dark"] .maplibregl-ctrl-attrib-button { filter: invert(1); }

/* ---------- floating top bar ---------- */
/* Language: a real <select>, so phones get their own native picker instead of a button
   that cycles through languages one tap at a time. */
.lang {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  padding: 5px 8px 5px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--field);
  color: var(--text); font-size: 12px; touch-action: manipulation;
}
.lang .globe { font-size: 12px; line-height: 1; }
.lang .chev { color: var(--accent-text); font-size: 10px; line-height: 1; margin-left: -2px; }
.lang select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 12px; padding: 0 2px 0 0; margin: 0; min-width: 64px; max-width: 84px;
  text-align: left; cursor: pointer;
}
.lang select:focus { outline: none; }
.lang:focus-within { border-color: var(--accent); }
/* Two pills in the top bar now: the theme one only ever shows 2–4 characters, so it takes
   what it needs instead of the language picker's 64 px floor. */
.lang.theme select { min-width: 40px; max-width: 60px; }
.lang.theme .globe { color: var(--accent-text); }

/* The cards on screen belong to the previous car: make the button impossible to miss. */
#go.stale { box-shadow: 0 0 0 2px var(--accent-ring-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--accent-ring-2); }
  50% { box-shadow: 0 0 0 4px var(--accent-ring-3); } }
.status.warn { color: var(--warn); }
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex;
  align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--topbar-grad);
  pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: .05em; text-shadow: var(--shadow-text); }
.brand span { color: var(--accent-text); font-weight: 500; letter-spacing: .12em; font-size: 12px; }
.brand .ver { font-size: 10px; color: var(--muted); font-style: normal; letter-spacing: .04em; }
.chip { border: 1px solid var(--line); background: var(--float); color: var(--accent-text);
  font: 600 13px/1 inherit; padding: 9px 13px; border-radius: 999px; cursor: pointer;
  font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.chip:active { transform: scale(.97); }

.card .cash .note { display: block; color: var(--muted-2); font-size: 11px; margin-top: 3px; }
/* "30.16 € à payer" broke between « à » and « payer » once the card got narrower. */
.card .j small { white-space: nowrap; }

/* ---------- floating planner: shrinks to one line once a route exists ---------- */
.planner { position: fixed; z-index: 20; top: calc(52px + env(safe-area-inset-top)); left: 10px;
  width: min(430px, calc(100vw - 20px)); padding: 10px; border-radius: 14px;
  /* On a short screen the vehicle block alone can eat the whole page and leave the result
     card 62 px tall. Cap the panel and scroll inside it; the card keeps a usable floor. */
  max-height: 48dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--float-strong); border: 1px solid var(--line); box-shadow: var(--shadow); }
.planner.min { max-height: none; overflow: visible; }
.plan-summary { display: none; }
.planner.min { padding: 8px 40px 8px 12px; }
.planner.min .plan-body { display: none; }
.planner.min .plan-summary { display: block; font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planner.min .plan-summary b { color: var(--text); }
.plan-toggle { position: absolute; right: 4px; top: 4px; width: 30px; height: 30px;
  border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer;
  display: none; }
.planner.min .plan-toggle { display: block; }
.planner .row { display: flex; gap: 8px; }
.planner input { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 16px; }
.planner input:focus { outline: none; border-color: var(--accent); }
/* Origin and destination are the only two fields anyone must touch, and after the vehicle bar
   landed above them they stopped standing out. Accent frame on .row inputs only — a bare
   `.planner input` rule would also catch the SOC number boxes. */
.planner .row input {
  border: 2px solid var(--accent-line); /* 1.5px rounds to 1 on some phones: use whole pixels */
  background: var(--field-2);
}
.planner .row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.planner .row input::placeholder { color: var(--muted); }
/* The ◎ was accent-coloured and sat on the accent frame, so the two yellows merged into one
   blob. Light icon, neutral ring: it reads as a button again. */
.planner .loc-wrap .loc {
  color: var(--text-2); background: var(--btn); border-color: var(--btn-line); width: 26px; height: 26px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.planner .loc-wrap .loc:active { color: var(--accent-text); border-color: var(--accent); }
/* Grid, not flex: three `nowrap` labels in a row cannot shrink below their text, so on a
   narrower iPhone (375 / 320 px) the row pushed 计算 off the right edge of the panel. */
.planner .row2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 6px; align-items: center; margin-top: 8px; }
.mini { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 11px;
  color: var(--muted); min-width: 0; line-height: 1.15; text-align: center; }
.mini input { width: clamp(34px, 9.5vw, 44px); flex: 0 0 auto; text-align: center; padding: 6px 2px;
  font-size: 16px; }
/* Double-tap on a button should not zoom either. */
.planner button, .card .actions a, #locate { touch-action: manipulation; }
#go { flex: 0 0 auto; min-width: 62px; background: var(--accent); color: var(--on-accent); border: 0;
  border-radius: 10px; padding: 11px 10px; font: 700 15px/1 inherit; cursor: pointer; }
/* French labels are wider than the Chinese ones: at 320 px the three fields ran 2 px past
   the row. Tighten the gap rather than shrink the 16 px inputs (Safari would zoom). */
@media (max-width: 360px) {
  .planner .row2 { gap: 4px; }
  .mini { font-size: 10.5px; gap: 2px; } /* "Plancher 20 %" ran 2 px past a 90 px track */
  .mini input { width: 34px; padding: 6px 1px; }
}
/* Below 360 px the four columns genuinely do not fit: give the button its own line. */
@media (max-width: 360px) {
  .planner .row2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #go { grid-column: 1 / -1; margin-top: 2px; }
}
#go:disabled { opacity: .55; }
.status { margin-top: 7px; font-size: 12px; color: var(--muted); min-height: 15px; }
.status.err { color: var(--err); }

/* ---------- bottom carousel: one card at a time, map stays visible ---------- */
/* The planner grows (vehicle block) and the sheet is bottom-anchored, so the two used to
   collide: 52 px of the card header sat under a 96 %-opaque panel. --sheet-top is written by
   app.js from the planner's real bottom edge, so the sheet starts where the panel ends.
   A card that no longer fits scrolls inside itself instead of being clipped. */
.sheet { position: fixed; z-index: 18; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  /* Cap the height instead of pinning `top`: the sheet stays content-sized, so its dark
     gradient keeps sitting right behind the cards instead of washing over the map. */
  max-height: calc(100vh - var(--sheet-top, 0px));
  max-height: calc(100dvh - var(--sheet-top, 0px));
  transition: max-height .16s ease;
  padding: env(safe-area-inset-bottom) 0 6px;
  background: var(--sheet-grad);
  pointer-events: none; }
/* A card that has to scroll must look like it can: iOS hides scrollbars, so a bottom fade
   is the only affordance telling the user the hand-off buttons are still down there. */
.sheet-fade {
  position: absolute; left: 13px; right: 13px; bottom: 6px; height: 40px; border-radius: 0 0 14px 14px;
  background: var(--sheet-fade-grad);
  opacity: 0; transition: opacity .16s ease; pointer-events: none;
}
.sheet-fade.on { opacity: 1; }
/* The gradient alone is invisible: it fades into the card's own colour. The chevron is the
   part the eye actually catches. */
.sheet-fade::after {
  content: "⌄"; position: absolute; left: 50%; transform: translateX(-50%); bottom: 5px;
  font-size: 17px; line-height: 1; color: var(--accent-text); opacity: .9;
}
.sheet .cards { pointer-events: auto; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; max-height: 100%;
  padding: 22px 16px 4px; scrollbar-width: none; }
.sheet .cards::-webkit-scrollbar { display: none; }
.card { flex: 0 0 84%; max-width: 400px; scroll-snap-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  box-shadow: var(--shadow); max-height: 100%; overflow-y: auto;
  /* Y only. `overscroll-behavior: contain` sets BOTH axes, and then the card swallows the
     horizontal pan meant for the carousel: the swipe stops dead on the card (measured:
     scrollLeft stayed 0 with contain, 282 with contain-y). */
  overscroll-behavior-y: contain; }
.card.best { border-color: var(--line-2); }
/* the picked card is the only one that gets the accent ring — it follows taps and swipes */
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring-2), var(--shadow); }
.card[data-idx] { cursor: pointer; }
.card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card .lbl { font-size: 15px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; }
.card .j { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .j small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.card .rank { font-size: 12.5px; color: var(--text-2); text-align: right; line-height: 1.45;
  font-variant-numeric: tabular-nums; }
.card .rank em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 3px;
  white-space: nowrap; }
/* min-width:0 or the origin half refuses to shrink below its inner input's min-content width,
   which left the destination field at 85 px on a 390 px phone (found while translating it:
   "Destination" was clipped to "Destinat"). */
.loc-wrap { position: relative; flex: 1; display: flex; min-width: 0; }
.loc-wrap input { flex: 1; padding-right: 32px; } /* the ◎ is 26 px wide at right: 4 px */
.loc { position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--field);
  color: var(--accent-text); font-size: 15px; line-height: 1; cursor: pointer; }
.loc:active { background: var(--btn); }
/* Clearing the destination: same round slot as the ◎, but muted until the field has content —
   a clear button on an empty field is a button that does nothing. */
.clr { font-size: 13px; color: var(--text-2); background: var(--btn); border-color: var(--btn-line); }
.clr:active { color: var(--err); border-color: #a33; }
.clr[hidden] { display: none; }
/* Chrome draws its own datalist arrow at the right edge, right where the ✕ sits, and a plain
   `display:none` loses to the UA rule — it needs !important plus zero width. The suggestions
   still open on typing; only the redundant chevron goes. */
#dest::-webkit-calendar-picker-indicator {
  display: none !important;
  width: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
}
.soc-hint { font-size: 11px; color: var(--muted); margin: -2px 0 8px; line-height: 1.35; }
/* charging count is the second thing a driver wants after money — give it its own row */
.card .charge-badge { display: inline-block; margin-top: 8px; padding: 4px 9px; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--accent-text); background: rgba(240,180,41,.12);
  border: 1px solid rgba(240,180,41,.35); font-variant-numeric: tabular-nums; }
.card .charge-badge.none { color: var(--ok-soft); background: rgba(27,127,90,.12); border-color: rgba(27,127,90,.35); }
.card .delta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.card .delta .pill {
  font-size: 12.5px; line-height: 1.35; padding: 2px 8px; border-radius: 9px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.card .delta .save { background: rgba(46,204,113,.16); color: var(--ok); }
.card .delta .slow { background: rgba(230,168,58,.16); color: var(--warn); }
.card .delta .ok { background: rgba(46,204,113,.16); color: var(--ok); }
.card .delta .neutral { background: var(--pill-neutral); color: var(--muted); }
.card .delta .lv { background: transparent; border: 1px solid currentColor; padding: 1px 7px; }
.card .delta .lv-easy { color: var(--ok); }
.card .delta .lv-ok { color: var(--muted); }
.card .delta .lv-hard { color: var(--err); }
.card .metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 9px; }
/* the count of plug-ins sits with the numbers, but keeps the accent so it still reads first */
.card .metrics .chg b { color: var(--accent-text); }
.card .metrics .chg.none b { color: var(--ok-soft); }
/* ---- garage code ---- */
#vehBox .garage { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
#vehBox .garage-row { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
#vehBox .garage-cap { font-size: 11px; color: var(--muted); white-space: nowrap; }
#vehBox .garage code {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  color: var(--text); opacity: .85;
}
#vehBox .garage input {
  flex: 1 1 auto; min-width: 0; height: 30px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--text);
  font-size: 16px;              /* iOS zooms the page under 16 px and never zooms back */
}
#vehBox .garage button {
  flex: 0 0 auto; height: 30px; padding: 0 11px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 11.5px;
}
#vehBox .garage button:hover { border-color: var(--accent); color: var(--accent); }
#vehBox .garage-note { margin: 0; font-size: 11px; color: var(--muted); min-height: 14px; }
#vehBox .garage-note.bad { color: var(--warn); }

.card .tag-od { margin-left: 6px; padding: 1px 5px; border-radius: 5px; font-size: 9.5px;
  color: var(--ok-soft); border: 1px solid rgba(143,191,165,.45); vertical-align: 1px; }
/* "Disputed": the published fare disagrees with the distance it covers. Amber, not red — the
 * number is still an official one, we just cannot stand behind it. */
.card .tag-od.tag-warn { margin-left: 4px; color: var(--warn); border-color: rgba(240,185,92,.55);
  background: rgba(240,185,92,.10); cursor: help; }
.card .wx { margin-top: 6px; font-size: 11px; color: var(--muted); }
.card .wx.env { margin-top: 9px; color: var(--muted); line-height: 1.5; }
/* Wraps only when darkness/rain push it past the card width; short lines stay on one row. */
.card .metrics div { font-size: 11px; color: var(--muted); }
.card .metrics b { display: block; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.card details { margin-top: 9px; }
.card summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.card .jam { margin-top: 7px; font-size: 11.5px; color: var(--warn); font-variant-numeric: tabular-nums; }
.card .jam b { font-weight: 600; }
.card .jam.free { color: var(--ok); }
.card details.sched { margin-top: 8px; }
.card details.sched summary { font-size: 12px; color: var(--muted); }
.card .sched-body { margin-top: 6px; display: grid; gap: 3px; }
.card .sched-row {
  display: grid; grid-template-columns: 50px 56px 62px 1fr; gap: 5px;
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.card .sched-row .at { color: var(--text-2); }
.card .sched-row .leg { color: var(--muted); }
.card .sched-hint { margin-top: 5px; font-size: 11px; line-height: 1.45; color: var(--warn); }
.card .sched-row .min { text-align: left; }
.card table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12px; }
.card td { padding: 3px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.card td.num { text-align: right; color: var(--text); font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.card td:first-child { line-height: 1.4; padding-right: 8px; }
.card .cash { margin-top: 8px; font-size: 11px; line-height: 1.45; color: var(--muted); }
.card .cash b { color: var(--text); }
.card .cash .note { display: block; color: var(--muted-2); font-size: 10.5px; margin-top: 2px; }
/* ---------- vehicle selectors (YT-033) ----------
   This used to be a grey line of text under the SOC row and people scrolled straight past it,
   then wasted a search on the wrong car. It is now a full-width bar sitting between the address
   fields and the SOC row: icon, label, the car in bold, chevron on the right. */
.hidden { display: none !important; }
/* The car line in the planner is no longer a <details> panel: it is a button that opens the
   settings page, so both the car and its garage code live in exactly one place. */
.veh {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--field);
  font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.veh:active { transform: scale(.995); }
.veh .veh-ico { font-size: 15px; line-height: 1; }
.veh .veh-cap { color: var(--muted); font-size: 12px; }
.veh .veh-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.veh .veh-chev { margin-left: auto; color: var(--accent-text); font-size: 12px; }
.veh.custom { border-color: var(--accent); background: var(--warn-bg); }
.veh-body { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.veh-body label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
/* Fuel car: no range select, so the last field spans the row instead of leaving a gap. */
#vehBox:not(.ev) .veh-body label:last-child { grid-column: 1 / -1; }
.veh-body select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--field); color: var(--fg); font-size: 16px; appearance: none; }
.veh-note { margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted-2); }
@media (max-width: 340px) { .veh-body { grid-template-columns: 1fr; } }
.card .metrics .tag { color: var(--muted); font-size: 11px; align-self: center; }
.card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.card .actions > a { flex: 1; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; text-decoration: none; padding: 9px 8px;
  /* the icon inherits currentColor so each button keeps its own contrast */
  border-radius: 9px; font-size: 13px; font-weight: 600; }
.card .gmaps { background: #1f6feb; color: #fff; }
/* Primary action, its own row: three buttons in one row squeezed "Google Maps" onto two lines. */
.card .actions > .navgo { flex: 1 1 100%; background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 14px; padding: 11px 0; }
.card .actions .navgo:active { background: var(--accent-press); }
.card .actions .openapp { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.card .actions .openapp:active { background: var(--btn); }
.card .actions svg { width: 15px; height: 15px; flex: 0 0 auto; }
/* iPhone row carries three buttons (Google / Apple / GPX): two of them are word pairs, so the
   horizontal padding and the gap come down rather than the font size (13 px is the iOS floor). */
.card .actions.three { gap: 6px; }
.card .actions.three > a, .card .actions.three > .gpx { padding-left: 4px; padding-right: 4px; gap: 4px; }
.card .actions.three svg { width: 14px; height: 14px; }
/* GPX now shares the row with the map handoffs: it is the only one that keeps OUR route, but it
   no longer needs a full-width line of its own (D-029). */
.card .actions > .gpx { flex: 1 1 0; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; padding: 9px 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit; line-height: 1;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  touch-action: manipulation; }
.card .actions > .gpx:active { background: var(--btn); }

/* ---------- on-map route labels + charge stops ---------- */
.route-label { pointer-events: none; white-space: nowrap; font: 600 11px/1 inherit;
  padding: 5px 8px; border-radius: 8px; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.6);
  border: 2px solid rgba(255,255,255,.85); transition: opacity .15s; }
.route-label.dim { opacity: .45; }
.stop-marker { width: 22px; height: 22px; border-radius: 50%; background: var(--btn); border: 2px solid var(--accent);
  color: var(--accent-text); font: 700 11px/18px inherit; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
.mapfail { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; color: var(--muted); font-size: 13px; background: var(--mapfail-bg); }
.mapfail a { color: var(--accent-text); }

@media (min-width: 821px) {
  .planner { top: 70px; }
  .sheet { left: auto; right: 16px; width: 420px; bottom: 16px; max-height: none; background: none;
    padding: 0; display: block; }
  .sheet .cards { flex-direction: column; overflow-x: hidden; overflow-y: auto; max-height: 70vh; padding: 0; }
  .card { flex: 0 0 auto; max-width: none; }
}


/* ══ settings page ══════════════════════════════════════════════════════════════════════════
   One full-screen page, one column, grouped cards. Everything is visible without nested menus:
   the phone has to reach the car, the language, the garage code and the donation link in a
   single tap from the gear. The donation row is text plus one button — no banner, no nag, no
   feature behind it. */

.gear {
  margin-left: auto; width: 34px; height: 34px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--field);
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.gear svg, .set-back svg { display: block; }
.gear:hover { color: var(--accent-text); border-color: var(--accent-line); }
.gear:active { transform: scale(.96); }

body.set-open { overflow: hidden; }

.settings {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .18s ease, transform .22s cubic-bezier(.2, .8, .3, 1);
}
.settings.open { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .settings { transition: none; } }

.set-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.set-head h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.set-back {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--field); color: var(--text); font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.set-back:active { transform: scale(.96); }

.set-body {
  max-width: 560px; margin: 0 auto;
  padding: 14px 14px calc(30px + env(safe-area-inset-bottom));
}

.set-group {
  background: var(--field); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 13px 14px; margin-bottom: 12px;
}
.set-group h3 {
  margin: 0 0 9px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  color: var(--muted); text-transform: uppercase;
}
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0;
}
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row > span:first-child { font-size: 13.5px; color: var(--text); }
.set-val { font-size: 12.5px; color: var(--muted); text-align: right; }
.set-row select {
  min-width: 132px; padding: 7px 10px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--field-2); color: var(--text);
  font-size: 16px;                 /* iOS: below 16 px the page zooms and never zooms back */
  -webkit-appearance: none; appearance: none;
}
.set-note { margin: 0 0 8px; font-size: 12px; line-height: 1.65; color: var(--muted); }
.set-note + .set-row { border-top: 0; }
.set-btn {
  height: 32px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--field-2); color: var(--text); font-size: 12.5px;
}
.set-btn:hover { border-color: var(--accent-line); color: var(--accent-text); }
.set-btn:active { transform: scale(.97); }
.donate-btn {
  display: block; text-align: center; text-decoration: none; margin-top: 10px;
  padding: 11px 14px; height: auto; border: 0; border-radius: 11px;
  background: var(--accent); color: #14181f; font-weight: 700; font-size: 13.5px;
}
.donate-btn:active { background: var(--accent-press); }
/* `display: block` above outranks the UA rule for [hidden], so the button has to be switched off
   explicitly — otherwise a donation CTA with no destination shows up as a dead yellow bar. */
.donate-btn[hidden] { display: none; }
.set-group .garage { border-top: 1px solid var(--line); }
