/* haulr. shared stylesheet. Dark-first control-tower dashboard for logistics.
   Cyan accent, Chakra Petch display. Light mode via a manual toggle and the
   system preference. Responsive to ~380px. */

:root {
  /* Dark, default */
  --base: #0B0F14;
  --surface: #121821;
  --surface-2: #1A2230;
  --ink: #E6EDF3;
  --muted: #8B97A6;
  --hairline: rgba(255, 255, 255, .09);
  --hairline-2: rgba(255, 255, 255, .05);

  --primary: #17C3E0;          /* cyan accent */
  --primary-ink: #04222B;      /* text sitting on cyan */
  --green: #2FD48A;            /* on time */
  --amber: #F5A524;            /* delay */
  --red: #FF5A5A;              /* exception */
  --blue: #4A8CFF;             /* in transit */

  --radius: 12px;
  --radius-sm: 8px;
  --gutter: 16px;
  --sidebar-w: 240px;
  --topbar-h: 60px;

  --shadow: 0 1px 0 rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.35);

  --font-display: "Chakra Petch", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Red Hat Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
}

/* Light, either from the toggle (data-theme=light) or the system preference
   when the viewer has not chosen (guarded so an explicit dark choice wins). */
:root[data-theme="light"] {
  --base: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #EDF1F5;
  --ink: #101720;
  --muted: #5A6675;
  --hairline: rgba(16, 23, 32, .10);
  --hairline-2: rgba(16, 23, 32, .06);

  --primary: #0E7C90;
  --primary-ink: #FFFFFF;
  --green: #12915C;
  --amber: #B9760B;
  --red: #D53C3C;
  --blue: #2C63CC;

  --shadow: 0 1px 2px rgba(16,23,32,.06), 0 10px 28px rgba(16,23,32,.10);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --base: #F4F6F8;
    --surface: #FFFFFF;
    --surface-2: #EDF1F5;
    --ink: #101720;
    --muted: #5A6675;
    --hairline: rgba(16, 23, 32, .10);
    --hairline-2: rgba(16, 23, 32, .06);

    --primary: #0E7C90;
    --primary-ink: #FFFFFF;
    --green: #12915C;
    --amber: #B9760B;
    --red: #D53C3C;
    --blue: #2C63CC;

    --shadow: 0 1px 2px rgba(16,23,32,.06), 0 10px 28px rgba(16,23,32,.10);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 0;
  line-height: 1.15;
}

a { color: inherit; text-decoration: none; }

.mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--hairline-2);
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.wordmark .dot { color: var(--primary); }

.company {
  padding: 2px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.company .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}
.company .sub { font-size: 12px; color: var(--muted); }
.chip-plan {
  align-self: flex-start;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 42%, transparent);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 10px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  transition: background .12s ease, color .12s ease;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--ink);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--primary);
}
.nav a[aria-current="page"] svg { color: var(--primary); }
.nav a.muted { opacity: .7; }

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--hairline-2);
  padding-top: 14px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--base) 82%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gutter);
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .spacer { flex: 1; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 13px;
  min-width: 220px;
  color: var(--muted);
}
.searchbox svg { width: 15px; height: 15px; flex: none; }
.searchbox input {
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  width: 100%;
  outline: none;
}
.searchbox input::placeholder { color: var(--muted); }

.shift-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .01em;
  color: var(--ink);
  background: var(--surface);
  white-space: nowrap;
}
.shift-ctl svg { width: 14px; height: 14px; color: var(--muted); }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--red); color: #fff;
  font-family: var(--font-mono); font-size: 9px;
  display: grid; place-items: center;
  border: 2px solid var(--base);
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 26%, var(--surface-2));
  color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--hairline);
}

.hamburger {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  place-items: center;
}
.hamburger svg { width: 19px; height: 19px; }

