/* NAS App — Apple-style interface (light + dark) */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", "Segoe UI", system-ui, sans-serif;

  --bg: #ececee;
  --bg-topbar: rgba(236, 236, 238, 0.72);
  --bg-bar: rgba(255, 255, 255, 0.72);
  --card: #ffffff;
  --col-bg: rgba(0, 0, 0, 0.035);
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #8e8e93;
  --separator: rgba(60, 60, 67, 0.14);
  /* medium grey, heavier than --separator: used only for the timeline row dividers */
  --sched-divider: #a1a1a6;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.20);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --seg-thumb: #ffffff;
  --green: #34c759;
  --red: #ff3b30;
  --amber: #ff9500;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.07), 0 14px 30px rgba(0, 0, 0, 0.07);
  --card-shadow-hover: 0 6px 14px rgba(0, 0, 0, 0.10), 0 18px 40px rgba(0, 0, 0, 0.10);
  --topbar-border: rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --tag-text-mix: 34%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --bg-topbar: rgba(18, 18, 20, 0.72);
    --bg-bar: rgba(28, 28, 30, 0.72);
    --card: #1c1c1e;
    --col-bg: rgba(255, 255, 255, 0.045);
    --label: #f5f5f7;
    --label-2: #a1a1a6;
    --label-3: #8e8e93;
    --separator: rgba(255, 255, 255, 0.11);
    --sched-divider: #58585c;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.40);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.22);
    --seg-thumb: #636366;
    --green: #30d158;
    --red: #ff453a;
    --amber: #ff9f0a;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 26px rgba(0, 0, 0, 0.55);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.55), 0 14px 34px rgba(0, 0, 0, 0.6);
    --topbar-border: rgba(255, 255, 255, 0.10);
    --tag-text-mix: 100%;
  }
}

:root[data-theme="light"] {
  --bg: #ececee; --bg-topbar: rgba(236,236,238,0.72); --bg-bar: rgba(255,255,255,0.72);
  --card: #ffffff; --col-bg: rgba(0,0,0,0.035);
  --label: #1d1d1f; --label-2: #6e6e73; --label-3: #8e8e93;
  --separator: rgba(60,60,67,0.14); --sched-divider: #a1a1a6;
  --fill: rgba(118,118,128,0.12); --fill-strong: rgba(118,118,128,0.20);
  --accent: #0071e3; --accent-soft: rgba(0,113,227,0.12); --seg-thumb: #ffffff;
  --green: #34c759; --red: #ff3b30; --amber: #ff9500;
  --card-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.07), 0 14px 30px rgba(0,0,0,0.07);
  --card-shadow-hover: 0 6px 14px rgba(0,0,0,0.10), 0 18px 40px rgba(0,0,0,0.10);
  --topbar-border: rgba(0,0,0,0.08); --tag-text-mix: 34%;
}
:root[data-theme="dark"] {
  --bg: #121214; --bg-topbar: rgba(18,18,20,0.72); --bg-bar: rgba(28,28,30,0.72);
  --card: #1c1c1e; --col-bg: rgba(255,255,255,0.045);
  --label: #f5f5f7; --label-2: #a1a1a6; --label-3: #8e8e93;
  --separator: rgba(255,255,255,0.11); --sched-divider: #58585c;
  --fill: rgba(118,118,128,0.24); --fill-strong: rgba(118,118,128,0.40);
  --accent: #0a84ff; --accent-soft: rgba(10,132,255,0.22); --seg-thumb: #636366;
  --green: #30d158; --red: #ff453a; --amber: #ff9f0a;
  --card-shadow: 0 1px 2px rgba(0,0,0,0.5), 0 8px 26px rgba(0,0,0,0.55);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.55), 0 14px 34px rgba(0,0,0,0.6);
  --topbar-border: rgba(255,255,255,0.10); --tag-text-mix: 100%;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* shared line-glyph icon */
.mi {
  width: 13px; height: 13px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -2px; color: var(--label-3);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  background: var(--card);
  color: var(--label);
  border-bottom: 1px solid var(--topbar-border);
  flex: 0 0 auto;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-badge {
  background: linear-gradient(160deg, #2f6fb2, #12263a);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.brand-logo { height: 42px; width: auto; max-width: 240px; display: block; object-fit: contain; }
.brand-logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo-dark { display: block; }
}

#search {
  width: 260px;
  padding: 8px 12px;
  border-radius: 9px;
  border: none;
  background: var(--fill);
  color: var(--label);
  font-size: 13.5px;
  font-family: inherit;
}
#search::placeholder { color: var(--label-3); }
#search:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 500;
  font-size: 13px;
  padding: 8px 15px;
  border-radius: 9px;
  cursor: pointer;
  letter-spacing: -0.01em;
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-icon {
  border: none;
  background: var(--fill);
  color: var(--label);
  width: 34px; height: 34px;
  border-radius: 9px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.btn-icon:hover { background: var(--fill-strong); }
.theme-ic {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
/* ---------- Settings popover ---------- */
.settings { position: relative; display: inline-flex; }
.settings-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 218px; z-index: 60;
  background: var(--card); border: 1px solid var(--separator);
  border-radius: 12px; box-shadow: var(--card-shadow-hover);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.set-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: none; background: transparent; color: var(--label);
  font: inherit; font-size: 13.5px; font-weight: 500; letter-spacing: -0.01em;
  cursor: pointer; padding: 9px 10px; border-radius: 8px;
}
.set-menu-item:hover { background: var(--fill); }
.set-menu-item span { flex: 1; }
.set-menu-item .mi { width: 17px; height: 17px; color: var(--label-2); }
.set-menu-item .set-chev { width: 15px; height: 15px; color: var(--label-3); }

/* segmented controls — shared by the preferences panel */
.set-seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.set-seg button {
  flex: 1; border: none; background: transparent; color: var(--label-2);
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em;
  padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.set-seg button:hover { color: var(--label); }
.set-seg button.on {
  background: var(--seg-thumb); color: var(--label);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16), 0 1px 1px rgba(0, 0, 0, 0.06);
}
/* Bookings toolbar All/Fit timeline-zoom toggle: compact, not stretched */
.sched-fit-seg { flex: 0 0 auto; }
.sched-fit-seg button { flex: 0 0 auto; padding: 5px 12px; }

/* ---------- User Preferences ---------- */
.prefs-body { padding: 4px 22px 20px; display: flex; flex-direction: column; }
.pref-cat { padding: 14px 0; border-top: 1px solid var(--separator); }
.pref-cat:first-child { border-top: none; }
.pref-cat-title {
  margin: 0 0 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-3);
}
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; }
.pref-row-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pref-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.pref-desc { font-size: 12px; color: var(--label-2); }
.pref-row .set-seg { flex: 0 0 auto; }
.pref-control { flex: 0 0 auto; }
.toast-control { display: flex; align-items: center; gap: 12px; }
.toast-control input[type="range"] { width: 150px; accent-color: var(--accent); cursor: pointer; }
.pref-val { min-width: 32px; text-align: right; font-size: 13px; font-weight: 600; color: var(--label); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .pref-row { flex-direction: column; align-items: stretch; gap: 9px; }
  .toast-control input[type="range"] { width: 100%; }
}

/* ---------- Admin Options (temporary local user management) ---------- */
.admin-body { padding: 14px 22px 22px; }
.admin-listhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.admin-listcap { font-size: 13px; font-weight: 600; color: var(--label-2); }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-empty { padding: 22px; text-align: center; color: var(--label-3); font-size: 13px; }
.admin-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--separator); border-radius: 12px; padding: 11px 13px; background: var(--card);
}
.admin-avatar {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #4bb0ff); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.admin-meta { flex: 1; min-width: 0; }
.admin-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.admin-email { font-size: 12.5px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-secs { font-size: 11.5px; color: var(--label-3); margin-top: 2px; }
.admin-role {
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.01em;
  background: var(--fill); color: var(--label-2);
}
.admin-role-admin { background: color-mix(in srgb, var(--accent) 16%, transparent); color: color-mix(in srgb, var(--accent) 62%, var(--label)); }
.admin-role-dispatcher { background: color-mix(in srgb, var(--green) 16%, transparent); color: color-mix(in srgb, var(--green) 55%, var(--label)); }
.admin-role-viewer { background: var(--fill-strong); color: var(--label-2); }
.admin-actions { flex: 0 0 auto; }
.admin-edit { padding: 7px 13px; font-size: 12.5px; }
.admin-sections { margin-top: 16px; }
.admin-sections-cap { font-size: 12px; font-weight: 500; color: var(--label-2); }
.admin-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 9px; }
.admin-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--label); cursor: pointer; }
.admin-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.theme-ic-dark { display: none; }
:root[data-theme="dark"] .theme-ic-light { display: none; }
:root[data-theme="dark"] .theme-ic-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-ic-light { display: none; }
  :root:not([data-theme="light"]) .theme-ic-dark { display: block; }
}

/* ---------- Timeline strip ---------- */
.timeline-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 22px;
  background: var(--card);
  border-bottom: 1px solid var(--separator);
  flex: 0 0 auto;
}

.timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  flex: 1;
  padding-bottom: 2px;
}
.timeline::-webkit-scrollbar { display: none; }

/* working-week divider (between Saturday and Sunday) */
.tl-week-sep {
  flex: 0 0 auto;
  align-self: stretch;
  width: 2px;
  margin: 6px 2px;
  border-radius: 2px;
  background: var(--fill-strong);
}

.tl-day {
  flex: 0 0 58px;
  border-radius: 12px;
  padding: 3px 0 3px;
  text-align: center;
  cursor: pointer;
  background: transparent;
  user-select: none;
  color: var(--label-2);
  transition: background .15s;
}
.tl-day:hover { background: var(--fill); }
.tl-day .dow { font-size: 11px; font-weight: 500; line-height: 1.1; text-transform: uppercase; color: var(--label-2); letter-spacing: 0.03em; }
.tl-day .dom {
  font-size: 18px; font-weight: 600; line-height: 24px;
  color: var(--label);
  width: 24px; height: 24px; margin: 1px auto;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.tl-day .mon { font-size: 10px; line-height: 1.1; color: var(--label-3); }
.tl-day .count {
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--accent);
  min-height: 11px;
  font-variant-numeric: tabular-nums;
}
.tl-day.is-weekend .dow, .tl-day.is-weekend .dom { color: var(--label-3); }
.tl-day.is-today .dom { background: var(--accent); color: #fff; }
.tl-day.is-today .dow { color: var(--accent); }
.tl-day.is-selected { background: var(--accent-soft); }
.tl-day.is-selected .dom { color: var(--accent); }
.tl-day.is-selected.is-today .dom { background: var(--accent); color: #fff; }

.tl-nav, .tl-today, .tl-all {
  border: none;
  background: var(--fill);
  border-radius: 9px;
  cursor: pointer;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
  padding: 0 13px;
  height: 34px;
  flex: 0 0 auto;
}
.tl-nav { font-size: 18px; line-height: 1; width: 34px; padding: 0; }
.tl-nav:hover, .tl-today:hover, .tl-all:hover { background: var(--fill-strong); }

/* ---------- Board ---------- */
main { flex: 1; overflow: hidden; display: flex; }

.board {
  display: flex;
  gap: 16px;
  padding: 20px 22px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
}

.col {
  flex: 1 1 0;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  background: var(--col-bg);
  border-radius: 16px;
  max-height: 100%;
}

.col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px 11px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.col-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--col-color, var(--accent)); }
.col-head .n {
  margin-left: auto;
  background: var(--fill);
  color: var(--label-2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}

.col-body {
  flex: 1;
  overflow-y: auto;
  padding: 2px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.col-body.drag-over { background: var(--accent-soft); border-radius: 0 0 16px 16px; }

.card {
  position: relative;
  overflow: hidden;
  /* keep full height in a crowded column: as flex children these would otherwise
     shrink (flex-shrink defaults to 1) and squash instead of letting .col-body scroll */
  flex: 0 0 auto;
  background: var(--card);
  border-radius: 13px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--separator);
  padding: 12px 13px;
  cursor: grab;
  transition: transform .16s ease, box-shadow .16s ease;
}
/* vehicle-classification colour strip across the top of a job card
   (segments split left-to-right for a multi-class job; grey when unassigned) */
.card-cbar { position: absolute; top: 0; left: 0; right: 0; height: 5px; }
.card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.5; transform: none; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card .ref-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.card .ref { font-size: 12px; font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums; }
/* HX Load ID chip on a card, alongside the NAS job number ("N/A" when not HX) */
.card .load-id { font-size: 10.5px; font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums;
  background: var(--fill); border-radius: 5px; padding: 1px 6px; }
.card .load-id[data-na] { color: var(--label-3); font-weight: 500; }
/* driver sub-status chip beside the main status tag */
.card .sub-tag { font-size: 10.5px; font-weight: 600; color: var(--label-2); background: var(--fill); border-radius: 5px; padding: 1px 6px; }
.card .price {
  margin-left: auto;
  font-size: 14px; font-weight: 600;
  color: var(--label);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.card .tag {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px;
  letter-spacing: -0.01em; white-space: nowrap;
  background: color-mix(in srgb, var(--sc) 15%, transparent);
  color: color-mix(in srgb, var(--sc) var(--tag-text-mix), var(--label));
}
.card .customer { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0 3px; }
.card .route { font-size: 12.5px; color: var(--label-2); margin-bottom: 2px; }
.card .route .arrow { color: var(--label-3); font-weight: 500; }
.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--label-2);
}
.card .meta span { display: inline-flex; align-items: center; gap: 4px; }
.card .meta b { color: var(--label); font-weight: 600; font-variant-numeric: tabular-nums; }
.card .meta .unassigned { color: var(--amber); font-weight: 600; }
.card .notes {
  margin-top: 9px; padding-top: 8px;
  border-top: 1px solid var(--separator);
  font-size: 11.5px; color: var(--label-2); line-height: 1.35;
}

