/* =============================================================
   Outward/Dispatch — style.css
   Design system: Linear (DESIGN.md) — light mode
   - Canvas #f7f8fa · Surface ladder ffffff → e6e9ee
   - Lavender accent #5e6ad2 (scarce: mark, CTA, focus)
   - Status colors reserved for data badges only (in-product palette)
   ============================================================= */

:root {
  /* Brand & accent */
  --primary: #5e6ad2;
  --on-primary: #ffffff;
  --primary-hover: #6c77e6;
  --primary-focus: #4f5cd6;
  --brand-secure: #5a5f8a;

  /* Text */
  --ink: #1a1d21;
  --ink-muted: #3f454d;
  --ink-subtle: #6b7078;
  --ink-tertiary: #9ca1a8;

  /* Surface ladder */
  --canvas: #f7f8fa;
  --surface-1: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #eceff3;
  --surface-4: #e6e9ee;
  --hairline: #e5e8ec;
  --hairline-strong: #d4d8de;
  --hairline-tertiary: #c2c7ce;

  /* Semantic */
  --semantic-success: #27a644;
  --semantic-overlay: #000000;

  /* Data badge palette (in-product, per spec) */
  --p1: #e5484d;        /* soft red */
  --p2: #f5a623;        /* amber */
  --p3: #4aa8ff;        /* blue */
  --p4: #8a8f98;        /* gray */
  --ack-done: #27a644;  /* emerald */
  --ack-transit: #4aa8ff; /* light blue */
  --ack-pending: #f59e0b; /* orange */

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 9999px;

  /* Spacing */
  --s-xxs: 4px;
  --s-xs: 8px;
  --s-sm: 12px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --s-xxl: 48px;

  /* Type */
  --font-display: "Inter", "SF Pro Display", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-text: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-sans: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --nav-h: 56px;
  --maxw: 1600px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.05px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

button {
  font-family: var(--font-text);
  cursor: pointer;
}

input,
textarea {
  font-family: var(--font-text);
}

::selection {
  background: rgba(94, 106, 210, 0.35);
  color: var(--ink);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--canvas);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: 2px solid var(--canvas);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--hairline-strong);
}

/* ---------- Utilities ---------- */
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-subtle);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid rgba(94, 105, 209, 0.5);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- Top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: rgba(247, 248, 250, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.topnav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--s-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  height: 28px;
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 26px;
  width: auto;
  max-width: 160px;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-xs);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  border: 1px solid transparent;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  min-height: 40px;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-focus);
}

.btn-secondary {
  background: var(--surface-1);
  color: var(--ink);
  border-color: var(--hairline);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
}

.btn-tertiary {
  background: transparent;
  color: var(--ink-muted);
}

.btn-tertiary:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-1);
}

.btn .spin {
  animation: spin 0.8s linear infinite;
}

.btn.is-on {
  background: var(--primary);
  color: var(--on-primary);
  border-color: transparent;
}

.btn.is-on:hover:not(:disabled) {
  background: var(--primary-hover);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--s-lg);
}

/* ---------- Access gate ---------- */
.access-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(94, 106, 210, 0.08), transparent 60%), var(--canvas);
}

body.gate-locked {
  overflow: hidden;
}

.gate-card {
  width: 100%;
  max-width: 320px;
  text-align: center;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: var(--s-xl);
  box-shadow: 0 12px 40px rgba(20, 24, 32, 0.08);
}

.gate-logo {
  margin-bottom: var(--s-md);
}

.gate-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin-bottom: var(--s-xxs);
}

.gate-sub {
  font-size: 13px;
  color: var(--ink-subtle);
  margin-bottom: var(--s-lg);
}

.gate-code {
  display: flex;
  justify-content: center;
  gap: var(--s-sm);
  margin-bottom: var(--s-lg);
  min-height: 16px;
}

.gate-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  background: transparent;
  transition: background 120ms ease, border-color 120ms ease;
}

.gate-dot.is-filled {
  background: var(--primary);
  border-color: var(--primary);
}

.gate-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-sm);
  margin-bottom: var(--s-md);
}

.gate-key {
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 500;
  font-family: var(--font-text);
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  transition: background 100ms ease, border-color 100ms ease;
}

.gate-key:hover {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
}

.gate-key:active {
  background: var(--surface-3);
}

.gate-key svg {
  width: 18px;
  height: 18px;
  color: var(--ink-subtle);
}

.gate-key-empty {
  pointer-events: none;
}

.gate-error {
  font-size: 13px;
  font-weight: 500;
  color: var(--p1);
  margin: 0 0 var(--s-md);
}

.access-gate #gateInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.gate-card .btn {
  width: 100%;
  justify-content: center;
}

/* ---------- Hero ---------- */
.hero {
  padding: var(--s-xxl) 0 var(--s-xl);
}

.eyebrow {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--primary-hover);
  margin-bottom: var(--s-sm);
}

.display {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--ink);
}

.subhead {
  margin-top: var(--s-sm);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.2px;
  color: var(--ink-muted);
  max-width: 640px;
}

/* ---------- No-JavaScript fallback ---------- */
.noscript-banner {
  margin: var(--s-xl) 0;
  padding: var(--s-xl);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  max-width: 720px;
}
.noscript-banner h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin: 0 0 var(--s-sm);
}
.noscript-banner p {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: 0 0 var(--s-sm);
}
.noscript-banner ul {
  margin: 0 0 var(--s-sm);
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-muted);
}
.noscript-banner a {
  color: var(--primary-focus);
  font-weight: 600;
  text-decoration: none;
}
.noscript-banner a:hover {
  text-decoration: underline;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
}