.content {
  padding: 22px var(--gutter) 60px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-head { margin-bottom: 20px; }
.page-head .eyebrow { display: block; margin-bottom: 7px; }
.page-head h2 { font-size: 26px; font-weight: 700; }
.page-head p { color: var(--muted); margin: 6px 0 0; font-size: 14px; max-width: 62ch; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 12px;
}
.section-head h3 { font-size: 16px; font-weight: 600; }
.section-head .link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .03em;
}
.section-head .link:hover { color: var(--primary); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 16px; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 15px 16px 16px;
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--accent, var(--muted));
  opacity: .85;
}
.kpi.tone-primary { --accent: var(--primary); }
.kpi.tone-blue { --accent: var(--blue); }
.kpi.tone-green { --accent: var(--green); }
.kpi.tone-amber { --accent: var(--amber); }
.kpi .k-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi .k-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.05;
  margin: 10px 0 4px;
  font-variant-numeric: tabular-nums;
}
.kpi .k-note { font-size: 12px; color: var(--muted); }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex: none; }
.pill.st-picked    { color: var(--muted); background: var(--surface-2); border-color: var(--hairline); }
.pill.st-transit   { color: var(--blue); background: color-mix(in srgb, var(--blue) 15%, transparent); border-color: color-mix(in srgb, var(--blue) 36%, transparent); }
.pill.st-out       { color: var(--primary); background: color-mix(in srgb, var(--primary) 15%, transparent); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.pill.st-delivered { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); border-color: color-mix(in srgb, var(--green) 36%, transparent); }
.pill.st-delayed   { color: var(--amber); background: color-mix(in srgb, var(--amber) 15%, transparent); border-color: color-mix(in srgb, var(--amber) 38%, transparent); }
.pill.st-active    { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); border-color: color-mix(in srgb, var(--green) 34%, transparent); }
.pill.st-idle      { color: var(--muted); background: var(--surface-2); border-color: var(--hairline); }
.pill.st-maint     { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); border-color: color-mix(in srgb, var(--red) 34%, transparent); }
.pill.st-ontime    { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); border-color: color-mix(in srgb, var(--green) 34%, transparent); }
.pill.st-behind    { color: var(--amber); background: color-mix(in srgb, var(--amber) 15%, transparent); border-color: color-mix(in srgb, var(--amber) 38%, transparent); }