.empty-col { font-size: 12.5px; color: var(--label-3); text-align: center; padding: 14px 0; }
/* Finance placeholder view (new section, awaiting its tools) */
.fin-placeholder { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; max-width: 460px; margin: 48px auto; }
.fin-placeholder .mi { width: 40px; height: 40px; color: var(--label-3); margin-bottom: 4px; }
.fin-ph-title { font-size: 16px; font-weight: 600; color: var(--label); margin: 0; }
.fin-ph-sub { font-size: 13.5px; line-height: 1.55; color: var(--label-2); margin: 0; }

/* ---------- Finance: nominal codes ---------- */
.fin-subnav { display: inline-flex; margin: 4px 0 16px; }
.fin-subnav button:disabled { opacity: .5; cursor: default; }
.fin-sub-head { margin-bottom: 10px; }
.fin-sub-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--label); }
.nom-add { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.nom-add input { flex: 1 1 180px; min-width: 120px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--label); font-size: 13.5px; }
.nom-add input:first-child { flex: 0 0 150px; }
.nom-add button { flex: 0 0 auto; }
.nom-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--line); max-height: calc(100vh - 320px); overflow-y: auto; }
.nom-table td.nom-code { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--label); white-space: nowrap; width: 90px; }
.nom-table td.nom-actions { text-align: right; white-space: nowrap; width: 1%; }
.nom-table .nom-input { width: 100%; padding: 5px 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--card); color: var(--label); font-size: 13px; }
.nom-actions button { margin-left: 6px; }
.ac-ref { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--label-2); background: var(--fill); border-radius: 5px; padding: 1px 6px; font-size: 11.5px; margin-right: 2px; }

/* Stub customer flag — name-only record created from the booking form, not yet fleshed out */
.incomplete-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  vertical-align: middle; margin-left: 6px; padding: 1px 6px; border-radius: 5px;
  background: color-mix(in srgb, var(--amber) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent);
  color: color-mix(in srgb, var(--amber) var(--tag-text-mix, 55%), var(--label));
}

/* Inline "Create" button that appears in the booking form's Customer field when the typed name has no match */
.cust-field { display: flex; align-items: center; gap: 6px; }
.cust-field > input { flex: 1 1 auto; min-width: 0; }
.cust-create {
  flex: 0 0 auto; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  border-radius: 7px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  white-space: nowrap;
}
.cust-create:hover { filter: brightness(1.05); }
.cust-create.hidden { display: none; }

/* ---------- Finance: Invoice import review grid ---------- */
.inv-prof { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--accent); background: var(--fill); border-radius: 5px; padding: 2px 7px; vertical-align: middle; margin-left: 4px; }
.inv-flagcount { color: #b26a00; }
.inv-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 10px; flex-wrap: wrap; }
.inv-extra { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--label-2); font-weight: 600; }
.inv-extra input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--label); font-size: 13.5px; min-width: 220px; font-variant-numeric: tabular-nums; }
.inv-totals { font-size: 13px; color: var(--label-2); }
.inv-totals b { color: var(--label); font-variant-numeric: tabular-nums; }
.inv-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 340px); }
.inv-table { font-size: 12.5px; table-layout: fixed; width: 100%; }
.inv-table th { white-space: nowrap; font-size: 11px; padding: 4px 6px; line-height: 1.15; vertical-align: bottom; }
/* beat the base .ck-table td padding (8px 10px, defined later) that was eating
   ~20px of width from every cell and truncating the data */
.ck-table.inv-table td { padding: 0; }
/* ~65% of the previous row height: tight inputs */
.inv-table td.inv-cell input, .inv-table td.inv-cell select { width: 100%; min-width: 0; border: 0; background: transparent; padding: 1px 5px; color: var(--label); font-size: 12.5px; font-family: inherit; height: 22px; line-height: 20px; box-sizing: border-box; }
.inv-table td.inv-cell select { padding: 1px 2px; }
.inv-table td.inv-cell input:focus, .inv-table td.inv-cell select:focus { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; background: var(--card); }
.inv-table td.inv-cell input.inv-pick { cursor: pointer; }
.inv-table td.inv-name { padding: 1px 6px; color: var(--label-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-table td.inv-num input { text-align: right; font-variant-numeric: tabular-nums; }
.inv-splitcell { text-align: center; padding: 0; }
.inv-split { border: 0; background: transparent; color: var(--label-3); font-size: 15px; font-weight: 700; line-height: 1; width: 22px; height: 22px; border-radius: 5px; cursor: pointer; }
.inv-split:hover { background: var(--accent); color: #fff; }
/* highlight cells the engine couldn't fill confidently */
.inv-table td.inv-low   { background: rgba(214,158,46,.16); box-shadow: inset 0 0 0 1px rgba(214,158,46,.4); }
.inv-table td.inv-missing { background: rgba(214,69,46,.16); box-shadow: inset 0 0 0 1px rgba(214,69,46,.5); }
.inv-table tr.inv-reviewed td { background: rgba(46,158,91,.07); }
.inv-table tr.inv-manual td.inv-cell input { font-style: italic; }
.inv-rowact { white-space: nowrap; text-align: center; padding: 1px 2px; }
.inv-act { border: 0; background: var(--fill); color: var(--label-2); border-radius: 6px; height: 22px; padding: 0 6px; margin: 0 1px; cursor: pointer; font-size: 11px; }
.inv-act.inv-view { font-weight: 600; }
.inv-act:hover { background: var(--fill-strong); color: var(--label); }
.inv-addrow { margin-top: 10px; }
/* searchable nominal-code picker */
.inv-picker { position: absolute; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); width: 280px; overflow: hidden; }
.inv-picker-search { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; background: var(--bg-bar); color: var(--label); font-size: 13px; box-sizing: border-box; }
.inv-picker-search:focus { outline: none; }
.inv-picker-list { max-height: 260px; overflow-y: auto; }
.inv-picker-opt { padding: 6px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-picker-opt:hover { background: var(--fill); }
.inv-picker-empty { padding: 10px; color: var(--label-3); font-size: 12.5px; }

/* ---------- POD matching panel (under Bookings) ---------- */
/* The POD screen fills the view instead of guessing at the chrome height. The old
   height: calc(100vh - 150px) didn't allow for the section sub-nav, so the panel ran
   past the bottom of the window and took "Assign POD to job" with it. */
#podMatchView { display: flex; flex-direction: column; overflow: hidden; }
#podMatchView.hidden { display: none; }
.pod-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex: 0 0 auto; }
.pod-head h2 { margin: 0; font-size: 18px; font-weight: 600; white-space: nowrap; }
.pod-head h2 .hint { font-weight: 400; }
/* file nav centred in the row, view tools pushed to the right edge */
.pod-filenav { display: flex; align-items: center; gap: 6px; margin: 0 auto; min-width: 0; }
.pod-viewtools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.pod-filenav button, .pod-viewtools button { border: 0; background: var(--fill); color: var(--label);
  border-radius: 6px; height: 28px; min-width: 28px; padding: 0 8px; cursor: pointer; font-size: 14px; }
.pod-filenav button:hover, .pod-viewtools button:hover { background: var(--fill-strong); }
.pod-body { display: flex; gap: 16px; flex: 1 1 auto; min-height: 0; }
.pod-viewer { flex: 2 1 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--fill); }
.pod-fname { font-size: 12px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.pod-canvas { flex: 1; overflow: auto; display: flex; background: #3a3f45; padding: 12px; }
/* margin:auto centres the image when it's smaller than the canvas, but lets every
   edge stay reachable by scrolling once it's zoomed larger than the canvas (flex
   align/justify centering would make the top/left unreachable). */
.pod-canvas img { max-width: 100%; max-height: 100%; margin: auto; transform-origin: center center; transition: transform .12s ease, width .12s ease; user-select: none; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.4); }
.pod-jobs { flex: 1 1 0; min-width: 260px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pod-jobs-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.pod-jobs-head input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--label); font-size: 13px; }
.pod-jobs-list { flex: 1; overflow-y: auto; }
.pod-job { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-bottom: 1px solid var(--separator); cursor: pointer; }
.pod-job:hover { background: var(--fill); }
.pod-job input { margin-top: 3px; }
.pod-job-main { display: flex; flex-direction: column; gap: 1px; font-size: 13px; flex: 1; min-width: 0; }
.pod-job-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pod-job-main b { font-weight: 600; color: var(--label); }
.pod-job-main span { color: var(--label-2); font-size: 12px; }
.pod-hx { color: var(--label-3) !important; font-variant-numeric: tabular-nums; }
.pod-suggested { background: rgba(255,140,26,.12); box-shadow: inset 3px 0 0 #ff8c1a; }
.pod-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: #111; background: #ff8c1a;
  border-radius: 999px; padding: 2px 10px; vertical-align: middle; animation: podBadgePulse 1.4s ease-in-out infinite; }
@keyframes podBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,140,26,.55); }
  50%      { box-shadow: 0 0 10px 3px rgba(255,140,26,.9); }
}
.pod-jobs .btn-primary { margin: 10px 12px; }
/* confidence chip (High / Med / Low) */
.pod-conf { font-size: 10px; font-weight: 700; letter-spacing: .03em; border-radius: 5px; padding: 1px 6px; color: #fff; white-space: nowrap; }
.pod-conf-high { background: #2e9e5b; }
.pod-conf-medium { background: #e0a020; color: #111; }
.pod-conf-low { background: var(--label-3); }
/* ⓘ job-details icon + hover popover */
.pod-info { flex: 0 0 auto; align-self: flex-start; margin-top: 1px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); background: var(--fill); color: var(--label-2); font-size: 11px; font-weight: 700; font-style: italic; line-height: 1; cursor: help; padding: 0; }
.pod-info:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.pod-info-pop { position: absolute; z-index: 90; width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.22); padding: 8px 10px; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .1s ease; }
.pod-info-pop.show { opacity: 1; }
.pod-info-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.pod-info-row span { color: var(--label-3); flex: 0 0 auto; }
.pod-info-row b { color: var(--label); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Docs section on the booking record ---------- */
.booking-docs { margin: 4px 0 2px; border-top: 1px solid var(--separator); padding-top: 12px; }
.booking-docs.hidden { display: none; }
.bd-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bd-head b { font-size: 13px; font-weight: 600; color: var(--label); }
.bd-count { font-size: 11px; font-weight: 600; color: var(--label-2); background: var(--fill); border-radius: 10px; padding: 1px 8px; }
.bd-count:empty { display: none; }
.bd-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.bd-row { display: flex; align-items: center; gap: 12px; background: var(--fill); border-radius: 10px; padding: 8px; }
.bd-thumb { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 8px; overflow: hidden; border: 1px solid var(--separator); background: var(--card); padding: 0; cursor: pointer; }
.bd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-meta { flex: 1 1 auto; min-width: 0; }
.bd-name { font-size: 13px; font-weight: 500; color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-sub { font-size: 11.5px; color: var(--label-2); margin-top: 2px; }
.bd-actions { flex: 0 0 auto; display: flex; gap: 4px; }
.bd-actions .btn-ghost { font-size: 12px; padding: 4px 10px; }
.bd-remove { color: var(--red); }

/* ---------- Day schedule view ---------- */
.day-schedule { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 20px 22px; }
.day-schedule-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.day-schedule-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.day-schedule-head .hint { font-size: 13px; color: var(--label-2); }

.sched-controls { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.sched-select { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--label-2); }
.sched-select select {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--label);
  background-color: var(--fill); border: none; border-radius: 9px;
  padding: 8px 30px 8px 12px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M2.5 4.5L6 8l3.5-3.5'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 11px;
  max-width: 220px;
}
.sched-select select:hover { background-color: var(--fill-strong); }
.sched-select select:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* searchable filter dropdown */
.combo { position: relative; display: inline-flex; }
.combo-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--label);
  background: var(--fill); border: none; border-radius: 9px;
  padding: 8px 10px 8px 12px; cursor: pointer; max-width: 220px;
}
.combo-btn:hover { background: var(--fill-strong); }
.combo-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-btn .mi { width: 12px; height: 12px; color: var(--label-3); flex: 0 0 auto; }
.combo-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); right: 0;
  width: 250px; max-width: 80vw;
  background: var(--card); border: 1px solid var(--separator); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22); padding: 8px;
}
.combo-search {
  width: 100%; font: inherit; font-size: 13px; color: var(--label);
  background: var(--fill); border: none; border-radius: 8px; padding: 8px 11px; margin-bottom: 6px;
}
.combo-search:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.combo-search::placeholder { color: var(--label-3); }
.combo-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; }
.combo-opt {
  flex: none;
  font-size: 13px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--label);
}
.combo-opt:hover { background: var(--fill); }
.combo-opt.sel { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.combo-ref { color: var(--label-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.combo-opt.sel .combo-ref { color: var(--accent); }
.combo-empty { font-size: 12.5px; color: var(--label-3); padding: 10px; text-align: center; }

.schedule-grid {
  flex: 1;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--separator);
  border-radius: 14px;
  position: relative;
}

/* One medium-grey divider between lanes, identical in all three groupings
   (vehicle / driver / customer) so the timeline reads the same however it's sliced. */
.sched-row { display: flex; border-bottom: 1px solid var(--sched-divider); min-height: 56px; }
.sched-row:last-child { border-bottom: none; }
.sched-label {
  flex: 0 0 170px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--label-2);
  border-right: 1px solid var(--separator);
  background: var(--card);
  position: sticky;
  left: 0;
  z-index: 2;
}
.sched-label b { display: block; font-size: 13px; font-weight: 600; color: var(--label); }

/* Timeline stretches to fill the window, but never below 1440px (scrolls under that). */
.sched-track { position: relative; flex: 1 0 1440px; min-width: 1440px; }

.sched-hours { display: flex; height: 100%; position: absolute; inset: 0; }
.sched-hour { flex: 1 1 0; min-width: 0; border-right: 1px solid var(--separator); font-size: 10px; color: var(--label-3); padding: 3px 0 0 5px; font-variant-numeric: tabular-nums; }

.sched-block {
  position: absolute;
  top: 9px;
  height: 74px;
  border-radius: 8px;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 5px 8px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 40px; /* keep very short jobs visible when the timeline scales */
}
/* ---- Edit mode: draggable tiles ---- */
.sched-edit .sched-block { user-select: none; }
.sched-block.editable { cursor: grab; }
.sched-block.editable.dragging { cursor: grabbing; z-index: 5; opacity: 0.96; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34); }
.blk-grip { position: absolute; top: 0; bottom: 0; width: 11px; z-index: 3; cursor: ew-resize; }
.blk-grip.l { left: 0; } .blk-grip.r { right: 0; }
/* a subtle grab bar appears on hover so the resize edges are discoverable */
.sched-block.editable:hover .blk-grip::after {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%); left: 3px;
  width: 3px; height: 42%; border-radius: 2px; background: rgba(255, 255, 255, 0.85);
}
.sched-block.editable:hover .blk-grip.r::after { left: auto; right: 3px; }
#schedDragLabel {
  position: fixed; z-index: 130; background: var(--label); color: var(--card);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28); opacity: 0; transition: opacity .08s ease;
}
#schedDragLabel.show { opacity: 1; }
/* two-column tile rows: left field left-aligned, right field right-aligned */
.sched-block .tb-row { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.sched-block .tb-l { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-block .tb-r { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; opacity: 0.95; font-variant-numeric: tabular-nums; }
.sched-block .tb-status { margin-top: auto; }
.sched-block .tb-status .tb-r { font-weight: 700; opacity: 1; }
.sched-block .tb-hx {
  font-size: 8px; font-weight: 800; letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.28); border-radius: 3px; padding: 0 3px; vertical-align: 1px;
}
/* completed job — grey and receded so finished work doesn't compete with live jobs.
   #8e8e93 is the app's neutral grey (statusMeta's fallback) and keeps the white
   tile text legible in both themes; hover restores full contrast to read it. */
.sched-block.is-done {
  background: #8e8e93;
  box-shadow: none;
  opacity: 0.62;
  transition: opacity .16s ease;
}
.sched-block.is-done:hover { opacity: 1; }

.sched-head-row { display: flex; border-bottom: 1px solid var(--separator); position: sticky; top: 0; background: var(--card); z-index: 3; min-height: 18px; }
.sched-head-row .sched-label { background: var(--card); padding-top: 3px; padding-bottom: 3px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sched-head-row .sched-label b { line-height: 1.2; }
/* filter icon to the right of the header title */
.sched-hfilter {
  border: none; background: transparent; cursor: pointer; flex: 0 0 auto;
  padding: 2px; border-radius: 5px; color: var(--label-3); display: inline-flex; align-items: center;
}
.sched-hfilter:hover { background: var(--fill); color: var(--label-2); }
.sched-hfilter.active { color: var(--accent); }
.sched-hfilter .mi { width: 14px; height: 14px; }
/* clearer, higher-contrast hour labels */
.sched-head-row .sched-hour { color: var(--label-2); font-weight: 600; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: var(--card);
  border-radius: 16px;
  width: 620px;
  max-width: 94vw;
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid var(--separator);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 2px;
}
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.modal-head-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.modal-origin:empty { display: none; }
.modal-origin .job-logo { height: 20px; max-width: 92px; }
/* Status control lives in the header, right-aligned, clear of the close button */
.modal-head-actions { display: flex; align-items: center; gap: 10px; }
.head-status {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--label);
  background: var(--fill); border: 1px solid var(--separator);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.head-status:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-close {
  border: none;
  background: var(--fill);
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--label-2);
  cursor: pointer;
  line-height: 1;
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--fill-strong); }