/* ---------- Ingest / dropzone ---------- */
.ingest-panel {
  padding: var(--s-lg);
}

.dropzone {
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-xl);
  background: var(--surface-1);
  padding: var(--s-xl) var(--s-lg);
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease;
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--primary);
}

.dropzone.is-dragover {
  border-color: var(--primary);
  background: rgba(94, 106, 210, 0.06);
}

.dz-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto var(--s-sm);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--primary-hover);
  display: grid;
  place-items: center;
}

.dz-icon svg {
  width: 20px;
  height: 20px;
}

.dz-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--ink);
}

.dz-sub {
  margin-top: var(--s-xxs);
  font-size: 13px;
  color: var(--ink-subtle);
}

.dz-actions {
  margin-top: var(--s-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-sm);
  flex-wrap: wrap;
}

.dz-or {
  font-size: 13px;
  color: var(--ink-tertiary);
}

.dz-foot {
  margin-top: var(--s-md);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-tertiary);
}

.error-banner {
  margin-top: var(--s-md);
  border: 1px solid rgba(229, 72, 77, 0.35);
  background: rgba(229, 72, 77, 0.06);
  color: #c9383f;
  border-radius: var(--r-md);
  padding: var(--s-sm) var(--s-md);
  font-size: 14px;
  display: flex;
  gap: var(--s-xs);
  align-items: flex-start;
}

.error-banner svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}

.error-banner .error-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #c9383f;
  opacity: 0.7;
  padding: 0;
  display: grid;
  place-items: center;
}

.error-banner .error-close:hover {
  opacity: 1;
}

.error-banner .error-close svg {
  width: 14px;
  height: 14px;
}

/* ---------- KPI grid ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-md);
  margin-top: var(--s-xl);
}

.kpi-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-md);
  display: flex;
  gap: var(--s-sm);
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(26, 29, 33, 0.08), transparent);
}

.kpi-card-danger {
  border-color: var(--clr-pending);
}

.kpi-card-danger .kpi-value {
  color: var(--clr-pending);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--primary-hover);
  display: grid;
  place-items: center;
  flex: none;
}

.kpi-icon svg {
  width: 17px;
  height: 17px;
}

.kpi-icon-danger {
  color: var(--p1);
}

.kpi-icon-success {
  color: var(--semantic-success);
}

.kpi-body {
  min-width: 0;
}

.kpi-label {
  font-size: 13px;
  color: var(--ink-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  margin-top: var(--s-xxs);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.15;
  color: var(--ink);
}

.kpi-mono {
  font-family: var(--font-mono);
  font-weight: 500;
}

.kpi-note {
  margin-top: var(--s-xxs);
  font-size: 12px;
  color: var(--ink-tertiary);
}

/* ---------- Top overview (KPIs) ---------- */
.top-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-md);
  margin-top: var(--s-md);
  align-items: stretch;
}

.top-overview .kpis {
  margin-top: 0;
}

/* ---------- Route KPIs (R1–R7) ---------- */
.route-kpis {
  margin-top: var(--s-md);
}

.route-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: var(--s-sm);
  margin-top: var(--s-md);
}

.route-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--s-xs);
  align-items: flex-start;
  text-align: left;
  font: inherit;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-sm);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.route-kpi:hover {
  border-color: var(--hairline-strong);
  box-shadow: 0 1px 4px rgba(26, 29, 33, 0.06);
}
.route-kpi:focus-visible {
  outline: 2px solid var(--primary-focus);
  outline-offset: 2px;
}
.route-kpi.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.route-kpi.is-empty {
  opacity: 0.55;
}

.route-kpi-head {
  display: flex;
  align-items: center;
  gap: var(--s-xxs);
  min-width: 0;
  width: 100%;
}
.route-kpi-code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.route-kpi-name {
  font-size: 12px;
  color: var(--ink-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.route-kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.1;
  color: var(--ink);
}

.route-kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-xxs);
  min-width: 0;
  width: 100%;
}
.route-kpi-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-subtle);
}
.route-kpi-pct.is-mid {
  color: var(--p2);
}
.route-kpi-pct.is-low {
  color: var(--p1);
}
.route-kpi-dim {
  font-size: 11px;
  color: var(--ink-tertiary);
}

.alert-center {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.alert-drag-handle {
  display: none;
}

.alert-floating {
  position: fixed;
  top: calc(var(--nav-h) + var(--s-md));
  right: var(--s-md);
  width: 340px;
  max-height: calc(100vh - var(--nav-h) - var(--s-xl));
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
  border-top: 3px solid var(--primary);
  animation: alert-slide-in 0.2s ease-out;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}

@keyframes alert-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-floating::-webkit-scrollbar {
  width: 5px;
}

.alert-floating::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 3px;
}

.alert-actions {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
}

.alert-toggle {
  padding: 4px 6px !important;
}

.alert-toggle i {
  width: 14px;
  height: 14px;
}

.alert-body {
  overflow-y: auto;
  overflow-x: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 50vh;
  opacity: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}

.alert-body::-webkit-scrollbar {
  width: 5px;
}

.alert-body::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 3px;
}

.alert-center.is-minimized .alert-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.alert-center.is-minimized {
  width: auto;
  min-width: 0;
}

.alert-center.is-minimized .card-sub {
  display: none;
}

.alert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-sm);
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--hairline);
}

.alert-head .card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-head .card-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.alert-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  margin-top: var(--s-sm);
  margin-bottom: var(--s-xxs);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-1);
  padding: 8px 10px;
  font-size: 12.5px;
  font-family: var(--font-text);
  color: var(--ink-muted);
  text-align: left;
  line-height: 1.35;
  transition: background 120ms ease, border-color 120ms ease;
}

