/* ==========================================================================
   Dhaka Emergency CSP — Unified Design System (Dark & Light Themes)
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg-page: #111214;
  --bg-panel: #141518;
  --bg-panel-subtle: #191b1f;
  --bg-card: #1c1e23;
  --bg-card-hover: #24272d;
  --bg-inset: #0d0e11;
  --bg-canvas: #0e1014;
  --bg-overlay: rgba(20, 21, 26, 0.92);
  --bg-dropdown: #0f1116;
  --bg-table-head: #17191d;

  --border-color: #262930;
  --border-subtle: #1e2026;
  --border-hover: #3d424d;
  --border-row: rgba(255, 255, 255, 0.05);

  --surface-subtle: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --surface-active: rgba(255, 255, 255, 0.12);
  --surface-strong: rgba(255, 255, 255, 0.16);

  --text-main: #f4f4f5;
  --text-strong: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-disabled: #52525b;

  --cta-bg: #ffffff;
  --cta-bg-hover: #eceef1;
  --cta-bg-active: #d4d4d8;
  --cta-text: #090a0d;
  --cta-border: #ffffff;
  --cta-shadow: 0 4px 16px rgba(255, 255, 255, 0.14);

  --accent-route: #38bdf8;
  --accent-medical: #10b981;
  --accent-fire: #ef4444;
  --accent-accident: #f59e0b;
  --accent-flood: #3b82f6;
  --accent-roadblock: #eab308;
  --accent-roadblock-bg: rgba(234, 179, 8, 0.12);
  --accent-roadblock-border: rgba(234, 179, 8, 0.45);

  --slider-track: #2b2f38;
  --slider-thumb: #ffffff;
  --slider-thumb-border: #0d0e11;

  --chart-track: #1b1e25;
  --chart-optimal: #38bdf8;
  --chart-suboptimal: #525866;

  --scrollbar-thumb: rgba(255, 255, 255, 0.18);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.34);

  --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.42);
  --shadow-dropdown: 0 12px 32px rgba(0, 0, 0, 0.72);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 4px;
  --transition-fast: 0.15s ease;
}

[data-theme="light"] {
  --bg-page: #f4f6f9;
  --bg-panel: #ffffff;
  --bg-panel-subtle: #f8fafc;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e8eef5;
  --bg-inset: #f4f6f9;
  --bg-canvas: #eef2f6;
  --bg-overlay: rgba(255, 255, 255, 0.94);
  --bg-dropdown: #ffffff;
  --bg-table-head: #f8fafc;

  --border-color: #dde3ec;
  --border-subtle: #e9edf3;
  --border-hover: #b8c4d4;
  --border-row: rgba(15, 23, 42, 0.06);

  --surface-subtle: rgba(15, 23, 42, 0.04);
  --surface-hover: rgba(15, 23, 42, 0.07);
  --surface-active: rgba(15, 23, 42, 0.10);
  --surface-strong: rgba(15, 23, 42, 0.14);

  --text-main: #0f172a;
  --text-strong: #020617;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-disabled: #94a3b8;

  --cta-bg: #0f172a;
  --cta-bg-hover: #1e293b;
  --cta-bg-active: #334155;
  --cta-text: #ffffff;
  --cta-border: #0f172a;
  --cta-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);

  --accent-route: #0284c7;
  --accent-medical: #059669;
  --accent-fire: #dc2626;
  --accent-accident: #d97706;
  --accent-flood: #2563eb;
  --accent-roadblock: #ca8a04;
  --accent-roadblock-bg: rgba(202, 138, 4, 0.10);
  --accent-roadblock-border: rgba(202, 138, 4, 0.45);

  --slider-track: #cbd5e1;
  --slider-thumb: #0f172a;
  --slider-thumb-border: #ffffff;

  --chart-track: #e2e8f0;
  --chart-optimal: #0284c7;
  --chart-suboptimal: #94a3b8;

  --scrollbar-thumb: rgba(15, 23, 42, 0.18);
  --scrollbar-thumb-hover: rgba(15, 23, 42, 0.34);

  --shadow-float: 0 4px 14px rgba(15, 23, 42, 0.10);
  --shadow-dropdown: 0 12px 28px rgba(15, 23, 42, 0.14);
}

html, body {
  overflow: hidden;
  height: 100%;
  width: 100%;
  max-width: 100vw;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
::-webkit-scrollbar-corner { background: transparent; }

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

.app-layout {
  width: 100vw;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-page);
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  height: 46px;
  flex-shrink: 0;
  z-index: 20;
}

.navbar-left { display: flex; align-items: center; gap: 10px; }
.brand-title { font-size: 13.5px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.015em; }
.engine-badge {
  font-size: 10px; font-weight: 600; color: var(--text-secondary);
  background: var(--surface-subtle); border: 1px solid var(--border-color);
  padding: 2px 8px; border-radius: 999px;
}

.navbar-actions { display: flex; align-items: center; gap: 7px; }
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  color: var(--text-secondary); font-family: var(--font-sans);
  font-size: 11.5px; font-weight: 500; padding: 5px 10px;
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition-fast);
}
.nav-btn:hover:not(:disabled) { background: var(--bg-card-hover); color: var(--text-strong); border-color: var(--border-hover); }
.nav-btn.active { border-color: var(--border-hover); color: var(--text-strong); background: var(--surface-active); }
.nav-btn:disabled { opacity: 0.45; cursor: not-allowed; }

[data-theme="dark"] #btn-theme-toggle .icon-moon { display: none; }
[data-theme="light"] #btn-theme-toggle .icon-sun { display: none; }

/* Workspace Grid */
.main-workspace {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr) 530px;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  transition: grid-template-columns 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--bg-page);
  height: calc(100vh - 46px);
}
.main-workspace.wide-map-mode { grid-template-columns: 306px minmax(0, 1fr) 0px; }
.main-workspace.wide-map-mode .benchmark-panel { display: none; }

