/* Dispatch CRM — highway-signage palette, Overpass type */
:root {
  --asphalt: #0f172a;          /* sidebar */
  --asphalt-2: #1e293b;
  --asphalt-ink: #cbd5e1;
  --sign: #2563eb;             /* brand accent */
  --sign-deep: #1d4ed8;
  --sign-tint: #e8efff;
  --money: #0f8a5f;
  --money-tint: #e3f6ec;
  --paper: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e5e9f0;
  --line-strong: #cfd6e2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --slate: #475569;
  --slate-bg: #eef2f7;
  --focus: #f59e0b;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0b1120;
  --surface: #131c2e;
  --surface-2: #182236;
  --ink: #e5e9f0;
  --muted: #94a3b8;
  --line: #243049;
  --line-strong: #334155;
  --sign: #60a5fa;
  --sign-deep: #3b82f6;
  --sign-tint: #172a4d;
  --money: #4ade80;
  --money-tint: #12301f;
  --amber: #fbbf24;
  --amber-bg: #3a2c0c;
  --red: #f87171;
  --red-bg: #3d1915;
  --blue: #93c5fd;
  --blue-bg: #172b45;
  --slate: #cbd5e1;
  --slate-bg: #243049;
  --asphalt: #070c18;
  --asphalt-2: #131c2e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sign); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #111c33 0%, var(--asphalt) 60%);
  color: var(--asphalt-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 16px 18px; display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 55%, #8b5cf6 100%);
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .02em; box-shadow: 0 6px 16px rgba(59, 130, 246, .35);
}
.brand b { display: block; color: #fff; font-size: 15px; font-weight: 800; line-height: 1.15; }
.brand small { display: block; color: #7f8ea6; font-size: 12px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.nav a {
  color: var(--asphalt-ink); padding: 9px 12px; border-radius: 9px;
  font-weight: 500; display: flex; align-items: center; gap: 11px; position: relative;
}
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(59, 130, 246, .18); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #60a5fa; }
.nav a.active svg { color: #93c5fd; opacity: 1; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.side-foot { padding: 14px 16px 16px; font-size: 12px; border-top: 1px solid rgba(255, 255, 255, .08); color: #8a98ae; }
.side-foot .me { display: flex; align-items: center; gap: 10px; }
.side-foot b { color: #fff; display: block; font-size: 13px; }
.side-foot .row { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.side-foot button { background: rgba(255, 255, 255, .06); border: 0; color: #c3cede; padding: 5px 9px; border-radius: 6px; font: inherit; font-size: 12px; cursor: pointer; }
.side-foot button:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 28px 14px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 22px; font-weight: 800; margin-right: auto; }
.topbar .crumb { color: var(--muted); font-weight: 600; font-size: 14px; margin-right: 8px; }
.menu-btn { display: none; }
.content { padding: 22px 28px 60px; max-width: 1500px; width: 100%; }

/* ---------- controls ---------- */
.btn {
  font: inherit; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px 7px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--sign); border-color: var(--sign); color: #fff; }
.btn.primary:hover { background: var(--sign-deep); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 10px 4px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 7px 10px 6px; width: 100%; min-height: 36px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sign); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sign) 25%, transparent); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.field > span { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; min-height: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { max-width: 280px; }
.filters select, .filters input[type=date] { width: auto; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  padding: 5px 11px 3px; border-radius: 999px;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ---------- panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel > header { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 10px; }
.panel > header h2 { font-size: 15px; font-weight: 800; }
.panel > header .aside { margin-left: auto; font-size: 13px; color: var(--muted); }
.panel .empty { padding: 18px 16px 22px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px 8px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); white-space: nowrap; border-top: 0; border-bottom: 1px solid var(--line); }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: var(--surface-2); }
td .sub { display: block; color: var(--muted); font-size: 12px; }
tfoot td { font-weight: 800; border-top: 2px solid var(--line-strong); }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

/* KPI strip — reads like a mileage board, one band not cards */
.board {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px;
}
.board > div { padding: 14px 18px 12px; border-left: 1px solid var(--line); }
.board > div:first-child { border-left: 0; }
.board.five { grid-template-columns: repeat(5, 1fr); }
.board .net { background: var(--sign-tint); border-radius: 0 8px 8px 0; }
.board .net .v { color: var(--sign); }
:root[data-theme="dark"] .board .net .v { color: #6fd3ad; }
.board .v { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.board .k { color: var(--muted); font-size: 13px; font-weight: 600; }

.range { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* status pills */
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px 1px; border-radius: 999px;
  background: var(--slate-bg); color: var(--slate); white-space: nowrap;
}
.pill.booked { background: var(--slate-bg); color: var(--slate); }
.pill.dispatched { background: var(--blue-bg); color: var(--blue); }
.pill.in_transit { background: var(--amber-bg); color: var(--amber); }
.pill.delivered, .pill.paid, .pill.active { background: var(--sign-tint); color: var(--sign); }
.pill.cancelled, .pill.void, .pill.inactive { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.pill.sent { background: var(--blue-bg); color: var(--blue); }
.pill.overdue, .pill.dnu { background: var(--red-bg); color: var(--red); }
.pill.on_hold { background: var(--amber-bg); color: var(--amber); }
:root[data-theme="dark"] .pill.delivered, :root[data-theme="dark"] .pill.paid, :root[data-theme="dark"] .pill.active { color: #6fd3ad; }

.warn { color: var(--amber); font-weight: 700; }
.bad { color: var(--red); font-weight: 700; }

/* ---------- the route sign ---------- */
.sign {
  background: var(--sign); color: #fff; border-radius: 12px; padding: 4px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.sign-inner {
  border: 2px solid #fff; border-radius: 9px; padding: 18px 22px 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center;
}
.sign .end .lbl { font-size: 13px; font-weight: 600; opacity: .8; }
.sign .city { font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: -.01em; }
.sign .city small { font-size: 18px; font-weight: 700; opacity: .85; margin-left: 4px; }
.sign .when { font-size: 14px; font-weight: 600; margin-top: 4px; }
.sign .end.to { text-align: right; }
.sign .mid { text-align: center; }
.sign .mid svg { width: 64px; height: 30px; display: block; margin: 0 auto 2px; }
.sign .miles { font-size: 20px; font-weight: 800; }
.sign .miles small { font-size: 13px; font-weight: 600; opacity: .85; display: block; }

/* status road */
.road { display: flex; margin: 16px 0 4px; }
.road .stop {
  flex: 1; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted);
  padding-top: 18px; position: relative;
}
.road .stop::before {
  content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 4px; background: var(--line);
}
.road .stop::after {
  content: ""; position: absolute; top: 2px; left: calc(50% - 6px); width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--line-strong);
}
.road .stop.done::before { background: var(--sign); }
.road .stop.done::after { border-color: var(--sign); background: var(--sign); }
.road .stop.now { color: var(--ink); }
.road .stop.now::after { border-color: var(--sign); background: var(--surface); box-shadow: 0 0 0 4px var(--sign-tint); }
.road .stop:first-child::before { left: 50%; }
.road .stop:last-child::before { right: 50%; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0; }
.facts > div { padding: 10px 16px 9px; border-top: 1px solid var(--line); }
.facts dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 700; word-break: break-word; }
.notes { white-space: pre-wrap; padding: 4px 16px 16px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.split { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.split > :last-child { margin-left: auto; }
.stack > * + * { margin-top: 16px; }

.files { list-style: none; margin: 0; padding: 0 16px 8px; }
.files li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.files .tag { font-size: 11px; font-weight: 800; background: var(--slate-bg); color: var(--slate); border-radius: 4px; padding: 2px 6px 1px; }
.files a { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop { margin: 0 16px 16px; border: 2px dashed var(--line-strong); border-radius: 8px; padding: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drop.over { border-color: var(--sign); background: var(--sign-tint); }
.drop select { width: auto; }

.log { list-style: none; margin: 0; padding: 0 16px 14px; font-size: 13px; }
.log li { padding: 6px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log time { color: var(--muted); display: block; font-size: 12px; }

/* ---------- modal ---------- */
dialog {
  border: 0; border-radius: 10px; padding: 0; width: min(760px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(20, 24, 27, .55); }
dialog form > header { padding: 18px 22px 6px; display: flex; align-items: center; }
dialog form > header h2 { font-size: 18px; font-weight: 800; margin-right: auto; }
dialog .body { padding: 10px 22px 6px; max-height: calc(100vh - 190px); overflow-y: auto; }
dialog footer { padding: 14px 22px 18px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; border-top: 1px solid var(--line); margin-top: 10px; }
dialog footer .calc { margin-right: auto; color: var(--muted); font-size: 13px; }
dialog footer .calc b { color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px 14px; }
.form-grid .c1 { grid-column: span 1; } .form-grid .c2 { grid-column: span 2; } .form-grid .c3 { grid-column: span 3; }
.form-grid .c4 { grid-column: span 4; } .form-grid .c6 { grid-column: span 6; }
.form-grid .group { grid-column: span 6; font-weight: 800; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.form-grid .group:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-error { color: var(--red); font-weight: 700; padding: 0 22px; }

/* toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: 10px 18px 9px; border-radius: 8px; font-weight: 700;
  z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.err { background: var(--red); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--asphalt); }
.login form { width: min(380px, 100%); }
.login .sign-inner { display: block; padding: 26px 26px 24px; }
.login h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login .logo { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px;
  background: rgba(255, 255, 255, .16); color: #fff; font-weight: 800; font-size: 17px; }
.login { background: radial-gradient(1200px 600px at 20% 0%, #1e3a8a 0%, transparent 60%), var(--asphalt); }
.login .sign { background: linear-gradient(140deg, #1d4ed8 0%, #4f46e5 100%); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.login .sign-inner { border-color: rgba(255, 255, 255, .25); border-radius: 14px; }
.login p { margin: 4px 0 20px; opacity: .85; }
.login label { display: block; font-weight: 700; margin-bottom: 12px; }
.login input { margin-top: 4px; border-color: transparent; background: #fff; color: #1b1f23; }
.login .btn { width: 100%; margin-top: 6px; background: #fff; color: var(--sign-deep); border-color: #fff; }
.login .err { background: rgba(0,0,0,.25); padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; font-weight: 700; }

/* ---------- invoice (also printable) ---------- */
.invoice { background: #fff; color: #1b1f23; padding: 34px 38px; border: 1px solid var(--line); border-radius: 8px; }
.invoice .head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.invoice h2 { font-size: 26px; font-weight: 800; color: var(--sign); }
.invoice .meta { text-align: right; }
.invoice .meta div { margin-bottom: 2px; }
.invoice table th { background: #f3f5f4; color: #5b646c; }
.invoice table td, .invoice table th { border-color: #dde2e0; }
.invoice .total { text-align: right; font-size: 20px; font-weight: 800; margin-top: 14px; }
.statement .adj { margin-top: 16px; padding-top: 12px; border-top: 1px solid #dde2e0; display: grid; gap: 8px; }
.statement .adj-row { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; }
.statement .adj-row input { background: #fff; color: #1b1f23; }
.statement .adj-row input[name=amt] { text-align: right; -moz-appearance: textfield; }
.statement .adj-row input[name=amt]::-webkit-inner-spin-button { -webkit-appearance: none; }
@media print { .statement .adj-row input { border: 0; padding: 0; min-height: 0; box-shadow: none; } .statement .adj-row input:placeholder-shown { display: none; } }
.invoice .pay { margin-top: 22px; padding-top: 14px; border-top: 1px solid #dde2e0; white-space: pre-wrap; color: #5b646c; }

@media print {
  .sidebar, .topbar, .no-print, .toast { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
  .invoice { border: 0; padding: 0; }
}

/* ---------- responsive ---------- */
/* ---------- refresh: cards, KPI tiles, tables ---------- */
.topbar { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); }
.topbar h1 { font-weight: 800; letter-spacing: -.02em; }
.panel { border-color: var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.panel > header { padding: 16px 18px 12px; }
.panel > header h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.btn { border-radius: 9px; font-weight: 600; }
.btn.primary { box-shadow: 0 4px 12px color-mix(in srgb, var(--sign) 30%, transparent); }
.chip { padding: 6px 13px 5px; font-weight: 600; }
.chip.on { background: var(--sign); border-color: var(--sign); color: #fff; }
input, select, textarea { border-radius: 9px; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
th, td { padding: 10px 14px 9px; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
tbody tr:nth-child(even):hover td, tbody tr:hover td { background: var(--sign-tint); }
.pill { padding: 3px 9px 2px; font-weight: 600; }
.pill.delivered, .pill.paid, .pill.active { background: var(--money-tint); color: var(--money); }
:root[data-theme="dark"] .pill.delivered, :root[data-theme="dark"] .pill.paid, :root[data-theme="dark"] .pill.active { color: var(--money); }
a { color: var(--sign); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.five { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.35fr); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px 15px; box-shadow: var(--shadow); min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.kpi .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--sign-tint); color: var(--sign); flex: none; }
.kpi .ico svg { width: 17px; height: 17px; }
.kpi .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .v { font-size: 27px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.kpi-delta { min-height: 20px; margin-top: 5px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.delta { font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.kpi-delta { flex-wrap: wrap; }
.main, .content { min-width: 0; }
.delta.up { background: var(--money-tint); color: var(--money); }
.delta.down { background: var(--red-bg); color: var(--red); }
.delta.flat { background: var(--slate-bg); color: var(--slate); }
.vs { color: var(--muted); }
.kpi .k { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi .how { display: none; }
.kpis > .kpi:nth-child(2) .ico { background: #ede9fe; color: #6d28d9; }
.kpis > .kpi:nth-child(3) .ico { background: var(--money-tint); color: var(--money); }
.kpis > .kpi:nth-child(4) .ico { background: #fef3c7; color: #b45309; }
:root[data-theme="dark"] .kpis > .kpi:nth-child(2) .ico { background: #2a1f4d; color: #c4b5fd; }
:root[data-theme="dark"] .kpis > .kpi:nth-child(4) .ico { background: #3a2c0c; color: #fbbf24; }
.kpi.hero { background: linear-gradient(140deg, #0f172a 0%, #1e3a8a 70%, #2563eb 130%); border-color: transparent; color: #fff; }
.kpi.hero .ico { background: rgba(255, 255, 255, .14); color: #fff; }
.kpi.hero .lbl, .kpi.hero .k, .kpi.hero .vs { color: #c7d2fe; }
.kpi.hero .v { font-size: 30px; }
.kpi.hero .delta.up { background: rgba(74, 222, 128, .18); color: #86efac; }
.kpi.hero .delta.down { background: rgba(248, 113, 113, .2); color: #fca5a5; }
.kpi.hero .how { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: 11.5px; color: #a5b4fc; }

.av { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.side-foot .av { width: 34px; height: 34px; font-size: 12px; }
.av0 { background: #2563eb; } .av1 { background: #7c3aed; } .av2 { background: #0f8a5f; } .av3 { background: #d97706; }
.av4 { background: #db2777; } .av5 { background: #0891b2; } .av6 { background: #4f46e5; } .av7 { background: #65a30d; }
.who { display: inline-flex; align-items: center; gap: 10px; }
td.barcell { min-width: 150px; }
.barnum { display: block; font-weight: 600; margin-bottom: 4px; }
svg.bar { display: block; width: 100%; height: 6px; }
svg.bar .bg { fill: var(--slate-bg); }
svg.bar .fg { fill: var(--money); }
svg.bar.alt .fg { fill: var(--sign); }
table.nice td { vertical-align: middle; }
.log li { padding: 9px 0; }
.ro { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); background: var(--slate-bg); border-radius: 999px; padding: 5px 11px; }
.ro svg { width: 14px; height: 14px; }
.btn svg { width: 15px; height: 15px; }
.st { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap; display: inline-block; }
.st.free { background: var(--money-tint); color: var(--money); } .st.soon { background: var(--amber-bg); color: var(--amber); }
.st.busy { background: var(--slate-bg); color: var(--slate); } .st.idle { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.src { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
.src.auto { background: var(--sign-tint); color: var(--sign); } .src.manual { background: #fce7f3; color: #be185d; }
:root[data-theme="dark"] .src.manual { background: #4a1530; color: #f9a8d4; }
.phone { font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--surface); white-space: nowrap; }
.phone:hover { border-color: var(--sign); }
.phone svg { width: 14px; height: 14px; color: var(--sign); }
.eq { display: flex; flex-wrap: wrap; gap: 4px; } .eq span { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.chev { color: var(--muted); margin-right: 6px; font-size: 12px; }
table.fleet tr.open td { background: var(--sign-tint); }
tbody tr.drawer > td, tbody tr.drawer:hover > td, tbody tr.drawer:nth-child(even) > td { background: var(--surface-2); padding: 0; }
table.inner tbody tr td { background: var(--surface); }
table.inner tbody tr:hover td { background: var(--sign-tint); }
.dr { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; padding: 16px 18px 18px; border-left: 3px solid var(--sign); }
.dr-l { display: grid; gap: 12px; align-content: start; }
.dgrid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dgrid3 > div, .locbox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.dgrid3 b { word-break: break-word; }
.dgrid3 small, .lab { display: block; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.locbox { display: flex; gap: 10px; align-items: center; } .locbox > svg { width: 20px; height: 20px; color: var(--sign); flex: none; } .locbox .btn { margin-left: auto; }
.dr-r { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.dr-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.dr-r textarea { min-height: 170px; font: 13px/1.55 var(--font); }
.dr-r .actions { justify-content: space-between; }
.replaced summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--muted); }
.dr1 { padding: 12px 16px 14px; border-left: 3px solid var(--sign); }
table.inner th { background: transparent; }
table.inner td, table.inner th { padding: 7px 10px; }
.kpis.fleetk { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .dr { grid-template-columns: minmax(0, 1fr); } .dgrid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .kpis.fleetk { grid-template-columns: minmax(0, 1fr); } }
.lane { display: block; background: var(--sign-tint); color: var(--ink); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.note { background: var(--amber-bg); color: var(--amber); border-radius: 10px; padding: 9px 14px; font-weight: 600; margin: 0 0 14px; }

@media (max-width: 1100px) {
  .grid.side, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .kpis, .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.five > .kpi.hero { grid-column: span 2; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: 240px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 16px 16px 60px; }
  .board { grid-template-columns: 1fr 1fr; }
  .kpis, .kpis.five { grid-template-columns: 1fr 1fr; }
  .kpis.five > .kpi.hero { grid-column: span 2; }
  .board > div:nth-child(3) { border-left: 0; }
  .board > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .board.five { grid-template-columns: 1fr 1fr; }
  .board.five > div:nth-child(5) { grid-column: span 2; border-left: 0; border-radius: 0 0 8px 8px; }
  .sign-inner { grid-template-columns: 1fr; text-align: left; gap: 10px; }
  .sign .end.to { text-align: left; }
  .sign .mid { text-align: left; display: flex; gap: 10px; align-items: center; }
  .sign .mid svg { margin: 0; transform: rotate(90deg); width: 30px; }
  .sign .city { font-size: 24px; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid > * { grid-column: span 2 !important; }
  .form-grid .c1 { grid-column: span 1 !important; }
  .filters input[type=search] { max-width: none; }
  .invoice { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* utilities (no inline styles: CSP) */
.mb { margin-bottom: 14px; }
.pad { padding: 8px 16px 16px; }
.btn.menu-btn { display: none; }
@media (max-width: 860px) { .btn.menu-btn { display: inline-flex; } }
.range input { width: auto; }
.road .stop.now:not(:last-child)::before { background: linear-gradient(to right, var(--sign) 50%, var(--line) 50%); }
.road .stop.now:first-child::before { background: var(--line); }
.auto-note { font-size: 13px; background: var(--sign-tint); border-radius: var(--radius); padding: 8px 12px 7px; line-height: 1.6; }
.auto-note:empty { display: none; }
.auto-note .btn { margin-left: 6px; vertical-align: middle; }
p.c6 { margin: 0; }
.hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.mt { margin-top: 16px; }
tbody tr.on td { background: var(--sign-tint); }
.secret { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 6px 0 10px; }
.secret code { font-size: 18px; font-weight: 700; letter-spacing: .04em; flex: 1; word-break: break-all; }
dialog.wide { width: min(980px, calc(100vw - 24px)); }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; }
.code-wrap { position: relative; }
.code-wrap .btn { position: absolute; top: 8px; right: 8px; }
.code-wrap pre { margin: 0; max-height: 320px; overflow: auto; background: var(--asphalt); color: #e6ebe8; border-radius: 8px; padding: 14px 16px; font-size: 12px; line-height: 1.5; }

/* dashboard truck map */
.mapcard .usmap { display: block; width: 100%; height: auto; max-height: 560px; padding: 4px 16px 0; }
.usmap .states path { fill: color-mix(in srgb, var(--sign) 7%, var(--surface)); stroke: var(--surface); stroke-width: 1.4; stroke-linejoin: round; }
.usmap .states path:hover { fill: color-mix(in srgb, var(--sign) 12%, var(--surface)); }
.usmap .slabels text { font: 600 11px var(--font); fill: var(--muted); opacity: .45; text-anchor: middle; pointer-events: none; }
.usmap .pin circle { stroke: var(--surface); stroke-width: 2.5; }
.usmap .pin.free circle { fill: #f5c518; stroke: #7a5b00; stroke-width: 2; }
.usmap .pin.soon circle { fill: #f08c1a; }
.usmap .pin.busy circle { fill: var(--sign); }
.usmap .pin:hover circle { stroke: var(--ink); stroke-width: 3; }
.usmap .pin .cnt { font: 700 11.5px var(--font); text-anchor: middle; fill: #fff; pointer-events: none; }
.usmap .pin.free .cnt { fill: #3d2d00; }
.usmap .tag rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; filter: drop-shadow(0 1px 1.5px rgba(15, 23, 42, .12)); }
.usmap .tag.free rect { stroke: #c9a000; } .usmap .tag.soon rect { stroke: #f08c1a; }
.usmap .tag text { font: 600 12px var(--font); fill: var(--ink); }
.usmap .tag:hover rect { stroke: var(--ink); }
.mapcard .maprest { padding: 0 18px; margin: 0; font-size: 13px; }
.usmap .leader { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.maplegend { display: flex; gap: 18px; flex-wrap: wrap; padding: 6px 18px 14px; font-size: 13px; color: var(--muted); font-weight: 500; }
.maplegend .lg { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lg.free { background: #f5c518; box-shadow: 0 0 0 2px #7a5b00 inset; } .lg.soon { background: #f08c1a; } .lg.busy { background: var(--sign); }
.lg.many { background: var(--sign); color: #fff; font-size: 9px; font-weight: 700; text-align: center; line-height: 11px; width: 15px; height: 15px; line-height: 15px; }

/* settings: checkbox lists, inline numbers, text-template previews */
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 4px; }
.checks .check { font-weight: 500; }
.inl { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; margin: 2px 0; }
.inl input { width: 84px; }
.tplbox { display: grid; gap: 6px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.tplbox code { font-size: 12px; }
.tplprev { margin: 0; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
  font: 13px/1.5 var(--font); white-space: pre-wrap; color: var(--ink); }
table.dashcfg select { min-width: 150px; }

/* new load: fill from rate con */
.rcdrop { display: block; cursor: pointer; padding: 2px 0; }
.rcdrop u { color: var(--sign); }
#rc-box:has(.rcdrop.over) { outline: 2px dashed var(--sign); outline-offset: 2px; }
#rc-msg:not(:empty) { margin-top: 4px; }
.field.rc-filled input, .field.rc-filled select { border-color: var(--sign); box-shadow: 0 0 0 2px var(--sign-tint); }

/* quick search (Ctrl+K) */
.side-search { display: flex; align-items: center; gap: 9px; margin: 0 12px 10px; padding: 8px 10px; width: calc(100% - 24px);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--radius); background: rgba(255, 255, 255, .04); color: var(--asphalt-ink); font: inherit; font-size: 13px; cursor: pointer; }
.side-search:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-search svg { width: 16px; height: 16px; flex: none; }
.side-search span { flex: 1; text-align: left; }
.side-search kbd, .pal-in kbd { font: 600 11px var(--font); padding: 2px 6px; border-radius: 5px; border: 1px solid currentColor; opacity: .6; }
.menu-btn svg { width: 16px; height: 16px; }
dialog.palette { width: min(760px, 94vw); max-width: none; margin: 8vh auto auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(15, 23, 42, .3); }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-in svg { width: 18px; height: 18px; flex: none; }
.pal-in input { flex: 1; border: 0; outline: 0; box-shadow: none; background: transparent; font-size: 16px; padding: 4px 0; min-height: 0; color: var(--ink); }
.pal-list { max-height: min(62vh, 560px); overflow: auto; padding: 6px 8px 10px; }
.pal-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 8px 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); cursor: pointer; }
.pal-item.on { background: var(--sign-tint); }
.pal-item .pal-main { flex: 1; min-width: 0; }
.pal-item .pal-main small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .st, .pal-item .pill { flex: none; min-width: 84px; text-align: center; }
.pal-item .num { font-weight: 700; }
.pal-list .empty { padding: 18px 10px; }
@media (max-width: 760px) { dialog.palette { margin-top: 2vh; } .pal-item [data-truckinfo] { display: none; } }

/* saved filters */
.views { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 13px; }
.chip.view { display: inline-flex; align-items: center; gap: 2px; padding-right: 4px; }
.chip.view a { color: inherit; text-decoration: none; }
.chip.view button { border: 0; background: none; color: inherit; opacity: .55; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.chip.view button:hover { opacity: 1; }
.chip.add { border-style: dashed; }
.rcdrop svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; color: var(--sign); }

/* ITS desk cards */
.itscard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; }
.ic-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ic-top > a b { font-size: 16px; }
.ic-act { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.ic-grid { display: grid; grid-template-columns: 1fr 1fr 1.3fr 1.2fr .9fr; gap: 14px; }
.ic-grid > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 13px; }
.ic-grid small { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ic-grid b { font-size: 14px; }
.ic-grid span { color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ic-money b { color: var(--money); }
.ic-notes { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); white-space: pre-wrap; }
@media (max-width: 1100px) { .ic-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .ic-grid { grid-template-columns: 1fr; } .ic-act { margin-left: 0; width: 100%; } }
.ic-grid .btn { align-self: flex-start; }

/* map: trip of the current / booked load */
.usmap .trip { stroke-width: 1.6; stroke-dasharray: 5 4; fill: none; opacity: .75; }
.usmap .trip.busy { stroke: var(--sign); } .usmap .trip.soon { stroke: #f08c1a; }
.usmap .trip-head { fill: var(--muted); }
.usmap .trip-from { stroke: var(--surface); stroke-width: 1.5; opacity: .85; }
.usmap .trip-from.busy { fill: var(--sign); } .usmap .trip-from.soon { fill: #f08c1a; }
.usmap .tag.busy rect { stroke: color-mix(in srgb, var(--sign) 55%, var(--surface)); }
.usmap .tag.busy text { fill: var(--sign-deep); font-weight: 500; }
.lg.trip { width: 22px; height: 0; border-radius: 0; border-top: 2px dashed var(--sign); vertical-align: 3px; }

/* company logo */
.brand .logo-img { width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(246, 243, 226, .9); background: #f6f3e2; }
.login .logo-img.big { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 14px; box-shadow: 0 4px 18px rgba(15, 23, 42, .18); }
.logo-edit { display: flex; gap: 16px; align-items: center; }
.logo-edit img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 10px rgba(15, 23, 42, .12); }
.logo-edit .ph { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: var(--slate-bg); color: var(--muted); font-weight: 700; }
.actions .grow { flex: 1; }
.login .logo-img.big ~ h1, .login .logo-img.big ~ p { text-align: center; }
.statement .st-brand { display: flex; align-items: center; gap: 14px; }
.statement .st-brand img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; box-shadow: 0 1px 6px rgba(15, 23, 42, .12); }
@media print { .statement .st-brand img { box-shadow: none; } }
.statement.payonly .xfee { display: none; }

/* office reports */
.rep-cols { max-height: none; }
.rep-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding-top: 16px; }
.rep-summary > div { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.rep-summary > div span { font-size: 12px; color: var(--muted); }
.rep-summary > div b { font-size: 16px; }
.rep-summary > div.strong { border-left: 3px solid var(--focus); }
.rep-summary > div.strong b { color: var(--money); }
.rep-table td, .rep-table th { white-space: nowrap; }
.rep-table tr.rep-group td { background: var(--surface-2); }
.rep-table tr.rep-sub-total td { border-top: 1px solid var(--line); }
.rep-table tr.rep-det > td { padding: 0 0 8px 24px; }
.rep-sub { font-size: 12px; }
.rep-presets { margin: 0; }
select.rep-orient { width: auto; }
.filters input[type=month] { width: auto; }
.rep-order { margin: 6px 0 2px; font-size: 13px; }
.rep-order span { opacity: .75; }
.rep-warn .pad { padding-top: 14px; color: var(--amber); background: var(--amber-bg); border-radius: var(--radius); }