.alert-item > i {
  width: 15px;
  height: 15px;
  flex: none;
}

.alert-item .dot {
  flex: none;
  width: 8px;
  height: 8px;
}

.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-title {
  display: block;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-meta {
  display: block;
  font-size: 11px;
  color: var(--ink-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.alert-age,
.alert-count {
  margin-left: auto;
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2, rgba(0,0,0,0.03));
}

.alert-priority {
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
  position: relative;
  overflow: hidden;
}

.alert-priority::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.alert-priority:hover {
  background: var(--surface-2, rgba(0,0,0,0.02));
}

.alert-priority.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  background: rgba(79, 70, 229, 0.04);
}

/* Priority severity borders */
.alert-critical::before { background: var(--p1); }
.alert-warn::before { background: var(--p2); }
.alert-info::before { background: var(--p3); }
.alert-ok::before { background: var(--ack-done); }

.alert-item.alert-critical {
  border-color: rgba(229, 72, 77, 0.35);
  background: rgba(229, 72, 77, 0.04);
}

.alert-item.alert-critical > i,
.alert-item.alert-critical .alert-age,
.alert-item.alert-critical .alert-count {
  color: var(--p1);
}

.alert-item.alert-critical .alert-age,
.alert-item.alert-critical .alert-count {
  background: rgba(229, 72, 77, 0.08);
}

.alert-item.alert-warn {
  border-color: rgba(245, 166, 35, 0.35);
  background: rgba(245, 166, 35, 0.04);
}

.alert-item.alert-warn > i,
.alert-item.alert-warn .alert-age,
.alert-item.alert-warn .alert-count {
  color: #a86f00;
}

.alert-item.alert-warn .alert-age,
.alert-item.alert-warn .alert-count {
  background: rgba(245, 166, 35, 0.08);
}

.alert-item.alert-info {
  border-color: rgba(74, 168, 255, 0.25);
  background: rgba(74, 168, 255, 0.03);
}

.alert-item.alert-info > i,
.alert-item.alert-info .alert-age,
.alert-item.alert-info .alert-count {
  color: var(--p3);
}

.alert-item.alert-info .alert-age,
.alert-item.alert-info .alert-count {
  background: rgba(74, 168, 255, 0.06);
}

.alert-item.alert-ok {
  border-color: rgba(72, 199, 142, 0.25);
  background: rgba(72, 199, 142, 0.03);
}

.alert-item.alert-ok > i,
.alert-item.alert-ok .alert-age,
.alert-item.alert-ok .alert-count {
  color: var(--ack-done);
}

.alert-item.alert-ok .alert-age,
.alert-item.alert-ok .alert-count {
  background: rgba(72, 199, 142, 0.06);
}

/* ---------- Context strip (route + priority descriptions) ---------- */
.context-strip {
  margin-top: var(--s-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-lg) var(--s-xl);
  padding: var(--s-sm) var(--s-lg);
}

.ctx-block {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
}

.ctx-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.ctx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ctx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  white-space: nowrap;
}

.ctx-chip.is-active {
  color: var(--ink);
  border-color: var(--hairline-strong);
  background: var(--surface-1);
}

/* ---------- Filters ---------- */
.filters {
  margin-top: var(--s-lg);
  display: flex;
  align-items: center;
  gap: var(--s-lg);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
}

.filter-label {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.customer-filter-bar {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding-top: var(--s-sm);
  border-top: 1px solid var(--hairline);
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-row {
  display: flex;
  gap: var(--s-xxs);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 3px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-subtle);
  min-height: 30px;
  transition: background-color 120ms ease, color 120ms ease;
}

.pill:hover {
  color: var(--ink);
}

.pill.is-active {
  background: var(--surface-2);
  color: var(--ink);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  flex: none;
}

.dot-p1 { background: var(--p1); }
.dot-p2 { background: var(--p2); }
.dot-p3 { background: var(--p3); }
.dot-p4 { background: var(--p4); }
.dot-done { background: var(--ack-done); }
.dot-transit { background: var(--ack-transit); }
.dot-pending { background: var(--ack-pending); }

/* ---------- Charts ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--s-md);
  margin-top: var(--s-lg);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-sm);
  margin-bottom: var(--s-md);
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.card-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-subtle);
}

.chart-box {
  position: relative;
  height: 340px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-xs);
  color: var(--ink-tertiary);
  font-size: 13px;
}

.chart-empty svg {
  width: 26px;
  height: 26px;
  color: var(--ink-tertiary);
}

.info-banner {
  margin-top: var(--s-md);
  border: 1px solid rgba(245, 166, 35, 0.35);
  background: rgba(245, 166, 35, 0.08);
  color: #9a6a00;
  border-radius: var(--r-md);
  padding: var(--s-sm) var(--s-md);
  font-size: 14px;
  display: flex;
  gap: var(--s-xs);
  align-items: flex-start;
  line-height: 1.5;
}

.info-banner svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  color: var(--p2);
}

.info-banner .error-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #9a6a00;
  opacity: 0.7;
  padding: 0;
  display: grid;
  place-items: center;
}

.info-banner .error-close:hover {
  opacity: 1;
}

.info-banner .error-close svg {
  width: 14px;
  height: 14px;
}

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.4;
  border-radius: var(--r-pill);
  padding: 2px 10px;
  border: 1px solid var(--hairline);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* ---------- Table ---------- */
.table-panel {
  margin-top: var(--s-md);
  padding: 0;
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  padding: var(--s-lg) var(--s-lg) var(--s-md);
  flex-wrap: wrap;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 0 var(--s-sm);
  min-height: 40px;
  width: 300px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.search-box:focus-within {
  border-color: var(--hairline-strong);
  box-shadow: 0 0 0 2px rgba(94, 105, 209, 0.25);
}

.search-box svg {
  width: 15px;
  height: 15px;
  color: var(--ink-tertiary);
  flex: none;
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.search-box input::placeholder {
  color: var(--ink-tertiary);
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--hairline);
}

.table-wrap.collapsed {
  display: none;
}

.collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-subtle);
  transition: background 120ms ease, color 120ms ease;
  vertical-align: middle;
  margin-right: var(--s-xs);
  flex-shrink: 0;
}