#bookingForm { padding: 16px 22px 22px; }

/* Left fields are a 3-column grid; Vehicles/Drivers sit in their own right-hand
   column so their vertical growth never stretches the left rows (which would
   leave big gaps under the other fields). */
.booking-layout { display: grid; grid-template-columns: 3fr 1fr; gap: 14px 16px; align-items: start; }
.form-side { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; align-items: start; }
.form-grid .col2 { grid-column: 2; }        /* keep Destination in column 2, aligned under Pickup */
.form-grid .span-3 { grid-column: 1 / -1; }  /* HX Load Notes / NAS Notes span the full 3 columns */
/* collapse as the window narrows so it never overflows */
@media (max-width: 900px) {
  .booking-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .col2 { grid-column: auto; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* min-width:0 lets grid items shrink; without it a date/time/select control's
   intrinsic width blows the 1fr columns past the modal and clips the right side. */
.form-grid label, .booking-layout label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--label-2); min-width: 0; }
.form-grid input, .form-grid select, .form-grid textarea,
.booking-layout input, .booking-layout select, .booking-layout textarea {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--separator);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--label);
  background: var(--card);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.booking-layout input:focus, .booking-layout select:focus, .booking-layout textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* Load Notes grows downward to show all its content */
.booking-layout textarea { resize: none; line-height: 1.4; min-height: 40px; overflow: hidden; }
/* Load Notes is read-only — auto-filled from the Haulage Exchange load, not editable */
.booking-layout textarea[readonly] { background: var(--fill); cursor: default; }
.booking-layout textarea[readonly]:focus { border-color: var(--separator); box-shadow: none; }
/* read-only identity field (HX Load ID) — clearly non-editable */
.booking-layout input.ro-field { background: var(--fill); cursor: default; color: var(--label-2); font-variant-numeric: tabular-nums; }
.booking-layout input.ro-field:focus { border-color: var(--separator); box-shadow: none; }
/* disabled placeholder fields (e.g. NAS Notes, reserved for a future feature) */
.form-grid input:disabled, .booking-layout input:disabled { background: var(--fill); color: var(--label-3); cursor: not-allowed; -webkit-text-fill-color: var(--label-3); }

/* multiple vehicle / driver rows in the booking form */
.multi { display: flex; flex-direction: column; gap: 6px; }
.multi-row { display: flex; align-items: center; gap: 6px; }
.multi-row select { flex: 1; min-width: 0; }
/* per-vehicle trailer picker (Phase 2): sits below the vehicle row */
.veh-entry { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.trailer-select { width: 100%; margin: 0 38px 0 0; }
.trailer-select.hidden { display: none; }
.rf-check { display: flex; align-items: center; gap: 8px; }
.rf-check input { width: auto; }
@keyframes trlFlash { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,149,0,0); } 50% { box-shadow: 0 0 0 3px rgba(255,149,0,.55); } }
.trailer-select.flash { animation: trlFlash .5s ease-in-out 3; }
.multi-remove {
  flex: 0 0 auto; width: 32px; height: 36px; border: none; border-radius: 8px;
  background: var(--fill); color: var(--label-2); font-size: 17px; line-height: 1; cursor: pointer;
}
.multi-remove:hover { background: var(--fill-strong); color: var(--red); }
.multi-add {
  align-self: flex-start; margin-top: 6px; padding: 4px 2px;
  border: none; background: transparent; color: var(--accent);
  font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.multi-add .mi { width: 13px; height: 13px; color: var(--accent); }
.multi-add:hover { text-decoration: underline; }

/* per-driver shift times: shown under a driver row once that driver is picked */
.driver-entry { display: flex; flex-direction: column; gap: 6px; }
.driver-shift { display: flex; gap: 10px; padding: 0 0 4px 4px; }
.driver-shift.hidden { display: none; }
.driver-shift .split-item { gap: 4px; font-size: 11px; color: var(--label-3); }

.split { display: flex; gap: 10px; min-width: 0; }
.split-item { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; }
.modal-actions .spacer { flex: 1; }

.btn-ghost {
  background: var(--fill);
  border: none;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--label);
  font-family: inherit;
}
.btn-ghost:hover { background: var(--fill-strong); }
.btn-danger {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  border: none;
  color: var(--red);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: color-mix(in srgb, var(--red) 22%, transparent); }

/* ---------- Haulage Exchange queue ---------- */
.hx-count {
  background: var(--red);
  color: #fff;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  font-variant-numeric: tabular-nums;
}
.hx-count.none { background: var(--fill-strong); color: var(--label-3); }

.hx-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  background: var(--card);
  border-left: 1px solid var(--separator);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.22);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform .25s cubic-bezier(.32, .72, .28, 1);
  will-change: transform;
}
/* Slide the right-hand drawers off-screen rather than display:none, so they
   animate in and out. Higher specificity + !important beats the global
   .hidden { display:none }. pointer-events off while parked so the off-screen
   panel can't catch clicks; shadow hidden so it doesn't peek past the edge. */
.hx-drawer.hidden {
  display: flex !important;
  transform: translateX(100%);
  pointer-events: none;
  box-shadow: none;
}

.hx-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--separator);
}
.hx-drawer-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.hx-drawer-head .hint, .hx-drawer-foot .hint { font-size: 11px; color: var(--label-2); }

