:root{
  color-scheme: light;
  --bg:#eef0f3;
  --surface-1:#fcfcfb;
  --surface-2:#f3f4f6;
  --border:#dcdfe4;
  --grid:#e6e8ec;
  --text-primary:#0b0b0b;
  --text-secondary:#52514e;
  --text-muted:#6f6e69;
  --brand:#05070A;
  --brand-accent:#2F63D4;
  --series-1:#2a78d6;
  --series-2:#eb6834;
  --good:#0a7a33;
  --warning:#9a6200;
  --critical:#c62828;
  --focus:#2F63D4;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --bg:#0f1012;
    --surface-1:#1a1a19;
    --surface-2:#232322;
    --border:#33332f;
    --grid:#2a2a28;
    --text-primary:#ffffff;
    --text-secondary:#c3c2b7;
    --text-muted:#9a998f;
    --series-1:#3987e5;
    --series-2:#d95926;
    --good:#4cc47a;
    --warning:#e3a33a;
    --critical:#ef6b6b;
    --focus:#6da7ec;
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --bg:#0f1012;
  --surface-1:#1a1a19;
  --surface-2:#232322;
  --border:#33332f;
  --grid:#2a2a28;
  --text-primary:#ffffff;
  --text-secondary:#c3c2b7;
  --text-muted:#9a998f;
  --series-1:#3987e5;
  --series-2:#d95926;
  --good:#4cc47a;
  --warning:#e3a33a;
  --critical:#ef6b6b;
  --focus:#6da7ec;
}

*{ box-sizing:border-box; }
html,body{ margin:0; }
body{
  background:var(--bg); color:var(--text-primary);
  font:14px/1.45 Inter, system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
}
[hidden]{ display:none !important; }
h1,h2,h3{ margin:0; font-family:Oswald, Inter, sans-serif; font-weight:500; letter-spacing:.3px; }
h2{ font-size:22px; }
h3{ font-size:16px; margin-bottom:6px; }
.muted{ color:var(--text-secondary); }
.small{ font-size:12px; }
.error{ color:var(--critical); min-height:1.2em; margin:4px 0 0; }
:focus-visible{ outline:2px solid var(--focus); outline-offset:2px; }
.num{ font-variant-numeric:tabular-nums; }