.collapse-toggle:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.collapse-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 200ms ease;
}

.collapse-toggle[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-xs);
}

.today-date {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-subtle);
  margin-left: var(--s-xs);
}

.dispatch-date-filter {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  flex-shrink: 0;
}

.dispatch-date-filter .filter-label {
  font-size: 12px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 900px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-subtle);
  padding: 10px var(--s-md);
  border-bottom: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
  white-space: nowrap;
}

thead th:last-child {
  border-right: none;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--ink-muted);
}

.th-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sort-ind {
  display: inline-block;
  width: 12px;
  height: 12px;
  vertical-align: -2px;
  color: var(--primary-hover);
  opacity: 0;
}

th.sortable.sorted .sort-ind {
  opacity: 1;
}

.sort-ind svg {
  width: 12px;
  height: 12px;
}

tbody td {
  padding: 10px var(--s-md);
  border-bottom: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
  color: var(--ink-muted);
  vertical-align: middle;
  overflow-wrap: break-word;
}

tbody td:last-child {
  border-right: none;
}

tbody tr {
  transition: background-color 100ms ease;
}

tbody tr:hover {
  background: var(--surface-2);
}

td.td-strong {
  color: var(--ink);
  font-weight: 500;
}

td.td-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

td.td-date .pending-date {
  color: var(--ink-tertiary);
  font-style: italic;
}

tr.row-empty td {
  text-align: center;
  padding: var(--s-xl) var(--s-md);
  color: var(--ink-tertiary);
}

/* ---------- Data badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--r-pill);
  padding: 2px 10px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge .dot {
  width: 6px;
  height: 6px;
}

.badge-p1 { color: #c9383f; background: rgba(229, 72, 77, 0.08); border-color: rgba(229, 72, 77, 0.3); }
.badge-p2 { color: #a86f00; background: rgba(245, 166, 35, 0.1); border-color: rgba(245, 166, 35, 0.3); }
.badge-p3 { color: #1f7fd6; background: rgba(74, 168, 255, 0.1); border-color: rgba(74, 168, 255, 0.3); }
.badge-p4 { color: #5c636b; background: rgba(138, 143, 152, 0.1); border-color: rgba(138, 143, 152, 0.3); }
.badge-neutral { color: var(--ink-subtle); background: var(--surface-2); border-color: var(--hairline); }

.badge-done { color: #1f7a37; background: rgba(39, 166, 68, 0.1); border-color: rgba(39, 166, 68, 0.3); }
.badge-transit { color: #1f7fd6; background: rgba(74, 168, 255, 0.1); border-color: rgba(74, 168, 255, 0.3); }
.badge-pending { color: #a86f00; background: rgba(245, 159, 11, 0.1); border-color: rgba(245, 159, 11, 0.3); }

/* ---------- View tabs ---------- */
.tabs {
  display: flex;
  gap: var(--s-xxs);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 3px;
  width: max-content;
  max-width: 100%;
  margin-top: var(--s-xl);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-subtle);
  min-height: 34px;
  transition: background-color 120ms ease, color 120ms ease;
}

.tab svg {
  width: 15px;
  height: 15px;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  background: var(--surface-2);
  color: var(--ink);
}

/* ---------- Customer directory ---------- */
.directory-panel {
  margin-top: var(--s-md);
  padding: 0;
  overflow: hidden;
}

th.th-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3px;
}

td.td-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

td.td-dim {
  color: var(--ink-subtle);
}

th.th-actions {
  text-align: right;
}

td.td-actions {
  text-align: right;
  white-space: nowrap;
}

.jump-link {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}

.jump-link:hover {
  text-decoration: underline;
}

.jump-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-radius: 3px;
}

tr.cust-row.is-clickable {
  cursor: pointer;
}

tr.cust-row.is-clickable:hover {
  background: var(--surface-2);
}

tr.cust-row.is-clickable:focus-visible {
  outline-offset: -2px;
}

.cust-open {
  font-weight: 500;
  color: var(--p1);
}

.cust-open.is-zero {
  color: var(--ink-subtle);
}

.count-chip {
  display: inline-flex;
  align-items: center;
  min-width: 26px;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 1px 8px;
}

.count-chip.is-muted {
  color: var(--ink-tertiary);
}

.zone-chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 2px 9px;
}

/* ---------- Branch drawer ---------- */
.branch-drawer {
  border-top: 1px solid var(--hairline);
  background: var(--surface-1);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  padding: var(--s-md) var(--s-lg) 0;
}

.drawer-head .card-title {
  font-size: 15px;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: var(--s-xxl);
  padding: var(--s-lg) 0 var(--s-xl);
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  gap: var(--s-md);
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-subtle);
}

.footer-meta {
  color: var(--ink-tertiary);
}

.footer-link {
  color: var(--ink-subtle);
  text-decoration: none;
  font-weight: 600;
}
.footer-link:hover {
  color: var(--primary-focus);
  text-decoration: underline;
}