.hx-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.hx-item {
  border: 1px solid var(--separator);
  border-radius: 12px;
  padding: 12px 13px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.hx-item .ref-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hx-item .ref { font-size: 12px; font-weight: 600; color: var(--amber); font-variant-numeric: tabular-nums; }
.hx-item .price { font-size: 14px; font-weight: 600; color: var(--label); font-variant-numeric: tabular-nums; }
.hx-item .company { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; margin: 3px 0 2px; }
.hx-item .route { font-size: 12.5px; color: var(--label-2); }
.hx-item .route .arrow { color: var(--label-3); }
.hx-item .meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 8px; font-size: 12px; color: var(--label-2); }
.hx-item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.hx-item .meta b { color: var(--label); font-weight: 600; font-variant-numeric: tabular-nums; }
.hx-item .hx-actions { display: flex; gap: 8px; margin-top: 11px; }
.hx-item .hx-actions button {
  font-size: 12px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: var(--fill);
  color: var(--label);
  font-family: inherit;
}
.hx-item .hx-actions button:hover { background: var(--fill-strong); }
.hx-item .hx-actions .accept { background: var(--accent); color: #fff; }
.hx-item .hx-actions .accept:hover { filter: brightness(1.06); background: var(--accent); }
.hx-item .hx-actions .dismiss { color: var(--red); margin-left: auto; }

.hx-empty { text-align: center; color: var(--label-3); font-size: 12.5px; padding: 34px 12px; line-height: 1.5; }

.hx-drawer-foot {
  border-top: 1px solid var(--separator);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hx-banner {
  grid-column: 1 / -1;
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  color: color-mix(in srgb, var(--amber) var(--tag-text-mix), var(--label));
  border-radius: 10px;
  font-size: 12px;
  padding: 10px 13px;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Read-only "Incoming HX load" details panel at the top of the Review/Accept modal —
   surfaces everything the queue holds so the operator can assign the right vehicle/
   driver, with the required vehicle class called out. */
.hx-review {
  grid-column: 1 / -1;
  border: 1px solid var(--separator);
  border-radius: 10px;
  background: var(--fill);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.hx-review-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hx-review-title { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--label-2); }
.hx-review-title .mi { width: 15px; height: 15px; color: var(--label-2); }
.hx-review-id { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hx-review-co { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 3px 0 10px; overflow-wrap: anywhere; }
.hx-review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; }
.hx-review-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; min-width: 0; }
.hx-review-k { display: inline-flex; align-items: center; gap: 6px; color: var(--label-2); white-space: nowrap; }
.hx-review-k .mi { width: 14px; height: 14px; color: var(--label-3); }
.hx-review-v { font-weight: 600; text-align: right; overflow-wrap: anywhere; min-width: 0; }
/* The required vehicle class is the headline — full width + accent highlight. */
.hx-review-row.strong { grid-column: 1 / -1; background: var(--accent-soft); border-radius: 7px; padding: 7px 9px; margin: 1px 0 4px; }
.hx-review-row.strong .hx-review-k, .hx-review-row.strong .hx-review-v { color: var(--accent); font-size: 14px; }
.hx-review-row.strong .hx-review-k .mi { color: var(--accent); }
.hx-review-notes { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--separator); font-size: 13px; }
.hx-review-notes .hx-review-v { text-align: left; font-weight: 500; color: var(--label); line-height: 1.4; }

/* Job-origin logo indicator (HX / NAS) shown on booking cards, alerts-panel
   items and the booking editor. Height is fixed and width is auto, so the
   aspect ratio is preserved. Two <img>s are swapped by theme, mirroring the
   header brand-logo logic: .on-light = dark-ink artwork shown on light
   backgrounds, .on-dark = light-ink artwork shown on dark backgrounds. */
.job-badge { display: inline-flex; align-items: center; vertical-align: middle; }
.job-logo { height: 18px; width: auto; max-width: 84px; display: block; }
.job-logo.on-dark { display: none; }
:root[data-theme="dark"] .job-logo.on-light { display: none; }
:root[data-theme="dark"] .job-logo.on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .job-logo.on-light { display: none; }
  :root:not([data-theme="light"]) .job-logo.on-dark { display: block; }
}

/* ---------- top-bar navigation ---------- */
.mainnav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav-btn {
  border: none; background: transparent; color: var(--label);
  font: inherit; font-size: 13.5px; font-weight: 500; letter-spacing: -0.01em;
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.nav-btn .mi { width: 16px; height: 16px; color: var(--label-2); }
.nav-btn:hover { background: var(--fill); }
/* selected section = an obvious accent lozenge with a ring around it */
.nav-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent); }
.nav-btn.active:hover { background: var(--accent-soft); }
.nav-btn.active .mi { color: var(--accent); }
/* slim vertical separator between nav groups */
/* trailing primary action in the toolbar */
.nav-new { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.nav-new .mi { width: 15px; height: 15px; color: currentColor; }
.topbar > .spacer { flex: 1 1 8px; }

.btn-alerts {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--fill); border: none; color: var(--label);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 13px; border-radius: 9px; cursor: pointer; white-space: nowrap;
}
.btn-alerts:hover { background: var(--fill-strong); }
.btn-alerts .mi { width: 15px; height: 15px; color: var(--label-2); }
.btn-alerts.has-alerts .mi { color: var(--red); }

/* ---------- alerts drawer sections ---------- */
.alert-section-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--label-2); padding: 6px 2px 2px; margin-top: 6px;
}
.alert-section-head:first-child { margin-top: 0; }
.alert-section-head .n {
  background: var(--fill); color: var(--label-2); border-radius: 8px;
  padding: 0 7px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.attn-item { cursor: pointer; border-left: 3px solid var(--amber); }
.attn-item:hover { background: var(--fill); }
.attn-flag { margin-top: 8px; font-size: 11.5px; font-weight: 600; color: var(--amber); }
.card-needs { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--amber); }

/* ---------- vehicles / drivers database ---------- */
.db-view { flex: 1; overflow-y: auto; padding: 22px; }
.db-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; max-width: 880px; }
/* Fleet header spans the full page so its actions (+ Add vehicle) sit at the right edge */
#vehiclesView .db-head { max-width: none; }
.db-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.db-head .hint { font-size: 13px; color: var(--label-2); }
.db-list { display: flex; flex-direction: column; gap: 8px; max-width: 880px; }
.db-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--separator); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--card-shadow);
}
.db-swatch { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); }
.db-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--fill);
  color: var(--label-2); font-size: 12.5px; font-weight: 600;
}
.db-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.db-main b { font-size: 14px; font-weight: 600; }
.db-main span { font-size: 12px; color: var(--label-2); }
.db-count { font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-actions { display: flex; gap: 6px; }
.db-actions button {
  border: none; background: var(--fill); color: var(--label); font: inherit;
  font-size: 12px; font-weight: 500; padding: 6px 11px; border-radius: 8px; cursor: pointer;
}
.db-actions button:hover { background: var(--fill-strong); }
.db-actions .db-del { color: var(--red); }
/* Click-to-reveal phone numbers on customer/supplier list rows. The pane folds
   open via a grid-rows transition (animates any content height). */
.db-actions .db-phone { display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; color: var(--label-2); }
.db-phone .mi { width: 15px; height: 15px; }
.db-actions .db-phone.active { background: var(--accent-soft); color: var(--accent); }
.num-reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s cubic-bezier(.32, .72, .28, 1); }
.num-reveal.open { grid-template-rows: 1fr; }
.num-reveal-inner { overflow: hidden; }
.num-reveal-card { margin-top: 6px; background: var(--fill); border: 1px solid var(--separator); border-radius: 10px; overflow: hidden; }
.num-item { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 9px 14px; font-size: 13px; text-decoration: none; color: var(--label); }
.num-item + .num-item { border-top: 1px solid var(--separator); }
.num-item:hover { background: var(--fill-strong); }
.num-label { color: var(--label-2); }
.num-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.db-click { cursor: pointer; }

.db-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-sort {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--label);
  background-color: var(--fill); border: none; border-radius: 9px;
  padding: 8px 30px 8px 12px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M2.5 4.5L6 8l3.5-3.5'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 11px;
}
.db-sort:hover { background-color: var(--fill-strong); }

/* ---------- import / export pane ---------- */
#ioBody { padding: 8px 22px 22px; display: flex; flex-direction: column; gap: 18px; }
.io-section { display: flex; flex-direction: column; gap: 8px; }
.io-h { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.io-desc { margin: 0; font-size: 12.5px; color: var(--label-2); line-height: 1.4; }
.io-desc b { color: var(--label); font-weight: 600; }
.io-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.io-btn {
  border: none; background: var(--fill); color: var(--label);
  font: inherit; font-size: 13px; font-weight: 500; padding: 9px 14px; border-radius: 9px; cursor: pointer;
}
.io-btn:hover { background: var(--fill-strong); }
.io-fileinput { font: inherit; font-size: 12.5px; color: var(--label-2); }
.io-fileinput::file-selector-button {
  border: none; background: var(--accent); color: #fff;
  font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 8px 13px; border-radius: 8px; margin-right: 11px; cursor: pointer;
}
.io-fileinput::file-selector-button:hover { filter: brightness(1.06); }
.io-status { font-size: 12.5px; color: var(--green); min-height: 16px; font-weight: 500; }
.io-status.io-error { color: var(--red); }

.modal-sm { width: 460px; }
.modal-sm .form-grid { grid-template-columns: 1fr; }
/* driver editor: wider pane, 3-column grid, ordered/grouped fields */
.modal-sm.res-wide { width: 860px; max-width: 94vw; }
.modal-sm.res-wide .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
/* record editor (customer/supplier): a roomy, framed window type - ~50% wider and
   ~30% taller than the old compact editor, with generous inner margins so content
   never hugs the edges. The field-layout design maps onto this next. */
.modal-sm.res-record { width: 1040px; max-width: 92vw; min-height: min(760px, 84vh); max-height: 90vh; }
.modal.res-record .modal-head { padding: 22px 30px 6px; }
.modal.res-record #resourceForm { padding: 18px 30px 26px; }
/* record Details layout: two columns - Account details | Contacts */
.rec-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 34px; }
.rec-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rec-cols label, .rec-notes { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--label-2); min-width: 0; }
.rec-cols input, .rec-cols select, .rec-cols textarea, .rec-notes textarea {
  width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid var(--separator);
  border-radius: 9px; font-size: 13.5px; font-family: inherit; color: var(--label);
  background: var(--card); box-sizing: border-box; }
.rec-cols input:focus, .rec-cols select:focus, .rec-cols textarea:focus, .rec-notes textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rec-cols textarea, .rec-notes textarea { resize: vertical; line-height: 1.4; min-height: 38px; }
.rec-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rec-acref { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; align-items: center; }
.rec-acref-fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rec-merge { align-self: center; white-space: nowrap; }
.rec-cgroup { display: flex; flex-direction: column; gap: 5px; }
.rec-cgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rec-cadd { border: 1px solid var(--separator); background: var(--fill); color: var(--label-2);
  width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1;
  display: grid; place-items: center; flex: none; }
.rec-cadd:hover { background: var(--fill-strong); }
.rec-crows { display: flex; flex-direction: column; gap: 6px; }
.rec-crow { display: grid; grid-template-columns: 96px 1fr 26px; gap: 6px; align-items: center; }
.rec-cdel { border: none; background: transparent; color: var(--label-3); font-size: 17px;
  cursor: pointer; line-height: 1; border-radius: 6px; height: 30px; }
.rec-cdel:hover { color: #d33; background: var(--fill); }
.rec-notes { margin-top: 14px; }
@media (max-width: 760px) { .rec-cols { grid-template-columns: 1fr; } }
.res-tabs { margin: 4px 0 16px; flex-wrap: wrap; }
.res-panel { min-height: 240px; }
.res-panel-empty { color: var(--label-3); font-size: 13.5px; text-align: center; padding: 56px 16px; }
.res-section { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--label-2); margin: 8px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--separator); }
.res-section:first-child { margin-top: 0; }
@media (max-width: 720px) { .modal-sm.res-wide .form-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .modal-sm.res-wide .form-grid { grid-template-columns: 1fr; } }
/* the booking form is a 4-column grid, so its pane is wider (still caps at 94vw) */
#modalOverlay .modal { width: 960px; }
.modal-sm input[type="color"] { height: 40px; padding: 3px; cursor: pointer; }

