/* Vigil dashboard, in the same visual system as getvigil.co.za (its DESIGN.md): navy by default, light on request
   (html[data-theme], set by theme.js and the sidebar toggle), Manrope throughout. A working tool, so denser than the
   site: sections are split by rules, the figures sit in one rounded panel. Three signal roles, as on the site:
   green for actions and all clear, amber while Vigil is asking, orange for what needs a look (a fault, an escalated
   trip, a value above 2x). Everything else is ink and the navy greys. No gradients, glows or pulsing.

   1. tokens (charcoal, light)        5. shell and sidebar
   2. base type                       6. sections, figures, tables
   3. controls and forms              7. notices and the Notifications timeline
   4. sign-in                         8. overview map, vehicle masthead, page parts
                                      9. phone layout */

/* ---- 1. tokens ---- */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root, :root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0b1220;                  /* the site's ground */
  --raised: #131d31;              /* panels, hover, selected rows */
  --raised-2: #1a263d;
  --ink: #f4f7fb;
  --muted: #a9b6c9;               /* 9:1 on --bg */
  --rule: #33445f;                /* the 2px rule above a section */
  --line: #24324c;                /* 1px lines between rows */
  --edge: #3b4d6e;                /* borders of controls, 3:1 against --bg */
  --signal: #ff6a2b;              /* needs a look: a fault, an escalated trip, a value above 2x */
  --signal-text: #ff8a57;         /* small text in the signal colour */
  --signal-soft: rgba(255, 106, 43, 0.14);
  --ask: #f5b13d;                 /* Vigil is asking */
  --ask-soft: rgba(245, 177, 61, 0.14);
  --go: #22c55e;                  /* actions and all clear */
  --go-hi: #4ade80;
  --go-ink: #052e16;              /* text on a green fill */
  --on-ink: #0b1220;              /* text on an ink fill */
  --map-bg: #0c1424;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f6f8fb;
  --raised: #ffffff;
  --raised-2: #eef2f7;
  --ink: #0b1220;
  --muted: #475569;               /* 7:1 on --bg */
  --rule: #c3cddb;
  --line: #dde3ec;
  --edge: #8794a8;
  --signal: #e0561f;
  --signal-text: #b8430f;         /* 5.6:1 on white */
  --signal-soft: rgba(224, 86, 31, 0.10);
  --ask: #b7791f;
  --ask-soft: rgba(183, 121, 31, 0.12);
  --go: #16a34a;
  --go-hi: #15803d;
  --go-ink: #ffffff;
  --on-ink: #ffffff;
  --map-bg: #eef2f7;
  --shadow: 0 12px 28px -16px rgba(11, 18, 32, 0.25), 0 2px 6px -2px rgba(11, 18, 32, 0.08);
}
:root {
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --narrow: var(--sans);          /* one face, as on the site; weight does the work the narrow face did */
  --mono: var(--sans);            /* figures stay aligned with tabular numerals instead of a monospace */
  --radius: 10px;
  --radius-lg: 16px;
  font: 15px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--go); color: var(--go-ink); }

/* ---- 2. base type ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--edge); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--go-hi); outline-offset: 2px; border-radius: 6px; }
h1 { font: 800 30px/1.15 var(--sans); letter-spacing: -.025em; margin: 0 0 6px; }
h2 { font: 700 17px/1.3 var(--sans); letter-spacing: -.01em; margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 28px; max-width: 78ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono, .plate, .when, .speed, .at, .dates, .code, td.value, td.cargo { font-family: var(--mono); }
.when, .speed, .at, .dates { font-size: 14px; }
.label, th, .card .k, nav.side .section, .day-head, .badge {
  font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: 0; }

/* ---- 3. controls and forms ---- */
label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 14px; }
label > input, label > select { margin-top: 6px; }
input, select { width: 100%; padding: 11px 13px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--map-bg);
  color: var(--ink); font: inherit; }
input::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--go); box-shadow: 0 0 0 3px rgba(34, 197, 94, .22); }
input[type=checkbox] { width: auto; margin-right: 8px; accent-color: var(--go); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background: var(--map-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237f8ea6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; }
select[multiple] { background-image: none; padding-right: 11px; }
td select { padding-right: 30px; background-position: right 10px center; }
/* settings switches, square like the sidebar's mode toggle: an outlined track and an ink knob; on, the knob moves
   across and the track's edge turns ink */
input.toggle { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--raised-2);
  border: 1px solid var(--edge); position: relative; cursor: pointer; margin: 0; padding: 0; vertical-align: middle; flex: none; }