.footer-dashboards {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: var(--s-sm);
  flex-wrap: wrap;
  padding-top: var(--s-sm);
  border-top: 1px solid var(--hairline);
  margin-top: var(--s-xs);
}
.footer-dashboards-label {
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
}
.footer-dashboards-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-xs) var(--s-md);
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(94, 106, 210, 0.3);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

/* ---------- Bell icon button ---------- */
.bell-btn {
  position: relative;
}

.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--p1);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
}

.bell-btn.has-alerts {
  border-color: rgba(201, 56, 63, 0.4);
}

.bell-btn.is-active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.bell-btn.is-active .bell-badge {
  background: #fff;
  color: var(--primary);
}

/* ---------- Section spacing ---------- */
.main > section,
main > section,
main > div,
.container > section,
.container > div {
  margin-top: var(--s-xl);
}

.main > section:first-child,
main > section:first-child {
  margin-top: 0;
}

.hero + section,
.hero + div {
  margin-top: 0;
}

.tabs + div,
.tabs + section {
  margin-top: var(--s-lg);
}

/* ---------- Multi-select dropdown ---------- */
.dropdown-multi {
  position: relative;
}

.dropdown-multi-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 160px;
  max-width: 260px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.dropdown-multi-btn:hover {
  border-color: var(--hairline-strong);
}

.dropdown-multi-btn:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(94, 106, 210, 0.15);
  outline: none;
}

.dropdown-multi-btn i {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--ink-subtle);
  transition: transform 140ms ease;
}

.dropdown-multi-btn[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.dropdown-multi-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  min-width: 220px;
  max-width: 300px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  animation: dropdown-in 120ms ease;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-multi-search {
  padding: 6px;
  border-bottom: 1px solid var(--hairline);
}

.dropdown-multi-search input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12.5px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
  font-family: var(--font-text);
}

.dropdown-multi-search input:focus {
  border-color: var(--primary);
}

.dropdown-multi-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}

.dropdown-multi-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 100ms ease;
  user-select: none;
}

.dropdown-multi-item:hover {
  background: var(--surface-2);
}

.dropdown-multi-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: none;
}

.dropdown-multi-item .dm-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-multi-footer {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid var(--hairline);
}

.dropdown-multi-footer button {
  flex: 1;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color 100ms ease;
}

.dropdown-multi-footer button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  top: calc(var(--nav-h) + var(--s-sm));
  right: var(--s-md);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--s-xs);
  max-width: 380px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--s-xs);
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  animation: toast-in 200ms ease-out;
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}

.toast-success svg { color: var(--semantic-success); }
.toast-error svg { color: var(--p1); }
.toast-info svg { color: var(--primary-hover); }

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-out {
  animation: toast-out 200ms ease-in forwards;
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

/* ---------- Date-range filter ---------- */
.filter-select {
  min-height: 34px;
  max-width: 220px;
  padding: 0 8px;
  font-family: var(--font-text);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  outline: none;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.filter-select:hover {
  border-color: var(--hairline-strong);
}

.filter-select:focus {
  border-color: var(--hairline-strong);
  box-shadow: 0 0 0 2px rgba(94, 105, 209, 0.25);
}

.date-input {
  min-height: 34px;
  padding: 0 10px;
  font-family: var(--font-text);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.date-input:focus {
  border-color: var(--hairline-strong);
  box-shadow: 0 0 0 2px rgba(94, 105, 209, 0.25);
}

.date-sep {
  color: var(--ink-tertiary);
  font-size: 13px;
}

/* ---------- Trend chart ---------- */
.trend-card {
  margin-top: var(--s-lg);
}

/* ---------- Data quality ---------- */
.quality-panel {
  margin-top: var(--s-md);
}

.backlog-empty {
  font-size: 13px;
  color: var(--ink-tertiary);
  padding: var(--s-md) 0;
}

.quality-report {
  margin-top: var(--s-md);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.quality-cat {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-1);
  overflow: hidden;
}

.quality-cat-head {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding: var(--s-sm) var(--s-md);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-2);
}

.quality-cat-head .qc-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.quality-cat-head .qc-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--p2);
}

.quality-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.quality-table td {
  padding: 7px var(--s-md);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.quality-table tr:last-child td {
  border-bottom: none;
}

.quality-table td.qc-strong {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- Routes overview ---------- */
.routes-panel {
  margin-top: var(--s-md);
  padding: 0;
  overflow: hidden;
}

/* ---------- Zone-wise traffic ---------- */
.zones-panel {
  margin-top: var(--s-md);
  padding: 0;
  overflow: hidden;
}

.zone-row {
  cursor: pointer;
}

.zone-row.is-active td {
  background: rgba(94, 106, 210, 0.06);
}

.route-row {
  cursor: pointer;
}

.route-row.is-active td {
  background: rgba(94, 106, 210, 0.06);
}

.route-row.is-active .route-chip {
  background: var(--primary);
  color: var(--on-primary);
  border-color: transparent;
}

.route-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  background: rgba(94, 106, 210, 0.08);
  border: 1px solid rgba(94, 106, 210, 0.25);
  border-radius: var(--r-pill);
  padding: 1px 8px;
}

.fulfillment {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.fulfillment-track {
  flex: 1;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.fulfillment-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--semantic-success);
  min-width: 2px;
}

.fulfillment-fill.is-mid {
  background: var(--p2);
}

.fulfillment-fill.is-low {
  background: var(--p1);
}

.fulfillment-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-subtle);
  min-width: 40px;
  text-align: right;
}

