/* ============================================================
   FleetTrack — modern dashboard UI
   ============================================================ */

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e4e7f0;
  --text: #161b2e;
  --text-2: #58607a;
  /* Measured, not eyeballed: #8b92a9 was 3.1:1 on a card and 2.89:1 on
     --bg, and this token carries real copy (tab labels, field labels, empty
     states, hints). #656d84 clears 4.5:1 on --surface, --bg and --surface-2. */
  --text-3: #656d84;

  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #ecebfd;
  --green: #15a35a;
  --green-soft: #e3f7ec;
  --amber: #d4880b;
  --amber-soft: #fcf1dd;
  /* --amber is a FILL colour; as text it is 2.5:1. Amber words use this. */
  --amber-text: #b45309;
  --red: #e0455a;
  --red-soft: #fde9ec;
  --gray-soft: #eceef4;

  /* vehicle status colors */
  --st-moving: #1d4ed8;   /* dark blue */
  --st-idle: #8b5cf6;     /* light purple — engine on, stopped (teal, orange, dark pink tried) */
  --st-parked: #15a35a;   /* green — engine off, stopped (brown and violet both rejected) */
  --st-nolocate: #e07b18; /* orange */
  --st-offline: #7c8499;  /* grey */
  --st-alarm: #dc2626;    /* red */

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 18px rgba(16, 24, 40, .09);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 999px;

  /* ---- Control size scale ----
     Three heights, and deliberately no fourth. 34px was already the app's
     de-facto control height: .pb-head, .view-toggle and .ra-toolbar each
     rediscovered it locally, every one of them with a comment saying the row
     should "sit on the same line". Promoting it to a token is what stops the
     fourth rediscovery.
       --ctl-h     form controls inside a filter card (.report-controls)
       --ctl-h-md  the default: toolbar buttons, tabs, inline selects
       --ctl-h-sm  dense controls that live inside a list row or a chip bar
     Controls set these as MIN-height, not height, so a label that genuinely
     needs two lines can still grow — while a one-line label can never come
     out a different height from the button next to it. */
  --ctl-h: 40px;
  --ctl-h-md: 34px;
  --ctl-h-sm: 28px;
  /* Corner radius follows the size step, so a control's shape and its height
     never disagree: --ctl-h and --ctl-h-md controls take --radius-sm,
     --ctl-h-sm controls take --radius-xs, cards take --radius, and anything
     pill-shaped takes --radius-pill. */
  /* Read-only status badges — .chip, .cg-chip, .io-chip, .rep-place,
     .cargo-chip. They are labels sitting inside table cells and card rows,
     not targets, so they are smaller than any control; they just have to be
     smaller by the SAME amount. They measured 17, 18, 19 and 22px. */
  --badge-h: 20px;
  --rail-w: 78px;
  --ctx-h: 60px;
  --sidebar-w: 320px;

  /* tag pill: darken/lighten tag text for contrast on its own tint */
  --tag-ink: #000;
}

[data-theme="dark"] {
  --bg: #0b0f1a;
  --surface: #141a28;
  --surface-2: #1b2333;
  --border: #283146;
  --text: #e9ecf5;
  --text-2: #a4adc4;
  --text-3: #8a93aa; /* was #6a7389: 3.66:1 on the dark card; this is 5.66 */

  --primary: #6d68f0;
  --primary-2: #7c79f5;
  --primary-soft: #20243f;
  --tag-ink: #fff;
  --green: #34d27b;
  --green-soft: #122e1f;
  --amber: #f3a623;
  --amber-soft: #312510;
  --amber-text: #fbbf24;
  --red: #f15267;
  --red-soft: #341620;
  --gray-soft: #212a3c;

  --st-moving: #3b82f6;
  --st-idle: #a78bfa;
  --st-parked: #34d27b;
  --st-nolocate: #f3a623;
  --st-offline: #6a7389;
  --st-alarm: #f25555;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}
button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: var(--font); }
.mobile-only { display: none; }

/* ============ APP SHELL ============ */
.app { display: flex; height: 100vh; height: 100dvh; }

/* ---- Left rail ---- */
.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  gap: 8px;
  z-index: 1000;
}

.rail-brand { padding: 6px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rail-brand-v { width: 32px; height: auto; }
.rail-brand-name { font-size: 11px; font-weight: 800; color: var(--text); letter-spacing: .01em; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
}

/* Scroll the DESTINATION LIST only — not .rail itself, whose overflow would
   clip the account popover — so on short laptop screens the tail of the nav
   scrolls instead of falling off the bottom edge with no way to reach it.
   (Same pattern as the mobile drawer, which hit this first.) */
.rail-nav {
  display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center;
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none;
  /* soft bottom edge, so a half-cut icon reads as "more below" rather
     than as a rendering glitch (invisible when the list already fits) */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
}
.rail-nav::-webkit-scrollbar { display: none; }
.rail-brand { flex-shrink: 0; }
.rail-foot { margin-top: auto; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }

.rail-btn[hidden], .mob-btn[hidden] { display: none !important; }
#dashDeliveriesSection[hidden], #dashAlertsCard[hidden] { display: none !important; }
.rail-btn {
  width: 100%;
  text-decoration: none; /* nav entries are real links now (cmd/middle-click opens a tab) */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 4px;
  border-radius: 12px;
  color: var(--text-3);
  position: relative;
  transition: background .15s, color .15s;
}
.rail-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-btn.active { background: var(--primary-soft); color: var(--primary); }
.rail-label { font-size: 10px; font-weight: 600; letter-spacing: .01em; text-align: center; }
/* One line, ellipsis, full name in the title (settings.js applyProfile).
   The old two-line clamp with word-break split a one-word login mid-word:
   "vamosde / mo". */
#railUserName { display: block; max-width: 100%; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* "More pages below" cue under the rail's scrolling list (main.js
   syncRailMore). Hidden whenever the whole list fits. */
.rail-more { flex-shrink: 0; width: 100%; height: 22px; display: grid; place-items: center; color: var(--text-3); border-radius: var(--radius-xs); }
.rail-more:hover { background: var(--surface-2); color: var(--text); }
.rail-more[hidden] { display: none; }
/* A full account has 13 destinations; at 1440×900 the last two fell below
   the fold. Tighter buttons on short screens fit all 13 down to ~860px. */
@media (min-width: 821px) and (max-height: 960px) {
  .rail-nav { gap: 2px; }
  .rail-nav .rail-btn { padding: 6px 4px; gap: 3px; }
  .rail-brand { padding: 2px 0 6px; }
}

.rail .badge {
  position: absolute;
  top: 4px; right: 14px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px;
  border-radius: 8px;
  display: grid; place-items: center;
  padding: 0 4px;
}
/* display:grid above would otherwise override the hidden attribute */
.rail .badge[hidden] { display: none; }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}

/* user menu (popover) */
.user-chip { position: relative; width: 100%; }
.user-menu {
  position: absolute;
  bottom: 4px; left: calc(100% + 10px);
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 1200;
}
.user-menu.open { display: block; }
.user-menu-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu-head strong { display: block; font-size: 13px; }
.user-menu-head span { font-size: 11.5px; color: var(--text-3); }
.user-menu-item {
  display: flex; width: 100%; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  text-align: left; transition: background .15s, color .15s;
}
.user-menu-item:hover { background: var(--surface-2); color: var(--text); }
.user-menu-item.danger { color: var(--red); }
.user-menu hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---- Workspace ---- */
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.ctxbar {
  height: var(--ctx-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 800;
}
.ctx-menu { display: none; width: 38px; height: 38px; border-radius: 9px; color: var(--text-2); }
.ctx-menu:hover { background: var(--surface-2); }
.ctx-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ctx-title h1 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.ctx-company { font-size: 12px; color: var(--text-3); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.conn-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--gray-soft);
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.conn-pill.online { background: var(--green-soft); color: var(--green); }
.conn-pill.online .conn-dot { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.conn-pill.offline { background: var(--red-soft); color: var(--red); }
.conn-pill.offline .conn-dot { background: var(--red); }
.conn-pill.mock { background: var(--amber-soft); color: var(--amber); }
.conn-pill.mock .conn-dot { background: var(--amber); }

.workspace-body { flex: 1; position: relative; min-height: 0; }

/* ---- View panels ---- */
.view-panel { position: absolute; inset: 0; display: none; }
/* Until the account's features are known (html.feat-ready, set by
   applyFeatures), show no nav buttons and no view content: the page starts
   with EVERY button, so a customer with a few features saw the rest appear
   and then vanish on each sign-in. Nothing at all is better than a flash. */
html:not(.feat-ready) .rail-btn[data-view],
html:not(.feat-ready) .mob-btn[data-view] { display: none !important; }
html:not(.feat-ready) .view-panel { visibility: hidden; }
.view-panel.open { display: block; }
.view-panel.map-view.open { display: flex; }
.view-inner { height: 100%; overflow-y: auto; padding: 22px; max-width: 1180px; margin: 0 auto; }
/* Data-table views use the whole window. 1180px is a reading measure — right
   for forms and card lists, wrong for a ten-column report, which was scrolling
   sideways inside a centred column while the screen had room to spare.
   Reports and the login log are the two views that render .report-table. */
#view-reports .view-inner { max-width: none; }

/* shared buttons
   ------------------------------------------------------------------
   One layout for every button: a height from the scale, content centred,
   line-height 1, and horizontal-only padding.

   line-height:1 is the load-bearing part. With padding setting the height,
   the button is as tall as its text's LINE BOX, and an emoji's line box is
   taller than a Latin one — so "👤 Ack people", "📇 Contacts" and "Ack" came
   out 32.5, 29 and 27.5px tall standing next to each other in the same
   toolbar, all three of them .btn-ghost.sm with identical CSS. Height now
   comes from the scale and nothing the label contains can move it.

   Because these are inline-flex, they need the [hidden] guard further down
   the file — a class rule that sets display beats the UA's [hidden] rule. */
.btn-primary, .btn-ghost, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h-md); line-height: 1; box-sizing: border-box;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary); color: #fff;
  font-weight: 600; font-size: 13px;
  padding: 0 18px; border-radius: var(--radius-sm);
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  font-size: 12.5px; font-weight: 600;
  padding: 0 13px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); color: var(--text-2);
  transition: border-color .15s, color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
/* Destructive actions, two weights and no more:
     .btn-primary.btn-danger  the confirming button INSIDE a dialog that asks
     .btn-ghost.danger-btn    a destructive action offered in a list or form
   There were five (ds-danger, sa-danger, danger-btn, vf-danger, and the
   soft fill); sa-danger only turned red on hover, so "Delete" on a
   sub-account and "Remove" on a contact looked like any other button. The
   soft red/green fill stays only for the Cut / Restore engine PAIR
   (commands.js), where the two colours are the point. */
.btn-primary.btn-danger { background: var(--red); }
.btn-ghost.danger-btn { color: var(--red); border-color: var(--red-soft); }
.btn-ghost.danger-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.btn-ghost.active { background: var(--primary); border-color: var(--primary); color: #fff; }
/* .sm is the dense step of the scale, and it means the same thing on every
   button — a .btn-primary.sm used to be silently full-size, because only
   .btn-ghost.sm had a rule. */
.btn-ghost.sm, .btn-primary.sm {
  min-height: var(--ctl-h-sm); font-size: 12px; padding: 0 10px;
  border-radius: var(--radius-xs);
}
/* Export control: a format picker joined to the Export button, one outline.
   XLSX is the default option; the select is the button's left half. */
.export-group { display: inline-flex; align-items: stretch; flex-shrink: 0; }
.export-group[hidden] { display: none; }
.export-group .export-fmt {
  min-height: var(--ctl-h-md); box-sizing: border-box; padding: 0 6px 0 10px;
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--text-2); background: var(--surface); cursor: pointer;
  border: 1.5px solid var(--border); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.export-group .export-go { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.export-group.sm .export-fmt { min-height: var(--ctl-h-sm); font-size: 11.5px; border-radius: var(--radius-xs) 0 0 var(--radius-xs); }
.export-group.sm .export-go { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.export-group .export-fmt:hover, .export-group .export-fmt:focus-visible { color: var(--primary); }
.export-group .export-go:disabled { opacity: .55; cursor: progress; }
.icon-btn {
  width: var(--ctl-h-md); height: var(--ctl-h-md); flex-shrink: 0;
  border-radius: var(--radius-sm); color: var(--text-2);
  padding: 0; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
/* .small pairs with .btn-ghost.sm — the two sit side by side in list rows
   (booking week nav, geofence rows), where a 2.5px difference reads as a
   wobble in the row. */
.icon-btn.small { width: var(--ctl-h-sm); height: var(--ctl-h-sm); min-height: var(--ctl-h-sm); border-radius: var(--radius-xs); }
/* the card's Trail toggle while its line is drawing */
.detail-actions .icon-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.muted { color: var(--text-3); font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-head h3 { font-size: 15px; font-weight: 700; }

/* ============ DASHBOARD ============ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 12px;
}
.sc-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.sc-total { background: var(--primary-soft); color: var(--primary); }
.sc-moving { background: color-mix(in srgb, var(--st-moving) 14%, transparent); color: var(--st-moving); }
.sc-idle { background: color-mix(in srgb, var(--st-idle) 14%, transparent); color: var(--st-idle); }
.sc-parked { background: color-mix(in srgb, var(--st-parked) 14%, transparent); color: var(--st-parked); }
.sc-nolocate { background: color-mix(in srgb, var(--st-nolocate) 16%, transparent); color: var(--st-nolocate); }
.sc-alarm { background: color-mix(in srgb, var(--st-alarm) 16%, transparent); color: var(--st-alarm); }
.sc-offline { background: var(--gray-soft); color: var(--text-3); }
.sc-body { display: flex; flex-direction: column; }
.sc-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.sc-label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.stat-card.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .05s; }
.stat-card.clickable:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.stat-card.clickable:active { transform: scale(.99); }

/* dashboard tags summary */
.dash-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dash-tag { display: inline-flex; align-items: center; gap: 8px; min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box; padding: 0 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.dash-tag:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.dash-tag .dot { width: 9px; height: 9px; border-radius: 50%; }
.dash-tag b { font-weight: 800; background: var(--surface-2); border-radius: 999px; padding: 1px 9px; font-size: 12px; }

.dash-section-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 12px; }
.dash-section-head h3 { font-size: 14px; font-weight: 700; }
.deliv-cards { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.sc-deliv-active { background: color-mix(in srgb, var(--st-moving) 14%, transparent); color: var(--st-moving); }

/* Dynamic dashboard: ordered card grid (wide cards span both columns) */
.dash-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.dash-topbar .btn-ghost { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* Sheet bar: multiple dashboards, switched like desktops */
.dash-sheets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 30px; }
.dash-sheet { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--radius-pill); padding: 0 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.dash-sheet:hover { border-color: var(--primary); color: var(--text); }
.dash-sheet.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.dash-sheet.add { padding: 0 11px; font-weight: 700; }
.dash-sheet .ds-x { font-size: 10px; opacity: .65; }
.dash-sheet .ds-x:hover { opacity: 1; }
.ds-rename { width: 120px; height: var(--ctl-h-sm); box-sizing: border-box; border: 1.5px solid var(--primary); border-radius: 999px; padding: 0 11px; font-size: 12.5px; font-weight: 600; background: var(--surface); color: var(--text); outline: none; } /* the sheet tab it replaces is --ctl-h-sm */
.dash-sheet-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; border: 1.5px dashed var(--border); border-radius: 14px; }
.dash-sheet-empty p { margin: 0; font-size: 13px; }
/* minmax(0, …), never a bare 1fr: a 1fr track is minmax(auto, 1fr) and grows
   to its widest content's minimum. One wide table (Underutilised vehicles:
   plate, %, idle, last active, badge) pushed EVERY card to 481px on a 390px
   phone and the screen clipped them all. Held to the column, a card's own
   content scrolls inside it instead (.uc-body below). */
.dash-cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dash-card { min-width: 0; }
.dash-card.wide { grid-column: 1 / -1; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }

/* Utilisation cards */
.util-card .card-head h3 { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.uc-scope { font-size: 12px; font-weight: 600; }
.uc-nav { display: flex; align-items: center; gap: 4px; }
.uc-nav .uc-period { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 64px; text-align: center; }
.uc-nav .icon-btn:disabled { opacity: .35; cursor: default; }
.uc-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 12px; }
.uc-kpi { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.uc-num { font-size: 20px; font-weight: 800; line-height: 1.1; }
.uc-num.bad { color: var(--st-alarm); }
.uc-lbl { font-size: 10.5px; font-weight: 600; color: var(--text-3); }
.uc-delta { font-size: 11px; font-weight: 700; }
.uc-delta.up { color: var(--st-moving); }
.uc-delta.down { color: var(--st-alarm); }
.uc-delta.flat { color: var(--text-3); }
.uc-bars { display: flex; flex-direction: column; gap: 5px; }
/* the value column is sized for the widest figure the card can produce — a
   month of driving runs to "223h 29m", and at 44px that wrapped onto a second
   line and pushed the row into its neighbour */
.uc-row { display: grid; grid-template-columns: 92px 1fr 62px; align-items: center; gap: 8px; }
.uc-plate { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-row.flag .uc-plate { color: var(--st-alarm); }
.uc-track { height: 12px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.uc-fill { display: block; height: 100%; background: var(--primary); border-radius: 4px 0 0 4px; }
.uc-val { font-size: 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* a bar pinned at 100% is capped by the track, so the corner it keeps square
   at every other width is the only thing left to say "this one is over" */
.uc-fill.full { border-radius: 4px; }
.uc-more { margin-top: 8px; width: 100%; height: var(--ctl-h-sm); border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-family: var(--font); font-size: 12px; font-weight: 600; cursor: pointer; }
.uc-more:hover { color: var(--primary); border-color: var(--primary); }

/* trend chart */
.uc-svg { width: 100%; height: auto; display: block; }
.uc-svg text { font-family: var(--font); }
.uc-grid { stroke: var(--border); stroke-width: 1; }
.uc-axis { fill: var(--text-3); font-size: 10px; }
.uc-target { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 4 3; }
.uc-area { fill: var(--primary); opacity: .12; }
.uc-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.uc-dot { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }

/* Temperature & Oil chart (sensorchart report): two stacked panels above the
   bucket table. Temperature borrows the orange status token, oil the primary. */
.rep-chart { margin-bottom: 14px; }
.rc-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 6px; margin-bottom: 10px; }
.rc-panel-title { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.rc-unit { color: var(--text-3); font-weight: 600; }
.rc-empty { color: var(--text-3); font-size: 12px; padding: 18px 0; }
.rc-svg { cursor: crosshair; height: 200px; }
.rc-line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rc-line-temperature, .rc-dot-temperature { stroke: var(--st-nolocate); }
.rc-line-oil, .rc-dot-oil { stroke: var(--primary); }
.rc-dot { fill: var(--surface); stroke-width: 2; }
.rc-band { opacity: .14; }
.rc-band-temperature { fill: var(--st-nolocate); }
.rc-band-oil { fill: var(--primary); }
.rc-cursor { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.rc-cursor[hidden] { display: none; }
.rc-readout { font-size: 12px; color: var(--text-2); min-height: 18px; padding: 2px 4px; }
/* refuels on the fuel panel: the band over the rise, its litres, and the list */
.rc-refuel-band { fill: var(--green); opacity: .12; }
.rc-refuel-line { stroke: var(--green); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.rc-refuel-tag { fill: var(--green-soft); stroke: var(--green); stroke-width: 1; }
.rc-refuel-text { fill: var(--text); font-size: 11px; font-weight: 700; }
.rc-refuels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12px; color: var(--text-2); padding: 6px 4px 4px; border-top: 1px solid var(--border); margin-top: 2px; }
.rc-refuels-h { font-weight: 700; color: var(--text); }
.rc-refuel-item b { color: var(--green); }
.rc-refuel-lv { color: var(--text-3); }
.rc-refuels-none { color: var(--text-3); }
/* Fuel drops: the refuel marks' red twin. */
.rc-drop-band { fill: var(--red); opacity: .10; }
.rc-drop-line { stroke: var(--red); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.rc-drop-tag { fill: var(--red-soft); stroke: var(--red); stroke-width: 1; }
.rc-drop-text { fill: var(--text); font-size: 11px; font-weight: 700; }
.rc-drop-item b { color: var(--red); }
.rc-drops { border-top-style: dashed; }
/* A placed refuel or drop opens Google Maps: the tag on the chart and the
   entry in the list under it. */
.rc-ev-link { cursor: pointer; }
a.rc-ev-link:hover .rc-refuel-tag { fill: color-mix(in srgb, var(--green) 24%, var(--surface)); }
a.rc-ev-link:hover .rc-drop-tag { fill: color-mix(in srgb, var(--red) 22%, var(--surface)); }
a.rc-ev-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rc-tag-pin { fill: none; stroke: var(--text-2); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
a.rc-refuel-item { color: inherit; text-decoration: none; border-radius: var(--radius-xs); padding: 1px 4px; margin: -1px -4px; }
a.rc-refuel-item:hover { background: var(--surface-2); }
a.rc-refuel-item:hover .rc-pin { stroke: var(--primary); }
.rc-pin { fill: none; stroke: var(--text-3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; margin-left: 4px; }
/* The litres used: dashed amber on its own right-hand axis, behind a toggle. */
.rc-used-line { fill: none; stroke: var(--amber); stroke-width: 1.8; stroke-dasharray: 6 4; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.rc-used-axis { fill: var(--amber-text); }
.rc-used-btn { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h-sm, 26px); padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.rc-used-btn:hover { background: var(--surface-2); color: var(--text); }
.rc-used-btn.on { border-color: var(--amber); background: var(--amber-soft); color: var(--text); }
.rc-used-btn b { color: var(--amber-text); font-weight: 700; }
.rc-used-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rc-used-sw { width: 14px; height: 0; border-top: 2px dashed var(--amber); }
#rcRefuel { width: 66px; }   /* room for the "auto" placeholder beside the spinner */

/* flagged table */
.uc-body { overflow-x: auto; }   /* a table wider than its card scrolls in the card, not the page */
.uc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.uc-table th { text-align: left; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 5px 8px; border-bottom: 1px solid var(--border); }
.uc-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.uc-table tr:last-child td { border-bottom: none; }
.uc-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; }
.uc-badge.critical { color: var(--st-alarm); background: color-mix(in srgb, var(--st-alarm) 13%, transparent); }
/* orange, for the same reason .uc-num.warn is: "ok" is GREEN here, so a
   green "Elsewhere" badge was indistinguishable from "Authorised" beside it
   and the whole column read as all-clear */
.uc-badge.watch { color: color-mix(in srgb, var(--st-nolocate) 85%, var(--text)); background: color-mix(in srgb, var(--st-nolocate) 16%, transparent); }
.uc-badge.ok { color: color-mix(in srgb, var(--green) 80%, var(--text)); background: color-mix(in srgb, var(--green) 16%, transparent); }

/* ---- operations cards (parking / driving hours / reporting health) ----
   These share the .uc-* chrome above; .oc-* adds only what the glance
   layout needs — a live state strip, count bars, a headline figure and
   the two-column split. */
/* NB: the warning tone uses --st-nolocate, the orange. Pointing "warn" at a
   green or teal status colour paints every caution number like an all-clear
   state. */
.uc-num.warn { color: var(--st-nolocate); }
.uc-fill.warn { background: var(--st-nolocate); }
.uc-fill.bad { background: var(--st-alarm); }
.uc-val.warn { color: var(--st-nolocate); }
.uc-val.bad { color: var(--st-alarm); }

.oc-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.oc-chip { font-size: 11.5px; font-weight: 600; color: var(--text-2); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.oc-chip b { font-weight: 800; color: var(--text); margin-right: 3px; }
.oc-chip.moving { border-color: color-mix(in srgb, var(--st-moving) 45%, var(--border)); }
.oc-chip.moving b { color: var(--st-moving); }
/* engine on but not moving — orange, matching the live map's "burning fuel
   standing still" reading rather than the palette's green idle token */
.oc-chip.idle { border-color: color-mix(in srgb, var(--st-nolocate) 45%, var(--border)); }
.oc-chip.idle b { color: var(--st-nolocate); }
.oc-chip.parked b { color: var(--text); }
.oc-chip.off { border-color: color-mix(in srgb, var(--st-alarm) 45%, var(--border)); }
.oc-chip.off b { color: var(--st-alarm); }

.oc-h { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 12px 0 7px; }
.oc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.oc-half { min-width: 0; }
.oc-half .oc-h:first-child { margin-top: 0; }

/* count bars — parking duration ladder, offline buckets */
.oc-row { display: grid; grid-template-columns: minmax(84px, 34%) 1fr 32px; align-items: center; gap: 8px; margin-bottom: 5px; }
.oc-lbl { font-size: 11.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-track { height: 12px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.oc-fill { display: block; height: 100%; background: var(--primary); border-radius: 4px 0 0 4px; }
.oc-n { font-size: 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.oc-row.good .oc-fill { background: var(--green); }
.oc-row.warn .oc-fill { background: var(--st-nolocate); }
.oc-row.bad .oc-fill { background: var(--st-alarm); }

/* headline figure */
.oc-headline { margin-bottom: 12px; }
.oc-big { font-size: 34px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.oc-big.good { color: var(--green); }
.oc-big.warn { color: var(--st-nolocate); }
.oc-big.bad { color: var(--st-alarm); }
.oc-sub { font-size: 11.5px; font-weight: 600; margin-top: 2px; }
.oc-facts { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.oc-facts b { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.oc-note { font-size: 11px; margin-top: 9px; line-height: 1.45; }
.oc-note.warn-txt { color: var(--st-nolocate); font-weight: 600; }
.oc-table { margin-top: 2px; }

/* night-hours bars — horizontal, on the same grid as the vehicle ranking
   opposite. `.two` flows a long month into newspaper columns so the left half
   ends level with the right instead of running twice its height; the rows are
   plain blocks (not flex) because multi-column only paginates block flow. */
.oc-hbars { column-gap: 26px; }
.oc-hbars.two { column-count: 2; }
.oc-hrow { display: grid; grid-template-columns: 38px 1fr 48px; align-items: center; gap: 6px; margin-bottom: 4px; break-inside: avoid; }
.oc-hrow .oc-track { height: 10px; }
.oc-hlbl { font-size: 10.5px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.oc-hval { font-size: 11px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oc-hrow.zero .oc-hval { color: var(--text-3); font-weight: 600; }

/* authorised-parking picker (card settings modal) */
.dcc-hint { font-size: 11px; line-height: 1.45; margin: 4px 0 8px; }
.dcc-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.dcc-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); cursor: pointer; }
.dcc-cat:has(input:checked) { color: var(--primary); border-color: var(--primary); }
.dcc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.dcc-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 6px 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.dcc-chip.gone { color: var(--st-alarm); border-color: color-mix(in srgb, var(--st-alarm) 45%, var(--border)); text-decoration: line-through; }
.dcc-chip button { border: none; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: 12px; padding: 0 2px; font-family: var(--font); }
.dcc-chip button:hover { opacity: 1; }
/* the picker input sits outside a .field wrapper, so it needs the control
   sizing that .field input would otherwise give it */
#dccAuthAdd { width: 100%; height: var(--ctl-h); box-sizing: border-box; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-family: var(--font); font-size: 13px; }
#dccAuthAdd:focus { outline: none; border-color: var(--primary); }

/* customize modal */
/* The rows carry the same shape as the "Add a card" .btn-ghost buttons below
   them — 1.5px border, --radius-sm, no fill, 12.5px/600 label — so the whole
   modal reads as one control scale instead of two. There is no "hidden card"
   row any more: a card that is off the sheet is an "Add a card" button. */
.dash-cust-list { display: flex; flex-direction: column; gap: 8px; }
.dash-cust-row { display: flex; align-items: center; gap: 9px; min-height: var(--ctl-h-md); box-sizing: border-box; padding: 4px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); cursor: grab; transition: border-color .15s; }
.dash-cust-row:hover { border-color: var(--primary); }
.dash-cust-row.dragging { opacity: .45; }
.dash-cust-row.dragover { border-color: var(--primary); }
.dc-grip { color: var(--text-3); font-size: 12px; letter-spacing: -2px; width: 14px; }
.dc-title { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; }
.dc-title .muted { font-weight: 500; font-size: 12px; }
.dash-cust-row .dc-x:hover { color: var(--st-alarm); }
.dash-cust-add { display: flex; gap: 8px; flex-wrap: wrap; }

.fleet-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--gray-soft); margin-bottom: 12px; }
.fleet-bar span { display: block; height: 100%; }
.fb-moving { background: var(--st-moving); }
.fb-idle { background: var(--st-idle); }
.fb-parked { background: var(--st-parked); }
.fb-nolocate { background: var(--st-nolocate); }
.fb-alarm { background: var(--st-alarm); }
.fb-offline { background: var(--st-offline); }
.fleet-legend { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.fleet-legend span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 500; }
.fleet-legend .dot { width: 9px; height: 9px; border-radius: 50%; }

.dash-list { display: flex; flex-direction: column; }
.dash-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.dash-row:first-child { border-top: none; }
.dash-row .status-dot { flex-shrink: 0; }
.dash-row .dr-plate { font-weight: 600; }
.dash-row .dr-meta { margin-left: auto; color: var(--text-3); font-size: 12px; font-weight: 600; }
.dash-row.clickable { cursor: pointer; border-radius: 8px; }
.dash-row.clickable:hover { background: var(--surface-2); }
.dash-empty { color: var(--text-3); font-size: 13px; padding: 18px 0; text-align: center; }

.dash-alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 4px; border-top: 1px solid var(--border); font-size: 12.5px; cursor: pointer; }
.dash-alert:first-child { border-top: none; }
.dash-alert:hover { background: var(--surface-2); border-radius: 8px; }
.dash-alert .alert-sev { margin-top: 1px; }
.dash-alert .da-body strong { display: block; color: var(--text); font-size: 13px; }
.dash-alert .da-body span { color: var(--text-3); }

/* ============ LIVE MAP VIEW ============ */
.map-view { overflow: hidden; }
/* clip, not just hidden: an overflow:hidden box still SCROLLS when something
   inside it is focused or scrolled into view. The closed vehicle panel sits
   below the map (translated out), so Tab reached its buttons and lifted the
   whole live map 260px off its frame, with no way back short of a reload
   (UI sweep, 2026-11-20). `hidden` stays as the fallback for old browsers. */
@supports (overflow: clip) { .map-view { overflow: clip; } }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 600;
  transition: margin-left .25s ease;
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w)); }

.sidebar-head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }

/* A row picks ONE step of the scale. These four rows each paired a full-size
   control (search box, filter popovers, Day/Week toggle, group toggle) with a
   dense one, which is the same 6px wobble the .sm buttons used to cause — so
   the dense controls in them are promoted to the row's step. */
.search-row { display: flex; gap: 8px; align-items: center; }
.search-row .icon-btn.small { width: var(--ctl-h-md); height: var(--ctl-h-md); min-height: var(--ctl-h-md); border-radius: var(--radius-sm); }
.search-row .search-box { flex: 1; min-width: 0; }
.head-toggle { flex-shrink: 0; border: 1.5px solid var(--border); background: var(--surface); }
.head-toggle.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.head-toggle.active:hover { background: var(--primary); }
.sidebar-head.slim .filter-row,
.sidebar-head.slim .status-strip { display: none; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  height: var(--ctl-h-md); box-sizing: border-box;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 12px; color: var(--text-3);
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--primary); background: var(--surface); }
/* the wrapper carries the height, so the input must not add to it */
.search-box input { flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: none; padding: 0; font-size: 13px; color: var(--text); }
.search-box input::placeholder { color: var(--text-3); }

/* Toolbar-height select: it stands next to .btn-primary / .btn-ghost in the
   trips tools row and the playback bar, so it takes --ctl-h-md. It was 40.5px
   against a 33.5px button. */
.select-inline {
  width: 100%;
  height: var(--ctl-h-md); box-sizing: border-box;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 10px; font-size: 13px; color: var(--text);
  outline: none; transition: border-color .15s;
}
.select-inline:focus { border-color: var(--primary); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
/* Clickable chips all sit on --ctl-h-sm — .seg-btn, .tag-chip, .dash-sheet
   and the .layer-filter chips are the same control wearing different labels,
   and they used to render at 29 / 26 / 28 / 30px. Only the read-only
   .tag-chip.mini badge is deliberately smaller: it is a label, not a target. */
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box;
  padding: 0 11px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
  border: 1.5px solid var(--border); background: var(--surface);
  transition: border-color .15s, background .15s, color .15s;
}
.seg-btn .dot { width: 8px; height: 8px; border-radius: 50%; }
.seg-btn b { font-weight: 800; color: var(--text); }
.seg-btn:hover { border-color: var(--text-3); }
.seg-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }

.tag-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box;
  padding: 0 10px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600;
  border: 1.5px solid var(--border); color: var(--text-2);
  background: var(--surface); transition: border-color .15s, background .15s;
}
.tag-chip:hover { border-color: var(--text-3); }
.tag-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.tag-chip.mini { cursor: default; min-height: 0; padding: 2px 8px; font-size: 11px; }

/* search clear button */
.search-clear { display: grid; place-items: center; background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; border-radius: 50%; }
.search-clear[hidden] { display: none; }
.search-clear:hover { color: var(--text); background: var(--surface-2); }

/* compact filter buttons (fleets + tags popovers) */
.filter-row { display: flex; gap: 8px; }
.filter-row .icon-btn.small { width: var(--ctl-h-md); height: var(--ctl-h-md); min-height: var(--ctl-h-md); border-radius: var(--radius-sm); }
.popover-wrap { position: relative; flex: 1; min-width: 0; }
.popover-wrap[hidden] { display: none; }
.fm-caret { flex-shrink: 0; color: var(--text-3); transition: transform .15s; }
.popover-wrap.open .fm-caret { transform: rotate(180deg); }
.popover-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 6px; max-height: 260px; overflow-y: auto; min-width: 170px;
}
.popover-menu[hidden] { display: none; }
/* The live map's filter row: the shared vehicles picker (vehscope.js), the
   width of the row. Its fleet rows carry the eye that hides a fleet from the
   map and the "Shared with" badge (main.js groupTail). */
.live-scope { flex: 1; min-width: 0; }
.live-scope.rvs-tool { display: block; }
.live-scope.rvs-tool .rvs-btn { width: 100%; max-width: none; } /* over .rvs-tool's own width, set later in the file */
.rvs-grp .fleet-eye { margin: 0; }
.rvs-eye-pad { flex: none; width: 24px; }
.rvs-grp .share-badge { flex: none; max-width: 90px; }

/* slim status strip */
.status-strip { display: flex; flex-direction: column; gap: 7px; }
.status-line { display: flex; align-items: center; justify-content: space-between; }
.status-title { font-size: 12px; font-weight: 700; color: var(--text-2); }
.status-title b { color: var(--text); font-weight: 800; }
.status-reset { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.status-reset[hidden] { display: none; }
.side-fleet-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
.side-fleet-bar span { display: block; height: 100%; }
.status-legend { display: flex; flex-wrap: wrap; gap: 5px; }
.sl-item {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.sl-item .dot { width: 8px; height: 8px; border-radius: 50%; }
.sl-item b { font-weight: 800; color: var(--text); }
.sl-item:hover { border-color: var(--text-3); }
.sl-item.active { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 12%, transparent); color: var(--text); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.v-tags { flex: 1 1 0%; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.v-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; line-height: 1.6; white-space: nowrap; flex-shrink: 0; }
.v-tag.more { background: var(--gray-soft); color: var(--text-2); }

.vehicle-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.vehicle-list::-webkit-scrollbar { width: 8px; }
.vehicle-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* A div, not a button: it holds a real button (the eye), and a button inside
   a button is invalid — main.js gives it role/tabindex and Enter/Space. */
.v-card {
  text-align: left; width: 100%; cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 7px;
}
.v-card:hover { border-color: var(--text-3); box-shadow: var(--shadow-sm); }
.v-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
/* A full card is icon | body; the body keeps the old two-row column. */
.v-card:not(.v-compact) { flex-direction: row; align-items: center; gap: 10px; }
.v-card-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.v-icon { flex: 0 0 auto; width: 36px; height: 36px; color: var(--text-2); display: flex; align-items: center; justify-content: center; }
.v-icon svg { width: 20px; height: 20px; }
/* The type sprites are top-down and nose-up (they rotate with the heading on
   the map); turned to face right they fill the tile instead of a thin sliver. */
.v-icon img { width: 36px; height: 36px; object-fit: contain; transform: rotate(90deg); }
.v-card-top { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--st-offline); }
.status-dot.moving { background: var(--st-moving); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-moving) 22%, transparent); }
.status-dot.idle { background: var(--st-idle); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-idle) 22%, transparent); }
.status-dot.parked { background: var(--st-parked); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-parked) 22%, transparent); }
.status-dot.nolocate { background: var(--st-nolocate); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-nolocate) 22%, transparent); }
.status-dot.alarm { background: var(--st-alarm); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-alarm) 30%, transparent); animation: alarmpulse 1.2s infinite; }
.status-dot.offline { background: var(--st-offline); }
@keyframes alarmpulse { 0%,100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--st-alarm) 35%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--st-alarm) 10%, transparent); } }
.v-plate { font-weight: 700; font-size: 13.5px; flex: 0 0 auto; min-width: 0; white-space: nowrap; color: var(--text); }
.v-speed { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 7px; background: var(--gray-soft); color: var(--text-2); flex-shrink: 0; white-space: nowrap; }
/* The status lives on a thick stripe down the card's left edge, and every
   word on the card stays in plain ink — one colour signal per card, readable
   at a glance while scrolling. The rest of the border is left to hover and
   selection. */
.v-card[data-state="moving"] { --sc: var(--st-moving); }
.v-card[data-state="idle"] { --sc: var(--st-idle); }
.v-card[data-state="parked"] { --sc: var(--st-parked); }
.v-card[data-state="nolocate"] { --sc: var(--st-nolocate); }
.v-card[data-state="alarm"] { --sc: var(--st-alarm); }
.v-card[data-state="offline"] { --sc: var(--st-offline); }
.v-card[data-state],
.v-card[data-state]:hover,
.v-card[data-state].selected { border-left: 5px solid var(--sc); }
/* The selection outline takes the status colour too — the grey border every
   other card has plus the ring is what marks it, not a hue of its own. */
.v-card[data-state].selected { border-color: var(--sc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 22%, transparent); }
.v-card[data-state]:not(.v-compact) { padding-left: 10px; }
.v-card[data-state] .v-speed { color: var(--text); }
.v-card[data-state] .v-card-bottom { color: var(--text); }
/* gap: on a narrow card "1 min ago" and "Ignition OFF" ran together. The
   ignition text is pushed right rather than spaced apart, so the eye can sit
   at the end of the row without moving it — the top row is the crowded one
   (plate + tag pills + speed), and the eye there cost a whole pill. */
.v-card-bottom { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.v-card-bottom .v-ign { margin-left: auto; }
.v-time { display: flex; align-items: center; gap: 5px; min-width: 0; }
/* An older last report ("14 Okt, 20:06") filled the row to the pixel, so the
   time and "Kunci kontak OFF" each broke onto two lines. One line each: the
   ignition keeps its width, the time gives way with an ellipsis. */
.v-time-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-card-bottom .v-ign { white-space: nowrap; flex-shrink: 0; }
.list-empty { text-align: center; color: var(--text-3); padding: 40px 20px; font-size: 13px; }

/* Compact list mode — plates only, two per row */
.list-mode-btn { flex-shrink: 0; border: 1.5px solid var(--border); background: var(--surface); }
.list-mode-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.list-mode-btn.active:hover { background: var(--primary); }
.vehicle-list.compact { flex-direction: row; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.vehicle-list.compact .list-empty { width: 100%; }
.v-card.v-compact { position: relative; width: calc(50% - 3px); flex: 0 0 auto; flex-direction: row; justify-content: center; padding: 9px 8px; }
.v-card.v-compact .v-plate { font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Per-card map visibility. On a full card the eye is always there but quiet;
   on a compact card it would crowd the plate, so it only shows on hover —
   except when the vehicle IS hidden, which has to be readable at a glance. */
.v-eye { flex: 0 0 auto; margin: -5px -4px -5px 0; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: none; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; transition: color .12s, background .12s, opacity .12s; }
.v-eye:hover { background: var(--surface-2); color: var(--text); }
.v-eye.off { color: var(--text-2); background: var(--gray-soft); }
.v-eye.off:hover { color: var(--text); }
/* Fleet-wide eyes: same control as the per-vehicle one, bigger scope. A fleet
   only some of whose cars are hidden shows the open eye with a marker, so a
   half-hidden fleet never reads as fully visible. */
.fleet-eye { margin: 0; }
.v-eye.partial { color: var(--primary); background: var(--primary-soft); }
.fleet-group-head .fleet-eye { margin-right: -4px; }

/* Compact cards are a grid of equal boxes with the plate dead centre, and an
   eye in the flow broke both — every plate shifted left by the space it
   reserved, and a card showing one looked a different shape from its
   neighbours. So it is taken OUT of the flow: geometry is identical to before
   this feature existed, and the icon only appears on hover (or when the
   vehicle is hidden, which has to read at a glance). The shadow is the card's
   own background bled leftward, so a long plate fades out under it instead of
   colliding with it. */
.v-card.v-compact .v-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; margin: 0; opacity: 0;
  background: var(--surface); box-shadow: -7px 0 7px 1px var(--surface);
}
.v-card.v-compact .v-eye:hover { background: var(--surface-2); }
.v-card.v-compact:hover .v-eye,
.v-card.v-compact .v-eye:focus-visible,
.v-card.v-compact .v-eye.off { opacity: 1; }
/* A hidden card's eye never goes away, so give that plate room instead of
   letting the icon sit on its last letters. Tied to the persistent state, not
   to hover, so nothing jumps under the pointer. */
.v-card.v-compact:has(.v-eye.off) .v-plate { padding-right: 20px; }

/* The "N hidden from map" line — only in the DOM's flow while it matters */
.hidden-bar { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 8px; background: var(--gray-soft); color: var(--text-2); font-size: 12px; font-weight: 600; }
.hidden-bar[hidden] { display: none; }
.hidden-bar svg { flex-shrink: 0; }
.hidden-bar span { flex: 1; min-width: 0; }
.hidden-bar-all { flex-shrink: 0; border: none; background: none; padding: 0 0 0 10px; font-size: 12px; font-weight: 700; color: var(--primary); cursor: pointer; }
.hidden-bar-all:hover { text-decoration: underline; }

/* The bar states what the map is showing and carries both actions. Hide all
   and Show all sit side by side while only some are hidden — that is the one
   state where you might want either. */
.hidden-bar .hb-icon { display: flex; flex: 0 0 auto; }
/* the bar is one line: the count never wraps the row taller */
.hidden-bar #hiddenBarText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden-bar-all[hidden] { display: none; }
.hidden-bar.some { background: var(--primary-soft); color: var(--primary); }

/* Group-by-fleet mode — one collapsible section per fleet */
.group-fleet-btn { flex-shrink: 0; border: 1.5px solid var(--border); background: var(--surface); }
.group-fleet-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.group-fleet-btn.active:hover { background: var(--primary); }
.fleet-group-tools { display: flex; justify-content: flex-end; padding: 0 2px; }
.fg-toggle-all { font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 2px 0; line-height: 1.2; background: none; border: 0; }
.fg-toggle-all:hover { color: var(--primary); }
/* no top padding in group mode: the sticky headers pin flush to the list's
   top edge, so no band of scrolling cards ever peeks above them */
.vehicle-list.grouped { padding-top: 0; }
.vehicle-list.grouped .fleet-group-tools { padding-top: 6px; }
.fleet-group { display: flex; flex-direction: column; gap: 8px; }
.fleet-group-head {
  position: sticky; top: 0; z-index: 2; /* the fleet name stays readable while its cars scroll */
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  min-height: var(--ctl-h-md); line-height: 1; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--gray-soft); color: var(--text-2);
  font-size: 12.5px; font-weight: 700;
  transition: border-color .15s;
}
.fleet-group-head:hover { border-color: var(--text-3); color: var(--text); }
.fleet-group-head { cursor: pointer; } /* a div now — it holds the fleet eye */
.fg-caret { flex-shrink: 0; transition: transform .15s; }
.fleet-group.collapsed .fg-caret { transform: rotate(-90deg); }
.fg-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-count { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.fg-pips { margin-left: auto; display: flex; gap: 7px; align-items: center; flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-3); }
.fg-pip { display: flex; align-items: center; gap: 3px; }
.fg-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.fleet-group-body { display: flex; flex-direction: column; gap: 8px; }
.fleet-group.collapsed .fleet-group-body { display: none; }
.fleet-group-body.compact { flex-direction: row; flex-wrap: wrap; gap: 6px; }

.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--border); }
.follow-toggle { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; user-select: none; }
.follow-toggle input { display: none; }
.switch { width: 34px; height: 19px; border-radius: 10px; background: var(--border); position: relative; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 2.5px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: var(--shadow-sm); }
.follow-toggle input:checked + .switch { background: var(--primary); }
.follow-toggle input:checked + .switch::after { transform: translateX(14px); }

.sidebar-collapse {
  position: absolute; left: var(--sidebar-w); top: 14px; z-index: 601;
  width: 24px; height: var(--ctl-h);
  background: var(--surface); border: 1px solid var(--border); border-left: none;
  border-radius: 0 8px 8px 0; color: var(--text-3);
  display: grid; place-items: center;
  transition: left .25s ease; box-shadow: var(--shadow-sm);
}
.map-view:has(.sidebar.collapsed) .sidebar-collapse { left: 0; }
.map-view:has(.sidebar.collapsed) .sidebar-collapse svg { transform: rotate(180deg); }

/* ---- Map ---- */
.map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; z-index: 1; background: var(--surface-2); }

/* Interactive Google Maps underlay (a real google.maps.Map, not tiles).
   When active, Leaflet goes transparent + click-through so Google handles
   panning, POI info windows and Street View; only the vehicle markers and
   their popups stay clickable on the Leaflet layer floating on top. */
#gmap { position: absolute; inset: 0; z-index: 0; display: none; }
.map-wrap.gmap-on #gmap { display: block; }
.map-wrap.gmap-on #map { background: transparent; pointer-events: none; }
.map-wrap.gmap-on #map .leaflet-marker-icon,
.map-wrap.gmap-on #map .leaflet-popup { pointer-events: auto; }

/* ---- "tap the map to place it" mode ----
   Three things have to be true for a placing click to be unambiguous, and each
   needs its own rule:
   1. Leaflet must RECEIVE the click. On the Google Interactive layer the rule
      above makes #map inert, so a map click handler is simply dead there —
      placing mode has to win that back.
   2. Nothing already on the map may swallow the click. Leaflet's own stylesheet
      declares `pointer-events: auto` directly on `.leaflet-interactive`, so
      switching the PANE off does nothing (a declared value on the child beats
      an inherited one). It has to be turned off on the elements themselves, or
      the same click also selects a vehicle and flies away from the spot.
   3. The cursor has to say so. */
.map-wrap.placing #map { pointer-events: auto; cursor: crosshair; }
.map-wrap.placing .leaflet-interactive { pointer-events: none !important; }
.map-wrap.placing .leaflet-container { cursor: crosshair; }

.place-bar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 510;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 140px);
  padding: 8px 10px 8px 14px; border-radius: 10px; background: var(--surface);
  border: 1.5px solid var(--primary); box-shadow: var(--shadow-md); }
.place-bar[hidden] { display: none; }
.place-bar-text { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-bar-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex-shrink: 0; animation: place-pulse 1.4s ease-in-out infinite; }
@keyframes place-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }
@media (prefers-reduced-motion: reduce) { .place-bar-dot { animation: none; } }
.map-wrap.gmap-on .leaflet-control-zoom { display: none; }
[data-theme="dark"] .leaflet-tile { filter: brightness(.7) invert(1) contrast(.85) hue-rotate(190deg) saturate(.45) brightness(.8); }
/* The street map's own land colour (vectorbase.js), so the moment before it
   draws is the same grey. */
.leaflet-container { background: #e6e8eb; }
[data-theme="dark"] .leaflet-container { background: #0b0f1a; }
/* The live map's satellite imagery, muted: the vehicles are drawn with no
   disc behind them, and on full-colour imagery a dark truck sank into the
   roofs. One filter on the layer's container (not per tile, not per pin),
   composited once — the cheap kind of filter, unlike a drop-shadow on every
   marker. Editors keep the imagery as it is: there you are reading it. */
#map .leaflet-layer.base-sat { filter: saturate(.35) contrast(.85) brightness(1.08); }

/* Permanent map labels — with the rest of the map's own styling, not in the
   Cargo status block where these first landed by habit: they label a fence
   or a place, and have nothing to do with a status colour.
   Permanent map labels. Quieter than Leaflet's default tooltip — with every
   fence and place labelled at once these tile the map, so they read as part
   of it rather than as a stack of popups: no arrow, no plate — 10px text with
   a white halo round each letter, the way a map labels its own streets, so a
   name stays readable without covering the map under it — and no pointer
   events so a label never eats a click meant for the shape under it. */
.map-name-tip.leaflet-tooltip { pointer-events: none; background: #ecfeff; border: 0; box-shadow: none;
  color: #155e75; font-size: 9px; font-weight: 700; letter-spacing: .02em; line-height: 10px; padding: 1px 5px;
  border-radius: 6px; white-space: nowrap; }
/* One size at every zoom (map.js); crowding is handled by declutter.js. */
.poi-pin { transform: scale(var(--place-scale, 1)); }
.map-name-tip.leaflet-tooltip::before { display: none; }
/* A name switch belongs to the layer above it, so it is indented and quieter:
   it is a property of that layer, not a fourth choice in the list. */
.lf-name-sub { margin-left: 18px; font-size: 11px; opacity: .8; }
.lf-name-sub.on { opacity: 1; }
/* Cyan like an uncoloured fence (places.js FENCE_LINE, 1 Dec 2026): pale
   tint behind, deep cyan text — light enough to tile a map, never a solid
   plate that reads as a SELECTED vehicle's. */
[data-theme="dark"] .map-name-tip.leaflet-tooltip { background: #083344; color: #a5f3fc; }
/* A place's name (places.js POI_TIP kind "place"): a round pill with a cyan
   dot, so a point reads as a point beside a fence's square badge. 1px border
   + 10px line = 12px, like a fence's; planMap's width estimate adds the dot,
   the gap and the padding (textW + 23). The dot is the tooltip's ::before,
   which Leaflet otherwise uses for the arrow — hence every reset. NO
   box-shadow on these labels, or on the fence badge below: a hairline
   shadow on ~130 names took panning at 4x CPU from 42 to 24-30 fps (1 Dec,
   268 fences on screen); without it the map pans as fast as before. */
.map-name-tip.map-name-place.leaflet-tooltip { border: 1px solid #a5f3fc; border-radius: 999px; padding: 0 6px 0 5px; }
.map-name-tip.map-name-place.leaflet-tooltip::before { display: inline-block; content: ""; position: static;
  width: 6px; height: 6px; margin: 0 4px 0 0; border: 0; border-radius: 50%; background: #06b6d4;
  vertical-align: 0; transform: none; }
[data-theme="dark"] .map-name-tip.map-name-place.leaflet-tooltip { border-color: #155e75; }
/* A fence's name (places.js fenceTip): a square-cornered badge tinted like
   the fence it names — its line colour, paled, as the border, a whisper of
   its fill behind the text — so it reads as that area's and not as a
   place's, and does not sit as a white hole on a pale close-in map. The
   tooltip itself is bare; the span is the badge — 1px border + 10px line =
   12px, like a place's. Text = the line colour darkened, so a pale fence
   stays legible. */
.map-name-tip.map-name-fence.leaflet-tooltip { background: none; padding: 0; border-radius: 0; }
.map-name-fence .mnf { display: block; padding: 0 4px; border: 1px solid color-mix(in srgb, var(--fc) 35%, #fff);
  border-radius: 4px; background: color-mix(in srgb, var(--ff) 8%, #fff); color: color-mix(in srgb, var(--fc) 65%, #000);
  line-height: 10px; }
[data-theme="dark"] .map-name-tip.map-name-fence.leaflet-tooltip { background: none; }
[data-theme="dark"] .map-name-fence .mnf { background: color-mix(in srgb, var(--ff) 18%, #111827);
  color: color-mix(in srgb, var(--fc) 45%, #fff); border-color: color-mix(in srgb, var(--fc) 55%, #111827); }
/* An uncoloured fence's line on the dark map: a step lighter, so it shows on
   dark land. Matched by colour, as that is all the SVG carries; a fence given
   this exact cyan by hand gets the same lift, which is the same cyan anyway. */
[data-theme="dark"] .leaflet-overlay-pane path[stroke="#0891b2"] { stroke: #22d3ee; }
/* A fence's inside band (places.js fenceBand) never takes the pointer: the
   fence's own path under it does. */
.leaflet-overlay-pane .gf-band { pointer-events: none; }
.leaflet-control-zoom a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
/* Layer button on the place + geofence editor maps (map.js addEditorLayerSwitch) */
.map-layer-btn { display: flex; align-items: center; gap: 6px; height: var(--ctl-h); padding: 0 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: color .15s; }
.map-layer-btn:hover { color: var(--primary); }
.map-layer-btn span { color: var(--text); }
.map-layer-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.map-tools { position: absolute; top: 14px; right: 14px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.map-tool { width: var(--ctl-h); height: var(--ctl-h); border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text-2); display: grid; place-items: center; box-shadow: var(--shadow-md); transition: color .15s, background .15s; }
.map-tool:hover { color: var(--primary); }
.map-tool.active { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Trucks of runs shared with this login (sharedlive.js): a pill of their own,
   dashed, so nobody takes one for a vehicle of this fleet. */
.shl-pin { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 99px;
  background: var(--panel, #fff); color: #7c3aed; border: 2px dashed #7c3aed; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  font: 700 11px/1.2 Inter, system-ui, sans-serif; white-space: nowrap; transform: translate(-6px, -4px); }
.shl-pin.moving { background: #7c3aed; color: #fff; border-style: solid; }
.shl-plate { color: inherit; }
.shl-pop { font-size: 12.5px; min-width: 200px; }
.shl-pop-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.shl-badge { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.shl-run { cursor: pointer; padding: 2px 0; }
.shl-run:hover { text-decoration: underline; }
.shl-run-v { padding: 2px 0; }   /* a vehicle share: no trip page to open */
.shl-pop-m { margin-top: 4px; font-weight: 600; }
.shl-pop-t, .shl-addr { margin-top: 2px; font-size: 11.5px; }
.shl-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
/* "Shared with you" above the vehicle list (sharedlive.js): its own section,
   folded to its header on a tap, never mixed into the fleet's rows. */
.shl-list { flex: none; padding: 10px 10px 0; display: flex; flex-direction: column; gap: 6px;
  max-height: 34vh; overflow-y: auto; }
.shl-list[hidden] { display: none; }
.shl-list-h { display: flex; align-items: center; gap: 6px; width: 100%; padding: 2px 2px; background: none; border: 0;
  color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.shl-list-h b { color: var(--text); }
.shl-chev { margin-left: auto; transition: transform .15s; }
.shl-list.folded .shl-chev { transform: rotate(-90deg); }
.shl-list-rows { display: flex; flex-direction: column; gap: 6px; }
.shl-list-rows[hidden] { display: none; }
.shl-row { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px dashed color-mix(in srgb, #7c3aed 55%, var(--border));
  border-radius: var(--radius-sm); padding: 9px 11px; color: var(--text); font: inherit; }
.shl-row:hover { border-color: #7c3aed; }
.shl-row-ico { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.shl-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.shl-row-top { display: flex; align-items: center; gap: 8px; }
.shl-row-top b { font-size: 13.5px; }
.shl-row-spd { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px;
  background: var(--gray-soft, rgba(0,0,0,.06)); color: var(--text-2); white-space: nowrap; }
.shl-row-spd.moving { background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.shl-row-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.v-marker { background: none !important; border: none !important; }
/* --marker-scale is set on #map from the map zoom (map.js) — pins shrink as
   the user zooms out. Origin 35px/44px keeps the pin tip on the anchor. */
.v-marker-inner { display: flex; flex-direction: column; align-items: center; transform: translateY(-4px) scale(var(--marker-scale, 1)); transform-origin: 35px 44px; }
.v-marker-pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: var(--text-3); border: 2.5px solid #fff; box-shadow: var(--shadow-md); display: grid; place-items: center; }
.v-marker-pin svg { transform: rotate(45deg); color: #fff; }
.v-marker-pin.moving { background: var(--st-moving); }
.v-marker-pin.idle { background: var(--st-idle); }
.v-marker-pin.parked { background: var(--st-parked); }
.v-marker-pin.nolocate { background: var(--st-nolocate); }
.v-marker-pin.alarm { background: var(--st-alarm); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-alarm) 40%, transparent), var(--shadow-md); }
.v-marker-pin.offline { background: var(--st-offline); }
.v-marker-pin.untagged { background: var(--st-offline); }

/* Vehicle-type markers (feature `vehicle_icons`): the sprite for the vehicle's
   own type in place of the balloon's generic truck glyph. Same disc, same
   status colours, same anchor — only the artwork and the rotation differ, so
   an account switching the feature on does not have to relearn the map. The
   sprite alone rotates; the disc and the plate label stay upright. */
/* The 3D pin (main.js pinKind "3d": every vehicle with a type): the type's
   artwork, 36px, with nothing round it. Every stock sprite carries a thin
   white sticker edge baked into the file (and an operator's upload gets the
   same edge when it is uploaded — vehicle-types.js outlineIcon), which is
   what keeps a dark vehicle visible on satellite imagery and a white truck
   visible on a white road without a disc behind it. The vehicle's centre
   sits on the fix, not above it like the balloon's tip, so it scales around
   that centre and the plate hangs below it.
   The cast shadow is a soft oval under the vehicle (.v3d-shadow): turned
   with the heading, then pushed down-right in screen space, so it falls the
   same way whichever way the vehicle points. Deliberately NOT a CSS
   drop-shadow: measured with 1,000 pins, the filter alone took zooming from
   ~49 to ~36 fps (p95 frame 38 -> 108 ms). The white edge is in the file
   for the same reason — drawn by the browser it would be that filter. */
/* --st-c, the pin's status colour, is set inline on .v-marker-inner
   (markerHtml) so the glow, the plate's text, and the selected ring, beam
   and plate all read the same one. */
.v-marker-inner.v-marker-3d { --st-c: var(--st-offline); transform: translateY(21px) scale(var(--marker-scale, 1)); transform-origin: 35px 19px; }
.v3d { position: relative; width: 38px; height: 38px; }
/* Unselected there is no ring: a soft glow of the status colour under the
   vehicle and the plate's text colour carry the status, over a base map
   muted so they stand out. One ring per pin — even a single one — turned a
   crowded view into a sheet of coloured dots (user, 2026-11-30). The ring,
   the white gap round it and the glow are the selected pin's alone. */
.v3d-ring { position: absolute; inset: -3px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--st-c) 55%, transparent) 0, color-mix(in srgb, var(--st-c) 28%, transparent) 42%, transparent 70%); }
/* The Truck, Private car and Motorcycle — 96% of the fleet — are painted in
   their status colour (main.js .painted, server icon_tint.js): the vehicle
   itself is the status, so their pins drop the glow. */
.v-marker-inner.v-marker-3d:not(.selected) .v3d.painted .v3d-ring { display: none; }
.v3d-body { position: absolute; inset: 0; display: grid; place-items: center; }
.v3d-shadow { position: absolute; left: 50%; top: 50%; width: 18px; height: 34px; margin: -17px 0 0 -9px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(15, 23, 42, .5), rgba(15, 23, 42, .22) 65%, rgba(15, 23, 42, 0));
  transform: translate(1.5px, 3px) rotate(var(--hd, 0deg)); }
/* Two classes deeper than Leaflet's `.leaflet-container .leaflet-marker-pane
   img { width: auto }`, which otherwise shrinks the box to the artwork's own
   ratio and pins it to the left edge — off the pin's centre. */
.v-marker-inner.v-marker-3d .v3d-body img { display: block; width: 36px; height: 36px; object-fit: contain; transform-origin: 50% 50%; transform: rotate(var(--hd, 0deg)); }
.v3d.offline .v3d-body img { opacity: .7; filter: grayscale(.8); }
/* Unselected, a plain plate with no border and the status colour in its
   text — taken darker so every status reads >= 4.5:1 on the plate (light:
   78% of it with black, 4.7-9.3:1; dark: 80% with white, 5.4-10:1). A
   status-tinted "chip" plate (#1051) and a status border (#1052) were both
   tried and taken back on the user's call (2026-11-30): with the status in
   the glow AND the text, a coloured background or edge on hundreds of plates
   only added noise. The border stays, transparent, so selecting a pin (the
   whole plate in the status colour, below) does not move its text. */
.v-marker-inner.v-marker-3d .v-marker-label { margin-top: 2px; border: 1.5px solid transparent;
  color: color-mix(in srgb, var(--st-c) 78%, #000);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08); }
[data-theme="dark"] .v-marker-inner.v-marker-3d .v-marker-label { color: color-mix(in srgb, var(--st-c) 80%, #fff); }
.v-marker-inner.v-marker-3d.selected .v-marker-label { margin-top: 2px; }
/* Selected: no black outline, no brand colour — the pin's own status colour,
   lifted and lit, all static. The only pin with a ring: a status ring over a
   70% surface-colour backing (a fully see-through one let a dark vehicle sink
   into satellite roofs), a white gap, a second ring and a soft glow; the
   vehicle rises (a touch bigger, its shadow longer); its beam grows longer
   and brighter; and the plate fills with the colour. */
.v-marker-inner.v-marker-3d.selected .v3d-ring { inset: 0; border: 3px solid var(--st-c);
  background: radial-gradient(circle, color-mix(in srgb, var(--st-c) 8%, transparent) 0 40%, color-mix(in srgb, var(--st-c) 30%, transparent) 100%),
    color-mix(in srgb, var(--surface) 70%, transparent);
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 4px var(--st-c), 0 0 12px 5px color-mix(in srgb, var(--st-c) 45%, transparent); }
/* White on the status colour itself measured 3.0-3.7:1 for No GPS, Parked
   and Offline (light) and 2.0:1 for Parked (dark), so the selected plate is
   the status colour taken darker: 75% of it in the light theme, 60% in the
   dark one, where the status colours are brighter — every status >= 5:1. */
.v-marker-inner.v-marker-3d.selected .v-marker-label { --plate-c: color-mix(in srgb, var(--st-c) 75%, #000);
  background: var(--plate-c); border-color: var(--plate-c); color: #fff; }
[data-theme="dark"] .v-marker-inner.v-marker-3d.selected .v-marker-label { --plate-c: color-mix(in srgb, var(--st-c) 60%, #000); }
.v-marker-inner.v-marker-3d.selected .v3d-shadow { transform: translate(3px, 6px) rotate(var(--hd, 0deg)) scale(1.12); opacity: .85; }
.v-marker-inner.v-marker-3d.selected .v3d-body img { scale: 1.08; }
/* The headlight beam: every 3D pin shows which way it faces with a cone of
   its status colour reaching out past the ring — soft and short unselected,
   longer and brighter selected. Static (a gradient under a mask), painted
   once when the pin is built. */
/* The beam is a small picture, not CSS effects: a 52-degree cone from the
   ring's edge, fading with distance, drawn by one SVG per status colour
   (light and dark theme). Measured with 1,000 pins on a 4x slower CPU,
   panning ran at 12 fps with the beam built from a gradient under a
   mask-image or clip-path, against 19 fps with no beam at all — CSS clips
   and masks are what cost, so the shape lives in the image. The element
   covers only the cone (40x21), turned about the pin's centre. Selected,
   it is longer and the same picture is laid twice, which brightens it. */
.v3d-beam { position: absolute; left: 50%; top: 50%; width: 40px; height: 21px; margin: -40px 0 0 -20px;
  transform-origin: 50% 40px; transform: rotate(var(--hd, 0deg)); pointer-events: none;
  background: var(--beam) 0 0 / 100% 100% no-repeat; }
/* Zoomed out (map.js BEAM_ZOOM) only the selected pin keeps its beam. */
#map.beams-off .v-marker-inner.v-marker-3d:not(.selected) .v3d-beam { display: none; }
.v-marker-inner.v-marker-3d.selected .v3d-beam { width: 48px; height: 29px; margin: -48px 0 0 -24px; transform-origin: 50% 48px;
  background: var(--beam) 0 0 / 100% 100% no-repeat, var(--beam) 0 0 / 100% 100% no-repeat; }
.v3d.moving { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%231d4ed8' stop-opacity='.36'/><stop offset='1' stop-color='%231d4ed8' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
.v3d.idle { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%238b5cf6' stop-opacity='.36'/><stop offset='1' stop-color='%238b5cf6' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
.v3d.parked { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%2315a35a' stop-opacity='.36'/><stop offset='1' stop-color='%2315a35a' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
.v3d.nolocate { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%23e07b18' stop-opacity='.36'/><stop offset='1' stop-color='%23e07b18' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
.v3d.offline { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%237c8499' stop-opacity='.36'/><stop offset='1' stop-color='%237c8499' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
.v3d.alarm { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%23dc2626' stop-opacity='.36'/><stop offset='1' stop-color='%23dc2626' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
[data-theme="dark"] .v3d.moving { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%233b82f6' stop-opacity='.36'/><stop offset='1' stop-color='%233b82f6' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
[data-theme="dark"] .v3d.idle { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%23a78bfa' stop-opacity='.36'/><stop offset='1' stop-color='%23a78bfa' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
[data-theme="dark"] .v3d.parked { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%2334d27b' stop-opacity='.36'/><stop offset='1' stop-color='%2334d27b' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
[data-theme="dark"] .v3d.nolocate { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%23f3a623' stop-opacity='.36'/><stop offset='1' stop-color='%23f3a623' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
[data-theme="dark"] .v3d.offline { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%236a7389' stop-opacity='.36'/><stop offset='1' stop-color='%236a7389' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }
[data-theme="dark"] .v3d.alarm { --beam: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 21' preserveAspectRatio='none'><radialGradient id='g' cx='20' cy='40' r='40' gradientUnits='userSpaceOnUse'><stop offset='.46' stop-color='%23f25555' stop-opacity='.36'/><stop offset='1' stop-color='%23f25555' stop-opacity='0'/></radialGradient><path d='M10.7 21H29.3L40 0H0Z' fill='url(%23g)'/></svg>"); }

/* zoomed-out clusters: one badge per group of nearby vehicles, count inside */
.v-cluster { background: none !important; border: none !important; }
.v-cluster-inner { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-family: var(--font); font-weight: 800; font-size: 13px; border: 3px solid rgba(255, 255, 255, .92); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 28%, transparent), var(--shadow-md); cursor: pointer; }
.v-cluster-inner.has-alarm { box-shadow: 0 0 0 4px color-mix(in srgb, var(--st-alarm) 50%, transparent), var(--shadow-md); }
/* A close-in stack (main.js renderStacks): the lead vehicle's own pin with a
   count badge on its shoulder and "+N" on its plate. */
.v-stack .v-marker-inner { position: relative; cursor: pointer; }
.v-stack-n { position: absolute; top: -7px; left: calc(50% + 9px); z-index: 1; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 9px; background: #111827; color: #fff; border: 2px solid #fff;
  font-family: var(--font); font-size: 10px; font-weight: 800; line-height: 14px; text-align: center;
  box-shadow: var(--shadow-sm); }
.v-stack-more { color: var(--primary); font-weight: 800; }
.v-marker-inner.selected .v-stack-more { color: #fff; }
.vc-pick { cursor: pointer; border-radius: 4px; }
.vc-pick:hover { background: var(--surface-2); color: var(--primary); }

/* cluster hover card: vehicles grouped by fence, numbered + sorted by plate.
   A sticky popup (not a tooltip) so the list can be scrolled and clicked. */
.vc-pop .leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); }
.vc-pop .leaflet-popup-content { margin: 10px 14px; font-family: var(--font); line-height: 1.4; }
.vc-pop .leaflet-popup-tip { background: var(--surface); border: 1px solid var(--border); }
.vc-pop .leaflet-popup-close-button { color: var(--text-3); }
.vc-pop .leaflet-popup-close-button:hover { color: var(--text); }
.vc-tip-zoom { width: 100%; margin-top: 9px; height: var(--ctl-h-sm); border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-family: var(--font); font-size: 12px; font-weight: 600; cursor: pointer; transition: color .12s, border-color .12s; }
.vc-tip-zoom:hover { color: var(--primary); border-color: var(--primary); }
.vc-tip-head { font-size: 12.5px; font-weight: 800; padding-bottom: 2px; }
/* rows never wrap — big groups flow into 2–3 columns (column-count inline,
   from the cluster size) instead of one endless strip */
.vc-tip-cols { column-gap: 22px; }
.vc-tip-group { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 7px 0 3px; white-space: nowrap; break-after: avoid; }
.vc-tip-list { margin: 2px 0 0; padding-left: 20px; font-size: 12px; font-weight: 600; break-before: avoid; }
.vc-tip-list li { line-height: 1.6; white-space: nowrap; }
.vc-tip-list li::marker { color: var(--text-3); font-weight: 600; }
.vc-tip .status-dot { width: 7px; height: 7px; display: inline-block; margin: 0 5px 1px 0; }
.vc-tip-more { font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* color-by-region legend — top-left, beside the list's collapse tab. The
   bottom corner it used to sit in is where the detail panel rises, and the
   panel covered it the moment a vehicle was opened. Capped under half the
   map so it stays clear of the panel too. */
.tagcolor-legend { position: absolute; left: 46px; top: 14px; z-index: 460; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 8px; max-width: 210px; max-height: 45%; overflow-y: auto; }
.tagcolor-legend[hidden] { display: none; }
.tcl-hd { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 2px 6px 6px; }
.tcl-note { font-size: 11px; color: var(--text-3); padding: 6px 6px 2px; }
.tcl-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text); background: none; border: none; cursor: pointer; text-align: left; }
.tcl-item[hidden] { display: none; }
.tcl-item:hover { background: var(--surface-2); }
.tcl-item.active { background: var(--primary-soft); }
.tcl-sw { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; background: var(--st-offline); }
.tcl-sw.all { background: conic-gradient(#2563eb, #16a34a, #d97706, #dc2626, #7c3aed, #0d9488, #2563eb); }
/* What happens to the cars the focused region doesn't cover */
.tcl-others { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; padding: 7px 6px 1px; border-top: 1px solid var(--border); }
.tcl-others-hd { font-size: 11px; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.tcl-seg { display: flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--surface-2); }
.tcl-seg-btn { border: none; background: none; padding: 3px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 700; color: var(--text-3); cursor: pointer; }
.tcl-seg-btn:hover { color: var(--text); }
.tcl-seg-btn.sel { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== Multi-view (vehicle wall) ===== */
.multi-wrap { height: 100%; display: flex; flex-direction: column; background: var(--surface-2); }
.multi-toolbar { position: relative; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 9px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; flex-shrink: 0; }
.mv-tb-group { display: flex; align-items: center; gap: 8px; }
.mv-tb-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
/* Segmented track, same construction as .group-toggle:
   padding + a --ctl-h-sm segment = --ctl-h-md, so it lines up with the vehicle
   filter and the pager either side of it. 2px here, not 3px, because this one
   also carries a border. */
.mv-grid-opts { display: inline-flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; box-sizing: border-box; }
.mv-gopt { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box; border: none; background: none; color: var(--text-2); font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: var(--radius-xs); cursor: pointer; transition: color .12s, background .12s; }
.mv-gopt:hover { color: var(--text); }
.mv-gopt.active { background: var(--primary); color: #fff; }
.mv-zoom { accent-color: var(--primary); width: 110px; cursor: pointer; }
.mv-tb-spacer { flex: 1; }
.mv-pager { gap: 6px; }
.mv-pg-btn { min-width: var(--ctl-h-md); height: var(--ctl-h-md); padding: 0 6px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; font-size: 14px; display: grid; place-items: center; transition: color .12s, background .12s; }
.mv-pg-btn:hover { color: var(--primary); }
.mv-pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.mv-pg-info { font-size: 13px; font-weight: 600; color: var(--text-2); min-width: 44px; text-align: center; }
.mv-count { font-size: 12px; color: var(--text-3); font-weight: 600; }

.multi-grid { flex: 1; min-height: 0; display: grid; gap: 4px; padding: 4px; grid-template-columns: repeat(var(--mv-cols, 3), 1fr); grid-template-rows: repeat(var(--mv-cols, 3), 1fr); }
.mv-pane { position: relative; border-radius: 8px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); cursor: pointer; min-height: 0; min-width: 0; transition: border-color .12s, box-shadow .12s; }
.mv-pane:hover { border-color: var(--primary); }
.mv-pane.mv-alarm { border-color: var(--st-alarm); box-shadow: 0 0 0 1.5px var(--st-alarm) inset; }
/* Leaflet forces position:relative on its map container, so size the canvas
   explicitly (width/height 100%) rather than relying on inset:0 to stretch. */
.mv-canvas { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; }
.mv-canvas.leaflet-container { background: var(--surface-2); }
/* plate sits top-left, speed/time bottom-right — opposite corners so they
   never overlap, even on a dense 8×8 wall. */
.mv-top, .mv-bot { position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 5px; max-width: calc(100% - 4px); pointer-events: none; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.mv-top { top: 0; left: 0; padding: 4px 8px 4px 6px; border-radius: 0 0 9px 0; background: color-mix(in srgb, var(--surface) 84%, transparent); }
.mv-bot { bottom: 0; right: 0; padding: 3px 8px; border-radius: 9px 0 0 0; background: color-mix(in srgb, var(--surface) 84%, transparent); }
/* A narrow tile (3×3 on a phone is ~120px) cut "Offline · 06 Okt, 17:5" off
   mid-word; the footer now ends in an ellipsis inside its own width. */
.mv-bot { overflow: hidden; }
.mv-bot .mv-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-plate { font-size: 12px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-meta { font-size: 11px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.mv-pane.mv-empty { background: var(--surface-2); border-style: dashed; cursor: default; }
.mv-pane.mv-empty:hover { border-color: var(--border); }
.mv-pane.mv-empty .mv-canvas { display: none; }
.mv-pane.mv-empty .mv-top { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.mv-pane.mv-empty .mv-bot { display: none; }
.mv-pane.mv-empty .mv-plate { color: var(--text-3); }

/* "Monitor": the shared vehicles picker (vehscope.js, .rvs-tool) */
.mv-veh-wrap { position: relative; }
.mv-pick-plate { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-pick-empty { padding: 16px 8px; text-align: center; color: var(--text-3); font-size: 12px; }

/* zoom in/out buttons (toolbar master zoom) */
.mv-zoom-btn { width: var(--ctl-h-md); height: var(--ctl-h-md); border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; display: grid; place-items: center; transition: color .12s, border-color .12s; }
.mv-zoom-btn:hover { color: var(--primary); border-color: var(--primary); }
.mv-layer-label { font-size: 12px; color: var(--text-2); white-space: nowrap; }

/* per-channel zoom (top-right of each pane, revealed on hover) */
.mv-zoomctl { position: absolute; top: 4px; right: 4px; z-index: 3; display: flex; gap: 3px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.mv-pane:hover .mv-zoomctl { opacity: 1; pointer-events: auto; }
.mv-pane.mv-empty .mv-zoomctl { display: none; }
.mv-zc-btn { width: 21px; height: 21px; border-radius: 6px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; display: grid; place-items: center; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.mv-zc-btn:hover { color: var(--primary); border-color: var(--primary); }
@media (hover: none) { .mv-zoomctl { opacity: 1; pointer-events: auto; } }

/* "+ Add vehicle" empty slot */
.mv-pane.mv-add { cursor: pointer; border-style: dashed; background: var(--surface-2); }
.mv-pane.mv-add:hover { border-color: var(--primary); background: var(--primary-soft); }
.mv-pane.mv-add .status-dot { display: none; }
.mv-pane.mv-add .mv-top { position: static; inset: auto; width: 100%; height: 100%; justify-content: center; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.mv-pane.mv-add .mv-plate { color: var(--text-3); font-weight: 700; font-size: 13px; }
.mv-pane.mv-add:hover .mv-plate { color: var(--primary); }

/* per-pane assign popover */
.mv-assign { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: color-mix(in srgb, var(--text) 28%, transparent); }
.mv-assign[hidden] { display: none; }
.mv-assign-card { width: 320px; max-width: calc(100% - 32px); max-height: 76%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-md); padding: 12px; }
.mv-assign-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--text); padding-bottom: 10px; }
.mv-assign-close { width: 26px; height: 26px; border-radius: 7px; border: none; background: var(--surface-2); color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.mv-assign-close:hover { color: var(--primary); }
.mv-assign-card > input { width: 100%; height: var(--ctl-h-md); padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13px; margin-bottom: 8px; }
.mv-assign-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.mv-assign-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); text-align: left; }
.mv-assign-item:hover { background: var(--surface-2); }
.mv-assign-meta { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-3); }

.mv-marker { background: none !important; border: none !important; }
.mv-pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg); background: var(--st-offline); border: 2px solid #fff; box-shadow: var(--shadow-sm); display: grid; place-items: center; }
.mv-pin svg { transform: rotate(45deg); color: #fff; width: 11px; height: 11px; }
.mv-pin.moving { background: var(--st-moving); }
.mv-pin.idle { background: var(--st-idle); }
.mv-pin.parked { background: var(--st-parked); }
.mv-pin.nolocate { background: var(--st-nolocate); }
.mv-pin.alarm { background: var(--st-alarm); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-alarm) 40%, transparent), var(--shadow-sm); }
.mv-pin.offline { background: var(--st-offline); }

@media (max-width: 780px) {
  .multi-grid { grid-template-rows: none; grid-auto-rows: 38vh; overflow-y: auto; }
  .multi-toolbar { gap: 10px; }
  .mv-tb-spacer { display: none; }
  .mv-count { display: none; }
}

/* Layer filter — shared between the floating map control and the per-page chip bars */
.map-filter { position: absolute; top: 14px; right: 64px; z-index: 500; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 8px; width: 198px; max-height: 72%; overflow-y: auto; }
.map-filter[hidden] { display: none; }
/* The layer panel is the wider one: it lists search results whose names must
   stay readable next to their Geofence / Place / Route label. */
.layer-filter.map-filter { width: 232px; }

/* Routes on the map: a row is swatch + two lines of text + three icon buttons,
   and the panel also carries a vehicle/window form, so it is the widest of the
   floating panels. Still narrow enough to clear the .map-tools column at the
   mobile breakpoint below. */
.mr-panel.map-filter { width: 320px; }
/* 320 + the 64px the tools column reserves overflows a phone, and a panel
   clipped off the left edge loses the swatch that says which line is which. */
@media (max-width: 420px) { .mr-panel.map-filter { width: auto; left: 10px; right: 60px; } }
.mr-empty { margin: 4px 6px 8px; font-size: 12px; color: var(--text-3); line-height: 1.45; }
.mr-row { display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 7px; }
.mr-row { cursor: pointer; }   /* the row brings its line to the front */
.mr-row:hover { background: var(--surface-2); }
.mr-row.off { opacity: .5; }
.mr-row.bad .mr-sw { opacity: .35; }
.mr-sw { width: 16px; height: 16px; border-radius: 5px; border: none; padding: 0; flex-shrink: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.mr-txt { flex: 1; min-width: 0; }
.mr-name { font-size: 12.5px; font-weight: 700; color: var(--text); cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-err { color: var(--red); }
.mr-ic { flex-shrink: 0; display: grid; place-items: center; width: 22px; height: 22px; border: none; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; opacity: .6; }
.mr-ic:hover:not(:disabled) { opacity: 1; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.mr-ic:disabled { opacity: .25; cursor: default; }
.mr-x { font-size: 17px; line-height: 1; }
.mr-x:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
/* No height: this field REPLACES the label text in the row, so it has to be
   the size of that text, not a step on the control scale — pinning it to
   --ctl-h-sm would make the row jump every time someone renames a route. */
.mr-rename { width: 100%; box-sizing: border-box; font-size: 12.5px; line-height: 18px; font-weight: 700; color: var(--text); background: var(--surface-2); border: 1.5px solid var(--primary); border-radius: 5px; padding: 0 5px; outline: none; }
.mr-swatches { padding: 4px 6px 8px 29px; }
.mr-bulk { display: flex; gap: 6px; padding: 6px 6px 2px; }
.mr-bulk button { flex: 1; }
.mr-add { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.mr-add select, .mr-add input[type="datetime-local"] { width: 100%; box-sizing: border-box; height: var(--ctl-h-sm); background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 8px; font-size: 12.5px; color: var(--text); outline: none; }
.mr-add select:focus, .mr-add input:focus { border-color: var(--primary); }
.mr-chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); cursor: pointer; }
.mr-sets { padding: 0 6px 4px; }
.mr-sets-row { display: flex; gap: 6px; margin-top: 6px; }
.mr-sets-row select, .mr-sets-row input[type="text"] { flex: 1; min-width: 0; box-sizing: border-box; height: var(--ctl-h-sm); background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 8px; font-size: 12.5px; color: var(--text); outline: none; }
.mr-sets-row select:focus, .mr-sets-row input:focus { border-color: var(--primary); }
.mr-sets-row .mr-del { flex: 0 0 auto; width: 26px; padding: 0; font-size: 16px; line-height: 1; }

/* The report row's "add this run to the map" button. Its own leading column,
   outside report.columns — narrow, and empty for rows that carry no window. */
/* Two buttons can ride this column — the map overlay (entitled) and the Google
   Maps link (always). Side by side, never stacked: stacking put a second 24px
   button under the first and grew EVERY row of the report from 43px to 67px. */
.rep-mr-h { width: 56px; }
.rep-mr-c { width: 56px; padding-left: 4px !important; padding-right: 0 !important; white-space: nowrap; }
.rep-mr-c .rep-mr { display: inline-grid; vertical-align: middle; }
.rep-mr { display: grid; place-items: center; width: 24px; height: 24px; border: none; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; opacity: .55; transition: opacity .12s, background .12s, color .12s; }
.rep-mr:hover { opacity: 1; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.rep-mr:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* One route's marks. Both are non-interactive so they never steal the hover
   from the line underneath, which is what carries the time/speed readout. */
.mr-end-i { display: block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.mr-end-i.mr-end-b { border-radius: 2px; }
.mr-arrow span { display: block; width: 16px; height: 16px; font-size: 13px; line-height: 16px; text-align: center; text-shadow: 0 0 2px rgba(255,255,255,.9); }

/* Province quick view (toolProvince) — grouped one-click jumps */
.prov-menu { width: 212px; }
.prov-menu .tcl-hd:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 8px; }
.lf-hd { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 2px 6px 6px; }
.lf-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.lf-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-3); background: none; border: none; cursor: pointer; text-align: left; opacity: .6; transition: opacity .12s, background .12s; }
.lf-item.on { color: var(--text); opacity: 1; }
.lf-item:hover { background: var(--surface-2); }
.lf-box { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border); flex-shrink: 0; }
.lf-item.on .lf-box { background: var(--primary); border-color: var(--primary); }
/* Layer row = visibility toggle + a "+" that creates one of that layer's
   objects. The + is a SIBLING of .lf-item, never a child: the panel uses one
   delegated handler that walks up to [data-master], so nesting would toggle
   the layer too (and button-inside-button is invalid HTML). */
.lf-row { display: flex; align-items: center; gap: 2px; }
.lf-row .lf-item { flex: 1 1 auto; width: auto; min-width: 0; }
.lf-add { flex-shrink: 0; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; border: none; background: none; color: var(--text-3); cursor: pointer; opacity: .55; transition: opacity .12s, background .12s, color .12s; }
.lf-add:hover { opacity: 1; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.lf-add:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.lf-sw { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; color: #fff; flex-shrink: 0; }
.lf-sw.lf-uncat { background: var(--text-3); }
.lf-name, .lf-label { flex: 1; }
/* Per-category total on a list-page chip. */
.lf-count { margin-left: 6px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-3); font-size: 10.5px; font-weight: 700; line-height: 16px; }
.layer-filter.chips .lf-item.on .lf-count { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }

/* Per-page chip layout */
.layer-filter.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.layer-filter.chips:empty { display: none; }
.layer-filter.chips .lf-hd { flex-basis: 100%; padding: 2px 0; }
.layer-filter.chips .lf-sep { display: none; }
.layer-filter.chips .lf-item { width: auto; min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0 11px 0 7px; }
.layer-filter.chips .lf-item.on { border-color: var(--primary); background: var(--primary-soft); }

/* Off-map (filtered out) rows in the geofence / places lists */
/* Rows are never greyed for being off the map: the Show on map / Hide on map
   button (.map-pin) is the one indicator, as on the Route fences tab. */
.cat-vis.on { color: var(--primary); }
.v-marker-inner.selected .v-marker-pin { transform: rotate(-45deg) scale(1.14); box-shadow: 0 0 0 3px var(--text), 0 0 0 5px rgba(255,255,255,.92), var(--shadow-md); }
.v-marker-inner.selected .v-marker-label { margin-top: 13px; background: var(--primary); color: #fff; border-color: var(--primary); }
.v-marker-label { margin-top: 5px; background: var(--surface); color: var(--text); border: 1px solid var(--border); font-family: var(--font); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 7px; white-space: nowrap; box-shadow: var(--shadow-sm); }

/* ============ DETAIL PANEL ============ */
.detail-panel {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  max-width: 980px; margin: 0 auto; z-index: 450;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 4px 18px 16px;
  transform: translateY(calc(100% + 24px));
  transition: transform .3s cubic-bezier(.32,.72,.33,1);
}
.detail-panel.open { transform: translateY(0); }
/* Desktop: the right edge is the map's control column — the tools at the top,
   Leaflet's zoom buttons at the bottom, both 14px in. The detail panel and the
   playback bar stop short of it, so the zoom buttons stay beside them in their
   corner instead of being lifted onto the panel. The lift below is the
   fallback for an overlay that still reaches the corner (main.js measures
   it); with this inset it does not. */
@media (min-width: 821px) {
  #view-live .detail-panel, #view-live .playback-bar { right: calc(var(--ctl-h) + 28px); }
  #view-live .leaflet-bottom.leaflet-right .leaflet-control-zoom { margin: 0 14px 14px 0; }
  #view-live .leaflet-control-zoom { position: relative; bottom: 0; right: 0; transition: bottom .28s ease, right .28s ease; }
  #view-live:has(.detail-panel.open:not(.collapsed)) .leaflet-control-zoom.lifted,
  #view-live:has(.playback-bar:not([hidden])) .leaflet-control-zoom.lifted {
    bottom: calc(var(--overlay-h, 0px) + 8px); right: calc(var(--ctl-h) + 12px);
  }
}
/* collapsed: slide down so only the grab strip peeks above the bottom edge */
.detail-panel.open.collapsed { transform: translateY(calc(100% - 32px)); }
.detail-grab { display: flex; justify-content: center; padding: 6px 0 2px; cursor: pointer; }
.detail-grab span { width: 38px; height: 4px; border-radius: 2px; background: var(--border); transition: background .15s, width .15s; }
.detail-grab:hover span { width: 52px; background: var(--text-3); }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 12px; }
.detail-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.detail-title h2 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.detail-tags { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#detailPanel [data-field][hidden] { display: none !important; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: var(--badge-h); line-height: 1; box-sizing: border-box; font-size: 11px; font-weight: 700; padding: 0 10px; border-radius: var(--radius-pill); background: var(--gray-soft); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.chip.moving { background: color-mix(in srgb, var(--st-moving) 14%, transparent); color: var(--st-moving); }
.chip.idle { background: color-mix(in srgb, var(--st-idle) 14%, transparent); color: var(--st-idle); }
.chip.parked { background: color-mix(in srgb, var(--st-parked) 14%, transparent); color: var(--st-parked); }
.chip.nolocate { background: color-mix(in srgb, var(--st-nolocate) 16%, transparent); color: var(--st-nolocate); }
.chip.alarm { background: color-mix(in srgb, var(--st-alarm) 16%, transparent); color: var(--st-alarm); }
.chip.offline { background: var(--gray-soft); color: var(--text-3); }
.detail-actions { display: flex; align-items: center; gap: 8px; }
/* The detail panel is a 320px sidebar carrying two text buttons and up to six
   icon buttons on one line, so the whole row takes the dense step of the
   scale. Pairing a full-size .btn-ghost with an .icon-btn.small is what made
   this row look ragged. */
.detail-actions .btn-ghost { min-height: var(--ctl-h-sm); font-size: 12px; padding: 0 10px; border-radius: var(--radius-xs); }
.detail-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.metric { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric[hidden] { display: none !important; }
.metric-wide { grid-column: span 3; }
.m-span2 { grid-column: span 2; }
.m-span3 { grid-column: span 3; }
.m-span4 { grid-column: span 4; }
.metric-wrap .metric-value { white-space: normal; overflow: visible; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* field show/hide config popover */
.field-cfg { position: relative; }
.field-cfg-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 6px; max-height: 320px; overflow-y: auto; }
.field-cfg-menu[hidden] { display: none; }
.field-cfg-hd { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 4px 8px 6px; }
.fc-opt { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; }
.fc-opt:hover { background: var(--surface-2); }
/* ---- Compact detail card ----
   The same tiles as the standard card, restyled: readings become one
   wrapping strip of icon + value (no address — the full card has it), and
   the less-used actions (Zoom and the field menu too) fold behind ⋯. A field the
   user switched off is hidden here too, because it is the same element. */
.d-more, .d-more-menu { display: contents; }
#dBtnMore { display: none; }
#dBtnPlayback { order: -2; }
#dBtnTrack, #dBtnZoom { order: -1; }   /* standard row: Trail, Zoom right after History */
#dBtnCompact[aria-pressed="true"] .ic-shrink, #dBtnCompact[aria-pressed="false"] .ic-grow { display: none; }
.detail-panel.compact .d-more { display: block; position: relative; }
.detail-panel.compact #dBtnMore { display: inline-grid; }
.detail-panel.compact .d-more-menu { display: none; }
/* The card sits on the bottom edge of the map, and its compact form is too
   short to hold a popover opening downwards — the field menu ran off the
   screen. So both the ⋯ row and the field menu inside it open upwards, over
   the map, and the phone card (overflow-y:auto, which would clip them) lets
   them out: everything compact fits without scrolling anyway. */
.detail-panel.compact .d-more.open .d-more-menu {
  display: flex; gap: 6px; position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 6px; }
.detail-panel.compact .field-cfg-menu { top: auto; bottom: calc(100% + 12px); max-height: min(320px, 45vh); }
@media (max-width: 820px) { .detail-panel.compact { overflow: visible; } }
.detail-panel.compact .detail-head { padding: 4px 0 8px; }
.detail-panel.compact .detail-tags { display: none; }
.detail-panel.compact .detail-grid {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  border-top: 1px solid var(--border); padding-top: 8px; }
.detail-panel.compact .metric {
  background: none; padding: 0; border-radius: 0; flex-direction: row; align-items: center; gap: 5px; min-height: 22px; }
.detail-panel.compact .metric::before {
  content: ""; flex: none; width: 14px; height: 14px; background: var(--text-3);
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.detail-panel.compact .metric-label,
.detail-panel.compact #dOilRaw,
.detail-panel.compact #dTotalWrap,
.detail-panel.compact #dFixAtLine,
.detail-panel.compact [data-field="fleet"],
.detail-panel.compact [data-field="device_no"],
.detail-panel.compact [data-field="io_status"],
.detail-panel.compact [data-field="address"],
.detail-panel.compact [data-field="subscription"] { display: none !important; }
.detail-panel.compact .metric-value { font-size: 13px; white-space: nowrap; }
.detail-panel.compact .metric-value b { font-size: 13px; }
/* most-asked first: how fast, how fresh */
.detail-panel.compact [data-field="speed"] { order: -2; }
.detail-panel.compact [data-field="last_update"] { order: -1; }
.detail-panel.compact .metric-mileage .mm-part:first-child .metric-value::after { content: " today"; font-weight: 500; color: var(--text-3); }
.detail-panel.compact .metric-driver .metric-value { flex-wrap: nowrap; }
.detail-panel.compact .metric-driver .dr-line { flex: 0 1 auto; }
.detail-panel.compact [data-field="speed"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 18a8 8 0 1 1 14 0'/%3E%3Cpath d='m12 13 4-4'/%3E%3C/svg%3E"); }
.detail-panel.compact [data-field="last_update"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.detail-panel.compact [data-field="ignition"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7.5' cy='15.5' r='4.5'/%3E%3Cpath d='m10.7 12.3 8.3-8.3M16 5l3 3'/%3E%3C/svg%3E"); }
.detail-panel.compact [data-field="battery"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='16' height='10' rx='2'/%3E%3Cpath d='M22 11v2M7 10v4M11 10v4'/%3E%3C/svg%3E"); }
.detail-panel.compact [data-field="temperature"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 14.8V5a2 2 0 0 0-4 0v9.8a4 4 0 1 0 4 0z'/%3E%3C/svg%3E"); }
.detail-panel.compact [data-field="oil"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v16M3 21h12M4 10h10M14 8h2a2 2 0 0 1 2 2v6a1.5 1.5 0 0 0 3 0V9l-3-3'/%3E%3C/svg%3E"); }
.detail-panel.compact [data-field="mileage"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20 8 4M20 20 16 4M12 6v2M12 11v2M12 16v2'/%3E%3C/svg%3E"); }
.detail-panel.compact [data-field="driver"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"); }
/* Settings ▸ Live map on open: three layers × show / names. */
.ml-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 18px; align-items: center; justify-items: center; max-width: 280px; }
.ml-grid .ml-row-label { justify-self: start; font-size: 13px; color: var(--text); }
.ml-grid .ml-h { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.ml-grid input { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); }
.ml-grid input:disabled { opacity: .4; }
.fc-opt input { width: 15px; height: 15px; accent-color: var(--primary); flex-shrink: 0; }
.metric-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-size: 13px; font-weight: 500; color: var(--text-2); white-space: normal; overflow-wrap: break-word; }
.metric-value b { font-size: 15px; font-weight: 800; color: var(--text); }
.metric-value.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; }
.metric-value.on { color: var(--green); font-weight: 700; }
.metric-value.off { color: var(--text-3); font-weight: 700; }
/* under Last update: the newest report had no GPS lock, so the pin is from
   this time (main.js renderDetail, domain.js staleFixAt) */
.metric-sub { font-size: 11.5px; font-weight: 600; color: var(--amber-text); overflow-wrap: break-word; }
.metric-sub > span { white-space: nowrap; }   /* a narrow tile wraps before the date, never inside it */
.io-chip { display: inline-grid; place-items: center; min-width: 26px; height: var(--badge-h); border-radius: var(--radius-xs); font-size: 11px; font-weight: 700; background: var(--gray-soft); color: var(--text-3); margin-right: 4px; padding: 0 6px; }
.io-chip.on { background: var(--green-soft); color: var(--green); }
/* named I/O channels (per-vehicle labelled inputs, e.g. door / wingbox) */
.io-named { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--gray-soft); color: var(--text-2); margin-right: 4px; white-space: nowrap; }
.io-named b { font-size: 11px; font-weight: 800; color: var(--text); }
.io-named.alert { background: var(--red-soft, #fde8e8); color: var(--red, #c0392b); }
.io-named.alert b { color: var(--red, #c0392b); }
.link-btn { color: var(--primary); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ============ PLAYBACK ============ */
.playback-bar {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  max-width: 880px; margin: 0 auto; z-index: 470;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 10px;
}
.playback-bar[hidden] { display: none; }
/* The phone caps the bar's height and scrolls it; without this the column
   squeezed its rows instead, and the wrapped List / Add to routes line was
   drawn over the date presets. */
.playback-bar > * { flex-shrink: 0; }
/* Out of the flow: anchored to the panel corner, never carried around by a wrap */
.pb-close { position: absolute; top: 9px; right: 10px; z-index: 1; }
/* Plate + result + actions. min-height holds the row before a load, when
   #pbInfo is empty; the right padding keeps it clear of the close button. */
.pb-top { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-height: var(--ctl-h-sm); padding-right: 76px; }
/* Minimise sits left of Close, out of the flow like it */
.pb-min { position: absolute; top: 9px; right: 44px; z-index: 1; }
.pb-min svg { transition: transform .2s ease; }
/* Minimised: plate + transport only — the window, legend, options and the
   result's actions come back with the full bar. */
.playback-bar.min { gap: 6px; }
.playback-bar.min .pb-min svg { transform: rotate(180deg); }
.playback-bar.min .pb-head, .playback-bar.min .pb-options,
.playback-bar.min .pb-legend, .playback-bar.min .pb-actions,
.playback-bar.min #pbInfo { display: none; }
.pb-top strong { font-size: 14px; white-space: nowrap; }
/* Basis auto, not 0: with the Report button and the distance beside the plate,
   a zero basis crushed "7 points" into a one-word column on a phone. Now it
   moves down a line as a whole, and still grows to push the actions right. */
.pb-top #pbInfo { flex: 1 1 auto; min-width: 0; font-size: 12.5px; }
/* The window's distance: the number a reader opens History for, so it reads
   beside the plate in the plate's ink, ahead of the muted point counts. */
.pb-km { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pb-km[hidden] { display: none; }
/* Back to the report row that opened this playback (track.js setBack). */
.pb-back { display: inline-flex; align-items: center; gap: 3px; padding: 0 9px 0 5px; flex: none; }
.pb-back[hidden] { display: none; }
.pb-actions { display: inline-flex; align-items: center; gap: 8px; flex: none; }
/* Query row only — presets / range / Load. */
.pb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* presets / dates / Load / speed share one 34px height so the row lines up */
.pb-head input[type="date"], .pb-head input[type="time"] { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); height: var(--ctl-h-md); padding: 0 10px; font-size: 13px; color: var(--text); outline: none; }
.pb-head input[type="date"]::-webkit-calendar-picker-indicator, .pb-head input[type="time"]::-webkit-calendar-picker-indicator { filter: var(--cal-filter, none); }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
/* height/centring now come from the shared button rule (--ctl-h-md). */
.pb-head .btn-ghost { padding: 0 13px; }
.pb-presets { display: flex; gap: 4px; }
.pb-range { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pb-preset { font-size: 11.5px; font-weight: 600; height: var(--ctl-h-md); padding: 0 11px; display: inline-flex; align-items: center; border-radius: var(--radius-sm); border: 1.5px solid var(--border); color: var(--text-2); transition: border-color .15s, color .15s, background .15s; }
.pb-preset:hover { border-color: var(--primary); color: var(--primary); }
.pb-preset.active { background: var(--primary); border-color: var(--primary); color: #fff; }
/* top-aligned: play and speed sit level with the slider, not halfway down the
   slider + strip + axis + legend stack */
.pb-controls { display: flex; align-items: flex-start; gap: 10px; }
.pb-controls .pb-track { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pb-controls input[type="range"] { width: 100%; margin: 0; accent-color: #d6249a; } /* magenta — must not read as a vehicle status colour */
.pb-controls input[type="range"]:disabled { opacity: .4; }
/* Status strip under the scrubber — live-view status colours over the time axis */
.pb-statusbar { height: 7px; border-radius: 4px; background: var(--surface-2); }
.pb-statusbar[hidden], .pb-axis[hidden], .pb-legend[hidden] { display: none; }
/* Hover/click target around the 7px strip. The padding gives the pointer
   something to hit; the negative margin gives the height straight back so the
   playback bar's row layout is unchanged. */
.pb-strip-wrap { position: relative; padding: 5px 0; margin: -5px 0; cursor: pointer; }
.pb-strip-cursor { position: absolute; top: 5px; bottom: 5px; width: 1px; background: var(--text-2); pointer-events: none; }
.pb-strip-cursor[hidden], .pb-strip-tip[hidden] { display: none; }
/* Band read-out. Centred on the cursor and clamped in JS so it can't spill
   out of the panel; never eats the pointer, or hover would flicker. */
.pb-strip-tip {
  position: absolute; bottom: calc(100% + 2px); transform: translateX(-50%);
  z-index: 2; pointer-events: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow-md); padding: 7px 10px;
}
.pb-tip-t { font-size: 12px; font-weight: 800; color: var(--text); }
.pb-tip-st { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--text-2); margin-top: 3px; }
.pb-tip-st i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.pb-tip-r { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
/* window start | scrubbed-to moment (promoted) | window end */
.pb-axis { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 8px; font-size: 10px; color: var(--text-3); }
.pb-axis > :last-child { text-align: right; }
.pb-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 12px; }
.pb-leg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--text-2); }
.pb-leg i { width: 9px; height: 9px; border-radius: 3px; }
/* Alarm-count badge in the playback bar — click opens the Alerts view list */
.pb-alerts { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 8px; border: none; cursor: pointer; font-size: 12px; font-weight: 800; background: color-mix(in srgb, var(--st-alarm) 13%, transparent); color: var(--st-alarm); }
.pb-alerts[hidden] { display: none; }
.pb-alerts:disabled { opacity: .45; cursor: default; }
.pb-play { display: grid; place-items: center; width: 38px; height: var(--ctl-h-md); padding: 0; }
.pb-play:disabled { opacity: .5; cursor: default; }
.pb-speed { width: auto; margin-top: 0; padding: 0 8px; flex: none; }
/* the scrubber's value — sits under the thumb's track, between t0 and t1 */
.pb-time { font-size: 12px; font-weight: 700; color: var(--text); text-align: center; }
/* time · speed, then distance so far — each half kept whole, so a phone-width
   bar breaks between them rather than spilling sideways (track.js) */
.pb-time > span { white-space: nowrap; }
.pb-run { font-variant-numeric: tabular-nums; }
.pb-options { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
.pb-marker { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: var(--shadow-md); }
/* Playback close-up: a small second map on the bar's top-right corner.
   track.js sets its right/bottom from the bar's box, so it rides the bar
   however many rows the bar wraps into. Not interactive — it only shows. */
.pb-inset {
  position: absolute; z-index: 471; width: 300px; height: 200px;
  cursor: grab; touch-action: none; user-select: none;
  border-radius: var(--radius); overflow: hidden; background: var(--gray-soft);
  border: 2px solid var(--surface); box-shadow: var(--shadow-lg);
}
.pb-inset[hidden], .pb-inset-show[hidden] { display: none; }
.pb-inset-map { position: absolute; inset: 0; background: var(--gray-soft); }
.pb-inset-map.leaflet-container, .pb-inset-map * { cursor: inherit !important; }
.pb-inset.dragging { cursor: grabbing; box-shadow: 0 18px 48px rgba(16, 24, 40, .28); }
/* just the hide button, top-right — no zoom readout: the box is a view */
.pb-inset-head {
  position: absolute; top: 6px; right: 6px; z-index: 500;
  display: flex; align-items: center; pointer-events: none;
}
.pb-inset-btn {
  pointer-events: auto; width: 24px; height: 24px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.pb-inset .pb-marker { width: 20px; height: 20px; }
.pb-inset-show {
  position: absolute; z-index: 465; display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-md);
  font: 600 12px var(--font); cursor: pointer;
}
/* the main map's outline of what the close-up shows */
.pb-lens { pointer-events: none; }
@media (max-width: 820px) {
  .pb-inset { width: 168px; height: 124px; }
}
.pb-stop { width: 18px; height: 18px; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg); background: var(--text-2); border: 2px solid #fff; box-shadow: var(--shadow-sm); display: grid; place-items: center; color: #fff; }
.pb-stop svg { transform: rotate(45deg); }
.pb-options .follow-toggle { gap: 7px; white-space: nowrap; }
.pb-clean { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-clean:has(#pbClean:not(:checked)) .pb-clean-fields { opacity: .45; }
.pb-clean-fields { display: inline-flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.pb-clean-fields label { display: inline-flex; align-items: center; gap: 5px; }
.pb-clean-fields input { width: 44px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 12.5px; }
/* History Track Colour (entitlement history_track_color): reads like its neighbours, with the
   line's colour where they have a switch; opens the preset popover (track.js). */
.pb-color { display: inline-flex; align-items: center; gap: 7px; padding: 2px 0; border: 0; background: none;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.pb-color[hidden] { display: none; }
/* a short stroke of the route itself, the switch's width */
.pb-color i { width: 34px; height: 6px; border-radius: 3px; flex: none; background: var(--pb-col, #2563eb); }
.pb-color:hover { color: var(--text); }
/* On the legend row it is the last entry, set apart at the row's end and at
   the legend's scale: the line's swatch beside the status swatches. */
.pb-legend .pb-color { margin-left: auto; padding: 0; gap: 5px; font-size: 11px; color: var(--text-2); }
.pb-legend .pb-color:hover { color: var(--text); }
.pb-legend .pb-color i { width: 22px; height: 5px; }
#map.playback-on .v-marker { display: none; }
#map.playback-on .v-marker.pb-keep { display: block; }
#map.playback-on .v-cluster { display: none; }

/* ============ REPORTS / ALERTS / GEOFENCE ============ */
.report-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.field label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.planned-row { display: flex; gap: 8px; }
.planned-row #tripDate { flex: 2; }
.planned-row #tripTime { flex: 1; }
.field-hint { font-size: 10.5px; line-height: 1.35; color: var(--text-3); }
.field select, .field input, .field textarea { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13px; color: var(--text); outline: none; transition: border-color .15s; height: var(--ctl-h); box-sizing: border-box; }
/* textareas grow, not clamp: multi-line by nature */
.field textarea { height: auto; min-height: 58px; resize: vertical; font-family: var(--font); line-height: 1.45; }
/* native (macOS) selects ignore padding/height, rendering shorter than the
   inputs next to them — flatten them and draw our own chevron */
.field select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
[data-theme="dark"] .field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
/* the 40px height is for text-like controls only — checkboxes/radios nested
   inside a .field (e.g. the live-share vehicle list) keep their natural size */
.field input[type="checkbox"], .field input[type="radio"] { height: auto; }
.field select:focus, .field input:focus, .field textarea:focus { border-color: var(--primary); }
[data-theme="dark"] .field input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
/* Every control in the filter card sits on the same 40px height so the
   selects, date/time inputs, threshold fields and Generate button align. */
.report-controls .field select,
.report-controls .field input,
.report-controls .btn-ghost,
.report-controls .btn-primary { height: var(--ctl-h); min-height: var(--ctl-h); box-sizing: border-box; }
/* Settings sits in the same row as Generate, so it takes the same height and
   the same icon+label shape as the app's other icon buttons (SVG, not an
   emoji, which renders at its own size on every platform). */
.rep-settings-btn { display: inline-flex; align-items: center; gap: 7px; }
.rep-actions { display: flex; gap: 12px; align-items: flex-end; }
/* shown only for the report types whose rows the saved-place radius reaches */
.rep-settings-btn[hidden] { display: none; }
.report-controls .idle-inputs { height: var(--ctl-h); }
/* What the chosen report shows — a full row of its own under the controls,
   rewritten whenever the type changes (reports.js REPORT_DESC). */
.rep-desc { flex: 1 1 100%; margin: -2px 0 0; font-size: 12px; line-height: 1.45; color: var(--text-2); }
.rep-desc:empty { display: none; }
/* On a phone every control takes the full width: the selects otherwise sized
   to their own content and read as three different widths stacked. */
@media (max-width: 600px) {
  .report-controls > .field { flex: 1 1 100%; }
}
/* Device Data Log's filters: ACC, GPS, gap, speed. Four groups outgrow a
   phone, so the row wraps (each group stays whole) instead of spilling out. */
.raw-filters select { width: auto; min-width: 104px; }
.report-controls .idle-inputs.raw-filters { flex-wrap: wrap; height: auto; min-height: var(--ctl-h); row-gap: 6px; }
/* A date and its time are one value, so they share one box: the time sits
   behind a hairline inside the date's border instead of in a second field.
   Report From/To and the History (playback) range use the same box. */
.dt-row { display: inline-flex; align-items: stretch; box-sizing: border-box; height: var(--ctl-h); background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color .15s; }
.field .dt-row { display: flex; }
.pb-head .dt-row { height: var(--ctl-h-md); }
.dt-row:focus-within { border-color: var(--primary); }
.dt-row input[type="date"], .dt-row input[type="time"],
.field .dt-row input[type="date"], .field .dt-row input[type="time"],
.pb-head .dt-row input[type="date"], .pb-head .dt-row input[type="time"] { height: 100%; border: 0; border-radius: 0; background: transparent; }
.dt-row input[type="date"] { flex: 1 1 auto; min-width: 118px; }
.dt-row input[type="time"] { width: 84px; flex: 0 0 auto; border-left: 1px solid var(--border) !important; padding: 0 6px 0 9px; }
/* iPhone Safari draws a date's value centred and on a line taller than the
   19px a 40px box keeps after 9px top and bottom padding, so the date sank
   below the middle, off the left edge every select above it starts at (the
   time beside it, with no vertical padding, sat right). Dates and times get
   no vertical padding, and their value starts at the left like any field. */
.field input[type="date"], .field input[type="time"] { padding-top: 0; padding-bottom: 0; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
/* Report From's label line: the label, and "‹ Whole week · Whole month ›" at its right
   end — small text buttons, so they add no row and no height to the form. */
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* height 0: the buttons centre on the label line and spill over it, so a
   taller hit box never grows the line */
.rep-month { display: inline-flex; align-items: center; height: 0; }
.rep-month button { border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1; padding: 3px 5px; border-radius: var(--radius-xs); cursor: pointer; white-space: nowrap; }
.rep-month button[data-step="-1"], .rep-month button[data-step="1"] { font-size: 15px; padding: 1px 6px 3px; }
.rep-month button:hover { background: var(--primary-soft); }
/* the unit the range already is (a Mon–Sun week, a whole month): the one ‹ › step by */
.rep-month button[aria-pressed="true"] { background: var(--primary-soft); }
.rep-month-sep { color: var(--text-3); font-size: 11.5px; line-height: 1; }
/* --primary alone is 4.1:1 on the dark card; small text needs a lighter tint */
[data-theme="dark"] .rep-month button { color: color-mix(in srgb, var(--primary) 65%, #fff); }
.rep-month button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* a finger needs more than the 18px the text takes */
@media (pointer: coarse) { .rep-month button, .rep-month button[data-step="-1"], .rep-month button[data-step="1"] { padding-top: 7px; padding-bottom: 7px; } }
[data-theme="dark"] .field input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.report-result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.report-result-head h3 { font-size: 15px; font-weight: 700; }
.report-result-actions { display: flex; gap: 8px; flex-shrink: 0; }
/* Oldest / Newest first: a select dressed as the ghost buttons beside it. */
.rep-order {
  min-height: var(--ctl-h-md); box-sizing: border-box; padding: 0 8px 0 10px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.rep-order:hover, .rep-order:focus-visible { border-color: var(--primary); color: var(--primary); }
.rep-order[hidden] { display: none; }
/* On a phone the title takes its own line and the controls wrap under it:
   with the order picker added, one row ran Export off the right edge and
   squeezed the title into a column one word wide. */
@media (max-width: 780px) {
  .report-result-head { flex-wrap: wrap; }
  .report-result-head h3 { flex: 1 1 100%; }
  .report-result-actions { flex-wrap: wrap; flex-shrink: 1; }
}
.rep-coord { color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap; }
.rep-coord:hover { text-decoration: underline; text-underline-offset: 2px; }
/* The name (or address) and its action button stay on ONE line: the marks
   added to the chips widened them enough to wrap the button onto its own row,
   which read as a second, empty cell. A long address ellipsises instead. */
.rep-addr-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; max-width: 100%; }
/* One block for the chip. The truncation used to sit on .rep-place itself as
   `display:inline-block`, which overrode the inline-flex below — the mark then
   stopped centring and the two chip types rendered at different heights. The
   name truncates on its own span instead, so the chip stays a flex row. */
.rep-place { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0;
  min-height: var(--badge-h); line-height: 1; box-sizing: border-box; padding: 0 8px;
  border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; white-space: nowrap; }
.rep-place .rep-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rep-mk { width: 11px; height: 11px; flex-shrink: 0; }
.rep-place.poi { background: var(--green-soft); color: var(--green); }
.rep-place.fence { background: var(--primary-soft, rgba(37,99,235,.12)); color: var(--primary); }
.rep-place.area { background: var(--gray-soft); color: var(--text-2); }
/* "still there" behind a Trip Event Multiple stop (reports.placeCell) */
.rep-place-note { margin-left: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.rep-place-note::before { content: "· "; }
/* "+N": the other names for the point (reports.js placeChain). Opened, the
   cell may wrap — the chips beside the first are the whole point of opening. */
.rep-place-more { flex-shrink: 0; min-height: var(--badge-h); padding: 0 7px; border: 0; border-radius: var(--radius-pill);
  background: var(--gray-soft); color: var(--text-2); font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; }
.rep-place-more:hover { color: var(--text); background: color-mix(in srgb, var(--text-3) 22%, transparent); }
/* "Show all places" while it is on: lit like the other on/off toggles. */
#repPlacesAll[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.rep-place-head { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.rep-place-rest { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.rep-place-rest[hidden] { display: none; }
.rep-addr-cell.open { flex-wrap: wrap; row-gap: 4px; }
.rep-addr-cell.open .rep-place-rest { flex-basis: 100%; }
.rep-addr { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.rep-geo { font-size: 12px; }
.rep-more { display: flex; justify-content: center; padding: 12px 0 2px; }
/* The reports' pager: Prev · Page [n] of N · Next, the row span beside it.
   Wraps onto two lines on a phone rather than pushing the page sideways. */
.rep-pager { flex-wrap: wrap; align-items: center; gap: 8px 10px; }
/* Prev on page 1 and Next on the last page: visibly off, not merely inert. */
.rep-pager button:disabled { opacity: .45; cursor: default; pointer-events: none; }
.rep-pg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.rep-pg-in { width: 64px; height: var(--ctl-h-sm, 30px); padding: 0 6px; text-align: center; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: var(--radius-sm, 6px); background: var(--surface, transparent);
  color: var(--text); font-size: 13px; }
.rep-pg-rows { font-size: 12px; white-space: nowrap; }
#repTableWrap { overflow-x: auto; }
.report-table { min-width: 100%; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.report-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
/* Body cells match the header, which has always been nowrap: "B 9058 UOK" and
   "16 Aug" broken across two lines double the row height for nothing, and the
   view scrolls horizontally when a report really is too wide. Long addresses
   ellipsise instead (.rep-addr). */
.report-table td { white-space: nowrap; }
.report-table tr:last-child td { border-bottom: none; }
.report-footer { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* A section heading inside the table: the tracker moved to another vehicle in
   the middle of this range, so the rows below belong to a different truck. It
   reads as a heading, not as a column head — bigger than the uppercase header
   row above it, and not nowrap-uppercase, so the two are never confused. */
.report-table .rep-sec th {
  text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 700;
  color: var(--text-1); padding: 16px 10px 7px; border-bottom: 2px solid var(--border);
}
.report-table tr.rep-sec:first-child th { padding-top: 6px; }
.rep-sec-when { font-weight: 500; font-size: 11px; color: var(--text-3); margin-left: 8px; white-space: nowrap; }
/* A refuel's own row in the Temperature & Fuel table: the day, the time and the
   litres, tinted so it is found by eye among the averaged rows around it. */
.report-table tr.rep-refuel td { background: var(--green-soft); color: var(--text); font-weight: 600; }
/* …and a fuel drop's, in red. */
.report-table tr.rep-fueldrop td { background: var(--red-soft); color: var(--text); font-weight: 600; }
/* A Device Data Log row sent without a GPS lock, in the live map's Not located
   orange: the run of them is what a GPS outage looks like in the log. */
.report-table tr.rep-total td { font-weight: 700; border-top: 2px solid var(--border); }
/* A row that opens in History (reports.js playOf). The hover tint is an
   IMAGE over the cell's colour, so a row that is already tinted (Input
   Status, no-GPS) keeps its own colour underneath. The row last opened keeps
   a stripe, so coming back from the playback shows where you were. */
.report-table tr.rep-play { cursor: pointer; }
.report-table tr.rep-play:hover td {
  background-image: linear-gradient(color-mix(in srgb, var(--primary) 7%, transparent), color-mix(in srgb, var(--primary) 7%, transparent));
}
.report-table tr.rep-play:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.report-table tr.rep-played td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.report-table tr.rep-nogps td { background: color-mix(in srgb, var(--st-nolocate) 16%, transparent); }
/* a lone speed spike an operator asked to see (Device Data Log) */
.report-table tr.rep-spike td { background: var(--amber-soft); }
/* Input Status: an input in its attention state (a door open), and the same
   while the vehicle was driving — the row a reader is looking for. Each input
   has its own calm hue (door blue, wingbox purple…) so they read apart down
   the table. Never red: in this app red means an alarm, and an open door at
   the depot is not one. */
:root { --io-h0: #2563eb; --io-h1: #7c3aed; --io-h2: #0d9488; --io-h3: #d97706; --io-h4: #0891b2; }
[data-theme="dark"] { --io-h0: #60a5fa; --io-h1: #a78bfa; --io-h2: #2dd4bf; --io-h3: #fbbf24; --io-h4: #22d3ee; }
.report-table tr.rep-io-alert, .report-table tr.rep-io-move { --io-h: var(--io-h0); }
.report-table tr.rep-io-h1 { --io-h: var(--io-h1); }
.report-table tr.rep-io-h2 { --io-h: var(--io-h2); }
.report-table tr.rep-io-h3 { --io-h: var(--io-h3); }
.report-table tr.rep-io-h4 { --io-h: var(--io-h4); }
.report-table tr.rep-io-alert td { background: color-mix(in srgb, var(--io-h) 9%, transparent); }
.report-table tr.rep-io-move td { background: color-mix(in srgb, var(--io-h) 20%, transparent); font-weight: 600; }
/* That section's own totals, under its own rows. */
.report-table .rep-secf td {
  font-weight: 600; color: var(--text-2); white-space: normal;
  padding: 8px 10px 12px; border-bottom: none;
}

/* A sortable header. Styled as the header it replaces rather than as a button —
   a row of twenty buttons across the top reads as a toolbar, not as a table
   head — with the arrow marking the one column actually doing the sorting. */
.report-table th > .rep-sort {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
  white-space: nowrap;
}
.report-table th > .rep-sort:hover, .report-table th > .rep-sort:focus-visible { color: var(--text); }
.report-table th > .rep-sort.on { color: var(--text); }

/* A count that opens the alerts behind it. Underlined on hover rather than
   always, because a grid where every number is a permanent blue link is
   unreadable as a grid — the point of the summary is scanning it. Inherits the
   cell's own type so a column of counts still lines up. */
.rep-drill {
  background: none; border: 0; padding: 0; font: inherit; color: var(--primary);
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.rep-drill:hover, .rep-drill:focus-visible { text-decoration: underline; }

/* ---- Alert drill-down drawer ---- */
/* What one count in the Daily Alert Summary is made of. A drawer and not a row
   that expands inside the table: that table scrolls SIDEWAYS, so a full-width
   detail row would open at column one — off the screen — beside a count the
   reader clicked in column fifteen. Sliding in from the right also leaves the
   grid in place, so the number that prompted the question is still readable.
   z-index sits above .modal-backdrop (1500) but below .bk-picker (1600): a
   dialog opened FROM the drawer (the ack modal) must land on top of it. */
.drill-backdrop {
  position: fixed; inset: 0; z-index: 1550; background: rgba(8, 12, 22, .45);
  display: flex; justify-content: flex-end;
}
.drill-backdrop[hidden] { display: none; }
.drill {
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; height: 100%;
  display: flex; flex-direction: column;
  animation: drill-in .16s ease-out;
}
/* Full width below the drawer's own max-width — on a phone a 480px panel with
   40px of dimmed backdrop beside it is just a narrower screen. */
@media (max-width: 560px) { .drill { max-width: 100%; border-left: none; } }
@keyframes drill-in { from { transform: translateX(16px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drill { animation: none; } }
.drill > header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.drill-head h3 { font-size: 15px; font-weight: 700; }
.drill-head p { margin: 2px 0 0; font-size: 12px; }
.drill-body { padding: 14px 18px 22px; overflow-y: auto; flex: 1 1 auto; }

/* One alert, read top-down: when and what, then where, then who was told.
   The history tab's eleven-column table does not fit 480px, and squeezing it
   in would make the cell you came here to understand the hardest to read. */
.drill-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.drill-item:last-child { border-bottom: none; }
.drill-when { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.drill-what { margin-top: 3px; font-size: 13px; color: var(--text-2); }
.drill-where { margin-top: 5px; font-size: 12px; }
/* The notification channels, as label/value pairs rather than a header row:
   at this width a four-column table of "sent / — / — / sent" is unreadable,
   and most alerts use one or two channels anyway. */
.drill-chans { margin-top: 8px; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; align-items: baseline; }
.drill-chans dt { color: var(--text-3); text-transform: uppercase; font-size: 10px; letter-spacing: .05em; }
.drill-chans dd { margin: 0; min-width: 0; }
.drill-empty { padding: 18px 0; }

/* ---- Centred number columns ---- */
/* A pivot of counts (Daily Alert Summary) reads as a grid, and a grid of
   left-aligned numbers under wide headers leaves each count adrift at the far
   left of its own column. Only the columns a report NAMES are centred, so the
   text reports are untouched; header and cell together, or the two disagree.
   Tabular figures so the digits line up down the column. */
.report-table td.rep-num, .report-table th.rep-num { text-align: center; }
.report-table td.rep-num { font-variant-numeric: tabular-nums; }

/* ---- Pinned row labels, for reports that are read ACROSS ---- */
/* A pivot (Daily Alert Summary) is read by running your eye right along a row.
   Wide enough and #repTableWrap scrolls the row's own Date and Vehicle out of
   view, so the count you land on belongs to nobody. Only a report that asks for
   it gets this — the tall, narrow reports are read downwards and a seam down
   column two would be noise.
   border-collapse: collapse paints a cell's borders on the TABLE rather than
   the cell, so a sticky cell scrolls out from under its own rules: the inset
   shadows below are those borders, drawn where they survive the scroll.
   --stick2 is column one's MEASURED width, set by renderReport once the table
   is in the DOM — it follows the longest plate, which no fixed value can. */
.report-table.report-stick th:nth-child(1), .report-table.report-stick td:nth-child(1),
.report-table.report-stick th:nth-child(2), .report-table.report-stick td:nth-child(2) {
  position: sticky; z-index: 1; background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--border);
}
.report-table.report-stick th:nth-child(1), .report-table.report-stick td:nth-child(1) { left: 0; }
.report-table.report-stick th:nth-child(2), .report-table.report-stick td:nth-child(2) {
  left: var(--stick2, 0);
  box-shadow: inset 0 -1px 0 var(--border), inset -1px 0 0 var(--border);
}
/* The last row has no rule under it (see tr:last-child above), but column two
   keeps the edge that separates the pinned pair from what slides beneath. */
.report-table.report-stick tr:last-child td:nth-child(1) { box-shadow: none; }
.report-table.report-stick tr:last-child td:nth-child(2) { box-shadow: inset -1px 0 0 var(--border); }

/* Plates down the side of a day-by-day grid: only the one column stays put. */
.report-table.report-stick-first th:nth-child(1), .report-table.report-stick-first td:nth-child(1) {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--border), inset -1px 0 0 var(--border);
}

/* ---- Site-to-site travel: the ordered site chain ---- */
/* The chain takes its own full-width line inside the existing flex-wrap
   .report-controls row rather than sitting between the 40px selects — four
   site names never fit on the same line as the date pickers. */
.sts-field, .sts-opts, .sts-saved { flex: 1 1 100%; min-width: 0; }
.sts-saved { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; order: -1;
  padding-bottom: 13px; margin-bottom: 2px; border-bottom: 1px dashed var(--border); }
.sts-saved[hidden] { display: none; }
.sts-saved-lbl { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-right: 3px; }
.sts-run { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h-sm); padding: 0 11px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.sts-run:hover { border-color: var(--primary); color: var(--primary); }
.sts-run em { font-style: normal; font-size: 10px; font-weight: 800; opacity: .65; }
.sts-run.add { border-style: dashed; }
.sts-run-x { opacity: 0; font-size: 14px; line-height: 1; color: var(--text-3); }
.sts-run:hover .sts-run-x { opacity: 1; }
.sts-run-x:hover { color: var(--red); }
.sts-draft { font-size: 10.5px; color: var(--text-3); margin-left: auto; }

.sts-chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: var(--ctl-h);
  padding: 4px 6px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 9px; }
.sts-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 6px 0 0; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.sts-chip:hover { border-color: var(--primary); }
.sts-seq { display: grid; place-items: center; width: 26px; height: 26px; margin-left: 1px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 800; flex-shrink: 0; }
/* filter mode: the position carries no meaning, so the badge is a plain marker
   rather than a sequence letter that would imply one */
.sts-seq.plain { background: var(--gray-soft); color: var(--text-3); font-size: 13px; }
.sts-kind { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; display: inline-block; }
.sts-kind.fence { background: var(--primary); }
.sts-kind.poi { background: var(--green); }
/* The picked site's mark: the report's hexagon / pin, in its colour (placemarks.js) */
.sts-kind-ic { display: inline-flex; flex-shrink: 0; }
.sts-kind-ic .rep-mk { width: 12px; height: 12px; }
.sts-kind-ic.fence { color: var(--primary); }
.sts-kind-ic.poi { color: var(--green); }
/* no site picked: which places the report covers (sitetrip.js SCOPES) */
.sts-scope { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-pill); overflow: hidden;
  flex-shrink: 0; }
.sts-scope-btn { border: 0; background: transparent; padding: 4px 10px; font: inherit; font-size: 12px; color: var(--text-2);
  cursor: pointer; white-space: nowrap; }
.sts-scope-btn + .sts-scope-btn { border-left: 1px solid var(--border); }
.sts-scope-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
/* under the site box: which mark is which */
.sts-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sts-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.sts-tok { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 5px; flex-shrink: 0;
  background: var(--gray-soft); color: var(--text-3); }
.sts-tok.over { background: var(--amber-soft); color: var(--amber); }
.sts-x { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 999px; color: var(--text-3); font-size: 14px; line-height: 1; }
.sts-x:hover { background: var(--red-soft); color: var(--red); }
/* Reorder is ‹ › on hover, deliberately NOT drag-and-drop: no new library, and
   it works on touch. */
.sts-mv { display: none; width: 16px; height: 22px; place-items: center; color: var(--text-3); font-size: 11px; border-radius: 5px; }
.sts-chip:hover .sts-mv { display: grid; }
.sts-mv[disabled] { opacity: .25; cursor: default; }
.sts-mv:not([disabled]):hover { background: var(--primary-soft); color: var(--primary); }
.sts-leg { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.05; flex-shrink: 0; }
.sts-arrow { color: var(--text-3); font-size: 14px; user-select: none; }
/* straight-line distance between consecutive sites — a leg reading 0.4 km on a
   cross-city run means a mis-pick, caught before a 19-column query runs */
.sts-leg-km { font-size: 9.5px; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.sts-leg-km.warn { color: var(--amber); }
.sts-add { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1.5px dashed var(--border); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.sts-add:hover { border-color: var(--primary); color: var(--primary); border-style: solid; }
.sts-full { font-size: 11.5px; color: var(--text-3); padding-left: 4px; }

.sts-opts { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding-top: 12px; margin-top: 2px; border-top: 1px dashed var(--border); }
.sts-opts[hidden] { display: none; }
.sts-num { width: 112px; min-width: 112px; }
.sts-unit { position: relative; display: block; }
.sts-unit input { width: 100%; padding-right: 34px; }
.sts-unit i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--text-3); pointer-events: none; }
.sts-toggles-field { min-width: auto; }
.sts-toggles { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* Return / Incomplete need a NAMED chain to mean anything, so they go flat
   while the chain is empty ("all sites"). No global disabled style exists in
   this sheet to inherit, and a toggle that still looks live but ignores the
   click is worse than one that plainly cannot be pressed. */
.sts-toggles .btn-ghost:disabled { opacity: .4; cursor: not-allowed; }
.sts-toggles .btn-ghost:disabled:hover { border-color: var(--border); color: var(--text-2); }
.sts-note { flex: 1 1 100%; margin-top: -2px; }
.sts-note[hidden] { display: none; }

/* ---- Site-to-site: the search overlay (reuses the .bk-picker shell) ---- */
.sts-hits { max-height: 300px; overflow-y: auto; border-top: 1px solid var(--border); }
.sts-hit { display: flex; align-items: center; gap: 10px; padding: 9px 18px; cursor: pointer; }
.sts-hit:hover, .sts-hit.sel { background: var(--surface-2); }
.sts-hit.dim { opacity: .5; }
.sts-hit-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sts-hit b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sts-hit b mark { background: transparent; color: var(--primary); font-weight: 800; }
.sts-hit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sts-hit-go { margin-left: auto; flex-shrink: 0; font-size: 10.5px; font-weight: 700; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
.sts-empty { padding: 16px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---- grouped report header (site-to-site) ---- */
/* Two header rows over the same flat columns: site groups, with the travel
   legs between them banded so the eye tracks site → travel → site instead of
   counting 19 columns. Any report without `groups` renders exactly as before. */
.report-grouped th.rep-grp { text-align: center; padding-bottom: 6px; }
.report-grouped th.rep-grp-site { color: var(--text); font-size: 11.5px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.report-grouped th.rep-grp-leg { color: var(--text-3); font-size: 10.5px; }
.report-grouped th.rep-sub { padding-top: 6px; font-size: 10px; }
.report-grouped th.rep-grp-plain { vertical-align: bottom; }
.report-grouped .rep-band { background: var(--surface-2); }
[data-theme="dark"] .report-grouped .rep-band { background: rgba(255, 255, 255, .025); }
/* the plate stays visible while a 19-column table scrolls sideways */
.report-grouped th:first-child, .report-grouped td:first-child {
  position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.report-grouped td:first-child { font-weight: 700; color: var(--text); }
.report-grouped td { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* The Login-log rules lived here. They moved with the view to the admin panel
   (03. Admin Webgps/css/admin.css) — class names unchanged, so the markup went
   over verbatim. .report-table stays: reports.js renders into it too. */
.idle-field[hidden] { display: none; }
.idle-inputs { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); height: 38px; }
.idle-inputs span { display: inline-flex; align-items: center; gap: 5px; }
.idle-inputs input { width: 52px; padding: 6px 7px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 13px; outline: none; }
.idle-inputs input:focus { border-color: var(--primary); }

.alert-item { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
/* acknowledged: chime muted for the vehicle — card dims but stays visible */
.alert-item.acked { opacity: .62; }
.alert-item .alert-ack.on { color: var(--st-moving); border-color: currentColor; }
/* Platform-wide acknowledgement */
.alerts-people { margin-left: auto; }
.ack-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--st-moving); white-space: nowrap; }
.ackp-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.ackp-row:last-child { border-bottom: none; }
.ackp-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ackp-name.off { color: var(--text-3); text-decoration: line-through; }
.ackp-pin { flex-shrink: 0; font-size: 12px; }
.ackp-del:hover { color: var(--red); }
.ackp-add { display: flex; gap: 8px; margin-top: 10px; }
/* Bulk acknowledgement: select several alerts, clear them with one PIN. */
.ack-bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.ack-bulk[hidden] { display: none; }
.ack-bulk-all { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }
/* The .field rule sizes inputs to 40px; a checkbox must keep its own size. */
.ack-bulk-all input, .ack-cb { width: 16px; height: 16px; flex: none; margin: 0; cursor: pointer; accent-color: var(--primary); }
.ack-bulk-n { font-size: 12.5px; }
.ack-bulk-go { margin-left: auto; }
.ack-bulk-go:disabled { opacity: .5; cursor: not-allowed; }
.ack-bulk-every { font-size: 12.5px; }
/* Live-tab paging: five rows a section, Prev / Next under them (ack.js livePage). */
.live-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 12px; font-size: 13px; }
.live-pager button:disabled { opacity: .45; cursor: default; }
/* Narrow checkbox column in the off-route / booking alert tables. */
.ra-table th.ack-cbcol, .ra-table td.ack-cbcol { width: 28px; padding-right: 0; text-align: center; }
.ack-scope { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; color: var(--primary); }
@media (max-width: 620px) { .ack-bulk-go { margin-left: 0; width: 100%; } }
.ackp-add input { flex: 1; min-width: 0; height: var(--ctl-h-md); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; font-size: 13px; color: var(--text); outline: none; }
.ackp-add input:focus { border-color: var(--primary); }
.ackp-add #ackpPin { flex: 0 0 130px; }

/* Alert contacts (recipients) — reuses the .ackp-* row/add layout. */
.ct-add { flex-wrap: wrap; }
.ct-add #ctPhone { flex: 0 0 150px; }
.ct-add #ctRole { flex: 0 0 140px; }
.ct-role { flex-shrink: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px; background: var(--gray-soft); color: var(--text-2); }
/* Contact chips above the rule-builder recipient box. */
.ct-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 7px; }
.ct-picker:empty { display: none; }
.ct-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 5px 10px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface-2);
  color: var(--text-2); transition: background .12s, border-color .12s, color .12s; }
.ct-chip:hover { border-color: var(--primary); }
.ct-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.ct-chip-role { font-size: 10px; font-weight: 700; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.ct-manage { font-size: 11.5px; font-weight: 600; color: var(--primary); text-decoration: none; margin-left: 2px; }
.ct-manage:hover { text-decoration: underline; }

/* WhatsApp column: status pill + who it actually went to.
   One recipient sits inline under the pill; several collapse into a <details>
   so a 6-recipient rule can't stretch the row — the column stays one line tall
   until the user opens it. */
.wa-to { margin-top: 3px; font-size: 11.5px; line-height: 1.35; max-width: 190px; }
.wa-to.one { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-to > summary { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text-2);
  list-style: none; white-space: nowrap; }
.wa-to > summary::-webkit-details-marker { display: none; }
.wa-to > summary:hover { color: var(--primary); }
.wa-count { flex-shrink: 0; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--gray-soft); color: var(--text-2); }
.wa-to[open] > summary { font-weight: 600; margin-bottom: 4px; }
.wa-to[open] > summary .wa-count { background: var(--primary); color: #fff; }
.wa-to ul { list-style: none; margin: 0; padding: 0 0 0 2px; border-left: 2px solid var(--border); }
.wa-to li { display: flex; align-items: baseline; gap: 6px; padding: 2px 0 2px 8px; }
.wa-to li.bad .wa-n { color: var(--red); }
.wa-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-num { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wa-st { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 1px 5px; border-radius: 4px; background: var(--red-soft); color: var(--red); }
.alert-sev { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.alert-sev.high { background: var(--red-soft); color: var(--red); }
.alert-sev.med { background: var(--amber-soft); color: var(--amber-text); }
.alert-sev.low { background: var(--gray-soft); color: var(--text-2); }
.alert-body { flex: 1; font-size: 13px; color: var(--text-2); }
.alert-body strong { color: var(--text); }
.alert-body .muted { display: block; margin-top: 2px; font-size: 12px; }

.gf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* Bulk categorise bar — sits above the geofence / places lists. Collapsed it is
   a single "Select multiple" button; expanded it carries its own filter, a
   select-all for the filtered view, and the category to apply. */
.bulk-bar { margin-bottom: 10px; }
/* Header row above the list: select-all tickbox (aligned with the row
   tickboxes), then — only while something is ticked — the action groups
   inline, split by a vertical rule. */
.bulk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: var(--ctl-h-sm); padding: 0 19px; } /* 18px card padding + 1px border = the row tickbox x */
.bulk-all { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.bulk-all .bulk-check { margin: 0; }
.bulk-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-sep { width: 1px; align-self: stretch; min-height: 22px; background: var(--border); margin: 0 2px; }
.bulk-clear { margin-left: auto; }
/* On the scale: these sit beside .btn-primary.sm / .btn-ghost.sm in the bulk
   row, so they take --ctl-h-sm and its radius (they were 29px with a 7px
   corner, a size of their own). */
.bulk-q, .bulk-cat, .cg-pl-role { height: var(--ctl-h-sm); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-xs); padding: 0 9px; font-size: 12px; color: var(--text); outline: none; }
.bulk-q { flex: 1; min-width: 140px; }
.bulk-q:focus, .bulk-cat:focus, .cg-pl-role:focus { border-color: var(--primary); }
.bulk-count { font-size: 12px; color: var(--text-2); margin-left: auto; white-space: nowrap; }
.bulk-check { flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.bulk-bar .btn-primary { padding: 0 12px; font-size: 12px; min-height: var(--ctl-h-sm); }
.bulk-bar .btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.bulk-bar .btn-ghost[disabled] { opacity: .5; cursor: not-allowed; }
.bulk-cargo { /* separated from the category group by .bulk-sep */ }
.bulk-lab { font-size: 12px; color: var(--text-2); }
.bulk-role { height: var(--ctl-h-sm); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-xs); padding: 0 9px; font-size: 12px; color: var(--text); outline: none; }
.bulk-role:focus { border-color: var(--primary); }
.bulk-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.bulk-chk input { accent-color: var(--primary); cursor: pointer; }

/* Cargo role, shown on the place/fence row. The failure mode this guards
   against is an account that LOOKS configured and is not, so a tagged place has
   to be visible without opening anything. */
.cargo-chip { display: inline-flex; align-items: center; min-height: var(--badge-h); line-height: 1; box-sizing: border-box; margin-left: 6px; padding: 0 7px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
/* Cargo hues come from the Fleet status palette tokens (--fs-*, defined with
   their dark-theme pair further down): the old literals fell to 3.0:1 here. */
.cargo-load   { background: color-mix(in srgb, var(--fs-place) 16%, transparent); color: var(--fs-place); border-color: color-mix(in srgb, var(--fs-place) 40%, transparent); }
.cargo-unload { background: color-mix(in srgb, var(--fs-unload) 16%, transparent); color: var(--fs-unload); border-color: color-mix(in srgb, var(--fs-unload) 40%, transparent); }
.cargo-both   { background: color-mix(in srgb, var(--fs-check) 16%, transparent); color: var(--fs-check); border-color: color-mix(in srgb, var(--fs-check) 40%, transparent); }
/* Checkpoint had no rule at all: it rendered as bare text inside a transparent
   border, invisible as a chip. Neutral rather than a fourth colour, because a
   checkpoint is the one role that is not an event — the cargo does not change.
   Built from the text tokens (the .src-badge treatment) so it stays legible in
   both themes; a fixed slate was unreadable on the dark background. */
.cargo-checkpoint { background: color-mix(in srgb, var(--text-3) 18%, transparent); color: var(--text-2); border-color: color-mix(in srgb, var(--text-3) 40%, transparent); }
.gf-item { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.gf-item-body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.gf-item-body strong { color: var(--text); }
.gf-item-body .muted { font-size: 12px; }
.gf-locate { flex-shrink: 0; }
/* shares a row with .btn-ghost.sm and .icon-btn.small, so it takes the same
   dense step of the scale rather than a height of its own */
.gf-cat, .poi-cat-sel, .rf-cat { flex-shrink: 0; max-width: 140px; height: var(--ctl-h-sm); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-xs); padding: 0 7px; font-size: 11.5px; color: var(--text); outline: none; }
.gf-cat:focus, .poi-cat-sel:focus, .rf-cat:focus { border-color: var(--primary); }

/* Provenance mark on places + geofences: "GPS server" (synced, read-only) vs
   "Created here" (ours, editable). Same wording and weight in both lists. */
.src-badge { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; vertical-align: 1px; }
.src-badge.src-legacy { background: color-mix(in srgb, var(--text-3) 18%, transparent); color: var(--text-2); }
.src-badge.src-local { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }

/* Geofence editor: circle/polygon switch + the draw helper buttons. */
.gf-shape-pick { display: flex; gap: 6px; }
.gf-shape-opt { flex: 1 1 0; height: var(--ctl-h); border: 1.5px solid var(--border); background: var(--surface-2); border-radius: 8px; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.gf-shape-opt:hover { border-color: var(--text-3); color: var(--text); }
.gf-shape-opt.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
/* Region mode's three fields sit in the form's own column, gap and all. */
.gf-region-fields { display: contents; }
.gf-region-fields[hidden] { display: none; }
/* Quick picks (Jabodetabek, …) and the regions joined so far. */
.gf-qpick, .gf-rchips { display: flex; flex-wrap: wrap; gap: 6px; }
.gf-qpick button { min-height: var(--ctl-h-sm); padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.gf-qpick button:hover { border-color: var(--text-3); color: var(--text); }
.gf-qpick button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.gf-rchip { display: inline-flex; align-items: center; gap: 2px; min-height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 3px 0 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); border-radius: var(--radius-pill);
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 600; }
.gf-rchip button { width: var(--badge-h); height: var(--badge-h); padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit;
  font-size: 14px; line-height: 1; cursor: pointer; }
.gf-rchip button:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.gf-region-add { align-self: flex-start; }
.gf-region-add:disabled { opacity: .45; cursor: default; pointer-events: none; }
.gf-draw-actions { flex-direction: row; gap: 6px; }
.gf-draw-actions .btn-ghost { flex: 1 1 0; }
#gfMap { width: 100%; height: 100%; min-height: 420px; }
.gf-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.gf-msg p { font-size: 13px; color: var(--text-2); margin: 0; }

/* Places / Geofences tabs */
/* .places-tab / .places-tabs: see the shared underline-tab rule in the Alerts
   section — layout is defined once there for all three bars. */
.ptab-panel[hidden] { display: none; }
/* Geofences tab has no show-on-map toggle — the count takes the flexible gap
   instead, so Categories sits next to "Draw geofence" like on the Places tab */
#gfCount { margin-right: auto; }

/* POI list items */
.poi-item { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.poi-cat-ic { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; color: #fff; }
.poi-item-body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.poi-item-body strong { color: var(--text); }
.poi-item-body .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poi-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
#poiMap { width: 100%; height: 100%; min-height: 420px; }
.poi-marker-label { font: 700 10px Inter, sans-serif; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

/* Manage categories modal */
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cat-row-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.cat-form { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.cat-form-title { font-size: 12px; font-weight: 700; color: var(--text-2); }
.cat-form-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.cat-form input[type="text"] { height: var(--ctl-h-md); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; font-size: 13px; color: var(--text); outline: none; }
.cat-form input[type="text"]:focus { border-color: var(--primary); }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-opt { width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--border); display: grid; place-items: center; font-size: 16px; background: var(--surface); cursor: pointer; }
.emoji-opt.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.cat-form-actions { display: flex; gap: 8px; margin-top: 6px; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-3); }
.empty-state svg { margin-bottom: 12px; opacity: .5; }
.empty-state h3 { color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 380px; margin: 0 auto 16px; }

/* ============ TRIPS ============ */
.trips-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.trips-list { display: flex; flex-direction: column; gap: 10px; }

/* toolbar */
.trips-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.trips-filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.trips-toolbar .seg { gap: 6px; }
.trip-metrics { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.trips-tools-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trips-tools-row .search-box { flex: 1; min-width: 180px; margin: 0; }
.trips-tools-row .select-inline { width: auto; margin: 0; }
.trips-tools-row .btn-primary { margin-left: auto; }
.view-toggle { display: flex; height: var(--ctl-h-md); box-sizing: border-box; border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
/* min-width, not width: the trips toggle holds icons (square) while the
   bookings Day/Week toggle holds words — a hard width clipped the labels. */
.view-toggle button { min-width: var(--ctl-h-md); height: 100%; padding: 0 10px; display: grid; place-items: center; color: var(--text-3); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.view-toggle button:has(svg) { padding: 0; }
.view-toggle button.active { background: var(--primary); color: #fff; }

/* table view */
.trip-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.trip-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; }
.trip-table th:hover { color: var(--text); }
.trip-table th .sort-ar { font-size: 9px; }
.trip-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
/* the DO backlog (dopool.js): a table that scrolls sideways on a phone, rows ticked for a truck */
.do-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.do-table th { cursor: default; }
/* not the trip table's: no columns dropped on a phone (the wrap scrolls), and long places wrap */
.trip-table.do-table th:nth-child(n), .trip-table.do-table td:nth-child(n) { display: table-cell; }
.do-table td { white-space: normal; vertical-align: top; min-width: 0; }
.do-table td:nth-child(2) { white-space: nowrap; }
.do-table .do-acts { white-space: nowrap; width: 1%; }
.do-table .do-place { min-width: 180px; }
.do-table tbody tr { cursor: default; }
.do-table td small.tt-crew { display: block; }
.do-table .do-pick-col { width: 32px; padding-right: 0; }
.do-table .do-pick-col input { width: 16px; height: 16px; accent-color: var(--primary); }
.do-table tr.picked td { background: var(--primary-soft); }
.do-table .do-acts { text-align: right; }
.do-table .do-acts .btn-ghost + .btn-ghost { margin-left: 4px; }
/* The column name a phone card needs (it has no header row); a table has one. */
.do-table .do-k { display: none; }
/* On a phone the table was wider than the screen: DO, shipper, load → drop,
   recipient, freight, status and the buttons side by side, scrolled sideways
   with half of it out of sight. Each DO becomes a card instead — the number
   and its status on top, the rest one line each, the buttons underneath. */
@media (max-width: 600px) {
  .do-table-wrap { overflow: visible; }
  .trip-table.do-table, .do-table tbody, .do-table tr.tt-group, .trip-table.do-table tr.tt-group > td { display: block; }
  .do-table thead { display: none; }
  .trip-table.do-table tbody tr[data-do] { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px;
    padding: 11px 12px; border-bottom: 1px solid var(--border); }
  .trip-table.do-table tbody tr[data-do]:last-child { border-bottom: none; }
  .trip-table.do-table tbody tr[data-do] > td { display: block; grid-column: 2; min-width: 0; padding: 0; border: 0; white-space: normal; }
  .trip-table.do-table tbody tr[data-do] > td.do-pick-col { grid-column: 1; grid-row: 1; width: auto; padding-top: 1px; }
  .trip-table.do-table tbody tr[data-do] > td.do-status { grid-column: 3; grid-row: 1; max-width: 150px; text-align: right; }
  .trip-table.do-table tbody tr[data-do] > td.do-acts { grid-column: 2 / -1; width: auto; margin-top: 6px; text-align: right; }
  .trip-table.do-table tbody tr[data-do] > td.do-acts:empty, .do-table .do-recip.do-none { display: none; }
  .do-table .do-k { display: inline; color: var(--text-3); }
}
.do-st { font-size: 12px; font-weight: 600; }
.do-st.open { color: var(--amber, #b45309); }
.do-st.on { color: var(--green, #15803d); }
.do-st.warn { color: var(--red, #dc2626); }
.do-st.muted { color: var(--text-3); }
.do-assign-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; padding: 8px 12px;
  border: 1px solid var(--primary); border-radius: var(--radius); background: var(--primary-soft); font-size: 13px; font-weight: 600; color: var(--text); }
.do-assign-bar[hidden] { display: none; }
.do-assign-bar span { flex: 1 1 auto; }
.do-trip-pick { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.do-trip-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.do-trip-row.same { border-color: var(--primary); }
.do-trip-row small { display: block; color: var(--text-3); margin-top: 2px; }
.do-trip-row .do-same { color: var(--primary); font-weight: 600; }
.trip-table tr:last-child td { border-bottom: none; }
.trip-table tbody tr { cursor: pointer; }
.trip-table tbody tr:hover { background: var(--surface-2); }
.trip-table .tt-plate { font-weight: 700; color: var(--text); }
.trip-table .tt-dur, .trip-table .tt-km, .trip-run { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Trip / order share box (tripshare.js) */
.ts-row { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.ts-row:last-of-type { border-bottom: 0; }
.ts-row > .share-link { display: block; width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.ts-label { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ts-meta { font-size: 11.5px; color: var(--text-3); margin-right: auto; min-width: 0; }
.ts-chip { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  background: var(--primary-soft); color: var(--primary); margin-right: 4px; vertical-align: 1px; }
.ts-chip.sched { background: color-mix(in srgb, var(--orange, #e07b18) 16%, transparent); color: var(--orange, #e07b18); }
.ts-qr { width: 132px; padding: 8px; background: #fff; border-radius: 8px; border: 1px solid var(--border); margin: 6px 0; }
.ts-qr svg { display: block; width: 100%; height: auto; }
.ts-new { margin-top: 4px; }
.tsf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); margin: 6px 0; }
.tsf-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-2); min-width: 0; }
.tsf-f > span { font-weight: 600; }
.tsf-f input, .tsf-f select { height: var(--ctl-h-md); box-sizing: border-box; font-size: 13px; padding: 0 8px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel, var(--bg)); color: var(--text); }
.tsf-wide, .tsf-opts, .tsf-actions { grid-column: 1 / -1; }
.tsf-f[hidden] { display: none; }
.tsf-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; }
.tsf-opts label { display: inline-flex; gap: 5px; align-items: center; }
.tsf-k { font-size: 12px; font-weight: 600; color: var(--text-2); }
.tsf-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 560px) { .tsf { grid-template-columns: minmax(0, 1fr); } }
.trip-table .tt-crew { display: block; font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.tt-prog { display: flex; align-items: center; gap: 7px; }
.tt-prog .prog-bar { width: 60px; }
.trips-empty { text-align: center; color: var(--text-3); padding: 40px 20px; font-size: 13px; }

.trip-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
/* The card's own line; the trip unfolds under it (.trip-x). */
.trip-card .tc-row { padding: 14px 16px; cursor: pointer; display: flex; align-items: center; gap: 14px; border-radius: var(--radius); }
.trip-card .tc-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.trip-card .tc-chev, .trip-table .tc-chev { color: var(--text-3); flex-shrink: 0; transition: transform .15s; }
.trip-card.open .tc-chev, .trip-table tr.open .tc-chev { transform: rotate(180deg); }
.trip-table .tc-chev { vertical-align: middle; }
.trip-table .tt-chev-col { width: 1%; padding-left: 0; text-align: right; cursor: default; }
.trip-card.open { border-color: var(--text-3); }
.trip-card:hover { border-color: var(--text-3); box-shadow: var(--shadow-md); }
.trip-card .tc-main { flex: 1; min-width: 0; }
.trip-card .tc-top { display: flex; align-items: center; gap: 8px; }
.trip-card .tc-plate { font-weight: 700; font-size: 14px; }
.tc-id { font-size: 11.5px; font-weight: 700; color: var(--text-3); font-family: ui-monospace, Menlo, monospace; }
.trip-card .tc-ref { font-size: 12px; color: var(--text-3); }
.trip-card .tc-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.trip-card .tc-prog { width: 120px; flex-shrink: 0; }
/* A phone card is ~340px: the fixed 120px bar squeezed the title row until
   the plate broke as "B 1235 / MGC" and the reference as "· PO- / 2601".
   Plate and reference never break; the row wraps WHOLE items instead. */
.trip-card .tc-plate, .trip-card .tc-ref { white-space: nowrap; }
@media (max-width: 600px) {
  .trip-card .tc-top { flex-wrap: wrap; row-gap: 2px; }
  .trip-card .tc-prog { width: 84px; }
}
.prog-bar { height: 7px; border-radius: 4px; background: var(--gray-soft); overflow: hidden; }
.prog-bar span { display: block; height: 100%; background: var(--green); }
.tc-prog small { font-size: 11px; color: var(--text-3); display: block; margin-top: 4px; text-align: right; }

.trip-status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.trip-status.active { background: color-mix(in srgb, var(--st-moving) 14%, transparent); color: var(--st-moving); }
.trip-status.completed { background: var(--green-soft); color: var(--green); }
.trip-status.completed_issues { background: color-mix(in srgb, var(--st-nolocate) 16%, transparent); color: var(--st-nolocate); }
.trip-status.cancelled { background: var(--gray-soft); color: var(--text-3); }

/* create + detail modal: two columns (form/list | map) */
/* .modal (later in this file) caps max-width at 420px with equal specificity,
   which silently overrode this class — the double selector makes the wide
   variant actually win. */
.modal-lg, .modal.modal-lg { max-width: 920px; width: 100%; }
/* The rule builder is the widest form in the app: its Then rows are whole
   sentences with inputs inside them ("Quiet period · at least 30 minutes
   before a new incident may alert · …"), and at 920px the longer ones wrapped
   mid-sentence. */
.modal.modal-rule { max-width: 1060px; }
/* Two classes, not one: the generic `.modal-body { display:flex; column;
   padding }` further down the sheet beat a lone `.trip-create`, and both trip
   modals lost their side-by-side map — it sat below the form, ~85px of it
   visible without scrolling. */
.modal-body.trip-create, .modal-body.trip-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; }
.trip-form { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--border); max-height: 70vh; overflow-y: auto; }
.trip-map-wrap { min-height: 420px; position: relative; }
#tripCreateMap, #tripDetailMap { width: 100%; height: 100%; min-height: 420px; }
.orders-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 8px; }
.orders-head label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.pick-hint { font-size: 10.5px; line-height: 1.35; color: var(--text-3); }

.order-edit { border: 1px solid var(--border); border-radius: 10px; padding: 11px; display: flex; flex-direction: column; gap: 8px; }
.order-edit .oe-top { display: flex; align-items: center; justify-content: space-between; }
.order-edit .oe-num { font-size: 12px; font-weight: 700; }
.order-edit input { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 12.5px; color: var(--text); outline: none; width: 100%; }
.order-edit input:focus { border-color: var(--primary); }
.oe-point { display: flex; flex-direction: column; gap: 6px; padding: 7px; border: 1px solid var(--border); border-radius: 8px; transition: border-color .15s, box-shadow .15s; }
.oe-point.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.oe-point-top { display: flex; align-items: center; gap: 8px; }
.oe-point .oe-label { font-size: 11px; font-weight: 700; width: 54px; flex-shrink: 0; }
.oe-point.pickup .oe-label { color: var(--st-moving); }
.oe-point.dropoff .oe-label { color: var(--st-nolocate); }
.oe-coord { flex: 1; font-size: 11.5px; color: var(--text-2); font-family: ui-monospace, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-coord.unset { color: var(--text-3); font-family: var(--font); font-style: italic; }
.oe-point-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oe-point .oe-save { flex-shrink: 0; color: var(--text-3); }
.oe-point .oe-save:hover { color: var(--primary); }
.oe-point-save { display: flex; gap: 6px; }
.oe-point-save[hidden] { display: none; }
.oe-point-save .oe-saveinput { flex: 1; min-width: 0; }
.oe-savego, .oe-savecancel { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 7px; border: 1.5px solid var(--border); color: var(--text-2); }
.oe-savego { background: var(--primary); border-color: var(--primary); color: #fff; }
/* Per-row pickup/dropoff: icon + inline search + map button (+ save when set). */
.oe-point-row { display: flex; align-items: center; gap: 7px; }
.oe-icon { flex-shrink: 0; display: grid; place-items: center; width: 22px; }
.oe-point.pickup .oe-icon { color: var(--st-moving); }
.oe-point.dropoff .oe-icon { color: var(--st-nolocate); }
/* Inside a .field, so it takes the filter-card height — and the pick-on-map
   button next to it has to as well, or the row steps down 12px mid-way. */
.oe-search { flex: 1; min-width: 0; height: var(--ctl-h); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; font-size: 12.5px; color: var(--text); outline: none; }
.oe-point-row .icon-btn { width: var(--ctl-h); height: var(--ctl-h); min-height: var(--ctl-h); }
.oe-search:focus { border-color: var(--primary); }
.oe-results { margin-top: 6px; max-height: 230px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.10); padding: 4px; }
.oe-results[hidden] { display: none; }
.oe-map.active { background: var(--primary); color: #fff; }
.oe-map.active:hover { background: var(--primary); }
/* multidrop: stops head buttons */
.orders-head-btns { display: flex; align-items: center; gap: 6px; }
/* a delivery stop card */
.stop { border: 1px solid var(--border); border-radius: 8px; padding: 7px; display: flex; flex-direction: column; gap: 6px; }
.stop-row { display: flex; align-items: center; gap: 7px; }
.stop-num { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--st-nolocate); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.stop-expand svg { transition: transform .15s; }
.stop-expand.open svg { transform: rotate(180deg); }
.stop-details { display: flex; flex-direction: column; gap: 7px; padding-top: 7px; border-top: 1px dashed var(--border); }
.stop-details[hidden] { display: none; }
.stop-details input { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 12.5px; color: var(--text); outline: none; width: 100%; }
.stop-details input:focus { border-color: var(--primary); }
.sd-override { display: flex; flex-direction: column; gap: 6px; }
.sd-override .oe-icon { color: var(--st-moving); }
.sd-override-label { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.sd-override-label .muted { font-weight: 500; text-transform: none; letter-spacing: 0; }
.sd-actions { display: flex; align-items: center; gap: 6px; }
.sd-actions .stop-del { margin-left: auto; }
.oe-result { display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 7px; background: none; border: none; cursor: pointer; }
.oe-result:hover { background: var(--surface-2); }
.oe-result-ic { font-size: 13px; line-height: 1.3; flex-shrink: 0; width: 16px; text-align: center; }
.oe-result-txt { min-width: 0; }
.oe-result-txt b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oe-result-txt small { display: block; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oe-result-empty { padding: 8px 9px; font-size: 11.5px; color: var(--text-3); }
/* Set (place-on-map) and Save (bookmark) are icon buttons in the point row. */
.oe-saveinput { flex: 1; min-width: 0; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 7px; padding: 6px 9px; font-size: 12px; color: var(--text); outline: none; }
.oe-saveinput:focus { border-color: var(--primary); }
.oe-del { color: var(--text-3); }
.oe-del:hover { color: var(--red); }

/* detail: orders + timeline */
.td-orders { padding: 16px; display: flex; flex-direction: column; gap: 14px; border-right: 1px solid var(--border); max-height: 70vh; overflow-y: auto; }
.td-order { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.td-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 2px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.td-controls #tdShareTrip { margin-left: auto; }
.td-controls .td-nav { display: inline-flex; gap: 6px; }
.td-controls .td-nav[hidden] { display: none; }
.td-controls .td-nav a.btn-ghost { text-decoration: none; }
.eta-chip { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.eta-chip + .route-toggle { margin-left: 6px; }
/* On time / Late / Overdue / Due, by the stop's own time (trips.js onTimeChip).
   Pushes right like the ETA when it comes first, and sits beside it after. */
.ontime-chip { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.eta-chip + .ontime-chip { margin-left: 6px; }
.ontime-chip + .route-toggle { margin-left: 6px; }
.ontime-chip.ok { background: var(--green-soft); color: var(--green); }
.ontime-chip.late { background: var(--red-soft, #fde8e8); color: var(--red); }
.ontime-chip.due { background: var(--gray-soft); color: var(--text-2, var(--text)); }
/* The trip's crew, above the controls: driver and kenek with their call links. */
.td-crew { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 2px 2px 10px; font-size: 13px; }
.td-crew.muted { color: var(--text-3); font-size: 12px; }
/* New trip: the route select and its "+ New route" button share one row. */
.trip-route-row { display: flex; gap: 8px; align-items: center; }
.trip-route-row select { flex: 1; min-width: 0; }
.trip-route-row .btn-ghost { flex: none; white-space: nowrap; }
/* New trip: the road plan (accounts without route fences). */
.trip-plan-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.trip-plan-now { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); }
.trip-plan-now.set { color: var(--text); font-weight: 500; }
.trip-plan-now .stale { color: var(--warn, #b45309); font-weight: 600; }
.trip-plan-row .btn-ghost { flex: none; white-space: nowrap; }
.td-route-k.plan { background: color-mix(in srgb, #64748b 16%, transparent); color: var(--text-2); }
.td-route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 2px 10px; font-size: 13px; }
.td-route-k { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.td-route .muted { color: var(--text-3); font-size: 12px; }
/* Trip page: planned vs driven km (trips.js fillTripKm). */
.td-route-k.km { background: color-mix(in srgb, #0d9488 14%, transparent); color: #0f766e; }
[data-theme="dark"] .td-route-k.km { background: color-mix(in srgb, #2dd4bf 16%, transparent); color: #5eead4; }
.km-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); }
.km-chip.over { background: var(--amber-soft); color: var(--amber-text); }
/* A planned km the office typed (tripkm.js): marked, so it is not taken for Google's. */
.km-manual { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  background: var(--primary-soft); color: var(--primary); cursor: help; }
.td-km .km-edit { margin-left: auto; }
.td-km .km-edit ~ .km-edit { margin-left: 0; }
.km-edit-row { display: inline-flex; align-items: center; gap: 6px; }
.km-edit-row input { width: 110px; }
.km-edit-hint { flex-basis: 100%; }
/* Edit trip (trips.js openTripEdit): what still changes, the stops that can't. */
.trip-edit-note { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; font-size: 12.5px;
  background: var(--primary-soft); color: var(--text); }
.stop.locked { opacity: .8; }
.stop.locked .stop-row { gap: 8px; }
.stop-locked-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.stop.locked .sd-notes { width: 100%; margin-top: 6px; }
.oe-point.pickup.locked .oe-point-row { gap: 8px; }
/* Trip page: its change history. */
.td-edits { margin: 0 2px 10px; font-size: 12.5px; }
.td-edits summary { cursor: pointer; color: var(--text-2); font-weight: 600; }
.td-edits ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
/* Trip Performance: a trip driven past its plan (reports.js delivery). */
.report-table tr.rep-km-over td { background: color-mix(in srgb, var(--amber) 12%, transparent); }
.td-crew-p { display: inline-flex; align-items: center; gap: 6px; }
.route-toggle { width: 26px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); margin-left: auto; }
.route-toggle.on { color: var(--primary); }
.route-toggle:hover { background: var(--surface-2); }
/* Wraps: on a phone "Stop 2 · ref", the ETA chip, the eye and a long status
   ("EN ROUTE TO PICKUP") did not fit one row and the status was clipped. */
.td-order .tdo-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 6px; }
.td-order .tdo-head .ostatus { margin-left: 0; }
.td-order .tdo-ref { font-weight: 700; font-size: 13px; }
.td-order .tdo-route { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.td-order .tdo-route b { color: var(--text); font-weight: 600; }
/* per stop: how long and how far from the point reached before (trips.js fillStopLegs) */
.td-order .tdo-legs, .tx-legs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); margin: -4px 0 8px; }
.td-order .tdo-legs[hidden] { display: none; }
.tx-legs { margin: 4px 0 0; }
.td-order .tdo-leg, .tx-legs .tdo-leg { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.td-order .tdo-leg b, .tx-legs .tdo-leg b { color: var(--text); font-weight: 600; }
.td-order .tdo-leg-k, .tx-legs .tdo-leg-k { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-3, var(--text-2)); }
/* the plan per stop (trips.js stopLines): PLAN before, ETA on the way, ACTUAL after */
.tdo-leg.plan b { color: var(--text-2); }
.tdo-leg.eta { color: var(--primary); }
.tdo-leg.eta b { color: var(--primary); }
.tdo-leg .ontime-chip { margin-left: 2px; }
#tdOrders.has-plan .tdo-head .eta-chip { display: none; }
.tdo-leg-vs { color: var(--text-3, var(--text-2)); }
.tdo-leg-vs b { color: var(--text-2) !important; font-weight: 600; }
.tdo-leg .tdo-plan-edit { padding: 0 6px; min-height: 0; line-height: 1.6; }
.tdo-plan-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tdo-plan-form label { display: inline-flex; align-items: center; gap: 4px; }
.tdo-plan-form input { width: 70px; padding: 3px 6px; font-size: 12px; }
.ostatus { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; background: var(--gray-soft); color: var(--text-2); white-space: nowrap; }
.ostatus.at_pickup, .ostatus.at_dropoff { background: color-mix(in srgb, var(--st-nolocate) 16%, transparent); color: var(--st-nolocate); }
.ostatus.en_route_pickup, .ostatus.en_route_dropoff { background: color-mix(in srgb, var(--st-moving) 14%, transparent); color: var(--st-moving); }
.ostatus.picked_up { background: var(--primary-soft); color: var(--primary); }
.ostatus.delivered { background: var(--green-soft); color: var(--green); }
.ostatus.cancelled, .ostatus.failed { background: var(--red-soft); color: var(--red); }

.timeline { display: flex; flex-direction: column; gap: 0; margin: 6px 0 10px; }
.tl-row { display: flex; gap: 9px; font-size: 11.5px; }
.tl-dot { width: 9px; flex-shrink: 0; position: relative; }
.tl-dot::before { content: ''; position: absolute; left: 3px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.tl-row:not(:last-child) .tl-dot::after { content: ''; position: absolute; left: 6px; top: 9px; bottom: -6px; width: 1.5px; background: var(--border); }
.tl-body { padding-bottom: 8px; }
.tl-body b { font-weight: 600; }
.tl-body span { color: var(--text-3); }
.tl-note { color: var(--text-2); font-size: 11.5px; font-style: italic; margin-top: 1px; }
.tl-photo { display: block; margin-top: 5px; width: 88px; height: 88px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.tl-photos { display: flex; gap: 6px; flex-wrap: wrap; }
.tl-reason { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.tdo-actions .fail-code { max-width: 100%; }
.pod-note, .pod-recv { flex: 1; min-width: 120px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--text); outline: none; }
.pod-note:focus, .pod-recv:focus { border-color: var(--green); }
.pod-photo-btn { cursor: pointer; }
.pod-file { font-size: 11px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fail-reason { flex: 1; min-width: 120px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--text); outline: none; }
.fail-reason:focus { border-color: var(--red); }
.tdo-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.tdo-actions .btn-ghost { padding: 0 11px; font-size: 12px; min-height: var(--ctl-h-sm); }
.tdo-actions .btn-ghost.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tdo-share { margin-top: 9px; padding: 11px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2, rgba(0,0,0,.02)); }
.share-hd { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.share-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.share-link { flex: 1 1 100%; min-width: 0; font-size: 12px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); font-family: ui-monospace, monospace; }
/* after the link wraps to its own line, keep "Expires…" left and the buttons right */
.share-row .share-exp { margin-right: auto; }
.tdo-share .btn-ghost { padding: 0 11px; font-size: 12px; min-height: var(--ctl-h-sm); }
.share-user { flex: 1; font-size: 13px; font-weight: 600; }
/* flex:none, not flex:1 — .field is a COLUMN flex container, so flex:1 set
   flex-basis:0 on the main (vertical) axis and the height was ignored. */
.share-user-input { flex: none; min-width: 0; height: var(--ctl-h-md); box-sizing: border-box; font-size: 13px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
/* Live share shared with an account (vshare.js): who it went to, on the line
   a public link's URL takes — the same height, so rows of both kinds align. */
.share-to { flex: 1 1 100%; min-width: 0; display: flex; align-items: center; min-height: var(--ctl-h-sm); box-sizing: border-box;
  font-size: 12.5px; padding: 0 9px; border: 1px dashed var(--border); border-radius: 7px; color: var(--text-2); }
.vsh-to b { color: var(--text); font-weight: 700; }

/* Shared with me (Phase B) */
.shared-intro { color: var(--muted); font-size: 13px; margin-bottom: 12px; max-width: 640px; }
.shared-card { display: flex; align-items: center; gap: 12px; cursor: pointer; transition: border-color .15s, transform .05s; }
.shared-card:hover { border-color: var(--primary); }
.shared-card:active { transform: scale(.997); }
.shared-card-main { flex: 1; min-width: 0; }
.shared-card-top { display: flex; align-items: center; gap: 9px; }
.shared-ref { font-weight: 700; }
.shared-card-sub { font-size: 13px; color: var(--text); margin-top: 3px; }
.shared-card-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.shared-card-arrow { color: var(--muted); flex-shrink: 0; }

/* Shared view tabs (with me / by me) */
/* Segmented track. The TRACK is one --ctl-h-md control (3px padding + a
   --ctl-h-sm segment = 34px), which is how it lines up with the buttons and
   tab bars beside it — .group-toggle below is built the same way, and
   .ra-toolbar used to pin it to 34px by hand for exactly this reason. */
/* .shared-tab / .shared-tabs: the page-level underline tabs (shared rule in
   the Alerts section). They were the one page drawn as a segmented pill track,
   which also wrapped "Shared with me" onto two lines on a phone. */
.shared-pane[hidden] { display: none; }
.shared-out-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* grouping toggle (text segmented control) */
.group-toggle { display: inline-flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: var(--radius-sm); }
.group-toggle[hidden] { display: none; }
.group-toggle button { display: inline-flex; align-items: center; min-height: var(--ctl-h-sm); line-height: 1; padding: 0 11px; border: none; background: none; border-radius: var(--radius-xs); font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.group-toggle button:hover { color: var(--text); }
.group-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* outbound (shared-by-me) rows */
.shareout-group-h { font-size: 11.5px; font-weight: 800; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.shareout-group:first-child .shareout-group-h { margin-top: 2px; }
.shareout-group-n { background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; letter-spacing: 0; }
.shareout-row { display: flex; align-items: center; gap: 12px; cursor: pointer; transition: border-color .15s; margin-bottom: 8px; }
.shareout-row:hover { border-color: var(--primary); }
.shareout-main { flex: 1; min-width: 0; }
.shareout-top { display: flex; align-items: center; gap: 9px; }
.shareout-target { margin-top: 7px; }
.shareout-to { font-size: 12.5px; font-weight: 700; }
.shareout-to.user { color: var(--primary); }
.shareout-to.link { color: var(--text-2); }
.shareout-actions { display: flex; gap: 7px; flex-shrink: 0; }
.shareout-actions .btn-ghost { padding: 0 11px; font-size: 12px; min-height: var(--ctl-h-sm); }
.sd-status { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sd-meta { font-size: 13px; color: var(--muted); margin: 8px 0; }
.sd-stepper { display: flex; margin: 6px 0 14px; }
.sd-step { flex: 1; text-align: center; position: relative; font-size: 11px; color: var(--muted); font-weight: 600; }
.sd-step .b { width: 16px; height: 16px; border-radius: 50%; background: var(--border); margin: 0 auto 6px; position: relative; z-index: 1; }
.sd-step.done .b, .sd-step.cur .b { background: var(--primary); }
.sd-step.cur .b { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent); }
.sd-step.done, .sd-step.cur { color: var(--text); }
.sd-step:not(:first-child)::before { content: ''; position: absolute; left: -50%; top: 7px; width: 100%; height: 2px; background: var(--border); }
.sd-step.done::before, .sd-step.cur::before { background: var(--primary); }
#sharedDetailMap { height: 100%; min-height: 320px; border-radius: 12px; }
.pin { width: 24px; height: 24px; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font: 700 10px Inter, sans-serif; }

/* ============ MODALS ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 22, .55); z-index: 1500; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; display: none; max-height: 90vh; overflow-y: auto; }
.modal.open { display: block; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal header h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-body .field { min-width: 0; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
/* The place / geofence / route editors are taller than a laptop screen (form +
   map), and the whole .modal scrolls — so Save sat below the fold, under a
   half-visible map. Their footer stays pinned to the bottom of the dialog;
   z-index clears Leaflet's panes (400) and controls (800/1000). */
#poiModal footer, #gfModal footer, #routeModal footer {
  position: sticky; bottom: 0; z-index: 1001; background: var(--surface);
}
.tag-row { display: flex; align-items: center; gap: 9px; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.tag-row:last-child { border-bottom: none; }
.tag-row .tag-assign { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--primary); }
.tag-row .tag-name { flex: 1; min-width: 0; background: var(--surface-2); border: 1.5px solid transparent; border-radius: 8px; padding: 6px 9px; font-size: 13px; color: var(--text); outline: none; }
.tag-row .tag-name:focus { border-color: var(--primary); background: var(--surface); }
.tag-row .tag-del { color: var(--text-3); flex-shrink: 0; }
.tag-row .tag-del:hover { color: var(--red); }
.tag-new { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tag-new input[type="text"] { flex: 1; min-width: 110px; height: var(--ctl-h-md); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; font-size: 13px; color: var(--text); outline: none; }
.tag-new input[type="text"]:focus { border-color: var(--primary); }
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch.sel { border-color: var(--text); }
/* native colour input as a swatch (row recolor + new-tag custom) */
.tag-color, .swatch-custom { width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; flex-shrink: 0; background: var(--surface-2); overflow: hidden; }
.tag-color::-webkit-color-swatch-wrapper, .swatch-custom input::-webkit-color-swatch-wrapper { padding: 0; }
.tag-color::-webkit-color-swatch, .swatch-custom input::-webkit-color-swatch { border: none; border-radius: 5px; }
.swatch-custom { position: relative; display: grid; place-items: center; }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch-custom span { font-size: 14px; font-weight: 700; color: var(--text-3); line-height: 1; }
.swatch-custom.sel { border-color: var(--text); border-width: 2px; }
.swatch-custom.sel span { color: #fff; }

/* ============ OPERATOR-SESSION BANNER ============
   Shown when an operator has opened a customer's account from the admin panel.
   Amber, not the alarm red: this is a standing statement of fact, and borrowing
   the alarm colour for it would cost that colour its meaning.

   z-index 1250 — under the alarm banner (1300) so it never covers an
   unacknowledged alert, and under the modal backdrop (1500).

   The [hidden] guard is not optional: an author `display` beats the UA sheet's
   [hidden] { display: none }, and a flex banner set hidden=true stays on
   screen without it. That has been shipped here once already. */
.imp-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1250; display: flex; align-items: center; gap: 9px;
  padding: 8px 15px; border-radius: 999px;
  background: #7c5306; color: #fff;
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 6px 22px rgba(124, 83, 6, .34);
  border: 1px solid rgba(255, 255, 255, .22);
  max-width: calc(100vw - 24px);
}
.imp-banner[hidden] { display: none; }
/* Both are fixed pills centred at the top, so together they land on each
   other. The alarm banner moves rather than this one: an operator session is
   constant for the whole visit and this bar is its frame, while an alert is
   the thing that must arrive ON TOP of whatever is already there. */
body.impersonating .alarm-banner { top: 54px; }
.imp-leave {
  font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: #7c5306; background: #fff; border: 0; border-radius: 999px;
  padding: 4px 11px; margin-left: 2px; cursor: pointer; flex: none;
}
.imp-leave:hover { background: #ffe9c2; }

/* Where Leave lands. A full cover, not a card over the running app: the point
   is that the session is over, and leaving the customer's map visible behind
   it would say the opposite. */
.imp-ended {
  position: fixed; inset: 0; z-index: 1600;   /* above the modal backdrop (1500) */
  display: grid; place-items: center; padding: 24px;
  background: var(--bg);
}
.imp-ended[hidden] { display: none; }
.imp-ended-card {
  max-width: 420px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px 26px;
  box-shadow: 0 4px 16px rgba(22, 27, 46, .08);
}
.imp-ended-h { font-size: 17px; font-weight: 800; margin-bottom: 10px; }
.imp-ended p { margin: 0 0 8px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.imp-ended .imp-ended-sub { color: var(--text-3); font-size: 12.5px; margin: 0; }
.imp-banner b { font-weight: 800; }
.imp-banner .imp-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; flex: none; }
@media (max-width: 640px) {
  .imp-banner { font-size: 11.5px; padding: 7px 12px; }
  /* On a phone the alarm banner is the one that must stay readable, so this
     keeps its dot and the account name and lets the sentence trail off. */
  .imp-banner .imp-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62vw; }
}

/* ============ UNACKED-ALERT BANNER ============
   The alarm that cannot be muted. Fixed to the top so it survives every
   view and any scroll position, above the user menu (1200) but below the
   modal backdrop (1500) — acking happens in a modal, and the banner must
   not sit over it. */
.alarm-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1300; display: flex; align-items: center; gap: 9px;
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  background: var(--st-alarm); color: #fff;
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 6px 22px rgba(220, 38, 38, .38);
  border: 1px solid rgba(255, 255, 255, .22);
  max-width: calc(100vw - 24px);
}
.alarm-banner[hidden] { display: none; }
.alarm-banner:hover { filter: brightness(1.06); }
.alarm-banner .ab-count { font-size: 15px; font-weight: 800; }
.alarm-banner .ab-open { opacity: .9; font-weight: 700; margin-left: 4px; white-space: nowrap; }
/* The pulse carries the urgency when the banner has been on screen a while
   and stopped being new information. */
.alarm-banner .ab-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #fff;
  animation: ab-pulse 1.6s ease-in-out infinite;
}
@keyframes ab-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) {
  .alarm-banner .ab-dot { animation: none; }
}
@media (max-width: 640px) {
  .alarm-banner { font-size: 12px; padding: 8px 13px; gap: 7px; }
  .alarm-banner .ab-text { display: none; }  /* count + Review still read fine */
}
/* Centred, the banner sat on the page title of a phone ("Dashbo…",
   "Sub-acc…") — the title starts at 72px and the banner's left edge came
   in at 134px on a 390px screen. Here it joins the right-hand cluster as
   a compact ● 3 › pill just left of the Guide button, and while it shows
   the connection pill keeps only its dot, which makes the room. */
@media (max-width: 540px) {
  .alarm-banner { left: auto; right: 104px; transform: none; top: 13px; padding: 7px 11px; gap: 6px; }
  .alarm-banner .ab-open { font-size: 0; margin-left: 0; }
  .alarm-banner .ab-open::after { content: "›"; font-size: 17px; line-height: 1; }
  .alarm-banner:not([hidden]) ~ .workspace #connLabel { display: none; }
}

/* ============ TOAST ============ */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 16px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; z-index: 2000; opacity: 0; transition: opacity .25s, transform .25s; box-shadow: var(--shadow-lg); max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* "A new version is available" — stays until Refresh or ×, above the toasts */
.update-bar { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 2001; display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--bg); padding: 8px 8px 8px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.update-bar-go { background: var(--primary); color: #fff; border: 0; border-radius: 8px; padding: 6px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.update-bar-x { background: none; border: 0; color: inherit; opacity: .7; font-size: 18px; line-height: 1; padding: 4px 6px; cursor: pointer; }
.update-bar-x:hover { opacity: 1; }
/* Subscription ending / ended (js/src/subnotice.js). Above the refresh bar,
   so the two never sit on top of each other. */
.sub-bar { position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%); z-index: 2001; width: max-content; max-width: min(560px, calc(100vw - 32px)); background: var(--amber-soft); color: var(--text); border: 1px solid var(--amber); border-radius: 12px; padding: 8px 8px 8px 14px; font-size: 13px; box-shadow: var(--shadow-lg); }
.sub-bar.ended { background: var(--red-soft); border-color: var(--red); }
.sub-bar-row { display: flex; align-items: center; gap: 8px; }
.sub-bar-text { flex: 1; line-height: 1.4; }
.sub-bar-more { background: none; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 4px 10px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sub-bar-x { background: none; border: 0; color: inherit; opacity: .7; font-size: 18px; line-height: 1; padding: 4px 6px; cursor: pointer; }
.sub-bar-x:hover { opacity: 1; }
.sub-bar-list { list-style: none; margin: 8px 0 2px; padding: 0; max-height: 40vh; overflow: auto; }
/* The vehicle panel's Subscription tile */
#dSubEnd { display: flex; flex-direction: column; gap: 2px; }
.sub-end { font-weight: 600; }
.sub-end.soon { color: var(--amber-text); }
.sub-end.ended { color: var(--red); }
.sub-end-note { font-size: 11.5px; font-weight: 400; color: var(--text-2, inherit); opacity: .85; }
.sub-bar-list li { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; border-top: 1px solid var(--border); }

/* ============ LOGIN (dark, Vamos-branded) ============ */
.login-screen {
  position: fixed; inset: 0; z-index: 3000;
  background: #1a1512;
  /* Column, not a stack: the artwork is a flow sibling that takes whatever
     height is left UNDER the content, so nothing is ever printed on top of it.
     It used to be absolutely positioned across the bottom 62%, which put the
     map behind the sign-in foot and the get-the-app codes. */
  display: flex; flex-direction: column;
  /* scrolls, not clips: on a short window the codes sit below the fold, and
     `overflow: hidden` left them unreachable. */
  overflow-x: hidden; overflow-y: auto;
}
.login-screen[hidden] { display: none; }

/* bottom archipelago artwork — a band pinned to the bottom of the screen,
   capped so a tall window (a tablet held upright) doesn't blow it up, and
   shrinking from the top when the content leaves it less room */
.login-art {
  order: 2; margin-top: auto;
  flex: 0 1 auto; height: 420px; min-height: 90px; overflow: hidden;
  pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: .92;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 22%);
}
/* natural aspect, never scaled up: the band clips the top of the image (which
   the mask fades out anyway) rather than zooming and cropping the sides */
.login-art img { width: 100%; max-width: 1180px; height: auto; display: block; }

.login-content {
  order: 1; flex: 0 0 auto;
  position: relative; z-index: 1;
  width: 100%; max-width: 1280px; margin: 0 auto;
  padding: 6vh 48px 28px;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px;
  align-items: start;
}

.login-intro { color: #fff; max-width: 460px; }
.login-intro h1 { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1.12; margin-bottom: 16px; }
.login-intro > p { font-size: 15.5px; color: #b9b2ab; line-height: 1.6; margin-bottom: 26px; }
.login-points { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: #e7e2dc; }
.lp-check { width: 20px; height: 20px; flex-shrink: 0; position: relative; }
.lp-check::after { content: ''; position: absolute; left: 4px; top: 4px; width: 11px; height: 6px; border-left: 2.4px solid #2f5dff; border-bottom: 2.4px solid #2f5dff; transform: rotate(-45deg); }

.login-right { display: flex; flex-direction: column; align-items: flex-end; }
/* the codes sit to the LEFT of the wordmark, both bottom-aligned on the same
   baseline as the console tag */
.login-head { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
/* the wordmark yields first when the row is tight — the codes have to keep
   their size to stay scannable */
.login-brand { display: flex; flex-direction: column; align-items: flex-end; flex: 0 1 auto; min-width: 0; }
.login-logo-img { max-height: 68px; height: auto; width: auto; max-width: 100%; margin-bottom: 6px; }
.login-console-tag { font-size: 13px; color: #9a938b; font-weight: 600; letter-spacing: .02em; }

.login-form { width: 100%; }
.login-form h2 { color: #fff; font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.login-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.lf { display: flex; flex-direction: column; gap: 7px; }
.lf label { font-size: 12.5px; font-weight: 600; color: #cfc9c2; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap svg { position: absolute; left: 13px; color: #8b847d; pointer-events: none; }
.input-wrap input {
  width: 100%;
  background: #241e1a;
  border: 1px solid #3a322c;
  border-radius: 10px;
  padding: 13px 13px 13px 38px;
  font-size: 14px; color: #fff;
  outline: none; transition: border-color .15s, background .15s;
}
.input-wrap input::placeholder { color: #6f6760; }
.input-wrap input:focus { border-color: #2f5dff; background: #2a2320; }

.login-error { color: #ff7a7a; font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
.login-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: #2f5dff; color: #fff;
  font-size: 15px; font-weight: 700;
  padding: 14px; border-radius: 11px;
  transition: filter .15s;
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:disabled { opacity: .65; cursor: default; }
.login-foot { font-size: 12px; color: #8b847d; margin-top: 14px; text-align: center; }

/* Get-the-app block, beside the wordmark: one QR per store, each also a
   tappable link so a phone (which cannot scan its own screen) still works. */
.login-apps { flex: 0 0 auto; }
.la-title { display: block; font-size: 11.5px; font-weight: 700; color: #9a938b; letter-spacing: .02em; margin-bottom: 8px; }
.la-codes { display: flex; gap: 14px; }
.la-code { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; }
.la-code img { width: 78px; height: 78px; display: block; border-radius: 9px; background: #fff; padding: 5px; border: 1px solid #3a322c; transition: border-color .15s, transform .15s; }
.la-code:hover img { border-color: #2f5dff; transform: translateY(-2px); }
.la-store { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #b9b2ab; }
.la-code:hover .la-store { color: #fff; }

/* Tablet: the head row is too narrow to hold the codes beside the wordmark
   without squeezing it, so inside the same column the codes drop under the
   wordmark. The two-column layout itself is unchanged — pulling the masthead
   out to full width leaves a dead band across the top. */
@media (max-width: 1100px) {
  .login-head { flex-direction: column; align-items: flex-end; gap: 14px; }
  .login-brand { order: -1; }
}

/* ============ MOBILE BOTTOM NAV ============ */
.mobnav { display: none; }
/* Only a Mechanic's bar carries Maintenance — every other account reaches it
   from More, as before (the bar has no room for a fifth destination). */
.mob-btn.mob-maint { display: none; }
.rail-scrim { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1180px) {
  .stat-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* seven status tiles: Total takes its own row, the six states fill two
     rows of three here (three rows of two on a phone) with no orphan */
  .stat-cards:not(.deliv-cards) > .stat-card:first-child { grid-column: 1 / -1; }
  .deliv-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-cards { grid-template-columns: minmax(0, 1fr); }
  .uc-kpis { grid-template-columns: repeat(2, 1fr); }
  /* the ops cards' two-column split stacks — side-by-side bars and tables
     are unreadable at phone width */
  .oc-split { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 820px) {
  :root {
    --sidebar-w: 100%;
    /* one source of truth for the bottom nav's real footprint (bar + home
       indicator) — the workspace, the map sheet and every bottom-anchored
       overlay below key off it */
    --mobnav-h: calc(62px + env(safe-area-inset-bottom));
    /* How tall the live-map bottom sheet is when open — kept as a LENGTH,
       not a percentage: overlays that ride above it use it in `bottom`, and
       a % there would resolve against the wrong containing block. */
    --map-h: calc(100dvh - var(--ctx-h) - var(--mobnav-h));
    /* The sheet is as tall as what it holds — its filters plus a row of cars
       — so the map keeps most of the screen. main.js measures it and writes
       the real height to --sheet-h on #view-live; this is only the value
       before that first reading. --sheet-max stops a tall head (every filter
       open, a long tag list) from taking the map over again. */
    --sheet-max: calc(var(--map-h) * .7);
    --sheet-h: var(--sheet-max);
  }

  /* rail becomes a slide-in drawer.
     It sits ABOVE the bottom nav (1100): the nav used to paint over the
     drawer's last ~62px, which swallowed taps on the bottom-most buttons
     (Theme / Account). The scrim goes above the nav too, so a tap outside
     the drawer closes it instead of switching view behind it. */
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .rail.open { transform: translateX(0); }
  .rail-scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1150; }

  /* A short phone (or any phone in landscape) can't fit the whole rail, and
     the tail simply fell off the bottom edge with no way to reach it.
     Scroll the DESTINATION LIST only — not .rail itself, whose overflow
     would clip the account popover that opens outside the rail — so Theme
     and Account stay pinned above the fold. */
  .rail-nav {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* soft bottom edge, so a half-cut icon reads as "more below" rather
       than as a rendering glitch (invisible when the list already fits) */
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
  }
  .rail-nav::-webkit-scrollbar { display: none; }
  .rail-foot { flex-shrink: 0; padding-top: 10px; border-top: 1px solid var(--border); }

  /* No duplicate destinations: the bottom bar owns Dashboard / Live map /
     Trips / Alerts, so the drawer only carries what the bar can't fit.
     Feature gating still uses the [hidden] attribute, which is unaffected. */
  .rail-btn[data-view="dashboard"],
  .rail-btn[data-view="live"],
  .rail-btn[data-view="trips"],
  .rail-btn[data-view="alerts"] { display: none; }
  /* A Mechanic's Maintenance sits in the bottom bar, so not in the drawer too. */
  html.is-mechanic .rail-btn[data-view="maintenance"] { display: none; }
  /* A customer with every module has ten destinations here; at the full 9px
     the tenth (Sub-accounts) fell just past the fold of an 844px phone and
     read as cut off under the list's fade. It still scrolls on a shorter one. */
  .rail-nav .rail-btn { padding: 7px 4px; }

  .ctx-menu { display: grid; }
  .ctx-company { display: none; }

  .workspace { padding-bottom: var(--mobnav-h); }

  /* mobile bottom nav */
  .mobnav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--mobnav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 1100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mob-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 10px; font-weight: 600; min-width: 0; }
  html.is-mechanic .mob-btn.mob-maint { display: flex; }
  .mob-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mob-btn.active { color: var(--primary); }

  /* toasts clear the bottom nav instead of hiding behind it */
  .toast { bottom: calc(var(--mobnav-h) + 14px); }
  .update-bar { bottom: calc(var(--mobnav-h) + 14px); }
  .sub-bar { bottom: calc(var(--mobnav-h) + 64px); }

  /* live map: sidebar becomes a bottom sheet */
  .map-view { flex-direction: column; }
  .sidebar {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; max-height: var(--sheet-max);
    border-right: none; border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
    transition: transform .28s ease;
    z-index: 600;
  }
  .sidebar.collapsed { margin-left: 0; transform: translateY(calc(100% - 52px)); }
  .sidebar-head { border-radius: 18px 18px 0 0; flex-shrink: 0; }
  /* The map comes first on a phone: the open sheet shows ONE card, or two
     rows of the compact plates, plus a sliver of the next so it reads as a
     list that scrolls. Picking a car is mostly done by search or by tapping
     its pin anyway. Heights are the cards' own — a full card is 66px, a
     compact one 36px — plus the list's 10px top padding and the gaps.
     Group mode adds room for one sticky fleet header. */
  .vehicle-list { flex: 0 1 auto; min-height: 0; max-height: 98px; }
  .vehicle-list.compact { max-height: 106px; }
  .vehicle-list.grouped { max-height: 140px; }
  .vehicle-list.grouped:has(.fleet-group-body.compact) { max-height: 148px; }
  .vehicle-list .list-empty { padding: 14px 12px; }
  .sidebar-collapse {
    /* grab tab riding the top edge of the bottom sheet (--sheet-h open / 52px peek) */
    left: 50%; top: auto; bottom: calc(var(--sheet-h) - 1px); transform: translateX(-50%);
    width: 80px; height: 30px; border: 1px solid var(--border); border-bottom: none;
    border-radius: 9px 9px 0 0;
    transition: bottom .28s ease;
  }
  .map-view:has(.sidebar.collapsed) .sidebar-collapse { left: 50%; bottom: 51px; }
  .map-view:has(.sidebar.collapsed) .sidebar-collapse svg { transform: rotate(90deg); }
  .sidebar-collapse svg { transform: rotate(-90deg); }

  /* Leaflet's zoom buttons sit bottom-right, i.e. buried under the sheet —
     "zoom out" was completely untappable. Move them to the bottom-LEFT
     (the right edge belongs to the .map-tools column, which runs from the
     top down past halfway) and lift them clear of the sheet in both states. */
  #view-live .leaflet-bottom.leaflet-right { right: auto; left: 0; }
  #view-live .leaflet-bottom.leaflet-right .leaflet-control { float: left; clear: left; margin: 0 0 10px 10px; }
  /* lift only the zoom buttons (relative, so the attribution keeps its slot
     at the very bottom instead of being dragged into the middle of the map) */
  #view-live .leaflet-control-zoom {
    position: relative;
    bottom: calc(var(--sheet-h) + 8px);
    transition: bottom .28s ease;
  }
  /* same ID specificity as the rule above, or it would never win */
  #view-live:has(.sidebar.collapsed) .leaflet-control-zoom { bottom: 62px; }
  .tagcolor-legend { left: 12px; max-height: 34%; } /* no collapse tab on phones */

  /* Half the map at most — the top half stays map, and the car is aimed into
     it (main.js viewCenterFor). At 70vh the panel covered the car it had
     just been opened for; the rest of its fields scroll. */
  /* bottom: the list sheet still peeks 52px under it (its search row), and
     at 8px the panel's last field sat behind that peek where no amount of
     scrolling could bring it out. */
  .detail-panel { left: 8px; right: 8px; bottom: 60px; padding: 4px 14px 14px; max-height: calc(var(--map-h) * .5); overflow-y: auto; }
  /* The sheet rises over the right-hand tool column, which sits above it in
     the stack (500 vs 450) — the column drew over the sheet's own fields and
     its close button. Raising the sheet would bury the camera panel (480)
     opened from it, so the column steps aside while the sheet is up instead;
     collapse or close the sheet and it is back. */
  #view-live .map-tools { transition: opacity .2s, visibility .2s; }
  #view-live:has(.detail-panel.open:not(.collapsed)) .map-tools { opacity: 0; visibility: hidden; pointer-events: none; }
  .detail-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .detail-title h2 { white-space: nowrap; }
  .detail-actions { justify-content: flex-end; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-wide,
  .detail-grid .m-span2, .detail-grid .m-span3, .detail-grid .m-span4 { grid-column: span 2; }
  .detail-actions .btn-ghost { padding: 0 10px; }

  /* Same footing as the detail panel: clear of the sheet's 52px search peek
     (it covered "Add to routes"), scrolling inside rather than growing. */
  .playback-bar { left: 8px; right: 8px; bottom: 60px; max-height: calc(var(--map-h) * .6); overflow-y: auto; }
  /* ...and the tool column steps aside for it as it does for the detail
     panel: drawn above the bar, it sat exactly over the bar's close button,
     so tapping ✕ opened the geofence filter instead. */
  #view-live:has(.playback-bar:not([hidden])) .map-tools { opacity: 0; visibility: hidden; pointer-events: none; }
  .pb-time { min-width: 0; }
  /* room for the sheet's pull tab, which stands above its 52px peek and sat on
     the last row of options */
  .playback-bar { padding-bottom: 28px; }

  .view-inner { padding: 16px; }
  .mobile-only { display: flex; }

  /* trips table sheds non-essential columns */
  .trips-tools-row .btn-primary { margin-left: 0; }
  .trip-table th:nth-child(3), .trip-table td:nth-child(3),
  .trip-table th:nth-child(4), .trip-table td:nth-child(4) { display: none; }

  /* Alerts: the row is badge | text | action buttons. At phone width the
     buttons pushed the text down to one word per line and the last of them
     ("Maps") fell off the right edge — drop the actions onto their own line. */
  .alert-item { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .alert-body { flex: 1 1 60%; min-width: 0; }
  .alert-actions { display: flex; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; }

  /* Wide data tables (off-route alerts, rule history, booking log) can't be
     narrowed sensibly — let each one scroll sideways on its own instead of
     spilling out of the card. display:block turns the table into its own
     scroll box without needing a wrapper element in every template. */
  .ra-table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ra-table td { white-space: nowrap; }

  /* Geofence / place rows: same overflow, same cure */
  .gf-item, .poi-item { flex-wrap: wrap; }
  .gf-item-body, .poi-item-body { flex: 1 1 100%; }
  .gf-cat, .poi-cat-sel { max-width: none; flex: 1 1 auto; }
  .gf-locate, .poi-item-actions { margin-left: auto; }
  .poi-item-actions { flex-wrap: wrap; justify-content: flex-end; }
  /* Route rows: category + Show / Compare / Edit / bin pushed Edit and the bin
     off the card on a phone (the view panned 78px sideways). */
  .rf-head .rf-actions { flex-wrap: wrap; margin-left: 0; }
  .rf-cat { max-width: none; flex: 1 1 auto; }

  /* Cargo: five tabs + Setup are ~490px. The row scrolls on its own instead
     of widening the whole view (it panned 130px sideways, Setup off-screen). */
  .cg-tabs, .shared-tabs { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .cg-tabs::-webkit-scrollbar, .shared-tabs::-webkit-scrollbar { display: none; }
  .shared-tabs > .shared-tab { flex-shrink: 0; }   /* "Link live" ran off the phone's edge, out of reach */
  .cg-tab, #cgSetupBtn { flex-shrink: 0; }
  /* a long status badge ("Empty · in transit · next: …") ran off its card */
  .cg-row { flex-wrap: wrap; }
  .cg-row .cg-chip { white-space: normal; max-width: 100%; min-width: 0; line-height: 1.25; padding-top: 2px; padding-bottom: 2px; }
  .cg-row .cg-row-basis { min-width: 0; }

  /* Bookings toolbar: date stepper + Today + Day/Week wouldn't fit on one
     line, so the Day/Week toggle was clipped off-screen and unreachable. */
  .bk-week-nav { flex-wrap: wrap; }
  .bk-range { min-width: 0; flex: 1 1 auto; }
  .bk-toolbar, .bk-toolbar-actions { flex-wrap: wrap; }

  /* Multi-view toolbar: the 2×2…8×8 strip is wider than a phone. Let it
     scroll on its own instead of widening the whole page (which put the
     bottom nav's labels behind a horizontal scrollbar). */
  .multi-wrap { max-width: 100%; overflow-x: hidden; }
  .mv-tb-group { max-width: 100%; min-width: 0; }
  .mv-grid-opts { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .mv-grid-opts::-webkit-scrollbar { display: none; }
  .mv-gopt { flex-shrink: 0; }
  .mv-zoom { width: 90px; }

  /* trip modals stack on mobile */
  .modal-body.trip-create, .modal-body.trip-detail { grid-template-columns: 1fr; }
  .trip-form, .td-orders { border-right: none; border-bottom: 1px solid var(--border); max-height: none; }
  .trip-map-wrap { min-height: 300px; }
  #tripCreateMap, #tripDetailMap { min-height: 300px; }

  /* login: one column, shrink artwork */
  .login-screen { overflow-y: auto; }
  .login-content { grid-template-columns: 1fr; gap: 0; padding: 5vh 22px 28px; }
  .login-intro h1 { font-size: 28px; }
  /* One column: `display: contents` on the right column and on the head row
     leaves intro, wordmark, form and codes as four siblings that order freely.
     The codes go last — a phone cannot scan its own screen, so they must not
     come between the reader and the sign-in form. */
  .login-right, .login-head { display: contents; }
  .login-intro { order: 1; margin-bottom: 26px; }
  .login-brand { order: 2; align-items: flex-start; margin-bottom: 18px; }
  .login-form { order: 3; }
  .login-apps { order: 4; margin-top: 20px; text-align: center; }
  .la-codes { justify-content: center; }
  .login-logo-img { max-height: 72px; align-self: flex-start; }
  .login-fields { grid-template-columns: 1fr; }
  /* 16px: below it, a browser that has no viewport fix (iOS before the head
     script runs, in-app browsers) zooms in on focus and leaves the form
     hanging off the right edge. */
  .input-wrap input { font-size: 16px; }
  .login-art { height: 210px; min-height: 110px; opacity: .5; }
  /* phones can't scan their own screen, but the codes are links too — tapping
     one opens the store. */
  .la-codes { gap: 16px; }
  .la-code img { width: 84px; height: 84px; }
}

@media (max-width: 420px) {
  .stat-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat-card { padding: 12px; gap: 10px; }
  .sc-body { min-width: 0; }   /* a long label ("Closed with issues") wraps rather than widening the tile */
  /* the dashboard tables: five columns fit a phone once the padding gives way
     (a long plate wraps under itself; kept on one line it needed a sideways
     scroll inside the card) */
  .uc-table th, .uc-table td { padding: 6px 5px; }
  .sc-num { font-size: 22px; }
  .detail-actions { flex-wrap: wrap; justify-content: flex-end; }
  /* no room for all three: keep the scrubbed-to moment, drop the endpoints */
  .pb-axis { grid-template-columns: 1fr; }
  .pb-axis #pbT0, .pb-axis #pbT1 { display: none; }
  /* from and to stack here, so the arrow would point at nothing */
  .pb-range > .muted { display: none; }
}

/* ===== Route fences (Geofences view tab) + off-route alert report ===== */
.rf-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }   /* the gap .gf-item cards keep */
.rf-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rf-head strong { font-size: 14px; }
.rf-badge { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.rf-meta { font-size: 12px; }
.rf-actions { margin-left: auto; display: flex; gap: 6px; }
.rf-assign { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 8px; border-top: 1px solid var(--border); }
.rf-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
/* --rf-col is set inline from the route's own colour (routefences.js
   routeColour); the fallback is the same default violet an uncoloured,
   uncategorised route draws with, so untouched routes look exactly as before. */
.rf-chip.active { background: color-mix(in srgb, var(--rf-col, #7c3aed) 12%, transparent); border-color: var(--rf-col, #7c3aed); color: var(--rf-col, #7c3aed); }
.rf-chip button { border: none; background: none; cursor: pointer; font-size: 12px; line-height: 1; padding: 0 2px; color: inherit; }
.rf-chip .rf-remove:hover { color: var(--st-alarm); }
.rf-add .rf-veh { font-size: 12px; padding: 4px 8px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2); }

/* Start/End marks on a drawn route (routefences.js endpointMarks). The marker
   divIcon is 0x0 at the anchor point; the pill centres itself over it and
   rides slightly above so it doesn't sit on the line. Fixed green/red — the
   marks say which WAY the route runs, so they must not follow route colour. */
/* Scaled with the places (--place-scale), kept readable at 40%; the origin
   is the anchor point after the translate, so it shrinks toward its route end. */
.rf-endpill { position: absolute; transform: translate(-50%, -135%) scale(max(0.4, var(--place-scale, 1))); transform-origin: 50% 135%; white-space: nowrap; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 9px; color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4); pointer-events: auto; }
.rf-endpill-start { background: #16a34a; }
.rf-endpill-end { background: #dc2626; }

.alerts-section { margin-bottom: 22px; }
.alerts-h { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: 0 0 10px; }
.ra-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.ra-filter { font-size: 12.5px; padding: 6px 9px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); }
/* One control height across the whole toolbar — selects, date inputs,
   buttons and the view toggle all sit on the same 34px line. */
/* The height line was lost when the size scale came in (8b5d2c58 kept the
   selector, dropped its rule), and the selects, dates and the vehicle picker
   fell to their content's 19px beside 28px buttons. */
.ra-toolbar .ra-filter { height: var(--ctl-h-md); box-sizing: border-box; padding: 0 10px; border-radius: var(--radius-sm); }
.ra-toolbar .btn-ghost { padding: 0 13px; font-size: 12.5px; }
.ra-toolbar select.ra-filter { min-width: 130px; max-width: 230px; }
/* A phone: two filters a row, each half the width, instead of a ragged stack
   of selects at their own option widths. */
@media (max-width: 560px) {
  #atab-history .ra-toolbar > .ra-filter, #atab-history .ra-toolbar > .vp { flex: 1 1 calc(50% - 4px); min-width: 0; max-width: none; }
  #atab-history .ra-toolbar > .vp > .vp-input { width: 100%; }
}
/* the track sizes itself now — 3px padding + a --ctl-h-sm segment = --ctl-h-md */
/* the shared .group-toggle button rule already sets this step */
/* The History table carries a column per delivery channel now — WhatsApp,
   Telegram and email — so it can outgrow the panel on a narrow desktop window,
   not only at the phone widths the rule further up already handles. Scroll it
   inside its own box: without this the last column (Acked) is clipped off with
   no way to reach it, which reads as "this rule has no acknowledgement" rather
   than as a layout that ran out of room. */
#aeList { overflow-x: auto; }
.ra-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ra-table th { text-align: left; color: var(--text-2); font-weight: 600; padding: 8px 10px; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
/* Column heads read like every other table in the app (.report-table,
   .uc-table, .trip-table): small capitals in the muted colour. These were the
   one sentence-case 12.5px header row. */
.ra-table thead th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border-bottom-width: 1px; }
.ra-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.ra-table tr:hover td { background: var(--surface-2); }
/* Alert history, flat view: a page over several vehicles gets a heading per
   plate — the report tables' section heading, in this table's scale. */
.ra-table .ae-plate th {
  font-size: 13px; font-weight: 700; color: var(--text-1); white-space: normal;
  padding: 16px 10px 7px; border-bottom: 2px solid var(--border);
}
.ra-table tbody tr.ae-plate:first-child th { padding-top: 8px; }
.ae-group-n { font-weight: 500; font-size: 11px; color: var(--text-3); margin-left: 8px; }
.ra-table a { color: #2563eb; text-decoration: none; }
.ra-wa { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.ra-wa.sent { background: rgba(22, 163, 74, .14); color: #16a34a; }
.ra-wa.failed { background: rgba(220, 38, 38, .14); color: var(--st-alarm); }
.ra-pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

/* New-route modal: source toggle (Upload / From history) */
.rm-source-tabs { display: flex; gap: 6px; }
.rm-src { flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: var(--ctl-h-md); box-sizing: border-box; padding: 6px 10px; font-size: 12.5px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--radius-sm); cursor: pointer; }
.rm-src.active { border-color: #7c3aed; background: rgba(124, 58, 237, .1); color: #7c3aed; }
.rm-row { display: flex; gap: 10px; }
.rm-row .field { flex: 1; }
/* The source sections are wrapper divs, so .modal-body's gap can't reach their
   rows — give them the same rhythm themselves. display:flex would defeat the
   `hidden` attribute, hence the explicit [hidden] override. */
#rmFileFields, #rmHistoryFields, #rmGoogleFields { display: flex; flex-direction: column; gap: 12px; }
#rmFileFields[hidden], #rmHistoryFields[hidden], #rmGoogleFields[hidden] { display: none; }
/* Preview button + its result line, vertically centred as one row */
.rm-preview { align-items: center; }
.rm-preview .muted { font-size: 12px; min-width: 0; }

/* Captured alternative paths, listed above the "add another path" button */
.rm-paths { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rm-paths[hidden] { display: none; }
.rm-path { display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font-size: 12px; padding: 4px 8px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.rm-path b { font-weight: 800; color: var(--primary); }
.rm-path-x { border: none; background: none; cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; color: inherit; }
.rm-path-x:hover { color: var(--st-alarm); }
/* the hint beside it may wrap; the button itself must not */
#rmAddPath { flex: 0 0 auto; white-space: nowrap; }
#rmPathsHint { flex: 1 1 160px; min-width: 0; }

/* Route guard picker rows: label · kind · fence/POI pick · POI radius.
   The pick select needs real width, so in the narrow modal the POI case
   wraps it (with the radius) onto its own line. */
.rm-guard-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.rm-guard-lbl { flex: 0 0 78px; font-size: 12px; color: var(--text-2); }
.rm-guard-row select, .rm-guard-row input { min-width: 0; }
.rm-guard-row select:first-of-type { flex: 0 1 132px; min-width: 112px; }
.rm-guard-row select + select { flex: 1 1 160px; }
.rm-guard-row input[type="number"] { flex: 0 0 86px; }

/* Multi-vehicle assign picker (route rows): the shared vehicles picker
   (vehscope.js) inline, then Cancel / Assign. */
.rf-pick { flex-basis: 100%; margin-top: 8px; }
.rf-pick[hidden] { display: none; }
/* The foot wraps: the route list is a narrow column on a phone, and a
   clipped "Assign" button is a dead end. */
.rf-pick-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.rf-pick-foot .btn-primary { padding: 0 14px; font-size: 12.5px; border-radius: var(--radius-xs); min-height: var(--ctl-h-sm); }
.rf-pick-foot .btn-primary[disabled] { opacity: .5; cursor: not-allowed; }

/* Per-vehicle guard state on assignment chips */
.rf-gs { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.rf-gs-armed { background: rgba(220, 38, 38, .12); border-color: #dc2626; color: #dc2626; }
.rf-gs-ready { background: rgba(22, 163, 74, .12); border-color: #16a34a; color: #16a34a; }

/* Route "Show/Hide on map" toggle — active (shown) state */
/* "Show on map" / "Hide on map" — one look for routes, fences and places. */
.map-pin.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* Vehicle live-share modal: multi-vehicle picker + per-link QR code */
.share-qr { flex: 1 1 100%; display: flex; justify-content: center; padding: 8px 0 4px; }
.share-qr svg { width: 170px; height: 170px; border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 8px; }
/* Start/End condition extras (datetime + fence selects revealed on demand) */
#vshStartAt, #vshEndAt, #vshStartFence, #vshEndFence { width: 100%; min-width: 0; box-sizing: border-box; padding: 8px; font-size: 12.5px; font-family: inherit; }
#vshStartAt[hidden], #vshEndAt[hidden], #vshStartFence[hidden], #vshEndFence[hidden] { display: none; }

/* Per-vehicle schedule overrides */
.vsh-pv-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-3); }
.vsh-pv-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; border: 1.5px solid var(--border); border-radius: 9px; padding: 8px; background: var(--surface-2); }
.vsh-pv-row { display: flex; flex-direction: column; gap: 5px; }
.vsh-pv-plate { font-size: 12.5px; font-weight: 700; }
.vsh-pv-conds { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.vsh-pv-conds select, .vsh-pv-conds input { width: 100%; min-width: 0; box-sizing: border-box; padding: 6px 7px; font-size: 12px; font-family: inherit; }
.vsh-pv-conds [hidden] { display: none; }

/* "Live links" monitoring list (Shared view) */
.vsl-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px 14px; margin-bottom: 10px; }
.vsl-card.ended, .vsl-card.expired, .vsl-card.revoked { opacity: .68; }
.vsl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vsl-title { font-weight: 800; font-size: 13.5px; }
.vsl-meta { font-size: 12px; }
.vsl-actions { margin-left: auto; display: flex; gap: 6px; }
.vsl-state { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); flex-shrink: 0; }
.vsl-state.active { background: color-mix(in srgb, var(--st-moving) 15%, transparent); color: var(--st-moving); }
.vsl-state.pending { background: color-mix(in srgb, var(--green) 15%, transparent); color: color-mix(in srgb, var(--green) 80%, var(--text)); }
.vsl-state.revoked { background: color-mix(in srgb, var(--st-alarm) 12%, transparent); color: var(--st-alarm); }
.vsl-vehicles { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.vsl-veh { display: flex; align-items: center; gap: 8px; font-size: 12.5px; flex-wrap: wrap; }

/* Edit-vehicles dialog: the link's current cars, each with one toggle. A
   row marked for removal stays readable (struck, not hidden) so the edit can
   be read back before it is saved. */
.vsh-edit-list { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: 9px; padding: 6px 8px; background: var(--surface-2); }
.vsh-edit-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 2px; }
.vsh-edit-row b { font-weight: 700; white-space: nowrap; }  /* a plate never breaks mid-name */
.vsh-edit-row .vsh-edit-when { margin-right: auto; font-size: 11.5px; min-width: 0; }
.vsh-edit-row button { flex-shrink: 0; }
.vsh-edit-row.drop b, .vsh-edit-row.drop .vsh-edit-when { text-decoration: line-through; opacity: .6; }
.vsh-edit-row.readd b { color: var(--st-moving); }
.vsh-edit-list .none { font-size: 12px; color: var(--text-3); padding: 4px 2px; }

/* The owner's name for a link, where one was given. On the card it takes the
   title slot and the vehicle count steps aside into a quiet counter. */
.share-label { color: var(--text); font-weight: 700; }
.vsl-count { font-size: 12px; }
/* On a phone the three columns leave the condition a sliver, and "until
   arrival in ⬡ Gudang Cengkareng" came out one word per line — so below 560
   the condition drops to its own full-width line under the plate. */
@media (max-width: 560px) {
  .vsh-edit-row { flex-wrap: wrap; }
  .vsh-edit-row .vsh-edit-when { flex-basis: 100%; margin-right: 0; order: 3; }
  .vsh-edit-row b { margin-right: auto; }
  /* two-line rows run together without a rule between them */
  .vsh-edit-row + .vsh-edit-row { border-top: 1px solid var(--border); padding-top: 7px; margin-top: 3px; }
}

/* ============================================================
   Bookings (pool / fleet car booking)
   ============================================================ */
.bk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.bk-week-nav { display: flex; align-items: center; gap: 8px; }
.bk-week-nav .icon-btn.small { width: var(--ctl-h-md); height: var(--ctl-h-md); min-height: var(--ctl-h-md); border-radius: var(--radius-sm); }
.bk-week-nav .btn-ghost.sm { min-height: var(--ctl-h-md); font-size: 12.5px; padding: 0 13px; border-radius: var(--radius-sm); }
.bk-range { font-size: 14px; font-weight: 600; color: var(--text); min-width: 168px; text-align: center; }

/* Today board — summary stat cards */
.bk-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.bk-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.bk-stat .bk-stat-val { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--text); }
.bk-stat .bk-stat-lbl { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.bk-stat.is-out   { border-left: 3px solid var(--primary); }
.bk-stat.is-due   { border-left: 3px solid var(--amber); }
.bk-stat.is-free  { border-left: 3px solid var(--green); }
.bk-stat.is-over  { border-left: 3px solid var(--red); }

/* Calendar — vehicle rows × day columns */
.bk-cal-card { padding: 0; overflow: hidden; }
.bk-cal { display: grid; }
.bk-cal-head, .bk-cal-row { display: grid; grid-template-columns: 168px repeat(7, 1fr); }
.bk-cal-head { position: sticky; top: 0; z-index: 2; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.bk-cal-head > div { padding: 10px 8px; font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; border-left: 1px solid var(--border); }
.bk-cal-head > div:first-child { text-align: left; border-left: 0; }
.bk-cal-head .bk-dow-today { color: var(--primary); }
.bk-cal-row { border-bottom: 1px solid var(--border); }
.bk-cal-row:last-child { border-bottom: 0; }
.bk-veh { padding: 12px 12px; border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; gap: 2px; background: var(--surface); }
.bk-veh-plate { font-weight: 700; font-size: 13px; color: var(--text); }
.bk-veh-sub { font-size: 11px; color: var(--text-3); }
.bk-track { position: relative; grid-column: 2 / span 7; height: 46px; }
.bk-track-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); }
.bk-track-grid > span { border-left: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.bk-track-grid > span:hover { background: var(--surface-2); }
.bk-track-grid > span.bk-is-today { background: rgba(79, 70, 229, .05); }

/* Booking bar overlaid on the track */
.bk-bar { position: absolute; top: 7px; height: 32px; border-radius: 8px; padding: 0 9px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid transparent; }
.bk-bar:hover { filter: brightness(.97); box-shadow: var(--shadow-md); }
.bk-bar .bk-bar-who { font-size: 11.5px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-bar .bk-bar-sub { font-size: 10px; line-height: 1.1; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-bar.s-booked   { background: var(--primary-soft); color: var(--primary); border-color: rgba(79,70,229,.25); }
.bk-bar.s-out      { background: var(--primary); color: #fff; }
.bk-bar.s-returned { background: var(--green-soft); color: var(--green); border-color: rgba(21,163,90,.25); }
.bk-bar.s-closed   { background: var(--gray-soft); color: var(--text-2); }
.bk-bar.s-overdue  { background: var(--red); color: #fff; }

/* Week view: bookings stack inside their day cell, left-aligned — no
   time-proportional placement (readability over timeline accuracy). */
.bk-week-cells { grid-column: 2 / span 7; display: grid; grid-template-columns: repeat(7, 1fr); min-height: 46px; }
.bk-week-cell { border-left: 1px solid var(--border); padding: 5px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; cursor: pointer; transition: background .12s; min-width: 0; }
.bk-week-cell:hover { background: var(--surface-2); }
.bk-week-cell.bk-is-today { background: rgba(79, 70, 229, .05); }
.bk-chip { position: static; top: auto; height: auto; max-width: 100%; padding: 4px 8px; border-radius: 7px; box-shadow: none; }

/* Status legend + availability hint in modal */
.bk-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 11.5px; color: var(--text-2); }
.bk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bk-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.bk-row { display: flex; gap: 10px; }
.bk-row .field { flex: 1; }
.bk-avail { font-size: 12.5px; font-weight: 600; padding: 9px 12px; border-radius: 8px; }
.bk-avail.ok  { background: var(--green-soft); color: var(--green); }
.bk-avail.bad { background: var(--red-soft); color: var(--red); }

/* Booking detail popover (status actions) */
.bk-pop { position: fixed; z-index: 60; width: 248px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; }
.bk-pop h4 { margin: 0 0 2px; font-size: 14px; }
.bk-pop .bk-pop-meta { font-size: 12px; color: var(--text-2); margin-bottom: 10px; line-height: 1.5; }
.bk-pop-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-pop-actions button { flex: 1 1 auto; }

@media (max-width: 760px) {
  .bk-board { grid-template-columns: repeat(2, 1fr); }
  .bk-cal-head, .bk-cal-row { grid-template-columns: 110px repeat(7, 1fr); }
  .bk-track { grid-column: 2 / span 7; }
}

/* Booking detail panel — lifecycle timeline (Phase 2 handover surfaced) */
.bk-pop.bk-detail { width: 322px; }
.bk-pop h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bk-pop-status { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.bk-pop-status.s-booked { background: var(--primary-soft); color: var(--primary); }
.bk-pop-status.s-out { background: var(--primary); color: #fff; }
.bk-pop-status.s-returned { background: var(--green-soft); color: var(--green); }
.bk-pop-status.s-overdue { background: var(--red); color: #fff; }
.bk-pop-status.s-closed,
.bk-pop-status.s-cancelled { background: var(--gray-soft); color: var(--text-2); }

.bk-overdue-banner { background: var(--red-soft); color: var(--red); font-size: 11.5px; font-weight: 600; padding: 7px 10px; border-radius: 8px; margin: 6px 0; }

.bk-timeline { list-style: none; margin: 12px 0 4px; padding: 0; }
.bk-timeline li { position: relative; padding: 0 0 15px 22px; }
.bk-timeline li:last-child { padding-bottom: 0; }
.bk-timeline li::before { content: ""; position: absolute; left: 3px; top: 2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); z-index: 1; }
.bk-timeline li::after { content: ""; position: absolute; left: 7px; top: 12px; bottom: -2px; width: 2px; background: var(--border); }
.bk-timeline li:last-child::after { display: none; }
.bk-timeline li.done::before { background: var(--primary); border-color: var(--primary); }
.bk-timeline li.ok::before { background: var(--green); border-color: var(--green); }
.bk-timeline li.current::before { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.bk-tl-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.bk-tl-sub { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.bk-tl-pending .bk-tl-label { color: var(--text-3); font-weight: 500; }

.bk-badge { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 5px; margin-left: 6px; vertical-align: middle; text-transform: uppercase; letter-spacing: .04em; }
.bk-badge.auto { background: var(--primary-soft); color: var(--primary); }
.bk-badge.manual { background: var(--gray-soft); color: var(--text-2); }

.bk-sim { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.bk-sim-lbl { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.bk-sim .btn-ghost { width: 100%; }

/* Booking setup modal — depots + bookable opt-in */
.bk-toolbar-actions { display: flex; gap: 8px; align-items: center; }
.bk-setup-sec { margin-bottom: 22px; }
.bk-setup-sec:last-child { margin-bottom: 0; }
.bk-setup-sec h4 { margin: 0 0 10px; font-size: 13.5px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bk-setup-hint { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.bk-setup-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.bk-setup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.bk-setup-name { font-size: 13px; font-weight: 600; color: var(--text); }
.bk-setup-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.bk-setup-empty { font-size: 12.5px; color: var(--text-3); padding: 14px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }
.bk-depot-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
/* one row, one height: the two buttons in it are .sm */
.bk-depot-add input { height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 10px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font-size: 12.5px; }
.bk-depot-add input[type="text"] { flex: 1 1 200px; }
.bk-depot-add input[type="number"] { width: 104px; }

/* Booking alerts (Alerts view) — kind pills */
.bk-alert-kind { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.bk-alert-kind.overdue { background: var(--red-soft); color: var(--red); }
.bk-alert-kind.unbooked_use { background: var(--amber-soft); color: var(--amber); }

/* ---- Day view: vehicles × hours (default calendar mode) ---- */
.bk-cal-head.bk-day-head, .bk-cal-row.bk-day-row { grid-template-columns: 168px repeat(18, 1fr); }
.bk-day-head .bk-hour { padding: 10px 2px; font-size: 10.5px; text-align: left; }
.bk-track-grid.bk-day-grid { grid-template-columns: repeat(18, 1fr); }
.bk-track-grid > span.bk-hour-odd { background: rgba(100, 116, 139, .035); }
/* span ALL 18 hour columns — the base .bk-track spans 7 (week layout), which
   squeezed day bars into the 05:00–12:00 region at the wrong hours */
.bk-day-row .bk-track { grid-column: 2 / span 18; height: 56px; }
.bk-day-row .bk-bar { top: 9px; height: 38px; }
.bk-day-row .bk-bar .bk-bar-who { font-size: 12.5px; }
.bk-day-row .bk-bar .bk-bar-sub { font-size: 10.5px; }
.bk-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 3; pointer-events: none; opacity: .8; }
.bk-now::before { content: ""; position: absolute; top: -1px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---- Today-board cards are drill-down buttons ---- */
.bk-stat-btn { cursor: pointer; transition: box-shadow .12s, transform .12s; }
.bk-stat-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.bk-stat-btn.sel { outline: 2px solid var(--primary); outline-offset: -1px; }

/* focus list under the board */
.bk-focus { padding: 12px 16px; margin-bottom: 16px; }
.bk-focus-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.bk-focus-head h4 { margin: 0; font-size: 13px; }
.bk-focus-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.bk-focus-row:hover { background: var(--surface-2); }
.bk-focus-plate { font-weight: 700; font-size: 13px; min-width: 110px; }
.bk-focus-sub { font-size: 12.5px; color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- driver PIN: readable (eye toggle) + inline editable ---- */
.bk-pin-wrap { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 4px 2px 8px; }
.bk-pin-lbl { font-size: 9.5px; font-weight: 700; color: var(--text-3); letter-spacing: .05em; }
.bk-pin-input { width: 58px; border: 0; background: transparent; color: var(--text); font: 600 12.5px 'Inter', sans-serif; letter-spacing: .12em; padding: 4px 2px; }
.bk-pin-input:focus { outline: none; }
.bk-pin-eye { flex-shrink: 0; }

/* ---- driver card: avatar + editable identity on top, PIN + car below ---- */
.bk-driver-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.bk-driver-del { position: absolute; top: 8px; right: 8px; }
.bk-driver-head { display: flex; align-items: center; gap: 10px; padding-right: 28px; }
.bk-driver-avatar { width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font: 700 14px 'Inter', sans-serif; }
.bk-driver-id { display: flex; flex-direction: column; gap: 0; flex: 1; min-width: 0; }
.bk-edit-input { border: 0; background: transparent; color: var(--text); border-radius: 6px; padding: 1px 4px; width: 100%; min-width: 0; }
.bk-edit-input:hover { background: var(--surface-2); }
.bk-edit-input:focus { outline: 1.5px solid var(--primary); background: var(--surface-2); }
.bk-edit-name { font: 700 13.5px 'Inter', sans-serif; }
.bk-edit-phone { font: 400 11.5px 'Inter', sans-serif; color: var(--text-3); }
.bk-driver-card .bk-driver-actions { display: flex; gap: 8px; }
.bk-driver-opts { margin-top: 6px; font-size: 12px; color: var(--text-2); }

/* The driver list is a PAGE now, not a 240px box inside a dialog. Each driver
   is one line — who they are, their PIN, their car, what reaches their phone —
   instead of a stack of rows that needed scrolling to read one person. */
#view-people .bk-setup-list { max-height: none; overflow: visible; }
#view-people .bk-driver-card {
  flex-direction: row; align-items: center; gap: 12px; padding: 8px 10px 8px 12px;
}
#view-people .bk-driver-head { flex: 1 1 200px; min-width: 160px; padding-right: 0; }
#view-people .bk-driver-card .bk-pin-wrap { flex: 0 0 118px; }
#view-people .bk-driver-card .bk-driver-car { flex: 0 0 200px; max-width: 200px; }
#view-people .bk-driver-opts {
  margin-top: 0; flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
}
#view-people .bk-driver-opts .follow-toggle { gap: 6px; white-space: nowrap; }
/* Their score this period (Driver scoring), a line of its own with the way
   to their page there. */
.bk-driver-score { flex: 1 1 100%; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; }
.bk-driver-score[hidden] { display: none; }
.bk-driver-score .bk-score-lbl { color: var(--text-2); font-weight: 600; }
.bk-driver-score .ds-score { min-width: 0; margin-right: 0; }
.bk-driver-score .link-btn { margin-left: auto; }
#view-people .bk-driver-del { position: static; margin-left: auto; flex: 0 0 auto; }

/* Ack people and contacts read as the drivers do: one card per
   person on its own ground, rather than rows separated by a hairline. On a
   page a bottom border is too faint to tell one person from the next. */
#view-people #contactsList { display: flex; flex-direction: column; gap: 6px; }
/* What a contact may do besides receive alerts (contacts.js): a small badge
   on the row, and a tick in the form under the list. */
.ct-badge { flex-shrink: 0; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft, rgba(79, 70, 229, .1)); color: var(--primary); white-space: nowrap; }
.ct-tick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2);
  white-space: nowrap; cursor: pointer; }
.ct-tick[hidden] { display: none; }
#view-people .ct-add #ctPin { flex: 0 1 150px; }
#view-people .ackp-row {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
#view-people .ackp-row:last-child { border-bottom: 1px solid var(--border); }
#view-people .ackp-row.editing { border-radius: 12px; }
/* The name holds its own width; the buttons sit on the right, as on a driver. */
#view-people .ackp-row .ackp-name { flex: 0 1 auto; }
#view-people .ackp-row > .btn-ghost,
#view-people .ackp-row > .icon-btn { flex: 0 0 auto; }

/* The supervisor add form is a two-column grid elsewhere (it lived in a
   dialog); on the page it is one line, like the driver one above it. */
#view-people .ct-add { display: flex; flex-wrap: wrap; align-items: center; }
#view-people .ct-add #muName { flex: 1 1 180px; }
#view-people .ct-add .mu-login-wrap { flex: 1 1 260px; }
#view-people .ct-add #muPassword { flex: 1 1 180px; }
#view-people .ct-add #muAdd,
#view-people .ct-add #muCancel { flex: 0 0 auto; }

/* The add form is one line on a page too, rather than a stack. */
#view-people .bk-driver-add { flex-direction: row; align-items: center; }
#view-people .bk-driver-add #bkDriverName { flex: 1 1 240px; }
#view-people .bk-driver-add-row { flex: 1 1 340px; }
/* Driver or kenek, in front of the name, and on the card beside the phone. */
.bk-driver-role-wrap { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); flex: 0 0 auto; }
.bk-driver-role-wrap select, .bk-driver-role {
  padding: 6px 8px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font-size: 12px;
}
/* On the card it sits on the second row beside the car: the head's right
   edge belongs to the delete button. Same height as the car picker. */
.bk-driver-card .bk-driver-role { flex: 0 0 auto; height: 32px; padding: 0 8px; }

/* Narrow enough and the line wraps rather than squeezing the name away. */
@media (max-width: 1100px) {
  #view-people .bk-driver-card { flex-wrap: wrap; }
  /* Room on the right for the delete button, which floats there now: without
     it the cross sat on top of the WhatsApp link. */
  #view-people .bk-driver-head { flex: 1 1 100%; padding-right: 36px; }
  #view-people .bk-driver-del { position: absolute; top: 8px; right: 8px; margin-left: 0; }
  #view-people .bk-driver-add { flex-wrap: wrap; }
}
.mu-trips-lbl { font-size: 12px; color: var(--text-2); gap: 6px; white-space: nowrap; }
.ppl-pane[hidden] { display: none; }

/* A supervisor's row carries more than a contact's did — a trips toggle and
   the vehicle scope — so it wraps rather than squeezing the name to nothing.
   The name and login stay on the first line, the controls follow. */
.mu-row { flex-wrap: wrap; row-gap: 4px; }
.mu-row .ackp-name { flex: 0 1 auto; }
/* Pushes a row's buttons to the right, whoever the row is about. */
.mu-spacer { flex: 1 1 60px; }

/* The prefix belongs to the login box beside it: keep the pair together when
   the add row wraps, or the account name strands on a line of its own. */
.mu-login-wrap { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 220px; min-width: 0; }
.mu-login-wrap #muLogin { flex: 1 1 auto; min-width: 0; }
.mu-scope-list { max-height: 46vh; overflow-y: auto; display: grid; gap: 2px; }
.mu-scope-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; }
.mu-scope-row:hover { background: var(--surface-2); }
.bk-driver-opts .follow-toggle { gap: 8px; }
.bk-driver-card .bk-pin-wrap { flex: 1; min-width: 0; border-radius: 8px; padding: 0 4px 0 10px; height: 32px; }
.bk-driver-card .bk-pin-input { flex: 1; width: auto; min-width: 0; }
.bk-driver-card .bk-pin-eye { width: 26px; height: 26px; }
.bk-driver-card .bk-driver-car { flex: 1.2; min-width: 0; max-width: none; padding: 0 10px; height: 32px; border-radius: 8px; }

/* ---- add-driver form: name on top; phone + PIN + square "+" below ---- */
.bk-driver-divider { border-top: 1px solid var(--border); margin: 12px 0 10px; }
.bk-driver-add { display: flex; flex-direction: column; gap: 8px; }
.bk-driver-add input { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 12.5px; width: 100%; min-width: 0; }
.bk-driver-add input:focus { outline: none; border-color: var(--primary); }
.bk-driver-add-row { display: flex; gap: 8px; }
.bk-driver-add-row #bkDriverPhone { flex: 1.6; }
.bk-driver-add-row #bkDriverPin { flex: 1; }
.bk-driver-add-btn { width: 40px; flex-shrink: 0; border: 0; border-radius: 10px; background: var(--primary); color: #fff; font: 400 20px/1 'Inter', sans-serif; cursor: pointer; }
.bk-driver-add-btn:disabled { background: var(--surface-2); color: var(--text-3); cursor: default; }

/* ---- destination coords chip (picker output) ---- */
.bk-dest-row { display: flex; align-items: center; gap: 10px; margin: -2px 0 10px; }
.bk-dest-coords { font-size: 12px; color: var(--text-3); }
.bk-dest-coords.set { color: var(--green); font-weight: 600; }

/* ---- location picker overlay (stacks above modals) ---- */
.bk-picker { position: fixed; inset: 0; z-index: 1600; background: rgba(10, 14, 26, .55); display: flex; align-items: center; justify-content: center; padding: 18px; } /* above .modal-backdrop (1500) */
.bk-picker[hidden] { display: none; }
.bk-picker-panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.bk-picker-panel header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; }
.bk-picker-panel header h3 { margin: 0; font-size: 15px; }
.bk-picker-search { position: relative; padding: 0 18px 10px; }
.bk-picker-search input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13.5px; }
.bk-picker-search input:focus { outline: none; border-color: var(--primary); }
.bk-pick-results { position: absolute; left: 18px; right: 18px; top: 100%; margin-top: -6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 1100; max-height: 220px; overflow-y: auto; } /* above the Leaflet panes/controls (≤1000) of the picker map below */
.bk-pick-hit { padding: 9px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.bk-pick-hit:hover { background: var(--surface-2); }
.bk-pick-hit b { font-size: 13px; }
.bk-pick-hit span { font-size: 11.5px; color: var(--text-3); }
.bk-pick-empty { padding: 12px; font-size: 12.5px; color: var(--text-3); text-align: center; }
#bkPickMap { height: min(46vh, 420px); }

/* picker search row + POI/fence overlay toggle (btn-ghost.active supplies the on-state) */
.bk-picker-search-row { display: flex; gap: 8px; align-items: stretch; }
.bk-picker-search-row input { flex: 1; min-width: 0; }
.bk-pick-layers { flex-shrink: 0; white-space: nowrap; }

/* Vehicle type-ahead combo (booking modal) */
.bk-combo { position: relative; }
.bk-combo-list { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 60; max-height: 210px; overflow-y: auto; padding: 4px; }
.bk-combo-list[hidden] { display: none; }
.bk-combo-opt { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; background: none; border: none; cursor: pointer; }
.bk-combo-opt:hover { background: var(--surface-2); }
.bk-combo-opt.sel { background: var(--primary-soft); }
.bk-combo-opt b { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-combo-opt span { font-size: 11.5px; color: var(--text-3); margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.bk-combo-empty { padding: 9px 10px; font-size: 12px; color: var(--text-3); }

/* Frequent-destination suggestion cards (under the Destination field + in the picker) */
.bk-sug-row { display: flex; gap: 8px; margin: -4px 0 12px; flex-wrap: wrap; }
.bk-sug-row[hidden] { display: none; }
.bk-sug { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; text-align: left; min-width: 0; flex: 1 1 30%; transition: border-color .15s, box-shadow .15s; }
.bk-sug:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.bk-sug-ic { font-size: 14px; flex-shrink: 0; }
.bk-sug-txt { min-width: 0; }
.bk-sug-txt b { display: block; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-sug-txt small { display: block; font-size: 10.5px; color: var(--text-3); }
.bk-pick-sug { margin: 8px 0 0; }

/* type-to-filter inputs above the setup lists */
.bk-setup-filter { width: 100%; height: var(--ctl-h-md); box-sizing: border-box; margin: 0 0 8px; padding: 0 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 12.5px; outline: none; transition: border-color .15s; }
.bk-setup-filter:focus { border-color: var(--primary); }
.bk-picker-panel footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); }
.bk-pick-hint { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 760px) {
  .bk-cal-head.bk-day-head, .bk-cal-row.bk-day-row { grid-template-columns: 96px repeat(18, 1fr); }
  .bk-day-head .bk-hour { font-size: 9px; }
}

/* Driver task: block in the detail panel + destination row + assign controls */
.bk-task { margin: 10px 0 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.bk-task-row { display: flex; gap: 8px; font-size: 12px; }
.bk-task-k { flex: 0 0 74px; color: var(--text-3); font-weight: 600; }
.bk-task-v { flex: 1; color: var(--text); }
.bk-ok { color: var(--green); font-weight: 600; }
.bk-wait { color: var(--amber); font-weight: 600; }
.bk-dest-row { display: flex; gap: 8px; margin: -4px 0 12px; align-items: center; flex-wrap: wrap; }
.bk-dest-row input { flex: 1 1 120px; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12.5px; }
.bk-driver-actions { display: flex; align-items: center; gap: 8px; }
.bk-driver-car { padding: 6px 8px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12px; max-width: 148px; }

/* ============ Custom alert rules (Alerts view tabs + builder) ============ */
/* Tabs mirror the places-tabs look but keep their own class so the
   geofence-tab feature gating (which selects .places-tab) never touches them. */
/* Underline tab bar — shared by Alerts, Places/Geofences and Cargo.
   align-items:flex-end, not the flex default of stretch: the bar also carries
   ordinary buttons, and stretch made every TAB as tall as whichever button
   happened to sit beside it. That is how the cargo tabs ended up 41px while
   the alerts tabs — same padding, same font, same rule, copied three times —
   were 33.5px. The tabs now take their height from the scale and the buttons
   sit on the same bottom line. */
.alerts-tabs, .places-tabs, .cg-tabs, .ppl-tabs, .shared-tabs {
  display: flex; align-items: flex-end; gap: 6px;
  margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.alerts-tab, .places-tab, .cg-tab, .ppl-tab, .shared-tab {
  display: inline-flex; align-items: center;
  min-height: var(--ctl-h-md); line-height: 1; box-sizing: border-box;
  padding: 0 14px; font-size: 13px; font-weight: 700; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.alerts-tab.active, .places-tab.active, .cg-tab.active, .ppl-tab.active, .shared-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
/* All four tab classes are inline-flex above, so `t.hidden = true` from the
   entitlement pass is silent without this guard — the same fault documented at
   .btn-ghost. It was live: a Basic account with `routefence` off still saw the
   "Route fences" tab (empty, and every /api/routes call 403s, but visible). */
.alerts-tab[hidden],
.places-tab[hidden],
.cg-tab[hidden],
.ppl-tab[hidden],
.atab-panel[hidden] { display: none; }
/* .field is display:flex, which beats the [hidden] attribute — restore it
   for the conditionally-hidden fields in the PIN + rule modals. */
.field[hidden], .ar-coverage[hidden] { display: none; }

/* Rules list rows */
.ar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ar-row-switch { gap: 0; }
.ar-row-body { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.ar-row-body.off strong { color: var(--text-3); }
.ar-row-sum { font-size: 12px; }
.ar-row-side { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; flex-shrink: 0; }
.ar-wa-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--green-soft, rgba(22,163,74,.12)); color: var(--green, #16a34a); flex-shrink: 0; }
.ar-coverage { font-size: 12.5px; margin: -6px 0 12px; }
/* Where the score-only rules went (Driver Scoring): the coverage line's twin. */
.ar-ds-note { font-size: 12.5px; margin: -6px 0 12px; color: var(--text-2); }
.ar-ds-note a { color: var(--primary); font-weight: 600; text-decoration: none; }
.ar-ds-note a:hover { text-decoration: underline; }

/* Builder modal */
.ar-toprow { display: flex; align-items: flex-end; gap: 16px; }
.ar-enabled { margin-bottom: 14px; }
.ar-sec { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.ar-sec h4 { font-size: 13px; margin: 0 0 10px; }
/* Who: the shared vehicles picker (vehscope.js, .rvs-inline) */
.ar-days { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ar-days button { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box; font-size: 12px; font-weight: 600; padding: 0 11px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.ar-days button.on { background: rgba(37, 99, 235, .12); border-color: var(--primary); color: var(--primary); }
.ar-win-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; color: var(--text-2); }
.ar-win-row input { height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 8px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font-size: 12.5px; } /* the row's ✕ is .icon-btn.small */
.ar-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.ar-dates input[type="date"] { height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 8px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font-size: 12.5px; }
.ar-dates input[type="text"] { flex: 1 1 200px; height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 10px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font-size: 12.5px; }

/* Palette + condition cards */
.ar-builder { display: grid; grid-template-columns: 190px 1fr; gap: 12px; }
@media (max-width: 700px) { .ar-builder { grid-template-columns: 1fr; } }
.ar-palette { display: flex; flex-direction: column; gap: 6px; align-content: flex-start; }
@media (max-width: 700px) { .ar-palette { flex-direction: row; flex-wrap: wrap; } }
.ar-block { font-size: 12.5px; font-weight: 600; padding: 8px 11px; border: 1.5px dashed var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-2); cursor: grab; user-select: none; }
.ar-block:hover { border-color: var(--primary); color: var(--primary); }
.ar-conds-wrap { display: flex; flex-direction: column; gap: 8px; border-radius: 10px; }
.ar-conds-wrap.drag .ar-drop { border-color: var(--primary); color: var(--primary); background: rgba(37, 99, 235, .06); }
.ar-cond { padding: 10px 12px; margin: 0; }
.ar-cond-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ar-cond-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.ar-and { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: rgba(37, 99, 235, .12); color: var(--primary); }
.ar-cond-del { margin-left: auto; }
.ar-cond-body { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ar-inline { padding: 5px 8px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12.5px; width: auto; }
.ar-cond-body input[type="number"].ar-inline { width: 70px; }
.ar-inline-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); cursor: pointer; }
/* Dashcam alarm card: one wrapping row of checkboxes per group (driver / road / device) */
.ar-da-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 6px 0; flex-basis: 100%; }
.ar-chips { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.ar-t-add { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* ---- Place picker: tick several fences/POIs at once ---- */
/* It used to be one dropdown and an "+ Add" press per place, which is fine for
   two and unusable for twenty. Takes the card's full width on its own line
   because it is a list, not another inline control. */
.ar-pick { flex-basis: 100%; margin-top: 8px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); padding: 8px; }
.ar-pick-head { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.ar-pick-q { flex: 1 1 120px; min-width: 0; }
.ar-pick-all { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 5px 6px;
  border-radius: 7px; background: var(--surface-2); cursor: pointer; }
/* Capped so a four-thousand-fence account gets a scrolling list rather than a
   card that grows past the bottom of the modal. */
.ar-pick-list { max-height: 210px; overflow-y: auto; margin-top: 6px; }
.ar-pick-one { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 4px 6px;
  border-radius: 7px; cursor: pointer; }
.ar-pick-one:hover { background: var(--surface-2); }
/* A ticked "all" leaves the individual rows visible but inert — hiding them
   would look like the list had emptied itself. */
.ar-pick-one input:disabled + span { opacity: .45; }
.ar-pick-none, .ar-pick-more { margin: 6px; font-size: 12px; }
.ar-drop { border: 1.5px dashed var(--border); border-radius: 10px; padding: 14px; text-align: center; font-size: 12.5px; color: var(--text-3); }
/* "Then" section: sentence-style rows — label column left, controls read
   inline like a sentence, so nothing shouts or truncates. */
.ar-then-rows { display: flex; flex-direction: column; gap: 12px; margin-top: 2px; }
.ar-then-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.ar-then-lbl { flex: 0 0 150px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.ar-then-inline { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ar-then-row select,
.ar-then-row input { height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 8px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font-size: 12.5px; }
.ar-then-row select { padding: 0 10px; }
.ar-then-row input[type="number"] { width: 68px; }
.ar-then-hint { font-size: 11.5px; color: var(--text-3); }
/* Settings owned by the "while it continues" answer directly above them: the
   rule they belong to changes what they mean, so they are tied to it visually
   rather than sitting as peers of the always-on rows below. */
.ar-mode-sub { display: flex; flex-direction: column; gap: 10px; margin-left: 14px; padding-left: 14px; border-left: 2px solid var(--border); }
/* The Then section is one column of rows followed by one column of channel
   cards, so the rows need the same breathing room BELOW them that the cards
   have between each other — otherwise the last row (escalation) sits flush
   against the WhatsApp card and reads as part of it. */
.ar-sec .ar-then-rows { margin-bottom: 16px; }
/* No 150px label column in here: these rows read as one sentence ("Remind
   every 30 min, up to 10 times"), and holding the label to the outer grid put
   a lake of empty space between each label and its own input. */
.ar-mode-sub .ar-then-lbl { flex: 0 0 auto; }
/* A statement of fact rather than a setting: same label column so it lines up
   with the rows around it, but nothing to fill in. */
.ar-then-note .ar-then-lbl { color: var(--text-3); font-weight: 600; }
.ar-mode-sub:empty { display: none; }
@media (max-width: 560px) { .ar-mode-sub { margin-left: 0; padding-left: 10px; } }
@media (max-width: 560px) { .ar-then-lbl { flex-basis: 100%; } }
#arPinBtn.on { border-color: var(--primary); color: var(--primary); }

/* History grouped views (By vehicle / By rule) */
.ae-group { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.ae-group summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; font-size: 13.5px; }
.ae-group summary::-webkit-details-marker { display: none; }
.ae-group summary::before { content: "▸"; color: var(--text-3); font-size: 11px; transition: transform .15s; }
.ae-group[open] summary::before { transform: rotate(90deg); }
.ae-group-meta { margin-left: auto; font-size: 12px; color: var(--text-3); }
.ae-sub { padding: 0 16px 12px; }
.ae-sub-h { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 6px 0; }

/* Collapsible Live-tab categories: accordion bars — a full-width card with a
   hover state and a right-hand chevron, so it's unmistakably clickable and
   every section looks identical. */
details.alerts-section > summary {
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 16px; margin: 0; transition: background .15s, border-color .15s;
}
details.alerts-section > summary::-webkit-details-marker { display: none; }
details.alerts-section > summary:hover { background: var(--surface-2); border-color: var(--border-strong, var(--border)); }
/* chevron: right-hand, flips when open (accordion convention) */
details.alerts-section > summary::after {
  content: ""; width: 8px; height: 8px; margin-left: auto; flex-shrink: 0;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg); transition: transform .18s; margin-top: -3px;
}
details.alerts-section[open] > summary::after { transform: rotate(45deg); margin-top: -6px; }
details.alerts-section[open] > summary { margin-bottom: 12px; }
.alerts-count:not(:empty) { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: rgba(37, 99, 235, .12); color: var(--primary); letter-spacing: 0; }
.alert-actions { display: inline-flex; gap: 6px; flex-shrink: 0; align-items: center; }
.alert-actions a { text-decoration: none; }

/* History tree: same accordion language on both levels */
.ae-group summary { transition: background .15s; }
.ae-group summary:hover { background: var(--surface-2); }
.ae-group summary::before { display: none; }
.ae-group summary::after {
  content: ""; width: 7px; height: 7px; margin-left: 10px; flex-shrink: 0;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg); transition: transform .18s; margin-top: -2px;
}
.ae-group[open] summary::after { transform: rotate(45deg); margin-top: -5px; }
.ae-sub { margin-bottom: 6px; }
.ae-sub summary {
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 8px; padding: 8px 12px;
  transition: background .15s;
}
.ae-sub summary::-webkit-details-marker { display: none; }
.ae-sub summary:hover { filter: brightness(.97); }
.ae-sub summary::after {
  content: ""; width: 6px; height: 6px; margin-left: auto; flex-shrink: 0;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg); transition: transform .18s;
}
.ae-sub[open] summary::after { transform: rotate(45deg); margin-top: -3px; }
.ae-sub[open] summary { margin-bottom: 4px; }

/* Unified history: alert-type badges */
.ae-type { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.ae-type.rule { background: rgba(37, 99, 235, .12); color: var(--primary); }
.ae-type.service, .ae-type.document { background: color-mix(in srgb, var(--text-2) 14%, transparent); color: var(--text-2); }
.ae-type.offroute { background: color-mix(in srgb, var(--fs-check) 12%, transparent); color: var(--fs-check); }
.ae-type.booking { background: var(--amber-soft); color: var(--amber-text); }
.ae-type.device { background: var(--red-soft); color: var(--red); }
/* Active (value-bearing) filters get an accent border — Safari shows today's
   date as a grey hint inside EMPTY date inputs, so set vs unset needs a
   stronger signal than font colour. */
.ra-filter.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }

/* Playback point/stop popups + track list modal */
.pb-pop { font-size: 12.5px; color: var(--text); min-width: 210px; }
.pb-pop-t { font-weight: 700; margin-bottom: 4px; }
.pb-pop-r { color: var(--text-2); margin-bottom: 2px; }
.pb-pop-r.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.pb-pop-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.pb-pop-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--ctl-h-md); height: var(--ctl-h-md); padding: 0; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.leaflet-container a.pb-pop-ico { color: var(--text-2); text-decoration: none; }
.pb-pop-ico:hover, .leaflet-container a.pb-pop-ico:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.pb-pop-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--border); }
.pb-pop-lbl { display: none; }
/* Phones (and any touch screen): no hover, so no tooltip — each icon gets its
   name underneath, inside the same tap target. */
@media (max-width: 820px), (hover: none) {
  .pb-pop-actions { align-items: stretch; }
  .pb-pop-ico { flex-direction: column; gap: 3px; width: auto; min-width: 54px; height: auto; padding: 6px 4px 5px; }
  .pb-pop-lbl { display: block; font-size: 10.5px; font-weight: 600; line-height: 1.1; }
}
.pb-list-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pb-list-bar .btn-ghost.sm { min-height: var(--ctl-h-md); font-size: 12.5px; padding: 0 13px; border-radius: var(--radius-sm); }
.pb-list-bar .export-group .export-fmt { min-height: var(--ctl-h-md); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.pb-list-bar .export-group .export-go { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pb-list-bar .muted { margin-right: auto; }
#pbListWrap { max-height: 55vh; overflow-y: auto; }

/* Phase 3: condition groups, templates, escalation */
.ar-group { border-style: dashed; }
.ar-group.drag { border-color: var(--primary); background: rgba(37, 99, 235, .05); }
.ar-g-body { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; padding-left: 10px; border-left: 2px solid var(--border); }
.ar-g-body .ar-cond { background: var(--surface-2); }
.ar-g-empty { margin: 2px 0; font-size: 12px; }
.ar-block-group { border-style: solid; color: var(--primary); border-color: rgba(37, 99, 235, .4); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tpl-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 13px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.tpl-card:hover { border-color: var(--primary); background: var(--surface-2); }
.tpl-ic { font-size: 20px; }
.tpl-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.tpl-desc { font-size: 12px; color: var(--text-2); line-height: 1.4; }

/* ===== Live camera panel =====
   Sits where the playback bar does but anchored top-right: the map still
   has to be readable while the camera is open, so the video takes a corner
   rather than the width of the screen. */
.video-panel {
  /* Clear of the .map-tools column: it is 40px wide at right:14px and sits
     ABOVE this panel (z 500 vs 480), so anchoring to the same edge buried
     the close button under the fullscreen button. The toolbar has to stay
     usable while the camera is open, so the panel yields the edge. */
  position: absolute; top: 14px; right: 64px; z-index: 480;
  width: min(440px, calc(100vw - 78px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px;
  /* Never taller than the map. Uncapped, the open SD card pushed the panel
     past the map's bottom edge, which clips it — the search results were
     cut off and the panel had nothing to scroll. Capped, it scrolls. */
  max-height: calc(100% - 28px);
}
/* ...and the cap must not squash anything: in a column flexbox the canvas
   (and every row) would shrink to fit rather than let the panel scroll. The
   maximised canvas opts back in with its own flex rule. */
.video-panel > * { flex-shrink: 0; }
.video-panel[hidden] { display: none; }
.video-head { display: flex; align-items: center; gap: 8px; }
.video-head strong { font-size: 14px; }
/* Only the FIRST icon button absorbs the free space; the rest sit tight
   against it. `margin-left:auto` on EVERY button makes flex split the gap
   between them, so with two buttons the maximise control drifts to the middle
   of the header instead of sitting beside the close. The sibling selector
   keeps that true if a third button is ever added. */
.video-head .icon-btn { margin-left: auto; }
.video-head .icon-btn ~ .icon-btn { margin-left: 0; }
/* One line, always: a status that wrapped ("live h264 · 10 fps · sound off")
   made the header — and everything under it — jump when the stream started. */
.video-head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Title over status, each with the whole width left of the buttons. They
   shared one line and both came out cut ("B 9840 UVW — ca…"). */
.video-id { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.video-status { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden;
                text-overflow: ellipsis; min-width: 0; }
/* Black behind the picture so letterboxing on a 4:3 camera looks deliberate
   rather than like a broken layout. */
#videoCanvas {
  width: 100%; height: auto; aspect-ratio: 4 / 3; display: block;
  background: #000; border-radius: 10px; border: 1px solid var(--border);
}
/* Three blocks: Watch (buttons + the stream's settings), then Capture and
   Camera side by side, then the cost line. Nothing in them is shown or hidden
   by Play/Stop, so nothing moves when it is pressed. */
.video-foot { display: flex; flex-direction: column; gap: 8px; }
.camf-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
/* A tinted box per group, holding its buttons and its settings together. */
.camf-group { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 5px 6px;
              border-radius: 10px; background: var(--bg-soft, rgba(127,127,127,.08)); }
.camf-row > .camf-group { flex: 1 1 auto; }
/* Play and Stop share one slot, wide enough for either, so swapping them
   moves nothing next to it. */
.camf-slot { display: inline-flex; min-width: 74px; }
.camf-slot > .btn-ghost { flex: 1 1 auto; justify-content: center; }
.video-foot .btn-ghost.sm:disabled { opacity: .45; cursor: not-allowed; }
.video-limit.off { opacity: .45; }
/* The cost line keeps its height while stopped (the meter is emptied, not
   hidden), so the panel does not grow and shrink on Play. */
.camf-info { row-gap: 2px; }
/* The foot holds seven controls plus the auto-stop select, and the panel is
   only min(440px, 100vw-78px) wide — narrower still once resized, down to the
   300px min-width. Wrapping is correct, but each added button costs a whole
   ROW, and rows past the panel's height fall outside the map area: measured at
   300px the foot wrapped to FIVE rows and pushed SD card, Restart and Play out
   of sight. That is how adding Stop and Listen "removed" the SD-card button.

   So below a threshold the labels collapse and the buttons become their icons.
   A CONTAINER query, not a media query: the panel is user-resizable, so its
   width has nothing to do with the viewport's — a phone-sized breakpoint would
   miss a narrow panel on a large screen, which is the common case here.
   The title attribute already carries the full description, so nothing is
   lost but the visible words.

   Threshold measured, not guessed, and RAISED to 480 when push-to-talk brought
   the count to eight: at the default 440px panel, labels now wrap to five rows
   (498px tall) and icons to four (446px). Eight labelled buttons no longer fit
   the panel they live in, so the default width collapses and only a panel
   resized past ~520px shows words again. Re-measure this if a ninth is ever
   added — the row count, not the taste, is what decides it. */
/* An open microphone in someone's vehicle is the one state in this panel that
   must never be inferred from a small icon. Red, not the generic accent the
   other lit buttons use, and it pulses so it is visible in peripheral vision
   while the operator is looking at the picture rather than the button. */
.video-foot #videoTalk.talking {
  background: #d92d20; border-color: #d92d20; color: #fff;
  animation: talk-pulse 1.1s ease-in-out infinite;
}
@keyframes talk-pulse { 50% { box-shadow: 0 0 0 4px rgba(217, 45, 32, .28); } }
@media (prefers-reduced-motion: reduce) {
  .video-foot #videoTalk.talking { animation: none; }
}

.video-panel { container-type: inline-size; }
/* Grouped onto their own row, six actions with words fit the default 440px
   panel; the words go only on a panel narrowed below that (measured). */
@container (max-width: 400px) {
  .video-foot .vb-t { display: none; }
  /* Listen keeps its word at every width. Sound is opt-in, and the whole
     reason it went unused for a day is that at the default panel size it was
     a bare speaker glyph among seven other glyphs — there was no way to tell
     there was anything to press. An icon is only self-explanatory to someone
     who already knows what it does. */
  /* Talk keeps its words at every width — see below. */
  /* Talk keeps its words for a stronger reason than Listen: it is the only
     control in the row that is HELD rather than clicked, and nothing about a
     bare 🎤 says so. An unlabelled button with a non-obvious gesture is two
     guesses stacked on each other. */
  .video-foot #videoTalk .vb-t { display: inline; }
  .video-foot .btn-ghost.sm { padding: 0 8px; }
}
.video-hint { font-size: 11px; color: var(--muted); flex: 1 1 140px; }
/* The meter has its own line, held open even when empty: sharing a line with
   the hint made the hint wrap to two lines the moment the meter appeared. */
.camf-info .video-meter { flex: 1 1 100%; min-height: 15px; }
/* Auto-stop and the data meter. Both sit BEFORE .video-hint, whose
   `flex: 1 1 140px` would otherwise push them onto a second row. */
.video-limit { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.video-limit select {
  font: inherit; padding: 2px 4px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
}
/* Tabular figures so a counting meter does not jitter its neighbours sideways
   once a second. */
.video-meter {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
/* Wrap BETWEEN the parts, never inside one: "auto-stop in" split from its
   time reads as two unrelated fragments. */
.video-meter > span { white-space: nowrap; }
.video-meter.warn { color: var(--st-nolocate); font-weight: 600; }
/* Saved clips: what WE hold, above the listing of what the CARD holds. */
.vf-clips-head { font-size: 11px; color: var(--muted); }
.vf-clips-list { display: flex; flex-direction: column; gap: 4px; }
.vf-clip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 8px; border-radius: 8px; background: var(--bg-soft, rgba(127,127,127,.08));
  font-size: 12px;
}
.vf-clip a.vf-dl { text-decoration: none; }
/* Two lines in both lists: WHEN on top, then what it is (camera, length,
   size). On one line the stamp and the size fought for 400px and the length
   was the part that lost. */
.vf-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.vf-when { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.vf-meta { color: var(--muted); font-variant-numeric: tabular-nums; }
/* A clip still coming reads as pending, not as broken. */
.vf-clip-generating .vf-meta { color: var(--st-nolocate); }
.vf-clip-failed .vf-meta { color: var(--st-alarm, #d9483b); }
/* A clip that is not the whole window, or whose timing is guessed, says so in
   words. It used to be a bare ⚠ whose reason lived only in a hover title —
   which a phone never shows. */
.vf-note { color: var(--st-nolocate); font-size: 11px; line-height: 1.35; }
.vf-saved { color: var(--green); font-weight: 600; white-space: nowrap; }

@media (max-width: 720px) {
  /* On a phone the map is the point, so span the width — but the toolbar
     column still runs down the right edge, so stop short of it rather than
     sliding the video under it. */
  .video-panel { top: 8px; left: 8px; right: 58px; width: auto; }
  /* ...and stop above the vehicle sheet's peek (52px) and its grab tab
     (30px), which sit OVER the panel (z 600 vs 480). Without a ceiling the
     panel just grew downwards: opening SD card put its From/To/Search under
     the sheet, where nothing could be tapped. Capped, the panel scrolls. */
  .video-panel { max-height: calc(100% - 98px); }
}

/* ===== [hidden] guards =====
   The hidden ATTRIBUTE only works while nothing else sets display: the UA
   rule is [hidden]{display:none} at specificity 0-1-0, which any bare class
   rule ties and then beats by source order. .icon-btn is display:grid, so
   the camera button rendered on every vehicle no matter what the JS set —
   `btn.hidden = true` did precisely nothing. An attribute selector on the
   same class (0-2-0) settles it.

   .map-tool and .ra-pager carry the same latent fault; guarded here before
   someone toggles them and finds the same silence. */
.icon-btn[hidden],
.btn-primary[hidden],
.btn-ghost[hidden],
.map-tool[hidden],
.ra-pager[hidden],
/* .dash-cust-add is toggled for real (main.js hides the whole "Add a card"
   block when no utilisation card type is entitled); .rm-src and .shared-tab
   are latent, guarded here like .map-tool above. */
.dash-cust-add[hidden],
.rm-src[hidden],
/* .tour-foot is display:flex, so switching the tour bubble into contents mode
   left Back/Next painted over the list until it was guarded here too. */
.tour-foot[hidden],
.shared-tab[hidden], .shared-tabs[hidden] { display: none; }

/* ===== SD-card browser + recording ===== */
.video-files { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.video-files[hidden] { display: none; }
.vf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.vf-head input { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 8px;
                 height: 30px; padding: 0 8px; font-size: 12px; color: var(--text); outline: none; }
/* No scroll box of its own: the panel already scrolls, and a list scrolling
   inside a scrolling panel showed one row at a time. */
.vf-list { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.vf-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 8px; border: 1px solid var(--border);
          border-radius: 8px; background: var(--surface-2); cursor: pointer; flex: none; }
.vf-row:hover { border-color: var(--primary); }
/* What the search found, then one heading per day: a range across midnight
   used to print the date twice on every row ("10/10 03:23:57 → 10/10 …"). */
.vf-sum { font-size: 11px; color: var(--muted); flex: none; }
/* All / Camera N over the card listing, and the pager under it. */
.vf-cams { display: flex; gap: 5px; flex-wrap: wrap; flex: none; }
.vf-chip {
  height: 26px; padding: 0 10px; border-radius: 999px; flex: none;
  border: 1.5px solid var(--border); background: var(--surface-2);
  color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer;
}
.vf-chip:hover { border-color: var(--primary); }
.vf-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.vf-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px;
            flex: none; padding-top: 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vf-pager .btn-ghost:disabled { opacity: .4; cursor: default; }
.vf-day { flex: none; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 2px 0; }

/* Controls | SD card, under the picture. */
.cam-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.cam-tab {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 6px 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  white-space: nowrap;
}
.cam-tab:hover { color: var(--text); }
.cam-tab.on { color: var(--primary); border-bottom-color: var(--primary); }
/* How many clips we hold; amber while one is still coming off the camera. */
.cam-tab-n {
  margin-left: 5px; padding: 0 6px; border-radius: 999px; font-size: 11px;
  background: var(--bg-soft, rgba(127,127,127,.12)); color: var(--text-2);
}
.cam-tab-n.busy { background: var(--st-nolocate); color: #fff; }
.cam-tab-n[hidden] { display: none; }
/* Three tabs fit a narrowed panel only without their icons (measured: 23px
   over at 300px with them). */
@container (max-width: 340px) { .cam-tab .ct-i { display: none; } }
.video-panel.maxed #videoClipsPane { flex: none; }
.video-foot[hidden] { display: none; }
/* Recording is destructive of attention if it is not obvious it is running. */
#videoRec.rec-on { background: var(--st-alarm, #dc2626); color: #fff; border-color: transparent; }

/* Format erases the card. It sits among ordinary buttons, so it has to read
   as different before it is clicked, not only in the confirm dialog. */
/* layout only — the colour is .danger-btn's, like every other destructive button */
.vf-danger { margin-left: auto; }

/* ===== Camera panel: resize, maximise, storage warning, transport ===== */
/* Draggable corner. The panel is a fixed-size card by default, but an
   operator reading a number plate needs it bigger, and the useful size
   depends on the screen — so let them choose rather than picking for them. */
.video-panel { resize: both; overflow: auto; min-width: 300px; min-height: 260px; }
/* Maximised, the panel takes the whole map — INCLUDING the edge the
   .map-tools column owns. That column sits at z-index 500, so at the panel's
   normal 480 it drew over the panel's own close and maximise buttons and
   they became unclickable. A maximised video is a focused view: it goes
   above the toolbar rather than tiptoeing around it, and the toolbar is
   reachable again the moment you restore. */
.video-panel.maxed {
  top: 14px; right: 14px; bottom: 14px; left: 14px;
  width: auto; height: auto; max-width: none; resize: none;
  z-index: 520;                       /* above .map-tools (500) */
}
/* Header and controls must keep their height when the canvas fills the rest,
   or the buttons get squeezed out of the flex container entirely. */
.video-panel.maxed .video-head,
.video-panel.maxed .video-foot,
.video-panel.maxed .video-transport,
.video-panel.maxed .video-channels,
.video-panel.maxed .video-files,
.video-panel.maxed .cam-tabs { flex: none; }

/* The canvas drives the panel height via aspect-ratio, which fights a
   user-chosen height — when maximised or resized, let it fill instead. */
.video-panel.maxed #videoCanvas { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; object-fit: contain; }
.video-panel.maxed { display: flex; flex-direction: column; }

/* A failed card is otherwise invisible: video still streams (a different
   path) and recordings simply never appear. */
.video-warn {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: var(--st-alarm, #dc2626); color: #fff; white-space: nowrap;
}
.video-warn[hidden] { display: none; }

.video-transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.video-transport[hidden] { display: none; }
.vt-speed { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.vt-speed select {
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 8px;
  height: var(--ctl-h-sm); padding: 0 6px; font-size: 12px; color: var(--text); outline: none;
}
/* The row itself plays; this fetches the original file. Distinct target so a
   click meant for one is not the other. */
.vf-dl { padding: 0 8px; height: 24px; line-height: 1; flex: none; }

/* Channel picker for multi-camera units (MDVRs run 2-8). */
.video-channels { display: flex; gap: 5px; flex-wrap: wrap; }
.video-channels[hidden] { display: none; }
.vc-btn {
  height: 26px; min-width: 34px; padding: 0 9px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface-2);
  color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer;
}
.vc-btn:hover { border-color: var(--primary); }
.vc-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* [hidden] MUST outrank every display rule above, or closing the panel sets
   the attribute and nothing happens. `.video-panel.maxed` (0-2-0) ties
   `.video-panel[hidden]` (0-2-0) and, being later in the file, wins — so the
   close button silently did nothing while maximised.

   This is the third time today an author `display` rule has defeated the
   hidden attribute (the camera icon-btn, .map-tool, and now this). One rule
   at the end of the file, more specific than anything above it, ends the
   pattern for this component instead of chasing it a case at a time. */
.video-panel[hidden],
.video-panel.maxed[hidden] { display: none !important; }

/* WhatsApp opt-in on a rule — one card whose header is the tick that turns a
   billable channel on. The settings live INSIDE the card so they read as
   belonging to the tick rather than floating beneath it, and they use the same
   label-left/control-right grammar as the rows below, so the Then section is
   one layout instead of two. The price sits in the header because that is the
   moment the cost is chosen. */
.ar-wa { border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.ar-wa-head { display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 11px 13px; background: var(--surface-2); }
.ar-wa:hover { border-color: var(--primary); }
.ar-wa:has(.ar-wa-head input:checked) { border-color: var(--primary); }
.ar-wa:has(.ar-wa-head input:checked) .ar-wa-head { background: var(--primary-soft, var(--surface-2)); }
.ar-wa-head input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex-shrink: 0; accent-color: var(--primary); }
.ar-wa-head-t { font-weight: 600; font-size: 13px; }
.ar-wa-price { margin-left: auto; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); }
.ar-wa-body { display: flex; flex-direction: column; gap: 12px;
  padding: 13px; border-top: 1.5px solid var(--border); }
/* "Send to" stacks chips, field and hint in the control column, so the label
   stays aligned with every other row instead of sitting above a full-width box. */
.ar-wa-torow { align-items: flex-start; }
.ar-wa-to { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.ar-wa-to .ct-picker { margin-bottom: 0; }
.ar-wa-to input { width: 100%; }
/* .ar-then-row / .ar-wa-body are display:flex, so the UA [hidden] rule loses without this. */
.ar-then-row[hidden], .ar-wa-body[hidden], .ar-wa[hidden] { display: none; }
.wa-to.none { color: var(--text-3); font-style: italic; }

/* Per-rule plan choice: only rendered when the account holds more than one, so
   the price moves out of the header pill and onto each option, where the
   choice is actually made. */
.ar-wa-plans { display: flex; flex-wrap: wrap; gap: 8px; }
.ar-wa-plan { display: flex; flex-direction: column; gap: 1px; cursor: pointer; text-align: left;
  padding: 7px 12px; border: 1.5px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-2); font: inherit; }
.ar-wa-plan:hover { border-color: var(--primary); }
.ar-wa-plan.on { border-color: var(--primary); background: var(--primary-soft, var(--surface-2)); color: var(--text); }
.ar-wa-plan-n { font-size: 12.5px; font-weight: 700; }
.ar-wa-plan-p { font-size: 11px; color: var(--text-3); }
.ar-wa-plan.on .ar-wa-plan-p { color: var(--text-2); }

/* Google-route endpoint pickers — a button that opens the shared map picker,
   showing whatever was chosen. Matches .field control height/shape. */
.rm-pick { display: flex; align-items: center; gap: 8px; width: 100%; height: var(--ctl-h); padding: 9px 10px;
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 9px;
  font-family: var(--font); font-size: 13px; color: var(--text-3); text-align: left; cursor: pointer;
  transition: border-color .15s; box-sizing: border-box; }
.rm-pick:hover { border-color: var(--primary); }
.rm-pick.set { color: var(--text); }
.rm-pick.set::before { content: "📍"; }
.rm-pick-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Road-route chooser (reuses .bk-picker / .bk-picker-panel for the shell) */
#rmRouteMap { height: min(42vh, 380px); }
.rm-route-opts { display: flex; flex-direction: column; gap: 6px; padding: 12px 18px 4px; max-height: 30vh; overflow-y: auto; }
.rm-route-opt { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); transition: border-color .15s, background .15s; }
.rm-route-opt:hover { background: var(--surface-2); }
.rm-route-opt.on { border-color: var(--primary); background: var(--primary-soft, var(--surface-2)); }
.rm-route-opt input { margin: 2px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.rm-route-swatch { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.rm-route-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rm-route-via { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.rm-route-num { font-size: 11.5px; color: var(--text-3); }
.bk-picker-panel footer .btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
/* the links box is a textarea in a COLUMN group now — a leftover flex-grow
   from its single-line days stretched it to fill the group */
#rmGLink { flex: 0 0 auto; min-height: 58px; height: auto; }

/* Route modal: each block of controls is a titled group, so it is obvious
   which buttons act on which part (the source path vs the route's path list). */
.rm-group { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.rm-group[hidden] { display: none; }
.rm-group-hd { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.rm-group-sub { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text-3); opacity: .8; }
.rm-group-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rm-group-actions .muted { flex: 1 1 160px; min-width: 0; }
/* the options list gets the room it needs before it starts scrolling */
.rm-route-opts { max-height: min(38vh, 300px); }
.rm-route-opt.ro { cursor: default; }
.rm-route-opt.ro:hover { background: var(--surface); }

/* Colour pickers in the geofence / route-fence editors. A null colour means
   "inherit the category", so Reset clears rather than picking a default. */
.col-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.col-pick-one { display: flex; align-items: center; gap: 6px; padding: 5px 9px 5px 7px;
  border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.col-pick-one span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.col-pick-one input[type="color"] { width: 26px; height: 22px; padding: 0; border: none; background: none; cursor: pointer; }
.col-pick-one.unset { border-style: dashed; opacity: .7; }

/* Per-layer name filter under each layer row in the map filter panel. */
.lf-search { width: 100%; margin: 2px 0 6px; padding: 5px 8px; font-size: 12px;
  border: 1.5px solid var(--border); border-radius: 7px; background: var(--surface-2);
  color: var(--text); outline: none; }
.lf-search:focus { border-color: var(--primary); }
.lf-search::placeholder { color: var(--text-3); }
/* A fence's colour button on its row: drawn like the fence — the outline as a
   ring round the fill — and opening the preset popover (places.js). */
.gf-swatch { flex-shrink: 0; width: 26px; height: 26px; padding: 0; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 7px; background: var(--surface-2);
  display: grid; place-items: center; }
.gf-swatch::after { content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--sw-line); background: color-mix(in srgb, var(--sw-fill) 55%, #fff); }
.gf-swatch.unset { border-style: dashed; }

/* Ready-made colour pairs (colorpresets.js): a ring in the outline colour
   round a disc of the fill, so each swatch looks like the fence it makes. */
.fp-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.fp-sw { width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 3px solid var(--fp-line); background: color-mix(in srgb, var(--fp-fill) 55%, #fff);
  box-shadow: 0 0 0 1px var(--border); transition: transform .1s; }
.fp-sw:hover { transform: scale(1.1); }
.fp-sw.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.fp-pop { position: fixed; z-index: 3000; width: 196px; padding: 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.fp-pop-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-bottom: 8px; }
.fp-pop .fp-row { margin: 0 0 10px; }
.fp-pop-foot { display: flex; gap: 6px; flex-wrap: wrap; }
/* "Default" / "Category colour" when already so: read as unavailable */
.fp-pop-foot .btn-ghost:disabled { opacity: .45; cursor: default; }
.fp-custom { position: relative; overflow: hidden; }
.fp-custom input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Draggable vertex / centre handles in the geofence editor. Sized for a finger
   but visually small, with a white ring so they read against any basemap. */
.gf-handle { width: 14px; height: 14px; border-radius: 50%; background: #fff;
  border: 3px solid var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: grab; }
.gf-handle:active { cursor: grabbing; }
.leaflet-marker-draggable .gf-handle:hover { transform: scale(1.15); }

/* ---------------- Cargo status ----------------
   The badge is deliberately not just a colour: this feature INFERS cargo from
   geometry, so an inferred state and a dispatcher-confirmed one must not look
   identical or an operator has no way to know which to trust. */
.cg-chip { display: inline-flex; align-items: center; min-height: var(--badge-h); line-height: 1; box-sizing: border-box; padding: 0 7px; border-radius: var(--radius-pill); font-size: 11px;
  font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.cg-laden, .cg-laden_partial { background: color-mix(in srgb, var(--fs-place) 15%, transparent); color: var(--fs-place); border-color: color-mix(in srgb, var(--fs-place) 35%, transparent); }
.cg-at_load    { background: color-mix(in srgb, var(--fs-place) 10%, transparent); color: var(--fs-place); border-style: dashed; border-color: color-mix(in srgb, var(--fs-place) 45%, transparent); }
.cg-at_unload  { background: color-mix(in srgb, var(--fs-unload) 10%, transparent); color: var(--fs-unload); border-style: dashed; border-color: color-mix(in srgb, var(--fs-unload) 45%, transparent); }
.cg-laden_waiting { background: color-mix(in srgb, var(--amber-text) 15%, transparent); color: var(--amber-text); border-color: color-mix(in srgb, var(--amber-text) 40%, transparent); }
.cg-empty      { background: color-mix(in srgb, var(--text-3) 14%, transparent); color: var(--text-2); border-color: color-mix(in srgb, var(--text-3) 30%, transparent); }
.cg-unknown, .cg-stale { background: transparent; color: var(--text-3); border-style: dashed; border-color: var(--border); }
/* The vehicle card's copy, beside the motion status. Its text grows with the
   trip ("Laden · in transit · 2 drops · next: … · Late +22m"), and one line
   ran off the card's right edge on a phone — cut mid-word, the next stop and
   the delay lost. It wraps instead, only when it does not fit, and never
   wider than the card. 10px is the pill's own radius at one line (20px high),
   so a one-line badge looks exactly as before and two lines round off as a
   card rather than a capsule pinching its text at the ends. */
#dCargo { min-width: 0; max-width: 100%; }
#dCargo .cg-chip { white-space: normal; max-width: 100%; line-height: 1.3; padding-top: 2px; padding-bottom: 2px; border-radius: 10px; overflow-wrap: anywhere; }
/* Confirmed by a person: solid ring. Low confidence: faded. */
.cg-confirmed { box-shadow: inset 0 0 0 1px currentColor; }
.cg-low { opacity: .6; }

.cg-head { padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.cg-head-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.cg-basis { margin-top: 4px; font-size: 12px; }
.cg-counts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.cg-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cg-note { font-size: 11.5px; }
.cg-ledger-hd { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 6px; }
.cg-stop { display: grid; grid-template-columns: 108px 44px 1fr auto auto auto; gap: 8px; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.cg-stop:last-child { border-bottom: 0; }
.cg-when { color: var(--text-2); }
.cg-dwell { color: var(--text-3); text-align: right; }
.cg-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-effect { font-weight: 700; font-size: 10.5px; letter-spacing: .04em; color: var(--primary); }
/* An unmapped stop is recorded in full and never counted as a delivery — it has
   to look different, or the ledger implies a drop that never happened. */
.cg-unmapped .cg-where { color: var(--text-3); font-style: italic; }
.cg-src { font-size: 10px; color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.v-cargo { margin-top: 4px; }
/* Health tab: three worklists. Rows are hairline-separated like the ledger
   they come from — no cards, because a card per row would bury the counts. */
/* The review line sits above the chips and reads as a statement with an
   answer, not as another question. */
.cg-review-flagline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-left: 3px solid #d4880b; }

/* Said once, above the tabs: nothing below is being derived. */
.cg-disabled { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px;
  border-left: 3px solid #d4880b; }
/* An author `display` beats the UA sheet's [hidden] { display: none }, so a
   flex banner set hidden=true stays on screen — it announced that cargo was
   switched off on an account where it is plainly on. The same guard the
   location menu already carries. */
.cg-disabled[hidden] { display: none; }
.cg-disabled .muted { font-size: 12.5px; }
.cg-hrow-dur { font-variant-numeric: tabular-nums; color: var(--text-3); margin-left: 6px; }

.cg-health-sec { margin-bottom: 26px; }
.cg-health-sec h4 { margin: 0 0 3px; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.cg-health-n { font-size: 11.5px; font-weight: 600; color: var(--primary);
  background: var(--surface-2); border-radius: var(--radius-pill); padding: 1px 8px; }
.cg-health-blurb { font-size: 12px; margin: 0 0 10px; max-width: 74ch; }
.cg-health-ok { font-size: 12.5px; margin: 0; color: var(--green); }
.cg-health-list { border-top: 1px solid var(--border); }
.cg-health-row { padding: 10px 0; border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.cg-health-main { font-size: 13px; flex: 1 1 340px; min-width: 0; display: flex; align-items: center; gap: 7px; }
/* The location button sits with the coordinates it acts on, not in a far
   column — at a glance the row reads "here is the spot, here is what to do". */
.cg-health-loc { width: var(--ctl-h-sm); height: var(--ctl-h-sm); flex: 0 0 auto; color: var(--text-2); }
.cg-health-loc:hover { color: var(--primary); }
.cg-health-meta { font-size: 11.5px; flex: 1 1 100%; }
.cg-health-actions { flex: 0 0 auto; }
.cg-health-act { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.cg-health-hint { font-size: 11.5px; }
.cg-health-foot { font-size: 11.5px; margin-top: 18px; }

.cg-set-row { margin-bottom: 14px; }
/* The three time thresholds sit side by side; each keeps its own note. */
.cg-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; margin-top: 12px; }
.cg-set-grid .cg-set-row select { width: 100%; margin-right: 0; }
/* background-COLOR, not the shorthand: the shorthand resets the .field
   chevron's no-repeat, and the dark theme's chevron then tiled across the box */
.cg-set-row select { background-color: var(--surface-2); border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--text); outline: none; margin-right: 6px; }
.cg-set-row select:focus { border-color: var(--primary); }
.cg-set-note { display: block; font-size: 11.5px; margin-top: 3px; }
.cg-set-summary { margin: 12px 0; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; }
.cg-set-warn { margin-top: 8px; font-size: 12px; color: var(--amber-text); }

/* ---- Cargo ▸ Places: the one screen where a cargo role is set ----
   A picker, not a second fence manager: no map, no colours, no category
   editor. Its chips borrow the list-page chip LOOK but not the layer-filter
   rules, because these filter a list and never a map layer. */
.cg-pl-head { margin-bottom: 12px; }
.cg-pl-sum { font-size: 12.5px; }
.cg-pl-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cg-pl-filters .list-q { flex: 1 1 220px; min-width: 180px; }
.cg-pl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
/* The UA sheet's [hidden] { display: none } loses to an author `display`, so a
   flex row toggled with .hidden = true stays on screen with whatever it last
   painted. This row hides itself when there is nothing to filter. */
.cg-pl-chips[hidden] { display: none; }
.cg-pl-cats { margin-bottom: 14px; }
.cg-pl-chip { width: auto; min-height: var(--ctl-h-sm); line-height: 1; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0 11px; }
/* Unselected is an OUTLINE chip at full strength, not a faded one. The
   layer-filter base dims its off state to opacity .6 with --text-3, which on a
   filter row reads as "unavailable" rather than "not chosen" — people stop
   pressing them. Selected is filled and coloured; unselected is legible and
   plainly pressable. */
.cg-pl-chip { opacity: 1; color: var(--text-2); }
.cg-pl-chip:hover { color: var(--text); border-color: var(--text-3); background: var(--surface-2); }
.cg-pl-chip.on { opacity: 1; color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.cg-pl-chip.on .lf-count { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
/* Scope and kind share one row; the rule says they are two questions. */
.cg-pl-chipsep { width: 1px; align-self: stretch; min-height: 22px; background: var(--border); margin: 0 4px; }

.cg-pl-item { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cg-pl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.cg-pl-body strong { color: var(--text); }
.cg-pl-body .muted { font-size: 12px; }
.cg-pl-kind { display: inline-block; margin-right: 2px; padding: 1px 6px; border-radius: 5px;
  background: color-mix(in srgb, var(--text-3) 18%, transparent); color: var(--text-2);
  font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; vertical-align: 1px; }
.cg-pl-untagged { font-style: italic; }
.cg-pl-edit { flex-shrink: 0; }
/* Arrived here from the chip on a fence row: mark the row that was clicked,
   so the answer to "which one did I press?" is on screen. */
.cg-pl-focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cg-pl-none { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }

/* The add picker. The only list of untagged places in the app — the tab itself
   shows the cargo configuration, not a second copy of the Geofences list. */
.cg-add-intro { font-size: 12.5px; margin: 0 0 14px; max-width: 74ch; }
.cg-add-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 4px 0 12px; font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.cg-add-spacer { flex: 1; }
.cg-add-hide { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--text-3); cursor: pointer; }
.cg-add-count { margin-right: auto; font-size: 12px; }
.cg-add-role-lab { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
#cgAddRole { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 7px;
  padding: 6px 9px; font-size: 12px; color: var(--text); outline: none; }
#cgAddRole:focus { border-color: var(--primary); }
/* The dialog holds ONE height from open to close. Sized to its contents it
   grew and shrank under every keystroke, because the list is what each filter
   changes — the buttons moved while you were reaching for them. So the modal
   itself is pinned, and the list absorbs whatever space is left and scrolls
   inside itself. `.modal`'s own max-height + overflow would otherwise scroll
   the FOOTER out of reach, which for a picker hides the Add button. */
#cargoAddModal.open { display: flex; flex-direction: column; height: min(90vh, 640px); overflow: hidden; }
#cargoAddModal .modal-body { flex: 1; min-height: 0; overflow: hidden; }
#cargoAddModal footer { flex-shrink: 0; }
/* On a phone the footer's count, role picker and two buttons do not fit one
   row; unwrapped, flex-end pushed "N selected — choose a role" and the Role
   label off the left edge (page sweep, 5 Oct). The count takes its own line. */
@media (max-width: 560px) {
  #cargoAddModal footer { flex-wrap: wrap; row-gap: 8px; }
  #cargoAddModal footer .cg-add-count { flex: 1 1 100%; margin-right: 0; }
}
/* The other half of "unselected is not unavailable": something that really IS
   unavailable has to look it. Add stays off until both a selection and a role
   exist, and there is no global disabled style in this sheet to inherit. */
#cargoAddModal footer button[disabled],
#cargoRoleModal footer button[disabled] { opacity: .5; cursor: not-allowed; }
#cgAddList { flex: 1; min-height: 0; overflow-y: auto; }

/* The chip on a fence/place row is a way THROUGH to this tab. It is a button
   wrapping the chip, so it must add no box of its own — otherwise the row
   grows by a border the unclickable version never had. */
.cargo-chip-link { display: inline; padding: 0; border: none; background: none; cursor: pointer; font: inherit; }
.cargo-chip-link:hover .cargo-chip { filter: brightness(1.08); }
.cargo-chip-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-pill); }

/* The role editor */
.cg-role-pick { display: flex; flex-wrap: wrap; gap: 8px; }
/* These are options, not field captions — `.field label` would render them as
   uppercase 11px micro-caps, which is the section heading's job, not theirs. */
.cg-role-pick .cg-role-opt { display: inline-flex; align-items: center; gap: 7px; min-height: var(--ctl-h-sm);
  box-sizing: border-box; padding: 0 11px; border: 1.5px solid var(--border); border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer;
  text-transform: none; letter-spacing: normal; }
.cg-role-pick .cg-role-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.cg-role-pick .cg-role-opt input { accent-color: var(--primary); cursor: pointer; }
.cg-role-chk { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; font-size: 13px; cursor: pointer; }
.cg-role-chk input { margin-top: 2px; flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.cg-role-chk .muted { font-size: 12px; }
.cg-role-edit .cg-set-row { margin-top: 14px; }

/* Cargo overview card */
.cgc-kpis { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .cgc-kpis { grid-template-columns: repeat(3, 1fr); } }
.cgc-conf { margin: 10px 0; }
.cgc-bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.cgc-seg.ok { background: var(--primary); }
.cgc-seg.inf { background: color-mix(in srgb, var(--primary) 45%, transparent); }
.cgc-seg.low { background: color-mix(in srgb, #d4880b 65%, transparent); }
.cgc-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--text-2); }
.cgc-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.cgc-legend i.ok { background: var(--primary); }
.cgc-legend i.inf { background: color-mix(in srgb, var(--primary) 45%, transparent); }
.cgc-legend i.low { background: color-mix(in srgb, #d4880b 65%, transparent); }
.cgc-why { margin: 10px 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.cgc-why-hd { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 4px; }
.cgc-why-row { font-size: 12px; color: var(--text-2); }
.cgc-why-row b { color: var(--text); }
.cgc-setup { font-size: 11.5px; margin: 8px 0; }
.cgc-seq { font-size: 11.5px; margin: 6px 0; color: var(--primary); }
.cgc-seq .bad { color: #e25555; }
.cgc-list { margin-top: 8px; max-height: 260px; overflow-y: auto; }
.cg-hist-seq { font-size: 11.5px; color: var(--primary); }
.cgc-row { display: grid; grid-template-columns: 92px auto 1fr; gap: 8px; align-items: center;
  padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.cgc-row:last-child { border-bottom: 0; }
.cgc-plate { font-weight: 600; }
.cgc-basis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }

/* ---------------- Cargo v2: view, tiles, board, glyphs ---------------- */
/* Cargo's tabs mirror the places-tabs look but keep their OWN class — the
   geofence-tab entitlement gating in main.js selects .places-tab globally and
   hides any tab whose data-ptab key it does not know (the Alerts view dodges
   the same trap with .alerts-tab). Found live on prod: all three cargo tabs
   invisible for every real account, visible in mock mode only. */
/* .cg-tab / .cg-tabs: layout comes from the shared underline-tab rule in the
   Alerts section. */
.cg-tab-spacer { flex: 1; }
/* the toolbar action rides the tab row, Bookings-size, clear of the underline */
/* the bar is align-items:flex-end, so the button already lands on the tab
   baseline — the old margin-bottom:8px was what stretched the tabs to 41px
   and made the cargo bar 6px taller than the identical alerts one. */
.cg-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 10px; }
@media (max-width: 900px) { .cg-tiles { grid-template-columns: repeat(3, 1fr); } }
.cg-tile { display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 8px 10px; cursor: pointer; text-align: left; }
.cg-tile.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cg-tile-n { font-size: 20px; font-weight: 700; color: var(--text); }
.cg-tile-l { font-size: 11px; color: var(--text-2); }
.cg-tile.cg-needs_review .cg-tile-n, .cg-tile.cgt-needs_review .cg-tile-n { color: var(--amber-text); }
.cg-subline { font-size: 12px; margin-bottom: 10px; }
.cg-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; cursor: pointer; }
.cg-row:hover { border-color: var(--primary); }
.cg-plate { min-width: 92px; }
.cg-row-basis { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.cg-review-flag { color: var(--amber-text); }

/* ---- Fleet status palette ----
   MEASURED in a browser, not chosen by eye. This began as one set of
   hard-coded hexes with no dark variant, and one palette cannot serve two
   backgrounds. Against the dark card the alarm red fell to 2.43:1 on the
   tile and 2.69:1 on the chip; against the light card the amber and green
   tiles fell to 2.58 and 2.97, and the cargo cyan chip to 3.68.

   Tile numbers are 20px/700 — large text, floor 3:1. Chips are 11px, normal
   text, floor 4.5:1. Three of the eight tile pairings failed outright, and
   the failures landed on the ALARM colours: the marks that say something is
   wrong were the hardest ones on the screen to read, in the theme where it
   mattered most.

   Every value below clears 4.5:1 against the card it actually sits on, in
   the theme it sits in. The hue of each status is unchanged — red, amber,
   green, cyan, orange, indigo, violet — so nothing about what the screen
   MEANS moves; only whether it can be read.

   ONE token per status, shared by the tile, the chip and the row accent.
   The class prefixes stay separate (fs-t- / fs-c- / fs-r-) because a chip
   rule painting a tile is the hazard they exist to prevent; sharing the
   COLOUR is the opposite problem — a status that is amber must not be amber
   in two slightly different ways. The last three are unused here and arrive
   with the per-place-kind chips; they are defined now so that branch cannot
   land another hard-coded pair. */
:root {
  --fs-no-data: #b91c1c;
  --fs-stopped: #b45309;
  /* Blue, not green: the live map and dashboard paint Moving blue and the
     stopped states purple/green (--st-idle / --st-parked), so a green "Moving"
     here read as stopped one click away. Same hue as --st-moving, darkened to clear 4.5:1. */
  --fs-moving:  #1d4ed8;
  --fs-place:   #0e7490;
  --fs-unload:  #c2410c;
  --fs-depot:   #5145cd;
  --fs-check:   #7c3aed;
}
[data-theme="dark"] {
  --fs-no-data: #f87171;
  --fs-stopped: #fbbf24;
  --fs-moving:  #60a5fa;
  --fs-place:   #38bdf8;
  --fs-unload:  #fb923c;
  --fs-depot:   #a5b4fc;
  --fs-check:   #c4b5fd;
}

/* ---- Vehicle status (js/src/vehiclestatus.js) ----
   Four tiles, not the Board's six, so the grid is overridden rather than
   inherited — four items in a six-column grid render as four narrow boxes
   and two holes. The rows below are the table further down (.vs-*). */
.fs-tiles { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .fs-tiles { grid-template-columns: repeat(2, 1fr); } }
/* Deliberately NOT appended after `.fs-hist`. The blank-panel branch adds
   `.fs-sub-link` there, and two branches appending after one anchor collide
   on every merge for no reason — a conflict that has already silently eaten
   this stylesheet's new rules twice. Anchored here, where nothing else is
   adding, the two never meet.
   The parameter explainer. Quiet by design: it must be findable without
   competing with the tiles, so it is sized like the sub-line above it and
   carries no card of its own. */
.fs-how { margin: 2px 0 10px; font-size: 12px; color: var(--text-2); }
.fs-how > summary { cursor: pointer; width: fit-content; list-style: revert; }
.fs-how > summary:hover { color: var(--text-1); }
.fs-how-body { padding: 6px 0 2px 2px; max-width: 70ch; }
.fs-how-body p { margin: 0 0 6px; line-height: 1.5; }
.fs-how-body strong { color: var(--text-1); }
.fs-hist, .vs-map { flex: none; }
/* The sub-line counts are buttons, but they must not LOOK like buttons —
   the line is a sentence and a row of controls would out-shout the tiles
   above it. Underlined on hover, like the text links elsewhere, and marked
   when active so the filter it applied is visible in the same place the
   tiles show theirs. Inherits its colour so it stays legible in both
   themes without a colour of its own. */
.fs-sub-link { background: none; border: 0; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-decoration-line: underline; text-decoration-style: dotted;
  text-underline-offset: 2px; }
.fs-sub-link:hover { text-decoration-style: solid; }
.fs-sub-link.active { font-weight: 600; text-decoration-style: solid; color: var(--text-1); }

/* ---- Vehicle status as a table (2026-10-29) ----
   One row per vehicle, in FIXED columns — Vehicle · Status · Location ·
   (Cargo) · Today — so the eye runs straight down each one. The old rows were
   a wrapping line of pills, and every place name started wherever the chip
   before it happened to end. Colours are the live map's: a truck is the same
   blue or green on both screens. */
.vs-tile { flex-direction: row; align-items: center; gap: 10px; background: var(--surface);
  transition: border-color .15s; }
.vs-tile:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.vs-tile-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vs-tile .cg-tile-n { line-height: 1.1; }
/* the dot carries the colour; the number stays ink, and No data's is quieter */
.cg-tile.vs-tile.fs-t-no_data .cg-tile-n { color: var(--text-2); }
.vs-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.vs-d-moving   { background: var(--st-moving); }
.vs-d-at_place { background: var(--st-parked); }
.vs-d-stopped  { background: var(--amber); }
.vs-d-no_data  { background: var(--st-offline); }
.vs-d-never    { background: transparent; box-shadow: inset 0 0 0 1.5px var(--st-offline); }

/* the load row: smaller than the tiles, because it is the second question */
.vs-cargo { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.vs-cargo[hidden] { display: none; }
.vs-cargo-l { font-size: 12px; font-weight: 600; color: var(--text-2); margin-right: 2px; }
.vs-chip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--ctl-h-sm);
  padding: 0 10px; border-radius: var(--radius-pill); border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 12px; font-weight: 500;
  transition: border-color .15s, background .15s; }
.vs-chip b { font-weight: 700; }
.vs-chip:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.vs-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.vs-cargo-facts { font-size: 12px; margin-left: 4px; }
.vs-need { color: var(--amber-text); }
.vs-setup { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.vs-cdot { width: 8px; height: 8px; border-radius: 2px; flex: none; display: inline-block; background: var(--text-3); }
.vs-c-loaded, .vs-c-loading { background: var(--fs-place); }
.vs-c-unloading { background: var(--fs-unload); }
.vs-c-checkpoint { background: var(--fs-check); }
.vs-c-waiting, .vs-c-needs_review { background: var(--amber); }

.vs-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.vs-q { flex: 1 1 260px; max-width: 360px; }
.vs-toolbar .cg-subline { margin: 0; }

.vs-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.vs-row { display: grid; align-items: center; column-gap: 14px; padding: 10px 16px;
  border-top: 1px solid var(--border); font-size: 13px; }
.vs-table > .vs-row:first-child { border-top: 0; }
.vs-cols-c { grid-template-columns: minmax(110px, .8fr) minmax(150px, 1fr) minmax(180px, 1.5fr) minmax(170px, 1.3fr) minmax(110px, .8fr) 64px; }
.vs-cols   { grid-template-columns: minmax(120px, .8fr) minmax(160px, 1fr) minmax(220px, 1.8fr) minmax(120px, .9fr) 64px; }
.vs-head { padding-top: 8px; padding-bottom: 8px; background: var(--surface-2); font-size: 11px;
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.vs-row:not(.vs-head):hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.vs-c { min-width: 0; }
.vs-plate { font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.vs-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.vs-stw, .vs-ck { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.vs-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.vs-tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; margin-right: 6px;
  border-radius: 5px; background: var(--gray-soft); color: var(--text-2); vertical-align: 1px; }
/* A bare coordinate is a FALLBACK, not a place name: set muted, never in the
   weight a named place gets. */
.vs-coords { font-weight: 400; color: var(--text-2); font-variant-numeric: tabular-nums; }
.vs-none { color: var(--text-3); font-weight: 400; }
.vs-late { color: var(--red); font-weight: 600; white-space: nowrap; }
.vs-warn { color: var(--amber-text); }
.vs-was { font-style: italic; }
.vs-today { font-size: 12.5px; white-space: nowrap; }
.vs-act { display: flex; justify-content: flex-end; gap: 2px; }
.vs-act .icon-btn { display: inline-grid; place-items: center; }
.vs-act .icon-btn:hover { color: var(--primary); }
.vs-quiet .vs-plate, .vs-quiet .vs-where { color: var(--text-2); }

/* The quiet ones, folded: a row-wide button, as plain as the header row. */
.vs-group { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px;
  border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-weight: 600; text-align: left; }
.vs-group svg { transition: transform .15s; flex: none; }
.vs-group.open svg { transform: rotate(90deg); }
.vs-group:hover { color: var(--text); }
.vs-group-n { min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--gray-soft); display: inline-grid; place-items: center; font-size: 11px; }
.vs-group-hint { font-weight: 400; color: var(--text-3); }

/* Phones: the same row as a small card — plate and status on top, then the
   place, the load, and today beside the two buttons. */
@media (max-width: 760px) {
  .vs-head { display: none; }
  .vs-row { column-gap: 10px; row-gap: 6px; padding: 12px 14px; }
  .vs-table > .vs-head + .vs-row { border-top: 0; }
  .vs-cols-c { grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "veh st" "loc loc" "cargo cargo" "today act"; }
  .vs-cols   { grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "veh st" "loc loc" "today act"; }
  .vs-veh { grid-area: veh; } .vs-st { grid-area: st; text-align: right; }
  .vs-st .vs-stw { justify-content: flex-end; }
  .vs-loc { grid-area: loc; } .vs-cargo-cell { grid-area: cargo; }
  .vs-today { grid-area: today; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
  .vs-today .vs-sub { margin-top: 0; }
  .vs-act { grid-area: act; }
  .vs-cargo-cell:empty { display: none; }
  /* a quiet truck has no Today: its History button rides the place line */
  .vs-quiet.vs-cols-c { grid-template-areas: "veh st" "loc act" "cargo cargo"; }
  .vs-quiet.vs-cols   { grid-template-areas: "veh st" "loc act"; }
  .vs-quiet .vs-today { display: none; }
  /* a full-width line on a phone: wrap a long place rather than cut it */
  .vs-where, .vs-cargo-cell .vs-sub { white-space: normal; }
  .vs-group-hint { display: none; }
  .vs-setup { margin-left: 0; }
  .vs-q { max-width: none; flex-basis: 100%; }
}

/* The Cargo board, as the same table: Vehicle · Cargo · Progress · This leg.
   A row opens the detail modal, so the whole row is the target. */
.cg-cols { grid-template-columns: minmax(120px, .8fr) minmax(170px, 1.1fr) minmax(200px, 1.7fr) minmax(130px, .9fr) 64px; }
.cg-brow { cursor: pointer; }
.cg-brow .vs-act { align-items: center; }
.cg-brow .cg-review-flag { font-size: 11px; margin-right: 2px; }
.cg-bhist { flex: none; }
@media (max-width: 760px) {
  .cg-cols { grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "veh st" "loc loc" "today act"; }
  .cg-cols.vs-quiet { grid-template-areas: "veh st" "loc act"; }
  /* six tiles in three columns: "Needs review" must stay on one line, or
     its row grows taller than the other */
  #cgTiles .vs-tile { gap: 7px; padding-left: 9px; padding-right: 8px; }
  #cgTiles .cg-tile-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #cgTiles .vs-tile-txt { overflow: hidden; }
}

/* Cargo as setup (vstatus_cargo): the way back, above the tabs */
.cg-back { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 6px; padding: 2px 0;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cg-back:hover { color: var(--primary); }
.cg-back[hidden] { display: none; }
.cg-tab-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px;
  padding: 0 5px; border-radius: var(--radius-pill); background: var(--amber-soft); color: var(--amber-text);
  font-size: 11px; font-weight: 700; vertical-align: 1px; }
.cg-tab-badge[hidden] { display: none; }
.cg-settings-card { padding: 18px 20px; }
.cg-settings-foot { display: flex; justify-content: flex-end; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border); }
.cg-settings-foot .btn-primary { min-height: var(--ctl-h-md); }

/* History rows: a head line plus the run's path. The head never wraps its
   own children into the path, and the path wraps INSIDE the card — a
   20-stop run must grow the card, never spill out of it. */
.cg-hrow { margin-bottom: 8px; }
.cg-hrow-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cg-hrow-when, .cg-hrow-counts { font-size: 12.5px; white-space: nowrap; }
.cg-hrow-reason { font-size: 12px; white-space: nowrap; }
.cg-hrow-spacer { flex: 1; }
.cg-hrow-hist, .cg-hrow-cmp { flex: none; }
.cg-path { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--border); }
.cg-path-step { font-size: 11.5px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2, var(--surface));
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-path-arrow { color: var(--text-3); font-size: 11px; }
.cg-path-more { font-size: 11.5px; color: var(--text-3); }
.cg-step-load { color: var(--fs-place); border-color: color-mix(in srgb, var(--fs-place) 40%, transparent); }
.cg-step-drop { color: var(--fs-unload); border-color: color-mix(in srgb, var(--fs-unload) 40%, transparent); }
.cg-step-checkpoint { color: var(--fs-check); border-color: color-mix(in srgb, var(--fs-check) 40%, transparent); }
.cg-step-finish { color: var(--text-2, var(--text)); border-color: var(--text-3); font-weight: 600; }

/* v2 chip states (shared wording server-side, shared classes client-side) */
/* Tokens, not literals: the old cyan/amber measured 3.08 and 2.55:1 as chip
   text, and had no dark-theme pair at all. */
.cg-loading   { background: color-mix(in srgb, var(--fs-place) 10%, transparent); color: var(--fs-place); border-style: dashed; border-color: color-mix(in srgb, var(--fs-place) 45%, transparent); }
.cg-loaded    { background: color-mix(in srgb, var(--fs-place) 15%, transparent); color: var(--fs-place); border-color: color-mix(in srgb, var(--fs-place) 35%, transparent); }
.cg-unloading { background: color-mix(in srgb, var(--fs-unload) 10%, transparent); color: var(--fs-unload); border-style: dashed; border-color: color-mix(in srgb, var(--fs-unload) 45%, transparent); }
.cg-waiting   { background: color-mix(in srgb, var(--amber-text) 15%, transparent); color: var(--amber-text); border-color: color-mix(in srgb, var(--amber-text) 40%, transparent); }
.cg-review, .cg-needs_review.cg-chip { background: color-mix(in srgb, var(--amber-text) 12%, transparent); color: var(--amber-text); border-style: dashed; border-color: var(--amber-text); }
.cg-checkpoint { background: color-mix(in srgb, var(--fs-check) 12%, transparent); color: var(--fs-check); border-color: color-mix(in srgb, var(--fs-check) 40%, transparent); }

/* Zoomed-out cargo STATUS pins: participants keep an individual pin whose
   body is the tile colour + glyph instead of joining a cluster badge.
   Size/shape here; colour, border and glyph tint come from the shared cg-*
   chip classes. The extra selector weight keeps the disc solid (chip
   backgrounds are translucent — washed out over map tiles). */
.v-marker-inner .v-cargo-pin { width: 26px; height: 26px; border-radius: 50%; border: 2px solid;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* the pin glyph — individual pins only; absent in clusters by design */
.v-cargo-glyph { position: absolute; right: -4px; top: -4px; font-size: 10px; line-height: 1;
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  width: 15px; height: 15px; display: grid; place-items: center; }

.cg-review-chip { margin-top: 8px; padding: 6px 9px; border: 1px dashed #d4880b; border-radius: 8px;
  font-size: 12px; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* setup */
.cg-setup-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
/* One control height for the whole row (--ctl-h-md, like every toolbar), and
   the selects drawn by us: a native macOS <select> ignores padding and height
   and paints its own pill + stacked chevron, so the vehicle and close-reason
   pickers stood out from the search box and the date inputs beside them. Same
   appearance:none + chevron the .field selects use. */
.cg-setup-filters input, .cg-setup-filters select { background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 10px; font-size: 12.5px; color: var(--text); outline: none;
  height: var(--ctl-h-md); box-sizing: border-box; font-family: var(--font); transition: border-color .15s; }
.cg-setup-filters input:focus, .cg-setup-filters select:focus { border-color: var(--primary); }
.cg-setup-filters input { flex: 1; min-width: 150px; }
.cg-setup-filters select { appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 13px; }
[data-theme="dark"] .cg-setup-filters select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
/* History tab filters share the Setup filter look; the date inputs are
   labelled and keep their natural width, the count sits at the far right. */
.cg-hist-filters { margin-bottom: 10px; }
.cg-hist-filters input[type="text"] { flex: 1 1 180px; }
.cg-hist-date { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.cg-hist-date input { flex: 0 0 auto; min-width: 0; }
/* WebKit's date field paints its own inner box; keep it on the row's height */
.cg-hist-date input::-webkit-datetime-edit { padding: 0; line-height: 1; }
.cg-hist-count { margin-left: auto; font-size: 12px; white-space: nowrap; }
.cg-path-step[title] { cursor: help; }
.cg-mode { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 6px;
  padding: 3px 6px; font-size: 11px; color: var(--text); }

/* Cargo sequences */
.cg-seq-card { display: block; margin-bottom: 10px; cursor: default; }
.cg-seq-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cg-seq-steps { font-size: 12px; line-height: 1.9; }
.cg-seq-step { white-space: nowrap; }
.cg-seq-arrow { color: var(--text-3); margin: 0 6px; }
.cg-seq-vehicles { font-size: 11.5px; margin-top: 4px; }
/* A paused route stays fully legible — it is configuration someone will come
   back to, not an error. Dimmed, not hidden, and the chip does the saying. */
.cg-seq-paused { opacity: 0.62; }
.cg-seq-paused .cg-seq-steps, .cg-seq-paused .cg-seq-vehicles { text-decoration: none; }
.cg-seq-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cg-seq-n { width: 18px; text-align: right; color: var(--text-3); font-size: 12px; }
.cg-seq-place { flex: 1; font-size: 13px; }
.cg-seq-row select, .cg-seq-row input { background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 6px; padding: 4px 6px; font-size: 11.5px; color: var(--text); }
.cg-step-min { width: 64px; }
.cg-step-dwell { width: 64px; }
.cg-seq-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cg-seq-add select { flex: 1; min-width: 180px; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 7px; padding: 6px 9px; font-size: 12.5px; color: var(--text); }
.cg-seq-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; flex-wrap: wrap; }

/* ---- Geofences / Places list pages: toolbar groups, cargo tabs, search box ---- */
.gf-toolbar { flex-wrap: wrap; }
.gf-tb-left, .gf-tb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gf-tb-right { margin-left: auto; }
.list-q { margin: 0; }
.gf-tb-left .list-q { flex: 1; min-width: 200px; }
/* Toolbar filter: it shares a row with 34px "Categories" / "Draw geofence",
   so it is a --ctl-h-md control like People's search, not a 29px one. */
.list-q input { width: 100%; max-width: 420px; height: var(--ctl-h-md); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; font-size: 13px; color: var(--text); outline: none; }
.list-q input:focus { border-color: var(--primary); }
.gf-loading { margin: 6px 0 12px 19px; font-size: 12.5px; }
/* Live-map filter panel: the one search box at the top and its result list.
   A result row is a per-item map toggle, so it wears the same .lf-item look as
   a layer/category row — lit when that item is on the map. */
.map-filter .lf-search { width: 100%; box-sizing: border-box; margin: 0 0 4px; }
.lf-res { margin-bottom: 6px; }
.lf-res[hidden] { display: none; }
.lf-res-hd { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--text-3); padding: 0 2px 4px 6px; }
.lf-res-all { border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--text-2); font: inherit; font-size: 10.5px; font-weight: 700; line-height: 1; padding: 4px 8px; cursor: pointer; white-space: nowrap; }
.lf-res-all:hover { border-color: var(--primary); color: var(--primary); }
.lf-res-empty { font-size: 11px; color: var(--text-3); padding: 2px 2px 8px 6px; }
/* The list is capped at 40 rows in JS and the panel itself scrolls (max-height
   72%), so the rows need no scroller of their own. */
.lf-res-item .lf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-res-k { flex-shrink: 0; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.lf-res-item.on .lf-res-k { color: var(--primary); }

/* Pin bar — "3 shown on the map · Hide all · Open map" at the foot of the
   Geofences / Places / Route fences page. Sticky as the LAST child of the
   scrolling .view-inner, so it stays in reach down a 4,000-row list. */
/* bottom is the NEGATIVE of .view-inner's padding: a sticky element is held
   inside the scrollport's PADDING box, so bottom:0 parks it 22px up and the
   next row shows underneath it. */
.pin-bar { position: sticky; bottom: -22px; z-index: 3; display: flex; align-items: center; gap: 10px;
  margin: 14px -22px -22px; padding: 12px 22px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow-md); }
.pin-bar[hidden] { display: none; }
/* The phone padding is 16px. AFTER the base rule, or it never applies: it
   used to sit in the ≤820px block hundreds of lines up, the base won on
   source order, and on a phone the bar poked 6px past both screen edges. */
@media (max-width: 820px) { .pin-bar { margin: 12px -16px -16px; padding: 10px 16px; bottom: -16px; } }
.pin-bar-n { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--text-2); }

/* ---- Location actions in reports (any coord / address cell) ---- */
/* Kebab: square, and quiet until hovered — it sits beside a chip or an
   address and must not compete with either. */
.rep-loc { flex-shrink: 0; margin-left: 4px; width: 22px; height: 22px; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; vertical-align: middle; }
.rep-loc:hover { border-color: var(--border); background: var(--surface-2); color: var(--primary); }
.rep-loc-menu { position: fixed; z-index: 1700; min-width: 210px; padding: 5px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.rep-loc-menu[hidden] { display: none; }
.rep-loc-menu button { text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12.5px;
  padding: 7px 9px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.rep-loc-menu button:hover { background: var(--surface-2); color: var(--primary); }
.rep-loc-menu button[hidden] { display: none; }

/* Columns popover — one tick per column of the report on screen. Same shell as
   the location menu; rows are labels wrapping a real checkbox, and the list
   scrolls because a raw-positions report has fifteen of them. */
.rep-col-menu { position: fixed; z-index: 1700; min-width: 190px; max-height: 60vh; overflow-y: auto; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; }
.rep-col-menu[hidden] { display: none; }
.rep-col-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 7px;
  font-size: 12.5px; color: var(--text); white-space: nowrap; cursor: pointer; }
.rep-col-menu label:hover { background: var(--surface-2); }
.rep-col-menu input { accent-color: var(--primary); cursor: pointer; }

/* A row whose control is inert because another switch governs it — today the
   escalation row while WhatsApp is off. Dimmed rather than hidden, so the
   option is discoverable and its hint can say what to switch on. */
.ar-then-row.off { opacity: .55; }
.ar-then-row.off input { cursor: not-allowed; }

/* ---- Alert message templates (Alerts → ✍️ Message) ---- */
.tpl-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tpl-tab { padding: 5px 11px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.tpl-tab.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft, var(--surface-2)); }
/* A dot for a channel that already carries a custom message, so the tabs say
   at a glance which ones have been changed. */
.tpl-tab.set::after { content: " ●"; font-size: 9px; vertical-align: middle; }
#tplBody { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1.5px solid var(--border);
  border-radius: var(--radius-xs); background: var(--surface); color: var(--text);
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.tpl-fields { display: flex; gap: 5px; flex-wrap: wrap; margin: 8px 0; }
.tpl-field { padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
  color: var(--text-2); font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; }
.tpl-field:hover { border-color: var(--primary); color: var(--primary); }
.tpl-foot { display: flex; align-items: center; gap: 8px; }
.tpl-preview { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--radius-xs); background: var(--surface-2);
  color: var(--text); font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

/* The contact currently loaded into the form below, so it is obvious which row
   the fields belong to. */
.ackp-row.editing { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--radius-xs); }

/* A modal that holds a table-ish thing rather than a short form: the phonebook
   carries five fields per row and the message editor a paragraph of text, and
   both were being folded into the 420px default meant for a confirm dialog. */
.modal.modal-wide { max-width: 720px; }

/* ---- recipient picker: a list, not a wall of chips ---- */
.ct-pick { border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); overflow: hidden; }
.ct-pick-h { display: flex; align-items: center; gap: 8px; padding: 6px 9px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.ct-pick-t { font-weight: 600; }
.ct-search { flex: 1 1 120px; min-width: 90px; height: 24px; padding: 0 8px; font-size: 11.5px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); }
.ct-pick-h .ct-manage { margin-left: auto; }
/* Capped so a long phonebook scrolls inside the row instead of pushing the
   save button off the modal. */
.ct-list { max-height: 168px; overflow-y: auto; }
.ct-item { display: flex; align-items: center; gap: 8px; padding: 5px 9px; cursor: pointer; font-size: 12.5px; }
.ct-item + .ct-item { border-top: 1px solid var(--border); }
.ct-item:hover { background: var(--surface-2); }
.ct-item.on { background: var(--primary-soft, var(--surface-2)); }
.ct-item input[type="checkbox"] { width: 15px; height: 15px; margin: 0; flex-shrink: 0; accent-color: var(--primary); }
.ct-item-n { font-weight: 600; color: var(--text); }
.ct-item-r { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.ct-item-v { margin-left: auto; font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-3); }
@media (max-width: 560px) { .ct-item-v { display: none; } }

/* The phonebook's own add/edit row: five fields need a grid, not one long line. */
.ct-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ct-add input { min-width: 0; }
.ct-add button { grid-column: auto; }
@media (max-width: 560px) { .ct-add { grid-template-columns: 1fr; } }

/* ---- Second plate label: the customer's own name for a vehicle ----
   Quieter than the plate on purpose. The plate is the vehicle's identity and
   keeps its weight and its status colour; this sits beside it in the muted
   ink, reads as an annotation, and truncates rather than pushing the speed
   and the tag pills off the card. */
.v-label {
  font-size: 12px; color: var(--text-2); font-weight: 600;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-label::before { content: "· "; opacity: .6; }
.v-card .v-label { flex: 0 1 auto; }

/* The detail header's copy, plus the pencil and the inline input it becomes. */
.detail-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.detail-label .v-label { font-size: 13px; }

/* ---- Name-first: Settings ▸ Second plate name ▸ In front of the plate ----
   The two swap roles: the vehicle's own name leads in the plate's weight and
   ink, and the plate follows as the annotation, after its "·". The plate
   never shrinks anywhere — a long name truncates instead, so the identity
   the GPS server knows the vehicle by is always readable whole. */
.v-label.v-label-first { font-size: 13.5px; font-weight: 700; color: var(--text); }
.v-label.v-label-first::before { content: none; }
.v-label-first + .v-plate { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--text-2); }
.v-label-first + .v-plate::before { content: "· "; opacity: .6; }
.v-card.v-compact .v-label.v-label-first { font-size: 12.5px; }
.v-card.v-compact .v-label-first + .v-plate { max-width: none; overflow: visible; margin-left: 4px; }
/* Name only: the name sits in the .v-plate node itself, and unlike a plate it
   may be long — it truncates rather than pushing the speed off the card. */
.v-plate.v-plate-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* The detail heading: the name at the heading's size, the plate after it. */
#dPlate.name-first { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; max-width: 100%; }
#dPlate .d-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dPlate .d-plate-no { flex: 0 0 auto; font-size: 13px; font-weight: 700; letter-spacing: 0; color: var(--text-2); white-space: nowrap; }
#dPlate .d-plate-no::before { content: "· "; opacity: .6; }
/* …and the pencil that edits the name straight after it, not out past the
   status chip, where "edit" would read as editing the status. */
.detail-title:has(> #dPlate.name-first) > :not(.status-dot, #dPlate, #dLabelWrap) { order: 1; }
/* A sub-account cannot rename, so with the name in the heading (or no name at
   all) the wrap holds only a hidden pencil — drop it, or the empty box spends
   the row's gap twice between the heading and the status chip. */
.is-sub #dLabelWrap:not(:has(.v-label)) { display: none; }

/* A map pin's tag. The name is capped (main.js NAME_CAP measures the same
   150px) so one long name cannot run a tag across half the map. */
.v-marker-label .vm-name { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.v-marker-label .vm-plate { margin-left: 4px; font-weight: 600; opacity: .78; }
.v-marker-label .vm-plate::before { content: "· "; }
/* …and after the plate: the plate leads, the name follows quieter, capped. */
.v-marker-label .vm-name-after { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; margin-left: 4px; font-weight: 600; opacity: .78; }
.v-marker-label .vm-name-after::before { content: "· "; }

/* Multi-view's pane tag. */
.mv-plate.has-name { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.mv-plate.has-name .mv-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mv-plate.has-name .mv-plate-no { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--text-2); }
.mv-plate.has-name .mv-plate-no::before { content: "· "; opacity: .6; }
.mv-plate.has-name-after { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.mv-plate.has-name-after .mv-plate-lead { flex: 0 0 auto; }
.mv-plate.has-name-after .mv-name-after { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 700; color: var(--text-2); }
.mv-plate.has-name-after .mv-name-after::before { content: "· "; opacity: .6; }
/* A narrow pane — a phone's 3×3 (about 115px), a desktop's 6×6 and up. The
   zoom buttons (always shown on a touch screen) sat on the tag's right half
   and covered the plate, so they move to the middle of the right edge; and a
   name in front takes two lines, the name over its plate, rather than one
   line that leaves the name a single letter. */
.mv-pane { container-type: inline-size; }
@container (max-width: 220px) {
  .mv-zoomctl { top: 50%; transform: translateY(-50%); flex-direction: column; }
  .mv-plate.has-name { flex-direction: column; align-items: flex-start; gap: 0; }
  .mv-plate.has-name .mv-name, .mv-plate.has-name .mv-plate-no { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .mv-plate.has-name .mv-plate-no::before { content: none; }
  .mv-plate.has-name-after { flex-direction: column; align-items: flex-start; gap: 0; }
  .mv-plate.has-name-after .mv-plate-lead, .mv-plate.has-name-after .mv-name-after { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .mv-plate.has-name-after .mv-name-after::before { content: none; }
}

/* ---- The second plate name editor (vehiclelabel.js) ----
   The placement choices as cards, the Sub-accounts role picker's shape: a
   title and, under it, this vehicle as it would read. They dim until there
   is a name to place. */
.lm-plate { font-weight: 800; }
.lp-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.lp-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: start; align-content: start;
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; min-width: 0; }
/* They are <label>s inside a .field, whose label is the small upper-case
   caption — reset to body text. */
.field .lp-opt { font-size: 13px; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: normal; }
.lp-opt input { grid-row: span 2; width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--primary); }
.lp-opt strong { font-weight: 600; }
.lp-opt .lp-prev-plate, .lp-opt .lp-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.lp-opt .lp-prev-plate { font-weight: 700; color: var(--text); }
.lp-opt .lp-sub { color: var(--text-3); white-space: normal; line-height: 1.35; }
.lp-opt.on { border-color: var(--primary); background: var(--primary-soft); }
.lp-opt.off { opacity: .5; cursor: not-allowed; }
.lp-warn { color: var(--amber-text); }
.modal footer .lp-remove { margin-right: auto; color: var(--red); }

/* ---- Call / WhatsApp on a number already on the screen ----
   Anchors, not buttons: the browser offers "copy link" on them, and a desktop
   with no dialler registered does nothing rather than erroring. Sized to sit
   in a row of icon buttons without changing its height. */
.call-pair { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.call-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  color: var(--text-2); background: var(--gray-soft);
  text-decoration: none; flex: 0 0 auto;
}
.call-btn:hover { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.call-btn.wa { color: #128c7e; }
.call-btn.wa:hover { color: #075e54; background: color-mix(in srgb, #25d366 16%, transparent); }

/* The driver tile on the live-map detail panel: a name, the number as the
   dispatcher typed it, and the pair of links. One line where there is room and
   two where there is not — the buttons must never be pushed out of the tile,
   which is the whole point of showing the number at all. */
.metric-driver .metric-value { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.metric-driver .dr-name { font-weight: 700; color: var(--text); }
.metric-driver .dr-phone {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; color: var(--text-3);
}
/* Driver and kenek together: one line each, the same three parts behind a
   role pill, so the two numbers never run together. */
.metric-driver .dr-line { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
/* The role pill — the same look and colours as the People › Drivers list
   (.lg-role.role-driver / .lg-role.kenek) wherever a crew is named. */
.metric-driver .dr-role, .crew-role {
  font-size: 11px; font-weight: 600; line-height: 16px; padding: 1px 8px; border-radius: 999px;
  background: var(--gray-soft); color: var(--text-2);
}
.metric-driver .dr-role.driver, .crew-role.driver { background: var(--primary-soft); color: var(--primary); }
.metric-driver .dr-role.kenek, .crew-role.kenek { background: var(--amber-soft); color: var(--amber); }

/* Today and, beside it, the total (mileage_total accounts): two halves of one
   tile, side by side, so the total never makes the tile taller. */
.metric.metric-mileage { flex-direction: row; gap: 10px; }
/* With Device No hidden (a sub-account not given it, or the user's own field
   menu) Ignition moves up a row and row two came up one cell short, leaving a
   hole after Today. The tile takes the spare cell instead. Desktop grid only:
   the phone grid is two columns and already spans this tile across both. */
@media (min-width: 821px) {
  #detailPanel:has([data-field="device_no"][hidden]) .metric-mileage { grid-column: span 3; }
}
.mm-part { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mm-part:first-child { flex: 0 0 auto; }  /* Today is short; the total gets the rest */
.mm-part + .mm-part { border-left: 1px solid var(--border); padding-left: 10px; }
.mm-part .metric-label, .mm-part .metric-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Device command dialogs (engine / timezone / mileage reset). */
.cmd-body { display: flex; flex-direction: column; gap: 10px; }
.cmd-body .field-hint { margin: 0; }
.cmd-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cmd-row input, .cmd-row select {
  flex: 1 1 160px; min-width: 0; font: inherit; font-size: 13px; height: var(--ctl-h, 36px); box-sizing: border-box;
  padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text);
}
.btn-danger-soft { background: var(--red-soft); color: var(--red); border: 0; border-radius: var(--radius-xs, 6px); padding: 0 12px; min-height: var(--ctl-h-sm, 32px); font-weight: 600; cursor: pointer; }
.btn-success-soft { background: var(--green-soft); color: var(--green); border: 0; border-radius: var(--radius-xs, 6px); padding: 0 12px; min-height: var(--ctl-h-sm, 32px); font-weight: 600; cursor: pointer; }
.cmd-body button:disabled, .cmd-body input:disabled, .cmd-body select:disabled { opacity: .5; cursor: default; }
.cmd-status { margin-right: auto; }
.cmd-status.bad { color: var(--red); }
.cmd-status.good { color: var(--green); }

/* The account's office number, above the driver list: a labelled field with
   the same two links the driver's phone will show, so the dispatcher can see
   what they are handing out. */
.mu-office { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.mu-office[hidden] { display: none; }   /* only with the driver app (driverlist.js) */
.mu-office label { font-size: 12px; color: var(--text-2); font-weight: 600; }
/* A phone number, so a phone number's width — it ran the whole page wide —
   and the same height and border as the search box under it. */
.mu-office input {
  flex: 0 1 240px; min-width: 0; height: var(--ctl-h-md); box-sizing: border-box;
  font: inherit; font-size: 13px; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
}
.mu-office input:focus { outline: none; border-color: var(--primary); }
@media (max-width: 600px) { .mu-office input { flex: 1 1 100%; } }
/* no number yet: no links, and no empty line wrapped under the input */
.mu-office .call-pair:empty { display: none; }

/* ---- The driver record, folded under its row ----
   The row above stays a row: this opens below it, full width, and closes
   again. Two columns on a wide panel — the photo, then the fields — and one
   on a narrow one, because a form that reflows is better than a form you
   scroll sideways. */
.bk-driver-card:has(.bk-driver-info) { flex-wrap: wrap; }
.bk-driver-info {
  flex: 1 0 100%; display: flex; gap: 14px; align-items: flex-start;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.di-photo-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; width: 92px; }
.di-photo {
  width: 84px; height: 84px; border-radius: 10px; object-fit: cover;
  background: var(--gray-soft); border: 1px solid var(--border);
}
.di-photo.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: var(--text-2);
}
.di-grid {
  flex: 1 1 320px; min-width: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 10px;
}
.di-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.di-f > span { font-size: 11px; font-weight: 600; color: var(--text-2); }
.di-f input, .di-f select, .di-f textarea {
  font: inherit; font-size: 13px; padding: 5px 8px; min-width: 0;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--card); color: var(--text);
}
.di-f input:focus, .di-f select:focus, .di-f textarea:focus { outline: none; border-color: var(--brand); }
.di-f textarea { resize: vertical; }
.di-wide { grid-column: 1 / -1; }

/* The licence warning spans the grid: it is the one fact here that can stop a
   truck leaving the yard, so it reads before the fields rather than beside. */
.di-chip {
  grid-column: 1 / -1; font-size: 12px; font-weight: 700;
  padding: 4px 9px; border-radius: 7px; justify-self: start;
}
.di-chip.warn { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.di-chip.bad { background: color-mix(in srgb, var(--st-alarm) 14%, transparent); color: var(--st-alarm); }

.di-calls { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.di-call-row { display: flex; align-items: center; gap: 6px; }
.di-call-lbl { font-size: 11px; color: var(--text-2); font-weight: 600; }

@media (max-width: 720px) {
  .bk-driver-info { flex-wrap: wrap; }
  .di-calls { flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; }
}

/* A driver's "I have seen it". Quiet on purpose and nowhere near the ack
   chip: it carries no authority, it stopped no reminder, and the alert it
   sits under is still outstanding. Its own line under the alert text, so it
   reads as a note rather than as a status. */
.seen-line {
  display: block; margin-top: 3px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.seen-line::before { content: "👁 "; }

/* ---- The conversation about a job ----
   Under the order it belongs to, inside the trip detail. Capped in height and
   scrolled internally: a long thread must not push the order's actions off
   the screen. */
.chat-pane { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.chat-head { font-size: 11px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.chat-log {
  max-height: 200px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding-right: 4px;
}
.chat-empty { margin: 0; font-size: 12px; color: var(--text-2); }
.chat-msg {
  background: var(--gray-soft); border-radius: 10px; padding: 6px 9px;
  max-width: 85%; align-self: flex-start;
}
/* The office's own messages on the other side, the habit every messaging app
   has taught people to read without being told. */
.chat-msg.mine {
  align-self: flex-end;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
}
.chat-meta { font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.chat-meta b { color: var(--text); }
/* pre-wrap, so a message typed with line breaks keeps them — and so a run of
   spaces cannot be used to push the layout around. */
.chat-body { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.chat-write { display: flex; gap: 6px; align-items: flex-end; margin-top: 8px; }
.chat-write textarea {
  flex: 1; min-width: 0; resize: none; font: inherit; font-size: 13px;
  padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); max-height: 96px;
}
.chat-write textarea:focus { outline: none; border-color: var(--brand); }

/* ============ WALKTHROUGH (guided tour) ============
   z-index 2500: above every modal (1500) and drawer (1550-1700) and above
   the toast (2000) — a tour that a toast can cover is a tour that loses its
   own Next button — but below the login screen (3000), which must never have
   anything painted over it.

   The dim is the spotlight's own box-shadow rather than a separate backdrop:
   one element whose top/left/width/height can transition, so the light slides
   from one control to the next instead of blinking off and on. Four dimming
   rects would need four synchronised transitions; a clip-path cannot tween
   between two differently-shaped paths at all. */
.tour-root { position: fixed; inset: 0; z-index: 2500; }
.tour-root.dim { background: rgba(8, 12, 22, .55); }
.tour-spot {
  position: fixed; border-radius: var(--radius-xs);
  box-shadow: 0 0 0 9999px rgba(8, 12, 22, .55), 0 0 0 2px var(--primary) inset;
  pointer-events: none;   /* the shadow is the only thing painted here */
  transition: top .18s ease, left .18s ease, width .18s ease, height .18s ease;
}
.tour-pop {
  position: fixed; width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 13px 15px 14px;
}
.tour-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
/* The counter is the way into the contents, so it has to look pressable —
   on a 53-step tour, Next fifty times is not a way to reach one step. */
.tour-count {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--text-3); font-variant-numeric: tabular-nums;
  padding: 3px 6px; margin-left: -6px; border-radius: var(--radius-xs);
  transition: background .15s, color .15s;
}
.tour-count::after {
  content: ""; width: 0; height: 0;
  border: 3.5px solid transparent; border-top-color: currentColor;
  margin-top: 2px; transition: transform .15s;
}
.tour-count:hover { background: var(--surface-2); color: var(--text-2); }
.tour-pop.listing .tour-count { background: var(--surface-2); color: var(--text-2); }
.tour-pop.listing .tour-count::after { transform: rotate(180deg); margin-top: -2px; }

/* Contents replaces the step body in place rather than floating a second
   panel: the bubble is already wherever it fits, and a popover hanging off
   it would need its own flipping and clamping — and would have nowhere to
   go inside the mobile bottom sheet. */
.tour-list {
  max-height: min(48vh, 340px); overflow-y: auto;
  margin: 4px -6px -4px; padding: 6px 2px 0;
  /* a scrolled list otherwise bleeds mid-row into the counter above it */
  border-top: 1px solid var(--border);
  scrollbar-width: thin;
}
.tour-jump {
  display: flex; align-items: baseline; gap: 9px; width: 100%;
  padding: 6px 8px; border-radius: var(--radius-xs);
  text-align: left; font-size: 12.5px; line-height: 1.35; color: var(--text-2);
  transition: background .12s, color .12s;
}
.tour-jump:hover { background: var(--surface-2); color: var(--text); }
.tour-jump.current { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.tj-n {
  flex: 0 0 auto; min-width: 17px; text-align: right;
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.tour-jump.current .tj-n { color: var(--primary); }
.tj-t { min-width: 0; }
.tour-lang { margin-left: auto; display: flex; border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden; }
.tour-lang button {
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  padding: 3px 7px; color: var(--text-3); background: none; line-height: 1;
  transition: background .15s, color .15s;
}
.tour-lang button.active { background: var(--primary); color: #fff; }
.tour-x { color: var(--text-3); display: inline-flex; padding: 2px; }
.tour-x:hover { color: var(--text); }
.tour-title { font-size: 14.5px; font-weight: 700; margin: 0 0 4px; }
.tour-body { font-size: 13px; line-height: 1.5; color: var(--text-2); margin: 0; }
.tour-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.tour-foot button:disabled { opacity: .4; pointer-events: none; }

/* A rotated square with two of its borders showing, so it picks up the
   bubble's border colour on the side it points from. */
.tour-arrow {
  position: absolute; width: 10px; height: 10px;
  background: var(--surface); border: 1px solid var(--border);
}
.tour-arrow.arr-bottom { top: -6px; margin-left: -5px; border-width: 1px 0 0 1px; transform: rotate(45deg); }
.tour-arrow.arr-top { bottom: -6px; margin-left: -5px; border-width: 0 1px 1px 0; transform: rotate(45deg); }
.tour-arrow.arr-right { left: -6px; margin-top: -5px; border-width: 0 0 1px 1px; transform: rotate(45deg); }
.tour-arrow.arr-left { right: -6px; margin-top: -5px; border-width: 1px 1px 0 0; transform: rotate(45deg); }

/* The context-bar button. Label on desktop, icon alone once the bar is tight —
   the company name and the connection pill share that row. */
.tour-btn { gap: 5px; padding: 0 11px; }
.tour-btn span { font-size: 12.5px; font-weight: 600; }
@media (max-width: 900px) { .tour-btn span { display: none; } .tour-btn { padding: 0; width: var(--ctl-h-md); } }

/* On a phone the bubble stops chasing the control: a 320px card flipping
   around a 375px screen spends most of its time clamped to an edge anyway.
   Pin it to the bottom, above the mobile nav, and let the spotlight point. */
@media (max-width: 720px) {
  .tour-pop {
    left: 10px !important; right: 10px; width: auto;
    top: auto !important; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
  }
  .tour-arrow { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot { transition: none; }
}

/* The ? the tour lends to a dialog header. It sits beside the close button
   because the context-bar Guide button is behind the 1500 backdrop and
   cannot be reached while a dialog is open. */
.tour-mini { color: var(--text-3); }
/* Modal headers are space-between with two children; tour.js adds this as a
   third, which landed it in the MIDDLE of the header. Push it right, beside ×. */
.modal header .tour-mini { margin-left: auto; margin-right: 4px; }
.tour-mini:hover { color: var(--primary); background: var(--surface-2); }

/* ✕ on the built-in dashboard cards (added by dashcards.js) */
.dc-head-acts { display: flex; align-items: center; gap: 6px; }
.dash-card[data-card="status"] { position: relative; }
.dc-close-float {
  position: absolute; top: -8px; right: -8px; z-index: 1;
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.12));
  opacity: 0; transition: opacity .15s;
}
.dash-card:hover > .dc-close-float, .dc-close-float:focus-visible { opacity: 1; }
@media (hover: none) { .dc-close-float { opacity: 1; } }

/* ============ DRIVER SCORING (driverscoring.js) ============
   Bands share the app's green / amber / red, with a darker ink for text on
   white (the plain tokens are fill colours and fail contrast as text). Good
   and Poor also differ in lightness, and every colour sits beside its word,
   so the band never rests on hue alone. */
:root { --ds-good: #15a35a; --ds-watch: #d4880b; --ds-poor: #c2334a;
  --ds-good-ink: #0f7a43; --ds-watch-ink: #8a5300; --ds-poor-ink: #b42335; }
[data-theme="dark"] { --ds-good-ink: #4ade80; --ds-watch-ink: #fbbf24; --ds-poor-ink: #fb7185; }

/* One height for the whole toolbar row: the md step (34px). The period group
   is 28px buttons + 2px padding + 1px border on each side = 34. */
.ds-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ds-period { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); box-sizing: border-box;
  height: var(--ctl-h-md); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.ds-period-label { font-size: 14px; min-width: 130px; text-align: center; }
.ds-period .icon-btn:disabled { opacity: .35; cursor: default; }
.ds-pill { display: inline-flex; align-items: center; min-height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 12px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700; background: var(--gray-soft); color: var(--text-2); }
.ds-pill-open { background: color-mix(in srgb, var(--ds-watch) 16%, transparent); color: var(--ds-watch-ink); }
.ds-pill-locked { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.ds-spacer { flex: 1; }
.ds-search { min-height: var(--ctl-h-md); box-sizing: border-box; width: 220px; padding: 0 12px; font-size: 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); outline: none; }
.ds-search:focus { border-color: var(--primary); }
.bk-driver-off { margin-left: 4px; }
/* People › Drivers: drivers deleted while their score was open, waiting for
   the period to lock (booking.js loadRemoved). Quieter than the live list:
   dashed, muted, one line each, wrapping on a phone. */
.bk-removed { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.bk-removed[hidden] { display: none; }
.bk-removed-h { font-size: 12px; font-weight: 600; color: var(--text-3); }
.bk-removed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px;
  border: 1px dashed var(--border); border-radius: 10px; font-size: 13px; }
.bk-removed-name { font-weight: 600; color: var(--text-2); }
.bk-removed-when { color: var(--text-3); font-size: 12.5px; flex: 1 1 auto; }
.bk-removed-acts { display: flex; gap: 6px; }
.ds-banner { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
/* after .ds-banner: same specificity, so order decides */
.ds-banner-warn { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--ds-watch) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ds-watch) 35%, var(--border));
  color: var(--ds-watch-ink); }

.ds-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.ds-cards-driver { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .ds-cards, .ds-cards-driver { grid-template-columns: minmax(0, 1fr); } }
.ds-h { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.ds-h-side { margin-left: auto; font-weight: 500; color: var(--text-3); font-size: 12px; }
.ds-big { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.ds-big-hint { margin-left: 10px; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--text-3); }
.ds-bandbar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; margin: 14px 0 10px; background: var(--surface-2); }
.ds-bandbar i { display: block; min-width: 0; }
.ds-bg-good { background: var(--ds-good); } .ds-bg-watch { background: var(--ds-watch); } .ds-bg-poor { background: var(--ds-poor); }
.ds-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.ds-legend span { display: flex; align-items: center; gap: 7px; }
.ds-legend b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.ds-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ds-dot-hollow { border: 1.5px solid var(--text-3); box-sizing: border-box; }
.ds-bars { display: flex; flex-direction: column; gap: 8px; }
.ds-bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.ds-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-bar-row b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.ds-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.ds-bar i { display: block; height: 100%; border-radius: 4px; background: var(--primary-2); }
.ds-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.ds-facts .muted { font-size: 12.5px; }
.ds-warn { color: var(--ds-watch-ink); font-size: 13px; }
.ds-none { margin: 0; }

.ds-table-card { padding: 0; overflow: hidden; }
/* position: relative keeps the absolutely placed .sr-only "Actions" header
   inside the scroller — without it the page itself scrolled sideways on a
   phone (581px wide at 375). */
.ds-table-wrap { overflow-x: auto; position: relative; }
.ds-table th.num, .ds-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ds-table td { color: var(--text); }
/* The table's outer columns line up with the card titles above (18px), not
   the report table's 10px — the table sits flush in a padding-less card. */
.ds-table th:first-child, .ds-table td:first-child { padding-left: 18px; }
.ds-table th:last-child, .ds-table td:last-child { padding-right: 18px; }
.ds-row { cursor: pointer; }
.ds-row:hover td, .ds-row:focus-visible td { background: var(--surface-2); }
.ds-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ds-unranked td, .ds-unranked .ds-score { color: var(--text-3); }
.ds-name { color: var(--text); font-weight: 600; text-decoration: none; }
.ds-name:hover { color: var(--primary); }
.ds-table td.ds-plates, .ds-table td.muted { color: var(--text-2); }
.ds-score { display: inline-block; min-width: 26px; font-size: 15px; font-weight: 800; margin-right: 8px; font-variant-numeric: tabular-nums; }
.ds-t-good { color: var(--ds-good-ink); } .ds-t-watch { color: var(--ds-watch-ink); } .ds-t-poor { color: var(--ds-poor-ink); }
.ds-band { display: inline-flex; align-items: center; min-height: var(--badge-h); padding: 0 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; white-space: nowrap; }
.ds-band-good { background: color-mix(in srgb, var(--ds-good) 15%, transparent); color: var(--ds-good-ink); }
.ds-band-watch { background: color-mix(in srgb, var(--ds-watch) 17%, transparent); color: var(--ds-watch-ink); }
.ds-band-poor { background: color-mix(in srgb, var(--ds-poor) 15%, transparent); color: var(--ds-poor-ink); }
/* the same band several periods running (bandChip's run) */
.ds-band-run { font-weight: 800; white-space: pre; }
.ds-who-band { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ds-who-band .muted { font-size: 12px; }
/* td-qualified: .ds-table td sets the text colour and would win otherwise. */
.ds-table td.ds-up { color: var(--ds-good-ink); font-weight: 700; }
.ds-table td.ds-down { color: var(--ds-poor-ink); font-weight: 700; }
.ds-table .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ds-empty { text-align: center; padding: 40px 24px; }
.ds-empty h3 { margin: 0 0 8px; font-size: 17px; }
.ds-empty p { max-width: 520px; margin: 0 auto 16px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }

/* one driver */
/* last n periods (trendHtml) */
.ds-trend { margin-bottom: 16px; }
.ds-trend-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; align-items: end; margin-top: 14px; }
.ds-trend-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.ds-trend-v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ds-trend-track { display: flex; align-items: flex-end; width: 100%; max-width: 44px; height: 84px;
  border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.ds-trend-bar { display: block; width: 100%; border-radius: 6px 6px 0 0; }
.ds-tb-good { background: var(--ds-good); } .ds-tb-watch { background: var(--ds-watch); } .ds-tb-poor { background: var(--ds-poor); }
.ds-tb-unranked { background: transparent; box-shadow: inset 0 0 0 2px var(--text-3); }
.ds-trend-k { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.ds-trend-col.cur .ds-trend-k { color: var(--text); font-weight: 700; }
.ds-who-head { display: flex; align-items: center; gap: 12px; }
/* Their card under People › Drivers: beside the name, or under it on a phone. */
.ds-who-head:has(.ds-record) { flex-wrap: wrap; }
.ds-who-head .ds-record { margin-left: auto; align-self: flex-start; white-space: nowrap; }
.ds-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 15px; }
.ds-who-name { margin: 0; font-size: 18px; font-weight: 700; }
.ds-who-score { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.ds-who-score .ds-big { font-size: 48px; }
.ds-who-score .ds-who-band { margin-bottom: 6px; }
.ds-who-rank { margin-left: auto; text-align: right; font-size: 14px; }
.ds-who-rank .ds-h { justify-content: flex-end; margin-bottom: 4px; }
.ds-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .ds-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ds-stats div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.ds-stats span { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.ds-stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.ds-stats small { font-size: 11px; font-weight: 600; color: var(--text-3); }
.ds-formula { margin-top: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; line-height: 1.5; }
.ds-log-h { padding: 18px 18px 8px; margin: 0; flex-wrap: wrap; }
.ds-log-h .ds-h-side { margin-left: 0; }
.ds-log td { vertical-align: top; }
.ds-log td.ds-what { white-space: normal; min-width: 280px; }
.ds-log .ds-when { color: var(--text-2); font-variant-numeric: tabular-nums; }
.ds-log .ds-what .muted { font-size: 12.5px; margin-top: 2px; }
.ds-pts { font-weight: 700; }
.ds-voided td { background: var(--surface-2); }
.ds-voided .ds-pts, .ds-voided .ds-what > b { text-decoration: line-through; color: var(--text-3); }
.ds-void-note { margin-top: 6px; padding: 6px 8px; border-radius: var(--radius-xs); background: var(--surface);
  border: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.ds-act { text-align: right; }
.ds-pb { font-size: 12px; font-weight: 600; }

/* void / confirm dialogs */
/* .modal-body already spaces its children (flex, gap 14px): nothing in these
   dialogs adds a margin of its own on top. */
.ds-modal-intro { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.ds-void-sum { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.45; }
.ds-void-sum .muted { font-size: 12.5px; margin-top: 3px; }
#dsVoidNote { height: auto; min-height: 76px; resize: vertical; font-family: inherit; line-height: 1.4; }
.ds-impact { margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; }
.ds-impact[hidden] { display: none; }
/* Stop scoring dialog: what undoing / pausing does, one consequence a line. */
.ds-stop-body { display: flex; flex-direction: column; gap: 10px; }
.ds-stop-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; line-height: 1.5; color: var(--text-2); }
.ds-stop-list b { color: var(--text); font-weight: 600; }

/* settings */
.ds-settings { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
/* Without "Driver Scoring details" (main.js applyFeatures → body.ds-no-details)
   the screens lose their explanations: the tagged .ds-help lines, the text
   under each setting and option, the worked preview, the info-only "Which
   driver" row, the formula and the legends. Warnings (.ds-warn), dialogs and
   every control stay. */
body.ds-no-details .ds-help,
body.ds-no-details .ds-set-lbl > span,
body.ds-no-details .ds-choice-d,
body.ds-no-details .ds-preview,
body.ds-no-details [data-set-row="which"],
body.ds-no-details .ds-formula,
body.ds-no-details .ds-log-h .ds-h-side,
body.ds-no-details .ds-trend .ds-h-side { display: none !important; }
body.ds-no-details .ds-settings { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .ds-settings { grid-template-columns: minmax(0, 1fr); } }
.ds-settings-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ds-set-h { margin: 0; font-size: 15px; font-weight: 700; }
.ds-set-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--text-2); }
.ds-set-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; padding: 16px 0 2px; margin-top: 14px; border-top: 1px solid var(--border); }
@media (max-width: 700px) { .ds-set-row { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.ds-set-lbl { display: flex; flex-direction: column; gap: 4px; }
.ds-set-lbl b { font-size: 13.5px; }
.ds-set-lbl span { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.ds-choices { display: flex; flex-direction: column; gap: 8px; }
.ds-choices.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .ds-choices.two { grid-template-columns: minmax(0, 1fr); } }
.ds-choice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.ds-choice:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.ds-choice.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.ds-radio { position: relative; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; flex-shrink: 0; box-sizing: border-box; border: 1.5px solid var(--text-3); }
.ds-choice.on .ds-radio { border-color: var(--primary); }
.ds-choice.on .ds-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }
.ds-choice-t { display: flex; flex-direction: column; gap: 3px; }
.ds-choice-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.ds-choice-d { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.ds-badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--ds-good) 15%, transparent); color: var(--ds-good-ink); }
.ds-seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); align-self: start; justify-self: start; }
.ds-seg button { min-height: var(--ctl-h-sm); padding: 0 16px; border-radius: var(--radius-xs); font-size: 13px; font-weight: 600; color: var(--text-2); }
.ds-seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.ds-inline-fields { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.ds-inline-fields label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-inline-fields .ar-inline { width: 84px; font-size: 13.5px; font-weight: 600; }
.ds-inline-fields .muted { font-size: 12.5px; color: var(--text-2); }
.ds-bands { display: flex; flex-direction: column; gap: 8px; max-width: 440px; }
.ds-bandrow { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.ds-bandrow b { width: 130px; color: var(--text); }
.ds-bandrow span { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ds-bandrow .ar-inline { width: 64px; font-weight: 600; }
.ds-savebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); }
.ds-savebar .muted { flex: 1; font-size: 12.5px; color: var(--text-2); }
.ds-set-headrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ds-rules { display: flex; flex-direction: column; margin-top: 12px; }
.ds-rule { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.ds-rule.off { opacity: .6; }
@media (max-width: 700px) { .ds-rule { grid-template-columns: minmax(0, 1fr) auto; } }
.ds-tiers { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.ds-tiers span { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); }
.ds-mode { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--gray-soft); color: var(--text-2); white-space: nowrap; }
.ds-mode.alert { background: var(--primary-soft); color: var(--primary); }
.ds-rule-n { font-size: 12px; white-space: nowrap; }
.ds-rule-acts { display: inline-flex; align-items: center; gap: 8px; }
.ds-note { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.ds-preview { position: sticky; top: 0; }
.ds-prev-k { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--primary); margin-bottom: 4px; }
.ds-prev-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); margin-top: 12px; font-size: 13.5px; }
.ds-prev-row .muted { font-size: 12px; color: var(--text-2); }
.ds-prev-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ds-preview .ds-big { font-size: 32px; }
.ds-take { margin: 6px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; line-height: 1.5; }

/* fleet view filter, void log, standard set */
.ds-fleet { width: auto; min-width: 150px; }
/* On a phone the row wraps; the two inputs take a line each at full width
   rather than leaving ragged gaps beside them. */
@media (max-width: 560px) {
  .ds-toolbar .ds-fleet, .ds-toolbar .ds-search { flex: 1 1 100%; width: auto; }
  .ds-toolbar .ds-spacer { display: none; }
}
.ds-log-btn { margin-top: 12px; }
.ds-pad { padding: 0 18px 18px; }
.ds-people { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.ds-person { display: inline-flex; align-items: center; gap: 6px; min-height: var(--ctl-h-sm); padding: 0 12px;
  border-radius: var(--radius-pill); background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.ds-person b { color: var(--text); }
.ds-act-chip { display: inline-flex; align-items: center; min-height: var(--badge-h); padding: 0 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; background: var(--gray-soft); color: var(--text-2); white-space: nowrap; }
.ds-act-void { background: color-mix(in srgb, var(--ds-poor) 14%, transparent); color: var(--ds-poor-ink); }
.ds-act-restore { background: color-mix(in srgb, var(--ds-good) 14%, transparent); color: var(--ds-good-ink); }
.ds-act-lock { background: var(--primary-soft); color: var(--primary); }
.ds-act-driver_deleted { background: color-mix(in srgb, var(--ds-poor) 14%, transparent); color: var(--ds-poor-ink); }
.ds-act-paused { background: color-mix(in srgb, var(--ds-watch) 14%, transparent); color: var(--ds-watch-ink); }
.ds-set-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.modal.ds-starter-modal { max-width: 560px; }
.ds-starter { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ds-starter-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.ds-starter-row:first-child { border-top: 0; }
.ds-starter-row input[type="checkbox"] { margin-top: 2px; }
.ds-starter-row.off { cursor: default; }
.ds-starter-row.off .ds-starter-t, .ds-starter-row.off .ds-starter-pts { opacity: .55; }
.ds-starter-t { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.ds-starter-t span { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.ds-starter-t .ds-starter-have { color: var(--ds-watch-ink); font-weight: 600; }
.ds-starter-pts { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.ds-starter-pts .ar-inline { width: 64px; font-weight: 600; }

/* Who signs a decision: the name field, or person + PIN (driverscoring.js mountSign) */
.modal-body .field[hidden], .ds-sign-pin[hidden] { display: none; }
/* People › Drivers, deleting a driver whose score is not final: the signed
   second step (booking.js openDriverDelete) spaced like the body it sits in. */
.drv-del-step { display: flex; flex-direction: column; gap: 14px; }
.drv-del-step[hidden] { display: none; }
#drvDelModal footer { flex-wrap: wrap; }
.ds-sign-pin { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 480px) { .ds-sign-pin { grid-template-columns: minmax(0, 1fr); } }
/* Tell the office (notifyRow) */
.ds-notify { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ds-check { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.ds-check input { margin: 0; }
.ds-check .muted { font-size: 12px; }
.ds-check.off { cursor: default; color: var(--text-3); }
.ds-notify-to { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ds-notify-to > .muted { font-size: 12px; line-height: 1.45; }
.ds-notify-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }

/* Drivers' disputes (dsDisputeModal; disputeLine on the driver page) */
.modal.ds-disp-modal { max-width: 620px; }
/* no scroll of its own: the dialog scrolls (.modal max-height 90vh) */
.ds-disp { display: flex; flex-direction: column; gap: 10px; }
.ds-disp-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; }
.ds-disp-row.done { background: var(--surface-2); border-color: transparent; }
.ds-disp-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13.5px; }
.ds-disp-who .muted, .ds-disp-v .muted { font-size: 12.5px; }
.ds-disp-v { line-height: 1.45; }
.ds-disp-note { margin: 0; padding: 8px 12px; border-left: 3px solid var(--primary); background: var(--surface-2);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.ds-disp-row.done .ds-disp-note { background: var(--surface); }
.ds-disp-reply { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 13px; padding: 8px 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.ds-disp-reply:focus { outline: none; border-color: var(--primary); }
.ds-disp-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.ds-disp-h { margin: 6px 0 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.ds-disp-st { display: inline-flex; align-items: center; min-height: var(--badge-h); padding: 0 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; white-space: nowrap; }
.ds-disp-accepted { background: color-mix(in srgb, var(--ds-good) 15%, transparent); color: var(--ds-good-ink); }
.ds-disp-kept { background: color-mix(in srgb, var(--ds-poor) 13%, transparent); color: var(--ds-poor-ink); }
.ds-disp-closed { background: var(--surface); color: var(--text-2); }
.ds-disp-reply-txt { font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.ds-disp-reply-txt b { color: var(--text); }
.ds-disp-line { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--primary); background: var(--surface-2);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.ds-disp-line b { color: var(--text); }

/* Vehicles without a driver (dsNoDriverModal) */
.modal.ds-nodrv-modal { max-width: 600px; }
.ds-nodrv { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ds-nodrv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: center;
  padding: 12px 14px; border-top: 1px solid var(--border); }
.ds-nodrv-row:first-child { border-top: 0; }
.ds-nodrv-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 13.5px; }
.ds-nodrv-t .muted, .ds-nodrv-cost { font-size: 12.5px; line-height: 1.45; }
.ds-nodrv-cost { color: var(--text-2); }
.ds-nodrv-cost .ds-warn { font-size: inherit; }
.ds-nodrv-act .select-inline { width: 210px; }
.ds-nodrv-note { font-size: 12.5px; text-align: right; }
.ds-nodrv-new { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ds-nodrv-new .ar-inline { flex: 1 1 150px; min-width: 0; height: var(--ctl-h-md); box-sizing: border-box; font-size: 13px; border-radius: var(--radius-sm); }
.ds-nodrv-msg { margin: 0; padding: 14px; font-size: 13px; color: var(--text-2); }
@media (max-width: 560px) {
  .ds-nodrv-row { grid-template-columns: minmax(0, 1fr); }
  .ds-nodrv-act .select-inline { width: 100%; }
  .ds-nodrv-note { text-align: left; }
}

/* Requirements (driverscoring.js): the switcher on the scorecard, the list,
   the vehicles table with its move bar, the moves record and the editor. */
.ds-reqbar { display: flex; gap: 8px; overflow-x: auto; margin: -4px 0 16px; padding: 2px 0 4px; scrollbar-width: thin; }
.ds-req-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 0 0 auto; min-width: 140px;
  padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); text-align: left; cursor: pointer; }
.ds-req-chip:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.ds-req-chip.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.ds-req-chip b { font-size: 13.5px; }
.ds-req-chip span { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ds-req-chip .muted { font-weight: 500; }
.ds-who-req { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 12.5px; }
.ds-req-tag { display: inline-flex; align-items: center; min-height: var(--badge-h); padding: 0 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.ds-who-req .link-btn { font-size: 12.5px; }
.ds-settings.one { grid-template-columns: minmax(0, 1fr); }
.ds-rule-in { margin-top: 5px; font-size: 12px; }
.ds-rule-in.ds-warn { font-weight: 600; }
.ds-reqs { display: flex; flex-direction: column; margin-top: 12px; }
.ds-req { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.ds-req-main { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.ds-req-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.ds-req-meta { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.ds-req .ds-tiers { margin-top: 2px; }
.ds-tiers .ds-tier-warn { background: color-mix(in srgb, var(--ds-watch) 14%, transparent); color: var(--ds-watch-ink); }
.ds-req-acts { display: inline-flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 560px) { .ds-req { flex-direction: column; } .ds-req-acts { align-self: stretch; } .ds-req-acts .btn-ghost { flex: 1; } }
.ds-rq-orphan { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border); line-height: 1.5; }
.ds-rq-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 16px 18px 12px; }
.ds-rq-head .ds-h { margin: 0; }
.ds-rq-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-rq-tools .select-inline { width: auto; min-width: 160px; }
@media (max-width: 560px) { .ds-rq-tools, .ds-rq-tools .ds-search, .ds-rq-tools .select-inline { flex: 1 1 100%; width: auto; } }
.ds-rq-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 18px 12px; padding: 8px 12px;
  border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font-size: 13px; }
.ds-rq-bar[hidden] { display: none; }
.ds-rq-seln { display: inline-flex; align-items: center; gap: 10px; }
.ds-rq-seln .link-btn { font-size: 12.5px; }
.ds-rq-move { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.ds-rq-to { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
/* Under the plate and the requirement, the columns a phone has no room for. */
.ds-rq-meta { display: none; font-size: 12px; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.ds-rq-meta .link-btn { font-size: 12px; }
@media (max-width: 560px) {
  .ds-rq-table .ds-rq-wide { display: none; }
  .ds-rq-table td, .ds-rq-table th { white-space: normal; }
  .ds-rq-meta { display: block; }
  .ds-rq-move { margin-left: 0; flex: 1 1 100%; }
  .ds-rq-to { flex: 1; min-width: 0; }
  .ds-rq-to .select-inline { flex: 1; min-width: 0; width: auto; }
  .ds-set-headrow { flex-direction: column; align-items: stretch; }
  .ds-set-headrow .ds-set-actions { justify-content: flex-start; }
}
.ds-rq-to .select-inline { width: auto; min-width: 150px; }
.ds-rq-table th.ds-rq-ck, .ds-rq-table td.ds-rq-ck { width: 1%; padding-right: 0; }
.ds-rq-table input[type="checkbox"] { margin: 0; vertical-align: middle; }
.ds-rq-none { color: var(--text-3); font-style: italic; }
.ds-rq-title { font-size: 16px; }
.ds-rq-count { font-size: 12.5px; }
.ds-rq-name { width: 100%; max-width: 360px; min-height: var(--ctl-h-md); box-sizing: border-box; padding: 0 12px; font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); outline: none; }
.ds-rq-name:focus { border-color: var(--primary); }
.ds-rq-rules { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ds-rq-rule { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ds-rq-rule b { font-weight: 600; }
.ds-rq-ruleacts { justify-content: flex-start; margin-top: 4px; }
.modal.ds-hist-modal { max-width: 520px; }
.ds-hist { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.ds-hist li { position: relative; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); }
.ds-hist li::before { content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--text-3); }
.ds-hist li.now::before { border-color: var(--primary); background: var(--primary); }
.ds-hist b { color: var(--text); font-size: 13.5px; }
.ds-hist .muted { font-size: 12px; }
.ar-score-reqs { gap: 4px 14px; }
.ar-score-reqs #arScoreReqs { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.ar-score-req { font-weight: 500; margin: 0; }

/* driver score section of the rule builder */
.ar-score-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; margin: 2px 0; }
.ar-score-fields { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ar-score-fields[hidden], .ar-score-tiers[hidden], .ar-score-note[hidden] { display: none; }
.ar-score-tiers { align-items: flex-start; }
.ar-score-tier-col { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ar-score-tier { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.ar-score-note { margin: 0; }
.ar-silent .ar-then-row:not(:has(#arDwell)), .ar-silent .ar-mode-sub, .ar-silent .ar-wa { opacity: .45; }
.ar-score-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap; }

/* ============================================================
   Sub-accounts (js/src/subaccounts.js)
   ============================================================ */
.sa-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sa-intro { margin: 0 0 4px; font-size: 13.5px; color: var(--text-2); max-width: 640px; line-height: 1.45; }
.sa-layout { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.sa-list { display: flex; flex-direction: column; gap: 8px; }
.sa-empty { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 18px; }
.sa-empty p { margin: 0 0 6px; }
.sa-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; text-align: left; width: 100%;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  color: var(--text); font: inherit; cursor: pointer; }
.sa-row:hover { border-color: var(--primary); }
.sa-row.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.sa-row.off { opacity: .7; }
.sa-row-main { display: flex; flex-direction: column; min-width: 0; }
.sa-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-login { font-size: 12px; color: var(--text-3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; }
.sa-row-meta { grid-column: 1 / -1; font-size: 12px; color: var(--text-2); }
.sa-row-meta + .sa-row-meta { color: var(--text-3); }
.sa-pill { align-self: start; display: inline-flex; align-items: center; height: var(--badge-h); padding: 0 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; background: var(--gray-soft); color: var(--text-2); white-space: nowrap; }
.sa-pill.viewer { background: var(--primary-soft); color: var(--primary); }
.sa-pill.notify { background: var(--amber-soft); color: var(--amber); }
.sa-pill.off { background: var(--red-soft); color: var(--red); font-weight: 600; }
.sa-editor { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.sa-ed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sa-ed-head h3 { margin: 0; font-size: 16px; }
.sa-ed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; margin-bottom: 14px; }
.sa-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 600; min-width: 0; }
/* Under a new sub-account's password: it starts as the login name. */
.sa-pw-hint { font-weight: 400; font-size: 11px; }
.sa-input { height: var(--ctl-h-md); box-sizing: border-box; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 10px; font-size: 13px; color: var(--text); outline: none; min-width: 0; width: 100%; font-weight: 400; }
.sa-input:focus { border-color: var(--primary); }
.sa-login-wrap { display: flex; align-items: center; gap: 2px; min-width: 0; }
.sa-code { font-size: 13px; padding: 7px 0; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.sa-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sa-role { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: start; align-content: start;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.sa-role input { grid-row: span 2; margin-top: 3px; }
.sa-role span { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.sa-role.on { border-color: var(--primary); background: var(--primary-soft); }
.sa-role.blocked { opacity: .55; cursor: not-allowed; }
.sa-secs { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.sa-sec + .sa-sec { border-top: 1px solid var(--border); }
.sa-sec-head { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%;
  padding: 11px 12px; background: none; border: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.sa-sec-head:hover { background: var(--surface-2); }
.sa-sec-title { font-weight: 650; font-size: 13px; }
.sa-sec-sum { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-sec-sum.warn { color: var(--amber); font-weight: 600; }
.sa-sec-caret { color: var(--text-3); transform: rotate(-90deg); transition: transform .15s; flex: none; }
.sa-sec.open .sa-sec-caret { transform: none; }
.sa-sec.open .sa-sec-sum { white-space: normal; }
.sa-sec-body { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.sa-sec-body h5 { margin: 6px 0 6px; font-size: 12px; color: var(--text-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.sa-sec-body h5 .field-hint { font-weight: 400; }
.sa-tree.dim, .sa-scroll.dim { opacity: .5; }
/* "All vehicles" ticked: the picker under it shows the old picks, untouchable */
.sa-tree.dim .rvs { pointer-events: none; }
.sa-scroll { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.sa-check, .sa-radio { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.4; padding: 3px 0; cursor: pointer; }
/* The app's checkbox: 15px, in the primary colour (themes with it). */
.sa-check input, .sa-radio input, .sa-role input { width: 15px; height: 15px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.sa-radio span { color: var(--text-2); }
/* The day a sub-account's history starts from, under its radio. */
.sa-hist-from { padding: 2px 0 6px 23px; }
.sa-hist-from .sa-input { width: auto; min-width: 170px; }
/* Fleets and categories: a group ticks whole, or opens to pick members. */
.sa-groups { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.sa-groups > .muted { padding: 10px 12px; margin: 0; }
.sa-group + .sa-group { border-top: 1px solid var(--border); }
.sa-group-head { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; min-height: var(--ctl-h-md); }
.sa-group.open .sa-group-head { background: var(--surface-2); }
.sa-group-caret { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
  border: none; background: none; border-radius: var(--radius-xs); color: var(--text-3); cursor: pointer; }
.sa-group-caret:hover { background: var(--gray-soft); color: var(--text); }
.sa-group-caret svg { transform: rotate(-90deg); transition: transform .15s; }
.sa-group.open .sa-group-caret svg { transform: none; }
.sa-group-check { flex: 1; min-width: 0; padding: 0; font-weight: 600; }
.sa-group-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-group-meta { flex: none; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.sa-group-meta.on { color: var(--primary); font-weight: 600; }
.sa-group-body { padding: 4px 12px 8px 36px; max-height: 280px; overflow-y: auto; border-top: 1px solid var(--border); }
.sa-group-body .muted { margin: 6px 0; font-size: 12.5px; }
.sa-more { margin: 6px 0 2px; font-size: 12px; color: var(--text-3); }
.sa-kind { display: inline-block; min-width: 62px; margin-right: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-3); }
.sa-tree { display: flex; flex-direction: column; gap: 8px; }
.sa-warn { background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; }
.sa-warn p { margin: 0 0 6px; line-height: 1.45; }
.sa-warn.lg-noprefix { margin: 0 0 10px; line-height: 1.45; }
.sa-warn-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* The reports a sub-account opens: folding groups like Vehicles, one tick
   each inside, with the line each report carries on the Reports page. */
.sa-reports-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sa-reports-head .field-hint { margin: 0; }
.sa-reports-head .btn-ghost { flex: none; }
.sa-reports-head + .sa-reports { margin-top: 10px; }
/* A group holds a handful of reports: it grows, no scroll inside the page's own. */
.sa-reports .sa-group-body { max-height: none; overflow: visible; }
.sa-reports .sa-group-body .sa-check span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sa-reports .sa-group-body .sa-check small { font-size: 12px; color: var(--text-3); line-height: 1.4; }
/* Oversees: one sub-account a row — its name, its login, and what it brings. */
.sa-oversees .sa-check > span { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; min-width: 0; }
.sa-oversees .sa-check small { flex-basis: 100%; font-size: 12px; color: var(--text-3); }
.sa-oversees .sa-check input:disabled + span { opacity: .55; }
.sa-oversees .sa-check:has(input:disabled) { cursor: not-allowed; }
/* Live only: what they see beside what they never do, stacked on a phone. */
.sa-live-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 16px; }
.sa-live-cols h5 { margin: 0 0 4px; }
.sa-sec-body > .sa-warn { margin: 8px 0 0; }
.sa-list-plain { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
/* Save stays in reach however far down a long editor you are. */
/* bottom is the NEGATIVE of .view-inner's padding (as .pin-bar): a sticky
   element is held inside the scrollport's padding box, so bottom:0 parked it
   that far up and the editor's next lines showed underneath it. */
/* Full card width (out over the editor's 18px padding): as wide as the
   content only, the sections' 1px side borders showed past its edges as
   they scrolled under it. */
.sa-ed-foot { display: flex; align-items: center; gap: 8px; margin: 14px -18px -18px; position: sticky; bottom: -22px; z-index: 2;
  padding: 12px 18px 18px; background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 820px) { .sa-ed-foot { bottom: -16px; } }   /* .view-inner's phone padding — after the base rule */
/* The editor's place beside the list, before one is picked (wide screens only). */
.sa-editor.empty { display: flex; align-items: center; justify-content: center; min-height: 220px; text-align: center;
  border-style: dashed; box-shadow: none; background: transparent; color: var(--text-2); font-size: 13.5px; }
.sa-editor.empty p { margin: 0; max-width: 300px; line-height: 1.5; }
.sa-active { font-size: 13px; }
.sa-spacer { flex: 1; }
.sa-access p { margin: 0 0 8px; }
.sa-access-lead { font-size: 13.5px; line-height: 1.5; }
.sa-access-list { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; font-size: 13px; }
.sa-access-list dt, .sa-access-list dd { margin: 0; padding: 8px 12px; border-top: 1px solid var(--border); }
.sa-access-list dt:first-of-type, .sa-access-list dt:first-of-type + dd { border-top: none; }
.sa-access-list dt { color: var(--text-3); font-weight: 600; background: var(--surface-2); }
.sa-access-list dd { color: var(--text); font-weight: 500; }
.sa-access-h { margin: 6px 0 8px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; }
/* The ack dialog of an Operator sub-account: who signs it, instead of a PIN. */
.ack-self { margin: 6px 0 2px; font-size: 13px; color: var(--text); line-height: 1.45; }
@media (max-width: 860px) {
  /* minmax(0, …): a plain 1fr track grows to its content's min-content width,
     and the groups' one-line labels would push the page past the screen. */
  .sa-layout { grid-template-columns: minmax(0, 1fr); }
  .sa-editor.empty { display: none; }
  .sa-group-meta { max-width: 42%; overflow: hidden; text-overflow: ellipsis; }
  .sa-sec-head { grid-template-columns: 1fr auto; }
  .sa-sec-sum { grid-column: 1 / -1; grid-row: 2; }
  .sa-top { flex-direction: column; }
}
@media (max-width: 560px) {
  /* A phone: the meta goes on its own line under the name, so neither is
     cut ("Vamos Sales Te…" beside "Whole fleet · new vehi…"). */
  .sa-group-head { flex-wrap: wrap; row-gap: 0; }
  .sa-group-meta { order: 3; flex-basis: 100%; max-width: none; white-space: normal; padding: 0 0 4px 57px; }
}

/* "Shared with …" on the customer's own fleets, places, rules and vehicles
   (js/src/sharebadges.js). */
.share-badge { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 7px; border-radius: var(--radius-pill);
  background: var(--primary-soft); color: var(--primary); font-size: 10.5px; font-weight: 650; white-space: nowrap;
  vertical-align: middle; max-width: 160px; overflow: hidden; text-overflow: ellipsis; flex: none; }
.gf-item-body .share-badge, .poi-item-body .share-badge { margin-left: 6px; }
.ar-row-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ar-row-name strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The account menu's items are flex, which beat the `hidden` attribute: "My
   access" showed for every account and People for accounts without it. */
.user-menu-item[hidden] { display: none; }

/* ============================================================
   Sub-accounts in the web app (server: kinds.js refuses their writes).
   These hide what they could only fail at — as CSS, with !important,
   because several of these buttons are re-shown by the JS that owns them
   on every render (the device commands, the label pencil, the camera's
   talk button, the bulk bars).
   ============================================================ */
/* Both roles, Viewer and Operator: the vehicle's commands, tags and name, the
   camera's settings, the parent's categories, rules, templates and people. */
.is-sub #dLabelEdit, .is-sub #dTagsEdit, .is-sub #dCargo,
/* Tags are the account's own (uid-scoped) and a sub-account can make none, so
   the panel's "No tags" and the colour-by-tag tool were always empty for it. */
.is-sub #dTagsWrap, .is-sub #toolTagColor,
.is-sub #dBtnEngine, .is-sub #dBtnTimezone, .is-sub #dBtnMileageReset,
.is-sub #videoSnap, .is-sub #videoReset, .is-sub #videoTalk, .is-sub #vfFormat,
.is-sub .vf-dl, .is-sub .vf-del, .is-sub .ev-dl, .is-sub .ev-del, .is-sub .ev-bulk, .is-sub .ev-cb,
.is-sub .manage-cats, .is-sub #rfAdd, .is-sub .km-edit, .is-sub #tdEditTrip,
.is-sub .bulk-check, .is-sub #gfBulk, .is-sub #poiBulk,
.is-sub #tplBtn, .is-sub #arTplBtn, .is-sub #arPinBtn, .is-sub #arAdd,
.is-sub .ar-row-switch, .is-sub .ar-row .rf-actions,
.is-sub #ackPeopleOpen,
.is-sub #umAppUsers,
/* A Viewer only — an Operator keeps these: acknowledging, creating and editing
   its own places (a shared place renders no edit control at all), and live-
   share links for its vehicles. */
.is-viewer .ack-btn, .is-viewer .ack-cb, .is-viewer .ack-bulk,
.is-viewer #dBtnShare { display: none !important; }
/* Its own places come back where the customer ticked them (.sub-places,
   users.sub_places) — the Operator's controls, its own rows only. */
.is-viewer:not(.sub-places) .lf-add, .is-viewer:not(.sub-places) #placeBar,
.is-viewer:not(.sub-places) #repLocMenu [data-act="fence"], .is-viewer:not(.sub-places) #repLocMenu [data-act="place"],
.is-viewer:not(.sub-places) #gfDraw, .is-viewer:not(.sub-places) #poiAdd,
.is-viewer:not(.sub-places) .gf-cat, .is-viewer:not(.sub-places) .gf-swatch,
.is-viewer:not(.sub-places) .gf-edit, .is-viewer:not(.sub-places) .gf-del,
.is-viewer:not(.sub-places) .poi-cat-sel, .is-viewer:not(.sub-places) .poi-edit, .is-viewer:not(.sub-places) .poi-del,
.is-viewer:not(.sub-places) #dBtnPlace { display: none !important; }
.is-viewer.sub-places #view-geofence .viewer-note { display: none; }
/* …and says so once, where the missing buttons would otherwise look broken
   (Alerts, Geofences). Shown for a Viewer only. */
.viewer-note { display: none; margin: -6px 0 12px; font-size: 12.5px; color: var(--text-2); }
.is-viewer .viewer-note { display: block; }
/* A sub-account watches dashcams only where the customer ticked "dashcam" for it. */
.is-sub:not(.sub-dashcam) #dBtnCamera { display: none !important; }
/* Offline camera: still clickable (it opens the saved evidence), but reads as off. */
#dBtnCamera.cam-offline { opacity: .5; }
.sa-pill.operator { background: var(--green-soft); color: var(--green); }
.sa-pill.liveonly { background: var(--gray-soft); color: var(--text-2); }
/* Custom is a Viewer with picked reports: the Viewer's colour, its own name. */
.sa-pill.custom { background: var(--primary-soft); color: var(--primary); }
/* Live-only: the live map alone. No way into the past (History opens
   playback), no place layers to filter, and no alarm to count — the server
   sends it none (subaccounts.liveOnlyView). */
.is-liveonly #dBtnPlayback, .is-liveonly #toolFilter, .is-liveonly #mapFilter,
.is-liveonly .sl-item[data-filter="alarm"] { display: none !important; }
/* A Mechanic given the live map sees it as a live-only login does; without
   it, it has no socket and so no connection to show (main.js). */
.is-mechanic #dBtnPlayback, .is-mechanic #toolFilter, .is-mechanic #mapFilter,
.is-mechanic .sl-item[data-filter="alarm"],
.is-mechanic:not(.mech-live) #connPill { display: none !important; }
/* The workshop's login: quiet like Live only, its own ink (Notify has the amber fill). */
.sa-pill.mechanic { background: var(--gray-soft); color: var(--amber); }
/* A sub-account's Shared view: what its customer account shared with it,
   plus (Operator) its live links — never "Shared by me" (shares.js hides it;
   one tab left = no tab bar, as elsewhere in the app). */
.is-sub .shared-tab[data-stab="out"] { display: none !important; }

/* ---------- Alarm evidence (evidence.js) ----------
   One card per alarm: what and when, then its photo and its clip side by
   side, wrapping under each other on a narrow screen. */
.ev-body { max-height: min(70vh, 640px); overflow-y: auto; gap: 10px; }
.ev-alarm { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex;
            flex-direction: column; gap: 8px; }
.ev-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ev-head .muted { font-size: 12px; }
/* Delete sits at the far end of the line, away from the photo it removes. */
.ev-head .ev-del { margin-left: auto; }
/* Select all / Delete selected: stays at the top while the list scrolls. */
.ev-bulk { position: sticky; top: -18px; z-index: 1; display: flex; flex-wrap: wrap; align-items: center;
           gap: 6px 12px; padding: 8px 10px; margin: -18px -18px 0; background: var(--bg);
           border-bottom: 1px solid var(--border); }
.ev-bulk .ev-bulk-del { margin-left: auto; }
.ev-bulk-all { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.ev-n { font-size: 12px; }
.ev-cb { margin: 0 2px 0 0; align-self: center; }
.ev-media { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.ev-photo { display: block; flex: 1 1 220px; max-width: 320px; }
.ev-photo img { display: block; width: 100%; height: auto; border-radius: 8px; background: #000; }
.ev-video { flex: 1 1 260px; max-width: 360px; width: 100%; border-radius: 8px; background: #000; }
.ev-clip { flex: 1 1 220px; max-width: 320px; min-height: 90px; display: flex; align-items: center;
           justify-content: center; gap: 8px; border-radius: 8px; border: 1px dashed var(--border); }
.ev-wait { margin: 0; }

/* ---- People › Logins: one list of everyone who signs in (logins.js) ----
   The list on the left, the picked login's editor on the right — the
   driver's own card or the sub-account editor — stacked on a phone. */
.lg-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.lg-cats { display: inline-flex; gap: 2px; padding: 3px; background: var(--gray-soft); border-radius: 10px; flex-wrap: wrap; }
.lg-cats[hidden] { display: none; }
.lg-cat { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2);
  background: none; border: 0; cursor: pointer; white-space: nowrap; }
.lg-cat:hover { color: var(--text); }
.lg-cat.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.lg-cat-n { font-weight: 500; color: var(--text-3); margin-left: 2px; }
.lg-search { flex: 1 1 200px; min-width: 0; height: var(--ctl-h-md); box-sizing: border-box; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font-size: 13px; outline: none; transition: border-color .15s; }
.lg-search:focus { border-color: var(--primary); }
.lg-add { position: relative; margin-left: auto; }
.lg-add [hidden] { display: none; }
.lg-add-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 260px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 6px; display: flex; flex-direction: column; }
.lg-add-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); }
.lg-add-menu button:hover { background: var(--gray-soft); }
.lg-add-menu button span { font-size: 12px; color: var(--text-3); }
/* People › Drivers: the last sync from the company's database (driverlist.js). */
#drSync { height: var(--ctl-h-md); }
#drSync[hidden], .dr-sync[hidden] { display: none; }
#drSync:disabled { opacity: .55; cursor: default; border-color: var(--border); color: var(--text-2); }
.dr-sync { margin: -4px 0 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 12.5px; color: var(--text-2); }
.dr-sync.bad { border-color: var(--red); }
.dr-sync-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.dr-sync-line strong { color: var(--text); }
.dr-sync.bad .dr-sync-line strong { color: var(--red); }
.dr-sync-more { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.dr-sync-notes { margin: 8px 0 0; padding: 0; list-style: none; max-height: 260px; overflow: auto;
  border-top: 1px solid var(--border); }
.dr-sync-notes li { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr); gap: 10px; padding: 5px 0;
  border-bottom: 1px solid var(--border); }
.dr-sync-notes li:last-child { border-bottom: 0; }
.dr-sync-notes .who { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-sync-notes .warn .what, .dr-sync-notes .skip .what { color: var(--amber); }
@media (max-width: 560px) {
  .dr-sync-notes li { grid-template-columns: 1fr; gap: 0; }
}
.lg-layout { display: grid; grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); gap: 18px; align-items: start; }
.lg-list { display: flex; flex-direction: column; gap: 6px; }
.lg-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "av main role" "av what what";
  gap: 2px 10px; align-items: center; text-align: left; width: 100%; padding: 8px 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.lg-row:hover { border-color: var(--primary); }
.lg-row.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.lg-row.off .lg-name { color: var(--text-3); }
.lg-avatar { grid-area: av; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; }
.lg-main { grid-area: main; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lg-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-login { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-role { grid-area: role; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--gray-soft); color: var(--text-2); }
/* The sub-account roles keep the colours .sa-pill gives them elsewhere. */
.lg-role.driver { background: var(--gray-soft); color: var(--text); }
.lg-role.kenek { background: var(--amber-soft); color: var(--amber); }
.lg-role.role-driver { background: var(--primary-soft); color: var(--primary); }
.lg-role.viewer, .lg-role.custom { background: var(--primary-soft); color: var(--primary); }
.lg-role.operator { background: var(--green-soft); color: var(--green); }
.lg-role.notify { background: var(--amber-soft); color: var(--amber); }
.lg-role.mechanic { background: var(--gray-soft); color: var(--amber); }
/* A coordinator's pill sits before its role's, solid so it reads first. */
.lg-pills { grid-area: role; display: inline-flex; gap: 4px; align-items: center; justify-self: end; }
.lg-role.coord { background: var(--primary); color: #fff; }
.lg-what { grid-area: what; font-size: 12px; color: var(--text-2); }
.lg-what em { font-style: normal; color: var(--red); }
/* A coordinator's customers, or the coordinator over this login — its own line. */
.lg-coord { display: block; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-none { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px;
  color: var(--text-2); font-size: 13.5px; }
.lg-editor { min-width: 0; }
.lg-empty { display: flex; align-items: center; justify-content: center; min-height: 200px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-2); font-size: 13.5px; padding: 18px; }
.lg-empty[hidden], .lg-editor [hidden] { display: none; }
.lg-empty p { margin: 0; }
/* The picked driver's card fills the editor column instead of one line. */
#view-people .lg-editor .bk-driver-card { flex-wrap: wrap; }
@media (max-width: 900px) {
  .lg-layout { grid-template-columns: minmax(0, 1fr); }
  /* Stacked under the list, "pick one" is only an empty box to scroll past. */
  .lg-empty { display: none; }
  .lg-add { margin-left: 0; }
  .lg-add-menu { right: auto; left: 0; }
}

/* ---- People › Contacts: the same list + editor as Logins (contacts.js) ---- */
.ct-row .ct-flags { grid-area: role; display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ct-flag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  background: var(--primary-soft); color: var(--primary); }
.ct-flag.off { background: var(--gray-soft); color: var(--text-3); }
.ct-row.off .lg-name { text-decoration: line-through; }
.ct-editor .sa-ed-head .call-pair { flex-shrink: 0; }
.ct-ticks { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 4px; }
.ct-ticks #ctPin { width: 160px; }
.ct-ticks [hidden] { display: none; }

/* People › Contacts: what the list is for, in a few lines (index.html). */
/* A page intro, not a field hint: five lines of explanation at the hint's
   10.5px were the smallest body text in the app. */
.ct-intro { margin: 0 0 8px; font-size: 12px; line-height: 1.45; }
.ct-intro p { margin: 0 0 4px; }
.ct-intro ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.ct-intro em { font-style: normal; font-weight: 600; color: var(--text-2); }

/* ---- New trip: the car's crew, and a stop's own time (trips.js) ---- */
/* Driver and kenek side by side; the driver alone (no `helpers` key) takes
   the whole row, as every other field of the form does. */
.trip-crew { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.trip-crew.solo { grid-template-columns: 1fr; }
.trip-crew > .field-hint { grid-column: 1 / -1; margin: 0; }
.trip-crew > .field-hint:empty { display: none; }
.trip-crew .field { min-width: 0; }
.trip-crew .crew-new { display: flex; gap: 6px; margin-top: 6px; }
.trip-crew .crew-new[hidden], .trip-crew .field[hidden], .trip-crew[hidden] { display: none; }
.trip-crew .crew-new input { flex: 1 1 0; min-width: 0; }
@media (max-width: 640px) { .trip-crew { grid-template-columns: 1fr; } }
.stop-details .sd-due { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2, var(--text)); }
.stop-details .sd-due input { flex: 0 0 auto; width: auto; }
.stop-details .sd-due .muted { font-size: 11.5px; }

/* ---- Trips: a trip unfolded in place, the group headings (trips.js) ---- */
.trip-card .trip-x { border-top: 1px solid var(--border); padding: 12px 16px 14px; }
.trip-table .tt-x td { background: var(--surface-2); white-space: normal; padding: 12px 16px; }
.trip-table .tt-x { cursor: default; }
.trip-table tr.tt-x:hover { background: var(--surface-2); }
.trip-x .tx-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 10px; font-size: 12.5px; }
.trip-x .tx-p { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.trip-x .tx-facts-line { color: var(--text-3); }
.trip-x .tx-open { margin-left: auto; }
.trip-x .tx-stops { display: flex; flex-direction: column; gap: 8px; }
.trip-x .tx-stop { display: flex; gap: 10px; align-items: flex-start; }
.trip-x .tx-n {
  flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gray-soft); color: var(--text-2); font-size: 11px; font-weight: 700;
}
.trip-x .tx-main { min-width: 0; flex: 1; }
.trip-x .tx-where { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.trip-x .tx-where span { color: var(--text-3); }
.trip-x .tx-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12px; color: var(--text-3); }
.trip-x .tx-facts .ontime-chip { margin-left: 0; }
.trip-x .tx-why { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.trip-group-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 2px 2px; font-size: 13px; }
.trip-group-h:first-child { padding-top: 0; }
.trip-group-h span, .trip-table .tt-group span { color: var(--text-3); font-size: 12px; }
.trip-table .tt-group td { background: var(--surface-2); color: var(--text); cursor: default; }
.trip-table .tt-group span { margin-left: 10px; }
.trip-table tr.tt-group:hover { background: transparent; }
/* An open trip page told that the trip moved elsewhere while a form was open. */
.td-stale { background: var(--amber-soft); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 10px; }

/* ---- Reports: a trip that unfolds into its stops (reports.js cellHtml) ---- */
.rep-trip {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  font: inherit; color: var(--primary); cursor: pointer; text-align: left;
}
.rep-trip:hover { text-decoration: underline; }
.rep-trip .rep-trip-chev { flex-shrink: 0; transition: transform .15s; }
.rep-trip.open .rep-trip-chev { transform: rotate(90deg); }
.report-table .rep-xrow td { background: var(--surface-2); white-space: normal; padding: 12px 16px; }

/* ---- Summary drill-down (reports.js sumDrill) ----
   Every number of a Summary line opens the visits or drives behind it. A
   whole grid of blue links would stop reading as a grid, so a number keeps
   its own colour and a dotted underline says it opens; the open one is blue. */
.rep-sum {
  background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
  font-variant-numeric: tabular-nums; text-decoration: underline dotted; text-decoration-color: var(--text-3);
  text-underline-offset: 3px;
}
.rep-sum:hover, .rep-sum:focus-visible { color: var(--primary); text-decoration-color: currentColor; }
.rep-sum.open { color: var(--primary); font-weight: 700; text-decoration: underline solid; }
/* stays in view where the summary scrolls sideways on a phone (width set in JS) */
.sum-x { position: sticky; left: 16px; }
.sum-x-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; font-size: 13px; color: var(--text); }
.sum-x-scroll { overflow-x: auto; }
.sum-x-table { border-collapse: collapse; font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.report-table .sum-x-table th { padding: 6px 12px; background: var(--surface); }
.report-table .sum-x-table td { padding: 6px 12px; background: var(--surface); white-space: nowrap; }
.report-table .sum-x-table tr:last-child td { border-bottom: 0; }
.sum-x-table .sum-t, .sum-x-table .sum-d { font-variant-numeric: tabular-nums; }
.sum-x-table .sum-plate { font-weight: 600; color: var(--text); }
.report-table .sum-x-table tr.sum-hit td { background: var(--primary-soft); }
.report-table .sum-x-table tr.sum-veh td { background: var(--surface-2); padding-top: 8px; }
.sum-x-table .sum-act { text-align: right; }
.sum-x-table .sum-play { white-space: nowrap; }
.sum-tag { margin-left: 8px; padding: 1px 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  color: var(--primary); background: var(--primary-soft); }
/* On a phone the list is a column of short cards instead of a table to
   scroll sideways inside a table that already scrolls: when and how long on
   the first line, the truck (trip, km) and History on the second. */
@media (max-width: 600px) {
  .sum-x-table, .sum-x-table tbody { display: block; }
  .sum-x-table thead { display: none; }
  .sum-x-table tbody tr:not(.sum-veh) { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 2px;
    padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .sum-x-table tbody tr:not(.sum-veh)::after { content: ""; order: 4; flex-basis: 100%; height: 0; }
  .report-table .sum-x-table tbody tr:not(.sum-veh) > td { display: block; padding: 0; border: 0; background: none; }
  .sum-x-table .sum-a { order: 1; }
  .sum-x-table .sum-b { order: 2; }
  .sum-x-table .sum-b::before { content: "→ "; color: var(--text-3); }
  .sum-x-table .sum-dur { order: 3; margin-left: auto; font-weight: 600; color: var(--text); }
  .sum-x-table .sum-plate { order: 5; }
  .sum-x-table .sum-trip { order: 6; color: var(--text-3); }
  .sum-x-table .sum-km { order: 7; color: var(--text-3); }
  .sum-x-table .sum-km::after { content: " km"; }
  .sum-x-table .sum-act { order: 8; margin-left: auto; }
  .sum-x-table .sum-act:empty { display: none; }
  .report-table .sum-x-table tr.sum-hit { background: var(--primary-soft); }
  .report-table .sum-x-table tr.sum-veh, .report-table .sum-x-table tr.sum-veh td { display: block; }
}

/* ============================================================
   Dashboard — the card look (js/src/dashv2.js)
   Everything below is scoped to #view-dashboard.dv2 or to the detail
   panel; the rules above it are each card's own content.
   ============================================================ */
#view-dashboard { --dv2-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --dv2-grid: color-mix(in srgb, var(--text) 4%, transparent); --dv2-glow: color-mix(in srgb, var(--primary) 14%, transparent); }
#view-dashboard.dv2 > .view-inner { max-width: 1440px;
  background-image: linear-gradient(var(--dv2-grid) 1px, transparent 1px), linear-gradient(90deg, var(--dv2-grid) 1px, transparent 1px);
  background-size: 32px 32px; background-attachment: local; }

/* the weighted grid: 12 columns, cards sized by what they carry */
.dv2 #dashCards { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; grid-auto-flow: row dense; align-items: stretch; }
.dv2 #dashCards > .dash-card { grid-column: span 3; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; min-height: 168px; }
.dv2 #dashCards > .dash-card[hidden] { display: none; }
/* Two widths only — a quarter and a half — so dense packing always finds a
   card to fill a gap: any half-row hole takes a quarter card from further on. */
.dv2 #dashCards > .dash-card[data-card="status"], .dv2 #dashCards > .dash-card[data-type="map"],
.dv2 #dashCards > .dash-card[data-type="trend"], .dv2 #dashCards > .dash-card[data-type="service"] { grid-column: span 6; }
.dv2 #dashCards > .dash-card[data-type="map"] { grid-row: span 2; }
/* in the grid only the face shows; the card's own content waits for a click */
.dv2 #dashCards > .dash-card:not([data-type="map"]) > :not(.dv2-face) { display: none !important; }
.dv2 #dashCards > .dash-card[data-type="map"] > :not(.dv2-face):not(.uc-body) { display: none !important; }
.dv2 #dashCards > .dash-card[data-type="map"] { display: flex; flex-direction: column; }
.dv2 #dashCards > .dash-card[data-type="map"] > .uc-body { flex: 1; display: flex; flex-direction: column; padding: 0 12px 12px; min-height: 0; }
.dv2 #dashCards > .dash-card[data-type="map"] .dmap { flex: 1; min-height: 240px; }
.dv2 .dash-sheet-empty { grid-column: 1 / -1; }
.dash-card > .dv2-face { display: none; }
.dv2 #dashCards > .dash-card > .dv2-face { display: flex; }

/* the face */
.dv2-face { position: relative; flex-direction: column; gap: 8px; height: 100%; padding: 14px 16px 16px; cursor: pointer;
  outline: none; transition: background-color .18s; }
.dv2-face::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: radial-gradient(420px 160px at 50% 0%, var(--dv2-glow), transparent 70%); }
.dv2 #dashCards > .dash-card { transition: border-color .18s, transform .18s, box-shadow .18s; }
.dv2 #dashCards > .dash-card:not([data-type="map"]):hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dv2 #dashCards > .dash-card:hover .dv2-face::before { opacity: 1; }
.dv2-face:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); border-radius: var(--radius); }
.dv2 #dashCards > .dash-card[data-type="map"] > .dv2-face { cursor: default; height: auto; padding-bottom: 8px; }
.dv2-fh { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dv2-t { font-family: var(--dv2-mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dv2-p { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.dv2-live { display: inline-flex; align-items: center; gap: 5px; font-family: var(--dv2-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--green); white-space: nowrap; }
.dv2-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: dv2-pulse 2s infinite; }
@keyframes dv2-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.dv2-x { margin-left: auto; flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--text-3);
  border: 1px solid transparent; transition: .18s; }
.dv2 #dashCards > .dash-card:hover .dv2-x { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); }
/* drag to move (dashv2.js): the grip is the finger's handle and the mouse's hint */
.dv2-grip { margin-left: auto; flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  color: var(--text-3); cursor: grab; touch-action: none; opacity: 0; transition: opacity .18s, color .18s; }
.dv2-grip + .dv2-x { margin-left: 0; }
.dv2 #dashCards > .dash-card:hover .dv2-grip, .dv2-face:focus-visible .dv2-grip { opacity: 1; }
.dv2-grip:hover { color: var(--primary); }
@media (hover: none) { .dv2-grip { opacity: 1; width: 32px; height: 32px; margin: -4px -4px -4px auto; } }
.dv2 #dashCards > .dash-card.dv2-dragging { z-index: 5; transition: none; cursor: grabbing; box-shadow: var(--shadow-lg);
  border-color: var(--primary); }
.dv2 #dashCards > .dash-card.dv2-dragging .dv2-face { cursor: grabbing; }
body.dv2-drag-on { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.dv2-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dv2-val { font-family: var(--dv2-mono); font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; color: var(--text); }
.dv2-val small { font-family: var(--font); font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--text-2); margin-left: 5px; }
.dv2-val.bad { color: var(--red); } .dv2-val.warn { color: var(--amber-text); }
.dv2-delta { font-family: var(--dv2-mono); font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.dv2-delta.good { color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); }
.dv2-delta.bad { color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent); }
.dv2-cap { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.dv2-empty { font-size: 12.5px; color: var(--text-3); margin-top: auto; padding-bottom: 4px; }
.dv2-chart { margin-top: auto; color: var(--primary); }
.dv2-chart.good { color: var(--green); } .dv2-chart.bad { color: var(--red); } .dv2-chart.warn { color: var(--amber); }
.dv2-spark { display: block; width: 100%; height: auto; max-height: 72px; }
.dv2-chart { position: relative; }
.dv2-tip { position: absolute; bottom: calc(100% + 4px); transform: translateX(-12px); padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--surface);
  font: 600 11px var(--font); white-space: nowrap; pointer-events: none; z-index: 2; box-shadow: var(--shadow-md); }
.dv2-tip.end { transform: translateX(calc(-100% + 12px)); }
.dv2-target { stroke: var(--text-3); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.dv2-seg { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; margin-top: auto; background: var(--gray-soft); }
.dv2-seg span { display: block; height: 100%; min-width: 3px; }
.dv2-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px 12px; }
.dv2-lg { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); min-width: 0; }
.dv2-lg i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.dv2-lg b { margin-left: auto; font-family: var(--dv2-mono); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.dv2-rows { display: flex; flex-direction: column; border-top: 1px dashed var(--border); }
.dv2-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.dv2-row:last-child { border-bottom: 0; }
.dv2-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv2-row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dv2-row b { margin-left: auto; font-family: var(--dv2-mono); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dv2-row.bad b { color: var(--red); } .dv2-row.warn b { color: var(--amber-text); }

/* the "Needs attention" strip */
.dv2-attn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: linear-gradient(90deg, color-mix(in srgb, var(--red) 7%, var(--surface)), var(--surface) 50%); }
.dv2-attn[hidden] { display: none; }
.dv2-attn-lbl { font-family: var(--dv2-mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin-right: 4px; }
.dv2-chip { display: inline-flex; align-items: center; gap: 7px; height: var(--ctl-h-sm); padding: 0 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 12.5px; color: var(--text); cursor: pointer; }
.dv2-chip:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.dv2-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.dv2-chip.bad i { background: var(--red); } .dv2-chip.warn i { background: var(--amber); }
.dv2-chip b { font-family: var(--dv2-mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.dv2-clear { font-size: 12.5px; color: var(--green); font-weight: 600; }

/* ---------- the detail panel (js/src/dashdetail.js) ----------
   One layout for every card: header, four KPIs, the chart with a breakdown
   beside it, the list behind the numbers, how it is measured. */
.dv2-scrim { position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, #050912 55%, transparent); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
body.dv2-locked { overflow: hidden; }
.dd { --dd-night: color-mix(in srgb, var(--primary) 9%, transparent); --dd-line: color-mix(in srgb, var(--border) 60%, transparent);
  width: min(1180px, 100%); max-height: 100%; overflow: auto; overscroll-behavior: contain; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 30px 90px rgba(5, 9, 18, .3), 0 2px 6px rgba(5, 9, 18, .08);
  display: flex; flex-direction: column; transform-origin: top left; outline: none; }
.dd-hd { position: sticky; top: 0; z-index: 4; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px;
  padding: 20px 26px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dd-hd-t { min-width: 0; }
.dd-ov { display: flex; align-items: center; gap: 8px; font: 600 10.5px/1.2 var(--dv2-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.dd-live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; animation: dd-pulse 2s infinite; }
@keyframes dd-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 45%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.dd-hd h2 { margin: 8px 0 0; font-size: 23px; line-height: 1.15; font-weight: 700; letter-spacing: -.015em; }
.dd-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dd-btn { height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 13px var(--font); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap; }
.dd-btn:hover { background: var(--surface-2); }
.dd-btn svg { color: var(--text-2); }
.dd-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.dd-btn.primary:hover { background: var(--primary-2); }
.dd-btn.sm { height: var(--ctl-h-sm); padding: 0 10px; font-size: 12px; border-radius: var(--radius-xs); }
.dd-ib { width: 38px; height: 38px; border-radius: var(--radius-sm); border: 0; background: none; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; }
.dd-ib:hover { background: var(--surface-2); color: var(--text); }
.dd-ib.sm { width: var(--ctl-h-sm); height: var(--ctl-h-sm); border-radius: var(--radius-xs); font-size: 13px; }
.dd-exp { display: inline-flex; }
.dd-exp .dd-fmt { height: 36px; border: 1px solid var(--border); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2);
  color: var(--text-2); font: 600 12px var(--font); padding: 0 6px; }
.dd-exp .dd-btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.dd-seg { display: inline-flex; gap: 2px; padding: 3px; height: 36px; box-sizing: border-box; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; }
.dd-seg button { height: var(--ctl-h-sm); padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; }
.dd-seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 0 0 1px var(--border); }
.dd-step { display: inline-flex; align-items: center; height: 36px; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dd-step span { font: 600 12.5px var(--dv2-mono); padding: 0 6px; white-space: nowrap; }
.dd-step button { width: var(--ctl-h-md); height: var(--ctl-h-md); border: 0; background: none; color: var(--text-2); border-radius: 9px; display: grid; place-items: center; cursor: pointer; }
.dd-step button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.dd-step button:disabled { opacity: .35; cursor: default; }
.dd-loading, .dd-empty-all { padding: 48px 26px; text-align: center; color: var(--text-3); font-size: 14px; }

.dd-kp { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.dd-k { padding: 18px 26px 20px; border-left: 1px solid var(--dd-line); min-width: 0; }
.dd-k:first-child { border-left: 0; }
.dd-kl { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.dd-kn { display: flex; align-items: baseline; gap: 7px; margin-top: 9px; font: 600 30px/1 var(--dv2-mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dd-kn small { font: 500 13px var(--font); letter-spacing: 0; color: var(--text-3); }
.dd-kn.bad { color: var(--red); } .dd-kn.warn { color: var(--amber-text); } .dd-kn.good { color: var(--green); }
.dd-ks { margin-top: 9px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); min-width: 0; }
.dd-ks span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dd-d { font: 600 11px/1 var(--dv2-mono); padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.dd-d.good { color: var(--green); background: var(--green-soft); } .dd-d.bad { color: var(--red); background: var(--red-soft); }

.dd-mg { display: grid; grid-template-columns: minmax(0, 1fr) 330px; border-bottom: 1px solid var(--border); }
.dd-mg.solo { grid-template-columns: minmax(0, 1fr); }
.dd-sec { padding: 20px 26px 22px; min-width: 0; }
.dd-sec + .dd-sec { border-left: 1px solid var(--dd-line); }
.dd-sh { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; margin-bottom: 6px; }
.dd-sh h3 { margin: 0; font-size: 13.5px; font-weight: 650; }
.dd-hint { font-size: 12px; color: var(--text-3); }
.dd-lg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-3); }
.dd-lg i { display: inline-block; vertical-align: middle; margin-right: 6px; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.dd-lg i.line { width: 12px; height: 0; border-radius: 0; border-top: 2px solid var(--c); background: none; }
.dd-lg i.dash { width: 14px; height: 0; border-radius: 0; border-top: 1.5px dashed var(--c); background: none; }
.dd-ro { min-height: 19px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-3); }
.dd-ro.on { color: var(--text); font-weight: 550; }
.dd-none { padding: 22px 6px; color: var(--text-3); font-size: 13px; }

/* columns */
.dd-col-ch { display: grid; grid-template-columns: 40px minmax(0, 1fr); }
.dd-ya { position: relative; height: 200px; }
.dd-ya span { position: absolute; right: 8px; transform: translateY(50%); font: 500 10.5px var(--dv2-mono); color: var(--text-3); white-space: nowrap; }
.dd-pa { position: relative; height: 200px; border-bottom: 1px solid var(--border); }
.dd-gl2 { position: absolute; left: 0; right: 0; height: 1px; background: var(--dd-line); }
.dd-tgl { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--amber-text); z-index: 1; pointer-events: none; }
.dd-tgl span { position: absolute; right: 0; top: -19px; font: 600 10.5px var(--dv2-mono); color: var(--amber-text); background: var(--surface); padding-left: 6px; }
.dd-cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: var(--gap); }
.dd-c { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column-reverse; align-items: center; padding: 0; border: 0; background: none; cursor: default; border-radius: 6px 6px 0 0; }
.dd-c:hover, .dd-c:focus-visible { background: var(--surface-2); outline: none; }
.dd-cs { width: 100%; max-width: 46px; flex: none; }
.dd-cs:last-of-type { border-radius: 5px 5px 0 0; }
.dd-c.low .dd-cs { opacity: .45; }
.dd-pv { position: absolute; left: 50%; width: min(100%, 46px); transform: translateX(-50%); border-top: 2px solid var(--text-3); opacity: .6; }
.dd-xa { display: flex; gap: var(--gap); margin: 7px 0 0 40px; }
.dd-xa span { flex: 1; min-width: 0; text-align: center; font: 500 10.5px var(--dv2-mono); color: var(--text-3); white-space: nowrap; overflow: hidden; }

/* horizontal bars, breakdowns */
.dd-hb, .dd-gl { display: flex; flex-direction: column; gap: 2px; }
.dd-hr { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) minmax(64px, auto); align-items: center; gap: 12px; min-height: var(--ctl-h-md);
  padding: 4px 8px; margin: 0 -8px; border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dd-hr.static { cursor: default; }
.dd-hr:not(.static):hover { background: var(--surface-2); }
.dd-hr.on, .dd-g.on { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.dd-hl { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.dd-hl i, .dd-gn i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dd-hv { font: 600 12.5px var(--dv2-mono); text-align: right; white-space: nowrap; }
.dd-hv.bad, .dd-gv.bad { color: var(--red); } .dd-hv.warn, .dd-gv.warn { color: var(--amber-text); }
.dd-tk { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--surface-2); }
.dd-tk.stack { background: none; height: 12px; }
.dd-fl { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--primary); }
.dd-fl.bad { background: var(--red); } .dd-fl.warn { background: var(--amber); } .dd-fl.good { background: var(--green); }
.dd-tg { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--amber-text); }
.dd-sb { display: flex; gap: 2px; height: 100%; border-radius: 4px; overflow: hidden; }
.dd-sb > span { display: block; height: 100%; }
.dd-g { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 9px 10px; border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; width: 100%; }
.dd-g.static { cursor: default; }
.dd-g:not(.static):hover { background: var(--surface-2); }
.dd-gn { font-size: 13px; font-weight: 600; min-width: 0; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dd-gn small { flex-basis: 100%; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.dd-gv { font: 600 12.5px var(--dv2-mono); white-space: nowrap; }
.dd-g .dd-tk, .dd-g .dd-sb { grid-column: 1 / -1; height: 6px; }
.dd-facts .dd-big { font: 600 40px/1 var(--dv2-mono); letter-spacing: -.03em; margin-top: 8px; }
.dd-big.good { color: var(--green); } .dd-big.warn { color: var(--amber-text); } .dd-big.bad { color: var(--red); }
.dd-bigsub { font-size: 12.5px; color: var(--text-3); margin: 6px 0 14px; }
.dd-facts ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--text-2); }
.dd-facts li b { font: 600 13px var(--dv2-mono); color: var(--text); margin-right: 4px; }

/* swim lanes: one dot per vehicle, by how long it has been in its state */
.dd-sw { position: relative; --lab: 120px; }
.dd-sw-ov { position: absolute; top: 0; bottom: 22px; left: var(--lab); right: 8px; pointer-events: none; }
.dd-sw-ov i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--dd-line); }
.dd-swr { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); align-items: center; height: 38px; border-top: 1px solid var(--dd-line); padding-right: 8px; }
.dd-swr:last-of-type { border-bottom: 1px solid var(--dd-line); }
.dd-swl { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.dd-swl i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dd-swl b { font: 600 11px var(--dv2-mono); color: var(--text-3); margin-left: 2px; }
.dd-swt { position: relative; height: 100%; }
/* past this point the state has gone on unusually long (statesince.js LONG_MIN) */
.dd-swzone { position: absolute; top: 3px; bottom: 3px; right: -8px; border-radius: 4px 0 0 4px;
  background: color-mix(in srgb, var(--amber) 9%, transparent); border-left: 1px dashed color-mix(in srgb, var(--amber-text) 45%, transparent); }
.dd-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; padding: 0; border-radius: 50%; border: 2px solid var(--surface); background: var(--c);
  cursor: pointer; transition: transform .12s, opacity .12s; box-sizing: border-box; }
.dd-dot.long { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 35%, transparent); }
.dd-dot:hover, .dd-dot:focus-visible { transform: scale(1.5); z-index: 2; outline: none; }
.dd-dot.dim { opacity: .15; }
.dd-swx { position: relative; height: 16px; margin: 6px 8px 0 var(--lab); }
.dd-swx span { position: absolute; transform: translateX(-50%); font: 500 10.5px var(--dv2-mono); color: var(--text-3); white-space: nowrap; }
.dd-swx span:last-child { transform: translateX(-90%); }

/* timeline */
.dd-tl { position: relative; margin-top: 22px; --lab: 104px; --val: 70px; }
.dd-tl-ov { position: absolute; top: 0; bottom: 22px; left: var(--lab); right: var(--val); pointer-events: none; }
.dd-tl-ov > i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--dd-line); }
.dd-night { position: absolute; top: 0; bottom: 0; background: var(--dd-night); border-radius: 4px; }
.dd-night b { position: absolute; top: -18px; left: 4px; font: 600 10px var(--dv2-mono); color: var(--primary); white-space: nowrap; }
.dd-fut { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--dd-line) 6px 7px); }
.dd-now { position: absolute; top: 0; bottom: 0; border-left: 1.5px solid var(--text); }
.dd-now b { position: absolute; top: -18px; transform: translateX(-50%); font: 600 10px var(--dv2-mono); background: var(--surface); padding: 0 4px; white-space: nowrap; }
.dd-tr { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr) var(--val); align-items: center; height: 30px; }
.dd-tn { font: 600 12px var(--dv2-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.dd-tv { font: 600 12px var(--dv2-mono); text-align: right; color: var(--text-2); }
.dd-tv.bad { color: var(--red); }
.dd-ttk { position: relative; height: 100%; }
.dd-ttk::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--dd-line); }
.dd-ts { position: absolute; top: 8px; bottom: 8px; min-width: 3px; padding: 0; border: 0; border-radius: 4px; background: var(--st-moving); cursor: default; }
.dd-ts.over { background: var(--red); }
.dd-ts:hover, .dd-ts:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px currentColor; color: var(--st-moving); outline: none; }
.dd-ts.over:hover, .dd-ts.over:focus-visible { color: var(--red); }
.dd-tx { position: relative; height: 16px; margin: 6px var(--val) 0 var(--lab); }
.dd-tx span { position: absolute; transform: translateX(-50%); font: 500 10.5px var(--dv2-mono); color: var(--text-3); }
.dd-more { margin-top: 10px; height: var(--ctl-h-sm); padding: 0 12px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: 600 12px var(--font); cursor: pointer; }
.dd-more:hover { background: var(--surface-2); }

/* the list */
.dd-form { margin: 16px 26px 0; }
.dd-form[hidden] { display: none; }
.dd-tw { padding: 18px 26px 6px; }
.dd-tt { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dd-tf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dd-srch { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; min-width: 250px; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-3); }
.dd-srch:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.dd-srch input { border: 0; outline: 0; background: none; width: 100%; font: 500 13px var(--font); color: var(--text); }
.dd-chip { height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: 550 12.5px var(--font);
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.dd-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.dd-chip b { font: 600 12px var(--dv2-mono); color: var(--text); }
.dd-chip:hover { border-color: var(--text-3); }
.dd-chip.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); color: var(--text); }
.dd-chip.on[style] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.dd-cnt { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.dd-clr { border: 0; background: none; padding: 6px; color: var(--primary); font: 600 12px var(--font); cursor: pointer; }
.dd-tbl { overflow-x: auto; }
.dd-row { display: grid; align-items: center; min-width: 780px; }
.dd-th { border-bottom: 1px solid var(--border); position: sticky; top: 0; }
/* a long header wraps onto two lines rather than running into the next one */
.dd-th { align-items: stretch; }
.dd-th button { min-height: 38px; height: 100%; width: 100%; display: flex; align-items: center; gap: 4px; padding: 6px 10px; border: 0; background: none; cursor: pointer; text-align: left;
  font: 600 10.5px/1.25 var(--dv2-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.dd-th button.num { text-align: right; }
.dd-th button.on { color: var(--text); }
.dd-th button.num { justify-content: flex-end; }
.dd-tr2 { border-bottom: 1px solid var(--dd-line); }
.dd-tr2:hover { background: var(--surface-2); }
.dd-tr2.bad { box-shadow: inset 3px 0 0 var(--red); } .dd-tr2.warn { box-shadow: inset 3px 0 0 var(--amber); }
.dd-tr2 > div { padding: 9px 10px; font-size: 13px; min-width: 0; }
.dd-tr2 > .num { text-align: right; font-family: var(--dv2-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dd-ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-pl { font: 600 13px var(--dv2-mono); letter-spacing: -.01em; }
.dd-tr2 small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-mut { color: var(--text-3); } .dd-bad { color: var(--red); font-weight: 600; } .dd-good { color: var(--green); font-weight: 600; }
.dd-pill, .dd-spill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.dd-pill.good { background: var(--green-soft); color: var(--green); } .dd-pill.warn { background: var(--amber-soft); color: var(--amber-text); }
.dd-pill.bad { background: var(--red-soft); color: var(--red); } .dd-pill.info { background: var(--primary-soft); color: var(--primary); }
.dd-spill { color: var(--text); } .dd-spill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.dd-tag { display: inline-flex; align-items: center; gap: 5px; margin: 1px 6px 1px 0; font-size: 12px; }
.dd-tag i { width: 8px; height: 8px; border-radius: 50%; }
.dd-ub { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 10px; align-items: center; }
.dd-ub b { font: 600 12.5px var(--dv2-mono); text-align: right; }
.dd-ub b.bad { color: var(--red); } .dd-ub b.warn { color: var(--amber-text); }
.dd-days { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: middle; max-width: 210px; }
.dd-days i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.dd-days.dense { gap: 2px; } .dd-days.dense i { width: 5px; height: 12px; border-radius: 2px; }
.dd-days i.u { background: var(--primary); box-shadow: none; }
.dd-days i.p { background: color-mix(in srgb, var(--primary) 35%, var(--surface)); box-shadow: none; }
.dd-dn { margin-left: 8px; font: 600 12px var(--dv2-mono); color: var(--text-2); vertical-align: middle; }
.dd-go { width: var(--ctl-h-md); height: var(--ctl-h-md); border: 0; border-radius: 9px; background: none; color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.dd-go:hover { background: var(--primary-soft); color: var(--primary); }
.dd-tr2 .dd-btn.sm + .dd-ib { margin-left: 4px; }
.dd-ft { padding: 14px 26px 18px; font-size: 12px; color: var(--text-3); }

/* the four newer cards, in either look */
.dmap { position: relative; height: 240px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); cursor: pointer; background: var(--surface-2); z-index: 0; }
.dmap-foot { font-size: 12px; margin-top: 6px; }
.sv-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 12px; }
.sv-form { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: var(--surface-2); }
.sv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sv-grid .field { margin: 0; }
.sv-pick-hd { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 6px; font-size: 12px; font-weight: 700; }
.sv-notify { display: grid; gap: 2px; max-height: 220px; overflow: auto; font-size: 12.5px; }
.sv-notify-row { display: grid; grid-template-columns: minmax(120px, 220px) repeat(var(--cols, 3), minmax(0, 150px)); justify-content: start; align-items: center; gap: 4px 16px; padding: 3px 0; }
.sv-notify-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sv-notify-row label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sv-notify-head { align-items: end; }
.sv-notify-head span { display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.sv-notify-head small { font-size: 11px; }
.sv-notify-plan { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; font-size: 12.5px; }
.sv-notify-plan label { white-space: nowrap; font-weight: 600; }
.sv-notify-plan select { width: auto; max-width: 100%; flex: 0 1 auto; }
@media (max-width: 600px) {
  .sv-notify-row { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
  .sv-notify-name, .sv-notify-head > span:first-child { grid-column: 1 / -1; }
  .sv-notify-head > span:first-child { display: none; }
}
.sv-form-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.sv-acts { white-space: nowrap; text-align: right; }
.sv-table td { white-space: nowrap; }
.util-card[data-type="service"] .uc-body, .util-card[data-type="safety"] .uc-body { overflow-x: auto; }

@media (max-width: 1180px) {
  .dv2 #dashCards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dv2 #dashCards > .dash-card { grid-column: span 3 !important; }
  .dv2 #dashCards > .dash-card[data-card="status"], .dv2 #dashCards > .dash-card[data-type="map"],
  .dv2 #dashCards > .dash-card[data-type="trend"], .dv2 #dashCards > .dash-card[data-type="service"] { grid-column: span 6 !important; }
}
@media (max-width: 900px) {
  .dd-kp { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dd-k:nth-child(3) { border-left: 0; }
  .dd-k:nth-child(n+3) { border-top: 1px solid var(--dd-line); }
  .dd-mg { grid-template-columns: minmax(0, 1fr); }
  .dd-sec + .dd-sec { border-left: 0; border-top: 1px solid var(--dd-line); }
  .dd-hd, .dd-sec, .dd-tw, .dd-ft, .dd-k { padding-left: 16px; padding-right: 16px; }
  .dd-form { margin: 14px 16px 0; }
  .dd-srch { min-width: 0; flex: 1 1 200px; }
  .dd-tl { --lab: 82px; --val: 56px; }
  .dd-sw { --lab: 92px; }
}
@media (max-width: 700px) {
  .dv2 #dashCards { grid-template-columns: minmax(0, 1fr); }
  .dv2 #dashCards > .dash-card, .dv2 #dashCards > .dash-card[data-card="status"], .dv2 #dashCards > .dash-card[data-type="map"],
  .dv2 #dashCards > .dash-card[data-type="trend"], .dv2 #dashCards > .dash-card[data-type="service"] { grid-column: 1 / -1 !important; grid-row: auto; min-height: 0; }
  .dv2-scrim { padding: 0; place-items: stretch; }
  .dd { width: 100%; max-height: 100%; border-radius: 0; border: 0; }
  /* on a phone the header would hold a third of the screen: it scrolls away */
  .dd-hd { position: static; }
  .dv2-val { font-size: 26px; }
  .sv-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .dv2-live i, .dd-live { animation: none; }
  .dv2 #dashCards > .dash-card, .dv2-face::before { transition: none; }
  .dv2 #dashCards > .dash-card:hover { transform: none; }
}

/* ---------- vehicles picker (vehscope.js) ----------
   The Reports form's many-vehicle field: a button that reads like the selects
   beside it, opening a panel of fleets, tags and plates with checkboxes. */
.rvs { position: relative; min-width: 0; }
.rep-scope-field { min-width: 200px; max-width: 320px; }
.rvs-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: var(--ctl-h); box-sizing: border-box;
  padding: 0 30px 0 10px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
[data-theme="dark"] .rvs-btn { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.rvs-btn:focus-visible, .rvs-btn[aria-expanded="true"] { border-color: var(--primary); outline: none; }
.rvs-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rvs-none .rvs-sum { color: var(--red); }
.rvs-ct { flex: none; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--primary-soft); color: var(--primary);
  font-size: 11px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.rvs-ct[hidden] { display: none; }
.rvs-pop { position: absolute; top: 100%; left: 0; z-index: 1200; margin-top: 4px; width: 400px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); box-sizing: border-box; padding: 8px; }
.rvs-pop[hidden] { display: none; }
.rvs-pop.rvs-right { left: auto; right: 0; }
/* .rvs prefixes outrank the form's own `.report-controls .field input` (40px, padded) */
.rvs input.rvs-q { width: 100%; box-sizing: border-box; height: var(--ctl-h-md); min-height: var(--ctl-h-md); padding: 0 10px; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 8px; font: inherit; font-size: 13px; color: var(--text); outline: none; }
.rvs input.rvs-q:focus { border-color: var(--primary); }
.rvs-bar { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 4px; }
.rvs-act { padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; background: none; font: inherit; font-size: 12px;
  color: var(--text-2); cursor: pointer; }
.rvs-act:hover { background: var(--surface-2); color: var(--text); }
.rvs-act.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.rvs-list { max-height: min(340px, 50vh); overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
/* Fleets / Tags / Vehicles: each heading folds its section. Sticky, so the
   section you are scrolling in stays named. */
.rvs-sec { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; width: 100%; box-sizing: border-box;
  margin: 0; padding: 8px 6px 6px 7px; background: var(--surface); border: 0; font: inherit; font-size: 11px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; text-align: left; cursor: pointer; }
.rvs-sec:not(:first-child) { border-top: 1px solid var(--border); }
.rvs-sec:hover { color: var(--text); }
.rvs-sec-n { font-weight: 500; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.rvs-sec svg, .rvs-car svg { flex: none; transition: transform .15s; }
.rvs-sec[aria-expanded="true"] > svg, .rvs-car[aria-expanded="true"] > svg { transform: rotate(90deg); }
/* label.rvs-row: the rows are <label>s inside a .field, whose own labels are small caps */
.rvs label.rvs-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 7px; font-size: 13px; font-weight: 400;
  color: var(--text); text-transform: none; letter-spacing: normal; cursor: pointer; min-height: 32px; box-sizing: border-box; }
.rvs label.rvs-row:hover { background: var(--surface-2); }
.rvs .rvs-row input[type="checkbox"] { flex: none; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--primary); cursor: pointer; }
/* A fleet or tag row: a label (tick them all), then ▸ at the end (its
   plates). The ▸ stays outside the label so opening a fleet never ticks it,
   and every tick — fleet, tag or plate — sits in one column on the left. */
.rvs-grp { display: flex; align-items: center; gap: 2px; min-height: 32px; padding-right: 2px; border-radius: 7px; box-sizing: border-box; }
.rvs-grp:hover { background: var(--surface-2); }
.rvs label.rvs-lab { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 8px; padding: 6px;
  font-size: 13px; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: normal; cursor: pointer; }
.rvs-car { flex: none; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--text-3); cursor: pointer; }
.rvs-car:hover { background: var(--border); color: var(--text); }
/* a fleet's plates hang under it (the line drops from its tick), ticks in line with its name */
.rvs-kids { margin-left: 14px; padding-left: 9px; border-left: 1px solid var(--border); }
.rvs-peek { display: block; width: 100%; margin: 0; padding: 6px 6px 6px 30px; border: 0; border-radius: 7px; background: none;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--primary); text-align: left; cursor: pointer; }
.rvs-peek:hover { background: var(--surface-2); }
.rvs-sec:focus-visible, .rvs-car:focus-visible, .rvs-peek:focus-visible, .rvs-chip-x:focus-visible, .rvs-chip-more:focus-visible {
  outline: 2px solid var(--primary); outline-offset: -2px; }
/* What is picked, above the list and out of its scroll. */
.rvs-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.rvs-chips[hidden] { display: none; }
.rvs-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 24px; box-sizing: border-box; padding: 0 3px 0 9px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 600; }
.rvs-chip .rvs-sw { width: 8px; height: 8px; }
.rvs-chip-t { min-width: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rvs-chip-n { font-weight: 400; font-variant-numeric: tabular-nums; }
.rvs-chip-x { flex: none; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: inherit; cursor: pointer; }
.rvs-chip-x:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
button.rvs-chip-more { padding: 0 9px; border: 0; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
button.rvs-chip-more:hover { background: color-mix(in srgb, var(--primary) 22%, var(--primary-soft)); }
.rvs-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rvs-grp .rvs-nm { font-weight: 600; }
.rvs-plate { font-variant-numeric: tabular-nums; }
/* a plate keeps its width; its fleet takes the rest of the row and ends in "…" */
.rvs label.rvs-row > .rvs-plate { flex: 0 1 auto; }
.rvs-sub { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right;
  font-size: 11.5px; color: var(--text-3); }
.rvs-k { flex: none; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rvs-sw { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.rvs-more, .rvs-empty { padding: 8px 6px; font-size: 12px; color: var(--text-3); }
.rvs-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.rvs-n { flex: 1; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rvs .rvs-foot .btn-primary { height: 32px; min-height: 32px; padding: 0 14px; }
/* A row's own extras (Cargo's modes on a picked truck, a reminder's "has
   one"), at its end; on a narrow row they drop to a line of their own. */
.rvs label.rvs-row:has(.rvs-x) { flex-wrap: wrap; row-gap: 4px; }
.rvs-gap { flex: 1; }
.rvs-x { flex: none; display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12px; color: var(--text-3); }
.rvs-x select { height: var(--ctl-h-sm); min-height: var(--ctl-h-sm); padding: 0 24px 0 8px; font-size: 12px; }
.rvs-row .status-dot { flex: none; }
.mt-has { white-space: nowrap; }
/* rule mode: a fleet or tag kept as itself — its new vehicles count too */
.rvs-dyn { flex: none; display: inline-flex; align-items: center; color: var(--primary); }
.rvs-dyn[hidden] { display: none; }
/* Inline: the panel itself, in a dialog or a form (Cargo, a route's Assign,
   a maintenance reminder, a share link) — no button, no Done. */
.rvs-inline .rvs-pop { position: static; z-index: auto; width: auto; max-width: none; margin: 0; box-shadow: none;
  border: 1.5px solid var(--border); border-radius: 10px; }
.rvs-inline .rvs-list { max-height: min(300px, 45vh); }
/* Tool: the button wears the toolbar's look (the Multi-view wall's "Monitor"). */
.rvs-tool { display: inline-block; }
.rvs-tool .rvs-btn { width: auto; min-width: 150px; max-width: 280px; height: var(--ctl-h-md); border-width: 1px; font-weight: 600; }
@media (max-width: 600px) {
  .rep-scope-field { max-width: none; }
  /* A phone gets a sheet from the bottom: most of the screen to scroll in,
     the page dimmed behind it (a tap there closes it, as outside the panel). */
  .rvs:not(.rvs-inline) .rvs-pop { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 1450; width: auto; max-width: none; max-height: 85vh;
    margin: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 16px 16px 0 0;
    box-shadow: 0 0 0 100vmax rgba(8, 12, 22, .45); }
  .rvs:not(.rvs-inline) .rvs-list { flex: 1 1 auto; min-height: 0; max-height: none; }
  .rvs label.rvs-row, .rvs-grp { min-height: var(--ctl-h); }
  .rvs-car { width: 32px; height: 32px; }
  .rvs-sec { padding-top: 11px; padding-bottom: 9px; padding-left: 11px; }
  .rvs-peek { padding: 10px 6px 10px 30px; }
  .rvs-chip { height: 30px; }
  .rvs-chip-x { width: 24px; height: 24px; }
}

/* ---------- vehicle picker (vehpick.js) ----------
   The type-to-search box that stands in for every <select data-vpick>. The
   input wears the select's own classes, so it looks like the dropdown it
   replaces; the wrapper takes the select's place in the layout. */
.vp-native { display: none !important; }
.vp { position: relative; display: inline-block; min-width: 0; vertical-align: middle; }
.vp[hidden] { display: none; }
.field .vp { display: block; width: 100%; }
.vp > .vp-input { width: 100%; box-sizing: border-box; text-overflow: ellipsis; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 13px; }
.vp > .vp-input:focus { cursor: text; }
.vp > .vp-input:disabled { opacity: .6; }
.vp-list { position: absolute; top: 100%; left: 0; min-width: 100%; width: max-content; max-width: min(320px, 92vw); margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 1200; max-height: 280px; overflow-y: auto; padding: 4px; box-sizing: border-box; }
.vp-list[hidden] { display: none; }
.vp-opt { padding: 7px 10px; border-radius: 7px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-opt:hover, .vp-opt.cur { background: var(--surface-2); }
.vp-opt.sel { background: var(--primary-soft); font-weight: 600; }
.vp-opt.off { color: var(--text-3); cursor: not-allowed; }
.vp-opt.off:hover { background: none; }
.vp-empty { padding: 8px 10px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
/* an <optgroup>'s label, as the vehicles picker heads its sections (Fleets / Tags) */
.vp-grp { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
/* where the select had a width of its own, the box takes it */
.ra-toolbar .vp { min-width: 150px; max-width: 230px; }
.cg-hist-filters .vp { min-width: 150px; }
.trips-tools-row .vp { width: 190px; }
.mr-add .vp { display: block; width: 100%; }
.mr-add .vp-input { height: var(--ctl-h-sm); background-color: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 26px 0 8px; font-size: 12.5px; color: var(--text); outline: none; }
.bk-driver-card .vp { flex: 1.2; min-width: 0; }
.bk-driver-card .vp > .bk-driver-car { max-width: none; }
#view-people .bk-driver-card .vp { flex: 0 0 200px; max-width: 200px; }

/* ===== Draft trips from GPS (js/src/tripdrafts.js) ===== */
.trip-mode-tabs { margin-bottom: 12px; }
.trip-mode-tabs[hidden], .trip-drafts[hidden], .trips-toolbar[hidden], .trips-list[hidden] { display: none; }
.trip-mode-tabs .seg-btn b:empty { display: none; }
.trip-drafts-intro { margin: 0 0 10px; font-size: 12.5px; color: var(--text-3); max-width: 70ch; }
.trip-drafts .trips-tools-row { margin-bottom: 14px; }
.draft-dis-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.draft-dis-toggle input { accent-color: var(--primary); }
.dc-more { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; }

.draft-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 14px 16px;
}
.draft-card .dc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.draft-card .tc-plate { font-weight: 700; font-size: 14px; white-space: nowrap; }
.draft-card .dc-when { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.draft-card .dc-facts { font-size: 12px; color: var(--text-3); }
.draft-card .dc-head .trip-status { margin-left: auto; }
.draft-card .dc-from { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.draft-card .dc-from .dc-name { font-weight: 600; }

.dc-stops { list-style: none; margin: 10px 0 0; padding: 0; border-left: 2px solid var(--border); }
.dc-stop label { display: flex; align-items: baseline; gap: 10px; padding: 6px 0 6px 12px; cursor: pointer; font-size: 13px; }
.dc-stop input { accent-color: var(--primary); flex-shrink: 0; align-self: center; cursor: pointer; }
.dc-stop input:disabled { cursor: default; }
.dc-stop.home .dc-what { color: var(--text-3); }
.dc-time { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; min-width: 92px; }
/* wide enough for "10 jam 31 mnt", so the place names start in one column */
.dc-dur { font-size: 12px; color: var(--text-3); white-space: nowrap; min-width: 86px; }
.dc-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.dc-name { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.dc-name.dc-addr { font-weight: 500; }
.dc-name.dc-coord { font-weight: 500; color: var(--text-3); font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.dc-role { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.dc-role { background: var(--primary-soft); color: var(--primary); }
.dc-role.unload { background: var(--green-soft); color: var(--green); }
.dc-role.depot { background: var(--gray-soft); color: var(--text-2); }
/* A stop's notes (back at start · engine on · rested here): words, not pills —
   a pill beside "Name it" and "Tag" read as a button. */
.dc-hint { font-size: 12px; font-weight: 400; color: var(--text-3); white-space: nowrap; }
/* "Name it" on an unnamed stop: the small control step, beside the text. */
.dc-pin-btn { display: inline-flex; align-items: center; gap: 4px; min-height: var(--ctl-h-sm); padding: 0 9px;
  border: 1.5px dashed var(--border); border-radius: 999px; background: var(--surface);
  font-size: 11.5px; font-weight: 600; color: var(--primary); cursor: pointer; white-space: nowrap; }
.dc-pin-btn:hover { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
/* "Tag" on a named place with no cargo role, and the choices it opens in place. */
.dc-role-btn { min-height: var(--ctl-h-sm); padding: 0 10px; border: 1.5px dashed var(--border); border-radius: 999px;
  background: var(--surface); font-size: 11.5px; font-weight: 600; color: var(--primary); cursor: pointer; white-space: nowrap; }
.dc-role-btn:hover { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.dc-role-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dc-role-pick button { min-height: var(--ctl-h-sm); padding: 0 10px; border: 1.5px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 11.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.dc-role-pick button:hover { border-color: var(--primary); color: var(--primary); }
.dc-role-pick button[data-rolecancel] { padding: 0 8px; color: var(--text-3); }
.dc-role-pick button:disabled { opacity: .5; cursor: default; }
.dc-note { margin-top: 10px; font-size: 12.5px; color: var(--amber-text); background: var(--amber-soft); border-radius: var(--radius-sm); padding: 8px 10px; }

.dc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.dc-foot .dc-ref { flex: 1; min-width: 160px; height: var(--ctl-h-sm); margin: 0; font-size: 12.5px;
  padding: 0 10px; border: 1.5px solid transparent; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); outline: none; }
.dc-foot .dc-ref:focus { border-color: var(--primary); }
.dc-foot [data-confirm] { margin-left: auto; }
.dc-foot [data-confirm]:disabled { opacity: .45; cursor: default; }

.draft-card.done { padding: 10px 16px; background: var(--surface-2); box-shadow: none; }
.dc-receipt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.dc-receipt .dc-done { color: var(--text-2); }
.dc-receipt .dc-done b { color: var(--text); }
.dc-receipt .btn-ghost:first-of-type { margin-left: auto; }

.dc-dismissed { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.dc-dis-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px;
  padding: 8px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text-2); }
.dc-dis-row .dc-dis-label { flex: 1; min-width: 160px; color: var(--text-3); overflow-wrap: anywhere; }

/* A trip confirmed from a GPS draft, wherever trips are listed. */
.trip-src-gps { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 999px;
  background: var(--gray-soft); color: var(--text-2); margin-left: 4px; }

@media (max-width: 600px) {
  .dc-stop label { flex-wrap: wrap; row-gap: 2px; }
  .dc-time { min-width: 0; }
  .dc-what { flex-basis: 100%; padding-left: 24px; }
  .dc-foot [data-confirm] { margin-left: 0; flex: 1; }
}

/* ---------- Maintenance view (maintenance.js) ----------
   Reuses the card's .sv-form / .sv-pick / .uc-table / .uc-kpis; what is here
   is the view's own layout. On a phone each table row becomes a block with
   its labels (data-l), so nothing scrolls sideways. */
#view-maintenance .mttab-panel { display: flex; flex-direction: column; gap: 12px; }
#view-maintenance .mttab-panel[hidden] { display: none; }
.mt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-chip { display: inline-flex; align-items: baseline; gap: 6px; min-height: var(--ctl-h-md); padding: 0 12px; align-items: center; border: 1px solid var(--border);
  border-radius: var(--radius-pill); background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.mt-chip b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.mt-chip.bad b { color: var(--st-alarm); }
.mt-chip.warn b { color: color-mix(in srgb, var(--st-nolocate) 85%, var(--text)); }
.mt-chip:hover { border-color: var(--primary); }
.mt-chip.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--surface)); color: var(--text); }
.mt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mt-toolbar > .muted { font-size: 12.5px; }
.mt-toolbar select { width: auto; flex: 0 0 auto; max-width: 100%; }
.mt-q { flex: 1 1 220px; max-width: 340px; }
.mt-q input { width: 100%; }
.mt-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.mt-inline input { width: auto; }
/* The records period sits on the toolbar's 34px line with the item select and
   the search box beside it — it was the browser's own 22px date field. */
.mt-inline input[type="date"] { height: var(--ctl-h-md); box-sizing: border-box; padding: 0 10px; font: inherit; font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); outline: none; }
.mt-inline input[type="date"]:focus { border-color: var(--primary); }
.mt-form { margin: 0; }
.mt-form-hd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.mt-form-hd .muted { font-size: 12.5px; }
.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.mt-grid .field { margin: 0; }
.mt-grid .mt-wide { grid-column: 1 / -1; }
.mt-seg { gap: 12px; font-size: 12.5px; }
.mt-seg { flex-wrap: wrap; align-items: center; min-height: var(--ctl-h-md); }
.field .mt-seg label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 500; color: var(--text); }
.mt-danger { color: var(--red); }
.mt-import { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; resize: vertical; }
.mt-import-res { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.mt-import-res ul { margin: 4px 0 0 18px; max-height: 140px; overflow: auto; }
.mt-hist { max-height: 340px; overflow: auto; }
.mt-hist td { vertical-align: top; }
.mt-table-card { padding: 0; overflow: hidden; }
.mt-table-wrap { overflow-x: auto; position: relative; }
.mt-table th:first-child, .mt-table td:first-child { padding-left: 16px; }
.mt-table th:last-child, .mt-table td:last-child { padding-right: 16px; }
.mt-table th.num, .mt-table td.num { text-align: right; }
.mt-table td { vertical-align: middle; }
.mt-table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; }
.mt-table tr.muted td { color: var(--text-3); }
.mt-table .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-fleet { font-size: 11.5px; }
.mt-acts { white-space: nowrap; text-align: right; }
.mt-acts > * + * { margin-left: 4px; }
.mt-more { padding: 10px 16px; font-size: 12.5px; }
.mt-empty { padding: 36px 20px; }
.mt-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mt-card-hd { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 10px; }
/* One grid for the whole chart, the rows on its lines (subgrid): with a grid
   per row, "Rp 800.000" took less room than "Rp 19.600.000" and every track
   ended somewhere else. */
.mt-bars { display: grid; grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) auto; gap: 8px 10px; }
.mt-bar-row { grid-column: 1 / -1; grid-template-columns: subgrid; }
.mt-card-hd-row { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; margin-bottom: 6px; }
.mt-card-foot { padding: 0 16px 12px; margin: 6px 0 0; }
.mt-remind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; margin: 4px 0 2px; }
.mt-remind input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); }
.mt-remind input[type="number"] { width: 92px; height: var(--ctl-h-sm, 30px); padding: 0 8px; }
.sa-maint { margin-top: 8px; }
.sa-maint label { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--text); }
.sa-maint select { width: 100%; max-width: 460px; }
.mt-kpis { margin: 0; }
.mt-kpis .uc-num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .mt-split { grid-template-columns: minmax(0, 1fr); }
  .mt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-kpis .uc-num { font-size: 17px; }
  .mt-q { max-width: none; }
  .mt-table thead { display: none; }
  .mt-table, .mt-table tbody, .mt-table tfoot, .mt-table tr, .mt-table td { display: block; width: auto; }
  .mt-table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .mt-table td, .mt-table th:first-child, .mt-table td:first-child, .mt-table td:last-child { border: 0; padding: 2px 0; }
  .mt-table td[data-l] { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
  .mt-table td[data-l]::before { content: attr(data-l); color: var(--text-3); font-size: 11.5px; }
  .mt-table td[data-l] > .mt-fleet { grid-column: 2; }
  .mt-table td[data-l] > .uc-badge { justify-self: start; }
  .mt-table td.num { text-align: left; }
  .mt-table .mt-acts { text-align: left; padding-top: 6px; }
  .mt-table tfoot td:empty { display: none; }
}

/* ---- B3 waste transport (js/src/b3.js) ----
   The B3 badge on a trip, New trip's "B3 load" row, and the B3 papers list:
   one row per truck or person, its papers as number + last valid day. */
.trip-b3 { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber-text); margin-left: 4px; }
.trip-b3-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.trip-b3-row .follow-toggle { margin: 0; }
#tripCrewHint.b3-warn { color: var(--amber-text); }

.b3-body .cp-intro { margin-top: 0; }
.b3-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.b3-tabs { flex: 0 0 auto; }
.b3-search { flex: 1 1 200px; min-width: 0; height: var(--ctl-h-md); box-sizing: border-box; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font-size: 13px; outline: none; transition: border-color .15s; }
.b3-search:focus { border-color: var(--primary); }
.b3-sum { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; }
.b3-sum:empty { display: none; }
.b3-st { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.b3-st.ok { background: var(--green-soft); color: var(--green); }
.b3-st.warn { background: var(--amber-soft); color: var(--amber-text); }
.b3-st.bad { background: var(--red-soft); color: var(--red); }
.b3-st.none { background: var(--gray-soft); color: var(--text-2); }
.b3-row { display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 10px 16px;
  padding: 12px 0; border-top: 1px solid var(--border); }
.b3-row:first-child { border-top: 0; }
.b3-who { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.b3-who b { overflow-wrap: anywhere; }
.b3-who small { font-size: 12px; }
.b3-docs { display: grid; gap: 8px; min-width: 0; }
.b3-doc { display: grid; grid-template-columns: 130px minmax(0, 1fr) 150px; gap: 8px; align-items: center; }
.b3-doc-name { font-size: 12px; font-weight: 600; color: var(--text-2); cursor: help; }
.b3-doc input { font: inherit; font-size: 13px; height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 8px; min-width: 0; width: 100%;
  border: 1px solid var(--border); border-radius: 7px; background: var(--card); color: var(--text); }
.b3-doc input:focus { outline: none; border-color: var(--brand); }
.b3-empty { padding: 12px 0; margin: 0; }
.b3-pager:empty { display: none; }
.b3-foot { margin: 10px 0 0; }
@media (max-width: 640px) {
  .b3-row { grid-template-columns: minmax(0, 1fr); }
  .b3-doc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .b3-doc-name { grid-column: 1 / -1; }
}

/* People › Drivers › Reminders (driverlist.js): which dates, how far ahead,
   above the contacts picker the Service due notice uses. */
.dr-remind { margin: 0 0 12px; }
.dr-rem-intro { margin: 2px 0 8px; font-size: 13px; }
.dr-rem-docs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; }
.dr-rem-docs label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.dr-rem-days { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0 0 12px; }
.dr-rem-days input { width: 72px; height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 8px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--card); color: var(--text); }

/* ---- Language switch (I18N.md): header, beside Guide, and the login screen ---- */
.lang-switch { display: flex; border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden; }
.lang-switch button {
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  padding: 0 8px; height: calc(var(--ctl-h-md) - 2px); color: var(--text-3); background: none; line-height: 1;
  transition: background .15s, color .15s;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active { background: var(--primary); color: #fff; }
.login-lang { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: #8b847d; }
.login-lang button { background: none; border: 0; padding: 2px 0; font: inherit; color: inherit; cursor: pointer; }
.login-lang button:hover { text-decoration: underline; }
.login-lang button.active { color: var(--primary); font-weight: 700; }
.user-menu-lang { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; font-size: 12.5px; color: var(--text-2); }
.user-menu-lang .lang-switch button { height: 24px; }
/* A phone's header has no room: the switch lives in the account menu (More ▸ account). */
@media (max-width: 600px) { .ctx-right > .lang-switch { display: none; } }

/* ---- Delivery orders & trip money (js/src/dofinance.js) ----
   New / Edit trip: shipper + load on a stop, freight + term in New trip; the
   trip's road money under the planned km. Trip page: the DO panel (table,
   totals, road money spent). Trips toolbar: Receivables. */
.stop-details .sd-do { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
.stop-details .sd-money { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 7px; }
.stop-details .sd-money label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.stop-details .sd-hint { grid-column: 1 / -1; font-size: 11.5px; margin-top: -2px; }
.stop-details .sd-hint[hidden] { display: none; }
.stop-details input.bad, .td-do input.bad, #tripRoadMoney.bad, .td-exp-add input.bad { border-color: var(--red); }
@media (max-width: 520px) { .stop-details .sd-do, .stop-details .sd-money { grid-template-columns: minmax(0, 1fr); } }
.road-money-row { display: flex; gap: 8px; }
.road-money-row #tripRoadMoney { flex: 1 1 150px; min-width: 0; }
.road-money-row #tripRoadMoneyNote { flex: 2 1 180px; min-width: 0; }
@media (max-width: 520px) { .road-money-row { flex-direction: column; } }

.tc-do { color: var(--text-2); }
.tdo-do { font-size: 12.5px; margin: 2px 0 4px; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tdo-do b { color: var(--text); font-weight: 600; }
.tdo-do-k { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px;
  background: color-mix(in srgb, #2563eb 13%, transparent); color: #1d4ed8; }
[data-theme="dark"] .tdo-do-k { background: color-mix(in srgb, #60a5fa 18%, transparent); color: #93c5fd; }

.td-do { margin: 0 2px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
.td-do > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer;
  padding: 8px 10px; font-size: 13px; font-weight: 700; color: var(--text); list-style: none; }
.td-do > summary::-webkit-details-marker { display: none; }
.td-do > summary > span::before { content: "▸"; display: inline-block; width: 14px; color: var(--text-3); transition: transform .15s; }
.td-do[open] > summary > span::before { transform: rotate(90deg); }
.td-do[open] > summary { border-bottom: 1px solid var(--border); }
.td-do-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); }
.td-do-sum > span { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--card); min-width: 0; }
.td-do-sum small { font-size: 11px; color: var(--text-3); font-weight: 600; }
.td-do-sum b { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-do-sum b.neg { color: var(--red); }
.td-do-sum b.pos { color: var(--green); }
.td-do-note { font-size: 12px; padding: 6px 10px 0; }
.td-do-road { display: flex; gap: 8px; padding: 10px 10px 0; flex-wrap: wrap; }
.td-do-road label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--text-2); flex: 0 1 180px; min-width: 0; }
.td-do-road label.grow { flex: 1 1 220px; }
.td-do-scroll { overflow-x: auto; padding: 4px 10px 8px; }
.td-do-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.td-do-table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 6px 8px 6px 0; white-space: nowrap; border-bottom: 1px solid var(--border); }
.td-do-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.td-do-table tr:last-child td { border-bottom: 0; }
.td-do-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-do-table .tdd-stop { white-space: nowrap; font-weight: 700; }
.td-do-table .tdd-stop small { display: block; font-weight: 400; color: var(--text-3); font-size: 11px; }
.td-do-table .tdd-pay { white-space: nowrap; }
.td-do-table.editing td { padding-right: 6px; }
.td-do input, .td-exp-add input { font: inherit; font-size: 12.5px; height: var(--ctl-h-sm); box-sizing: border-box; padding: 0 8px;
  width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); outline: none; }
.td-do input:focus, .td-exp-add input:focus { border-color: var(--primary); }
.td-do-table .tdd-freight { min-width: 110px; text-align: right; }
.td-do-table .tdd-days { min-width: 64px; }
.td-do-table .tdd-shipper, .td-do-table .tdd-cargo { min-width: 140px; }
.td-do-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 10px 10px; }
.pay-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pay-chip.paid { background: var(--green-soft); color: var(--green); }
.pay-chip.due { background: var(--gray-soft); color: var(--text-2); }
.pay-chip.pending { background: var(--gray-soft); color: var(--text-3); }
.pay-chip.overdue { background: var(--red-soft); color: var(--red); }
.pay-chip.void { background: var(--gray-soft); color: var(--text-3); text-decoration: line-through; }

.td-exp { border-top: 1px solid var(--border); padding: 8px 10px 10px; }
.td-exp-head { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.td-exp-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.td-exp-list li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.td-exp-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.td-exp-line { display: flex; justify-content: space-between; gap: 10px; }
.td-exp-kind { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.td-exp-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-exp-note { color: var(--text-2); overflow-wrap: anywhere; }
.td-exp-by { font-size: 11.5px; }
.td-exp-photo img { width: var(--ctl-h-sm); height: var(--ctl-h-sm); object-fit: cover; border-radius: 5px; border: 1px solid var(--border); display: block; }
.td-exp-del { color: var(--text-3); }
.td-exp-empty { font-size: 12px; margin-bottom: 8px; }
.td-exp-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.td-exp-add select { flex: 1 1 130px; min-width: 0; }
.td-exp-add #tdExpAmount { flex: 1 1 120px; width: auto; }
.td-exp-add #tdExpNote { flex: 1 1 100%; width: auto; }
.td-exp-add .td-exp-photo-btn { flex: 0 0 auto; }
.td-exp-add #tdExpAdd { flex: 1 0 auto; }
.td-exp-add select { height: var(--ctl-h-sm); box-sizing: border-box; }
.td-exp-photo-btn { height: var(--ctl-h-sm); padding: 0 10px; display: inline-flex; align-items: center; }
.td-exp-photo-btn.on { border-color: var(--green); background: var(--green-soft); }

#receivablesModal .modal-body { min-height: 240px; }
.rec-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.rec-tot { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); min-width: 0; }
.rec-tot small { font-size: 11px; font-weight: 600; color: var(--text-3); }
.rec-tot b { font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rec-tot.overdue b { color: var(--red); }
.rec-tabs { margin: 0 0 10px; }
.rec-scroll { overflow-x: auto; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rec-table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rec-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rec-table td small { display: block; color: var(--text-3); font-size: 11px; }
.rec-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec-table .rec-ck { width: 28px; padding-right: 0; }
.rec-table .rec-trip { white-space: nowrap; }
.rec-group td { background: var(--surface-2); font-size: 12.5px; }
.rec-group td span { margin-left: 10px; color: var(--text-2); }
.rec-row.overdue td:nth-child(6) { color: var(--red); font-weight: 600; }
#receivablesModal footer { flex-wrap: wrap; }
.rec-sel { margin-right: auto; font-size: 12.5px; }
.rec-paid-on { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.rec-paid-on[hidden] { display: none; }
.rec-paid-on input { height: var(--ctl-h-md); box-sizing: border-box; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit; font-size: 12.5px; }
@media (max-width: 640px) {
  .rec-totals { gap: 6px; }
  .rec-tot { padding: 6px 8px; }
  .rec-tot small { font-size: 10.5px; }
  .rec-tot b { font-size: 12.5px; }
  .rec-sel { width: 100%; }
}

.report-table tr.rep-pay-overdue td { background: color-mix(in srgb, var(--red) 9%, transparent); }
.report-table tr.rep-do-waiting td { color: var(--text-3); font-style: italic; }
.report-table tr.rep-margin-loss td { background: color-mix(in srgb, var(--red) 9%, transparent); }

/* A Custom login without the live map (state.pastMapOnly, html.past-map):
   the map opens only for History and a report's places, so nothing on it
   says where a vehicle is NOW — no vehicle list, no vehicle marker (the
   playback draws its own), no vehicle panel, no shared trucks, and no
   "This vehicle live" or "All vehicles" in the playback bar. */
.past-map #sidebar, .past-map #sidebarCollapse, .past-map #detailPanel, .past-map #toolSharedLive,
.past-map label:has(> #pbShowSelf), .past-map label:has(> #pbShowAll) { display: none !important; }
.past-map #map .v-marker, .past-map #map .v-cluster { display: none !important; }
/* A banner's button, left out where the login only reads (driverscoring.js RO):
   no box of its own, so the button sits in the banner as it always did. */
.ds-act-slot { display: contents; }
.ds-elsewhere { margin: 10px 0 0; }

/* A trip's customer and the shares made with it (trips.js, server tripcustomer.js). */
.trip-cust-row { display: flex; gap: 8px; }
.trip-cust-row #tripCustomer { flex: 3 1 180px; min-width: 0; }
.trip-cust-row #tripCustomerUser { flex: 2 1 150px; min-width: 0; }
/* stacked on a phone: each takes its own height, never the row's flex-basis (180px) as one */
@media (max-width: 520px) { .trip-cust-row { flex-direction: column; } .trip-cust-row #tripCustomer, .trip-cust-row #tripCustomerUser { flex: none; } }
.trip-share-field { display: flex; flex-direction: column; gap: 6px; }
.trip-share-field[hidden], .trip-share-part[hidden] { display: none; }
/* its heading reads as the trip form's field labels do; the share form inside keeps the trip page's look */
.trip-share-hd { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.trip-share-field .tsf { margin: 0; }
.trip-src-cust { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, #0d9488 14%, transparent); color: #0f766e; margin-left: 4px; }
[data-theme="dark"] .trip-src-cust { background: color-mix(in srgb, #2dd4bf 16%, transparent); color: #5eead4; }
.td-route-k.cust { background: color-mix(in srgb, #0d9488 14%, transparent); color: #0f766e; }
[data-theme="dark"] .td-route-k.cust { background: color-mix(in srgb, #2dd4bf 16%, transparent); color: #5eead4; }
/* A customer's own trip order on a shared truck: the owner's parts of a trip
   step aside — crew, B3, road plan, route, km, money, its customer and
   shares, Optimise, and saving a place into the owner's list. */
#tripModal.cust-mode #tripB3Field, #tripModal.cust-mode #tripCrew, #tripModal.cust-mode #tripPlanField,
#tripModal.cust-mode #tripRouteField, #tripModal.cust-mode #tripPlannedKmField, #tripModal.cust-mode #tripRoadMoneyField,
#tripModal.cust-mode #tripCustomerField, #tripModal.cust-mode #tripShareField, #tripModal.cust-mode #orderOptimizeBtn,
#tripModal.cust-mode #tripAssignAlt, #tripModal.cust-mode .oe-save { display: none !important; }
.shared-card-acts { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.sd-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; font-size: 12.5px; }

/* Geofence ▸ Apply to old data (js/src/visitapply.js). The account owner's
   control only: a sub-account has no stored visits of its own. */
.is-sub .visits-apply-open { display: none !important; }
/* The period and OK stay in reach on a short screen: the text scrolls, the
   buttons do not. */
#visitApplyModal { max-width: 540px; }
#visitApplyModal.open { display: flex; flex-direction: column; overflow: hidden; }
#visitApplyModal .va-body { gap: 12px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.va-sub { margin: 0; font-weight: 600; font-size: 13px; }
.va-none, .va-note { margin: 0; font-size: 12.5px; color: var(--text-2); }
.va-changes { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 190px; overflow: auto; }
/* What changed and its kind on top, the name under it (a long name or a
   rename "A → B" needs the whole width, on a phone most of all), then when. */
.va-changes li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "what kind" "name name" "at at";
  gap: 1px 10px; padding: 7px 10px; font-size: 12.5px; border-top: 1px solid var(--border); }
.va-changes li:first-child { border-top: 0; }
.va-what { grid-area: what; color: var(--text-2); }
.va-name { grid-area: name; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.va-kind { grid-area: kind; color: var(--text-3); }
.va-at { grid-area: at; color: var(--text-3); font-size: 11.5px; }
.va-changes li.va-more { display: block; color: var(--text-2); }
.va-days { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.field label.va-day { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer;
  text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text); }
.va-warn { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber-text);
  font-size: 12.5px; line-height: 1.45; }
.va-run { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--primary-soft); font-size: 12.5px; }
.va-bar { height: 6px; margin-top: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.va-bar i { display: block; height: 100%; background: var(--primary); transition: width .4s; }
.va-last { font-size: 12.5px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 10px; }
.va-last .btn-link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline; }
/* Driver Scoring › Vehicles and › Customers (js/src/dsperf.js). */
.dsp-toolbar .dsp-date { height: var(--ctl-h-md); padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel, var(--bg)); color: var(--text); font: inherit; font-size: 13px; }
.dsp-table th.dsp-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.dsp-table th.dsp-sort.on { color: var(--text); }
.dsp-table td.num, .dsp-table th.num { text-align: right; white-space: nowrap; }
/* Its cards: the heading and the note sit inside the card's padding (the table runs edge to edge, as the scorecard's) */
.dsp-card { margin-bottom: 16px; }
.dsp-card > .ds-h { padding: 14px 16px 10px; margin: 0; flex-wrap: wrap; row-gap: 2px; }
.dsp-card > .dsp-note { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
.dsp-range { display: inline-flex; align-items: center; gap: 6px; }
.dsp-note { font-size: 12px; line-height: 1.5; }
.dsp-note span + span::before { content: " · "; }
@media (max-width: 600px) {
  .dsp-toolbar > .select-inline, .dsp-toolbar > .dsp-range { flex: 1 1 100%; }
  .dsp-range .dsp-date { flex: 1 1 0; min-width: 0; }
  .dsp-toolbar .ds-spacer { display: none; }
}
.dsp-toolbar .select-inline { width: auto; margin: 0; min-width: 130px; }

/* Found by the whole-app sweep (28 Nov). */
/* Requirements: its two cards apart, as every other stack of cards */
#dsRequirements > .card + .card { margin-top: 16px; }
/* Maintenance › Due: a state and a plate stay on one line (the pill broke in two, each half with its own background) */
tr[class^="mt-row-"] .uc-badge, tr[class^="mt-row-"] > td:first-child > b { white-space: nowrap; }
/* Dark theme: the browser's own controls (checkboxes, date pickers, scrollbars) drawn dark too — checkboxes stayed white */
[data-theme="dark"] { color-scheme: dark; }
/* Booking: a plate stays on one line — two lines made the label cell taller than the lane beside it (phone) */
.bk-veh-plate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .bk-veh { padding: 10px 8px; } }
/* Multi-view: "Layout" / "Zoom" labels never break in two beside their controls */
.mv-tb-label { white-space: nowrap; }


/* ---------- White-label (js/brand.js) ----------
   html.wl is set in <head> on any host that is not ours: every Vamos mark is
   hidden from the first paint, and the customer's logo and/or name — or
   nothing, when they want no logo — is drawn into the [data-wl-slot] beside
   it. The store QR codes go too: they install an app called Vamos GPS. */
html.wl .login-logo-img,
html.wl .rail-brand-v,
html.wl .rail-brand-name,
html.wl .login-apps { display: none !important; }
.wl-slot[hidden] { display: none !important; }
.wl-slot-login { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 8px; max-width: 100%; }
.wl-slot-login .wl-logo { max-height: 68px; max-width: min(320px, 100%); width: auto; height: auto; object-fit: contain; }
.wl-slot-login .wl-name { color: #fff; font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; text-align: right; overflow-wrap: anywhere; }
.wl-slot-rail { display: flex; flex-direction: column; align-items: center; gap: 3px; max-width: 100%; }
.wl-slot-rail .wl-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 7px; }
.wl-slot-rail .wl-name { font-size: 11px; font-weight: 800; color: var(--text); letter-spacing: .01em; line-height: 1.2; text-align: center; max-width: 64px; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .wl-slot-login { justify-content: flex-start; }
  .wl-slot-login .wl-name { text-align: left; }
}
