:root {
  --navy-950: #102239;
  --navy-900: #16304f;
  --navy-800: #1d416c;
  --blue-600: #2469a8;
  --blue-500: #327dbd;
  --blue-100: #e7f1f9;
  --blue-50: #f2f7fb;
  --red-600: #c63b36;
  --red-100: #fbeceb;
  --green-700: #18734d;
  --green-600: #20845b;
  --green-100: #e6f4ed;
  --amber-700: #95620d;
  --amber-100: #fff4db;
  --ink: #182231;
  --muted: #687486;
  --line: #dce2e9;
  --line-strong: #cbd3dd;
  --paper: #ffffff;
  --canvas: #f3f5f7;
  --shadow: 0 1px 2px rgba(16, 34, 57, .05), 0 8px 24px rgba(16, 34, 57, .04);
  --radius: 10px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(50, 125, 189, .25); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 232px;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #eaf0f6;
  background: var(--navy-950);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 9px; background: rgba(255,255,255,.08); color: #fff; }
.brand-mark svg { width: 28px; height: 28px; }
.brand strong, .brand small, .sidebar-company strong, .sidebar-company small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: #9fb0c3; font-size: 11px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 7px; color: #aebccd; font-size: 13px; font-weight: 650; text-decoration: none; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: var(--navy-800); box-shadow: inset 3px 0 0 #69a6d5; }
.sidebar-company { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.company-avatar, .user-avatar { display: grid; place-items: center; border-radius: 50%; font-weight: 750; }
.company-avatar { width: 34px; height: 34px; flex: 0 0 34px; color: var(--navy-950); background: #d8e9f6; font-size: 11px; }
.sidebar-company strong { font-size: 12px; }
.sidebar-company small { margin-top: 3px; color: #8799ad; font-size: 10px; }

main { min-height: 100vh; margin-left: 232px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: 62px; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--line); background: #fff; }
.topbar-context, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-context { color: #4e5b6c; font-size: 12px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); box-shadow: 0 0 0 3px var(--green-100); }
.topbar-separator { width: 1px; height: 15px; margin: 0 4px; background: var(--line); }
.sample-pill, .confidence, .engine-pill { display: inline-flex; align-items: center; border-radius: 999px; font-size: 10px; font-weight: 750; letter-spacing: .02em; }
.sample-pill { padding: 5px 8px; color: var(--amber-700); background: var(--amber-100); }
.demo-toggle { display: inline-flex; height: 34px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: #536174; background: #fff; font-size: 10px; font-weight: 750; }
.demo-toggle:hover { border-color: var(--line-strong); background: #f8fafb; }
.toggle-track { position: relative; width: 26px; height: 15px; border-radius: 999px; background: #c8d0da; transition: background .18s; }
.toggle-track span { position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16,34,57,.2); transition: transform .18s; }
.demo-toggle[aria-pressed="true"] { border-color: #bad6eb; color: var(--blue-600); background: var(--blue-50); }
.demo-toggle[aria-pressed="true"] .toggle-track { background: var(--blue-600); }
.demo-toggle[aria-pressed="true"] .toggle-track span { transform: translateX(11px); }
.icon-button { display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #536174; background: #fff; }
.icon-button:hover { border-color: var(--line-strong); background: #f8fafb; }
.icon-button svg { width: 18px; height: 18px; }
.user-avatar { width: 32px; height: 32px; color: #fff; background: var(--blue-600); font-size: 10px; }
.mobile-menu { display: none; width: 34px; height: 34px; padding: 8px; border: 0; background: transparent; }
.mobile-menu span { display: block; height: 2px; margin: 4px 0; background: var(--ink); }

.page { width: min(1480px, 100%); margin: 0 auto; padding: 30px; }
.page-heading, .heading-actions, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 6px; color: var(--blue-600); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; color: var(--navy-950); font-size: clamp(25px, 3vw, 34px); line-height: 1.12; letter-spacing: -.035em; }
.page-heading > div:first-child > p:last-child { max-width: 660px; margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.heading-actions { flex: 0 0 auto; align-items: flex-end; gap: 8px; }
.preset-field { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 750; }
.preset-field select { min-width: 165px; height: 38px; padding: 0 32px 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: #fff; }
.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 750; }
.button svg { width: 16px; height: 16px; }
.button.primary { border-color: var(--blue-600); color: #fff; background: var(--blue-600); box-shadow: 0 3px 8px rgba(36,105,168,.18); }
.button.primary:hover { background: #1d5d98; }
.button.secondary { border-color: var(--line-strong); color: #354256; background: #fff; }
.button.secondary:hover { background: #f7f9fb; }
.button.small { min-height: 32px; padding-inline: 10px; font-size: 11px; }
.button:disabled { cursor: not-allowed; opacity: .45; }


.demo-toolbar { align-items: flex-end; justify-content: space-between; gap: 18px; margin: 20px 0 14px; padding: 12px 14px; border: 1px solid #d5e4f0; border-radius: 8px; background: var(--blue-50); }
.demo-toolbar-copy strong, .demo-toolbar-copy span { display: block; }
.demo-toolbar-copy strong { color: #345874; font-size: 11px; }
.demo-toolbar-copy span { margin-top: 4px; color: #64788b; font-size: 9px; line-height: 1.45; }
.demo-toolbar-actions { display: flex; flex: 0 0 auto; align-items: flex-end; gap: 8px; }
.kpi-grid.operational-kpis { grid-template-columns: repeat(5, minmax(0,1fr)); margin-top: 22px; }
.readiness-card { border-top: 3px solid var(--green-600); padding-top: 15px; background: linear-gradient(145deg, #fff 48%, #f4faf7); }
.readiness-pill { padding: 4px 7px; border-radius: 999px; color: var(--green-700); background: var(--green-100); font-size: 9px; font-weight: 800; }
.demo-results { margin-bottom: 14px; padding: 15px; border: 1px solid #d5e4f0; border-radius: var(--radius); background: #f5f9fc; }
.demo-results-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.demo-results-heading h2 { margin: 3px 0 0; color: var(--navy-950); font-size: 14px; }
.demo-results-heading p { max-width: 520px; margin: 0; color: #64788b; font-size: 9px; line-height: 1.45; text-align: right; }
.demo-results-actions { display: flex; max-width: 610px; align-items: center; justify-content: flex-end; gap: 12px; }
.spotlight-button { flex: 0 0 auto; border-color: #a9c9e1; color: #215e93; background: #fff; }
.spotlight-button:hover { background: var(--blue-50); }
.demo-label { color: var(--blue-600); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.demo-kpi-grid { margin: 13px 0 0; }
.demo-kpi-grid .kpi-card { min-height: 112px; box-shadow: none; }
.finance-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-top: 13px; }
.finance-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.finance-card span, .finance-card strong, .finance-card small { display: block; }
.finance-card span { color: var(--muted); font-size: 9px; font-weight: 700; }
.finance-card strong { margin-top: 6px; color: var(--navy-950); font-size: 23px; line-height: 1; letter-spacing: -.03em; }
.finance-card small { margin-top: 7px; color: #8791a0; font-size: 8px; }
.finance-card.tankpro { border-top: 3px solid var(--blue-600); padding-top: 11px; }
.finance-card.waste { border-top: 3px solid var(--red-600); padding-top: 11px; }
.finance-card.waste strong { color: var(--red-600); }
.opportunity-card { display: grid; grid-template-columns: auto minmax(220px,1fr) auto; align-items: center; gap: 20px; min-height: 100px; margin-top: 12px; padding: 16px 18px; border: 1px solid #bcdac9; border-radius: 9px; background: #f2faf5; }
.opportunity-card > div:first-child strong { display: block; margin-top: 5px; color: var(--green-700); font-size: 28px; line-height: 1; letter-spacing: -.035em; }
.opportunity-card > p { margin: 0; color: #557064; font-size: 10px; line-height: 1.5; }
.opportunity-breakdown { display: grid; gap: 6px; min-width: 210px; }
.opportunity-breakdown span { color: #668073; font-size: 8px; }
.opportunity-breakdown b { color: #2e5d47; font-size: 10px; }
[data-demo-only] { display: none !important; }
body.demo-mode .demo-toolbar { display: flex !important; }
body.demo-mode .demo-results, body.demo-mode .comparison-panel, body.demo-mode .cost-breakdown { display: block !important; }
body.demo-mode .sample-pill, body.demo-mode .engine-pill { display: inline-flex !important; }
body.demo-mode .tour-layer:not([hidden]) { display: block !important; }
body.demo-mode .segmented { display: inline-flex !important; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.kpi-card { min-height: 128px; padding: 17px 18px 15px; }
.kpi-card.savings-card { border-top: 3px solid var(--green-600); padding-top: 15px; background: linear-gradient(145deg, #fff 45%, #f3faf7); }
.kpi-label { display: flex; min-height: 24px; align-items: flex-start; justify-content: space-between; gap: 8px; color: #657185; font-size: 11px; font-weight: 700; }
.confidence { padding: 4px 6px; color: var(--green-700); background: var(--green-100); white-space: nowrap; }
.metric-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; }
.metric-icon svg { width: 14px; height: 14px; }
.metric-icon.miles { color: var(--blue-600); background: var(--blue-100); }
.metric-icon.revenue { color: var(--green-700); background: var(--green-100); }
.metric-icon.time { color: #7656a8; background: #f0eafa; }
.metric-icon.overtime { color: var(--amber-700); background: var(--amber-100); }
.metric-icon.stops { color: var(--blue-600); background: var(--blue-100); }
.metric-icon.dumps { color: var(--red-600); background: var(--red-100); }
.kpi-value { display: block; margin-top: 4px; color: var(--navy-950); font-size: 28px; line-height: 1; letter-spacing: -.035em; }
.savings-card .kpi-value { color: var(--green-700); }
.kpi-card p { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 2.35fr) minmax(270px, .65fr); gap: 14px; }
.map-panel { position: relative; z-index: 0; isolation: isolate; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 17px 18px 14px; border-bottom: 1px solid var(--line); }
.panel-header.compact { padding-bottom: 12px; }
.panel-header h2, .section-heading h2 { margin: 0 0 4px; color: var(--navy-950); font-size: 15px; letter-spacing: -.015em; }
.panel-header p { max-width: 700px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.title-row { display: flex; align-items: center; gap: 8px; }
.engine-pill { padding: 4px 7px; color: #536174; background: #eef1f4; }
.segmented { display: inline-flex; flex: 0 0 auto; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #f5f7f9; }
.segmented button { height: 29px; padding: 0 10px; border: 0; border-radius: 5px; color: #657185; background: transparent; font-size: 10px; font-weight: 750; }
.segmented button.active { color: var(--navy-950); background: #fff; box-shadow: 0 1px 3px rgba(16,34,57,.12); }
#route-map { position: relative; height: 450px; overflow: hidden; background: #dbe8ef; }
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-image-layer,
.leaflet-layer { position: absolute; top: 0; left: 0; }
.leaflet-container { overflow: hidden; font-family: inherit; -webkit-tap-highlight-color: transparent; }
.leaflet-tile, .leaflet-marker-icon, .leaflet-marker-shadow { user-select: none; -webkit-user-drag: none; }
.leaflet-tile { visibility: hidden; }
.leaflet-tile-loaded { visibility: inherit; }
.leaflet-marker-icon, .leaflet-marker-shadow { display: block; }
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-container .leaflet-overlay-pane svg { max-width: none !important; max-height: none !important; }
.leaflet-container .leaflet-tile-pane img, .leaflet-container .leaflet-tile { width: auto; max-width: none !important; max-height: none !important; padding: 0; }
.leaflet-marker-icon.leaflet-interactive, .leaflet-pane > svg path.leaflet-interactive { pointer-events: auto; }
.leaflet-tile-container, .leaflet-pane > svg path { pointer-events: none; }
.leaflet-top, .leaflet-bottom { position: absolute; z-index: 1000; pointer-events: none; }
.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.leaflet-control { position: relative; z-index: 800; float: left; clear: both; pointer-events: auto; }
.leaflet-right .leaflet-control { float: right; }
.leaflet-top .leaflet-control { margin-top: 10px; }
.leaflet-bottom .leaflet-control { margin-bottom: 10px; }
.leaflet-left .leaflet-control { margin-left: 10px; }
.leaflet-right .leaflet-control { margin-right: 10px; }
.leaflet-bar { overflow: hidden; border: 1px solid rgba(16,34,57,.16); border-radius: 7px; box-shadow: 0 2px 8px rgba(16,34,57,.14); }
.leaflet-bar a { display: block; width: 28px; height: 28px; border-bottom: 1px solid var(--line); color: var(--navy-900); background: #fff; font-size: 18px; font-weight: 700; line-height: 28px; text-align: center; text-decoration: none; }
.leaflet-bar a:last-child { border-bottom: 0; }
.leaflet-control-attribution { padding: 2px 5px; color: #657185; background: rgba(255,255,255,.82); font-size: 8px; }
.leaflet-control-attribution a { color: var(--blue-600); text-decoration: none; }
.leaflet-popup { position: absolute; margin-bottom: 20px; text-align: center; }
.leaflet-popup-content-wrapper { padding: 1px; border-radius: 8px; background: #fff; box-shadow: 0 4px 18px rgba(16,34,57,.22); text-align: left; }
.leaflet-popup-content { margin: 12px 14px; min-width: 150px; line-height: 1.45; }
.leaflet-popup-tip-container { position: absolute; left: 50%; width: 20px; height: 10px; margin-left: -10px; overflow: hidden; pointer-events: none; }
.leaflet-popup-tip { width: 12px; height: 12px; margin: -7px auto 0; transform: rotate(45deg); background: #fff; box-shadow: 2px 2px 4px rgba(16,34,57,.12); }
.leaflet-popup-close-button { position: absolute; top: 4px; right: 5px; z-index: 2; width: 20px; height: 20px; color: #7b8796; font-size: 16px; line-height: 20px; text-align: center; text-decoration: none; }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); color: #5c6879; font-size: 9px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-line { width: 18px; height: 3px; border-radius: 4px; background: var(--legend-color); }
.legend-dot { width: 8px; height: 8px; border: 2px solid var(--legend-color); border-radius: 50%; background: #fff; }
.map-marker { display: grid; width: 24px; height: 24px; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: var(--marker-color); box-shadow: 0 1px 5px rgba(16,34,57,.35); font-size: 9px; font-weight: 800; }
.map-marker.facility { border-radius: 6px; background: var(--red-600); }
.map-marker.depot { background: var(--navy-950); }
.map-popup strong, .map-popup span { display: block; }
.map-popup strong { margin-bottom: 3px; }
.map-popup span { color: var(--muted); font-size: 10px; }
.map-fallback { display: grid; height: 100%; place-items: center; padding: 30px; color: var(--muted); text-align: center; background: radial-gradient(circle at 70% 40%, #eaf3f7 0 16%, transparent 17%), linear-gradient(155deg,#cddfe8,#edf3f5); }

.summary-list { margin: 0; padding: 4px 18px 12px; }
.summary-list div { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #edf0f3; }
.summary-list dt { color: var(--muted); font-size: 10px; }
.summary-list dd { margin: 0; color: var(--navy-950); font-size: 12px; font-weight: 800; }
.capacity-block { padding: 3px 18px 15px; }
.capacity-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; color: var(--muted); font-size: 10px; }
.capacity-heading span:last-child { color: var(--green-700); font-weight: 750; }
.capacity-row + .capacity-row { margin-top: 10px; }
.capacity-meta { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 9px; }
.capacity-meta strong { font-weight: 750; }
.capacity-meta span { color: var(--muted); }
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: #e9edf1; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--progress-color); }
.cost-breakdown { margin: 0 14px 14px; padding: 14px; border-radius: 8px; background: #f6f8fa; }
.cost-breakdown h3 { margin-bottom: 10px; color: var(--navy-950); font-size: 11px; }
.cost-breakdown > div { display: flex; justify-content: space-between; padding: 5px 0; color: var(--muted); font-size: 10px; }
.cost-breakdown > div strong { color: #354256; }
.cost-breakdown .cost-total { margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 750; }
.cost-breakdown .cost-total strong { color: var(--navy-950); font-size: 13px; }
.cost-breakdown p { margin: 8px 0 0; color: #788394; font-size: 8px; line-height: 1.45; }
.readiness-list { margin: 0 14px 14px; padding: 14px; border: 1px solid #e1e6eb; border-radius: 8px; background: #fbfcfd; }
.readiness-list h3 { margin-bottom: 8px; color: var(--navy-950); font-size: 11px; }
.readiness-list > div { display: flex; justify-content: space-between; padding: 6px 0; color: var(--muted); font-size: 9px; }
.readiness-list > div + div { border-top: 1px solid #edf0f3; }
.readiness-list strong { color: #354256; font-weight: 750; }

.comparison-panel { margin-top: 28px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 10px 18px; color: var(--muted); background: #f8f9fb; font-size: 9px; font-weight: 750; text-align: right; text-transform: uppercase; letter-spacing: .04em; }
th:first-child, td:first-child { text-align: left; }
td { padding: 12px 18px; border-top: 1px solid #edf0f3; text-align: right; }
td:first-child { color: #465366; font-weight: 650; }
td strong { color: var(--navy-950); }
.delta-good { display: inline-flex; padding: 3px 6px; border-radius: 999px; color: var(--green-700); background: var(--green-100); font-size: 9px; font-weight: 750; }
.delta-neutral { color: var(--muted); }

.routes-section { padding-top: 28px; }
.section-heading { align-items: center; margin-bottom: 12px; }
.route-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.route-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.route-card-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.truck-title { display: flex; align-items: center; gap: 10px; }
.truck-swatch { width: 5px; height: 34px; border-radius: 5px; background: var(--truck-color); }
.truck-title strong, .truck-title span { display: block; }
.truck-title strong { color: var(--navy-950); font-size: 13px; }
.truck-title span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.route-card-actions { display: flex; align-items: center; gap: 11px; }
.print-truck { height: 30px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 6px; color: #465366; background: #fff; font-size: 9px; font-weight: 750; }
.print-truck:hover { color: var(--blue-600); border-color: #b9cee0; background: var(--blue-50); }
.route-total { text-align: right; }
.route-total strong, .route-total span { display: block; }
.route-total strong { color: var(--navy-950); font-size: 13px; }
.route-total span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.route-stats { display: grid; grid-template-columns: repeat(6,1fr); padding: 10px 17px; border-bottom: 1px solid #edf0f3; background: #fafbfc; }
.route-stats span, .route-stats strong { display: block; }
.route-stats span { color: var(--muted); font-size: 8px; }
.route-stats strong { margin-top: 3px; color: #354256; font-size: 10px; }
.stop-timeline { padding: 8px 17px 13px; }
.timeline-row { position: relative; display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 9px; min-height: 44px; align-items: center; }
.timeline-row:not(:last-child)::after { position: absolute; top: 30px; bottom: -8px; left: 11px; width: 1px; content: ""; background: #dce2e8; }
.timeline-index { z-index: 1; display: grid; width: 24px; height: 24px; place-items: center; border: 2px solid var(--truck-color); border-radius: 50%; color: var(--truck-color); background: #fff; font-size: 8px; font-weight: 800; }
.timeline-row.dump .timeline-index { border-color: var(--red-600); color: #fff; background: var(--red-600); }
.timeline-copy strong, .timeline-copy span { display: block; }
.timeline-copy strong { overflow: hidden; color: #354256; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-copy span { margin-top: 3px; color: var(--muted); font-size: 8px; }
.load-badge { padding: 4px 6px; border-radius: 5px; color: #4f5c6d; background: #f0f3f6; font-size: 8px; font-weight: 700; }
.timeline-row.dump .load-badge { color: var(--red-600); background: var(--red-100); }

.facilities-panel { margin-top: 28px; }
.facility-list { display: grid; grid-template-columns: repeat(3,1fr); }
.facility-card { padding: 16px 18px; }
.facility-card + .facility-card { border-left: 1px solid var(--line); }
.facility-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.facility-card h3 { margin: 0 0 4px; color: var(--navy-950); font-size: 11px; }
.facility-card address { color: var(--muted); font-size: 9px; font-style: normal; }
.facility-badge { padding: 4px 6px; border-radius: 999px; color: var(--blue-600); background: var(--blue-100); font-size: 8px; font-weight: 750; white-space: nowrap; }
.facility-card p { margin: 11px 0 0; color: #536174; font-size: 9px; line-height: 1.5; }
.facility-card label { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: #354256; font-size: 9px; font-weight: 700; }
.facility-card input { accent-color: var(--blue-600); }

footer { display: flex; justify-content: space-between; padding: 28px 2px 10px; color: #8791a0; font-size: 9px; }
footer a { color: #5e6c7e; font-weight: 700; text-decoration: none; }
footer a:hover { color: var(--blue-600); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(12,26,43,.38); }
.editor-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 2010; display: flex; width: min(620px, 94vw); flex-direction: column; visibility: hidden; transform: translateX(100%); background: #fff; box-shadow: -12px 0 32px rgba(16,34,57,.16); transition: transform .15s ease, visibility .15s; }
.editor-drawer.open { visibility: visible; transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; }
.drawer-header h2 { margin: 0; color: var(--navy-950); font-size: 20px; }
.drawer-tabs { display: flex; gap: 5px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.drawer-tabs button { padding: 10px 9px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 11px; font-weight: 750; }
.drawer-tabs button[aria-selected="true"] { border-bottom-color: var(--blue-600); color: var(--blue-600); }
.drawer-tabs span { margin-left: 4px; padding: 2px 5px; border-radius: 999px; background: #eef1f4; font-size: 8px; }
.drawer-content { flex: 1; overflow-y: auto; padding: 18px 22px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.tab-intro p, .tab-copy { max-width: 420px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.tab-intro-actions, .fleet-controls { display: flex; flex: 0 0 auto; align-items: flex-end; gap: 8px; }
.danger-quiet { border-color: #e6c9c9; color: #9b3f3b; background: #fff; }
.danger-quiet:hover { border-color: #dcaaaa; background: #fff6f6; }
.fleet-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 8px; font-weight: 750; }
.fleet-controls input { width: 58px; height: 32px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: #fff; }
.empty-editor { display: grid; min-height: 150px; place-content: center; gap: 6px; padding: 24px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); text-align: center; }
.empty-editor strong { color: #465366; font-size: 12px; }
.empty-editor span { font-size: 9px; line-height: 1.45; }
.editor-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.editor-row + .editor-row { margin-top: 8px; }
.stop-row { grid-template-columns: 26px minmax(130px,1.4fr) minmax(100px,1fr) 82px 100px 32px; align-items: end; }
.truck-row { grid-template-columns: minmax(130px,1.4fr) 115px 110px 32px; align-items: end; }
.drag-index { align-self: center; color: #8b95a3; font-size: 10px; font-weight: 750; text-align: center; }
.field { display: grid; gap: 5px; min-width: 0; }
.field span { overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.field input, .field select { width: 100%; height: 34px; min-width: 0; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: #fff; font-size: 10px; }
.field input:focus, .field select:focus { border-color: var(--blue-500); }
.row-remove { display: grid; width: 32px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: #8b6570; background: #fff; }
.row-remove:hover { border-color: #edc8c8; color: var(--red-600); background: #fff7f7; }
.row-remove svg { width: 14px; height: 14px; }
.cost-form { display: grid; grid-template-columns: repeat(2,1fr); gap: 11px; margin-top: 15px; }
.cost-form .field { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.cost-form .field span { color: #465366; font-size: 9px; }
.field-help { min-height: 22px; margin: 0; color: #8791a0; font-size: 8px; line-height: 1.4; }
.source-note { margin-top: 16px; padding: 13px; border: 1px solid #d8e5ef; border-radius: 8px; background: var(--blue-50); }
.source-note strong { color: #365875; font-size: 10px; }
.source-note p { margin: 5px 0 0; color: #5e7387; font-size: 9px; line-height: 1.5; }
.drawer-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfd; }
.drawer-footer span { color: var(--green-700); font-size: 10px; font-weight: 650; }
.drawer-footer span.error { color: var(--red-600); }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 120; visibility: hidden; padding: 11px 14px; border-radius: 8px; color: #fff; background: var(--navy-950); box-shadow: 0 10px 28px rgba(16,34,57,.25); font-size: 11px; opacity: 0; transform: translateY(8px); transition: all .18s; }
.toast.show { visibility: visible; opacity: 1; transform: translateY(0); }

.tour-layer[hidden] { display: none; }
.tour-layer { position: fixed; inset: 0; z-index: 3000; pointer-events: none; }
.tour-backdrop { position: fixed; inset: 0; pointer-events: auto; background: rgba(7,17,31,.76); }
.tour-card { position: fixed; z-index: 2; width: min(360px, calc(100vw - 32px)); padding: 20px; border: 1px solid #dbe5ee; border-radius: 12px; background: #fff; box-shadow: 0 18px 54px rgba(0,0,0,.28); pointer-events: auto; }
.tour-progress { color: var(--blue-600); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tour-card h2 { margin: 5px 0 8px; color: var(--navy-950); font-size: 19px; letter-spacing: -.02em; }
.tour-card p { margin: 0; color: #536174; font-size: 11px; line-height: 1.55; }
.tour-close { position: absolute; top: 12px; right: 12px; padding: 5px 7px; border: 0; color: var(--muted); background: transparent; font-size: 9px; font-weight: 750; }
.tour-close:hover { color: var(--navy-950); background: #f1f4f7; }
.tour-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.tour-spotlight { position: relative; z-index: 3001 !important; outline: 3px solid #6eb5ea; outline-offset: 4px; box-shadow: 0 0 0 8px rgba(110,181,234,.2), 0 16px 48px rgba(0,0,0,.32) !important; pointer-events: none; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .kpi-grid.operational-kpis { grid-template-columns: repeat(2,1fr); }
  .finance-grid { grid-template-columns: repeat(2,1fr); }
  .workspace-grid { grid-template-columns: 1fr; }
  .summary-panel { display: grid; grid-template-columns: 1.1fr 1fr 1fr; }
  .summary-panel .panel-header { grid-column: 1 / -1; }
  .summary-list { border-right: 1px solid var(--line); }
  .capacity-block { padding-top: 14px; border-right: 1px solid var(--line); }
  .cost-breakdown { margin-top: 14px; }
  .readiness-list { margin-top: 14px; }
  body.demo-mode .summary-panel .cost-breakdown { grid-column: 1 / -1; }
  #route-map { height: 420px; }
  .stop-row { grid-template-columns: 24px minmax(120px,1.3fr) minmax(90px,1fr) 78px 90px 32px; }
}

@media (max-width: 900px) {
  .sidebar { visibility: hidden; transform: translateX(-100%); transition: transform .2s, visibility .2s; }
  .sidebar.open { visibility: visible; transform: translateX(0); }
  main { margin-left: 0; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 18px; }
  .topbar-context { margin-right: auto; margin-left: 8px; }
  .page { padding: 22px 18px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .demo-toolbar { align-items: stretch; flex-direction: column; }
  .demo-toolbar-actions { justify-content: flex-end; }
  .route-cards { grid-template-columns: 1fr; }
  .facility-list { grid-template-columns: 1fr; }
  .facility-card + .facility-card { border-top: 1px solid var(--line); border-left: 0; }
  .stop-row { grid-template-columns: 24px 1fr 1fr 32px; }
  .stop-row .field:nth-of-type(3), .stop-row .field:nth-of-type(4) { grid-row: 2; }
  .stop-row .field:nth-of-type(3) { grid-column: 2; }
  .stop-row .field:nth-of-type(4) { grid-column: 3; }
  .stop-row .row-remove { grid-column: 4; grid-row: 1 / 3; align-self: center; }
}

@media (max-width: 640px) {
  .demo-results-actions { max-width: none; align-items: flex-start; flex-direction: column; }
  .finance-grid { grid-template-columns: repeat(2,1fr); }
  .opportunity-card { grid-template-columns: 1fr; gap: 10px; }
  .opportunity-breakdown { min-width: 0; }
  .route-card-header { align-items: flex-start; }
  .route-card-actions { align-items: flex-end; flex-direction: column; gap: 7px; }
  .topbar-context span:nth-of-type(n+3), .topbar-separator, .topbar-actions .icon-button { display: none; }
  body.demo-mode .sample-pill { display: none !important; }
  .page { padding: 18px 12px; }
  .heading-actions { display: flex; }
  .preset-field { grid-column: 1 / -1; }
  .preset-field select { width: 100%; }
  .demo-toggle { padding-inline: 7px; }
  .demo-toolbar-actions { display: grid; grid-template-columns: 1fr auto; }
  .demo-results-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .demo-results-heading p { text-align: left; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { min-height: 116px; padding: 14px; }
  .kpi-value { font-size: 23px; }
  .workspace-grid { gap: 10px; }
  .panel-header { flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .tab-intro { flex-direction: column; }
  .tab-intro-actions, .fleet-controls { width: 100%; justify-content: flex-end; }
  #route-map { height: 350px; }
  .summary-panel { display: block; }
  .summary-list, .capacity-block { border-right: 0; }
  .section-heading { align-items: flex-start; }
  .route-stats { grid-template-columns: repeat(2,1fr); gap: 8px; }
  th, td { padding-inline: 12px; white-space: nowrap; }
  footer { gap: 10px; flex-direction: column; }
  .editor-drawer { width: 100%; max-width: none; }
  .drawer-header, .drawer-tabs, .drawer-content, .drawer-footer { padding-right: 14px; padding-left: 14px; }
  .drawer-tabs { overflow-x: auto; }
  .stop-row { grid-template-columns: 20px minmax(0,1fr) 32px; }
  .stop-row .field:nth-of-type(1), .stop-row .field:nth-of-type(2), .stop-row .field:nth-of-type(3), .stop-row .field:nth-of-type(4) { grid-column: 2; }
  .stop-row .field:nth-of-type(1) { grid-row: 1; }
  .stop-row .field:nth-of-type(2) { grid-row: 2; }
  .stop-row .field:nth-of-type(3) { grid-row: 3; }
  .stop-row .field:nth-of-type(4) { grid-row: 4; }
  .stop-row .drag-index { grid-row: 1 / 5; }
  .stop-row .row-remove { grid-column: 3; grid-row: 1 / 5; }
  .truck-row { grid-template-columns: 1fr 1fr 32px; }
  .truck-row .field:first-child { grid-column: 1 / 3; }
  .truck-row .row-remove { grid-column: 3; grid-row: 1 / 3; align-self: center; }
  .cost-form { grid-template-columns: 1fr; }
  .toast { right: 14px; bottom: 14px; left: 14px; text-align: center; }
}

@media print {
  .sidebar, .topbar, .page-heading, .demo-toolbar, .demo-results, .kpi-grid, .workspace-grid, .comparison-panel, .facilities-panel, footer, .section-heading .button { display: none !important; }
  main { margin: 0; }
  .page { padding: 0; }
  .routes-section { padding: 0; }
  .route-cards { grid-template-columns: 1fr 1fr; }
  .route-card { break-inside: avoid; box-shadow: none; }
  .print-truck, .tour-layer { display: none !important; }
  body[data-print-route] .route-card { display: none; }
  body[data-print-route] .route-card.print-target { display: block; }
  body[data-print-route] .route-cards { grid-template-columns: 1fr; }
}