/* ---------- Filter chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { color: var(--ink); }
.chip .count { color: var(--muted); }
.chip[aria-pressed="true"] {
  color: var(--primary-ink);
  background: var(--primary);
  border-color: var(--primary);
}
.chip[aria-pressed="true"] .count { color: var(--primary-ink); opacity: .8; }

/* ---------- Buttons ---------- */
.btn-mini {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--primary-ink);
  background: var(--primary);
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
.btn-ghost {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--primary) 40%, var(--hairline)); }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
table.data thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
}
table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline-2);
  font-size: 13.5px;
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; }
table.data .idcell { font-family: var(--font-mono); font-size: 12px; color: var(--primary); }
table.data .mono { font-size: 12.5px; }
.lane { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lane .arrow { color: var(--muted); }
.lane .arrow svg { width: 13px; height: 13px; display: block; }
.name-strong { font-weight: 600; }
.muted-cell { color: var(--muted); }
.sub-cell { color: var(--muted); font-size: 12px; }

/* ---------- Overview layout ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  align-items: start;
}
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.chart-card {
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.chart-card .ch-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.chart-card svg { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart-card svg text.ax { font-family: var(--font-mono); font-size: 8.5px; fill: var(--muted); }

/* ---------- Signature tracker board ---------- */
.tracker-board {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background:
    linear-gradient(color-mix(in srgb, var(--primary) 5%, transparent), transparent 120px),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tb-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.tb-head .tb-title { display: flex; align-items: center; gap: 9px; }
.tb-head .tb-title svg { width: 18px; height: 18px; color: var(--primary); }
.tb-head h3 { font-size: 16px; font-weight: 600; }
.tb-legend { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.tb-legend .li { display: inline-flex; align-items: center; gap: 6px; }
.tb-legend .sw { width: 9px; height: 9px; border-radius: 999px; }

.tk-scroll { overflow-x: auto; }
.tk-list { min-width: 720px; }
.tk-row {
  display: grid;
  grid-template-columns: 190px 1fr 168px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline-2);
}
.tk-row:last-child { border-bottom: none; }
.tk-row:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

.tk-lead { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tk-id { font-size: 12.5px; color: var(--primary); font-weight: 500; }
.tk-carrier { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tk-mid { min-width: 0; }
.tk-ends {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 9px;
}
.tk-city { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-city.to { color: var(--muted); text-align: right; }
.tk-city.to::before { content: "to "; font-family: var(--font-mono); font-size: 10px; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }

.tk-line { position: relative; height: 14px; margin: 2px 0; }
.tk-track {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  height: 3px; border-radius: 3px; background: var(--surface-2);
  border: 1px solid var(--hairline-2);
}
.tk-fill {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 3px; border-radius: 3px;
}
.tk-node {
  position: absolute; top: 50%;
  width: 11px; height: 11px; border-radius: 999px;
  transform: translate(-50%, -50%);
  background: var(--nc, var(--surface-2));
  border: 2px solid var(--nr, var(--hairline));
  box-shadow: 0 0 0 3px var(--surface);
}
.tk-node.on { }
.tk-cursor {
  position: absolute; top: 50%;
  width: 9px; height: 9px; border-radius: 999px;
  transform: translate(-50%, -50%);
  background: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 26%, transparent);
}
.tk-cursor.delay { background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 26%, transparent); }
.tk-scan { margin-top: 9px; }
.tk-scan .mono { font-size: 11px; color: var(--muted); }

.tk-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  text-align: right;
}
.tk-eta { font-size: 11.5px; color: var(--ink); }

/* ---------- Fleet status strip (overview) ---------- */
.fleet-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.fs-cell {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 11px 12px;
  border-left: 3px solid var(--fc, var(--muted));
}
.fs-cell .fs-unit { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.fs-cell .fs-driver { font-size: 12px; color: var(--muted); margin: 2px 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Alerts / exceptions list ---------- */
.alerts { display: flex; flex-direction: column; }
.alert-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 13px 4px;
  border-bottom: 1px solid var(--hairline-2);
}
.alert-row:last-child { border-bottom: none; }
.al-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; flex: none;
  color: var(--al, var(--muted));
  background: color-mix(in srgb, var(--al, var(--muted)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--al, var(--muted)) 30%, transparent);
}
.al-mark svg { width: 16px; height: 16px; }
.alert-row.lvl-high { --al: var(--red); }
.alert-row.lvl-med { --al: var(--amber); }
.alert-row.lvl-low { --al: var(--blue); }
.al-body { min-width: 0; }
.al-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.al-code { font-family: var(--font-mono); font-size: 11px; color: var(--primary); }
.al-title { font-weight: 600; font-size: 13.5px; }
.al-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.al-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* ---------- Fleet page cards ---------- */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.unit-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.uc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.uc-ident { display: flex; align-items: center; gap: 11px; }
.uc-badge {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center; flex: none;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--primary);
}
.uc-badge svg { width: 22px; height: 22px; }
.uc-unit { font-family: var(--font-mono); font-weight: 500; font-size: 16px; }
.uc-type { font-size: 12px; color: var(--muted); }
.uc-driver {
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--hairline-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.uc-driver .lab { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.uc-driver .val { font-weight: 600; font-size: 13.5px; }
.uc-job { margin-top: 11px; font-size: 12.5px; color: var(--muted); }
.uc-job strong { color: var(--ink); font-weight: 500; }
.uc-loc { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.uc-loc svg { width: 13px; height: 13px; color: var(--primary); }
.uc-metrics {
  margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--hairline-2);
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end;
}
.fuel-wrap { min-width: 0; }
.fuel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.fuel-top .lab { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fuel-top .lab svg { width: 13px; height: 13px; }
.fuel-top .pct { font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.fuel-bar { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--hairline-2); }
.fuel-bar > span { display: block; height: 100%; border-radius: 5px; }
.odo { text-align: right; }
.odo .lab { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: block; }
.odo .val { font-family: var(--font-mono); font-size: 13px; font-weight: 500; margin-top: 3px; }

/* ---------- Routes page ---------- */
.route-list { display: flex; flex-direction: column; gap: 14px; }
.route-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rc-ident { display: flex; align-items: center; gap: 11px; }
.rc-badge {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--hairline); color: var(--primary);
}
.rc-badge svg { width: 20px; height: 20px; }
.rc-id { font-family: var(--font-mono); font-size: 13px; color: var(--primary); }
.rc-driver { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.rc-sub { font-size: 12px; color: var(--muted); }
.rc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }

.rc-progress { margin: 14px 0 6px; }
.rc-prog-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.rc-prog-top .lab { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rc-prog-top .pct { font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.rc-bar { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--hairline-2); }
.rc-bar > span { display: block; height: 100%; border-radius: 5px; }
.rc-next {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  font-size: 12.5px;
}
.rc-next .lab { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }

/* schematic vertical stop list */
.stops {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline-2);
  display: flex; flex-direction: column;
}
.stop-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  position: relative;
}
.stop-node {
  position: relative; width: 26px; height: 100%; display: flex; align-items: center; justify-content: center;
}
.stop-node::before {
  content: ""; position: absolute; top: -9px; bottom: -9px; left: 50%; transform: translateX(-50%);
  width: 2px; background: var(--hairline);
}
.stop-row:first-child .stop-node::before { top: 50%; }
.stop-row:last-child .stop-node::before { bottom: 50%; }
.stop-dot {
  width: 13px; height: 13px; border-radius: 999px; position: relative; z-index: 1;
  background: var(--surface); border: 2px solid var(--hairline);
}
.stop-row.done .stop-dot { background: var(--green); border-color: var(--green); }
.stop-row.next .stop-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 24%, transparent); }
.stop-row.pending .stop-dot { background: var(--surface); border-color: var(--muted); }
.stop-mid { min-width: 0; }
.stop-place { font-size: 13.5px; font-weight: 500; }
.stop-kind { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.stop-time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-align: right; }
.stop-row.next .stop-time { color: var(--ink); }

