/* MotoMic app. Colours are tokens. Dark is the classic dashboard's look
   (near-black, orange accent, glass cards over two soft glows); light is the
   same design by day. Both follow the system unless the person picked one in
   the top bar (html[data-theme]). */
:root {
  --bg: #f3f4f7; --glow1: rgba(249,115,22,.10); --glow2: rgba(14,165,233,.08);
  --surface: rgba(255,255,255,.80); --surface-solid: #ffffff; --surface-2: rgba(15,23,42,.05);
  --input-bg: #ffffff; --side-bg: rgba(255,255,255,.78); --top-bg: rgba(243,244,247,.78);
  --fg: #111827; --muted: #5b6472; --line: rgba(15,23,42,.10); --line-strong: rgba(15,23,42,.20);
  --accent: #ea580c; --accent-ink: #c2410c; --accent-fg: #ffffff; --accent-glow: rgba(234,88,12,.12);
  --danger: #b42318; --danger-bg: #fdecea; --ok: #067647; --ok-bg: #e6f6ee; --warn-bg: #fff4e0;
  --c-orange: #ea580c; --c-green: #059669; --c-blue: #2563eb; --c-purple: #7c3aed; --c-red: #dc2626; --c-sky: #0284c7;
  --radius: 14px; --shadow: 0 6px 20px rgba(15,23,42,.06); --shadow-lg: 0 16px 40px rgba(15,23,42,.14);
  --inset: inset 0 1px 0 rgba(255,255,255,.6);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c12; --glow1: rgba(249,115,22,.14); --glow2: rgba(56,189,248,.12);
    --surface: rgba(255,255,255,.04); --surface-solid: #141a26; --surface-2: rgba(255,255,255,.06);
    --input-bg: rgba(0,0,0,.28); --side-bg: rgba(12,15,23,.72); --top-bg: rgba(10,12,18,.72);
    --fg: #f3f4f6; --muted: #9aa4b2; --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
    --accent: #f97316; --accent-ink: #fb923c; --accent-fg: #0a0c12; --accent-glow: rgba(249,115,22,.15);
    --danger: #ff8a80; --danger-bg: rgba(239,68,68,.14); --ok: #34d399; --ok-bg: rgba(16,185,129,.14); --warn-bg: rgba(245,158,11,.14);
    --c-orange: #f97316; --c-green: #10b981; --c-blue: #3b82f6; --c-purple: #8b5cf6; --c-red: #ef4444; --c-sky: #0ea5e9;
    --shadow: 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 16px 40px rgba(0,0,0,.5); --inset: inset 0 1px 0 rgba(255,255,255,.04);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0c12; --glow1: rgba(249,115,22,.14); --glow2: rgba(56,189,248,.12);
  --surface: rgba(255,255,255,.04); --surface-solid: #141a26; --surface-2: rgba(255,255,255,.06);
  --input-bg: rgba(0,0,0,.28); --side-bg: rgba(12,15,23,.72); --top-bg: rgba(10,12,18,.72);
  --fg: #f3f4f6; --muted: #9aa4b2; --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
  --accent: #f97316; --accent-ink: #fb923c; --accent-fg: #0a0c12; --accent-glow: rgba(249,115,22,.15);
  --danger: #ff8a80; --danger-bg: rgba(239,68,68,.14); --ok: #34d399; --ok-bg: rgba(16,185,129,.14); --warn-bg: rgba(245,158,11,.14);
  --c-orange: #f97316; --c-green: #10b981; --c-blue: #3b82f6; --c-purple: #8b5cf6; --c-red: #ef4444; --c-sky: #0ea5e9;
  --shadow: 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 16px 40px rgba(0,0,0,.5); --inset: inset 0 1px 0 rgba(255,255,255,.04);
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* `hidden` is only a user-agent display:none: any author rule that sets
   display on the element beats it (the classic's save bar sat on screen
   for exactly this reason). The attribute wins, always. */
[hidden] { display: none !important; }
html, body { margin: 0; color: var(--fg); background-color: var(--bg); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; min-height: 100vh;
  background-image: radial-gradient(1200px 600px at 80% -10%, var(--glow1), transparent 60%), radial-gradient(900px 500px at -10% 110%, var(--glow2), transparent 60%);
  background-attachment: fixed; }
a { color: var(--accent-ink); }
h1 { font-size: 22px; margin: 0; letter-spacing: -.2px; } h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.boot { height: 3px; background: linear-gradient(90deg, var(--accent), transparent); animation: boot 1s infinite; }
@keyframes boot { from { opacity: .2 } to { opacity: 1 } }
.ico { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- shell: sidebar + top bar */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 16px; padding: 20px 14px; overflow-y: auto; z-index: 1200;
  background: var(--side-bg); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--fg); text-decoration: none; padding: 0 6px; }