@media (max-width: 1360px) {
  .main-workspace { grid-template-columns: 286px minmax(0, 1fr) 485px; }
}
@media (max-width: 1180px) {
  html, body { overflow-y: auto !important; height: auto !important; }
  .app-layout { height: auto !important; overflow: visible !important; }
  .main-workspace { display: flex; flex-direction: column; height: auto; flex: none; }
  .canvas-panel { height: 540px !important; flex: none !important; }
  .benchmark-panel { height: auto !important; overflow-y: visible !important; border-left: none !important; border-top: 1px solid var(--border-color) !important; }
  .sidebar.unified-console { height: auto !important; overflow-y: visible !important; border-right: none !important; border-bottom: 1px solid var(--border-color) !important; }
}

.cf-section-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; user-select: none; }
.cf-section-tag {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.08em; color: var(--text-secondary); text-transform: uppercase;
}
.mini-count { font-size: 10px; font-weight: 600; color: var(--accent-route); }
.link-clear-btn {
  background: none; border: none; color: var(--text-muted); font-size: 10.5px;
  cursor: pointer; text-decoration: underline;
}
.link-clear-btn:hover { color: var(--text-strong); }

/* Left Sidebar */
.sidebar.unified-console {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  height: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden;
}

.console-section {
  display: flex; flex-direction: column; gap: 9px;
  padding: 12px 14px; border-bottom: 1px solid var(--border-color); position: relative;
}
.console-section.no-border { border-bottom: none; }

/* 5-Tool Segmented Bar */
.tool-grid-5 {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--bg-panel); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); overflow: hidden;
}
.tool-pill {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 30px; background: transparent; border: none;
  border-right: 1px solid var(--border-color);
  font-family: var(--font-sans); font-size: 10.5px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition-fast);
}
.tool-pill:last-child { border-right: none; }
.tool-pill:hover { background: var(--surface-subtle); color: var(--text-strong); }
.tool-pill.active { background: var(--surface-active); color: var(--text-strong); font-weight: 600; }

.tool-dot, .legend-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-medical { background: var(--accent-medical); }
.dot-fire { background: var(--accent-fire); }
.dot-accident { background: var(--accent-accident); }
.dot-flood { background: var(--accent-flood); }
.dot-roadblock { background: var(--accent-roadblock); }

.severity-row { display: flex; align-items: center; gap: 8px; }
.severity-label { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }

.segmented-bar {
  flex: 1; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--bg-panel); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); overflow: hidden;
}
.seg-btn {
  background: transparent; border: none; border-right: 1px solid var(--border-color);
  color: var(--text-secondary); font-family: var(--font-sans); font-size: 10.5px;
  font-weight: 500; height: 26px; cursor: pointer; transition: all var(--transition-fast);
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--surface-subtle); color: var(--text-strong); }
.seg-btn.active { background: var(--surface-active); color: var(--text-strong); font-weight: 600; }

.roadblock-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent-roadblock-bg); border: 1px dashed var(--accent-roadblock-border);
  border-radius: var(--radius-sm); padding: 5px 9px;
}
.roadblock-bar-info { display: flex; align-items: center; gap: 7px; }
.roadblock-dot-badge { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-roadblock); }
.roadblock-text { font-size: 11px; font-weight: 600; color: var(--text-strong); }
.clear-roadblocks-btn {
  background: var(--bg-panel); border: 1px solid var(--accent-roadblock-border);
  color: var(--text-strong); font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 3px; cursor: pointer;
}

/* Workload Presets */
.preset-pill-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-panel); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); overflow: hidden;
}
.preset-pill {
  background: transparent; border: none; border-right: 1px solid var(--border-color);
  color: var(--text-secondary); font-family: var(--font-sans);
  font-size: 10.5px; font-weight: 500; height: 27px; padding: 0 3px;
  cursor: pointer; transition: all var(--transition-fast); white-space: nowrap;
}
.preset-pill:last-child { border-right: none; }
.preset-pill:hover { background: var(--surface-subtle); color: var(--text-strong); }
.preset-pill.active { background: var(--surface-active); color: var(--text-strong); font-weight: 600; }

.constraint-group { display: flex; flex-direction: column; gap: 5px; }
.weights-box {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-inset); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 8px 11px;
}
.weight-item { display: flex; flex-direction: column; gap: 3px; }
.weight-label { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-secondary); }
.weight-val { color: var(--text-strong); font-weight: 600; }

.range-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 3px;
  background: var(--slider-track); border-radius: 999px; outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 12px; height: 12px;
  background: var(--slider-thumb); border-radius: 50%; cursor: pointer;
  border: 2px solid var(--slider-thumb-border);
}
.range-slider::-moz-range-thumb {
  width: 12px; height: 12px; background: var(--slider-thumb); border-radius: 50%;
  cursor: pointer; border: 2px solid var(--slider-thumb-border);
}

/* Compute CTA */
.compute-cta-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--cta-bg); color: var(--cta-text);
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 700;
  padding: 9px 14px; border: 1px solid var(--cta-border); border-radius: var(--radius-sm);
  cursor: pointer; box-shadow: var(--cta-shadow); transition: all 0.18s ease;
}
.compute-cta-btn:hover:not(:disabled) { background: var(--cta-bg-hover); transform: translateY(-1px); }
.compute-cta-btn:active:not(:disabled) { background: var(--cta-bg-active); transform: translateY(0); }

@keyframes btnSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.compute-cta-btn .btn-spinner {
  display: none; width: 13px; height: 13px;
  border: 2px solid color-mix(in srgb, var(--cta-text) 25%, transparent);
  border-top-color: var(--cta-text); border-radius: 50%; animation: btnSpin 0.65s linear infinite;
}
.compute-cta-btn.computing { cursor: wait; pointer-events: none; opacity: 0.9; box-shadow: none; }
.compute-cta-btn.computing .compute-btn-icon { display: none; }
.compute-cta-btn.computing .btn-spinner { display: inline-block; }
.compute-cta-btn.needs-recompute {
  border-color: var(--accent-route);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-route) 30%, transparent);
}

