/* The portal's shared interface layer (2026-10-16): shell, navigation,
   page headers, KPI tiles, cards, tables, forms, drawers, tabs, badges,
   and the motion system. Built on style.css's brand tokens.

   The owner's taste, in their words: futuristic and interactive like
   Apple or Tesla, "no over shadowing or hollow effects", smooth
   transitions, micro-interactions, parallax, responsive on any phone.
   So: flat surfaces and hairline borders; motion that explains (things
   arrive in order, numbers count up, the page slides between views),
   short and eased, and none at all with "reduce motion". */

:root {
  --page-max: 1600px;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms;
  --t: 260ms;
  --t-slow: 520ms;
  --ring: 0 0 0 3px rgba(238, 52, 39, 0.18);
  /* Old names kept so nothing breaks; they are the status tokens in style.css (one palette). */
  --g: var(--ok); --a: var(--warning); --r: var(--critical);
  --blue: #2f6fdb; --violet: #5b5bd6;
}
[data-theme="dark"] { --ring: 0 0 0 3px rgba(252, 211, 10, 0.22); }

/* ---------- page transitions (Chrome, Edge, Safari 18+) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: ui-fade-out 160ms var(--ease) both; }
::view-transition-new(root) { animation: ui-fade-in 260ms var(--ease-out) both; }
@keyframes ui-fade-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes ui-fade-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- navigation ---------- */
.topbar { gap: 16px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a, .nav-menu > button {
  position: relative; margin: 0; padding: 8px 12px; border-radius: 999px; border: 0; background: none;
  color: var(--muted); font: 600 14px var(--font-body); text-decoration: none; cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.topnav a:hover, .nav-menu > button:hover { color: var(--text); background: var(--panel-2); }
.topnav a.is-current { color: var(--text); background: var(--panel-2); }
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; background: var(--brick-red); color: #fff; font: 700 11px var(--font-body); vertical-align: 1px; }
.nav-menu { position: relative; }
.nav-menu > button::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; vertical-align: 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.nav-menu-list { position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; padding: 6px; display: grid; gap: 2px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top left;
  visibility: hidden; pointer-events: none; transition: opacity var(--t-fast) var(--ease), transform var(--t) var(--ease-out); z-index: 40; }
.nav-menu.is-open .nav-menu-list { visibility: inherit; opacity: 1; transform: none; pointer-events: auto; }
.nav-menu-list a { display: grid; gap: 1px; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav-menu-list a small { color: var(--muted); font-weight: 500; font-size: 12px; }
.nav-menu-list a:hover { background: var(--panel-2); }
.nav-toggle { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); cursor: pointer; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after { display: block; width: 16px; height: 1.5px; margin: auto;
  background: currentColor; position: relative; transition: transform var(--t) var(--ease-out); }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -5px; } .nav-toggle span::after { top: 5px; }
@media (max-width: 1080px) {
  .nav-toggle { display: grid; place-items: center; order: 3; }
  .topnav { position: fixed; inset: 61px 0 auto 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 16px 18px;
    background: var(--panel); border-bottom: 1px solid var(--border); transform: translateY(-8px); visibility: hidden; opacity: 0; pointer-events: none;
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out); max-height: calc(100vh - 61px); overflow: auto; z-index: 30; }
  body.nav-open .topnav { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }
  .topnav a, .nav-menu > button { padding: 12px 14px; border-radius: 10px; font-size: 16px; text-align: left; }
  .nav-menu-list { position: static; opacity: 1; transform: none; pointer-events: auto; box-shadow: none; border: 0; padding: 0 0 0 10px; display: none; }
  .nav-menu.is-open .nav-menu-list { display: grid; }
  .user-menu a:not(:first-of-type) { display: none; }
}

/* ---------- page ---------- */
.ui-page { max-width: var(--page-max); margin: 0 auto; padding: 22px 32px 64px; display: grid; gap: 18px; }
@media (max-width: 760px) { .ui-page { padding: 16px 16px 48px; gap: 14px; } }
.ui-head { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px;
  padding: 6px 0 4px; }
.ui-eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font: 700 11px var(--font-body);
  letter-spacing: 0.08em; text-transform: uppercase; }
.ui-title { margin: 4px 0 0; font: 700 clamp(26px, 3.2vw, 38px)/1.08 var(--font-display); letter-spacing: -0.02em; }
.ui-sub { margin: 8px 0 0; max-width: 70ch; color: var(--muted); font-size: 15px; line-height: 1.5; }
.ui-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* A soft brand glow behind the page title that drifts with scrolling
   (parallax): colour, never a shadow on content. */
.ui-head::before { content: ""; position: absolute; z-index: -1; right: 6%; top: -60px; width: 420px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(252, 211, 10, 0.20), transparent);
  transform: translate3d(0, calc(var(--scroll, 0) * 0.25px), 0); pointer-events: none; }
[data-theme="dark"] .ui-head::before { background: radial-gradient(closest-side, rgba(238, 52, 39, 0.16), transparent); }

/* ---------- tabs ---------- */
.ui-tabs { position: relative; display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); }
.ui-tabs a, .ui-tabs button { position: relative; z-index: 1; padding: 8px 16px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font: 700 13px var(--font-body); text-decoration: none; cursor: pointer; transition: color var(--t-fast) var(--ease); }
.ui-tabs a:hover, .ui-tabs button:hover { color: var(--text); }
.ui-tabs [aria-current="page"], .ui-tabs [aria-selected="true"] { color: var(--text); }
.ui-tabs .ui-tab-ink { position: absolute; z-index: 0; top: 4px; bottom: 4px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--border); transition: left var(--t) var(--ease-out), width var(--t) var(--ease-out); }

