/* ============================================================ tokens ==== */
/*
 * Light theme. Cool paper rather than cream, so it reads as a records sheet
 * instead of a stationery mock-up. The one dark object on the page is the
 * odometer drum: real mechanical odometers are black drums with pale digits,
 * and keeping it that way makes the instrument the thing your eye lands on.
 */
:root {
  --paper:      #EFF2F5;
  --card:       #FFFFFF;
  --card-sunk:  #F6F8FA;
  --ink:        #101A26;
  --ink-soft:   #3D4B5C;
  --dim:        #66748A;
  --dimmer:     #8F9CAE;
  --rule:       #D7DEE6;
  --rule-soft:  #E7ECF1;

  --drum:       #1A2432;
  --drum-face:  #F3EFE6;

  --amber:      #B26A00;
  --amber-lit:  #E08A0B;
  --amber-wash: #FDF3E0;
  --amber-edge: #EBD3A8;

  --green:      #1F6F5C;
  --green-wash: #E8F4EF;

  --red:        #C0392B;
  --red-wash:   #FBECEA;

  --r-sm: 5px;
  --r-md: 9px;
  --r-lg: 14px;

  --lift-1: 0 1px 2px rgba(16, 26, 38, .06), 0 1px 1px rgba(16, 26, 38, .04);
  --lift-2: 0 4px 14px rgba(16, 26, 38, .08), 0 1px 3px rgba(16, 26, 38, .06);
  --lift-3: 0 18px 46px rgba(16, 26, 38, .16), 0 3px 10px rgba(16, 26, 38, .08);
  --sunk: inset 0 2px 5px rgba(16, 26, 38, .45);

  --pad: clamp(16px, 2.2vw, 26px);

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

/* ============================================================== base ==== */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; font-weight: 700; }

button, input, select { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--amber-lit);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

code { font-family: var(--mono); font-size: .9em; color: var(--dim); }

/* The wide cut of Archivo is the house voice for every label. */
.field-label,
.odo-caption,
.gauge dt,
.log thead th,
.tally-item span,
.sheet-title,
.brand-name,
.veh-year-label {
  font-stretch: 125%;
  text-transform: uppercase;
  letter-spacing: .085em;
}

/* ============================================================ topbar ==== */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
  justify-content: space-between;
  padding: 13px var(--pad);
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 500;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  background: conic-gradient(from 210deg, var(--amber-lit) 0deg 96deg, transparent 96deg 360deg);
  flex: none;
}

.brand-name { font-size: 12px; font-weight: 700; line-height: 1.15; color: var(--ink); }

.topbar-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }

/* =============================================================== tabs === */
.tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  background: var(--card-sunk);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
}

.tab {
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .13s ease, color .13s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-on {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--lift-1);
}

.tabpanel[hidden] { display: none; }

/* ------------------------------------------------------------- scope bar */
.scope {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 18px;
  padding: 12px var(--pad);
  background: var(--card-sunk);
  border-bottom: 1px solid var(--rule);
}
.scope[hidden] { display: none; }
.scope .field--inline { min-width: 150px; }

.scope-note {
  font-size: 11.5px;
  color: var(--dim);
  padding-bottom: 8px;
}

/* ============================================================= fields === */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.field-label { font-size: 10px; font-weight: 600; color: var(--dim); }

.field-label .req { font-style: normal; color: var(--amber); margin-left: 6px; letter-spacing: .04em; }

.field input,
.field select,
.sheet-tools input,
.sheet-tools select,
.veh-input {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
  min-width: 0;
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.field select, .sheet-tools select { cursor: pointer; }
.field input::placeholder { color: var(--dimmer); }

.field input:focus,
.field select:focus,
.sheet-tools input:focus,
.veh-input:focus {
  border-color: var(--amber-lit);
  outline: none;
  box-shadow: 0 0 0 3px var(--amber-wash);
}

.field--inline { min-width: 108px; }

.hint { font-size: 11px; color: var(--dim); font-family: var(--mono); min-height: 14px; }
.hint[data-tone="warn"] { color: var(--amber); }

/* --------------------------------------------------- address typeahead -- */
.typeahead { position: relative; display: flex; align-items: stretch; gap: 6px; }
.typeahead input { flex: 1; }

.pin-btn {
  flex: none;
  border: 1px solid var(--rule);
  background: var(--card-sunk);
  color: var(--dim);
  border-radius: var(--r-sm);
  padding: 0 12px;
  font-size: 10.5px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
}
.pin-btn:hover { background: var(--amber-wash); border-color: var(--amber-edge); color: var(--amber); }

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--lift-3);
  max-height: 264px;
  overflow-y: auto;
}
.suggestions[hidden] { display: none; }