/* ---------- calendar event tooltip ---------- */
.event-tip {
  position: fixed; z-index: 60; top: 0; left: 0;
  width: 288px; max-width: calc(100vw - 16px);
  background: var(--card); color: var(--label);
  border: 1px solid var(--separator); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  padding: 13px 14px; font-size: 13px; pointer-events: auto;
}
.event-tip .tip-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.event-tip .tip-head-main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.event-tip .tip-origin { flex: 0 0 auto; }
.tip-customer { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.tip-ref { font-size: 11.5px; color: var(--label-2); font-variant-numeric: tabular-nums; margin-top: 2px; }
.tip-desc { font-size: 12.5px; color: var(--label-2); line-height: 1.4; margin: 9px 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--separator); }
.tip-rows { display: flex; flex-direction: column; gap: 7px; }
.tip-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tip-k { display: inline-flex; align-items: center; gap: 6px; color: var(--label-2); font-size: 12px; white-space: nowrap; }
.tip-k .mi { color: var(--label-3); }
.tip-v { font-weight: 600; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-v a { color: var(--accent); text-decoration: none; }
.tip-v a:hover { text-decoration: underline; }
.tip-wa {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 12px; padding: 9px 12px; border-radius: 10px;
  background: #25d366; color: #fff; font-weight: 600; font-size: 12.5px;
  text-decoration: none;
}
.tip-wa:hover { filter: brightness(1.05); }
.tip-wa .mi { color: #fff; width: 15px; height: 15px; }

/* ---------- toast notifications ---------- */
.toast-host {
  position: fixed; top: 72px; right: 16px; z-index: 70;
  display: flex; flex-direction: column; gap: 10px;
  width: 328px; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--card); color: var(--label);
  border: 1px solid var(--separator); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  padding: 12px 13px; cursor: pointer;
  animation: toast-in 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.toast.leaving { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast-icon {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber);
}
.toast-icon .mi { width: 17px; height: 17px; color: inherit; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.toast-msg { font-size: 12.5px; color: var(--label-2); margin-top: 2px; line-height: 1.35; }
.toast-close {
  pointer-events: auto; border: none; background: transparent; color: var(--label-3);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 2px 4px; margin: -2px -2px 0 0;
}
.toast-close:hover { color: var(--label); }
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.leaving { animation: none !important; }
}

/* ---------- HX load pane ---------- */
/* The HX approval pane holds longer free-text (addresses, cargo, refs) than the
   resource editor, so give it more room and let every field wrap rather than
   overflow. Width still yields to --modal max-width: 94vw on small windows. */
#hxPaneOverlay .modal { width: 520px; }
#hxPaneBody { padding: 8px 22px 22px; }
.confirm-body { padding: 8px 22px 22px; }
.hx-pane-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hx-pane-co { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; min-width: 0; overflow-wrap: anywhere; }
.hx-pane-price { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.hx-pane-route { font-size: 13px; color: var(--label-2); margin: 4px 0 14px; overflow-wrap: anywhere; }
.hx-pane-route .arrow { color: var(--label-3); }
.hx-pane-rows { display: flex; flex-direction: column; gap: 9px; }
.hx-pane-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.hx-pane-v { font-size: 13px; font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.hx-pane-notes {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--separator);
  font-size: 12.5px; color: var(--label-2); line-height: 1.4; overflow-wrap: anywhere;
}
.hx-pane-warn { padding: 2px 0; }
.hx-pane-warn-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--amber); margin-bottom: 8px; }
.hx-pane-warn-head .mi { width: 18px; height: 18px; color: var(--amber); }
.hx-pane-warn p { margin: 0 0 14px; font-size: 13px; color: var(--label-2); line-height: 1.45; }
.hx-confirm {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; color: var(--label); cursor: pointer;
  background: var(--fill); border-radius: 10px; padding: 11px 12px;
}
.hx-confirm input { margin-top: 1px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; }

.hidden { display: none !important; }

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

/* ===== WhatsApp Business inbox ===== */
.wa-banner {
  background: var(--accent-soft); color: var(--label);
  border: 1px solid var(--separator); border-radius: var(--radius);
  padding: 10px 14px; margin: 12px 12px 0; font-size: 13px; line-height: 1.45;
}
.wa-banner code { background: var(--fill); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.wa-layout {
  display: grid; grid-template-columns: 300px 1fr; gap: 12px;
  flex: 1; min-height: 0; padding: 12px;
}
.wa-list-pane, .wa-thread-pane {
  background: var(--card); border: 1px solid var(--separator);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.wa-list-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--separator);
}
.wa-list-head h2 { font-size: 16px; margin: 0; }
.wa-status { font-size: 12px; color: var(--label-3); }
.wa-status-ok { color: var(--green); }
.wa-status-err { color: var(--red); }
.wa-convos { overflow-y: auto; flex: 1; }
.wa-empty { padding: 24px 16px; color: var(--label-3); font-size: 13px; text-align: center; }
.wa-convo {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-bottom: 1px solid var(--separator); padding: 10px 14px; cursor: pointer; color: var(--label);
}
.wa-convo:hover { background: var(--col-bg); }
.wa-convo.active { background: var(--accent-soft); }
.wa-convo-top { display: flex; justify-content: space-between; gap: 8px; }
.wa-convo-name { font-weight: 600; font-size: 14px; }
.wa-convo-time { font-size: 11px; color: var(--label-3); white-space: nowrap; }
.wa-convo-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.wa-convo-last { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.wa-thread-head { padding: 12px 16px; border-bottom: 1px solid var(--separator); }
.wa-thread-title { font-weight: 600; font-size: 15px; }
.wa-thread-num { font-size: 12px; color: var(--label-3); }
.wa-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.wa-msg { display: flex; }
.wa-msg-in { justify-content: flex-start; }
.wa-msg-out { justify-content: flex-end; }
.wa-bubble {
  max-width: 74%; padding: 7px 11px 5px; border-radius: 14px; font-size: 14px; line-height: 1.4;
  white-space: pre-wrap; word-break: break-word; position: relative;
}
.wa-msg-in .wa-bubble { background: var(--fill); color: var(--label); border-bottom-left-radius: 4px; }
.wa-msg-out .wa-bubble { background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.wa-meta { display: block; font-size: 10px; opacity: 0.7; margin-top: 3px; text-align: right; }
.wa-tick { text-transform: capitalize; }
.wa-window-note {
  margin: 0 16px; padding: 6px 10px; font-size: 12px; color: var(--label-2);
  background: var(--fill); border-radius: 8px;
}
.wa-reply { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--separator); align-items: flex-end; }
.wa-reply textarea {
  flex: 1; resize: none; font: inherit; font-size: 14px; padding: 8px 12px;
  border: 1px solid var(--separator); border-radius: 18px; background: var(--bg); color: var(--label);
  max-height: 120px;
}
.wa-reply textarea:focus { outline: none; border-color: var(--accent); }

/* ---- Floating launcher (bottom-right) ---- */
.wa-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 60; padding: 0;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  transition: transform .15s ease, box-shadow .15s ease;
}
.wa-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34); }
.wa-launcher:active { transform: scale(.94); }
.wa-launcher.active { transform: scale(.94); }
.wa-launcher-ic { width: 30px; height: 30px; fill: currentColor; }
.wa-launcher-badge {
  position: absolute; top: -2px; right: -2px; box-sizing: border-box;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}

/* ---- Fly-out panel (right ~50%) ---- */
.wa-flyout {
  position: fixed; top: 0; right: 0; z-index: 65;
  width: 50vw; min-width: 380px; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--separator);
  box-shadow: -14px 0 44px rgba(0, 0, 0, 0.24);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.32, .72, .28, 1);
}
.wa-flyout.open { transform: translateX(0); }
.wa-flyout-head {
  display: flex; align-items: center; justify-content: space-between; flex: none;
  padding: 12px 14px; border-bottom: 1px solid var(--separator);
}
.wa-flyout-title { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 700; }
.wa-flyout-ic { width: 22px; height: 22px; fill: var(--green); }
.wa-flyout-actions { display: flex; align-items: center; gap: 6px; }
.wa-flyout-actions .mi { width: 17px; height: 17px; color: var(--label-2); }

/* ---- Standalone pop-out window ---- */
body.wa-standalone { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.wa-standalone-head {
  display: flex; align-items: center; gap: 9px; flex: none;
  padding: 12px 14px; border-bottom: 1px solid var(--separator);
  font-size: 17px; font-weight: 700;
}
.wa-standalone-ic { width: 22px; height: 22px; fill: var(--green); }

@media (max-width: 760px) {
  .wa-layout { grid-template-columns: 1fr; }
  .wa-flyout { width: 100vw; min-width: 0; }
}

/* ---------- live vehicle map ---------- */
.db-tabs { flex: 0 0 auto; }
.db-tabs button { flex: 0 0 auto; padding: 6px 14px; }

.fleet-map-wrap { display: flex; flex-direction: column; gap: 8px; position: relative; }
.fleet-map {
  height: 460px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--separator);
  /* isolate Leaflet's internal z-index stack so it never rides over the header */
  position: relative; z-index: 0; isolation: isolate;
}
.fleet-hint { display: inline-flex; align-items: center; gap: 6px; }
.fleet-hint .mi { width: 15px; height: 15px; color: var(--label-3); }

/* Live map fills the view down to the bottom of the window */
.db-view-map { display: flex; flex-direction: column; overflow: hidden; padding-top: 9px; }
.db-view-map .fleet-map-wrap { flex: 1 1 auto; min-height: 0; }
.db-view-map .fleet-map { position: absolute; inset: 0; height: auto; }

/* left-hand vehicle panel (which vehicles to track) */
.fleet-veh-panel { display: none; }
.db-view-map .fleet-veh-panel {
  display: block; position: absolute; top: 12px; left: 12px; z-index: 5; width: 190px;
  background: var(--card); border: 1px solid var(--separator); border-radius: 12px;
  box-shadow: var(--card-shadow); padding: 8px; max-height: calc(100% - 24px); overflow-y: auto;
}
.fvp-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-3); padding: 2px 4px 6px; }
.fvp-row { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 6px; }
.fvp-row:hover { background: var(--fill); }
.fvp-all { border-bottom: 1px solid var(--separator); border-radius: 0; padding-bottom: 7px; margin-bottom: 4px; }
.fvp-check, #fvpAll { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; }
.fvp-swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.fvp-name { flex: 1; min-width: 0; text-align: left; border: none; background: transparent; font: inherit; font-size: 12.5px; color: var(--label); cursor: pointer; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fvp-name:hover { color: var(--accent); }
.fvp-name-static { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--label); }
.fvp-list { display: flex; flex-direction: column; gap: 1px; }
.fvp-empty { font-size: 12px; color: var(--label-3); padding: 8px 4px; }
.db-view-map .fleet-hint {
  position: absolute; bottom: 8px; left: 10px; z-index: 5;
  background: var(--card); padding: 4px 9px; border-radius: 8px; box-shadow: var(--card-shadow); font-size: 11px;
}

/* map mode toolbar (2D / Satellite / Street Maps) — floats top-centre of the map */
.fleet-modes {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; gap: 6px;
}
.fleet-mode {
  border: 1px solid var(--separator); background: var(--card); color: var(--label);
  border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; box-shadow: var(--card-shadow);
}
.fleet-mode:hover { background: var(--fill); }
.fleet-mode.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fleet-map-wrap.sv-open .fleet-modes { display: none; }