.logo { display: inline-flex; padding: 7px; border-radius: 10px; background: var(--accent-glow); color: var(--accent); }
.logo .ico { width: 20px; height: 20px; }
.account-name { color: var(--muted); font-size: 13px; padding: 0 8px; }
select.account { margin: 0 4px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; border-left: 3px solid transparent; }
.nav:hover { color: var(--fg); background: var(--surface-2); }
.nav.active { color: var(--fg); background: var(--accent-glow); border-left-color: var(--accent); }
.nav.active .ico { color: var(--accent); }
.side-foot { margin-top: auto; }
.frame { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; gap: 10px; padding: 10px 24px; /* above Leaflet's controls (1000) */
  background: var(--top-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-title { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--fg); padding: 0; width: 40px; min-height: 40px; border-radius: 10px; }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
select.lang { width: auto; padding: 8px 6px; min-height: 40px; font-weight: 600; font-size: 13px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); min-height: 40px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 14px; flex: none; }
.user-text { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 600; font-size: 13px; } .user-role { font-size: 11px; color: var(--muted); }
.caret { width: 16px; height: 16px; color: var(--muted); }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; display: flex; flex-direction: column; padding: 6px; z-index: 1300;
  background: var(--surface-solid); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.menu a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.menu a:hover, .menu a.active { background: var(--surface-2); }
button.logout { color: var(--muted); border-color: var(--line); }
button.logout:hover { color: var(--danger); border-color: var(--danger); }
.scrim { display: none; }
.banner { margin: 12px 24px 0; }
.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 22px 24px 48px; outline: none; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
.back { text-decoration: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  /* Closed: off screen AND hidden, so neither Tab nor a screen reader lands in it. */
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; background: var(--surface-solid); }
  .app.nav-open .side { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1150; }
  .menu-btn { display: inline-flex; }
  .top { padding: 8px 12px; gap: 8px; }
  .top-tools { gap: 6px; }
  .user-text, .caret { display: none; }
  .user-menu summary { padding: 4px; }
  button.logout { width: 40px; padding: 0; }
  button.logout span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .banner { margin: 10px 12px 0; }
}