.suggestion {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.suggestion.is-active { background: var(--amber-wash); }

.suggestion-main { font-size: 13px; color: var(--ink); line-height: 1.35; }
.suggestion-context { font-size: 11px; color: var(--dim); font-family: var(--mono); }

/* ============================================================ buttons === */
.btn {
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: var(--r-sm);
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--lift-1);
  transition: background .13s ease, border-color .13s ease, transform .06s ease;
}
.btn:hover { background: var(--card-sunk); border-color: #C2CCD8; }
.btn:active { transform: translateY(1px); }
.btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn--record[disabled] { background: var(--card-sunk); border-color: var(--rule); color: var(--dimmer); }
.btn--stop[disabled]   { background: var(--card-sunk); border-color: var(--rule); color: var(--dimmer); }
.btn--finish[disabled] { background: var(--card-sunk); border-color: var(--rule); color: var(--dimmer); }

.btn--record {
  background: var(--amber);
  border-color: var(--amber);
  color: #FFFFFF;
}
.btn--record:hover { background: #9C5D00; border-color: #9C5D00; }

.btn--finish {
  background: var(--amber-wash);
  border-color: var(--amber-edge);
  color: var(--amber);
}
.btn--finish:hover { background: #FBEBCE; border-color: #DEBE86; }

.btn--hold { background: var(--card); }

.btn--manual {
  background: var(--green-wash);
  border-color: #BEDDD2;
  color: var(--green);
  width: 100%;
}
.btn--manual:hover { background: #DCEEE7; border-color: #A3CFC0; color: #175546; }

.btn--stop {
  background: var(--red);
  border-color: var(--red);
  color: #FFFFFF;
}
.btn--stop:hover { background: #A72F23; border-color: #A72F23; }

.btn--ghost { background: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--card-sunk); }

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--dim);
  padding-inline: 9px;
  box-shadow: none;
}
.btn--quiet:hover { background: var(--card-sunk); color: var(--ink); border-color: transparent; }

.btn--danger { background: transparent; border-color: #E4B6B0; color: var(--red); box-shadow: none; }
.btn--danger:hover { background: var(--red-wash); border-color: #D79A92; }

.btn--tiny { padding: 5px 9px; font-size: 10px; }
.btn--pill { border-radius: 999px; }

.icon-btn {
  background: none; border: none; color: var(--dim);
  font-size: 15px; cursor: pointer; padding: 4px 8px; border-radius: var(--r-sm);
}
.icon-btn:hover { color: var(--ink); background: var(--card-sunk); }

.link-btn {
  background: none; border: none; padding: 0;
  color: var(--amber);
  font-size: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--amber-lit); }

.spacer { flex: 1; }

/* ============================================================== deck ==== */
.deck {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 1px;
  background: var(--rule);
  border-bottom: 1px solid var(--rule);
  min-height: 62vh;
}

.panel { background: var(--card); }

.panel--instruments {
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --------------------------------------------------------- recorder head */
.recorder-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-stretch: 112%;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--dim);
}

.status-lamp { width: 9px; height: 9px; border-radius: 50%; background: var(--dimmer); flex: none; }
.status-lamp[data-state="recording"] {
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(192, 57, 43, .5);
  animation: pulse 1.6s ease-out infinite;
}
.status-lamp[data-state="paused"] { background: var(--amber-lit); }
.status-lamp[data-state="stopped"] { background: var(--ink); box-shadow: 0 0 0 3px var(--rule-soft); }

@keyframes pulse {
  70%  { box-shadow: 0 0 0 9px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

.status-text { color: var(--ink); }

.signal { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.signal-bars { display: flex; align-items: flex-end; gap: 2px; height: 13px; }
.signal-bars i { width: 3px; background: var(--rule); border-radius: 1px; display: block; }
.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 7px; }
.signal-bars i:nth-child(3) { height: 10px; }
.signal-bars i:nth-child(4) { height: 13px; }
.signal-bars[data-bars="1"] i:nth-child(-n+1),
.signal-bars[data-bars="2"] i:nth-child(-n+2),
.signal-bars[data-bars="3"] i:nth-child(-n+3),
.signal-bars[data-bars="4"] i:nth-child(-n+4) { background: var(--green); }

.signal-text { font-family: var(--mono); font-size: 11px; color: var(--dim); }

/* ------------------------------------------------- the odometer drum ---- */
.odo-block { display: flex; flex-direction: column; gap: 8px; }
.odo-caption { font-size: 10px; font-weight: 600; color: var(--dim); }

.odo {
  display: flex;
  gap: 3px;
  padding: 10px;
  background: var(--drum);
  border: 1px solid #0C131C;
  border-radius: var(--r-md);
  box-shadow: var(--lift-2);
  width: fit-content;
  max-width: 100%;
}

.odo-cell {
  position: relative;
  width: clamp(24px, 6.4vw, 34px);
  height: clamp(40px, 10vw, 52px);
  overflow: hidden;
  border-radius: 3px;
  background: linear-gradient(180deg, #0E151F 0%, #26364B 46%, #0B1119 100%);
}
.odo-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0) 36%, rgba(0,0,0,0) 60%, rgba(0,0,0,.55));
}
.odo-cell--tenth { background: linear-gradient(180deg, #6B4405 0%, #C98A16 46%, #5A390A 100%); }
.odo-cell--tenth .odo-strip { color: #FFF6E4; }

.odo-sep {
  align-self: flex-end;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--amber-lit);
  margin: 0 2px 8px;
  flex: none;
}

.odo-strip {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
  font-size: clamp(20px, 5vw, 27px);
  color: var(--drum-face);
  transition: transform .45s cubic-bezier(.3, .9, .35, 1);
  will-change: transform;
}
.odo-strip span {
  height: clamp(40px, 10vw, 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.odo-unit { font-family: var(--mono); font-size: 12px; color: var(--dim); }

/* ------------------------------------------------------------- gauges --- */
.gauges {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin: 0;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}

.gauge { background: var(--card-sunk); padding: 12px 14px; }
.gauge dt { font-size: 9.5px; color: var(--dim); font-weight: 600; }
.gauge dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* ----------------------------------------------------------- controls --- */
.controls { display: flex; gap: 10px; flex-wrap: wrap; }
.controls .btn { flex: 1 1 auto; }
.controls--secondary { margin-top: -10px; }
.controls--secondary .btn { flex: 0 1 auto; }

.note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--dim);
  border-left: 2px solid var(--rule);
  padding-left: 12px;
}

/* ================================================================ map === */
.panel--map { position: relative; min-height: 340px; }

#map { position: absolute; inset: 0; background: #E4E9EE; }

.leaflet-container { background: #E4E9EE; font-family: var(--display); }
.leaflet-control-attribution {
  background: rgba(255, 255, 255, .88) !important;
  color: var(--dim) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--ink-soft) !important; }
.leaflet-bar a {
  background: var(--card) !important;
  color: var(--ink) !important;
  border-color: var(--rule) !important;
}
.leaflet-bar a:hover { background: var(--card-sunk) !important; }
.leaflet-tooltip {
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--ink);
  box-shadow: var(--lift-2);
  font-size: 12px;
}

.map-recenter { position: absolute; right: 12px; bottom: 26px; z-index: 450; }

.map-overlay {
  position: absolute;
  left: 12px; right: 12px; top: 12px;
  z-index: 450;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--amber-lit);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--ink);
  box-shadow: var(--lift-2);
}

.me-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--amber-lit);
  border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 1px rgba(16,26,38,.25), 0 2px 6px rgba(16,26,38,.3);
}