/* in-map Street View pane (Street View Static image — no WebGL), sized to the map */
.sv-pane {
  position: absolute; inset: 0; z-index: 8; display: none;
  background: #1c2229; border-radius: 14px; overflow: hidden;
}
.sv-pane.open { display: block; }
.sv-frame, .sv-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* static Street View image (plain <img>, no WebGL) — renders on any machine, incl. remote desktop/VM */
.sv-static { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-frame.sv-noimg .sv-static { display: none; }
.sv-noimg-msg { display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
  text-align: center; padding: 24px; color: #cdd7e2; font-size: 14px; }
.sv-frame.sv-noimg .sv-noimg-msg { display: flex; }
/* "Open in Google Maps" link for full interactive Street View on capable machines */
.sv-open-maps { position: absolute; right: 12px; bottom: 12px; z-index: 2;
  background: rgba(20,24,30,.82); color: #fff; text-decoration: none;
  font-size: 12.5px; font-weight: 600; padding: 8px 12px; border-radius: 8px; }
.sv-open-maps:hover { background: rgba(20,24,30,.95); }
/* ✕ floats above the pane, top-centre, clear of Google's own top-right controls */
.sv-close {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 9;
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--label); color: var(--card); font-size: 20px; line-height: 1;
  box-shadow: var(--card-shadow);
}
.fleet-map-wrap.sv-open .sv-close { display: inline-flex; }
.sv-close:hover { opacity: 0.85; }

/* tracking flyout: date range + today's updates */
.track-range { display: flex; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--separator); }
.track-range label { flex: 1; display: flex; flex-direction: row; align-items: center; gap: 7px; font-size: 11px; font-weight: 500; color: var(--label-2); white-space: nowrap; }
.track-range input { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); }
.track-range input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* day-nav row: collapse the range to one day and step through days */
.track-daynav { display: flex; gap: 8px; padding: 12px 18px 0; }
.track-daynav button { font: inherit; font-weight: 600; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); cursor: pointer; padding: 7px 10px; }
.track-daynav button:hover { background: var(--fill); }
.track-daynav button:active { background: var(--fill-strong); }
#trackPrevDay, #trackNextDay { flex: 0 0 46px; font-size: 15px; line-height: 1; }
#trackToday { flex: 1; font-size: 12px; }
/* the Show/Detail filter lives in the drawer header (free space) so the date row stays roomy;
   scoped to #trackDrawer so other hx-drawers keep their top-aligned header */
#trackDrawer .hx-drawer-head { align-items: center; gap: 10px; }
#trackDrawer .hx-drawer-head > div:first-child { min-width: 0; flex: 0 1 auto; }
.track-show { margin-left: auto; display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 11px; font-weight: 500; color: var(--label-2); }
/* Reports button + Tracking/Driver-update legend share the flyout footer */
.hx-drawer-foot.track-foot { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 16px; }
.track-legend { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--label-2); }
.track-reports { margin-left: auto; font: inherit; font-size: 12px; font-weight: 600; padding: 6px 14px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); cursor: pointer; white-space: nowrap; }
.track-reports:hover { background: var(--fill); }
/* Daily vehicle log report pane */
.report-modal { width: 1180px; max-width: 96vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.report-head { display: flex; align-items: center; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--separator); }
.report-head-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.report-head-l h2 { margin: 0; }
.report-veh { font: inherit; font-size: 13px; padding: 6px 9px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); max-width: 260px; }
.report-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.report-nav button { font: inherit; font-weight: 600; padding: 6px 11px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); cursor: pointer; }
.report-nav button:hover { background: var(--fill); }
.report-nav input[type="date"] { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); }
.report-body { padding: 4px 18px 18px; overflow: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report-table th { text-align: left; font-weight: 600; color: var(--label-2); padding: 9px 10px; border-bottom: 1px solid var(--separator); white-space: nowrap; position: sticky; top: 0; background: var(--card); z-index: 1; }
.report-table td { padding: 9px 10px; border-bottom: 1px solid var(--separator); vertical-align: top; }
.report-table .rp-n { color: var(--label-3); font-variant-numeric: tabular-nums; }
.report-table .rp-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table .rp-time { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: 4px; }
.report-table .rp-prog { color: var(--label-3); font-style: italic; }
.report-table .rp-totals td { font-weight: 700; background: var(--fill); border-top: 2px solid var(--separator); border-bottom: none; }
.report-table .rp-tot-lbl { text-align: right; }
.report-empty { padding: 48px 16px; text-align: center; color: var(--label-3); font-size: 13.5px; }
.track-show select { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); max-width: 190px; }
#trackBody { gap: 0; }
.track-update { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--separator); }
/* day separator — rows carry only a clock, so a multi-day range needs a stated date */
.tu-date {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 2px 5px; margin-top: 2px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--label-3); background: var(--card); border-bottom: 1px solid var(--separator);
}
.tu-date:first-child { margin-top: 0; padding-top: 4px; }
/* row actions ("i" mini-map + Street View eye), hidden until the row is hovered, aligned right */
.tu-acts { flex: 0 0 auto; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.tu-eye, .tu-info {
  flex: 0 0 auto; opacity: 0; visibility: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 1px solid var(--separator); border-radius: 7px;
  background: var(--card); color: var(--accent); cursor: pointer; transition: opacity .12s;
}
.track-update:hover .tu-eye, .tu-eye:focus-visible,
.track-update:hover .tu-info, .tu-info:focus-visible { opacity: 1; visibility: visible; }
.tu-eye:hover, .tu-info:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.tu-eye .mi, .tu-info .mi { width: 17px; height: 17px; }
/* mini-map inside the "where was this?" popover */
.tu-loc-map { height: 140px; border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.tu-time { flex: 0 0 46px; font-size: 12px; font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums; }
.tu-body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tu-title { font-size: 13px; color: var(--label); }
.tu-sub { font-size: 11.5px; color: var(--label-3); font-variant-numeric: tabular-nums; }
/* Enhanced-mode tracking detail: leg duration/distance, idle, dwell, day summary */
.tu-meta { opacity: .75; }
.tu-day-sum { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--label-2); }

/* Checks log: Review button — pulses/glows orange to flag it still needs reviewing */
.ck-review-btn {
  border: none; font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 8px; cursor: pointer;
  background: color-mix(in srgb, var(--amber) 16%, transparent);
  color: color-mix(in srgb, var(--amber) 60%, var(--label));
  animation: ck-review-pulse 1.7s ease-in-out infinite;
}
.ck-review-btn:hover { background: color-mix(in srgb, var(--amber) 28%, transparent); }
@keyframes ck-review-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--amber) 42%, transparent); }
  50%      { box-shadow: 0 0 9px 1px color-mix(in srgb, var(--amber) 60%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .ck-review-btn { animation: none; box-shadow: 0 0 6px color-mix(in srgb, var(--amber) 45%, transparent); }
}
/* reviewed rows: static, green — no pulse */
.ck-review-btn.ck-reviewed {
  animation: none; box-shadow: none; font-weight: 500;
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: color-mix(in srgb, var(--green) 55%, var(--label));
}
.ck-review-btn.ck-reviewed:hover { background: color-mix(in srgb, var(--green) 26%, transparent); }

/* Vehicle-check review flyout */
.cr-log-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 8px; }
.cr-log-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-3); }
#crAddEntry { padding: 5px 11px; font-size: 12.5px; }
.cr-entry { border: 1px solid var(--separator); border-radius: 10px; padding: 10px 12px; background: var(--card); }
.cr-entry-meta { font-size: 11px; color: var(--label-3); font-weight: 600; margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.cr-entry-notes { font-size: 13px; color: var(--label); line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.cr-editor { border-color: var(--accent); }
.cr-note {
  width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--separator);
  border-radius: 8px; background: var(--card); color: var(--label); resize: vertical;
}
.cr-note:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cr-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.cr-editor-actions button { padding: 6px 12px; font-size: 12.5px; }
.cr-foot { flex-direction: row; gap: 10px; }
.cr-foot button { flex: 1; padding: 9px; font-size: 13.5px; }

/* Timesheets: date-range filter bar + driver filter + review button */
.ts-filters { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ts-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 500; color: var(--label-2); }
.ts-filters input[type="date"] { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); }
.ts-filters input[type="date"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-active-filter { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--label-2); background: var(--fill); border-radius: 999px; padding: 5px 6px 5px 11px; }
.ts-active-filter button { border: none; background: none; cursor: pointer; color: var(--label-3); font-size: 15px; line-height: 1; padding: 0 3px; }
.ts-active-filter button:hover { color: var(--red); }
.ts-driver-th { white-space: nowrap; }
.ts-hfilter { border: none; background: var(--fill); cursor: pointer; padding: 3px 5px; border-radius: 6px; color: var(--label-2); vertical-align: -4px; margin-left: 6px; display: inline-flex; align-items: center; }
.ts-hfilter:hover { background: var(--fill-strong); color: var(--accent); }
.ts-hfilter.active { color: var(--accent); background: var(--accent-soft); }
.ts-hfilter .mi { width: 15px; height: 15px; }
.ts-driver-pop { position: fixed; z-index: 60; width: 210px; max-height: 320px; overflow-y: auto; background: var(--card); border: 1px solid var(--separator); border-radius: 12px; box-shadow: var(--card-shadow-hover); padding: 6px; }
.ts-dopt { display: block; width: 100%; text-align: left; border: none; background: none; font: inherit; font-size: 13px; color: var(--label); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ts-dopt:hover { background: var(--fill); }
.ts-dopt.sel { color: var(--accent); font-weight: 600; }
/* searchable filter popover: search box pinned, option list scrolls (scoped to the Driver Updates funnels) */
#duFilterPop { display: flex; flex-direction: column; overflow: hidden; }
#duFilterPop .ts-dopt-list { overflow-y: auto; }
.ts-fsearch { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; padding: 7px 9px; margin-bottom: 6px;
  border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); }
.ts-fsearch:focus { outline: none; border-color: var(--accent); }
.ts-review-btn { border: none; background: var(--fill); color: var(--label); font: inherit; font-size: 12px; font-weight: 500; padding: 5px 14px; border-radius: 8px; cursor: pointer; }
.ts-review-btn:hover { background: var(--fill-strong); color: var(--accent); }

/* Driver Updates queue (Bookings sub-view) */
.du-count { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 5px; margin-left: 6px; border-radius: 8px; background: var(--amber); color: #fff; font-size: 11px; font-weight: 700; }
#driverUpdatesBtn.du-attn { color: color-mix(in srgb, var(--amber) 85%, var(--label)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 55%, transparent); animation: ck-review-pulse 1.7s ease-in-out infinite; }
#driverUpdatesBtn.du-attn .mi { color: var(--amber); }
@media (prefers-reduced-motion: reduce) { #driverUpdatesBtn.du-attn { animation: none; box-shadow: 0 0 6px color-mix(in srgb, var(--amber) 45%, transparent); } }
/* overall review-status filter (All / Approved / Unapproved) — right-aligned */
.du-statusbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 0 14px; }
.du-statusbar-label { font-size: 12.5px; font-weight: 600; color: var(--label-2); }
.du-statusbar .set-seg { flex: 0 0 auto; }
.du-statusbar .set-seg button { flex: 0 0 auto; }
/* same-job grouping: an expandable master row with its updates nested beneath */
.du-master > td { background: var(--fill); font-weight: 500; }
.du-expand { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 9px;
  border: 1px solid var(--separator); background: var(--card); border-radius: 5px; font-size: 15px; line-height: 1; cursor: pointer;
  color: var(--label-2); vertical-align: -4px; }
.du-expand:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.du-master-count { color: var(--label-2); font-size: 12.5px; }
.du-pending-n { color: var(--amber); font-weight: 700; }
/* job's overall current status chip, shown in the master row's actions cell */
.du-jobstatus { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap;
  background: color-mix(in srgb, var(--sc, #8e8e93) 15%, transparent); color: color-mix(in srgb, var(--sc, #8e8e93) var(--tag-text-mix), var(--label)); }
.du-child > td { background: color-mix(in srgb, var(--fill) 35%, transparent); }
.du-child > td:first-child { padding-left: 40px; box-shadow: inset 3px 0 0 var(--accent-soft); }
.du-child-tick { display: inline-block; width: 12px; }
.du-change { white-space: nowrap; }
.du-addr { min-width: 120px; max-width: 240px; white-space: normal; overflow-wrap: anywhere; color: var(--label-2); font-size: 13px; }
.du-change .tag { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap;
  background: color-mix(in srgb, var(--sc) 15%, transparent); color: color-mix(in srgb, var(--sc) var(--tag-text-mix), var(--label)); }
.du-arrow { color: var(--label-3); margin: 0 3px; }
.du-edit-sel { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); }
.du-actions { white-space: nowrap; text-align: right; }
.du-btn { font: inherit; font-size: 12px; font-weight: 600; border: 1px solid var(--separator); background: var(--card); border-radius: 8px; padding: 5px 10px; cursor: pointer; margin-left: 4px; }
.du-btn:hover { background: var(--fill); }
.du-approve { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--separator)) !important; }
.du-undo { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--separator)) !important; }
.du-approved { font-size: 11px; font-weight: 700; color: var(--green); margin-right: 6px; }
.du-allocated { font-size: 11px; color: var(--label-2); white-space: nowrap; }
.du-row-done { opacity: .72; }
/* driver-photo thumbnails + override flags in the Driver Updates queue */
.du-photos { white-space: nowrap; }
.du-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--separator); margin: 2px; vertical-align: middle; }
.du-noflag { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; background: var(--red); border-radius: 5px; padding: 3px 6px; margin: 2px; text-transform: uppercase; letter-spacing: .02em; }