input.toggle::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); transition: left .15s cubic-bezier(.16,1,.3,1); }
input.toggle:hover { border-color: var(--ink); }
input.toggle:checked { border-color: var(--go); background: var(--go); }
input.toggle:checked::before { left: 16px; background: var(--go-ink); }
input.toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input.money { max-width: 170px; font-size: 14px; }
td input.money { min-width: 154px; }  /* room for "R 250 000 default" */
table.vehicles td.model { min-width: 170px; }
table.vehicles td, table.vehicles th { padding-left: 8px; padding-right: 8px; }
label > input.money { display: block; }
.check { display: flex; align-items: center; color: var(--ink); font-size: 14px; }
button.primary, button.ghost, button.danger { font: 700 14px/1.3 var(--sans); border-radius: var(--radius); padding: 10px 18px; cursor: pointer;
  border: 1px solid transparent; transition: background-color .2s, border-color .2s; }
button.primary { background: var(--go); color: var(--go-ink); border-color: var(--go); }
button.primary:hover { background: var(--go-hi); border-color: var(--go-hi); }
button.primary:disabled { opacity: .5; cursor: default; }
button.ghost, button.danger { background: none; border-color: var(--edge); color: var(--ink); }
button.ghost:hover, button.danger:hover { border-color: var(--ink); background: var(--raised); }
button:disabled { cursor: default; opacity: .6; }
.wide { width: 100%; }
main .wide { width: auto; min-width: 180px; }  /* full width only on the sign-in box */
.actions { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.error { color: var(--signal-text); font-size: 14px; margin: 0 0 12px; }
.ok { color: var(--ink); font-size: 14px; margin: 0 0 12px; }
.help { font-size: 14px; color: var(--muted); margin-top: 4px; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--edge); text-underline-offset: 3px; }
button.link:hover { text-decoration-color: currentColor; }
button.link::after { content: " ›"; }
.code { font-size: 18px; letter-spacing: 1px; background: var(--map-bg); border: 1px dashed var(--edge); border-radius: var(--radius);
  padding: 12px; text-align: center; user-select: all; }
.strength.s0 { color: var(--muted); }
.strength.s1 { color: var(--muted); }
.strength.s2 { color: var(--go-hi); }

/* ---- 4. sign-in ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth .box { width: 100%; max-width: 420px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 32px 28px 28px; box-shadow: var(--shadow); }
.auth .foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.auth .foot a { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.brand img { height: 32px; width: 32px; }
.brand b { font: 800 22px/1 var(--sans); letter-spacing: -.02em; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--map-bg); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 22px; }
.tabs button { flex: 1; background: none; border: 0; border-radius: 8px; color: var(--muted);
  padding: 9px 8px; cursor: pointer; font: 700 14px var(--sans); }
.tabs button.on { color: var(--ink); background: var(--raised-2); }

/* ---- 5. shell and sidebar ---- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
nav.side { background: var(--bg); border-right: 1px solid var(--line); padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
nav.side .brand { margin: 0 8px 22px; }
nav.side .brand img { height: 26px; }
nav.side select { margin: 0 0 14px; }
nav.side a { color: var(--muted); text-decoration: none; padding: 7px 10px; border-left: 2px solid transparent; display: flex;
  justify-content: space-between; align-items: center; }
nav.side a:hover { color: var(--ink); background: var(--raised); }
nav.side a { border-left: 0; border-radius: 8px; }
nav.side a.on { color: var(--ink); background: var(--raised); font-weight: 700; box-shadow: inset 3px 0 0 var(--go); }
nav.side .spacer { flex: 1; }
nav.side .who { padding: 12px 10px 8px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 8px; }
nav.side .section { color: var(--muted); margin: 18px 10px 6px; font-size: 12px; }
.count { font: 700 12px/20px var(--sans); min-width: 22px; text-align: center; border: 0; background: var(--ask-soft); color: var(--ask);
  border-radius: 999px; padding: 0 7px; }
nav.side .count { align-self: center; }
button.theme { font: 14px var(--sans); background: none; border: 0; color: var(--muted); padding: 7px 10px 7px 12px; text-align: left; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; }
button.theme:hover { color: var(--ink); background: var(--raised); }
/* the mode toggle, square like the rest: an outlined track and an ink knob that moves across */
button.theme .sw { width: 34px; height: 20px; border: 1px solid var(--edge); border-radius: 999px; position: relative; flex: none; background: var(--raised-2); }
button.theme .sw::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink);
  transition: left .15s cubic-bezier(.16,1,.3,1); }