/* ============================================================== sheet === */
.sheet {
  padding: clamp(22px, 3vw, 38px) var(--pad);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.sheet-title { font-size: 13px; color: var(--ink); }

.sheet-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sheet-tools input { width: min(280px, 60vw); }

/* -------------------------------------------------------------- tally --- */
.tally {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: var(--lift-1);
}

.tally-item { background: var(--card); padding: 12px 18px; flex: 1 1 140px; }
.tally-item span { display: block; font-size: 9.5px; color: var(--dim); font-weight: 600; }
.tally-item strong {
  display: block;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.tally-item--accent strong { color: var(--amber); }

/* ------------------------------------------------------------- table ---- */
.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--lift-1);
}

.log { width: 100%; border-collapse: collapse; min-width: 880px; }

.log thead th {
  text-align: left;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--dim);
  padding: 12px 14px 9px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  background: var(--card-sunk);
}

.log tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
  font-size: 13px;
}
.log tbody tr:last-child td { border-bottom: none; }
.log tbody tr { cursor: pointer; }
.log tbody tr:hover { background: var(--card-sunk); }
.log tbody tr.is-active { background: var(--amber-wash); box-shadow: inset 3px 0 0 var(--amber); }

.c-entry, .c-odo, .c-dist { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.c-entry { width: 46px; color: var(--dimmer); }
.c-date { width: 108px; font-family: var(--mono); white-space: nowrap; color: var(--ink-soft); }
.c-odo { width: 132px; white-space: nowrap; color: var(--dim); }
.c-dist { width: 98px; text-align: right; white-space: nowrap; }
.c-act { width: 96px; text-align: right; white-space: nowrap; }

.route { display: flex; flex-direction: column; gap: 3px; }
.route b { font-weight: 500; color: var(--ink); }
.route i { font-style: normal; color: var(--dim); font-size: 12px; display: flex; gap: 6px; }
.route i::before { content: '↳'; color: var(--dimmer); }

.tag {
  display: inline-block;
  font-size: 9.5px;
  font-stretch: 112%;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--dim);
  margin-right: 6px;
  vertical-align: 1px;
}
.tag--business { border-color: var(--amber-edge); color: var(--amber); background: var(--amber-wash); }
.tag--personal { border-color: var(--rule); color: var(--dim); background: var(--card-sunk); }

