/* Jort Dispatch — a UK haulage control panel. Motorway-sign blue for the brand, hi-vis yellow for the one thing to
   press, signal colours for state. Barlow (road-sign lineage) for text, Barlow Condensed for figures and headings. */

:root {
  color-scheme: light;
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --surface-3: #ECF0F5;
  --ink: #0F1A2B;
  --ink-2: #4B586B;
  --ink-3: #8592A6;
  --line: #DFE5EE;
  --line-2: #CBD3DF;
  --brand: #1B4DB1;
  --brand-2: #163F92;
  --brand-ink: #FFFFFF;
  --brand-soft: #E5ECFA;
  --hivis: #D6F01A;
  --hivis-ink: #141A02;
  --hivis-edge: #B7CF06;
  --live: #0E9F55;
  --live-soft: #E2F6EB;
  --stop: #D7343B;
  --stop-soft: #FCE7E8;
  --dry: #C27A00;
  --dry-soft: #FBF0D9;
  --shadow: 0 1px 2px rgba(15, 26, 43, .06), 0 4px 16px rgba(15, 26, 43, .06);
  --shadow-up: 0 -1px 0 var(--line), 0 -6px 18px rgba(15, 26, 43, .05);
  --radius: 16px;
  --radius-s: 10px;
  --bar-h: 64px;
  --tab-h: 62px;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-c: 'Barlow Condensed', 'Barlow', 'Arial Narrow', system-ui, sans-serif;
  --map-filter: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B111C;
    --surface: #131C2B;
    --surface-2: #182335;
    --surface-3: #1E2B40;
    --ink: #E9EEF6;
    --ink-2: #A5B1C5;
    --ink-3: #6E7B91;
    --line: #223049;
    --line-2: #2D3D5A;
    --brand: #5B8DF5;
    --brand-2: #7AA3F8;
    --brand-ink: #071226;
    --brand-soft: #18284A;
    --hivis: #D6F01A;
    --hivis-ink: #141A02;
    --hivis-edge: #E6FA5A;
    --live: #34D485;
    --live-soft: #123224;
    --stop: #FF6168;
    --stop-soft: #3A1A20;
    --dry: #FFB52E;
    --dry-soft: #3A2C10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-up: 0 -1px 0 var(--line), 0 -8px 22px rgba(0, 0, 0, .3);
    --map-filter: invert(1) hue-rotate(195deg) brightness(.92) contrast(.88) saturate(.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B111C;
  --surface: #131C2B;
  --surface-2: #182335;
  --surface-3: #1E2B40;
  --ink: #E9EEF6;
  --ink-2: #A5B1C5;
  --ink-3: #6E7B91;
  --line: #223049;
  --line-2: #2D3D5A;
  --brand: #5B8DF5;
  --brand-2: #7AA3F8;
  --brand-ink: #071226;
  --brand-soft: #18284A;
  --hivis: #D6F01A;
  --hivis-ink: #141A02;
  --hivis-edge: #E6FA5A;
  --live: #34D485;
  --live-soft: #123224;
  --stop: #FF6168;
  --stop-soft: #3A1A20;
  --dry: #FFB52E;
  --dry-soft: #3A2C10;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-up: 0 -1px 0 var(--line), 0 -8px 22px rgba(0, 0, 0, .3);
  --map-filter: invert(1) hue-rotate(195deg) brightness(.92) contrast(.88) saturate(.55);
}

*, *::before, *::after { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.num { font-family: var(--font-c); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── shell ─────────────────────────────────────────────────────────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; height: 100%; }
.appbar {
  position: sticky; top: 0; z-index: 30;
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar-in { height: var(--bar-h); display: flex; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto; }
.mark { width: 36px; height: 36px; flex: none; display: block; }
.brandname { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.brandname b { font: 700 21px/1 var(--font-c); letter-spacing: .02em; text-transform: uppercase; }
.brandname span { font: 500 12px/1.2 var(--font); color: var(--ink-3); margin-top: 3px; letter-spacing: .02em; }
.appbar .grow { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 10px; border-radius: 99px;
  font: 700 13px/1 var(--font-c); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2); border: 0;
}
.pill i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.pill.live { background: var(--live-soft); color: var(--live); }
.pill.live i { box-shadow: 0 0 0 0 currentColor; animation: beat 2.2s infinite; }
.pill.stop { background: var(--stop-soft); color: var(--stop); }
.pill.dry { background: var(--dry-soft); color: var(--dry); }
.pill.busy i { animation: blink 1s infinite; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: .35; } }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); }
.iconbtn:active { background: var(--surface-3); }
.iconbtn svg { width: 22px; height: 22px; }
.gpsdot { position: relative; }
.gpsdot.on { color: var(--brand); }
.gpsdot.on::after { content: ''; position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--live); border: 2px solid var(--bg); }