button.theme[aria-pressed=true] .sw::before { left: 16px; }
button.theme:hover .sw { border-color: var(--ink); }
main { padding: 36px 44px 56px; max-width: 1240px; min-width: 0; }  /* min-width: a wide table scrolls inside .scroll, not the page */
header.top { display: none; }

/* ---- 6. sections, figures, tables ---- */
/* a section: a 2px rule above it, no box */
.panel { border-top: 2px solid var(--rule); padding: 12px 0 0; margin-bottom: 36px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
/* figures: a row of short facts split by 1px lines */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 36px; background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.card { padding: 18px 22px 20px; border-left: 1px solid var(--line); min-width: 0; }
.card:first-child { border-left: 0; }
.card .k { color: var(--muted); }
.card .v { font: 800 22px/1.25 var(--sans); letter-spacing: -.02em; margin-top: 4px; }
.card .s { font-size: 14px; color: var(--muted); margin-top: 2px; }
.card .v .ratio { font: 400 14px var(--mono); color: var(--muted); }
.cards.status { margin-bottom: 28px; }
.card .s .behind { color: var(--signal-text); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td.value, td.cargo { white-space: nowrap; font-size: 14px; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td input, td select { padding: 6px 8px; }
.pill { display: inline-block; font-size: 12.5px; line-height: 1.4; padding: 1px 7px; border-radius: var(--radius); border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.pill { border-radius: 999px; padding: 2px 9px; }
.pill.good { color: var(--go-hi); border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .08); }
.pill.accent { color: var(--ink); border-color: var(--edge); }
.pill.warn, .pill.bad { color: var(--signal-text); border-color: transparent; background: var(--signal-soft); }
.pill.ask { color: var(--ask); border-color: transparent; background: var(--ask-soft); }
.pill[title] { cursor: help; }
.badge { display: inline-block; vertical-align: middle; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); cursor: help; }
.empty { color: var(--muted); padding: 24px 0; }
.scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.scroll::-webkit-scrollbar { height: 6px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); }
.scroll::-webkit-scrollbar-track { background: transparent; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 4px 0 8px; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
form button.ghost { margin-left: 8px; }
.filters .spacer, .actions .spacer { flex: 1; }
details.fold > summary { cursor: pointer; font-size: 14px; list-style: none; padding: 4px 0; text-decoration: underline;
  text-decoration-color: var(--edge); text-underline-offset: 3px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸ "; }
details.fold[open] > summary::before { content: "▾ "; }
details.fold > div { padding-top: 12px; }
.panel > details.fold:only-child > summary { font: 700 17px var(--sans); text-decoration: none; }
/* organisations on Profile: rows split by lines */
.orgs { display: flex; flex-direction: column; margin-bottom: 12px; }
.org-row { display: grid; grid-template-columns: 1fr auto 120px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; }
.org-row:hover { background: var(--raised); }
/* the live table: a row with a position shows the car on the map */
table.live tr.pick { cursor: pointer; }
table.live tr.pick:hover td, table.live tr.pick:focus-visible td { background: var(--raised); }
table.live tr.pick:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
table.live tr.on td { background: var(--raised); }
table.live tr.on td:first-child { box-shadow: inset 3px 0 0 var(--go); }
table.live th, table.live td.name, table.live td.speed, table.live td.when { white-space: nowrap; }
.live-more { margin-top: 12px; }
table.vehicles td.edit { text-align: right; white-space: nowrap; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover b { text-decoration: underline; text-underline-offset: 3px; }
.plate { letter-spacing: .02em; }
b.plate { font-weight: 500; }
/* the Vehicles list's anchor: each vehicle's plate (or name) in the first column */
table.vehicles td.name b { font: 800 19px/1.15 var(--sans); letter-spacing: -.01em; color: var(--ink); white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); border: 1px solid var(--ink); box-shadow: var(--shadow);
  padding: 9px 16px; border-radius: var(--radius); font-size: 14px; z-index: 50; transition: opacity .4s; }
.toast.bad { background: var(--bg); color: var(--signal-text); border-color: var(--signal); }
.toast.out { opacity: 0; }
dialog { background: var(--raised); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; width: min(460px, 92vw); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
/* a vehicle's health details, beside the table instead of inside a cell */
dialog.side-panel { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(420px, 100vw); border-width: 0 0 0 1px; border-radius: 0;
  overflow: auto; border-top: 0; }
dialog.side-panel .panel-head { border-bottom: 2px solid var(--rule); padding-bottom: 10px; }
dialog.side-panel .fault-state { max-width: none; }

/* ---- 7. notices and the Notifications timeline ---- */
/* a notice is a row between 1px lines; what needs a look (an unseen fault or health warning, a control-room
   notice, a question) carries a 2px signal rule on its left */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0 11px 12px; border-top: 1px solid var(--line);
  border-left: 2px solid transparent; font-size: 14px; }
.notice:last-child { border-bottom: 1px solid var(--line); }
.notice + .notice:last-child, .panel .notice:last-child { border-bottom: 0; }
.notice .grow { flex: 1; min-width: 0; }
.notice.warn:not(.seen), .notice.bad:not(.seen) { border-left-color: var(--signal); }
.notice.question { border-left-color: var(--ask); }
.notice .ico { flex: none; width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; color: var(--muted); }
.notice:not(.seen) .ico { color: var(--ink); }
.notice.warn:not(.seen) .ico.fault, .notice.warn:not(.seen) .ico.health, .notice.bad:not(.seen) .ico.trip { color: var(--signal-text); }
.notice.opens { cursor: pointer; }
.notice.opens:hover { background: var(--raised); }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.notice button.ghost { padding: 5px 12px; font-size: 14px; flex: none; }
.notice details summary { cursor: pointer; list-style: none; }
.notice details summary::-webkit-details-marker { display: none; }
.notice details summary::after { content: " · Why ▾"; color: var(--muted); font-size: 14px; white-space: nowrap; }
.notice details[open] summary::after { content: " · Hide ▴"; }
.notice details ul { margin: 8px 0 4px; padding-left: 18px; color: var(--muted); }
.notice details li { margin-bottom: 2px; }
.notice .dates { margin-top: 2px; }
.notice .cleared { margin: 2px 0 0; color: var(--muted); }
.notice-actions { margin: 10px 0 24px; }
.notice > .at { display: none; }
.question { font-size: 15px; }
.question .row { margin-top: 10px; }
button.ghost.small { padding: 5px 12px; font-size: 14px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filters select { width: auto; min-width: 150px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
.chips { display: inline-flex; gap: 2px; padding: 3px; background: var(--map-bg); border: 1px solid var(--line); border-radius: var(--radius); }
.chip { font: 700 13px var(--sans); background: none; border: 0; border-radius: 7px; color: var(--muted); padding: 6px 12px; cursor: pointer; }
.chip.on { background: var(--raised-2); color: var(--ink); }
/* the timeline: a day per section, a clock time in the gutter of each row */
.timeline { padding-top: 0; }
.day-head { color: var(--ink); padding: 18px 0 8px; margin: 0; display: flex; align-items: baseline; gap: 12px; }
.day-head::after { content: ""; flex: 1; border-top: 1px solid var(--line); transform: translateY(-3px); }
.day-head:first-child { padding-top: 12px; }
.timeline .notice { padding-left: 0; border-left: 0; border-top: 0; position: relative; padding-top: 9px; padding-bottom: 9px; }
.timeline .notice + .notice { border-top: 1px solid var(--line); }
.timeline .notice:last-child { border-bottom: 0; }
.timeline .notice > .at { display: block; flex: none; width: 52px; color: var(--muted); padding-top: 1px; }
.timeline .notice:not(.seen) > .at { color: var(--ink); }
.timeline .notice.warn:not(.seen)::before, .timeline .notice.bad:not(.seen)::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 2px; background: var(--signal); }

/* ---- 8. overview map, vehicle masthead, page parts ---- */
/* the overview's one large element: the map, across the whole content width */
.map-panel { margin-left: -44px; margin-right: -44px; margin-top: 28px; border-top: 0; padding-top: 0; }
.map-panel > .panel-head, .map-panel > h2, .map-panel > p { padding: 0 44px; }
.map-panel > .panel-head { margin-bottom: 10px; }
.map, .map-off { border-top: 2px solid var(--rule); border-bottom: 1px solid var(--line); }
.map { height: 500px; overflow: hidden; background: var(--map-bg); }
.map-off { height: 500px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; }
.map-off p { max-width: 560px; margin: 6px 0 0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.legend .dot.driving { background: var(--go); }
.legend .dot.on { background: var(--bg); box-shadow: inset 0 0 0 2px var(--ink); }
.legend .dot.problem { background: var(--signal); }
/* Google's info window and controls, in the page's colours */
.map .gm-style .gm-style-iw-c { background: var(--raised); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px !important; }
.map .gm-style .gm-style-iw-d { overflow: auto !important; }
.map .gm-style .gm-style-iw-tc::after { background: var(--raised); }
.map .gm-style .gm-style-iw-chr { height: 0; }
.map .gm-style .gm-style-iw-chr button { position: absolute !important; top: 0; right: 0; opacity: .6; }
:root[data-theme=dark] .map .gm-style .gm-style-iw-chr button { filter: invert(1); }
.map .map-pop { font: 14px/1.45 var(--sans); color: var(--ink); padding-right: 22px; }
.map .map-pop b { font-weight: 700; }
.map .gm-style .gm-bundled-control .gmnoprint > div { background: var(--raised) !important; border: 1px solid var(--line) !important; border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important; overflow: hidden; }
.map .gm-style .gm-bundled-control .gmnoprint > div > div { background: var(--line) !important; margin: 0 6px !important; }  /* the line between + and - */
.map .gm-style .gm-control-active { background: transparent !important; border-radius: 0 !important; box-shadow: none !important; }
.map .gm-style .gm-control-active:hover { background: var(--raised-2) !important; }
:root[data-theme=dark] .map .gm-style .gm-control-active img { filter: invert(1); }
.map .gm-style .gm-style-cc div { background: transparent !important; }
.map .gm-style .gm-style-cc a, .map .gm-style .gm-style-cc span, .map .gm-style .gm-style-cc button { color: var(--muted) !important; }
.map-label { font-family: var(--sans) !important; font-weight: 700 !important; letter-spacing: 0;
  text-shadow: 1px 0 var(--map-bg), -1px 0 var(--map-bg), 0 1px var(--map-bg), 0 -1px var(--map-bg); }
/* the vehicle page's one large element: a masthead, plate large, health and what Vigil is doing beside it */
.masthead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 32px; align-items: end;
  border-bottom: 2px solid var(--rule); padding-bottom: 18px; margin-bottom: 28px; }
.masthead h1.plate { font: 800 60px/1 var(--sans); letter-spacing: -.03em; margin: 6px 0 10px; }
.masthead h1.plate { overflow-wrap: anywhere; }  /* a long one-word name wraps rather than running off a phone */
.masthead p.lead { margin: 0; color: var(--ink); font-size: 16px; }
.masthead .mast-sub { color: var(--muted); }
.masthead .cards { border-top: 0; margin: 0; }
.masthead + .cards { border-top: 0; }
.masthead + .panel { border-top: 0; }  /* the masthead's rule already closes it: no double rule above the fault */
.masthead .card { padding-top: 0; padding-bottom: 0; }
a.back { display: inline-block; text-decoration: none; color: var(--muted); }
a.back:hover { color: var(--ink); }
/* health and faults */
.v-warn { color: var(--signal-text); }
.fault-state { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 340px; }
.fault-line { color: var(--signal-text); }
.fault-more { font-size: 14px; }
.fault-more summary { cursor: pointer; list-style: none; text-decoration: underline; text-decoration-color: var(--edge); text-underline-offset: 3px; }
.fault-more summary::-webkit-details-marker { display: none; }
.fault-more summary::after { content: " ▾"; }
.fault-more[open] summary::after { content: " ▴"; }
.fault-part { margin-top: 10px; padding: 10px 12px; border: 1px solid rgba(255, 106, 43, .4); background: var(--signal-soft); border-radius: var(--radius); }
.fault-part ul { margin: 4px 0; padding-left: 18px; color: var(--muted); }
.fault-part button { margin-top: 6px; }
.fault { color: var(--signal-text); margin-top: 4px; }
.risk { margin-top: 2px; cursor: help; }
.bar { height: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar { border-radius: 99px; }
.bar span { display: block; height: 100%; background: var(--go); border-radius: 99px; }
.set-row { display: flex; align-items: center; justify-content: space-between; max-width: 320px; margin-bottom: 14px; }

/* ---- 9. phone layout ---- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  header.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--bg);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  header.top .brand { margin: 0; }
  header.top .brand img { height: 22px; }
  header.top .menu { display: inline-flex; align-items: center; gap: 8px; }
  nav.side { display: none; border-right: 0; border-bottom: 1px solid var(--line); position: static; height: auto; }
  nav.side .brand { display: none; }
  .shell.open nav.side { display: flex; }
  nav.side .spacer { display: none; }
  main { padding: 20px 16px 40px; }
  h1 { font-size: 24px; }
  .masthead { grid-template-columns: 1fr; gap: 16px; }
  .masthead h1.plate { font-size: 46px; }
  .map-panel { margin-left: -16px; margin-right: -16px; }
  .map-panel > .panel-head, .map-panel > h2, .map-panel > p { padding: 0 16px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card { padding: 14px 16px 16px; }
  .card:nth-child(odd) { border-left: 0; }
  .cards .card.watch { grid-column: 1 / -1; order: 3; border-left: 0; border-top: 1px solid var(--line); }
  .card .v { font-size: 19px; }
  td, th { padding: 9px 5px; }
  /* the live table reads as a block per vehicle: name with its pills, then where it is and when it last reported */
  table.live thead { display: none; }
  table.live, table.live tbody { display: block; }
  table.live tr { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 8px; align-items: center;
    padding: 12px 4px; border-bottom: 1px solid var(--line); }
  table.live tr:last-child { border-bottom: 0; }
  table.live td { display: block; padding: 0; border: 0; white-space: normal; }
  table.live td.name { grid-column: 1; }
  table.live td.status { grid-column: 2; grid-row: 1; }
  table.live td.health { grid-column: 3; grid-row: 1; }
  table.live td.where, table.live td.when, table.live td.speed { grid-column: 1 / -1; }
  table.live td.speed { display: none; }
  table.live tr.driving td.speed { display: block; }
  table.live tr.pick:hover td, table.live tr.on td { background: none; box-shadow: none; }
  table.live tr.pick:hover, table.live tr.on { background: var(--raised); }
  /* and so does the vehicles table: name with its pills, make and model, then each setting with its label */
  table.vehicles, table.vehicles tbody { display: block; }
  table.vehicles tr:first-child { display: none; }
  table.vehicles tr { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
  table.vehicles tr:last-child { border-bottom: 0; }
  table.vehicles td { display: block; padding: 0; border: 0; }
  table.vehicles td.name { grid-column: 1; grid-row: 1; }
  table.vehicles td.health { grid-column: 2; grid-row: 1; }
  table.vehicles td.watch { grid-column: 3; grid-row: 1; }
  table.vehicles td.model { grid-column: 1 / -1; margin-bottom: 4px; }
  table.vehicles td[data-l] { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
  table.vehicles td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 14px; min-width: 56px; }
  table.vehicles td input.money { min-width: 0; width: 170px; }
  table.vehicles td select { width: auto; min-width: 170px; }
  .map, .map-off { height: 340px; }
  table.vehicles td.edit { grid-column: 1 / -1; text-align: left; }
  .notice { flex-wrap: wrap; }
  .timeline .notice > .at { width: 44px; }
  .org-row { grid-template-columns: 1fr auto; }
  .org-row .small { display: none; }
  .filters select { flex: 1; }
}

:root[data-theme=light] .chip.on, :root[data-theme=light] .tabs button.on { background: #fff; box-shadow: 0 1px 3px rgba(11, 18, 32, .14); }