.flag { display: inline-block; font-size: 11px; color: var(--red); margin-top: 4px; }

.gps-mark { color: var(--green); font-size: 11px; font-family: var(--mono); }
.pin-mark { color: var(--dim); font-size: 11px; font-family: var(--mono); }

.empty { color: var(--dim); font-size: 13px; padding: 30px 0; text-align: center; }

/* ----------------------------------------------------------- vehicles --- */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.veh-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--lift-1);
}

.veh-head { display: flex; align-items: baseline; gap: 8px; }
.veh-head h3 { font-size: 15px; font-stretch: 112%; }
.veh-head .veh-sub { font-size: 12px; color: var(--dim); font-family: var(--mono); }
.veh-head .icon-btn { margin-left: auto; font-size: 12px; }

.veh-year-label { font-size: 9.5px; color: var(--dim); font-weight: 600; }
.veh-readings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.veh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  border-top: 1px solid var(--rule-soft);
  padding-top: 10px;
  font-size: 12px;
  color: var(--dim);
}
.veh-stats b { font-family: var(--mono); font-weight: 500; color: var(--ink); margin-left: 6px; }
.veh-stats .veh-share b { color: var(--amber); }

/* -------------------------------------------------------------- audit --- */
.audit {
  margin-top: 18px;
  border: 1px solid var(--amber-edge);
  border-left: 3px solid var(--amber-lit);
  border-radius: var(--r-sm);
  padding: 14px 18px;
  background: var(--amber-wash);
}
.audit h3 {
  font-size: 11px; font-stretch: 125%; text-transform: uppercase;
  letter-spacing: .09em; color: var(--ink-soft);
}
.audit ul { margin: 8px 0 0; padding-left: 18px; }
.audit li { font-size: 13px; margin-bottom: 5px; color: var(--ink-soft); }
.audit li::marker { color: var(--amber); }
.audit--clear { background: var(--green-wash); border-color: #BEDDD2; border-left-color: var(--green); }
.audit--clear li::marker { color: var(--green); }

/* ------------------------------------------------------------ account --- */
.account {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--lift-1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  font-size: 10px;
  font-weight: 600;
  font-stretch: 125%;
  text-transform: uppercase;
  letter-spacing: .085em;
  color: var(--dim);
}

.card-value {
  margin: 0;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  word-break: break-all;
}

.card-note { margin: 0; font-size: 12px; line-height: 1.55; color: var(--dim); }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* --------------------------------------------------------------- foot --- */
.foot {
  padding: 22px var(--pad) 40px;
  color: var(--dim);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.foot p { margin: 0; }

/* ============================================================== modal === */
.modal {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--ink);
  padding: 0;
  width: min(720px, 94vw);
  max-height: 92vh;
  box-shadow: var(--lift-3);
}
.modal::backdrop { background: rgba(16, 26, 38, .42); backdrop-filter: blur(2px); }

.modal-form { display: flex; flex-direction: column; max-height: 92vh; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
}
.modal-head h2 {
  font-size: 14px; font-stretch: 125%;
  text-transform: uppercase; letter-spacing: .09em;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--rule);
  background: var(--card-sunk);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.row { display: grid; gap: 14px; }
.row--2 { grid-template-columns: 1fr 1fr; }
.row--3 { grid-template-columns: repeat(3, 1fr); }

.reconcile, .gps-summary, .routed {
  margin: 0;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-soft);
  background: var(--card-sunk);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  padding: 9px 12px;
}
.reconcile[data-tone="warn"], .routed[data-tone="warn"] {
  color: #8A5200;
  background: var(--amber-wash);
  border-color: var(--amber-edge);
}