/* ---------- KPI tiles ---------- */
.ui-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ui-kpi { position: relative; overflow: hidden; display: grid; gap: 6px; align-content: start; min-height: 116px; padding: 16px 18px;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); color: var(--text); text-decoration: none;
  transition: transform var(--t) var(--ease-out), border-color var(--t-fast) var(--ease); }
a.ui-kpi:hover, button.ui-kpi:hover { transform: translateY(-2px); border-color: var(--muted); }
.ui-kpi::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity var(--t) var(--ease);
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(252, 211, 10, 0.12), transparent 60%); }
.ui-kpi:hover::after { opacity: 1; }
.ui-kpi-label { color: var(--muted); font: 700 12px var(--font-body); letter-spacing: 0.02em; }
.ui-kpi-value { font: 700 30px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ui-kpi-value small { margin-left: 4px; font: 600 13px var(--font-body); color: var(--muted); letter-spacing: 0; }
.ui-kpi-sub { color: var(--muted); font-size: 12px; }
.ui-kpi[data-state]::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; }
.ui-kpi[data-state="g"]::before { background: var(--g); }
.ui-kpi[data-state="a"]::before { background: var(--a); }
.ui-kpi[data-state="r"]::before { background: var(--r); }
.ui-kpi.is-solid { color: #fff; border-color: transparent; }
.ui-kpi.is-solid .ui-kpi-label, .ui-kpi.is-solid .ui-kpi-sub, .ui-kpi.is-solid .ui-kpi-value small { color: rgba(255, 255, 255, 0.82); }

/* ---------- cards ---------- */
.ui-grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.ui-grid > .span-12 { grid-column: span 12; } .ui-grid > .span-8 { grid-column: span 8; } .ui-grid > .span-7 { grid-column: span 7; }
.ui-grid > .span-6 { grid-column: span 6; } .ui-grid > .span-5 { grid-column: span 5; } .ui-grid > .span-4 { grid-column: span 4; }
@media (max-width: 1100px) { .ui-grid > [class*="span-"] { grid-column: span 12; } }
.ui-card { min-width: 0; display: grid; gap: 12px; align-content: start; padding: 18px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); }
.ui-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.ui-card-head h2, .ui-card h2 { margin: 0; font: 700 16px var(--font-body); text-transform: none; letter-spacing: 0; color: var(--text); }
.ui-card-head .hint { color: var(--muted); font-size: 13px; }
.ui-empty { margin: 6px 0; color: var(--muted); }

/* ---------- tables ---------- */
.ui-table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; -webkit-overflow-scrolling: touch; }
.ui-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ui-table th { position: sticky; top: 0; padding: 10px 12px; text-align: left; white-space: nowrap; background: var(--panel);
  color: var(--muted); font: 700 11px var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.ui-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ui-table tbody tr { transition: background var(--t-fast) var(--ease); }
.ui-table tbody tr:hover { background: var(--panel-2); }
.ui-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table .mono { font: 600 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.ui-table .strong { font-weight: 700; }
.ui-table tr.is-retired td { color: var(--muted); }
.ui-table a { color: var(--text); }

/* ---------- badges ---------- */
.ui-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font: 700 11px var(--font-body);
  letter-spacing: 0.02em; white-space: nowrap; border: 1px solid transparent; }
.ui-badge.ok { background: var(--ok-bg); color: var(--ok); }
.ui-badge.warn { background: var(--warning-bg); color: var(--warning); }
.ui-badge.crit { background: var(--critical-bg); color: var(--critical); }
.ui-badge.info { background: var(--info-bg); color: var(--info); }
.ui-badge.muted { background: var(--panel-2); color: var(--muted); border-color: var(--border); }
.ui-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }

/* ---------- buttons and forms ---------- */
.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); text-decoration: none;
  font: 700 13px var(--font-body); cursor: pointer; transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
  border-color var(--t-fast) var(--ease); }
.ui-btn:hover { border-color: var(--muted); }
.ui-btn:active { transform: scale(0.97); }
.ui-btn.primary { background: var(--text); color: var(--panel); border-color: var(--text); }
.ui-btn.primary:hover { opacity: 0.9; }
.ui-btn.danger { color: var(--critical); }
.ui-btn.small { min-height: 30px; padding: 0 12px; font-size: 12px; }
.ui-btn:focus-visible, .ui-input:focus-visible, .ui-select:focus-visible { outline: none; box-shadow: var(--ring); }
.ui-form { display: grid; gap: 14px; }
.ui-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.ui-field { display: grid; gap: 6px; }
.ui-field > span { color: var(--muted); font: 700 11px var(--font-body); letter-spacing: 0.05em; text-transform: uppercase; }
.ui-input, .ui-select, .ui-field textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel); color: var(--text); font: 500 14px var(--font-body);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.ui-input:hover, .ui-select:hover { border-color: var(--muted); }
.ui-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.ui-error { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--critical-bg); color: var(--critical); font-weight: 600; }
.ui-note { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.ui-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.ui-search { min-width: 220px; }

/* ---------- drawer (add / edit forms slide in) ---------- */
.ui-drawer { position: fixed; z-index: 2000; inset: 0; display: grid; justify-items: end; pointer-events: none; }
.ui-drawer::before { content: ""; position: absolute; inset: 0; background: rgba(15, 17, 19, 0.28); opacity: 0;
  transition: opacity var(--t) var(--ease); }
.ui-drawer-panel { position: relative; width: min(520px, 100vw); height: 100%; overflow: auto; padding: 22px 24px 28px;
  background: var(--panel); border-left: 1px solid var(--border); transform: translateX(24px); opacity: 0;
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t) var(--ease); display: grid; align-content: start; gap: 16px; }
.ui-drawer.is-open { pointer-events: auto; }
.ui-drawer.is-open::before { opacity: 1; }
.ui-drawer.is-open .ui-drawer-panel { transform: none; opacity: 1; }
.ui-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ui-drawer-head h2 { margin: 0; font: 700 20px var(--font-display); }