/* ---- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow), var(--inset);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
section.card { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.narrow { max-width: 520px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack > button, .stack > .button { align-self: flex-start; }
.auth .stack > button, .auth .stack > .button { align-self: stretch; }
.empty { color: var(--muted); margin: 6px 0; }

/* ---- controls */
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 14px; }
label.row { flex-direction: row; align-items: center; justify-content: space-between; font-weight: 400; }
input, select, textarea { font: inherit; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--input-bg); color: var(--fg); min-width: 0; }
option { background: var(--surface-solid); color: var(--fg); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; text-decoration: none; min-height: 40px; transition: box-shadow .2s, background .2s; }
button:not(.ghost):not(.danger):not(.link):not(.chip):not(.icon-btn):hover { box-shadow: 0 0 20px var(--accent-glow); }
button:disabled { opacity: .5; cursor: default; }
.ghost { background: transparent; color: var(--accent-ink); }
.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.link { background: none; border: none; color: var(--accent-ink); padding: 4px 6px; min-height: 0; }
.link.danger { color: var(--danger); }
.small { font-size: 13px; } button.small { padding: 5px 10px; min-height: 32px; }
.block { width: 100%; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 6px; }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.note { padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); margin: 8px 0; }
.note.error { background: var(--danger-bg); color: var(--danger); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.upgrade { background: var(--surface-2); }
.msg.err { color: var(--danger); }

/* ---- tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--muted); font-weight: 600; font-size: 13px; }
table.plans td:not(:first-child), table.plans th:not(:first-child) { text-align: center; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 10px 0 0; font-size: 14px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
ul.plain, ul.events { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.events li { margin-bottom: 10px; } ul.events li.unread { border-left: 3px solid var(--accent); }
ul.events li.staff { border-left-color: var(--danger); } ul.events p { margin: 6px 0 0; }

/* ---- fleet */
.fleet { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.map { height: 460px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.map.small { height: 240px; }
.vehicles { display: grid; gap: 10px; }
.vehicle { display: block; text-decoration: none; color: var(--fg); }
.vehicle:hover { border-color: var(--accent); }
.vehicle-head { display: flex; align-items: center; gap: 8px; }
.kind { font-size: 20px; }

/* ---- auth */
.auth { max-width: 400px; margin: 10vh auto; }
.auth.wide { max-width: 560px; }
.auth h1 { margin-bottom: 4px; }
.secret, .codes { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; letter-spacing: 1px; padding: 10px; background: var(--surface-2); border-radius: 8px; word-break: break-all; margin: 6px 0; }
.steps { padding-left: 20px; } .steps li { margin: 8px 0; }

/* ---- dialogs, toast */
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-solid); color: var(--fg); padding: 18px; width: min(460px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(0,0,0,.45); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 10px; pointer-events: none; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); } #toast.error { background: var(--danger); color: #fff; }

/* ---- phone */
@media (max-width: 760px) {
  .fleet { grid-template-columns: 1fr; }
  .map { height: 300px; }
  table.list th:nth-child(n+4):not(:last-child), table.list td:nth-child(n+4):not(:last-child) { display: none; }
  .page { padding: 16px 12px 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- a vehicle's pages */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: -4px 0 14px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab { font-weight: 600; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.map { height: 360px; border-radius: 10px; overflow: hidden; }
.map.small { height: 260px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.big { font-size: 22px; }
.nowrap { white-space: nowrap; }

/* ride */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow), var(--inset);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.tile.warn { background: var(--warn-bg); }
.tile-k { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; } .tile-v { font-size: 19px; font-weight: 800; } .tile-d { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { min-height: 32px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.scrub-readout { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.chart-row-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.chart-row-val { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-svg { display: block; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 10px; }
.chart-cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hit { cursor: crosshair; }
input[type=range] { flex: 1; min-width: 160px; padding: 0; }

/* maintenance, logs, sms, tracker */
ul.items, ul.sms { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.item-main { flex: 1; min-width: 200px; }
.logview { max-height: 420px; overflow: auto; background: var(--surface-2); padding: 10px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
ul.sms li { padding: 8px 10px; border-radius: 10px; margin: 6px 0; max-width: 560px; background: var(--surface-2); }
ul.sms li.out { margin-left: auto; background: var(--ok-bg); }
ul.sms li p { margin: 2px 0 0; white-space: pre-wrap; }
.field { display: flex; flex-direction: column; gap: 2px; }
.cmd { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cmd p { margin: 2px 0 0; }
dialog.modal textarea { width: 100%; }
.settings { max-width: 520px; }
.settings input[type=number] { max-width: 200px; }

/* ---- live widgets (pages/live.js, widgets.js) */
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: minmax(96px, auto); gap: 12px; margin-bottom: 14px; }
.w { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: transform .25s cubic-bezier(.4,0,.2,1), border-color .25s; min-width: 0; }
.w:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.w.tall { grid-row: span 2; align-items: stretch; }
.w-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px; }
.w-icon .ico { width: 22px; height: 22px; }
.tone-orange { background: color-mix(in srgb, var(--c-orange) 12%, transparent); color: var(--c-orange); }
.tone-green { background: color-mix(in srgb, var(--c-green) 12%, transparent); color: var(--c-green); }
.tone-blue { background: color-mix(in srgb, var(--c-blue) 12%, transparent); color: var(--c-blue); }
.tone-purple { background: color-mix(in srgb, var(--c-purple) 12%, transparent); color: var(--c-purple); }
.tone-red { background: color-mix(in srgb, var(--c-red) 12%, transparent); color: var(--c-red); }
.w-data { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.w-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.w-value { font-size: 21px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.w-value small { font-size: 12px; font-weight: 600; color: var(--muted); }
.w-value.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .5px; }
.w-value.small-value { font-size: 16px; }
.w-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; min-height: 1em; }
.st-ok { color: var(--c-green); } .st-bad { color: var(--c-red); } .st-warn { color: var(--c-orange); } .st-hot { color: var(--accent); }
/* gauges: the figure is in the drawing; the text value stays for screen readers */
.w.is-gauge { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 12px; }
.w.is-gauge .w-data { order: -1; }
.w.is-gauge .w-value { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.w-gauge { display: flex; justify-content: center; }
svg.gauge { width: 100%; max-width: 190px; height: auto; }
.gauge-track { fill: none; stroke: var(--line-strong); stroke-width: 9; stroke-linecap: round; }
.gauge-val { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .4s; }
.gauge-peak { fill: none; stroke: var(--fg); stroke-width: 13; opacity: .55; }
.gauge-num { fill: var(--fg); font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gauge-unit { fill: var(--muted); font-size: 9px; font-weight: 600; }
.w.is-gauge .w-sub { text-align: center; }
/* battery, signal */
svg.batt { width: 46px; height: 24px; }
.batt-shell { stroke: var(--muted); } .batt-tip { fill: var(--muted); }
.batt-fill.lvl-ok { fill: var(--c-green); } .batt-fill.lvl-mid { fill: var(--c-orange); } .batt-fill.lvl-low { fill: var(--c-red); }
.batt-bolt { fill: var(--fg); opacity: 0; } .batt-bolt.on { opacity: .9; }
svg.sig { width: 36px; height: 26px; }
.sig-bar { fill: var(--line-strong); } .sig-bar.on { fill: var(--c-blue); }
/* lean */
.lean-box { display: flex; align-items: center; gap: 16px; flex: 1; margin-top: 8px; flex-wrap: wrap; }
svg.lean-svg { width: 120px; height: 120px; flex: none; }
.lean-ring { stroke: var(--line-strong); }
.bike-stroke { stroke: var(--accent); } .bike-fill { fill: var(--accent); }
.bike-g { transform-origin: 50px 50px; transition: transform .3s ease-out; }
.lean-vals { display: flex; flex-direction: column; gap: 10px; }
.lean-vals > div { display: flex; flex-direction: column; }
/* customising */
.w-tools { display: none; position: absolute; top: 6px; left: 8px; right: 6px; justify-content: space-between; align-items: center; z-index: 2; }
.wgrid.customizing .w-tools { display: flex; }
.wgrid.customizing .w { border-style: dashed; padding-top: 34px; }
.wgrid.customizing .w:hover { transform: none; }
.wgrid.customizing .w.user-hidden { opacity: .4; }
.w-handle { cursor: grab; color: var(--muted); display: inline-flex; padding: 4px; touch-action: none; }
.w-tool { background: transparent; border: none; color: var(--muted); padding: 4px; min-height: 0; }
.w-tool:hover { color: var(--fg); }
.w-ghost { opacity: .35; }
@media (max-width: 760px) { table.list.rides th:nth-child(4):not(:last-child), table.list.rides td:nth-child(4):not(:last-child) { display: table-cell; } }
@media (max-width: 560px) { .wgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .w { padding: 12px; gap: 10px; } .w-icon { width: 38px; height: 38px; }
  .w.tall { grid-column: span 2; grid-row: span 1; } .w-value { font-size: 18px; } }

/* ---- ride comparison */
.table-wrap { overflow-x: auto; }
table.compare td, table.compare th { white-space: nowrap; }
table.compare tbody th { color: var(--muted); font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot[data-k="0"] { background: #f97316; } .dot[data-k="1"] { background: #0ea5e9; }
td.pick { width: 36px; }
td.pick input { width: 18px; height: 18px; }
.chart-row { margin-bottom: 10px; }

/* ---- a vehicle's settings (pages/vset.js): panes on the left, one save bar */
.vset { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.vset-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 4px; }
.vset-tab { justify-content: flex-start; background: transparent; border: 1px solid transparent; color: var(--muted); font-weight: 600; border-left: 3px solid transparent; border-radius: 10px; }
.vset-tab:hover { background: var(--surface-2); color: var(--fg); }
.vset-tab[aria-current="page"] { background: var(--accent-glow); color: var(--fg); border-left-color: var(--accent); }
.vset-title { font-size: 20px; margin-bottom: 4px; }
.vset-intro { margin: 0 0 12px; max-width: 760px; }
.vset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.vset-sec { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.vset-sec h3 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.vset-field { display: flex; flex-direction: column; gap: 6px; }
.vset-field > label { font-weight: 500; }
.vset-label { font-weight: 500; font-size: 14px; }
.vset-readout { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.toggle-row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
.toggle-row .vset-label { flex: 1; min-width: 180px; }
.toggle-row .vset-info { flex-basis: 100%; }
.vset-info { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--fg); line-height: 1.45; }
.info-btn { background: transparent; border: none; color: var(--accent-ink); padding: 0 4px; min-height: 0; font-size: 15px; font-weight: 400; vertical-align: baseline; }
.vset-adv summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.vset-adv[open] { display: flex; flex-direction: column; gap: 14px; }
.range-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; gap: 8px; }
input[type=range] { accent-color: var(--accent); }
/* the classic's switch */
.switch { position: relative; display: inline-flex; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .slider { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch .slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: .5; }
.savebar { position: sticky; bottom: 12px; z-index: 1050; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--accent); box-shadow: var(--shadow-lg); font-weight: 600; }
@media (max-width: 900px) {
  .vset { grid-template-columns: 1fr; }
  .vset-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .vset-tab { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; border-radius: 8px; }
  .vset-tab[aria-current="page"] { border-bottom-color: var(--accent); }
  .vset-grid { grid-template-columns: 1fr; }
}

/* ---- logs (the classic's table) */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 8px 0 12px; }
.filter-bar label { flex: 1 1 140px; font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-bar button { flex: none; }
table.logs td { font-size: 13px; }
table.logs td.details { max-width: 420px; overflow-wrap: anywhere; }
.lvl { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.lvl-error { background: var(--danger-bg); color: var(--danger); }
.lvl-warn { background: var(--warn-bg); color: var(--c-orange); }
.lvl-debug { opacity: .7; }
.src-tag { font-size: 12px; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
tr.log-error td:first-child { box-shadow: inset 3px 0 0 var(--c-red); }
tr.log-warn td:first-child { box-shadow: inset 3px 0 0 var(--c-orange); }
pre.raw-json { margin: 6px 0 0; padding: 8px; border-radius: 8px; background: var(--surface-2); font-size: 11.5px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.pager { justify-content: flex-end; margin-top: 10px; }
.chip[role="switch"][aria-checked="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
@media (max-width: 760px) {
  table.list.logs th:nth-child(4):not(:last-child), table.list.logs td:nth-child(4):not(:last-child) { display: table-cell; }
  table.list.logs th:nth-child(3), table.list.logs td:nth-child(3) { display: none; }
}
td.sms-body { max-width: 380px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) { table.list.smslog th:nth-child(4):not(:last-child), table.list.smslog td:nth-child(4):not(:last-child) { display: table-cell; }
  table.list.smslog th:nth-child(3), table.list.smslog td:nth-child(3) { display: none; } }

/* ---- ride list (the classic History) */
.rides-filter { margin-bottom: 6px; }
.rides-filter .chips { margin: 0; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.inline input, label.inline select { padding: 6px 8px; }
.rides-summary { margin: 6px 0 10px; font-weight: 600; min-height: 1.4em; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.selected td { background: var(--accent-glow); }
.ride-title { font-weight: 700; }
td.row-actions { white-space: nowrap; text-align: right; }

/* ---- records (the classic's Records & Personal Bests) */
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.record-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
a.record-tile:hover { border-color: var(--accent); }
.record-icon { font-size: 20px; }
.record-val { font-size: 22px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.record-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.record-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
tr.unack td:first-child { box-shadow: inset 3px 0 0 var(--c-red); }
.autoack { margin-bottom: 12px; }

/* ---- Live: the classic dashboard's extras */
.actions-bar { margin: 0 0 12px; }
.sim-notice div { margin-top: 4px; white-space: pre-wrap; }
.last-ride { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow), var(--inset); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.last-ride-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.last-ride-when { font-weight: 600; margin: 4px 0 6px; }
.last-ride-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; }
.last-ride-stats b { color: var(--fg); font-size: 16px; }
.map.map-dark .leaflet-tile { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); }
.coords { margin: 8px 0 0; font-variant-numeric: tabular-nums; }

/* ---- invitations */
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0; }
h3.subhead { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 18px 0 4px; }
.invite-pick { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.note.ok .row input { flex: 1; min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
img.qr { display: block; width: 220px; height: 220px; margin: 10px 0; border-radius: 12px; background: #fff; padding: 6px; }

/* ---- vehicles in the sidebar */
.side-vehicles { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 20px; padding-left: 10px; border-left: 1px solid var(--line); }
.side-search { margin: 4px 0; padding: 6px 8px; font-size: 13px; min-height: 0; }
.side-results { display: flex; flex-direction: column; gap: 1px; }
.side-vehicle { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; overflow: hidden; }
.side-vehicle span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-vehicle:hover { background: var(--surface-2); color: var(--fg); }
.side-vehicle.active { color: var(--fg); background: var(--accent-glow); }
.side-vehicle .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-green); flex: none; }
.side-vehicle .dot.alert { background: var(--c-red); }
.side-none { padding: 4px 8px; }

/* ---- invitations waiting for this person */
.invites-banner { margin: 12px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.invite-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-glow); border: 1px solid var(--accent); }
.invite-icon { color: var(--accent); display: inline-flex; }
.invite-text { flex: 1; min-width: 200px; font-weight: 600; }
@media (max-width: 900px) { .invites-banner { margin: 10px 12px 0; } }
.api-endpoint { padding: 10px 0; border-bottom: 1px solid var(--line); }
.api-endpoint p { margin: 4px 0; }
pre.api-code { max-height: none; white-space: pre-wrap; }
.toggle-line { flex-direction: row; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; }
.toggle-line > span:last-child { flex: 1; }
.plan-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-glow); color: var(--accent-ink); text-decoration: none; white-space: nowrap; }

/* A firmware update's progress (otaProgress.js) - the classic dashboard's bar. */
.ota-progress { margin: 10px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2, transparent); }
.ota-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ota-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ota-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s ease; }
.ota-progress.bad .ota-fill { background: var(--danger); }
.ota-progress.good .ota-fill { background: var(--ok); }
.ota-progress p { margin: 8px 0 0; }

/* Plans: monthly / yearly switch, and what a year saves. */
.segmented { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.segmented button { border-radius: 999px; }
.segmented button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.plans .save { font-size: 11px; font-weight: 700; color: var(--ok); }