/* Combobox */
.custom-combobox { position: relative; width: 100%; }
.combobox-trigger {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-panel); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); height: 34px; padding: 0 11px;
  cursor: pointer; user-select: none; outline: none;
}
.combobox-trigger:hover { border-color: var(--border-hover); background: var(--surface-subtle); }
.custom-combobox.open .combobox-trigger { border-color: var(--border-hover); background: var(--surface-hover); }
.combobox-value-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.combobox-text { font-size: 12px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combobox-chevron { color: var(--text-muted); transition: transform 0.2s ease; flex-shrink: 0; }
.custom-combobox.open .combobox-chevron { transform: rotate(180deg); color: var(--text-strong); }

.combobox-dropdown {
  position: absolute; bottom: calc(100% + 4px); left: 0; width: 100%;
  background: var(--bg-dropdown); border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-dropdown);
  display: none; flex-direction: column; z-index: 100; overflow: hidden; max-height: 220px;
}
.custom-combobox.open .combobox-dropdown { display: flex; }
.combobox-options-list { overflow-y: auto; display: flex; flex-direction: column; }
.combobox-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; cursor: pointer; font-size: 11.5px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-row); gap: 8px;
}
.combobox-option:hover { background: var(--bg-card-hover); color: var(--text-strong); }
.combobox-option.selected { background: var(--surface-active); color: var(--text-strong); font-weight: 600; }
.combobox-option-cost { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-secondary); }

/* Transport & Telemetry */
.transport-bar {
  display: flex; align-items: stretch; background: var(--bg-panel);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden;
}
.transport-btn {
  flex: 1; height: 30px; background: transparent; border: none;
  border-right: 1px solid var(--border-color); color: var(--text-secondary);
  font-family: var(--font-sans); font-size: 11px; font-weight: 500; cursor: pointer;
}
.transport-btn:last-child { border-right: none; }
.transport-btn:hover { background: var(--surface-subtle); color: var(--text-strong); }
.transport-btn.play-btn { background: var(--surface-hover); color: var(--text-strong); font-weight: 600; }

.telemetry-compact-grid {
  display: flex; background: var(--bg-inset);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden;
}
.telemetry-pill { flex: 1; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border-color); padding: 5px 8px; }
.telemetry-pill:last-child { border-right: none; }
.telemetry-pill-label { font-size: 8.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-muted); text-transform: uppercase; }
.telemetry-pill-val { font-size: 11px; font-weight: 600; color: var(--text-strong); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Center Map Viewport */
.viewport-section { display: flex; flex-direction: column; min-width: 0; height: 100%; min-height: 0; background: var(--bg-page); position: relative; }
.status-ribbon {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-panel); border-bottom: 1px solid var(--border-color);
  padding: 0 14px; height: 38px; flex-shrink: 0;
}
.status-ribbon-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.status-ribbon-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.status-indicator { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.status-indicator.ready { background: var(--accent-medical); box-shadow: 0 0 6px color-mix(in srgb, var(--accent-medical) 65%, transparent); }
.status-indicator.running { background: var(--accent-accident); box-shadow: 0 0 6px color-mix(in srgb, var(--accent-accident) 70%, transparent); }
.status-text { font-size: 12px; font-weight: 500; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.basemap-toggle-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-family: var(--font-sans); font-size: 10.5px; font-weight: 500;
  padding: 4px 8px; cursor: pointer;
}
.basemap-toggle-btn.active { background: var(--surface-active); color: var(--text-strong); border-color: var(--border-hover); font-weight: 600; }

.layer-switcher {
  display: inline-flex; background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); overflow: hidden;
}
.layer-btn {
  background: transparent; border: none; border-right: 1px solid var(--border-color);
  color: var(--text-secondary); font-family: var(--font-sans); font-size: 10.5px;
  font-weight: 500; padding: 4px 8px; cursor: pointer;
}
.layer-btn:last-child { border-right: none; }
.layer-btn.active { background: var(--surface-active); color: var(--text-strong); font-weight: 600; }

.canvas-panel { position: relative; width: 100%; flex: 1 1 0; min-height: 0; background: var(--bg-canvas); overflow: hidden; }
#map-canvas { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; touch-action: none; }
#map-canvas:active { cursor: grabbing; }

.map-controls {
  position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column;
  background: var(--bg-overlay); backdrop-filter: blur(8px);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float); overflow: hidden; z-index: 20;
}
.map-ctrl-btn {
  width: 32px; height: 31px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary); cursor: pointer;
}
.map-ctrl-btn:last-child { border-bottom: none; }
.map-ctrl-btn:hover { background: var(--surface-hover); color: var(--text-strong); }
.map-zoom-level { font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; color: var(--text-muted); text-align: center; padding: 4px 0; border-bottom: 1px solid var(--border-color); }