/* ---------- Route guide ---------- */
.route-guide {
  margin-top: var(--s-md);
}

.route-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-md);
}

.route-guide-card {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  border-top: 3px solid var(--rg, var(--primary));
  padding: var(--s-md);
}

.rg-1 { --rg: #27a644; --rg-soft: rgba(39, 166, 68, 0.10); }
.rg-2 { --rg: #5e6ad2; --rg-soft: rgba(94, 106, 210, 0.10); }
.rg-3 { --rg: #e5484d; --rg-soft: rgba(229, 72, 77, 0.10); }
.rg-4 { --rg: #b87800; --rg-soft: rgba(245, 166, 35, 0.14); }
.rg-5 { --rg: #6b7280; --rg-soft: rgba(138, 143, 152, 0.14); }
.rg-6 { --rg: #9333ea; --rg-soft: rgba(147, 51, 234, 0.12); }
.rg-7 { --rg: #0d9488; --rg-soft: rgba(13, 148, 136, 0.12); }

.rg-head {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  margin-bottom: var(--s-xs);
}

.rg-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--rg, var(--primary));
  background: var(--rg-soft, rgba(94, 106, 210, 0.08));
  border: 1px solid var(--rg, var(--primary));
  border-radius: var(--r-pill);
  padding: 1px 9px;
}

.rg-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.rg-arrow {
  margin-left: auto;
  width: 16px;
  height: 16px;
  color: var(--rg, var(--primary));
}

.rg-hub {
  font-size: 12px;
  color: var(--ink-subtle);
  margin: 0 0 var(--s-sm);
}

.status-badge svg {
  width: 14px;
  height: 14px;
}

.rg-zone {
  margin-top: var(--s-sm);
}

.rg-zone-name {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  margin: 0 0 3px;
}

.rg-circles {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
}

.rg-overlap {
  margin-top: var(--s-sm);
  padding-top: var(--s-sm);
  border-top: 1px dashed var(--hairline-strong);
}

.rg-overlap-row {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.rg-overlap-key {
  display: inline-block;
  min-width: 108px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.rg-overlap-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
  white-space: nowrap;
}

.rg-overlap-name {
  font-size: 12px;
  color: var(--ink-muted);
}

.rg-overlap-none {
  color: var(--ink-tertiary);
}

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

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--s-md);
  }

  .hero {
    padding-top: var(--s-xl);
  }

  .display {
    font-size: 32px;
    letter-spacing: -0.8px;
  }

  .subhead {
    font-size: 17px;
  }

  .search-box {
    width: 100%;
  }

  .table-actions,
  .table-head {
    width: 100%;
  }

  .dispatch-date-filter {
    flex-wrap: wrap;
  }

  .filters {
    gap: var(--s-md);
  }

  .bell-btn {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .bell-badge {
    top: 1px;
    right: 1px;
  }

  .alert-floating {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    border-top: 3px solid var(--primary);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    animation: alert-slide-up 0.25s ease-out;
  }

  .alert-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0 4px;
  }

  .alert-drag-handle::after {
    content: '';
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--hairline-strong);
  }

  @keyframes alert-slide-up {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }

  .alert-center.is-minimized {
    width: 100%;
    min-width: 0;
  }
  .alert-body {
    max-height: 55vh;
  }
}

@media (max-width: 480px) {
  .kpis {
    grid-template-columns: 1fr;
  }

  .brand-name {
    display: none;
  }

  .topnav-right .btn span {
    display: none;
  }

  .topnav-right .btn {
    padding: 8px 10px;
  }

  .bell-btn {
    position: relative;
  }

  .bell-badge {
    top: 0;
    right: 0;
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    padding: 0 3px;
  }

  .alert-floating {
    max-height: 75vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    margin: 0;
  }

  .alert-body {
    max-height: 60vh;
  }

  .alert-head .card-title {
    font-size: 14px;
  }

  .alert-item {
    padding: 8px 10px;
    font-size: 12px;
  }

  .alert-count,
  .alert-age {
    font-size: 10px;
    padding: 2px 5px;
  }

  .dz-actions {
    flex-direction: column;
  }
}

/* ---------- Route Ops: SLA escalation ---------- */
.sla-panel,
.map-panel,
.loadplan-panel {
  margin-top: var(--s-md);
}

.sla-settings {
  padding: var(--s-md) var(--s-lg) 0;
}

.sla-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-sm);
}

.sla-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.sla-field input {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  width: 100%;
}

.sla-actions {
  display: flex;
  gap: var(--s-xs);
  margin-top: var(--s-md);
}

.sla-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--r-pill);
  padding: 2px 10px;
}