/* buttons + inputs */
.btn{
  font:inherit; font-weight:600; cursor:pointer;
  border:1px solid var(--border); background:var(--surface-1); color:var(--text-primary);
  border-radius:8px; padding:8px 14px;
}
.btn:hover{ background:var(--surface-2); }
.btn.primary{ background:var(--brand-accent); border-color:var(--brand-accent); color:#fff; }
.btn.primary:hover{ filter:brightness(1.08); }
.btn.ghost{ background:transparent; }
.btn.small{ padding:6px 10px; font-size:13px; }
.btn.danger{ color:var(--critical); }
input,select{
  font:inherit; color:var(--text-primary); background:var(--surface-1);
  border:1px solid var(--border); border-radius:8px; padding:6px 8px; min-width:0;
}
.row-gap{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

/* login */
.login{ min-height:100vh; display:grid; place-items:center; padding:16px; background:var(--brand); }
.login-card{
  width:100%; max-width:340px; background:var(--surface-1); border-radius:14px; padding:28px;
  display:flex; flex-direction:column; gap:10px; border-top:4px solid var(--brand-accent);
}
.login-card img{ border-radius:12px; }
.login-card h1{ font-size:24px; }
.login-card label{ font-weight:600; font-size:13px; }
.login-card input{ padding:10px; }

/* top bar */
.topbar{
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  background:var(--brand); color:#fff; padding:10px 16px; border-bottom:3px solid var(--brand-accent);
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand img{ border-radius:6px; }
.brand-name{ font-family:Oswald, sans-serif; font-weight:700; letter-spacing:1px; font-size:15px; line-height:1.1; }
.brand-sub{ font-size:11px; color:#9fb6e8; }
.tabs{ display:flex; gap:4px; margin-left:8px; }
.tabs button{
  font:inherit; font-weight:600; color:#c9d1de; background:transparent; border:0;
  padding:8px 12px; border-radius:8px; cursor:pointer;
}
.tabs button[aria-selected="true"]{ color:#fff; background:rgba(255,255,255,.12); }
.top-actions{ margin-left:auto; display:flex; gap:8px; align-items:center; }
.top-actions .btn{ background:transparent; color:#fff; border-color:rgba(255,255,255,.3); }
.icon-btn{ background:transparent; border:1px solid rgba(255,255,255,.3); border-radius:8px; padding:6px; cursor:pointer; display:flex; }
.icon-btn svg{ width:18px; height:18px; fill:#fff; }

/* filters */
.filters{
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
  padding:10px 16px; background:var(--surface-1); border-bottom:1px solid var(--border);
  position:sticky; top:0; z-index:5;
}
.filters label{ display:flex; gap:6px; align-items:center; color:var(--text-secondary); font-size:13px; }
.filters select{ max-width:180px; }
.presets{ display:flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.presets button{
  font:inherit; font-size:13px; background:var(--surface-1); color:var(--text-primary);
  border:0; border-right:1px solid var(--border); padding:6px 10px; cursor:pointer;
}
.presets button:last-child{ border-right:0; }
.presets button[aria-pressed="true"]{ background:var(--brand-accent); color:#fff; }

main{ padding:16px; max-width:1500px; margin:0 auto; }
.panel-head{ display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px; }

/* widget grid */
.grid{ display:grid; grid-template-columns:repeat(12, minmax(0,1fr)); gap:12px; }
.w{
  background:var(--surface-1); border:1px solid var(--border); border-radius:12px;
  padding:14px 16px; min-width:0; position:relative;
}
.w.s{ grid-column:span 3; } .w.m{ grid-column:span 6; } .w.l{ grid-column:span 12; }
@media (max-width:1100px){ .w.s{ grid-column:span 6; } }
@media (max-width:720px){
  .filters{ position:static; }
  .filters select{ flex:1 1 calc(50% - 8px); max-width:none; }
  .presets{ width:100%; } .presets button{ flex:1; padding:6px 4px; }
 .w.s,.w.m,.w.l{ grid-column:span 12; } .tabs{ margin-left:0; order:3; width:100%; } }
.w-head{ display:flex; justify-content:space-between; gap:8px; align-items:flex-start; margin-bottom:8px; }
.w-title{ font-weight:600; color:var(--text-secondary); font-size:13px; }
.w-tools{ display:none; gap:4px; }
.editing .w-tools{ display:flex; }
.editing .w{ border-style:dashed; }
.w-tools button{
  font:inherit; font-size:12px; border:1px solid var(--border); background:var(--surface-2);
  color:var(--text-primary); border-radius:6px; padding:2px 7px; cursor:pointer;
}
.kpi-value{ font-size:30px; font-weight:700; line-height:1.1; letter-spacing:-.5px; }
.kpi-sub{ color:var(--text-muted); font-size:12px; margin-top:4px; }
.legend{ display:flex; gap:14px; font-size:12px; color:var(--text-secondary); margin-bottom:6px; }
.legend i{ display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:5px; vertical-align:-1px; }
.w svg{ display:block; width:100%; overflow:visible; }
.w svg text{ fill:var(--text-secondary); font-size:11px; font-family:Inter, sans-serif; }
.w svg .val{ fill:var(--text-primary); font-weight:600; }
.w svg .gridline{ stroke:var(--grid); stroke-width:1; }
.w svg .axis{ stroke:var(--border); stroke-width:1; }
.w svg .hit{ fill:transparent; cursor:pointer; }
.w svg .hit:hover + .bar, .w svg g.row:hover .bar{ filter:brightness(1.12); }
.w .nodata{ color:var(--text-muted); padding:24px 0; text-align:center; }

/* tables */
.table-wrap{ overflow:auto; max-height:70vh; border:1px solid var(--border); border-radius:10px; background:var(--surface-1); }
.w .table-wrap{ max-height:360px; border:0; }
.data-table{ width:100%; border-collapse:collapse; font-size:13px; }
.data-table th,.data-table td{ padding:7px 10px; border-bottom:1px solid var(--grid); text-align:left; white-space:nowrap; }
.data-table th{ position:sticky; top:0; background:var(--surface-2); font-weight:600; color:var(--text-secondary); cursor:pointer; user-select:none; }
.data-table td.n,.data-table th.n{ text-align:right; font-variant-numeric:tabular-nums; }
.data-table tbody tr:hover{ background:var(--surface-2); }
/* Frozen first column (e.g. Fleet's Unit): stays put while the rest of the row scrolls sideways. */
.data-table.freeze-first th:first-child,.data-table.freeze-first td:first-child{ position:sticky; left:0; z-index:1; background:var(--surface-1); box-shadow:inset -1px 0 0 var(--border), 4px 0 6px -4px rgb(0 0 0 / .18); }
.data-table.freeze-first thead th{ z-index:2; }
.data-table.freeze-first thead th:first-child{ z-index:3; background:var(--surface-2); }
.data-table.freeze-first tbody tr:hover td:first-child{ background:var(--surface-2); }
.pill{ display:inline-flex; align-items:center; gap:4px; font-size:12px; font-weight:600; padding:1px 8px; border-radius:99px; border:1px solid var(--border); }
.pill.paid{ color:var(--good); } .pill.unpaid{ color:var(--critical); }

/* data tab */
.card{ background:var(--surface-1); border:1px solid var(--border); border-radius:12px; padding:16px; margin-bottom:14px; }
.drop{
  display:block; border:2px dashed var(--border); border-radius:12px; padding:34px 16px; text-align:center;
  color:var(--text-secondary); cursor:pointer; margin-top:10px;
}
.drop.over{ border-color:var(--brand-accent); background:var(--surface-2); }
#preview{ margin-top:14px; }
.stats{ display:grid; grid-template-columns:repeat(auto-fit, minmax(150px,1fr)); gap:10px; margin:10px 0; }
.stats div{ background:var(--surface-2); border-radius:8px; padding:10px; }
.stats b{ display:block; font-size:18px; }
.defs{ margin:0; padding-left:18px; color:var(--text-secondary); }
.defs li{ margin:4px 0; }
.empty{ text-align:center; padding:60px 16px; background:var(--surface-1); border:1px solid var(--border); border-radius:12px; }
.empty p{ color:var(--text-secondary); }

/* dialog */
dialog{ border:1px solid var(--border); border-radius:14px; background:var(--surface-1); color:var(--text-primary); padding:22px; width:min(420px, calc(100vw - 32px)); }
dialog::backdrop{ background:rgba(0,0,0,.45); }
dialog form{ display:flex; flex-direction:column; gap:10px; }
dialog label{ display:flex; flex-direction:column; gap:4px; font-size:13px; font-weight:600; color:var(--text-secondary); }
.dlg-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:6px; }

.tooltip{
  position:fixed; z-index:50; pointer-events:none; background:var(--surface-1); color:var(--text-primary);
  border:1px solid var(--border); border-radius:8px; padding:8px 10px; font-size:12px;
  box-shadow:0 6px 20px rgba(0,0,0,.18); max-width:260px;
}
.tooltip b{ display:block; margin-bottom:2px; }
.tooltip .tt-row{ display:flex; justify-content:space-between; gap:14px; }
.tooltip i{ display:inline-block; width:8px; height:8px; border-radius:2px; margin-right:5px; }
.toast{
  position:fixed; bottom:20px; left:50%; transform:translateX(-50%); z-index:60;
  background:var(--brand); color:#fff; padding:10px 16px; border-radius:10px; font-weight:600;
}

/* lifetime + profitability */
.data-table tbody tr.clickable{ cursor:pointer; }
.data-table tr.selected{ background:var(--surface-2); box-shadow:inset 3px 0 0 var(--brand-accent); }
.detail{ margin-bottom:14px; }
.detail-head{ display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:10px; }
.inline-form{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; }
.inline-form label{ display:flex; flex-direction:column; gap:4px; font-size:12px; font-weight:600; color:var(--text-secondary); }
.inline-form label.grow{ flex:1 1 180px; }
.inline-form input[type=number]{ width:120px; }
dialog label.check{ flex-direction:row; align-items:center; gap:8px; }
.neg{ color:var(--critical); }
.meter{ display:inline-block; width:90px; height:8px; border-radius:4px; background:var(--grid); vertical-align:middle; margin-right:8px; overflow:hidden; }
.meter i{ display:block; height:100%; background:var(--series-1); border-radius:4px; }
.meter i.low{ background:var(--critical); }
.w svg .avg{ fill:var(--text-muted); font-weight:400; }

/* accounts */
.login-card label{ display:flex; flex-direction:column; gap:4px; }
#credFields, #codeFields{ display:flex; flex-direction:column; gap:8px; }
.dlg-body{ display:flex; flex-direction:column; gap:10px; }
.dlg-body form{ display:flex; flex-direction:column; gap:8px; padding:12px 0; border-top:1px solid var(--border); }
.dlg-body h4{ margin:0; font-size:14px; }
#twofa{ border-top:1px solid var(--border); padding-top:12px; display:flex; flex-direction:column; gap:8px; }
#twofaBody{ display:flex; flex-direction:column; gap:8px; }
.qr{ background:#fff; padding:10px; border-radius:8px; width:max-content; }
.secret{ display:flex; gap:8px; align-items:center; background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:10px 12px; }
.secret code{ font-size:18px; font-weight:700; letter-spacing:1px; flex:1; word-break:break-all; }
.tag{ display:inline-block; font-size:11px; font-weight:600; padding:1px 7px; border-radius:99px; border:1px solid var(--border); color:var(--text-secondary); margin-right:4px; }
.tag.warn{ color:var(--critical); }
.tag.ok{ color:var(--good); }
.user-actions{ display:flex; gap:4px; flex-wrap:wrap; }
.user-actions select{ padding:3px 6px; font-size:12px; }

/* Editing controls only for editor/admin roles. */
body:not(.can-edit) :is(#editBtn, #addWidgetBtn, #resetLayoutBtn, .upload-card, #costForm, #tireForm, [data-del], [data-del-cost], [data-del-tire], .edit-only){ display:none !important; }

/* admin workspace */
.subnav{ display:flex; gap:4px; flex-wrap:wrap; margin-bottom:14px; border-bottom:1px solid var(--border); padding-bottom:8px; }
.subnav button{ font:inherit; font-weight:600; font-size:13px; background:transparent; border:0; color:var(--text-secondary); padding:7px 11px; border-radius:8px; cursor:pointer; }
.subnav button[aria-current="true"]{ background:var(--surface-1); color:var(--text-primary); box-shadow:inset 0 -2px 0 var(--brand-accent); }
.subnav .n{ font-size:11px; color:var(--text-muted); margin-left:4px; }
.chip{ display:inline-flex; align-items:center; gap:4px; font-size:12px; font-weight:600; padding:1px 8px; border-radius:99px; border:1px solid var(--border); white-space:nowrap; }
.chip.crit{ color:var(--critical); border-color:currentColor; }
.chip.warn{ color:var(--warning); border-color:currentColor; }
.chip.ok{ color:var(--good); }
.chip.done{ color:var(--text-muted); }
.overdue{ color:var(--critical); font-weight:600; }
.count-badge{ display:inline-block; min-width:18px; padding:0 5px; border-radius:99px; background:var(--brand-accent); color:#fff; font-size:11px; line-height:18px; text-align:center; margin-left:4px; }
.ws-toolbar{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:10px; }
.ws-toolbar input[type=search]{ min-width:200px; }
.data-table td.wrap{ white-space:normal; min-width:240px; max-width:420px; }
.data-table tr.closed td{ color:var(--text-muted); }
.wide-dlg{ width:min(760px, calc(100vw - 32px)); }
.item-grid{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; }
.item-grid .wide{ grid-column:1 / -1; }
.item-grid textarea{ font:inherit; color:var(--text-primary); background:var(--surface-1); border:1px solid var(--border); border-radius:8px; padding:6px 8px; min-height:64px; resize:vertical; }
@media (max-width:620px){ .item-grid{ grid-template-columns:1fr; } }
#itemHistory{ margin-top:8px; font-size:12px; color:var(--text-secondary); }
#itemHistory div p{ margin:4px 0; }
.tiles{ display:grid; grid-template-columns:repeat(auto-fit, minmax(170px,1fr)); gap:12px; margin-bottom:14px; }
.tile{ background:var(--surface-1); border:1px solid var(--border); border-radius:12px; padding:12px 14px; cursor:pointer; text-align:left; font:inherit; color:inherit; }
.tile:hover{ border-color:var(--brand-accent); }
.tile .t{ font-size:12px; font-weight:600; color:var(--text-secondary); }
.tile .v{ font-size:28px; font-weight:700; }
.tile .v.bad{ color:var(--critical); }
.stale{ color:var(--critical); font-weight:600; }
.towbook{ font-size:11px; color:var(--text-muted); }

.update-bar{ position:fixed; top:12px; left:50%; transform:translateX(-50%); z-index:70; background:var(--surface-1); color:var(--text-primary);
  border:2px solid var(--brand-accent); border-radius:10px; padding:8px 12px; display:flex; gap:10px; align-items:center; box-shadow:0 6px 20px rgba(0,0,0,.2); }
/* Tab row scrolls sideways on narrow screens instead of running off the edge. */
.tabs{ overflow-x:auto; scrollbar-width:none; }
.tabs button{ white-space:nowrap; flex:0 0 auto; }

/* fleet */
.item-grid h4{ grid-column:1 / -1; margin:8px 0 0; font-size:13px; color:var(--text-secondary); border-bottom:1px solid var(--border); padding-bottom:4px; }
.due-soon{ color:var(--warning); font-weight:600; }
.due-past{ color:var(--critical); font-weight:600; }
body:not(.can-edit) .edit-only-flex{ display:none !important; }

/* unpriced calls → tasks */
.task-drop{ display:flex; gap:16px; align-items:center; flex-wrap:wrap; position:sticky; top:56px; z-index:4; }
.drop-target{ flex:1 1 280px; border:2px dashed var(--border); border-radius:10px; padding:14px 16px; display:flex; flex-direction:column; gap:2px; }
.drop-target.over{ border-color:var(--brand-accent); background:var(--surface-2); }
tr[draggable="true"]{ cursor:grab; }
tr[draggable="true"]:active{ cursor:grabbing; }
tr.dragging{ opacity:.45; }
.has-task{ color:var(--good); font-weight:600; font-size:12px; white-space:nowrap; }

/* ---------- Dispatch ---------- */
.dstats{ grid-template-columns:repeat(auto-fit, minmax(140px,1fr)); margin-top:0; }
.warn-text{ color:var(--warning); }
.dboard{ display:grid; grid-template-columns:repeat(5, minmax(200px,1fr)); gap:10px; overflow-x:auto; padding-bottom:6px; align-items:start; }
.dcol{ background:var(--surface-2); border:1px solid var(--border); border-radius:12px; padding:8px; min-height:140px; }
.dcol h3{ font-size:14px; display:flex; justify-content:space-between; padding:2px 4px 6px; }
.dcol h3 .n{ font-family:Inter, sans-serif; font-size:12px; color:var(--text-muted); }
.dempty{ text-align:center; padding:18px 0; }
.dcard{ background:var(--surface-1); border:1px solid var(--border); border-left:4px solid var(--brand-accent); border-radius:10px; padding:8px 10px; margin-bottom:8px; cursor:pointer; display:flex; flex-direction:column; gap:3px; }
.dcard:hover, .dcard:focus-visible{ box-shadow:0 0 0 2px var(--focus); outline:none; }
.dcard.slow{ border-left-color:var(--warning); }
.dcard.late{ border-left-color:var(--critical); }
.dcard.pri-emergency{ background:color-mix(in srgb, var(--critical) 8%, var(--surface-1)); }
.dcard header{ display:flex; align-items:center; gap:6px; }
.dcard header .muted{ margin-left:auto; }
.dcard-acct{ font-weight:600; font-size:13px; }
.dloc{ color:var(--text-secondary); overflow-wrap:anywhere; }
.dcard footer{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:4px; }
.dcard footer .btn{ margin-left:auto; }
.chip{ font-size:11px; font-weight:700; padding:1px 7px; border-radius:99px; background:var(--surface-2); border:1px solid var(--border); }
.chip.warn{ color:var(--warning); border-color:currentColor; }
.chip.crit{ color:var(--critical); border-color:currentColor; }
.dlower{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; margin-top:12px; }
.dtrucks{ display:grid; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:8px; }
.dtruck{ display:flex; flex-direction:column; gap:2px; padding:8px 10px; border-radius:8px; border:1px solid var(--border); background:var(--surface-2); }
.dtruck.free b::before{ content:"● "; color:var(--good); }
.dtruck.busy{ cursor:pointer; } .dtruck.busy b::before{ content:"● "; color:var(--warning); }
.mono{ font-family:ui-monospace, Menlo, monospace; font-size:12px; }
.call-dlg{ width:min(980px, calc(100vw - 24px)); }
.call-grid{ grid-template-columns:repeat(4, minmax(0,1fr)); }
.call-grid .wide{ grid-column:1 / -1; }
.call-head{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.chips{ display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-bottom:6px; }
.chip-btn{ font:inherit; font-size:12px; padding:3px 9px; border-radius:99px; border:1px solid var(--border); background:var(--surface-2); color:var(--text-primary); cursor:pointer; }
.chip-btn:hover{ border-color:var(--brand-accent); }
dialog .data-table input, dialog .data-table select{ width:100%; padding:4px 6px; }
dialog label.inline{ flex-direction:row; align-items:center; gap:6px; }
.totals{ display:flex; justify-content:flex-end; gap:18px; flex-wrap:wrap; margin-top:8px; font-size:13px; }
.timeline{ display:flex; flex-wrap:wrap; gap:6px 16px; }
.timeline details{ flex-basis:100%; }
.timeline ul{ margin:6px 0 0; padding-left:18px; max-height:180px; overflow:auto; }
@media (max-width:1100px){ .dlower{ grid-template-columns:1fr; } .call-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); } }
@media (max-width:620px){ .call-grid{ grid-template-columns:1fr; } }

/* Printed invoice: only #printArea shows. */
#printArea .invoice{ font:13px Inter, sans-serif; color:#000; }
.invoice header{ display:flex; justify-content:space-between; border-bottom:2px solid #000; padding-bottom:8px; }
.invoice h1{ font-size:20px; margin:0; } .invoice h2{ font-size:16px; margin:0; } .invoice .r{ text-align:right; }
.invoice p{ margin:2px 0; }
.invoice .cols{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin:14px 0; }
.invoice h3{ font-size:12px; text-transform:uppercase; color:#555; margin:0 0 4px; }
.invoice table{ width:100%; border-collapse:collapse; }
.invoice th, .invoice td{ border-bottom:1px solid #ccc; padding:6px; text-align:left; }
.invoice .n{ text-align:right; }
.invoice .sig{ margin-top:30px; }
@media print{
  body.printing > *:not(#app){ display:none !important; }
  body.printing #app > *:not(main){ display:none !important; }
  body.printing main > *:not(#tab-dispatch){ display:none !important; }
  body.printing #tab-dispatch > *:not(#printArea){ display:none !important; }
  body.printing #tab-dispatch, body.printing #printArea{ display:block !important; }
  body.printing, body.printing main{ background:#fff; padding:0; }
}

/* Dispatch part 2: address suggestions, share box, photos, map, settings, statement */
.call-grid label.addr{ position:relative; }
.geo-ok{ font-weight:500; color:var(--good); font-size:12px; }
.suggest{ position:absolute; top:100%; left:0; right:0; z-index:10; background:var(--surface-1); border:1px solid var(--border); border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.18); overflow:hidden; }
.suggest button{ display:block; width:100%; text-align:left; font:inherit; font-weight:400; font-size:13px; color:var(--text-primary); background:transparent; border:0; border-bottom:1px solid var(--grid); padding:8px 10px; cursor:pointer; }
.suggest button:hover, .suggest button:focus{ background:var(--surface-2); }
.chip-btn.zone{ border-color:var(--good); color:var(--good); font-weight:600; }
.chip-btn.busy{ opacity:.65; }
.share-box{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:8px; margin:8px 0; }
.share-box input{ flex:1 1 260px; font-size:12px; }
a.btn{ text-decoration:none; color:inherit; display:inline-flex; align-items:center; }
.photos{ display:flex; flex-wrap:wrap; gap:10px; }
.photos a{ display:flex; flex-direction:column; gap:4px; width:140px; text-decoration:none; color:inherit; }
.photos img{ width:140px; height:105px; object-fit:cover; border-radius:8px; border:1px solid var(--border); background:#fff; }
.photos a.signature img{ object-fit:contain; }
.dmap-wrap{ display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:12px; }
.dmap{ height:calc(100vh - 210px); min-height:420px; border-radius:12px; border:1px solid var(--border); }
.dmap-side{ max-height:calc(100vh - 210px); overflow:auto; margin:0; }
.dmap-call{ display:block; width:100%; text-align:left; font:inherit; color:inherit; background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:8px; margin-bottom:6px; cursor:pointer; }
.map-tag{ display:inline-block; transform:translate(-50%,-50%); white-space:nowrap; font:700 11px Inter, sans-serif; padding:2px 6px; border-radius:6px; color:#fff; box-shadow:0 1px 4px rgba(0,0,0,.4); }
.map-tag.truck{ background:#05070A; border:2px solid #2F63D4; }
.map-tag.phone{ background:#2F63D4; border:2px solid #fff; }
.legend .lg-truck{ background:#05070A; border:2px solid #2F63D4; }
.legend .lg-phone{ background:#2F63D4; }
.leaflet-container{ font:12px Inter, sans-serif; }
.dsettings{ display:grid; grid-template-columns:repeat(auto-fit, minmax(340px,1fr)); gap:12px; align-items:start; }
.dsettings .card{ margin:0; }
.dsettings code{ font-size:12px; }
.stmt-preview{ background:#fff; color:#000; border-radius:8px; padding:16px; max-height:60vh; overflow:auto; }
@media (max-width:900px){ .dmap-wrap{ grid-template-columns:1fr; } .dmap{ height:60vh; } }
.map-tag.truck.moving{ background:#0a7a33; border-color:#fff; }
.map-tag.truck.stale{ opacity:.55; filter:grayscale(1); }

/* Billing, payroll, impound paperwork */
.bill-group{ border:1px solid var(--border); border-radius:10px; padding:8px 10px; margin-bottom:8px; background:var(--surface-2); }
.bill-group summary{ cursor:pointer; padding:2px 0 6px; }
.bill-group .table-wrap{ max-height:300px; }
.qbo-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(320px,1fr)); gap:18px; }
.qbo-grid h4{ margin:4px 0 6px; font-size:14px; }
.nowrap{ white-space:nowrap; }
.pay-detail > td{ background:var(--surface-2); padding:6px 10px 12px; }
.data-table tfoot th{ position:static; }
textarea.mono{ font-family:ui-monospace, Menlo, monospace; font-size:12px; color:var(--text-primary); background:var(--surface-1); border:1px solid var(--border); border-radius:8px; padding:8px; }
.invoice.letter pre{ font:14px/1.5 Georgia, "Times New Roman", serif; white-space:pre-wrap; margin:0; }
.ok-chip{ color:var(--good); border-color:currentColor; }
.stripe-dlg{ width:min(720px, calc(100vw - 24px)); }
#stripeOnboard{ min-height:420px; }

/* Navigation: sections (dark top bar) → pages (light row) */
.sections{ display:flex; gap:4px; margin-left:8px; overflow-x:auto; scrollbar-width:none; }
.sections button{ font:inherit; font-weight:600; color:#c9d1de; background:transparent; border:0; padding:8px 14px; border-radius:8px; cursor:pointer; white-space:nowrap; }
.sections button[aria-current="true"]{ color:#fff; background:rgba(255,255,255,.14); }
.subtabs{ display:flex; gap:2px; margin:0; padding:0 16px; background:var(--surface-1); border-bottom:1px solid var(--border); overflow-x:auto; scrollbar-width:none; }
.subtabs button{ font:inherit; font-weight:600; font-size:14px; color:var(--text-secondary); background:transparent; border:0; border-bottom:3px solid transparent;
  padding:10px 12px 8px; cursor:pointer; white-space:nowrap; border-radius:0; }
.subtabs button[aria-selected="true"]{ color:var(--text-primary); border-bottom-color:var(--brand-accent); }
.subtabs button:hover{ color:var(--text-primary); }
.dhead{ margin-bottom:10px; } .dhead h2:empty{ display:none; } .dhead .row-gap{ margin-left:auto; }

/* Phones: compact header, board columns stack, stats scroll sideways */
@media (max-width:720px){
  .topbar{ padding:8px 12px; gap:8px; }
  .brand-name{ font-size:13px; }
  .brand img{ width:22px; height:22px; }
  .top-actions{ gap:6px; } .top-actions .btn{ padding:5px 8px; font-size:12px; }
  #accountBtn{ max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .sections{ order:3; width:100%; margin-left:0; }
  .subtabs{ padding:0 8px; }
  main{ padding:10px; }
  .dstats{ display:flex; overflow-x:auto; gap:8px; scrollbar-width:none; }
  .dstats > div{ flex:0 0 auto; min-width:120px; }
  .dboard{ grid-template-columns:1fr; overflow:visible; }
  .dcol{ min-height:0; }
  .dhead .row-gap{ width:100%; } .dhead #dNew{ flex:1; }
}

/* Quick intake + assign */
.qi{ margin-bottom:12px; border:2px solid var(--brand-accent); }
.qi-head{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin-bottom:8px; }
.qi-head h3{ margin:0; }
.qi-grid{ display:grid; grid-template-columns:repeat(6, minmax(0,1fr)); gap:10px; }
.qi-grid label, .qi-assign label{ display:flex; flex-direction:column; gap:4px; font-size:12px; font-weight:600; color:var(--text-secondary); }
.qi-pickup{ grid-column:span 3; position:relative; } .qi-veh{ grid-column:span 2; } .qi-dest, .qi-notes{ grid-column:span 3; }
.qi-urgent{ flex-direction:row !important; align-items:center; align-self:end; padding-bottom:8px; }
.qi-assign{ display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; margin-top:12px; padding-top:12px; border-top:1px solid var(--border); }
.qi-assign label{ min-width:200px; }
.dphone{ color:var(--text-secondary); text-decoration:none; } .dphone:hover{ text-decoration:underline; }
.assign-dlg{ width:min(620px, calc(100vw - 24px)); }
.assign-list{ display:flex; flex-direction:column; gap:6px; max-height:52vh; overflow:auto; }
.assign-row{ display:grid; grid-template-columns:1.4fr 1fr 1fr 60px; gap:8px; align-items:center; text-align:left; font:inherit; color:inherit;
  background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:10px 12px; cursor:pointer; }
.assign-row:hover{ border-color:var(--brand-accent); }
.assign-row.busy{ opacity:.6; }
.ok-text{ color:var(--good); font-weight:600; }
.dlower > .card{ min-width:0; overflow:hidden; }
@media (max-width:900px){ .qi-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); } .qi-pickup, .qi-veh, .qi-dest, .qi-notes{ grid-column:1 / -1; } }
@media (max-width:720px){ .qi-assign label{ min-width:0; flex:1 1 140px; } .qi-assign .btn{ flex:1 1 auto; } .assign-row{ grid-template-columns:1fr 1fr; } }

/* Call form: status steps + tabs */
.stepper{ display:flex; gap:0; margin:6px 0 10px; flex-wrap:wrap; }
.stepper button{ font:inherit; font-size:13px; font-weight:600; padding:7px 12px; border:1px solid var(--border); background:var(--surface-2); color:var(--text-secondary); cursor:pointer; margin-left:-1px; }
.stepper button:first-of-type{ border-radius:8px 0 0 8px; margin-left:0; } .stepper button:last-of-type{ border-radius:0 8px 8px 0; }
.stepper button.on{ background:var(--brand-accent); border-color:var(--brand-accent); color:#fff; position:relative; z-index:1; }
.stepper .chip{ margin-left:10px; align-self:center; }
.ctabs{ display:flex; gap:2px; border-bottom:1px solid var(--border); margin-bottom:12px; overflow-x:auto; }
.ctabs button{ font:inherit; font-weight:600; font-size:14px; background:transparent; border:0; border-bottom:3px solid transparent; padding:8px 12px; color:var(--text-secondary); cursor:pointer; white-space:nowrap; }
.ctabs button[aria-selected="true"]{ color:var(--text-primary); border-bottom-color:var(--brand-accent); }
.ctabs .n{ font-weight:500; color:var(--text-muted); }
.cpane{ min-height:300px; }
.pane-h{ margin:16px 0 6px; font-size:13px; color:var(--text-secondary); }
.history{ margin:0; padding-left:18px; max-height:260px; overflow:auto; }
.ask-dlg{ width:min(440px, calc(100vw - 24px)); }
.ask-dlg textarea{ font:inherit; padding:8px; border-radius:8px; border:1px solid var(--border); background:var(--surface-1); color:var(--text-primary); }
.btn.danger-solid{ background:var(--critical); border-color:var(--critical); color:#fff; }
.call-dlg{ margin-top:4vh; } .call-dlg .cpane{ min-height:52vh; }
.problem-dlg{ width:min(480px, calc(100vw - 24px)); border:1px solid var(--border); border-radius:14px; background:var(--surface-1); color:var(--text-primary); }
.problem-dlg form{ display:flex; flex-direction:column; gap:10px; }
.problem-dlg textarea{ font:inherit; padding:8px; border-radius:8px; border:1px solid var(--border); background:var(--surface-1); color:var(--text-primary); }
.problem-dlg .row-actions{ display:flex; justify-content:flex-end; gap:8px; }
.problem-dlg .row-actions button{ font:inherit; padding:8px 14px; border-radius:8px; border:1px solid var(--border); background:var(--surface-2); color:var(--text-primary); cursor:pointer; }
.problem-dlg .row-actions .send{ background:var(--brand-accent); border-color:var(--brand-accent); color:#fff; }
@media (max-width:720px){ #reportBtn{ font-size:0; padding:5px 9px; } #reportBtn::after{ content:"?"; font-size:13px; } }

/* Import data */
.imp-kinds{ display:grid; grid-template-columns:repeat(auto-fit, minmax(220px,1fr)); gap:8px; margin-top:10px; }
.imp-kind{ display:flex; flex-direction:column; gap:4px; text-align:left; font:inherit; color:inherit; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:10px 12px; cursor:pointer; }
.imp-kind[aria-pressed="true"]{ border:2px solid var(--brand-accent); background:var(--surface-1); }
.imp-map{ display:grid; grid-template-columns:repeat(auto-fit, minmax(220px,1fr)); gap:10px; }
.imp-map label{ display:flex; flex-direction:column; gap:3px; font-size:12px; font-weight:600; color:var(--text-secondary); }
.imp-groups{ margin:8px 0 12px; padding-left:18px; font-size:13px; } .imp-groups li{ margin:3px 0; }
.imp-groups li.error{ color:var(--critical); } .imp-groups li.warning{ color:var(--warning); }
tr.imp-err td:first-child{ box-shadow:inset 3px 0 0 var(--critical); } tr.imp-warn td:first-child{ box-shadow:inset 3px 0 0 var(--warning); }
td.imp-cell{ background:color-mix(in srgb, var(--warning) 14%, transparent); }
.onboard .steps{ list-style:none; padding:0; margin:12px 0; display:flex; flex-direction:column; gap:8px; }
.onboard .steps li{ display:grid; grid-template-columns:32px 1fr auto; gap:10px; align-items:center; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface-2); }
.onboard .steps li.done{ opacity:.75; }
.onboard .tick{ width:26px; height:26px; border-radius:50%; border:2px solid var(--border); display:grid; place-items:center; font-weight:700; color:#fff; }
.onboard li.done .tick{ background:var(--good); border-color:var(--good); }
.meter.big{ width:220px; height:12px; border-radius:6px; }
/* Subscription status strip under the header (plan-page.js) */
.billing-banner{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:8px 16px; font-size:14px; background:#fff4d6; color:#5a4300; border-bottom:1px solid #e9c46a; }
.billing-banner.bad{ background:#fde8e8; color:#7a1414; border-color:#f0b4b4; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .billing-banner{ background:#3d3210; color:#f3dc9b; border-color:#6b5a1e; } :root:not([data-theme="light"]) .billing-banner.bad{ background:#3d1414; color:#f6c1c1; border-color:#6b1e1e; } }
:root[data-theme="dark"] .billing-banner{ background:#3d3210; color:#f3dc9b; border-color:#6b5a1e; }
:root[data-theme="dark"] .billing-banner.bad{ background:#3d1414; color:#f6c1c1; border-color:#6b1e1e; }
.bad-text{ color:var(--critical); }
/* Call form: split bill columns show only when the bill is split; crew rows (dispatch-call.js) */
#callForm:not(.split-on) .payer-col{ display:none; }
.split-totals table{ margin-top:8px; max-width:520px; }
.crew{ display:flex; flex-direction:column; gap:8px; }
.crew:empty{ display:none; }
.crew-row{ display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; padding:8px; border:1px dashed var(--border); border-radius:8px; }
.crew-row label{ flex:1; min-width:140px; }
.dsettings #surForm{ grid-column:1 / -1; }
/* Call form sub-sections (police / accident, condition at pickup) */
details.subform{ border:1px solid var(--border); border-radius:8px; padding:8px 12px; }
details.subform > summary{ cursor:pointer; font-weight:600; font-size:13px; color:var(--text-secondary); }
details.subform[open] > summary{ margin-bottom:8px; }
details.subform .chips{ margin-bottom:8px; }
.dcol.sched{ opacity:.95; }
.dcol.sched h3{ color:var(--text-secondary); }
.dboard.has-sched{ grid-template-columns:repeat(6, minmax(200px,1fr)); }
@media (max-width:720px){ .dboard.has-sched{ grid-template-columns:1fr; } }
/* Call form: stops and extra vehicles (dispatch-call.js) */
.stops, .xveh{ display:flex; flex-direction:column; gap:8px; }
.stops:empty, .xveh:empty{ display:none; }
.stop-row, .veh-row{ display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; padding:8px; border:1px dashed var(--border); border-radius:8px; position:relative; }
.stop-row .addr{ flex:2; min-width:220px; position:relative; } .stop-row label{ flex:1; min-width:160px; }
.stop-n{ font-weight:700; align-self:center; min-width:16px; color:var(--text-secondary); }
.veh-row label{ flex:1; min-width:90px; }
.chip-btn.unfit, .assign-row.unfit{ opacity:.6; }
/* Local rules (local-pages.js) */
.dsettings .wide-card{ grid-column:1 / -1; }
.banner-warn{ background:#fff4d6; color:#5a4300; border:1px solid #e9c46a; border-radius:8px; padding:8px 12px; font-size:13px; }
:root[data-theme="dark"] .banner-warn{ background:#3d3210; color:#f3dc9b; border-color:#6b5a1e; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .banner-warn{ background:#3d3210; color:#f3dc9b; border-color:#6b5a1e; } }
#cPPIProblems:empty{ display:none; }
/* Fleet: date/number with an N/A tick; files on a vehicle */
.na-pair{ display:flex; gap:8px; align-items:center; }
.na-pair input[type=date], .na-pair input[type=number]{ flex:1; min-width:0; }
.na-check{ display:inline-flex; gap:4px; align-items:center; font-size:13px; white-space:nowrap; }
.veh-files{ display:grid; gap:8px; margin-bottom:10px; }
.veh-file{ display:grid; grid-template-columns:56px 1fr auto; gap:10px; align-items:center; padding:6px; border:1px solid var(--border); border-radius:8px; }
.veh-file img{ width:56px; height:56px; object-fit:cover; border-radius:6px; display:block; }
.veh-file-icon{ width:56px; height:56px; display:grid; place-items:center; border-radius:6px; border:1px solid var(--border); font-weight:700; font-size:12px; text-decoration:none; }
@media (max-width:600px){ .veh-file{ grid-template-columns:44px 1fr; } .veh-file > .row-gap{ grid-column:1 / -1; } .veh-file img, .veh-file-icon{ width:44px; height:44px; } }
#linkDlg label{ display:flex; flex-direction:column; gap:4px; margin-bottom:8px; }
#linkDlg #linkOverride{ flex-direction:row; align-items:flex-start; }
.rem-step{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-bottom:8px; }
.rem-step label{ display:flex; flex-direction:column; gap:4px; font-size:13px; }
.rem-step input[type=number]{ width:7em; }
/* Office → Drivers */
.multi-pick{ display:flex; flex-wrap:wrap; gap:6px 14px; padding:4px 0; }
.dq-list{ list-style:none; padding:0; margin:0 0 6px; display:grid; gap:4px; }
.dq-list li.expired{ color:var(--critical); }
.dq-list li.ok{ color:var(--good); }
.item-grid .multi-pick label.na-check, .multi-pick .na-check{ display:inline-flex; flex-direction:row; align-items:center; gap:6px; font-weight:500; }
/* Reports → IFTA */
.ifta-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:16px; margin-top:8px; }
.ifta-truck h4{ margin:0 0 6px; }
.ifta-table tfoot th{ border-top:2px solid var(--border); }
#printArea .ifta-grid{ grid-template-columns:1fr 1fr; }

/* vehicle view */
#vehDlg{ width:min(940px, calc(100vw - 32px)); padding-top:18px; }
#vehDlg #vehTitle{ margin:0; font-size:20px; }
.veh-head{ display:flex; flex-direction:column; gap:10px; padding-bottom:12px; border-bottom:1px solid var(--border); }
.veh-id{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-weight:600; }
.veh-id .chip .chip{ border:0; padding:0; }
.veh-facts{ display:flex; flex-wrap:wrap; gap:8px 28px; }
.veh-facts > div{ display:flex; flex-direction:column; }
.veh-facts b{ font-size:17px; }
.veh-due{ display:flex; flex-wrap:wrap; gap:6px; }
.veh-tabs{ display:flex; gap:4px; padding:6px 0 0; border-bottom:2px solid var(--brand-accent); position:sticky; top:-18px; z-index:5; background:var(--surface-1); overflow-x:auto; scrollbar-width:none; margin-top:-4px; }
.veh-tabs button{ font:inherit; font-size:13px; font-weight:600; padding:9px 18px; border:1px solid var(--border); border-bottom:0; border-radius:8px 8px 0 0;
  background:var(--surface-2); color:var(--text-secondary); cursor:pointer; white-space:nowrap; }
.veh-tabs button:hover{ color:var(--text-primary); background:var(--surface-1); border-color:var(--brand-accent); }
.veh-tabs button[aria-selected="true"]{ background:var(--brand-accent); border-color:var(--brand-accent); color:#fff; }
.veh-pane{ align-content:start; min-height:240px; }
.veh-pane > .stats{ margin:2px 0; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); }
.veh-pane > .stats b{ font-size:20px; }
.stats div.good b{ color:var(--good); }
.stats div.bad b{ color:var(--critical); }
.veh-pane h4{ margin:6px 0 2px; }
.veh-edit-head{ margin-top:18px !important; padding-top:12px; border-top:1px dashed var(--border); color:var(--text-primary) !important; font-size:14px !important; }
.veh-due-table{ width:auto; min-width:min(420px,100%); }
.veh-notes{ white-space:pre-wrap; margin:0; }
details.how{ font-size:12px; color:var(--text-secondary); }
details.how summary{ cursor:pointer; font-weight:600; }
details.how p{ margin:6px 0; }
/* folding card: <details class="card fold"><summary><h3>…</h3> extra</summary> */
details.card.fold > summary{ cursor:pointer; list-style:none; display:flex; align-items:baseline; gap:10px; }
details.card.fold > summary::-webkit-details-marker{ display:none; }
details.card.fold > summary h3{ margin:0; }
details.card.fold > summary::before{ content:"▸"; color:var(--text-secondary); }
details.card.fold[open] > summary::before{ content:"▾"; }
details.card.fold[open] > summary{ margin-bottom:10px; }
.veh-read-add{ margin-bottom:6px; }
/* sub-tabs (Setup → Company and friends): same look as the vehicle tabs */
.sub-tabs{ display:flex; gap:4px; padding-top:4px; border-bottom:2px solid var(--brand-accent); margin-bottom:14px; overflow-x:auto; scrollbar-width:none; }
.sub-tabs button{ font:inherit; font-size:13px; font-weight:600; padding:9px 18px; border:1px solid var(--border); border-bottom:0; border-radius:8px 8px 0 0;
  background:var(--surface-2); color:var(--text-secondary); cursor:pointer; white-space:nowrap; }
.sub-tabs button:hover{ color:var(--text-primary); background:var(--surface-1); border-color:var(--brand-accent); }
.sub-tabs button[aria-selected="true"]{ background:var(--brand-accent); border-color:var(--brand-accent); color:#fff; }
#coForm .item-grid label{ display:flex; flex-direction:column; gap:4px; font-size:13px; font-weight:600; color:var(--text-secondary); }
#coForm .item-grid input{ width:100%; }
/* Board: columns scroll on their own (the page stays one screen tall), trucks in a sidebar, optional compact cards */
.dmain{ display:grid; grid-template-columns:minmax(0,1fr) 250px; gap:12px; align-items:start; }
.dmain .dboard{ min-width:0; }
.dcol{ max-height:calc(100vh - 250px); overflow-y:auto; }
.dcol h3{ position:sticky; top:-8px; background:var(--surface-2); z-index:1; margin:-8px -8px 4px; padding:10px 12px 6px; border-radius:12px 12px 0 0; }
.dside{ margin:0; position:sticky; top:8px; max-height:calc(100vh - 170px); overflow-y:auto; }
.dside h3{ display:flex; justify-content:space-between; align-items:baseline; }
.dside .dtrucks{ grid-template-columns:1fr; gap:6px; }
.dside .dtruck{ padding:6px 10px; }
.dlower{ grid-template-columns:1fr; }
.dboard.compact .dcard{ padding:6px 8px; gap:1px; margin-bottom:6px; }
.dboard.compact .dcard .dloc, .dboard.compact .dcard .dphone, .dboard.compact .dcard > .small:not(.bad-text):not(.warn-text){ display:none; }
.dboard.compact .dcard footer{ margin-top:2px; }
@media (max-width:1100px){ .dmain{ grid-template-columns:1fr; } .dside{ position:static; max-height:none; } .dside .dtrucks{ grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); } }
@media (max-width:720px){ .dcol{ max-height:none; } }
.dside .dtruck{ flex-direction:row; flex-wrap:wrap; align-items:baseline; column-gap:8px; }
.dside .dtruck b{ flex:1 0 100%; font-size:13px; }
/* Profitability matrix: scrolls both ways inside its card; Truck column, header row and Total row stay put */
.pm-scroll{ max-height:calc(100vh - 230px); }
#profitTable th, #profitTable td{ white-space:nowrap; }
#profitTable tr.pm-total td{ position:sticky; bottom:0; background:var(--surface-2); box-shadow:inset 0 1px 0 var(--border); z-index:1; }
#profitTable tr.pm-total td:first-child{ z-index:2; }
/* Fleet → Maintenance */
.mt-filters{ margin:0 0 10px; align-items:end; }
#maintDlg .item-grid h4{ margin-top:6px; }
/* Office → Lots */
.lots-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(320px,1fr)); gap:12px; }
.lot-card{ margin:0; display:flex; flex-direction:column; gap:6px; }
.lot-card p{ margin:0; }
.lot-card.lot-off{ opacity:.6; }
.lot-head{ display:flex; justify-content:space-between; align-items:center; gap:8px; }
.lot-head h3{ margin:0; }
.lot-occ{ display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; padding:8px 10px; background:var(--surface-2); border-radius:8px; }
.lot-occ b{ font-size:20px; }
.lot-lic .chip{ margin:2px 4px 2px 0; }
.lots-company{ margin-bottom:10px; }
.addr-row{ display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr); gap:10px; }
@media (max-width:620px){ .addr-row{ grid-template-columns:1fr 1fr; } .addr-row label:first-child{ grid-column:1 / -1; } }

/* Fuel page: gallons by truck, ranked bars drawn like the Revenue page's (.w svg rules above). */
.tf-head{ display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:4px 16px; margin-bottom:12px; }
.tf-head h3{ margin:0; } .tf-head p{ margin:0; color:var(--text-secondary); }
.tf-charts{ display:grid; grid-template-columns:minmax(0,3fr) minmax(0,2fr); gap:12px; align-items:start; margin-bottom:10px; }
.tf-charts svg{ display:block; width:100%; overflow:visible; }
.tf-charts g.row{ cursor:pointer; outline:none; }
.tf-charts g.row.on text{ font-weight:700; fill:var(--text-primary); }
.tf-charts g.row:focus-visible .hit{ stroke:var(--focus); stroke-width:2; }
@media (max-width:760px){ .tf-charts{ grid-template-columns:minmax(0,1fr); } }
.fill-status{ font:inherit; font-size:12px; font-weight:600; background:none; border:1px solid var(--border); border-radius:99px; padding:1px 9px; cursor:pointer; white-space:nowrap; color:var(--text-secondary); }
.fill-status:hover{ border-color:var(--brand-accent); }
.fill-status.warn{ color:var(--warning); border-color:currentColor; } .fill-status.ok{ color:var(--good); border-color:currentColor; } .fill-status.bad{ color:var(--critical); border-color:currentColor; }
.review-sum button{ font:inherit; background:none; border:0; padding:0; color:var(--brand-accent); cursor:pointer; text-decoration:underline; }
.fill-dlg section{ border-top:1px solid var(--border); padding-top:12px; }
.fill-dlg h4{ margin:0 0 8px; }
.fill-dlg .row-gap{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.fill-tickets{ max-height:170px; overflow:auto; border:1px solid var(--border); border-radius:8px; margin:6px 0; }
.fill-tickets label{ display:flex; flex-direction:row; align-items:flex-start; gap:8px; padding:7px 10px; font-weight:400; color:inherit; cursor:pointer; border-top:1px solid var(--grid); }
.fill-tickets label:first-child{ border-top:0; }
.fill-tickets input{ width:auto; margin-top:2px; }
.tank-track{ position:relative; height:22px; background:var(--grid); border-radius:6px; overflow:hidden; }
.tank-track i{ position:absolute; left:0; top:0; display:block; height:100%; background:var(--series-1); border-radius:0 6px 6px 0; transition:width .25s ease; }
#tankMax{ opacity:.3; }
.tank-track.low i{ background:var(--warning); }
#tankNote{ margin:8px 0 0; }
.tank-more{ margin-top:8px; } .tank-more summary{ cursor:pointer; color:var(--brand-accent); } .tank-more .table-wrap{ margin-top:8px; }
.fuel-range{ display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px 14px; margin-bottom:12px; }
.fuel-range label{ display:flex; flex-direction:column; gap:2px; font-size:12px; font-weight:600; color:var(--text-secondary); }
.fuel-range .presets{ flex-wrap:wrap; }
#fuelTrendCard .w{ margin-bottom:8px; }
.tf-splits{ display:grid; grid-template-columns:repeat(auto-fit, minmax(290px,1fr)); gap:14px; align-items:start; }
.tf-splits .data-table th, .tf-splits .data-table td{ padding-left:6px; padding-right:6px; font-size:12px; }
#truckFuelTitle{ outline:none; }
.tf-splits h4{ margin-bottom:6px; }
.tf-list{ max-height:320px; overflow:auto; }
#truckFuelDlg{ width:min(1000px, calc(100vw - 32px)); }
/* Driver pay plan editor (dispatch-payroll.js) */
.pay-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(200px,1fr)); gap:10px; margin:8px 0; }
.pay-grid label{ display:flex; flex-direction:column; gap:4px; font-size:12px; font-weight:600; color:var(--text-secondary); }
.pay-box{ border:1px solid var(--border); border-radius:10px; padding:8px 12px; margin:10px 0; }
.pay-box legend{ font-size:12px; font-weight:700; color:var(--text-secondary); padding:0 4px; }
.pay-box .row-gap{ margin:4px 0; }

/* Reports → Targets: one small chart per truck / driver. Status colors are the theme's good / warning / critical. */
#filters.dates-only select[data-dim]{ display:none; }
.tg-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); gap:12px; margin-bottom:14px; }
.tg-card{ margin:0; border-top:3px solid var(--border); }
.tg-card.tg-good{ border-top-color:var(--good); } .tg-card.tg-warn{ border-top-color:var(--warning); } .tg-card.tg-bad{ border-top-color:var(--critical); }
.tg-head{ display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.tg-head h3{ margin:0; }
.tg-pct{ font-size:22px; font-weight:700; }
.tg-good .tg-pct, .tg-good-text, .stats .tg-good b{ color:var(--good); }
.tg-warn .tg-pct, .tg-warn-text, .stats .tg-warn b{ color:var(--warning); }
.tg-bad .tg-pct, .tg-bad-text, .stats .tg-bad b{ color:var(--critical); }
.tg-nums{ margin:2px 0 4px; } .tg-nums b{ font-size:18px; }
.tg-card svg{ width:100%; display:block; }
.tg-card svg text{ font-size:11px; fill:var(--text-muted); }
/* Fleet → Vehicles quick status */
select.veh-status{ font-size:12px; padding:2px 4px; border-radius:6px; }
select.veh-status.warn{ color:var(--warning); }
select.veh-status.off{ color:var(--text-muted); }