.map-legend {
  position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 10px;
  background: var(--bg-overlay); backdrop-filter: blur(8px);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float); padding: 5px 10px; font-size: 10.5px; color: var(--text-secondary);
  z-index: 20; pointer-events: none;
}
.legend-item { display: flex; align-items: center; gap: 5px; }

.map-scale-bar {
  position: absolute; bottom: 12px; left: 12px; display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-overlay); backdrop-filter: blur(6px);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  padding: 4px 8px 5px; pointer-events: none; z-index: 20;
}
.scale-bar-label { font-size: 9.5px; font-weight: 600; color: var(--text-secondary); line-height: 1; }
.scale-bar-line { width: 68px; height: 5px; border-left: 1.5px solid var(--text-secondary); border-right: 1.5px solid var(--text-secondary); border-bottom: 1.5px solid var(--text-secondary); }

.map-attribution {
  position: absolute; bottom: 10px; right: 12px; font-size: 9.5px; color: var(--text-muted);
  background: var(--bg-overlay); border: 1px solid var(--border-color);
  border-radius: 3px; padding: 2px 7px; pointer-events: none; z-index: 20;
}

.canvas-tooltip {
  position: absolute; display: none; background: var(--bg-overlay); backdrop-filter: blur(8px);
  border: 1px solid var(--border-hover); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 11px; color: var(--text-main);
  pointer-events: none; z-index: 30; max-width: 270px; box-shadow: var(--shadow-float);
}
.tooltip-title { font-weight: 600; color: var(--text-strong); font-size: 11.5px; }
.tooltip-sub { color: var(--text-secondary); font-size: 10px; margin-top: 2px; }
.tooltip-hint { color: var(--accent-route); font-size: 10px; font-weight: 500; margin-top: 4px; }

.route-details-bar {
  display: flex; align-items: center; gap: 10px; background: var(--bg-panel);
  border-top: 1px solid var(--border-color); padding: 0 14px; height: 36px; flex-shrink: 0; overflow: hidden;
}
.route-tag {
  font-size: 10.5px; font-weight: 600; color: var(--text-strong);
  background: var(--surface-hover); border: 1px solid var(--border-color);
  padding: 2px 8px; border-radius: var(--radius-sm); white-space: nowrap; flex-shrink: 0;
}
.route-breadcrumb { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; }

/* Right Panel + Tabs */
.benchmark-panel {
  background: var(--bg-panel); border-left: 1px solid var(--border-color);
  display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden;
}
.panel-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border-color); background: var(--bg-table-head); flex-shrink: 0;
}
.panel-tab {
  background: transparent; border: none; border-right: 1px solid var(--border-color);
  color: var(--text-secondary); font-family: var(--font-sans); font-size: 11px;
  font-weight: 500; height: 38px; cursor: pointer; transition: all var(--transition-fast);
}
.panel-tab:last-child { border-right: none; }
.panel-tab:hover { color: var(--text-strong); background: var(--surface-subtle); }
.panel-tab.active { color: var(--text-strong); font-weight: 600; background: var(--bg-panel); box-shadow: inset 0 -2px 0 var(--accent-route); }

.tab-pane { display: none; flex-direction: column; flex: 1 1 0; min-height: 0; overflow-y: auto; }
.tab-pane.active { display: flex; }