.sla-breached { color: #c9383f; background: rgba(229, 72, 77, 0.08); border: 1px solid rgba(229, 72, 77, 0.3); }
.sla-at-risk { color: #a86f00; background: rgba(245, 166, 35, 0.1); border: 1px solid rgba(245, 166, 35, 0.3); }
.sla-on-track { color: #1f7a37; background: rgba(39, 166, 68, 0.1); border: 1px solid rgba(39, 166, 68, 0.3); }

tr.row-sla-breached { background: rgba(229, 72, 77, 0.05); }
tr.row-sla-at-risk { background: rgba(245, 166, 35, 0.04); }

/* ---------- ALL Complete table ---------- */
.complete-head {
  border-top: 1px solid var(--hairline);
  margin-top: 0;
  padding-top: var(--s-lg);
}

.complete-badge {
  color: #1f7a37;
  background: rgba(39, 166, 68, 0.1);
  border-color: rgba(39, 166, 68, 0.3);
}

tr.row-complete {
  background: rgba(39, 166, 68, 0.07);
}

tr.row-complete:hover {
  background: rgba(39, 166, 68, 0.12);
}

.complete-more {
  display: flex;
  justify-content: center;
  padding: var(--s-md) 0 var(--s-sm);
  border-top: 1px solid var(--hairline);
}

.complete-more[hidden] {
  display: none;
}

/* ---------- Route Ops: map ---------- */
.map-body {
  position: relative;
}

.route-map {
  height: 420px;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.route-map .leaflet-container {
  font-family: var(--font-sans);
}

.route-map-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: var(--s-md);
  text-align: center;
  pointer-events: none;
  z-index: 500;
}

/* ---------- Route Ops: route focus tabs ---------- */
.route-tabs-panel {
  margin-top: var(--s-md);
}

.route-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm);
}

.route-tab {
  flex: 1 1 170px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--rt, var(--primary));
  border-radius: var(--r-md);
  padding: var(--s-sm) var(--s-md);
  cursor: pointer;
}

.route-tab:hover {
  border-color: var(--primary);
}

.route-tab.is-active {
  background: var(--surface-1);
  border-color: var(--rt, var(--primary));
  box-shadow: 0 0 0 1px var(--rt, var(--primary));
}

.route-tab-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--rt, var(--primary));
}

.route-tab-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-subtle);
}

/* ---------- Route Ops: ABC ---------- */
.dot-abc-a { background: var(--p1); }
.dot-abc-b { background: var(--p2); }
.dot-abc-c { background: var(--p4); }

.abc-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
}