.routed { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.routed[hidden] { display: none; }
.routed-text { flex: 1 1 auto; min-width: 0; }
.routed .link-btn { font-family: var(--display); font-size: 11.5px; }

/* ============================================================== toasts == */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #F4F7FA;
  border: 1px solid #0A121C;
  border-left: 3px solid var(--amber-lit);
  border-radius: var(--r-sm);
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--lift-3);
  animation: rise .22s ease-out;
  max-width: 90vw;
}
.toast--bad { border-left-color: #E2705E; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================== gate ==== */
.gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% -10%, #FFFFFF 0%, var(--paper) 62%);
  overflow-y: auto;
}
.gate[hidden] { display: none; }

.gate-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 30px 28px 24px;
  box-shadow: var(--lift-3);
}

.gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule-soft);
}

.gate-title { font-size: 22px; font-stretch: 112%; letter-spacing: -.01em; margin-bottom: 6px; }
.gate-blurb { margin: 0 0 20px; font-size: 13px; line-height: 1.55; color: var(--dim); }

#authForm { display: flex; flex-direction: column; gap: 14px; }
.gate-submit { width: 100%; padding: 12px; margin-top: 4px; }

.gate-error {
  margin: 0;
  font-size: 12.5px;
  color: #8E2A1E;
  background: var(--red-wash);
  border: 1px solid #E4B6B0;
  border-radius: var(--r-sm);
  padding: 9px 12px;
}
.gate-error[hidden] { display: none; }

.gate-swap { margin: 18px 0 0; font-size: 12.5px; color: var(--dim); text-align: center; }

.app[hidden] { display: none; }

/* ------------------------------------------------------------ who am i -- */
.who {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--rule);
}

.who-email {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal--slim { width: min(420px, 94vw); }

/* ========================================================== responsive == */
@media (max-width: 900px) {
  .deck { grid-template-columns: 1fr; }
  .topbar { padding-bottom: 0; }
  .tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--rule);
    background: transparent;
    padding: 0;
    overflow-x: auto;
  }
  .tab { flex: 1; border-radius: 0; padding: 12px 8px; font-size: 10.5px; }
  .tab.is-on { box-shadow: inset 0 -2px 0 var(--amber); background: transparent; color: var(--amber); }
  .scope { gap: 10px; }
  .scope .field--inline { flex: 1 1 130px; min-width: 0; }
  .scope-note { display: none; }
  .account { grid-template-columns: 1fr; }
  .panel--map { min-height: 46vh; order: -1; }
  .row--2, .row--3 { grid-template-columns: 1fr; }
  .topbar { gap: 10px; }
  .topbar-controls { width: 100%; }
  .field--inline { flex: 1 1 92px; }
  .sheet-tools, .sheet-tools input { width: 100%; }
  .who {
    width: 100%;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--rule);
    padding-top: 10px;
  }
  .who-email { flex: 1; max-width: none; }
  .gate-card { padding: 24px 20px 20px; }
  .table-wrap { border-radius: var(--r-md); }
}

@media (prefers-reduced-motion: reduce) {
  .odo-strip { transition: none; }
  .status-lamp[data-state="recording"] { animation: none; }
  .toast { animation: none; }
  * { scroll-behavior: auto; }
}

/* ============================================================ guidance == */
.navbox {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--card-sunk);
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.navbox-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.navbox .controls { margin: 0; }
.navbox .controls .btn { flex: 1 1 auto; }
.navbox .field[hidden] { display: none; }

.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { width: 15px; height: 15px; accent-color: var(--amber); cursor: pointer; }
.switch span {
  font-size: 10px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
}
.switch input:disabled + span { opacity: .5; }

.warn-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #8A5200;
  background: var(--amber-wash);
  border: 1px solid var(--amber-edge);
  border-radius: var(--r-sm);
  padding: 9px 11px;
}
.warn-note[hidden] { display: none; }

/* ------------------------------------------------------ the turn banner -- */
.guide {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 460;
  background: var(--ink);
  color: #F4F7FA;
  border-radius: var(--r-md);
  box-shadow: var(--lift-3);
  overflow: hidden;
}
.guide[hidden] { display: none; }

.guide-main { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }

.guide-icon { flex: none; width: 42px; height: 42px; color: #FFC24D; }
.guide-icon svg { width: 100%; height: 100%; display: block; }

.guide-words { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.guide-when {
  font-size: 12px;
  font-weight: 700;
  font-stretch: 125%;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #FFC24D;
}

.guide-what {
  font-size: 18px;
  line-height: 1.25;
  font-stretch: 108%;
  overflow-wrap: anywhere;
}

.guide-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 12px;
  color: #A9B7C8;
}
.guide-then { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-eta { font-family: var(--mono); flex: none; }

.guide-status {
  padding: 8px 16px;
  background: #8A3D1E;
  color: #FFE6D6;
  font-size: 12px;
}
.guide-status[hidden] { display: none; }

@media (max-width: 900px) {
  .guide-what { font-size: 16px; }
  .guide-icon { width: 34px; height: 34px; }
}

/* ============================================================ offline === */
.netbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--pad);
  font-size: 12.5px;
  background: var(--amber-wash);
  border-bottom: 1px solid var(--amber-edge);
  color: #8A5200;
}
.netbar[hidden] { display: none; }
.netbar[data-state="offline"] { background: var(--red-wash); border-bottom-color: #E4B6B0; color: #8E2A1E; }

.netbar-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  flex: none;
}

.offline-estimate {
  margin: 0;
  font-size: 12px;
  font-family: var(--mono);
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--card-sunk);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  padding: 9px 11px;
}
.offline-estimate[data-tone="warn"] {
  color: #8A5200;
  background: var(--amber-wash);
  border-color: var(--amber-edge);
}

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

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--rule-soft);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--amber);
  transition: width .25s ease;
}
.progress-text { font-size: 11.5px; font-family: var(--mono); color: var(--dim); }

/* ========================================================== maps tab ==== */
.maps-grid {
  display: grid;
  grid-template-columns: minmax(320px, 460px) 1fr;
  gap: 14px;
  align-items: start;
}

.mode-list { display: flex; flex-direction: column; gap: 8px; }