/* Timesheet review flyout: editable fields + change log */
.tsr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.tsr-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 500; color: var(--label-2); min-width: 0; }
.tsr-field input { width: 100%; min-width: 0; font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--separator); border-radius: 8px; background: var(--card); color: var(--label); }
.tsr-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tsr-field input:disabled { background: var(--fill); color: var(--label-2); -webkit-text-fill-color: var(--label-2); }
.tsr-check { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--label); }
.tsr-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.tsr-log-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-3); margin: 18px 0 8px; }
.tsr-log { display: flex; flex-direction: column; gap: 8px; }
.tsr-log-entry { border: 1px solid var(--separator); border-radius: 10px; padding: 9px 11px; background: var(--card); }
.tsr-log-meta { font-size: 11px; color: var(--label-3); font-weight: 600; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.tsr-log-change { font-size: 12.5px; color: var(--label); line-height: 1.4; word-break: break-word; }

/* Leaflet base — inherit the app font, theme the empty/loading canvas */
.leaflet-container { font-family: var(--font); background: var(--fill); }
.leaflet-container a { color: var(--accent); }
.leaflet-bar a, .leaflet-bar a:hover { color: #1d1d1f; }

/* Vehicle marker (fleet map + tooltip mini-map) */
.veh-div { background: none; border: none; }
.veh-marker { display: flex; flex-direction: column; align-items: center; }
.veh-dot {
  width: 24px; height: 24px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0, 0, 0, 0.4);
  display: grid; place-items: center;
}
.veh-arrow { width: 15px; height: 15px; fill: #fff; }
.veh-dot-core { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.veh-marker.parked .veh-dot { background: #8e8e93; }
.veh-tag {
  margin-top: 3px; background: #fff; color: #1d1d1f;
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); white-space: nowrap;
  font-variant-numeric: tabular-nums; letter-spacing: 0.01em;
}
.veh-popup b { font-size: 13px; }
.veh-popup .mp-sub { color: #6e6e73; font-size: 11.5px; margin: 1px 0 5px; }
.veh-popup .mp-row { font-size: 12px; }
.veh-popup .mp-parked { color: #6e6e73; }
.veh-popup .mp-upd { color: #8e8e93; font-size: 11px; margin-top: 3px; }

/* Location section inside the calendar hover tooltip */
.tip-loc {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--label-2); margin: 11px 0 6px;
}
.tip-loc .mi { width: 14px; height: 14px; color: var(--label-3); flex: 0 0 auto; }
.tip-map {
  height: 118px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--separator); background: var(--fill);
  position: relative; z-index: 0; isolation: isolate;
}

/* ---------- login ---------- */
.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.login-overlay.hidden { display: none; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--card); border: 1px solid var(--separator);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 32px 28px; display: flex; flex-direction: column; gap: 14px;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-logo { width: 34px; height: 34px; border-radius: 8px; }
.login-brand h1 { margin: 0; font-size: 22px; font-weight: 600; color: var(--label); letter-spacing: -0.02em; }
.login-sub { margin: -4px 0 6px; color: var(--label-2); font-size: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--label-2); }
.login-field input {
  font: inherit; font-size: 15px; color: var(--label);
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--separator); background: var(--bg);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.login-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error { min-height: 18px; color: var(--red); font-size: 13px; }
.login-btn { margin-top: 4px; width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.login-btn:disabled { opacity: 0.6; cursor: default; }
/* SSO primary button (it's an <a>, so force button-like layout) + local toggle */
.login-sso { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.login-local-toggle { margin-top: 10px; width: 100%; padding: 6px; background: none; border: none; color: var(--label-2); font-size: 13px; cursor: pointer; }
.login-local-toggle:hover { color: var(--label); text-decoration: underline; }
#localLoginFields { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.admin-pw-hint { color: var(--label-3); font-size: 12px; font-weight: 400; }
.au-sso-toggle { flex-direction: row !important; align-items: center; flex-wrap: wrap; gap: 8px; }
.au-sso-toggle input { width: auto; margin: 0; }
.au-sso-toggle .admin-pw-hint { flex-basis: 100%; }

/* ===== Driver submissions: fuel / checks / timesheets (office side) ===== */

/* wide tables scroll horizontally inside their own container */
.ck-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 12px; border-radius: var(--radius); }
.ck-table { border-collapse: collapse; width: 100%; font-size: 13px; background: var(--card); }
.ck-table th, .ck-table td {
  border-bottom: 1px solid var(--separator); padding: 8px 10px; text-align: left; white-space: nowrap; vertical-align: top;
}
.ck-table th { position: sticky; top: 0; background: var(--bg-bar); backdrop-filter: blur(8px); font-weight: 600; color: var(--label-2); z-index: 1; }
.ck-table td.num, .ck-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ck-table tr:last-child td { border-bottom: none; }

/* the 21 check columns are narrow, vertical headers to keep the table compact */
.ck-table th.ck-col {
  writing-mode: vertical-rl; transform: rotate(180deg);
  max-height: 150px; font-weight: 500; font-size: 11px; padding: 8px 4px; text-align: left;
}
.ck-table td.ck-col { text-align: center; padding: 6px 4px; }
.ck { display: inline-block; min-width: 20px; font-weight: 700; }
.ck-pass { color: var(--green); }
.ck-fail { color: var(--red); }
.ck-na   { color: var(--label-3); font-weight: 600; font-size: 11px; }
.ck-blank { color: var(--label-3); }
.ck-row { cursor: pointer; }
.ck-row:hover td { background: var(--fill); }
.ck-row-defect td { background: color-mix(in srgb, var(--red) 8%, transparent); }
.ck-row-defect td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.ck-defect-txt { white-space: normal; min-width: 160px; max-width: 260px; }

/* report filter bars + stat boxes (fuel & checks) */
.rep-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-top: 12px; }
.rep-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--label-2); }
.rep-filters select, .rep-filters input {
  font: inherit; font-size: 14px; color: var(--label); background: var(--bg);
  border: 1px solid var(--separator); border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
.rep-layout { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 8px; }
@media (min-width: 900px) { .rep-layout { grid-template-columns: 1fr 220px; align-items: start; } }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 900px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-box {
  background: var(--card); border: 1px solid var(--separator); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--card-shadow);
}
.stat-label { font-size: 12px; color: var(--label-2); }
.stat-val { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---------- finance dashboard ---------- */
.fin-range-note { align-self: flex-end; font-size: 12px; color: var(--label-3); padding-bottom: 9px; }
.fin-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.stat-sub { font-size: 11.5px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.fin-charts { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
@media (min-width: 860px) { .fin-charts { grid-template-columns: 1fr 1fr; } }
.fin-chart-card { background: var(--card); border: 1px solid var(--separator); border-radius: 12px; padding: 14px 16px; box-shadow: var(--card-shadow); }
.fin-chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.fin-chart-head span:first-child { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.fin-chart-total { font-size: 13px; font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums; }
.fc-plot { display: flex; align-items: flex-end; gap: 5px; height: 150px; }
.fc-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.fc-bar { width: 62%; max-width: 30px; min-height: 2px; border-radius: 4px 4px 0 0; }
.fc-axis-row { display: flex; gap: 5px; margin-top: 6px; }
.fc-x { flex: 1 1 0; min-width: 0; text-align: center; font-size: 9.5px; color: var(--label-3); white-space: nowrap; overflow: hidden; }
.fin-loading { margin-top: 12px; font-size: 12.5px; color: var(--label-2); }
.fin-note { margin: 14px 0 0; font-size: 11.5px; color: var(--label-3); line-height: 1.4; }

/* timesheet status chips + actions */
.ts-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.ts-pending  { background: color-mix(in srgb, var(--amber) 20%, transparent); color: color-mix(in srgb, var(--amber) var(--tag-text-mix), var(--label)); }
.ts-approved { background: color-mix(in srgb, var(--green) 20%, transparent); color: color-mix(in srgb, var(--green) var(--tag-text-mix), var(--label)); }
.ts-rejected { background: color-mix(in srgb, var(--red) 20%, transparent); color: color-mix(in srgb, var(--red) var(--tag-text-mix), var(--label)); }
.ts-pid { color: var(--label-3); font-size: 11px; }
.ts-by { display: block; color: var(--label-3); font-size: 11px; margin-top: 2px; }
.ts-assign { white-space: normal; min-width: 160px; max-width: 280px; }
.ts-actions { white-space: nowrap; }
.ts-actions button { font: inherit; font-size: 12px; font-weight: 600; border: 1px solid var(--separator); background: var(--card); border-radius: 8px; padding: 5px 10px; cursor: pointer; margin-left: 4px; }
.ts-actions button:hover { background: var(--fill); }

/* check detail modal */
.cd-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 14px; }
.cd-meta > div { display: flex; flex-direction: column; }
.cd-meta b { font-size: 12px; color: var(--label-2); font-weight: 600; }
.cd-defects { background: color-mix(in srgb, var(--red) 8%, transparent); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.cd-defects b { font-size: 12px; color: var(--red); }
.cd-defects p { margin: 4px 0 0; }
.cd-items { display: grid; grid-template-columns: 1fr; gap: 0; max-height: 40vh; overflow-y: auto; border: 1px solid var(--separator); border-radius: 10px; }
.cd-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--separator); font-size: 14px; }
.cd-item:last-child { border-bottom: none; }

/* vehicle editor Details|Logs tabs */
.res-tabs { margin-bottom: 14px; }

/* driver detail-change review */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--amber); color: #fff; font-size: 11px; font-weight: 700; }
.db-row-flagged { box-shadow: inset 3px 0 0 var(--amber); }
.db-flag { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; vertical-align: middle;
  background: color-mix(in srgb, var(--amber) 22%, transparent); color: color-mix(in srgb, var(--amber) var(--tag-text-mix), var(--label)); }

/* Handsets (Drivers -> Handsets asset register) */
.hs-avatar { color: var(--label-2); }
.hs-avatar .mi { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.hs-imei { font-size: 11px; font-weight: 500; color: var(--label-3); font-variant-numeric: tabular-nums; margin-left: 4px; }
.hs-holder { flex: 0 0 auto; max-width: 160px; text-align: right; }
.hs-holder b { font-size: 13px; font-weight: 600; }
.hs-unassigned { color: var(--label-3); font-style: italic; font-weight: 500; }
.hs-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto;
  background: var(--fill); color: var(--label-2); }
.hs-pill.hs-in_use { background: color-mix(in srgb, var(--green) 20%, transparent); color: color-mix(in srgb, var(--green) var(--tag-text-mix), var(--label)); }
.hs-pill.hs-spare { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) var(--tag-text-mix), var(--label)); }
.hs-pill.hs-lost { background: color-mix(in srgb, var(--red) 20%, transparent); color: color-mix(in srgb, var(--red) var(--tag-text-mix), var(--label)); }
.hs-pill.hs-retired { background: var(--fill); color: var(--label-3); }
.dc-diffs { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dc-diff { display: grid; grid-template-columns: 132px 1fr auto 1fr; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--separator); border-radius: 10px; font-size: 14px; }
.dc-field { font-weight: 600; color: var(--label-2); font-size: 12.5px; }
.dc-old { color: var(--label-3); text-decoration: line-through; min-width: 0; overflow-wrap: anywhere; }
.dc-arrow { color: var(--label-3); }
.dc-new { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.dc-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--label-2); margin-top: 6px; padding: 0 2px; }
.dc-same { grid-column: 2 / -1; color: var(--label-2); overflow-wrap: anywhere; display: flex; align-items: baseline; gap: 8px; }
.dc-nochange { font-size: 11px; font-weight: 600; color: var(--label-3); }
.dc-unchanged { opacity: .85; }
@media (max-width: 560px) { .dc-diff { grid-template-columns: 1fr; gap: 4px; } .dc-arrow { display: none; } }