/* ---------- Legend ---------- */
.legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-bottom: 16px;
  font-size: 12px; color: var(--muted);
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.legend .item { display: inline-flex; align-items: center; gap: 7px; }
.legend .dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }

/* ---------- Tiles row (shipments / customers summary) ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.tile {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 13px 14px;
}
.tile .t-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tile .t-value { font-family: var(--font-display); font-weight: 700; font-size: 24px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.tile .t-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tile .t-value .u { font-size: 14px; color: var(--muted); font-weight: 500; }

/* on-time mini meter for customer rows */
.meter { display: inline-flex; align-items: center; gap: 8px; }
.meter .bar { width: 62px; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--hairline-2); }
.meter .bar > span { display: block; height: 100%; border-radius: 4px; }
.meter .val { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }

.tier {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--hairline); color: var(--muted);
}
.tier.t-key { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.tier.t-watch { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: color-mix(in srgb, var(--amber) 12%, transparent); }

/* ---------- Footer note ---------- */
.demo-note {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline-2);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.demo-note svg { width: 14px; height: 14px; flex: none; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
  display: flex; align-items: center; gap: 9px;
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 15px; height: 15px; color: var(--primary); }

/* Scrim for mobile nav */
.scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
}
.scrim.show { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 264px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; }
  .searchbox { display: none; }
  .shift-ctl { display: none; }
}

@media (max-width: 460px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 50px; }
  .page-head h2 { font-size: 22px; }
  .kpi .k-value { font-size: 28px; }
  .tb-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (prefers-reduced-motion: no-preference) {
  .kpi, .unit-card, .route-card, .card, .tracker-board { animation: rise .3s ease both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .live-dot { animation: pulse 2.2s ease-in-out infinite; }
  @keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
  .tk-cursor { animation: ping 2.4s ease-in-out infinite; }
  @keyframes ping { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.35); } }
}