.mode {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 11px 13px;
  cursor: pointer;
  background: var(--card);
  transition: border-color .12s ease, background .12s ease;
}
.mode:hover { border-color: #C2CCD8; }
.mode:has(input:checked) {
  border-color: var(--amber);
  background: var(--amber-wash);
}
.mode input { margin-top: 3px; accent-color: var(--amber); flex: none; }
.mode-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mode-body b { font-size: 13px; }
.mode-body span { font-size: 12px; line-height: 1.5; color: var(--dim); }
.mode:has(input:checked) .mode-body span { color: var(--ink-soft); }

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

.card--map { display: flex; flex-direction: column; gap: 10px; }

.mini-map {
  height: 420px;
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
  overflow: hidden;
  background: #E4E9EE;
}

@media (max-width: 900px) {
  .maps-grid { grid-template-columns: 1fr; }
  .mini-map { height: 300px; }
}

/* ===================================================== new components === */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips[hidden] { display: none; }
.chip {
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: border-color .12s ease, background .12s ease;
}
.chip:hover { border-color: var(--amber); background: var(--amber-wash); }

.place-list { display: flex; flex-direction: column; gap: 6px; }
.place-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 9px 12px;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  background: var(--card-sunk);
  font-size: 13px;
}
.place-kind {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--amber);
}
.place-addr { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-add { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.rate-table { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.rate-row {
  display: grid;
  grid-template-columns: 90px 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 7px 11px;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-family: var(--mono);
}
.rate-row b { text-transform: capitalize; font-family: var(--sans); }
.rate-val { font-weight: 600; }
.rate-add { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rate-add .btn { grid-column: 1 / -1; }

/* ------------------------------------------------ classification queue -- */
.queue {
  border: 1px solid var(--amber-edge);
  background: var(--amber-wash);
  border-radius: var(--r-md);
  padding: 14px 15px;
  margin-bottom: 14px;
}
.queue[hidden] { display: none; }
.queue-title { margin: 0 0 2px; font-size: 14px; }
.queue-count { color: var(--amber); }
.queue-hint { margin: 0 0 10px; font-size: 12px; color: var(--dim); }
.queue-cards { display: flex; flex-direction: column; gap: 8px; }

.qcard {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 11px 13px;
  touch-action: pan-y;
  transition: transform .14s ease, opacity .14s ease;
}
.qcard--right { transform: translateX(70%); opacity: 0; }
.qcard--left { transform: translateX(-70%); opacity: 0; }
.qcard-head { display: flex; justify-content: space-between; font-size: 13px; }
.qcard-dist { font-family: var(--mono); }
.qcard-route { font-size: 12.5px; color: var(--dim); margin: 3px 0 9px; overflow-wrap: anywhere; }
.qcard-flag {
  font-size: 11.5px; color: #8A5200;
  background: var(--amber-wash); border: 1px solid var(--amber-edge);
  border-radius: var(--r-sm); padding: 5px 9px; margin-bottom: 8px;
}
.qcard-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.qbtn {
  border: 1px solid var(--rule); background: var(--card-sunk);
  border-radius: var(--r-sm); padding: 8px 12px;
  font-size: 12px; cursor: pointer; min-height: 38px;
}
.qbtn--business { border-color: #BEDDD2; color: var(--green); background: var(--green-wash); }
.qbtn--commute { color: #8A5200; }

/* ----------------------------------------------------- odometer photos -- */
.veh-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.photo-slot { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.photo-slot img {
  width: 100%; max-height: 110px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--rule); cursor: zoom-in;
}
.photo-add { width: 100%; font-size: 12px; }

/* ======================================================= mobile first === */
/*
 * The person using this is a driver with a phone on a mount. Everything they
 * touch mid-trip must be reachable with a thumb and hittable with a glance:
 * tabs move to the bottom edge, recorder buttons grow to glove size, and
 * inputs hold 16px so iOS never zooms the page when one is focused.
 */
@media (max-width: 700px) {
  html { -webkit-text-size-adjust: 100%; }
  input, select, textarea { font-size: 16px !important; }
  .btn, .qbtn, .chip, .tab, .pin-btn { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

  /* tabs: bottom bar, safe-area aware */
  .tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 700;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--ink);
    border-top: none;
    box-shadow: 0 -4px 18px rgba(16, 26, 38, .25);
  }
  .tab {
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: #A9B7C8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    padding: 12px 2px;
    min-height: 48px;
  }
  .tab[aria-selected="true"] {
    background: rgba(255, 194, 77, .16);
    color: #FFC24D;
    box-shadow: none;
  }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* the recorder: glove-sized targets */
  .controls .btn { min-height: 56px; font-size: 16px; }
  .btn--record, .btn--stop { min-height: 62px; font-size: 17px; }
  .btn--manual { min-height: 52px; }
  .pin-btn { min-width: 58px; min-height: 44px; }

  .gauges { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .gauge dd { font-size: 15px; }
  .gauge dt { font-size: 8.5px; }

  #map { height: 320px; }
  .guide-what { font-size: 15px; }

  /* dialogs become sheets */
  dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .sheet { padding: 12px; }
  .sheet-head { flex-wrap: wrap; gap: 8px; }
  .maps-grid { grid-template-columns: 1fr; }
  .rate-add { grid-template-columns: 1fr; }
  .place-row { grid-template-columns: auto auto 1fr; }
  .place-row .link-btn { grid-column: 3; justify-self: end; }

  /* logbook table scrolls sideways instead of crushing */
  .log-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .log { min-width: 680px; }

  .scope { flex-wrap: wrap; }
  .netbar { font-size: 12px; }
}

/* very small phones */
@media (max-width: 380px) {
  .gauges { grid-template-columns: repeat(2, 1fr); }
  .qcard-actions .qbtn { flex: 1 1 40%; }
}

/* an odometer that can be corrected in place */
.gauge--tap { cursor: pointer; position: relative; }
.gauge--tap:hover { background: var(--amber-wash); }
.gauge--tap:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.gauge-edit {
  font-size: 8px;
  letter-spacing: .1em;
  color: var(--amber);
  border: 1px solid var(--amber-edge);
  border-radius: 999px;
  padding: 1px 5px;
  margin-left: 4px;
}

/* ======================================================= stage and dock ==
 * The map is the backdrop of the whole app. Everything else lives in the
 * dock: on desktop a permanent right-hand third showing whichever tab is
 * active, on phones an overlay that slides over the map. Both are positioned
 * against --chrome-h, the measured height of whatever is above them (the tab
 * bar, plus the offline strip when it appears), because that height changes.
 */

html, body { height: 100%; }
body { overflow: hidden; }               /* the dock scrolls, the page does not */

.stage {
  position: fixed;
  top: var(--chrome-h, 60px);
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  background: var(--card-sunk);
}
.stage #map { height: 100%; width: 100%; border-radius: 0; border: 0; }

.map-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 450;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(6px);
  box-shadow: var(--lift-2);
  font-size: 11px;
  max-width: calc(100% - 20px);
  cursor: pointer;
}
.map-chip:hover { background: #fff; }
.map-chip .status-text { font-size: 10.5px; letter-spacing: .06em; white-space: nowrap; }

.map-recenter { bottom: auto; top: 10px; right: 10px; z-index: 450; }
.guide { top: 54px; }

.dock {
  position: fixed;
  top: var(--chrome-h, 60px);
  bottom: 0;
  right: 0;
  z-index: 600;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  box-shadow: -8px 0 28px rgba(16, 26, 38, .12);
}
body.map-only .dock { display: none; }    /* the map, and nothing else */

/* Drive supplies its own vehicle picker, so the scope row is redundant there
   and would only push the content down. */
body[data-tab="drive"] .scope { display: none; }

/* The old page footer has no place in a fixed layout. */
.foot { display: none; }

/* The drive sheet stops being a floating sheet: it is simply the Drive tab's
 * content inside the dock. Its old open/closed positioning must not apply. */
#driveSheet {
  position: static;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.drive-vehicle { flex-direction: row; align-items: center; gap: 10px; }
.drive-vehicle select { flex: 1; }


/* ------------------------------------------------------------- desktop -- */
@media (min-width: 901px) {
  .dock { width: 33.333%; min-width: 380px; padding: 0 18px 18px; }
  .stage { right: max(33.333%, 380px); }   /* map keeps the other two thirds */

  /* Panels were designed for a full page; in a third they stack. */
  .dock .deck, .dock .cols { display: flex; flex-direction: column; }
  body[data-tab="drive"] .scope { display: none; }
  .dock .log-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dock .log { min-width: 640px; }         /* the table scrolls sideways in a third */
  .dock .tabpanel { padding-left: 0; padding-right: 0; }
  .scope { position: sticky; top: 0; z-index: 5; }
}

/* -------------------------------------------------------------- phones -- */
@media (max-width: 900px) {
  /* The tab bar IS the top nav: no logo, five tabs across the top. */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 700;
    display: block;
    padding: 0;
    background: var(--ink);
    box-shadow: 0 4px 18px rgba(16, 26, 38, .25);
  }
  .brand { display: none; }
  .tabs {
    position: static;                      /* overrides the old bottom bar */
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-top) * 0);
    background: transparent;
    box-shadow: none;
  }
  body { padding-bottom: 0; }              /* no bottom bar to clear any more */

  /* The dock covers the map edge-to-edge when a tab's content is open. */
  .dock {
    left: 0;
    width: auto;
    border-left: 0;
    padding: 0 12px 12px;
    box-shadow: none;
  }

  /* Drive behaves like every other tab: one overlay, starting directly under
     the tab nav, covering the map completely. Nothing floats separately. */
  #driveSheet .odo { transform: scale(.86); transform-origin: center; }
  #driveSheet .gauges { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 380px) {
    }

/* ===================================================== the recorder bar ==
 * Start, Pause and Stop belong to the trip, not to a tab: a trip keeps
 * running whatever you are looking at. So they live along the bottom edge,
 * over the map, with the running figures small above them — the tabs at the
 * top, the controls at the bottom, and the map filling everything between.
 */
.drivebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 650;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -4px 18px rgba(16, 26, 38, .14);
}

.drivebar-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
}
.drivebar-stat { display: flex; align-items: baseline; gap: 3px; }
.drivebar-stat b { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.drivebar-stat i {
  font-style: normal;
  font-size: 8px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dim);
}

.drivebar-controls { display: flex; gap: 6px; }
.drivebar-controls .btn {
  flex: 1 1 0;
  min-height: 38px;
  padding: 0 6px;
  font-size: 12px;
  letter-spacing: .05em;
}

/* Desktop: the bar tucks under the dock, so the map keeps its two thirds
   uninterrupted and the controls stay beside the tab content. */
@media (min-width: 901px) {
  .drivebar {
    left: auto;
    width: 33.333%;
    min-width: 380px;
    border-left: 1px solid var(--rule);
  }
}

/* The stage runs under the bar; the dock stops above it. */
.dock { bottom: var(--bar-h, 62px); }

/* The return leg is the third option after a stop, not a variant of Log. */
.btn--return { border-color: var(--amber-edge); color: #8A5200; background: var(--amber-wash); }
.btn--return:disabled { background: var(--card-sunk); color: var(--dim); border-color: var(--rule); }