main { flex: 1; min-height: 0; }
.view { display: none; height: 100%; }
.view.on { display: block; }
.scroll {
  height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
.wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 0 8px env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  box-shadow: var(--shadow-up);
}
.tabs-in { height: var(--tab-h); max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tab {
  position: relative; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font: 600 11.5px/1 var(--font); letter-spacing: .03em; padding: 0;
}
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--ink); }
.tab.on::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.tab .badge {
  position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--stop); color: #fff; font: 700 11px/18px var(--font); text-align: center;
}

/* ── cards + type ──────────────────────────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.eyebrow { font: 700 12px/1 var(--font-c); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.h { font: 700 26px/1.05 var(--font-c); letter-spacing: .005em; margin: 0; text-wrap: balance; }
.h2 { font: 700 19px/1.15 var(--font-c); letter-spacing: .02em; margin: 0; text-transform: uppercase; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px;
  background: var(--surface-3); color: var(--ink-2); font: 600 13px/1 var(--font); white-space: nowrap;
}
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.live { background: var(--live-soft); color: var(--live); }
.chip.dry { background: var(--dry-soft); color: var(--dry); }
.chip.stop { background: var(--stop-soft); color: var(--stop); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 700 16px/1 var(--font); letter-spacing: .01em; text-decoration: none; user-select: none;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--hivis); color: var(--hivis-ink); border-color: var(--hivis-edge); }
.btn.brand { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.danger { background: var(--stop); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.block { width: 100%; }
.btn.big { min-height: 60px; font-size: 19px; border-radius: 16px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ── home ──────────────────────────────────────────────────────────────────────────────────────────────── */
.control { padding: 18px 16px 16px; position: relative; overflow: hidden; }
.control::before {   /* the road: a dashed centre line along the top edge, coloured by state */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: repeating-linear-gradient(90deg, var(--state, var(--ink-3)) 0 26px, transparent 26px 40px);
}
.control.live { --state: var(--live); }
.control.stop { --state: var(--stop); }
.control.dry { --state: var(--dry); }
.state-line { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; }
.state-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--state, var(--ink-3)); flex: none; }
.control.live .state-dot { animation: beat 2.2s infinite; color: var(--live); }
.control .h { font-size: 30px; }
.control .sub { color: var(--ink-2); font-size: 15px; }
.control .actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px 12px 11px; }
.stat b { display: block; font: 700 clamp(22px, 7.4vw, 30px)/1 var(--font-c); white-space: nowrap; font-variant-numeric: tabular-nums; margin: 6px 0 2px; letter-spacing: .01em; }
.stat small { color: var(--ink-3); font-size: 12.5px; }

.mode-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin-top: 12px; font-size: 15px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; }

/* booked work as a road: stops on a dashed line */
.road { list-style: none; margin: 12px 0 0; padding: 0; position: relative; }
.road::before { content: ''; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 2px;
  background: repeating-linear-gradient(180deg, var(--line-2) 0 8px, transparent 8px 14px); }
.road li { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 8px 0; }
.road .n { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 700 15px/1 var(--font-c);
  background: var(--surface-3); color: var(--ink-2); position: relative; z-index: 1; border: 2px solid var(--surface); }