/* ---------- charts made of HTML ---------- */
.ui-bars { display: grid; gap: 8px; }
.ui-bar { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.ui-bar-track { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.ui-bar-fill { height: 100%; width: var(--w, 0%); border-radius: 999px; background: var(--text);
  transform-origin: left; animation: ui-grow var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes ui-grow { from { transform: scaleX(0); } }
.ui-heat { display: grid; gap: 3px; font-size: 12px; overflow-x: auto; }
.ui-heat-row { display: grid; grid-template-columns: 120px repeat(var(--n), minmax(22px, 1fr)); gap: 3px; align-items: center; }
.ui-heat-cell { height: 26px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: 11px;
  background: color-mix(in srgb, var(--brick-red) calc(var(--v, 0) * 100%), var(--panel-2));
  color: var(--text); transition: transform var(--t-fast) var(--ease); }
.ui-heat-cell[data-v="0"] { color: transparent; }
.ui-heat-cell:hover { transform: scale(1.12); }
.ui-heat-cell.hot { color: #fff; }
.ui-spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.ui-spark span { flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; background: var(--text); opacity: 0.85;
  height: var(--h, 2%); transform-origin: bottom; animation: ui-rise var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 25ms); }
@keyframes ui-rise { from { transform: scaleY(0); } }

/* ---------- reveal on scroll (ui.js adds .is-in) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(10px); transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 55ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal].is-settled { transition-delay: 0s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .ui-head::before { transform: none; }
}

/* ---------- driver shift grid ---------- */
.shift-grid td.shift-slot { padding: 4px; text-align: center; }
.shift-btn { width: 100%; min-width: 54px; height: 32px; border-radius: 8px; border: 1px dashed var(--border); background: none;
  color: var(--muted); font: 700 12px var(--font-body); cursor: pointer; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.shift-btn:hover { border-color: var(--muted); color: var(--text); transform: translateY(-1px); }
.shift-slot.is-filled .shift-btn { border-style: solid; background: var(--ok-bg); border-color: transparent; color: var(--ok); }

/* ---------- locations page ---------- */
.loc-map-wrap { position: relative; }
.loc-map { height: min(62vh, 620px); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.loc-draw { position: absolute; z-index: 1001; left: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); font-size: 13px; max-width: calc(100% - 80px); }
.loc-shape { margin: 0; color: var(--muted); font-size: 13px; }
/* The location form sits beside the map without a backdrop, so the map
   stays clickable while drawing. */
.loc-drawer::before { display: none; }
.loc-drawer.is-open { pointer-events: none; }
.loc-drawer .ui-drawer-panel { pointer-events: auto; width: min(440px, 100vw); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.06); }
@media (min-width: 1100px) { body:has(.loc-drawer.is-open) .loc-mapcard { margin-right: 440px; transition: margin var(--t-slow) var(--ease-out); } }

/* ---------- report builder ---------- */
.rb-form { align-content: start; position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; }
@media (max-width: 1100px) { .rb-form { position: static; max-height: none; } }
.rb-reports { display: grid; gap: 6px; }
.rb-report { display: grid; gap: 2px; padding: 10px 12px 10px 34px; position: relative; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.rb-report:hover { border-color: var(--muted); }
.rb-report.is-on { border-color: var(--text); background: var(--panel-2); }
.rb-report input { position: absolute; left: 12px; top: 12px; }
.rb-report b { font-size: 14px; } .rb-report small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.rb-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; }
.rb-checks .ui-check { font-weight: 500; font-size: 13px; }
.rb-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rb-preview { max-height: 70vh; }
.rb-preview td { white-space: nowrap; font-size: 13px; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; flex-wrap: nowrap; }
  .user-menu { gap: 10px; }
  .user-menu > a { display: none; }
  .nav-toggle { order: 0; flex: none; }
  .topnav { inset: 57px 0 auto 0; }
  /* Tables marked .is-stack become one card per row. */
  .ui-table.is-stack thead { display: none; }
  .ui-table.is-stack, .ui-table.is-stack tbody, .ui-table.is-stack tr, .ui-table.is-stack td { display: block; width: 100%; }
  .ui-table.is-stack tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .ui-table.is-stack td { border: 0; padding: 3px 0; text-align: left; }
  .ui-table.is-stack td.num { text-align: left; }
  .ui-table.is-stack td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 92px; color: var(--muted);
    font: 700 11px var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; }
  .ui-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-kpi { min-height: 96px; padding: 12px 14px; }
  .ui-kpi-value { font-size: 24px; }
}

/* ---------- large monitors: use the width, scale type a little ---------- */
@media (min-width: 1800px) { :root { --page-max: min(92vw, 2200px); } }
@media (min-width: 2200px) {
  body { font-size: 17px; }
  .ui-kpi-value { font-size: 34px; }
  .ui-table { font-size: 15px; }
  .topnav a, .nav-menu > button { font-size: 15px; }
}

.vm-no { font: 700 16px var(--font-display); letter-spacing: 0.02em; text-decoration: none; }
.vm-note { color: var(--a); font-weight: 600; }

/* alerts queue: inline actions */
.aq-inline { display: inline-flex; gap: 6px; align-items: center; margin: 4px 0 0; }
.aq-select { min-height: 30px; padding: 2px 8px; font-size: 12px; width: auto; max-width: 150px; }
.aq-table td { vertical-align: top; }

/* ---------- data quality ---------- */
.dq { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font: 700 12px var(--font-body); white-space: nowrap; }
.dq-good, i.dq-good { background: var(--ok-bg); color: var(--ok); }
.dq-fair, i.dq-fair { background: var(--warning-bg); color: var(--warning); }
.dq-poor, i.dq-poor { background: var(--critical-bg); color: var(--critical); }
.dq-head { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.dq-head .dq { font-size: 15px; padding: 4px 12px; }
.dq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; margin-top: 10px; }
.dq-day { display: grid; justify-items: center; gap: 3px; font-size: 12px; }
.dq-day small { color: var(--muted); }
.dq-bar { width: 24px; height: 64px; border-radius: 6px; background: var(--panel-2); display: flex; align-items: flex-end; overflow: hidden; }
.dq-bar i { display: block; width: 100%; border-radius: 6px; transform-origin: bottom; animation: ui-rise var(--t-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms); }
i.dq-good { background: var(--g); } i.dq-fair { background: var(--a); } i.dq-poor { background: var(--r); }

/* ---------- fitter tickets ---------- */
.tk-list { display: grid; gap: 12px; }
.tk-ticket { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px;
  transition: border-color var(--t-fast) var(--ease); }
.tk-ticket:hover { border-color: var(--muted); }
.tk-ticket header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tk-facts { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tk-facts b { color: var(--text); }
.tk-ticket details summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.tk-ticket ol, .tk-history { margin: 6px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }

/* ---------- alert pages ---------- */
.ad-status { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.ad-small { margin: 0; color: var(--muted); font-size: 12px; }
.ad-who { margin: 0; line-height: 1.7; }
.ad-close { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.ad-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.ad-facts th { width: 40%; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--muted); position: static; }
.ad-map { height: 340px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.ah-filters .ui-fields { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.chart-legend { display: inline-flex; gap: 12px; font-size: 12px; color: var(--muted); }

/* ---------- map credits (owner, 16 Oct: the map watermark) ----------
   The OpenStreetMap licence needs the credit visible, so it stays, as a
   small "i" in the corner; pointing at it shows the full text. */
.maplibregl-ctrl-attrib.maplibregl-compact { min-height: 22px; min-width: 22px; padding: 0 !important; margin: 0 6px 6px 0 !important;
  background: color-mix(in srgb, var(--panel) 80%, transparent) !important; border: 1px solid var(--border); }
.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner { display: none; }
.maplibregl-ctrl-attrib.maplibregl-compact:hover, .maplibregl-ctrl-attrib.maplibregl-compact:focus-within { padding: 2px 28px 2px 8px !important; }
.maplibregl-ctrl-attrib.maplibregl-compact:hover .maplibregl-ctrl-attrib-inner,
.maplibregl-ctrl-attrib.maplibregl-compact:focus-within .maplibregl-ctrl-attrib-inner { display: block; font-size: 10px; color: var(--muted); }
.maplibregl-ctrl-attrib-button { width: 22px !important; height: 22px !important; background-size: 16px !important; opacity: 0.55; }
:root[data-theme="dark"] .maplibregl-ctrl-attrib-button { filter: invert(1); }
.leaflet-control-attribution.leaflet-control { font-size: 9px; line-height: 1.4; opacity: 0.5; padding: 0 5px; background: color-mix(in srgb, var(--panel) 70%, transparent) !important; }
.leaflet-control-attribution.leaflet-control:hover { opacity: 1; }

/* ---------- journey replay: player and telemetry panel (truck page and live map) ---------- */
/* Replay player, under the route map */
.tk-rp { display: grid; gap: 8px; padding-top: 10px; }
.tk-rp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.tk-rp-buttons { display: flex; align-items: center; gap: 6px; }
.tk-rp-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer; transition: border-color 120ms, background 120ms, transform 120ms; }
.tk-rp-btn:hover { border-color: var(--muted); }
.tk-rp-btn:active { transform: scale(0.94); }
.tk-rp-btn:disabled { opacity: 0.4; cursor: default; }
.tk-rp-btn svg { width: 15px; height: 15px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
#tk-rp-start svg path { stroke-width: 2; }
.tk-rp-play { width: 44px; height: 44px; background: var(--text); color: var(--panel); border-color: var(--text); }
.tk-rp-play:hover { border-color: var(--text); }
.tk-rp-play svg { width: 18px; height: 18px; }
.tk-rp-play .i-pause, .tk-rp.is-playing .tk-rp-play .i-play { display: none; }
.tk-rp.is-playing .tk-rp-play .i-pause { display: block; }
.tk-rp-now { display: grid; min-width: 180px; flex: 1; }
.tk-rp-now b { font: 700 15px var(--font-body); font-variant-numeric: tabular-nums; }
.tk-rp-now span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tk-rp-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12px; color: var(--muted); }
.tk-rp-speed { display: inline-flex; align-items: center; gap: 6px; }
.tk-rp-range { display: inline-flex; align-items: center; gap: 6px; }
.tk-rp-range input { font: 600 12px var(--font-body); color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px; }
.tk-rp-speed select { font: 600 13px var(--font-body); color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px; }
.tk-rp-check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.tk-rp-check input { accent-color: var(--tk-speed); }
.tk-rp-bar { position: relative; height: 22px; }
.tk-rp-track { position: absolute; left: 0; right: 0; top: 8px; height: 6px; border-radius: 999px; background: var(--panel-2); }
.tk-rp-bar input { position: absolute; inset: 0; width: 100%; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.tk-rp-bar input::-webkit-slider-runnable-track { height: 22px; background: none; }
.tk-rp-bar input::-moz-range-track { height: 22px; background: none; }
.tk-rp-bar input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--text); transition: transform 120ms; }
.tk-rp-bar input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--text); }
.tk-rp-bar input:active::-webkit-slider-thumb { transform: scale(1.2); }
.tk-rp-bar input:focus-visible { outline: 2px solid var(--tk-speed); outline-offset: 2px; border-radius: 999px; }
.tk-rp-ends { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tk-rp-key { display: inline-flex; align-items: center; gap: 5px; }
.tk-rp-key i { width: 14px; height: 4px; border-radius: 999px; background: var(--tk-speed); }
.tk-rp.is-empty .tk-rp-bar, .tk-rp.is-empty .tk-rp-ends { opacity: 0.4; }
@media (max-width: 640px) {
  .tk-rp-now { order: 3; flex-basis: 100%; }
  .tk-rp-opts { gap: 6px 12px; }
}

/* Telemetry on the map, top right (owner, 16 Oct: "play the telematics
   ... on right top corner in both minimised & maximised versions"). */
.tk-hud { position: absolute; top: 10px; right: 10px; z-index: 2; width: 206px; display: grid; gap: 6px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 93%, transparent);
  font-size: 12px; color: var(--muted); pointer-events: none; }
.tk-hud-time { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tk-hud-speed { display: flex; align-items: baseline; gap: 5px; }
.tk-hud-speed b { font: 700 30px/1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tk-hud-state { margin-left: auto; align-self: center; font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; transition: background 200ms, color 200ms; }
.tk-hud-state.is-moving { background: #2f6fdb; color: #fff; }
.tk-hud-state.is-idle { background: #c4870d; color: #fff; }
.tk-hud-bar { height: 4px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.tk-hud-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--tk-speed); transition: width 160ms linear; }
.tk-hud-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
.tk-hud-grid dd { margin: 0; text-align: right; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-hud-note { font-size: 11px; font-weight: 600; color: var(--text); background: var(--panel-2); border-radius: 8px; padding: 4px 8px; }
.tk-hud-note.is-on { animation: ui-fade-in 220ms var(--ease-out) both; }
@media (max-width: 640px) {
  .tk-hud { width: 150px; padding: 8px 10px; }
  .tk-mapcard:not(.is-max) .tk-hud-grid { display: none; }
}



/* Map tool rail (ui.js ADMapNav): pan / select, the arrows with "back to
   the truck" in their middle, whole route; the edge marker; the zoom box. */
.ad-nav { display: grid; gap: 6px; justify-items: start; }
.ad-nav-tools, .ad-nav-pad, .ad-nav-whole { background: #fff; border-radius: 8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1); }
.ad-nav-tools { display: grid; grid-template-columns: 30px 30px; gap: 2px; padding: 2px; }
.ad-nav button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: #1c2333; cursor: pointer; }
.ad-nav button:hover { background: #f0f2f6; }
.ad-nav button:focus-visible { outline: 2px solid #ee3427; outline-offset: 1px; }
.ad-nav-tools button[aria-pressed="true"] { background: #1c2333; color: #fff; }
.ad-nav-pad { display: grid; grid-template-columns: repeat(3, 26px); grid-template-rows: repeat(3, 26px); padding: 2px; }
.ad-nav-pad button { width: 26px; height: 26px; }
.ad-nav-pad .u { grid-area: 1 / 2; } .ad-nav-pad .l { grid-area: 2 / 1; } .ad-nav-pad .ad-nav-home { grid-area: 2 / 2; }
.ad-nav-pad .r { grid-area: 2 / 3; } .ad-nav-pad .d { grid-area: 3 / 2; }
.ad-nav-pad .l svg { transform: rotate(-90deg); } .ad-nav-pad .r svg { transform: rotate(90deg); } .ad-nav-pad .d svg { transform: rotate(180deg); }
.ad-nav .ad-nav-whole { width: 30px; height: 30px; background: #fff; }
.ad-nav svg, .ad-nav-edge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ad-nav svg .f { fill: currentColor; stroke-width: 1; }
.ad-nav-home .dot { fill: none; stroke: none; }
.ad-nav-home.is-following { color: #ee3427; }
.ad-nav-home.is-following .dot { fill: currentColor; }
.ad-nav-select .maplibregl-canvas-container.maplibregl-interactive, .ad-nav-select .maplibregl-canvas { cursor: default; }
.ad-nav-box { position: absolute; z-index: 4; border: 1.5px dashed #ee3427; background: rgba(238, 52, 39, 0.08); pointer-events: none; }
.ad-nav-edge { position: absolute; z-index: 4; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px; border: 0; border-radius: 999px; background: #1c2333; color: #fff; cursor: pointer;
  font: 600 12px var(--font-body); white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22); }
.ad-nav-edge i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #ee3427; }
.ad-nav-edge i svg { width: 14px; height: 14px; stroke-width: 2.2; }
.ad-nav-edge[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) { .ad-nav button { transition: background 120ms ease, color 120ms ease; } }

/* A traffic signal where a truck waits (ui.js ADSignal), red lit. */
.ad-signal { width: 16px; height: 44px; cursor: help; }
.ad-signal svg { display: block; width: 16px; height: 44px; }
.ad-signal .pole { fill: #5b6474; }
.ad-signal .box { fill: #1c2333; stroke: #0e131d; stroke-width: 1; }
.ad-signal .red { fill: #ff3b30; }
.ad-signal .off { fill: #3a4252; }

/* Company signature, shared across the portal. */
.brand-logo { display: block; width: 142px; height: auto; flex-shrink: 0; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 12px 18px;
  border-radius: 8px; background: var(--text); color: var(--panel); transform: translateY(-180%); }
.skip-link:focus { transform: none; outline: 2px solid var(--accent); outline-offset: 3px; }

/* Keep closed navigation out of keyboard focus and make live status legible. */
.nav-menu-list { visibility: hidden; }
.nav-menu.is-open .nav-menu-list { visibility: visible; }
body.drawer-open { overflow: hidden; }
.ui-btn:focus-visible, .topnav a:focus-visible, .nav-menu > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.feed-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.feed-state::before { content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.feed-state.is-connected { color: var(--ok); }
.feed-state.is-delayed { color: var(--warning); }
.dataset-what { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.error-page { max-width: 800px; padding-top: 64px; }
@media (max-width: 1080px) {
  .topnav { visibility: hidden; }
  .nav-open .topnav { visibility: visible; }
  body:not(.nav-open) .topnav .nav-menu-list { visibility: hidden; }
}

/* Truck markers scale with map zoom (web/marker-scale.ts sets --fm-scale on each map).
   Leaflet icon boxes keep their nominal size, so centre the scaled truck inside. */
.fl-divicon, .tk-flat-truck { display: flex; align-items: center; justify-content: center; overflow: visible; }
.fl-truck, .fm-truck, .tk-truck-marker { transition: width .18s ease-out, height .18s ease-out; }
@media (prefers-reduced-motion: reduce) { .fl-truck, .fm-truck, .tk-truck-marker { transition: none; } }

/* ===== Truck stops on any map (stops.ts): live map truck panel and truck page: duration pin, card with in/out and engine ===== */
/* The marker element is 0 x 0 and never transformed (MapLibre positions it with transform);
   the inner part scales with the zoom (--vp-stop-s) and grows on hover. The tail tip is the place. */
.vp-stopmk { display: block; width: 0; height: 0; padding: 0; border: 0; background: none; overflow: visible; cursor: pointer; font: inherit; --stop: #475569; }
.vp-stopmk[hidden] { display: none; }
.vp-stopmk.is-idle { --stop: #c27c06; }
.vp-stopmk.is-now { --stop: #1f56d6; }
.vp-stopmk-in { position: absolute; left: 0; bottom: 0; display: grid; justify-items: center; transform: translateX(-50%) scale(var(--vp-stop-s, 1));
  transform-origin: 50% 100%; transition: transform 120ms ease; }
.vp-stopmk-pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 6px; border-radius: 999px; background: var(--stop); color: #fff;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(15, 23, 42, .35); font: 700 11.5px/1 var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vp-stopmk-ico { width: 7px; height: 8px; border: solid #fff; border-width: 0 2px; opacity: .9; }
/* A short stem down to a dot whose centre is the exact stop place. */
.vp-stopmk-tip { position: relative; width: 2px; height: 9px; background: #fff; box-shadow: 0 0 2px rgba(15, 23, 42, .45); }
.vp-stopmk-tip::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; box-sizing: border-box; transform: translateX(-50%);
  border-radius: 50%; background: var(--stop); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .4); }
.vp-stopmk:hover, .vp-stopmk.open, .vp-stopmk:focus-visible { z-index: 5; }
.vp-stopmk:hover .vp-stopmk-in, .vp-stopmk.open .vp-stopmk-in, .vp-stopmk:focus-visible .vp-stopmk-in { transform: translateX(-50%) scale(calc(var(--vp-stop-s, 1) * 1.1)); }
.vp-stopmk:focus-visible { outline: none; }
.vp-stopmk:focus-visible .vp-stopmk-pill { outline: 2px solid #2f6fdb; outline-offset: 2px; }
.vp-stopmk.open .vp-stopmk-pill { box-shadow: 0 0 0 4px color-mix(in srgb, var(--stop) 30%, transparent), 0 2px 6px rgba(15, 23, 42, .35); }
.vp-stopcard { display: none; position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; min-width: 190px; max-width: 250px;
  padding: 10px 12px; border-radius: 11px; background: var(--panel); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .22); text-align: left; font: 500 12.5px/1.4 var(--font-body); white-space: normal; cursor: default; }
.vp-stopmk:hover .vp-stopcard, .vp-stopmk.open .vp-stopcard { display: grid; gap: 7px; }
.vp-stopcard-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vp-stopcard-h b { font: 700 13.5px/1.25 var(--font-display); }
.vp-stopcard-chip { flex: none; font: 700 10.5px/1 var(--font-body); font-style: normal; padding: 4px 7px; border-radius: 999px; color: #475569; background: #47556918; }
.vp-stopcard-chip.is-idle { color: #9a6205; background: #c27c061f; }
.vp-stopcard-chip.is-now { color: #1f56d6; background: #1f56d61a; }
.vp-stopcard-times { display: flex; align-items: center; gap: 10px; padding: 6px 9px; border-radius: 8px; background: color-mix(in srgb, var(--text) 4%, var(--panel)); }
.vp-stopcard-times > span { display: grid; gap: 1px; }
.vp-stopcard-times small { color: var(--muted); font: 600 10.5px var(--font-body); text-transform: uppercase; letter-spacing: .04em; }
.vp-stopcard-times strong { font: 700 15px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.vp-stopcard-arrow { color: var(--muted); font-style: normal; }
.vp-stopcard-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; }
.vp-stopcard-bar i { min-width: 4px; } .vp-stopcard-bar .is-off { background: #64748b; } .vp-stopcard-bar .is-idle { background: #e59a0f; } .vp-stopcard-bar .is-unk { background: color-mix(in srgb, var(--text) 15%, transparent); }
.vp-stopcard-eng { color: var(--muted); font-size: 12px; }
.vp-stopcard-place { color: var(--text); font-weight: 600; padding-top: 6px; border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
@media (prefers-reduced-motion: reduce) { .vp-stopmk-in { transition: none; } }

/* Phones (5 Nov 2026): tab strips stay one row and scroll sideways instead of wrapping into
   a lumpy two-row pill (Alerts centre: Queue · Oversight · Fitter tickets · Rules · ...). */
@media (max-width: 600px) {
  .ui-tabs { display: flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .ui-tabs::-webkit-scrollbar { display: none; }
  .ui-tabs a, .ui-tabs button { flex: none; white-space: nowrap; padding: 8px 13px; }
}

/* Reports (5 Nov 2026): dates in one bar at the top; compact report list; preview header. */
.rb-shell { display: grid; gap: 18px; min-width: 0; }
.rb-datebar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 22px; padding: 14px 18px; position: sticky; top: 8px; z-index: 6; }
.rb-dates { display: flex; align-items: flex-end; gap: 10px; }
.rb-date { display: grid; gap: 4px; color: var(--muted); font: 700 11px var(--font-body); text-transform: uppercase; letter-spacing: .05em; }
.rb-date .ui-input { width: 160px; min-height: 40px; font-size: 14px; text-transform: none; letter-spacing: normal; font-weight: 600; color: var(--text); }
.rb-to { color: var(--muted); padding-bottom: 10px; }
.rb-datebar .rb-presets { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 3px; }
.rb-preset { min-height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font: 600 13px var(--font-body); cursor: pointer; white-space: nowrap; }
.rb-preset:hover { color: var(--text); border-color: var(--muted); }
.rb-preset[aria-pressed="true"] { background: var(--text); color: var(--panel); border-color: var(--text); }
.rb-preset:focus-visible { outline: 2px solid #2f6fdb; outline-offset: 2px; }
.rb-range { margin: 0 0 0 auto; padding-bottom: 8px; font: 700 15px var(--font-display); color: var(--text); white-space: nowrap; }
.rb-range span { color: var(--muted); font: 600 13px var(--font-body); }
.rb-report { padding: 9px 12px 9px 34px; }
.rb-report input { top: 10px; }
.rb-report.is-on small { margin-top: 2px; }
.rb-form { top: 100px; max-height: calc(100vh - 116px); }
.rb-result { min-width: 0; align-content: start; }
.rb-result-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 18px; }
.rb-result-head h2 { margin: 0 0 8px; font: 700 20px var(--font-display); color: var(--text); text-transform: none; letter-spacing: normal; }
.rb-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.rb-facts span { padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--muted); font-size: 12.5px; }
.rb-facts b { color: var(--text); font-variant-numeric: tabular-nums; }
.rb-dl { margin: 0; }
.rb-preview { max-width: 100%; overflow: auto; }
.rb-preview thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.rb-preview tbody tr:hover td { background: color-mix(in srgb, var(--text) 3%, transparent); }
.rb-more { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }
.rb-empty { display: grid; gap: 4px; place-items: center; padding: 48px 16px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); text-align: center; font-size: 14px; }
.rb-empty b { color: var(--text); font: 700 16px var(--font-display); }
@media (max-width: 1100px) { .rb-datebar { position: static; } .rb-form { top: auto; max-height: none; } }
@media (max-width: 640px) {
  .rb-datebar { padding: 12px; } .rb-dates { width: 100%; } .rb-date { flex: 1 1 0; min-width: 0; } .rb-date .ui-input { width: 100%; }
  .rb-range { margin-left: 0; white-space: normal; } .rb-datebar .rb-presets { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
}
/* Result lights in report previews (side-tank fills check): green / red / amber / grey. */
.rb-light { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.rb-light::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.rb-light.is-good { color: #067647; background: #ecfdf3; } .rb-light.is-bad { color: #b42318; background: #fef3f2; }
.rb-light.is-warn { color: #b54708; background: #fffaeb; } .rb-light.is-none { color: #667085; background: color-mix(in srgb, var(--text) 6%, transparent); }
:root[data-theme="dark"] .rb-light.is-good { color: #75e0a7; background: rgba(23,178,106,.14); } :root[data-theme="dark"] .rb-light.is-bad { color: #fda29b; background: rgba(217,45,32,.14); }
:root[data-theme="dark"] .rb-light.is-warn { color: #fec84b; background: rgba(247,144,9,.14); } :root[data-theme="dark"] .rb-light.is-none { color: #98a2b3; }
/* Report previews: headings may wrap onto two lines and cells sit closer, so more columns fit
   (the side-tank check's Result lights stay in view). */
.rb-preview th { white-space: normal; vertical-align: bottom; min-width: 44px; padding-left: 10px; padding-right: 10px; line-height: 1.3; }
.rb-preview td { padding-left: 10px; padding-right: 10px; }
.rb-more { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.rb-key { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0 0; padding: 10px 12px; list-style: none; border-radius: 10px; background: color-mix(in srgb, var(--text) 3%, transparent); }
.rb-key li { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.rb-key .rb-light { font-size: 11.5px; padding: 2px 8px 2px 7px; }
.rb-why { display: block; margin: 3px 0 0 4px; color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.rb-key { display: grid; gap: 8px; }
.rb-key li { display: block; line-height: 1.6; }
.rb-key li .rb-light { margin-right: 8px; vertical-align: middle; }
.rb-key li b { color: var(--text); }

/* ---------- Light / dark / auto switch (templates/_theme_switch.html, web/page-bootstrap.ts) ---------- */
.theme-switch { position: relative; display: inline-flex; flex: none; }
.topbar > .theme-switch { margin-left: 10px; }
.topbar > .brand ~ .theme-switch { margin-left: auto; }
.theme-switch-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--muted); cursor: pointer; }
.theme-switch-btn:hover, .theme-switch-btn:focus-visible, .theme-switch-btn[aria-expanded="true"] { color: var(--text); border-color: var(--muted); }
.theme-switch-btn svg { width: 16px; height: 16px; }
.theme-switch-btn .ts-ico { display: none; }
.theme-switch-btn[data-theme-choice="auto"] .ts-ico-auto,
.theme-switch-btn[data-theme-choice="light"] .ts-ico-light,
.theme-switch-btn[data-theme-choice="dark"] .ts-ico-dark { display: block; }
.theme-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5500; min-width: 200px; margin: 0; padding: 5px; list-style: none;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); }
.theme-menu[hidden] { display: none; }
.theme-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font: 500 13px var(--font-body, inherit); text-align: left; cursor: pointer; }
.theme-menu button::before { content: ''; width: 14px; flex: none; text-align: center; color: var(--accent); }
.theme-menu button[aria-checked="true"] { font-weight: 700; }
.theme-menu button[aria-checked="true"]::before { content: '\2713'; }
.theme-menu button:hover, .theme-menu button:focus-visible { background: var(--panel-2); outline: none; }
.theme-switch + .user-menu { margin-left: 12px; }

/* ---------- Search from any page (web/search.ts) ---------- */
.gs-open { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--muted); font: 600 13px var(--font-body, inherit); cursor: pointer; }
.gs-open:hover, .gs-open:focus-visible { color: var(--text); border-color: var(--muted); }
.gs-open svg { width: 16px; height: 16px; }
.gs-open kbd { font: 600 11px var(--font-body, inherit); padding: 1px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); }
.gs-open + script + .user-menu { margin-left: 0; }
.gs { position: fixed; inset: 0; z-index: 6000; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(10, 12, 14, 0.45); }
.gs[hidden] { display: none; }
.gs-panel { width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); overflow: hidden; }
.gs-input { width: 100%; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: 500 16px var(--font-body, inherit); outline: none; }
.gs-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.gs-hit { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.gs-list li[aria-selected="true"] .gs-hit { background: var(--panel-2); }
.gs-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.gs-main { display: flex; flex-direction: column; min-width: 0; }
.gs-main b, .gs-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-main small { color: var(--muted); font-size: 12px; }
.gs-hint { margin: 0; padding: 9px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
@media (max-width: 640px) { .gs-open span, .gs-open kbd { display: none; } .gs-open { padding: 8px; } .gs { padding-top: 8vh; } .gs-hit { grid-template-columns: 72px 1fr; } }

/* ---------- New-alert notice (web/live-nav.ts) ---------- */
.nav-toast { position: fixed; right: 16px; bottom: 16px; z-index: 5500; display: flex; align-items: flex-start; gap: 8px; max-width: min(380px, calc(100vw - 32px));
  padding: 12px 12px 12px 14px; border-radius: 14px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--warning);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22); }
.nav-toast.is-critical { border-left-color: var(--critical); }
.nav-toast a { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; font-size: 13px; min-width: 0; }
.nav-toast a span { color: var(--muted); }
.nav-toast button { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }

/* ---------- Role table on the account page ---------- */
.role-table { margin-top: 12px; }
.role-table summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.role-table .data-table { margin-top: 10px; }
.role-table .data-table th, .role-table .data-table td { padding: 8px 10px; }
.role-yes { color: var(--ok); font-weight: 700; text-align: center; }
.role-no { color: var(--muted); text-align: center; }
/* Screen-reader-only text for every page (was only in truck.css, so the Admin page showed it). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* Comfortable tap targets on phones. */
@media (max-width: 640px) { .ui-btn.small, .tk-seg, .tk-step, .att-chip { min-height: 44px; } }

/* Contacts and store facts on the order page. */
.order-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px; }
.order-calls { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.order-call { display: grid; gap: 2px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); color: var(--text); text-decoration: none; min-width: 0; }
.order-call span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-call strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.order-call small { font-size: 11px; color: var(--muted); }
.order-call:hover, .order-call:focus-visible { border-color: var(--muted); }
.order-mail { margin: 8px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.order-facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; margin: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.order-facts dt { color: var(--muted); font-size: 13px; }
.order-facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
/* Order page: lookup box, summary, GPS vs data entry (owner, 16 Nov). Theme tokens only. */
.od-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.od-find { display: flex; align-items: center; gap: 8px; min-width: 0; }
.od-find label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.od-find input { width: 150px; max-width: 40vw; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.od-find input:focus-visible { outline: 2px solid var(--info, var(--muted)); outline-offset: 1px; }
.od-h { margin: 0 0 12px; }
.od-headrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.od-headrow .od-h { margin: 0; }
.od-summary { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.od-summary .stat-tile { min-height: 92px; padding: 16px 18px; }
.od-summary .stat-tile-value { font-size: 22px; overflow-wrap: anywhere; }
.stat-tile.od-quiet { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.stat-tile.od-quiet .stat-tile-label { color: var(--muted); opacity: 1; }
.stat-tile.od-good .stat-tile-value { color: var(--ok); }
.stat-tile.od-bad .stat-tile-value { color: var(--critical); }
.od-truck a { color: inherit; }
.od-badge { align-self: flex-start; margin-top: 8px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--warning); background: var(--warning-bg); cursor: help; }
.od-badge.is-main { color: var(--ok); background: var(--ok-bg); }
.od-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.od-pill.is-good { color: var(--ok); background: var(--ok-bg); }
.od-pill.is-warn { color: var(--warning); background: var(--warning-bg); }
.od-pill.is-bad { color: var(--critical); background: var(--critical-bg); }
.od-inout th[scope=row] { text-align: left; color: var(--muted); font-weight: 600; white-space: nowrap; }
.od-inout td { font-variant-numeric: tabular-nums; }
.od-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); max-width: 860px; }
.od-entry { grid-template-columns: 130px minmax(0, 1fr); }
.order-facts dd small { color: var(--muted); }
.os-box { display: flex; flex-wrap: wrap; gap: 10px; max-width: 560px; }
.os-box input { flex: 1 1 220px; min-width: 0; min-height: 52px; padding: 10px 16px; font: inherit; font-size: 22px; font-variant-numeric: tabular-nums; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text); }
.os-box .btn { min-height: 52px; }
.os-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; max-width: 560px; }
.os-list a { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); text-decoration: none; }
.os-list a:hover, .os-list a:focus-visible { border-color: var(--muted); }
.os-list small { color: var(--muted); font-size: 12px; }
.os-h { margin-top: 20px; }