/* Tables */
.table-frame { width: 100%; overflow-x: auto; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10.5px; text-align: left; }
.data-table th {
  background: var(--bg-table-head); color: var(--text-muted); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em; padding: 7.5px 5px;
  border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
.data-table th:first-child, .data-table td:first-child { padding-left: 11px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 10px; }
.data-table td { padding: 7px 5px; border-bottom: 1px solid var(--border-row); color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td strong { color: var(--text-strong); font-weight: 600; }
.data-table tbody tr { cursor: pointer; transition: background-color 0.1s ease; }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr.selected-row { background: var(--surface-active); box-shadow: inset 2px 0 0 var(--accent-route); }
.empty-message { text-align: center; padding: 20px 12px; color: var(--text-muted); font-style: italic; }

.badge-tag { display: inline-block; padding: 2px 6px; font-size: 9px; font-weight: 600; border-radius: 3px; text-transform: uppercase; }
.badge-solved { background: color-mix(in srgb, var(--accent-medical) 18%, transparent); color: var(--accent-medical); border: 1px solid color-mix(in srgb, var(--accent-medical) 45%, transparent); }
.badge-partial { background: color-mix(in srgb, var(--accent-accident) 18%, transparent); color: var(--accent-accident); border: 1px solid color-mix(in srgb, var(--accent-accident) 45%, transparent); }
.badge-failed { background: color-mix(in srgb, var(--accent-fire) 16%, transparent); color: var(--accent-fire); border: 1px solid color-mix(in srgb, var(--accent-fire) 40%, transparent); }

/* Constraint Verification Scorecard */
.route-inspector-card {
  padding: 12px 14px; border-bottom: 1px solid var(--border-color);
  display: flex; flex-direction: column; gap: 9px; background: var(--bg-panel-subtle); flex-shrink: 0;
}
.inspector-badge {
  font-size: 10px; font-weight: 600; color: var(--text-strong);
  background: var(--surface-hover); border: 1px solid var(--border-color); padding: 2px 7px; border-radius: 3px;
}
.constraint-badges-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-inset); border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden;
}
.constraint-pill { display: flex; flex-direction: column; padding: 6px 8px; border-right: 1px solid var(--border-color); }
.constraint-pill:last-child { border-right: none; }
.c-label { font-size: 8.5px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; }
.c-val { font-family: var(--font-mono); font-size: 11px; font-weight: 700; margin-top: 2px; color: var(--text-strong); }
.c-val.pass { color: var(--accent-medical); }
.c-val.fail { color: var(--accent-fire); }

.inspector-corridors-wrap { display: flex; flex-direction: column; gap: 5px; }
.inspector-corridors-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; color: var(--text-muted); }
.inspector-corridors-list { display: flex; flex-wrap: wrap; gap: 5px; }
.corridor-chip { font-size: 10.5px; color: var(--text-main); background: var(--bg-card); border: 1px solid var(--border-color); padding: 3px 7px; border-radius: 3px; }

/* Charts */
.metrics-grid { display: flex; flex-direction: column; }
.metric-card { border-bottom: 1px solid var(--border-color); padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.metric-card:last-child { border-bottom: none; }
.metric-card-header { display: flex; justify-content: space-between; align-items: center; }
.metric-chart-body { display: flex; flex-direction: column; gap: 7px; }
.chart-empty { text-align: center; padding: 14px 0; color: var(--text-muted); font-size: 11px; }

.chart-bar-row { display: grid; grid-template-columns: 88px 1fr 64px; align-items: center; gap: 8px; font-size: 10.5px; }
.chart-bar-label { color: var(--text-secondary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-track { height: 6px; background: var(--chart-track); border-radius: 2px; overflow: hidden; }
.chart-bar-fill { height: 100%; background: var(--chart-optimal); border-radius: 2px; transition: width 0.3s ease; }
.chart-bar-fill.suboptimal-fill { background: var(--chart-suboptimal); }
.chart-bar-val { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-strong); text-align: right; }

/* Fleet & Incident Lists */
.depot-list, .incident-list { display: flex; flex-direction: column; gap: 6px; }
.depot-row, .inc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg-inset); border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 11px; cursor: pointer;
}
.depot-row:hover, .inc-row:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.depot-meta, .inc-meta { display: flex; flex-direction: column; min-width: 0; }
.depot-name, .inc-name { font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.depot-sub, .inc-sub { font-size: 10px; color: var(--text-muted); }
.depot-caps { display: flex; gap: 5px; font-family: var(--font-mono); font-size: 10px; flex-shrink: 0; }
.cap-pill { padding: 2px 6px; border-radius: 3px; background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-main); }

.inc-remove-btn {
  background: transparent; border: 1px solid var(--border-color); color: var(--text-muted);
  border-radius: 3px; padding: 2px 6px; font-size: 10px; cursor: pointer;
}
.inc-remove-btn:hover { color: var(--accent-fire); border-color: var(--accent-fire); }

/* Scalability Benchmark Cards */
.bench-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.45; }
.scale-card {
  background: var(--bg-inset); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden;
}
.scale-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 11px; background: var(--bg-table-head); border-bottom: 1px solid var(--border-color);
  font-size: 11px; font-weight: 600; color: var(--text-strong);
}