.road li.aim .n { background: var(--hivis); color: var(--hivis-ink); }
.road li.past { opacity: .45; }
.road .what { font-weight: 600; line-height: 1.25; }
.road .what small { display: block; font-weight: 500; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.road .when { text-align: right; font: 700 18px/1.1 var(--font-c); font-variant-numeric: tabular-nums; white-space: nowrap; }
.road .when small { display: block; font: 500 12.5px/1.2 var(--font); color: var(--ink-3); }
.road li.zone3 .n { background: var(--brand-soft); color: var(--brand); }

.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.qa {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.qa:active { transform: scale(.98); }
.qa .ic { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.qa .ic svg { width: 21px; height: 21px; }
.qa b { display: block; font-weight: 700; font-size: 15.5px; line-height: 1.15; }
.qa small { display: block; color: var(--ink-3); font-size: 12.5px; line-height: 1.2; margin-top: 2px; }
.qa.warn .ic { background: var(--stop-soft); color: var(--stop); }

/* ── quotes ────────────────────────────────────────────────────────────────────────────────────────────── */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; }
.seg button { border: 0; background: transparent; height: 38px; border-radius: 9px; font-weight: 700; font-size: 14.5px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.qcard { padding: 14px 14px 12px; }
.qtop { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.route { font-weight: 700; font-size: 16.5px; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.route .to { display: flex; gap: 6px; color: var(--ink-2); font-weight: 600; margin-top: 3px; }
.route .to::before { content: '→'; color: var(--ink-3); }
.price { font: 700 30px/1 var(--font-c); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.price small { display: block; font: 600 12px/1.3 var(--font); color: var(--ink-3); margin-top: 3px; }
.qcard .chips { margin-top: 10px; }
.why { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); list-style: none; font-size: 14px; }
.why li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.why li:last-child { border-bottom: 0; }
.why li.head { font-weight: 700; }
.more { border: 0; background: none; color: var(--brand); font-weight: 700; font-size: 14px; padding: 8px 0 0; }
.daylabel { font: 700 13px/1 var(--font-c); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 8px 2px 0; }
.empty { text-align: center; padding: 36px 20px; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-size: 17px; margin-bottom: 4px; }

/* ── chat ──────────────────────────────────────────────────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; height: 100%; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 12px 10px; }
.msgs-in { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; max-width: min(88%, 620px); }
.msg.agent { align-self: flex-start; }
.msg.you { align-self: flex-end; align-items: flex-end; }
.bubble {
  padding: 10px 13px; border-radius: 16px; font-size: 15.5px; line-height: 1.42; overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.msg.agent .bubble { border-top-left-radius: 6px; }
.msg.you .bubble { background: var(--brand); color: var(--brand-ink); border-color: transparent; border-top-right-radius: 6px; }
.bubble b { font-weight: 700; }
.bubble code { font: 500 .92em/1.3 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.msg.you .bubble code { background: rgba(255, 255, 255, .18); }
.bubble pre { white-space: pre-wrap; margin: 6px 0; font: 500 13px/1.4 ui-monospace, Menlo, Consolas, monospace; }
.bubble img { display: block; max-width: 100%; border-radius: 10px; margin: -2px -3px 6px; }
.meta { font-size: 12px; color: var(--ink-3); margin: 4px 6px 0; }
.keys { display: flex; flex-direction: column; gap: 6px; margin-top: 7px; width: 100%; }
.krow { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.key {
  min-height: 44px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--brand); font-weight: 700; font-size: 14.5px; line-height: 1.2; text-align: center; text-decoration: none;
  display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere;
}
.key:active { background: var(--brand-soft); }
.key.done { color: var(--live); border-style: dashed; pointer-events: none; }
.key.busy { opacity: .55; pointer-events: none; }
.dayline { align-self: center; font: 700 12px/1 var(--font-c); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-3); padding: 6px 10px; border-radius: 99px; margin: 6px 0; }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: bob 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 8px 10px calc(8px + var(--tab-h) + env(safe-area-inset-bottom, 0px));
}
.composer-in { max-width: 760px; margin: 0 auto; }
.suggest { display: flex; gap: 6px; overflow-x: auto; padding: 0 2px 8px; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.suggest button { flex: none; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.inputrow { display: flex; align-items: flex-end; gap: 8px; }
.inputrow textarea {
  flex: 1; min-height: 46px; max-height: 140px; resize: none; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface-2);
  padding: 11px 14px; font-size: 16px; line-height: 1.35; outline: none;
}
.inputrow textarea:focus { border-color: var(--brand); background: var(--surface); }
.send { width: 46px; height: 46px; flex: none; border-radius: 14px; border: 0; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.send svg { width: 22px; height: 22px; }
.send[disabled] { background: var(--surface-3); color: var(--ink-3); }

/* ── map ───────────────────────────────────────────────────────────────────────────────────────────────── */
.mapview { position: relative; height: 100%; }
#map { position: absolute; inset: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); background: var(--surface-3); }
#map .leaflet-tile-pane { filter: var(--map-filter); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.mapsheet {
  position: absolute; left: 12px; right: 12px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 12px); z-index: 500;
  max-width: 560px; margin: 0 auto; padding: 12px 14px;
}
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.vanpin { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0,0,0,.3); border: 2px solid #fff; }
.vanpin svg { width: 20px; height: 20px; }
.gpspin { width: 18px; height: 18px; border-radius: 50%; background: #2F7BFF; border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(47, 123, 255, .5); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(47,123,255,.55); } 80% { box-shadow: 0 0 0 16px rgba(47,123,255,0); } 100% { box-shadow: 0 0 0 0 rgba(47,123,255,0); } }
.stoppin { width: 30px; height: 30px; border-radius: 9px; background: var(--hivis); color: var(--hivis-ink); display: grid; place-items: center; font: 700 16px/1 var(--font-c); border: 2px solid #1A1F07; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.stoppin.z3 { background: #1B4DB1; color: #fff; border-color: #fff; }

/* ── switch / settings ─────────────────────────────────────────────────────────────────────────────────── */
.setting { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting .t { flex: 1; min-width: 0; }
.setting .t b { display: block; font-weight: 700; }
.setting .t small { display: block; color: var(--ink-3); font-size: 13.5px; line-height: 1.35; margin-top: 2px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + span { background: var(--live); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ── sheet (confirmations) ─────────────────────────────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 90; background: rgba(5, 10, 20, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px)); animation: up .2s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line-2); margin: -8px auto 14px; }
.sheet p { color: var(--ink-2); margin: 8px 0 16px; }
.sheet .acts { display: grid; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }

#toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 72px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 520px; padding: 11px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow); animation: up .2s ease; }
.toast.bad { background: var(--stop); color: #fff; }

/* ── login ─────────────────────────────────────────────────────────────────────────────────────────────── */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px); }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login .mark { width: 64px; height: 64px; margin: 0 auto 14px; }
.login h1 { font: 700 34px/1 var(--font-c); text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.login .lede { color: var(--ink-2); margin: 8px 0 26px; }
.dots { display: flex; justify-content: center; gap: 12px; margin: 0 0 8px; height: 22px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); transition: background .12s, border-color .12s; }
.dots i.on { background: var(--ink); border-color: var(--ink); }
.dots.bad i { border-color: var(--stop); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.login .err { min-height: 22px; color: var(--stop); font-weight: 600; font-size: 14.5px; margin-bottom: 10px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.pad button { height: 64px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font: 600 28px/1 var(--font-c); box-shadow: var(--shadow); }
.pad button:active { background: var(--surface-3); }
.pad button.fn { background: transparent; box-shadow: none; border-color: transparent; font: 700 15px/1 var(--font); color: var(--ink-2); }
.pad button.go { background: var(--hivis); color: var(--hivis-ink); border-color: var(--hivis-edge); font: 700 16px/1 var(--font); }
.login .hint { margin-top: 22px; font-size: 13.5px; color: var(--ink-3); }

@media (min-width: 720px) {
  .quick { grid-template-columns: repeat(3, 1fr); }
  .scroll { padding-top: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── prices ──────────────────────────────────────────────────────────────────────────────────────────────── */
.pricerow { width: 100%; border: 0; background: transparent; text-align: left; color: inherit; cursor: pointer; }
.pricerow:active { background: var(--surface-2); }
.card > .pricerow:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card > .pricerow:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.pval { flex: none; font-size: 21px; font-weight: 700; padding: 6px 12px; border-radius: 10px; background: var(--surface-3); color: var(--ink); white-space: nowrap; }
.pval.changed { background: var(--brand-soft); color: var(--brand); }
.stepper { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; align-items: stretch; }
.stepper .btn { font-size: 28px; min-height: 64px; padding: 0; }
.stepper input { min-width: 0; text-align: center; font-size: 32px; font-weight: 700; border-radius: 14px; border: 2px solid var(--line-2); background: var(--surface-2); outline: none; }
.stepper input:focus { border-color: var(--brand); background: var(--surface); }

/* ── the agent's screen ──────────────────────────────────────────────────────────────────────────────────── */
.screenview { height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 10px); max-width: 900px; margin: 0 auto; }
.screenbar { display: flex; align-items: center; gap: 10px; }
.screenbox { flex: 1; min-height: 0; border-radius: 16px; overflow: hidden; background: #05080f; border: 1px solid var(--line); position: relative; }
.screenbox > div { width: 100% !important; height: 100% !important; }
.screenbox .empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.screenhint { margin: 0; text-align: center; font-size: 12.5px; color: var(--ink-3); }

/* ── forms ───────────────────────────────────────────────────────────────────────────────────────────────── */
.formset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.formset[disabled] { opacity: .6; }
.lbl { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.inp { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 16px; outline: none; }
.inp:focus { border-color: var(--brand); background: var(--surface); }
select.inp, .vans select, .pair select { appearance: none; -webkit-appearance: none; }
.chipset { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chipset button { height: 40px; min-width: 52px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 15px; color: var(--ink-2); }
.chipset button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chipset .inp { width: 92px; min-height: 40px; text-align: center; }
.vans, .pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.vans label, .pair label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; min-width: 0; }
.vans select, .pair select { min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 16px; font-weight: 600; color: var(--ink); }
.money { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); padding-left: 12px; }
.money i { font-style: normal; font-weight: 700; color: var(--ink-3); }
.money .inp { border: 0; background: transparent; }
.tick { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.tick input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.tick b { display: block; font-size: 15px; line-height: 1.25; }
.tick small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.tick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.qcard .when { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 14.5px; color: var(--ink-3); }
.qcard .when b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.bubble.flat { box-shadow: none; background: var(--surface-2); }
.summary { border-color: var(--brand); }
.nowval { margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); letter-spacing: .04em; text-transform: none; font-family: var(--font); font-weight: 600; }
.nowval:empty { display: none; }
.jobacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.jobacts .btn { min-height: 42px; font-size: 14.5px; padding: 0 12px; }