/* driver licence-entitlement checkboxes (office driver editor) */
.rf-full { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.rf-label { font-size: 13px; font-weight: 600; color: var(--label-2); }
.lc-boxes { display: flex; flex-wrap: wrap; gap: 8px; }
.lc-box { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 11px; border: 1px solid var(--separator); border-radius: 8px; cursor: pointer; background: var(--card); }
.lc-box input { margin: 0; accent-color: var(--accent); }
.lc-box:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ==========================================================================
   Fuel cards (Fleet tab + driver record), fuel suppliers (Admin), fuel costs
   ========================================================================== */
.muted { color: var(--label-3); }
.fin-filters .spacer { flex: 1 1 auto; }

/* Fuel-cards table (Fleet Fuel Cards tab + driver-record panel) */
.fc-table td, .fc-table th { vertical-align: middle; }
.fc-ref { font-weight: 600; font-variant-numeric: tabular-nums; }
.fc-actions { white-space: nowrap; text-align: right; }
.fc-actions button + button { margin-left: 6px; }
.card-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; text-transform: capitalize; }
.card-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.card-status-active { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); }
.card-status-suspended { color: var(--amber); background: color-mix(in srgb, var(--amber) 15%, transparent); }
.card-status-cancelled { color: var(--red); background: color-mix(in srgb, var(--red) 15%, transparent); }

/* driver-record "Fuel cards" tab header */
.drv-cards-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }

/* Admin Options tab strip (Users | Fuel suppliers) */
.admin-tabs { margin: 4px 20px 0; }

/* Finance → Fuel costs pane */
.fc-cost-pane { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 20px; align-items: start; }
.fc-cost-form, .fc-cost-log { background: var(--card); border: 1px solid var(--separator); border-radius: 14px; padding: 16px 18px; }
.fc-cost-form h3, .fc-cost-log h3 { margin: 0 0 12px; font-size: 15px; }
.fc-cost-form .form-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
.fc-cost-form .form-grid label:first-child { grid-column: 1 / -1; }
.fc-cost-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.fc-cost-actions .hint { flex: 1; }
.fc-cost { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 820px) { .fc-cost-pane { grid-template-columns: 1fr; } .fc-cost-form .form-grid { grid-template-columns: 1fr; } }

/* Admin Options -> Variables tab */
#adminVariablesView .hint { display: block; margin: 0 20px 10px; }
#varGroups { padding: 0 20px 8px; }
.var-group { margin-bottom: 18px; }
.var-group-cap { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--label-3); margin: 10px 0 6px; }
.var-row { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 16px; align-items: start; padding: 9px 0; border-top: 1px solid var(--separator); }
.var-title { font-weight: 600; font-size: 14px; }
.var-hint { font-size: 12px; color: var(--label-2); margin-top: 2px; }
.var-field { display: flex; flex-direction: column; gap: 6px; }
.var-input { width: 100%; }
.var-statuses { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.var-status-row { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--separator); border-radius: 8px; padding: 3px 4px 3px 8px; background: var(--card); }
.var-status-label { border: none; background: transparent; width: 120px; font-size: 13px; }
.var-status-color { width: 26px; height: 26px; border: none; background: none; padding: 0; }
.var-status-del { border: none; background: transparent; color: var(--label-2); cursor: pointer; font-size: 16px; line-height: 1; }
.var-status-add { border: 1px dashed var(--separator); background: transparent; color: var(--label-2); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
@media (max-width: 640px) { .var-row { grid-template-columns: 1fr; gap: 6px; } }
/* booking-status editor: one labelled card per status */
.var-statuslist { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.var-statuslist .var-status-add { align-self: flex-start; }
.var-srow { display: block; border: 1px solid var(--separator); border-radius: 10px; padding: 10px 12px; margin: 0; background: var(--card); }
.stedit-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.stedit-top .var-status-color { width: 30px; height: 30px; border: none; background: none; padding: 0; flex: 0 0 auto; }
.stedit-top .var-status-label { flex: 1; min-width: 0; width: auto; font-weight: 600; font-size: 13.5px; border: 1px solid var(--separator); border-radius: 6px; padding: 5px 8px; background: transparent; }
.stedit-top .var-status-del { margin-left: auto; border: none; background: transparent; color: var(--label-2); cursor: pointer; font-size: 18px; line-height: 1; flex: 0 0 auto; }
.stedit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; }
.stedit-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stedit-f > span { font-size: 11.5px; font-weight: 600; color: var(--label-2); }
.stedit-f > small { font-size: 10px; color: var(--label-3); line-height: 1.3; }
.stedit-f input, .stedit-f select { width: 100%; font-size: 12.5px; border: 1px solid var(--separator); border-radius: 6px; padding: 5px 8px; background: transparent; color: inherit; }
.stedit-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--label-2); }
.stedit-check input { margin: 0; accent-color: var(--accent); }
@media (max-width: 560px) { .stedit-grid { grid-template-columns: 1fr; } }
/* dashboard-columns editor (Booking Settings) */
.var-columnlist { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.var-columnlist .var-col-add { align-self: flex-start; border: 1px dashed var(--separator); background: transparent; color: var(--label-2); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.var-col-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--separator); border-radius: 8px; padding: 5px 8px; background: var(--card); }
.var-col-move { display: inline-flex; flex-direction: column; gap: 1px; flex: 0 0 auto; }
.var-col-move button { border: none; background: transparent; color: var(--label-2); cursor: pointer; font-size: 9px; line-height: 1; padding: 1px 3px; }
.var-col-move button:disabled { opacity: .3; cursor: default; }
.var-col-color { width: 26px; height: 26px; border: none; background: none; padding: 0; flex: 0 0 auto; }
.var-col-name { flex: 1; min-width: 0; font-size: 13px; border: 1px solid var(--separator); border-radius: 6px; padding: 5px 8px; background: transparent; color: inherit; }
.var-col-del { margin-left: auto; border: none; background: transparent; color: var(--label-2); cursor: pointer; font-size: 16px; line-height: 1; flex: 0 0 auto; }
/* Booking Settings tab: full-width stacked sections (title/hint above the editor); the redundant category cap is hidden */
#bookingVarGroups .var-group-cap { display: none; }
#bookingVarGroups .var-row { grid-template-columns: 1fr; gap: 8px; }

/* Forms — sign-up PIN issue cards */
.sp-cards { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0 20px; }
.sp-card { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border: 1px solid var(--border, #d0d0d5); border-radius: 12px; background: var(--card, #fff); }
.sp-card h3 { margin: 0; }
.sp-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sp-msg { font-size: 13px; min-height: 18px; color: var(--muted, #666); }
.db-count.sp-active { color: #1a7f37; } .db-count.sp-used { color: #666; } .db-count.sp-expired { color: #b3261e; }

/* Customers/Drivers — NEW sign-up submissions strip (office review) */
.sp-new-row { background: #fff8e6; }
.sp-badge { font-size:11px; font-weight:700; color:#8a6d00; background:#ffe9a8; border-radius:6px; padding:2px 6px; align-self:center; }
.sp-accept { color:#1a7f37; } .sp-dismiss { color:#b3261e; }

/* ===== Nested navigation redesign (2026-07-19) ===== */
/* Section sub-nav: the active section's child row aligns under the first top-nav
   item; the grandchild row cascades under the selected child button. The left
   offsets are set by alignSectionNav() (JS) since they depend on live positions. */
/* full-width bar under the top nav; 22px inset matches .db-view so the sub-menu
   lines up with the content (heading/table) directly below it */
.section-nav { flex: 0 0 auto; padding: 8px 22px 4px; }
.section-nav.hidden { display: none; }
.section-nav-row { display: flex; align-items: center; gap: 12px; }
.section-nav-row .set-seg { display: inline-flex; flex: 0 0 auto; }
.section-nav-row .set-seg button { flex: 0 0 auto; }
.section-nav-sub { margin-top: 7px; }
/* child/grandchild buttons reuse the existing .set-seg segmented styling.
   The old per-view internal tab strips are replaced by this section sub-nav. */
#vehTabs, #fuelTabs, #driversTabs, .fin-subnav { display: none !important; }
/* WhatsApp inbox launcher: hidden while dormant (whatsapp:// deep-links still work). */
#waLauncher { display: none !important; }

/* "+ New" create dropdown (global, top-right) */
.new-menu { position: relative; display: inline-flex; }
.new-chev { width: 14px; height: 14px; margin-left: 1px; color: currentColor; }
.new-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 184px;
  background: var(--card); border: 1px solid var(--separator); border-radius: 12px;
  box-shadow: var(--card-shadow-hover); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.new-pop.hidden { display: none; }
.new-item { text-align: left; border: none; background: none; font: inherit; font-size: 13.5px;
  color: var(--label); padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.new-item:hover { background: var(--fill); }

/* right-hand slot on the section sub-nav row for page-level actions (POD matching's
   "Load PODs"); empty on every other page, so the row is unchanged there. */
.section-nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- Drivers -> Pay Rates ----------
   Rate pills on the list row, and the per-driver window: rate table on top,
   append-only change log at the bottom. Office-only surface - none of these
   values reach the driver portal. */
.pr-rate {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* An unset rate reads 0.00 but muted, so it is never mistaken for a real zero. */
.pr-rate-unset {
  opacity: 0.55;
  font-style: italic;
}

.pr-body {
  padding: 16px 20px;
  max-height: min(70vh, 620px);
  overflow: auto;
}

.pr-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* Admin -> Payroll tab: the catalogue editor. */
.payroll-section { margin-top: 18px; }
.payroll-table th, .payroll-table td { vertical-align: middle; }
.payroll-table .py-mid { text-align: center; }
.payroll-table .py-label { width: 100%; }

/* Drivers -> Pay Rates sub-tab: default rates split Payments | Deductions.
   Side by side on a wide office screen; wraps to stacked when narrow. */
.pr-cols { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.pr-col { flex: 1 1 320px; min-width: 0; }
.pr-col-head { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--label-2); }

/* The expandable change-log row under a rate (from -> to, who, when). */
.pr-logrow > td { padding: 2px 10px 10px; }
.pr-loginner { padding: 4px 0; }

/* Read-only rate cell on the informational Pay Rates sub-tab. */
.pr-readonly { font-variant-numeric: tabular-nums; }

/* Rate review wizard (Phase 1.5). */
.rv-warn { font-size: 15px; line-height: 1.55; }
.rv-ack { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.rv-eff { display: flex; align-items: center; gap: 6px; margin-right: 10px; }

.pr-table { width: 100%; border-collapse: collapse; }
.pr-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--label-3);
  padding: 6px 8px;
  border-bottom: 1px solid var(--separator);
}
.pr-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--separator);
  vertical-align: middle;
}
.pr-table input[type="number"],
.pr-table input[type="date"] {
  width: 110px;
  font-variant-numeric: tabular-nums;
}
.pr-source { color: var(--label-2); white-space: nowrap; }
.pr-row-actions { text-align: right; white-space: nowrap; }
.pr-hint { display: block; font-size: 11px; color: var(--label-3); }

.pr-log-title {
  margin: 20px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
}
.pr-log { list-style: none; margin: 0; padding: 0; }
.pr-log li {
  padding: 7px 0;
  border-bottom: 1px solid var(--separator);
  font-size: 13px;
  color: var(--label);
}
.pr-log li:last-child { border-bottom: 0; }
.pr-log em { color: var(--label-2); font-style: normal; }
.pr-log .hint { margin-left: 6px; color: var(--label-3); }

.pg-add { margin-top: 14px; }

/* The rate table is the widest thing in these windows; let it scroll rather
   than force the modal wider than the viewport on a laptop. */
@media (max-width: 640px) {
  .pr-body { padding: 12px; }
  .pr-table { display: block; overflow-x: auto; }
}

/* A status entry in the timesheet change log is a sign-off, not a field edit -
   who authorised someone's pay, and when. Marked so it reads as a distinct
   event rather than as a correction to a field called "Status". */
.tsr-log-status { border-left: 2px solid var(--accent); padding-left: 8px; }
.tsr-log-status .tsr-log-change b { color: var(--accent); }
.tsr-log-from { color: var(--label-3); font-size: 12px; }