.abc-A { color: #c9383f; background: rgba(229, 72, 77, 0.1); border: 1px solid rgba(229, 72, 77, 0.35); }
.abc-B { color: #a86f00; background: rgba(245, 166, 35, 0.1); border: 1px solid rgba(245, 166, 35, 0.35); }
.abc-C { color: #5c636b; background: rgba(138, 143, 152, 0.12); border: 1px solid rgba(138, 143, 152, 0.35); }

/* ---------- Route Ops: load plans ---------- */
.lp-route {
  border-top: 1px solid var(--hairline);
  padding: var(--s-md) var(--s-lg);
}

.lp-route:first-child {
  border-top: none;
}

.lp-head {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  margin-bottom: var(--s-sm);
}

.lp-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.lp-export {
  margin-left: auto;
  white-space: nowrap;
}

.lp-name .lp-dim {
  color: var(--ink-subtle);
  font-weight: 500;
  font-size: 12.5px;
}

.lp-circle {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: var(--s-sm);
  overflow: hidden;
}

.lp-circle-head {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  padding: 8px 12px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
}

.lp-bucket {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 1px 8px;
  white-space: nowrap;
}

.lp-bucket-early { color: #1f7a37; background: rgba(39, 166, 68, 0.1); border-color: rgba(39, 166, 68, 0.3); }
.lp-bucket-morning { color: #1f7fd6; background: rgba(74, 168, 255, 0.1); border-color: rgba(74, 168, 255, 0.3); }
.lp-bucket-truck { color: #a86f00; background: rgba(245, 166, 35, 0.1); border-color: rgba(245, 166, 35, 0.3); }
.lp-bucket-offpeak { color: #5c636b; background: rgba(138, 143, 152, 0.1); border-color: rgba(138, 143, 152, 0.3); }
.lp-bucket-any { color: #3f4b9e; background: rgba(94, 106, 210, 0.1); border-color: rgba(94, 106, 210, 0.3); }

.lp-circle-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.lp-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.lp-note {
  font-size: 12px;
  color: var(--ink-subtle);
  margin: 8px 12px 4px;
}

.lp-rows {
  display: flex;
  flex-direction: column;
}

.lp-row {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  padding: 6px 12px;
  border-top: 1px solid var(--hairline);
  font-size: 12.5px;
}

.lp-row:first-child {
  border-top: none;
}

.lp-row-c {
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp-row-inv {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-subtle);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-row-b {
  color: var(--ink-subtle);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm) var(--s-lg);
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.lp-stat b {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  margin-right: 4px;
}

.lp-bar {
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: var(--s-sm);
}

.lp-bar-sm {
  height: 3px;
  margin: 6px 12px 2px;
}

.lp-fill {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: var(--r-pill);
}

.lp-fill-done {
  background: #27a644;
}

.lp-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.lp-row-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.lp-row-status {
  font-size: 11px;
  color: var(--ink-subtle);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Print (driver manifests) ---------- */
.print-only {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  #printArea,
  #printArea * {
    visibility: visible;
  }

  #printArea {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 24px;
  }

  .pm-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #1a1d21;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .pm-title {
    font-size: 18px;
    font-weight: 700;
  }

  .pm-sub {
    font-size: 11px;
    color: #444;
  }

  .pm-route {
    margin-bottom: 16px;
  }

  .pm-route h4 {
    font-size: 14px;
    margin: 12px 0 6px;
  }

  .pm-row {
    font-size: 11.5px;
    padding: 3px 0;
    border-bottom: 1px dotted #bbb;
    display: flex;
    gap: 8px;
  }

  .pm-seq { width: 28px; }
  .pm-circle { width: 120px; font-weight: 600; }
  .pm-inv { width: 110px; font-family: var(--font-mono); }
  .pm-cust { flex: 1; }
  .pm-loc { width: 140px; }
  .pm-prio { width: 34px; }
  .pm-ack { width: 60px; }
}

/* ---------- Route Ops: Dispatch Command Center ---------- */
.command-panel,
.dispatch-board-panel {
  margin-top: var(--s-md);
}

.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-sm);
  padding: var(--s-md) var(--s-lg) 0;
}

.fleet-card {
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--fc, var(--primary));
  border-radius: var(--r-md);
  background: var(--surface-1);
  padding: var(--s-sm) var(--s-md);
}

.fc-r1 { --fc: #5e6ad2; }
.fc-r2 { --fc: #27a644; }
.fc-r3 { --fc: #b87800; }
.fc-r4 { --fc: #e5484d; }
.fc-r5 { --fc: #6b7280; }
.fc-r7 { --fc: #0d9488; }

.fc-head {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  flex-wrap: wrap;
}

.fc-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.fc-window {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.fc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-xs);
  margin: var(--s-sm) 0;
}

.fc-stat {
  display: flex;
  flex-direction: column;
}

.fc-stat-v {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.fc-stat-v.fc-stat-danger {
  color: var(--p1);
}

.fc-stat-l {
  font-size: 10.5px;
  color: var(--ink-subtle);
}

.fc-need {
  color: var(--p1);
  font-size: 12px;
}

.fc-pressure {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
}

.fc-bar {
  flex: 1;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.fc-bar-inline {
  width: 64px;
  height: 6px;
  flex: none;
  display: inline-flex;
  vertical-align: middle;
  margin-right: 6px;
}

.fc-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--primary);
}

.fc-fill.is-ok { background: var(--ack-done); }
.fc-fill.is-warm { background: var(--p2); }
.fc-fill.is-over { background: var(--p1); }

.fc-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  min-width: 44px;
  text-align: right;
}

.fc-pct.is-ok { color: var(--ack-done); }
.fc-pct.is-warm { color: #a86f00; }
.fc-pct.is-over { color: var(--p1); }

.fc-pct-inline {
  font-size: 11px;
  min-width: 0;
}

.fleet-overflow {
  margin: var(--s-md) var(--s-lg) 0;
  border: 1px solid rgba(245, 166, 35, 0.35);
  background: rgba(245, 166, 35, 0.05);
  border-radius: var(--r-md);
  padding: var(--s-sm) var(--s-md);
}

.fleet-overflow-title {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--s-xs);
}

.fleet-overflow-title i {
  width: 16px;
  height: 16px;
}

.fleet-note {
  font-weight: 400;
  color: var(--ink-subtle);
  font-size: 11.5px;
}

.fleet-sugg {
  font-size: 12.5px;
  color: var(--ink-muted);
  padding: 4px 0;
}

.fleet-sugg .route-chip {
  margin: 0 2px;
}

.fleet-ok {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  margin: var(--s-md) var(--s-lg) 0;
  font-size: 13px;
  color: var(--ack-done);
}

.fleet-ok i {
  width: 16px;
  height: 16px;
}

.fleet-order {
  min-width: 220px;
  max-width: 360px;
}

.fleet-stop {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 1px 8px;
  margin: 2px;
  white-space: nowrap;
}

.fc-win-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-subtle);
}

.fc-class {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 0 6px;
  vertical-align: middle;
}

.fc-swing {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--semantic-success, #2f6f4f);
  background: rgba(39, 166, 68, 0.08);
  border: 1px solid rgba(39, 166, 68, 0.25);
  border-radius: var(--r-pill);
  padding: 0 6px;
  vertical-align: middle;
}

/* ---------- Route Ops: Day-Ahead Dispatch Board ---------- */
.dispatch-board-panel .table-actions {
  flex-wrap: wrap;
}

#dispatchBoard {
  padding: 0 var(--s-lg) var(--s-md);
}

.db-route {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-1);
  margin: var(--s-md) 0 0;
  overflow: hidden;
}

.db-head {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding: var(--s-sm) var(--s-md);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}

.db-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.db-dim {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-subtle);
}

.db-bucket {
  border-bottom: 1px solid var(--hairline);
  padding: var(--s-sm) var(--s-md);
}

.db-bucket:last-child {
  border-bottom: none;
}

.db-bucket-head {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  flex-wrap: wrap;
}

.db-bucket-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.db-window {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
}

.db-bucket-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
}

.db-bucket-early .db-bucket-name { color: #1f7a37; }
.db-bucket-morning .db-bucket-name { color: #1f7fd6; }
.db-bucket-truck .db-bucket-name { color: #a86f00; }
.db-bucket-offpeak .db-bucket-name { color: #5c636b; }
.db-bucket-any .db-bucket-name { color: #3f4b9e; }

.db-stops {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-xs);
  margin-top: var(--s-sm);
}

.db-stop {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 6px 10px;
  font-size: 12px;
  flex-wrap: wrap;
}

.db-stop-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: var(--r-pill);
}

.db-stop-name {
  font-weight: 600;
  color: var(--ink);
}

.db-stop-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.db-stop .sla-chip {
  font-size: 10.5px;
  padding: 0 8px;
}

/* ---------- Route Ops: map extras ---------- */
.stop-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.stop-badge span {
  line-height: 1;
}

.map-legend {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: var(--s-sm) var(--s-md) 0;
}

.map-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm) var(--s-md);
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.map-legend-item.is-dim {
  opacity: 0.45;
}

.map-legend-item b {
  color: var(--ink);
  font-weight: 600;
}

.map-legend-item i {
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
}

.map-legend-item .lg-hub {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.map-legend-item .lg-stop {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.map-legend-item .lg-bubble {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: rgba(94, 106, 210, 0.45);
}

.map-pop-orders {
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.map-pop-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 2px 0;
  white-space: nowrap;
}

.map-pop-ack {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-subtle);
}

/* Accessible screen-reader-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

