/* Project AEGIS — LVMH × Palantir Gotham × Cabinet Situation Room UI Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@300;400;500&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  --bg-void: #070A10;
  --glass-surface: rgba(10, 15, 26, 0.78);
  --glass-card: rgba(15, 23, 38, 0.72);
  --glass-card-hover: rgba(22, 34, 54, 0.85);
  --hairline: 0.5px solid rgba(148, 163, 184, 0.22);
  --hairline-sapphire: 0.5px solid rgba(56, 189, 248, 0.35);
  --hairline-emerald: 0.5px solid rgba(16, 185, 129, 0.35);
  --hairline-amber: 0.5px solid rgba(245, 158, 11, 0.40);
  --hairline-pink: 0.5px solid rgba(255, 77, 109, 0.40);

  --text-primary: #ECEFF4;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --sapphire: #38BDF8;
  --sapphire-glow: rgba(56, 189, 248, 0.25);
  --emerald: #10B981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --amber: #F59E0B;
  --amber-glow: rgba(245, 158, 11, 0.25);
  --pink-red: #FF4D6D;
  --pink-red-glow: rgba(255, 77, 109, 0.25);

  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Tabular Numbers on all metric elements */
.tabular-nums, .num, .coord, .time, .badge, table, td, th {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* =========================================================================
   1. 3D Full-Bleed Viewport & Safety Perimeter Frame
   ========================================================================= */
#cesium-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  background-color: var(--bg-void);
  touch-action: none;
}

#cesium-viewport canvas {
  touch-action: none;
}

#sim-perimeter-frame {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 200;
  pointer-events: none;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

#sim-perimeter-frame.active {
  border-color: var(--amber);
  box-shadow: inset 0 0 16px rgba(245, 158, 11, 0.20);
}

#sim-watermark-pill {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  pointer-events: none;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 20px;
  background: rgba(15, 23, 38, 0.94);
  border: 1.5px solid var(--amber);
  color: var(--amber);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.8px;
  box-shadow: 0 0 16px var(--amber-glow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: pulse-amber 2.5s infinite;
}

#sim-watermark-pill.visible {
  display: flex;
}

@keyframes pulse-amber {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.65; }
}

/* =========================================================================
   2. Glass HUD Overlays Structure
   ========================================================================= */
.hud-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.glass-bar, .glass-panel, .glass-btn, .glass-pill, .glass-card {
  pointer-events: auto;
  background: var(--glass-surface);
  backdrop-filter: blur(22px) saturate(175%);
  -webkit-backdrop-filter: blur(22px) saturate(175%);
  border: var(--hairline);
}

/* =========================================================================
   3. Top Telemetry Header (44px)
   ========================================================================= */
#top-telemetry-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: var(--hairline);
}

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

.brand-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title .brand-logo {
  color: var(--sapphire);
  font-size: 14px;
}

.brand-sub {
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  font-weight: 300;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border: var(--hairline-emerald);
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald);
  transition: all 0.25s ease;
}

.mode-badge.sim-mode {
  border: var(--hairline-amber);
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
}

.telemetry-center-strip {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-clock-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.live-clock-group .clock-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.live-clock-group .clock-label {
  color: var(--text-muted);
  font-size: 9.5px;
}

.live-clock-group .clock-val {
  color: var(--text-primary);
  font-weight: 500;
}

.open-feed-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  background: rgba(15, 23, 38, 0.65);
  padding: 3px 8px;
  border-radius: 4px;
  border: var(--hairline);
}

.feed-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
}

.feed-stat .feed-highlight {
  color: var(--sapphire);
  font-weight: 500;
}

.top-actions-strip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-header:hover {
  background: var(--glass-card-hover);
  border-color: var(--sapphire);
  color: var(--sapphire);
}

.btn-header.primary {
  border-color: var(--sapphire);
  color: var(--sapphire);
  background: rgba(56, 189, 248, 0.12);
}

/* =========================================================================
   4. Left 5-Lens Rail (54px width)
   ========================================================================= */
#left-lens-rail {
  position: fixed;
  top: 52px;
  left: 10px;
  width: 50px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 4px;
  border-radius: 6px;
  z-index: 80;
}

.lens-item {
  width: 40px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.lens-item .lens-icon {
  font-size: 15px;
}

.lens-item .lens-text {
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.3px;
}

.lens-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.lens-item.active {
  color: var(--sapphire);
  border-color: var(--sapphire);
  background: rgba(56, 189, 248, 0.16);
  font-weight: 500;
}

/* =========================================================================
   5. Floating 3D Layers & Camera Controls (Top-Right)
   ========================================================================= */
#floating-layer-controls {
  position: fixed;
  top: 52px;
  right: 350px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 80;
  transition: right 0.3s ease;
}

#floating-layer-controls.inspector-closed {
  right: 14px;
}

.control-bar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 6px;
}

.control-btn {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 9.5px;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.control-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.control-btn.active {
  color: var(--sapphire);
  border-color: var(--sapphire);
  background: rgba(56, 189, 248, 0.18);
  font-weight: 500;
}

.control-btn.active.emerald {
  color: var(--emerald);
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.18);
}

.control-btn.active.amber {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.18);
}

.control-btn.drag-orbit-active {
  color: var(--sapphire);
  border-color: var(--sapphire);
  background: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 10px var(--sapphire-glow);
  font-weight: 500;
}

.divider-vert {
  width: 1px;
  height: 14px;
  background: rgba(148, 163, 184, 0.25);
  margin: 0 2px;
}

/* =========================================================================
   6. Bottom-Left Live 3D Compass & Telemetry Gimbal
   ========================================================================= */
#bottom-left-compass-gimbal {
  position: fixed;
  bottom: 58px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  z-index: 80;
}

.compass-ring {
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.compass-needle {
  transition: transform 0.1s linear;
}

.gimbal-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-secondary);
}

.gimbal-metrics span b {
  color: var(--text-primary);
  font-weight: 500;
}

/* =========================================================================
   7. Right Contextual Obsidian Dossier (336px)
   ========================================================================= */
#right-dossier-panel {
  position: fixed;
  top: 44px;
  right: 0;
  width: 336px;
  bottom: 48px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  border-left: var(--hairline);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

#right-dossier-panel.closed {
  transform: translateX(100%);
}

.dossier-header-bar {
  height: 44px;
  padding: 0 12px;
  border-bottom: var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 38, 0.90);
}

.dossier-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dossier-title-group .icon {
  color: var(--sapphire);
  font-size: 14px;
}

.dossier-title-group .title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.dossier-title-group .subtitle {
  font-size: 9.5px;
  color: var(--sapphire);
}

.dossier-tabs-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: var(--hairline);
  background: rgba(10, 15, 26, 0.65);
  overflow-x: auto;
}

.dossier-tab-pill {
  padding: 3px 7px;
  border-radius: 3px;
  font-size: 9.5px;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dossier-tab-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.dossier-tab-pill.active {
  color: var(--sapphire);
  border-color: var(--sapphire);
  background: rgba(56, 189, 248, 0.16);
  font-weight: 500;
}

.dossier-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom Scrollbar for Obsidian Panel */
.dossier-content-area::-webkit-scrollbar {
  width: 4px;
}
.dossier-content-area::-webkit-scrollbar-track {
  background: transparent;
}
.dossier-content-area::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 2px;
}

.dossier-section {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.dossier-section.active {
  display: flex;
}

.section-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--hairline);
  padding-bottom: 3px;
}

.unit-selector-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip-unit {
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 9.5px;
  background: rgba(15, 23, 38, 0.7);
  border: var(--hairline);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-unit:hover {
  border-color: var(--sapphire);
  color: var(--text-primary);
}

.chip-unit.active {
  color: var(--sapphire);
  border-color: var(--sapphire);
  background: rgba(56, 189, 248, 0.18);
  font-weight: 500;
}

.unit-action-btn-row {
  display: flex;
  gap: 6px;
}

.btn-unit-action {
  flex: 1;
  padding: 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--sapphire);
  color: var(--sapphire);
  background: rgba(56, 189, 248, 0.12);
  transition: all 0.2s ease;
}

.btn-unit-action:hover {
  background: rgba(56, 189, 248, 0.24);
}

/* Flight Timing Matrix */
.timing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--glass-card);
  padding: 8px;
  border-radius: 4px;
  border: var(--hairline);
}

.timing-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timing-cell .label {
  font-size: 9px;
  color: var(--text-muted);
}

.timing-cell .val {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
}

.timing-cell .val.sapphire { color: var(--sapphire); }
.timing-cell .val.emerald { color: var(--emerald); }
.timing-cell .val.amber { color: var(--amber); }

/* Roles & Manifest Table */
.manifest-box {
  background: var(--glass-card);
  padding: 8px;
  border-radius: 4px;
  border: var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manifest-pob-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--hairline);
  padding-bottom: 4px;
}

.manifest-pob-row .pob-total {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--emerald);
}

.role-tag-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
}

.role-tag-item {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Patient Vital Card */
.patient-vital-card {
  background: rgba(255, 77, 109, 0.08);
  border: var(--hairline-pink);
  border-radius: 4px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.patient-vital-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-triage-red {
  background: var(--pink-red);
  color: #FFFFFF;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
}

.vitals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
}

.vitals-row .v-item span {
  color: var(--text-muted);
  font-size: 9px;
}

/* Thin Animated ECG Waveform */
.ecg-svg {
  width: 100%;
  height: 22px;
}

.ecg-path {
  stroke: var(--pink-red);
  stroke-width: 1.2;
  fill: none;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: ecg-draw 2.2s linear infinite;
}

@keyframes ecg-draw {
  0% { stroke-dashoffset: 200; }
  100% { stroke-dashoffset: 0; }
}

/* Honest Missing Manifest Card */
.manifest-missing-card {
  background: rgba(245, 158, 11, 0.08);
  border: var(--hairline-amber);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manifest-missing-card .alert-title {
  color: var(--amber);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.manifest-missing-card .alert-reason {
  color: var(--text-secondary);
  font-size: 9.5px;
  line-height: 1.4;
}

/* Attributes Grid */
.attr-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--glass-card);
  padding: 8px;
  border-radius: 4px;
  border: var(--hairline);
}

.attr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
}

.attr-row .k {
  color: var(--text-muted);
}

.attr-row .v {
  color: var(--text-primary);
  text-align: right;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* SimCity Sliders Deck */
.simcity-deck {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-card-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.btn-scenario-preset {
  padding: 5px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 400;
  text-align: center;
  cursor: pointer;
  background: var(--glass-card);
  border: var(--hairline);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-scenario-preset:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.sim-slider-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--glass-card);
  padding: 6px 8px;
  border-radius: 4px;
  border: var(--hairline);
}

.sim-slider-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
}

.sim-slider-label-row .s-name {
  color: var(--text-secondary);
}

.sim-slider-label-row .s-val {
  color: var(--sapphire);
  font-weight: 500;
}

.sim-slider-input {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 2px;
  outline: none;
}

.sim-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sapphire);
  cursor: pointer;
  box-shadow: 0 0 6px var(--sapphire-glow);
}

.sim-lock-banner {
  background: rgba(245, 158, 11, 0.12);
  border: var(--hairline-amber);
  padding: 8px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-fork-sim {
  padding: 7px;
  border-radius: 4px;
  background: var(--amber);
  color: #070A10;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-fork-sim:hover {
  box-shadow: 0 0 12px var(--amber-glow);
}

/* =========================================================================
   8. Bottom Timeline & Safety Interlock Bar (48px)
   ========================================================================= */
#bottom-timeline-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-top: var(--hairline);
}

.timeline-left-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-mode-toggle {
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--amber);
  color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
}

.btn-mode-toggle.return-live {
  border-color: var(--emerald);
  color: var(--emerald);
  background: rgba(16, 185, 129, 0.15);
}

.timeline-scrubber-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 500px;
  margin: 0 20px;
}

.timeline-scrubber-group .time-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 2px;
  outline: none;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
}

.timeline-right-kpis {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10.5px;
}

/* =========================================================================
   9. All-23-Wards Sortable Thin Comparison Modal (#ward-matrix-modal)
   ========================================================================= */
#ward-matrix-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(7, 10, 16, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#ward-matrix-modal.open {
  display: flex;
}

.modal-glass-container {
  width: 95vw;
  max-width: 1200px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 26, 0.92);
  border: var(--hairline);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  height: 48px;
  padding: 0 16px;
  border-bottom: var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-close-modal:hover {
  color: var(--pink-red);
}

.modal-table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.ward-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  text-align: right;
}

.ward-matrix-table th {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 38, 0.98);
  padding: 8px 10px;
  border-bottom: var(--hairline);
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.ward-matrix-table th:hover {
  color: var(--sapphire);
}

.ward-matrix-table th.text-left,
.ward-matrix-table td.text-left {
  text-align: left;
}

.ward-matrix-table td {
  padding: 7px 10px;
  border-bottom: 0.5px solid rgba(148, 163, 184, 0.10);
  color: var(--text-primary);
  white-space: nowrap;
}

.ward-matrix-table tr:hover td {
  background: rgba(56, 189, 248, 0.10);
  cursor: pointer;
}

/* =========================================================================
   10. M4 Real-Time 3D Weather, Traffic Corridors & API Key Vault Styles
   ========================================================================= */

.badge-api-count {
  background: rgba(16, 185, 129, 0.20);
  border: var(--hairline-emerald);
  color: var(--emerald);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 600;
  margin-left: 4px;
}

.control-btn.btn-storm-preview.active {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.22);
  color: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

.nowcast-player-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  margin-top: 4px;
  background: rgba(10, 15, 26, 0.88);
  border: var(--hairline-sapphire);
  animation: fadeIn 0.2s ease-out;
}

.nowcast-label {
  font-size: 10.5px;
  color: var(--sapphire);
  font-weight: 500;
  white-space: nowrap;
}

.nowcast-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(56, 189, 248, 0.25);
  border-radius: 2px;
  outline: none;
}

.nowcast-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sapphire);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
}

#api-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: rgba(7, 10, 16, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#api-settings-modal.open {
  display: flex;
}

.api-modal-container {
  width: 95vw;
  max-width: 1280px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 26, 0.94);
  border: var(--hairline);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-subtitle {
  font-size: 10px;
  color: var(--text-muted);
}

.modal-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.api-modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.api-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.api-section-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.api-section-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.api-section-badge.amber {
  background: rgba(245, 158, 11, 0.15);
  border: var(--hairline-amber);
  color: var(--amber);
}

.api-section-badge.emerald {
  background: rgba(16, 185, 129, 0.15);
  border: var(--hairline-emerald);
  color: var(--emerald);
}

.api-section-badge.sapphire {
  background: rgba(56, 189, 248, 0.18);
  border: var(--hairline-sapphire);
  color: var(--sapphire);
}

.api-key-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.api-key-input {
  background: rgba(13, 22, 38, 0.9);
  border: 0.5px solid rgba(56, 189, 248, 0.35);
  color: #ECEFF4;
  padding: 4px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  width: 140px;
  outline: none;
  transition: border-color 0.2s;
}

.api-key-input:focus {
  border-color: var(--sapphire);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.3);
}

.btn-key-action {
  background: rgba(56, 189, 248, 0.12);
  border: 0.5px solid var(--sapphire);
  color: var(--sapphire);
  border-radius: 3px;
  font-size: 9.5px;
  padding: 3px 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-key-action:hover {
  background: rgba(56, 189, 248, 0.25);
}

.badge-key-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-key-status.unset {
  background: rgba(255, 77, 109, 0.12);
  border: var(--hairline-pink);
  color: var(--pink-red);
}

.badge-key-status.set {
  background: rgba(16, 185, 129, 0.15);
  border: var(--hairline-emerald);
  color: var(--emerald);
}

.traffic-corridor-item {
  background: var(--glass-card);
  border: var(--hairline);
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.traffic-corridor-item:hover {
  background: rgba(56, 189, 248, 0.10);
  border-color: var(--sapphire);
}

.traffic-corridor-item.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--sapphire);
}

.traffic-badge-free {
  color: var(--emerald);
  background: rgba(16, 185, 129, 0.12);
  border: var(--hairline-emerald);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9.5px;
}

.traffic-badge-moderate {
  color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
  border: var(--hairline-amber);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9.5px;
}

.traffic-badge-congested {
  color: var(--pink-red);
  background: rgba(255, 77, 109, 0.12);
  border: var(--hairline-pink);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9.5px;
}

.adsb-live-card {
  background: var(--glass-card);
  border: var(--hairline-sapphire);
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =========================================================================
   Traffic Congestion Legend & Filter Bar (Bottom-Left)
   ========================================================================= */
#traffic-legend-bar {
  position: fixed;
  bottom: 58px;
  left: 254px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  z-index: 25;
  background: rgba(10, 16, 26, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  font-family: inherit;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.traffic-legend-header {
  display: flex;
  align-items: center;
}

.traffic-legend-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.traffic-legend-sub {
  font-size: 8.5px;
  font-weight: 400;
  color: var(--text-muted);
}

.traffic-legend-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
  border-left: 1px solid rgba(148, 163, 184, 0.2);
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0 8px;
}

.traffic-legend-filters {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tr-filter-pill {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-secondary);
  font-size: 9px;
  padding: 2.5px 7px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tr-filter-pill:hover {
  background: rgba(56, 189, 248, 0.15);
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.4);
}

.tr-filter-pill.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--sapphire);
  color: var(--sapphire);
  font-weight: 600;
  box-shadow: 0 0 8px var(--sapphire-glow);
}

.traffic-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.traffic-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.traffic-status-pill-bold {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}

/* =========================================================================
   On-Screen Hideable Directional Movement Cursor (D-Pad) & Zoom Pad
   ========================================================================= */
#map-dpad-widget {
  position: fixed;
  bottom: 132px;
  left: 12px;
  width: 118px;
  padding: 6px 7px 7px;
  border-radius: 8px;
  z-index: 82;
  background: rgba(10, 16, 26, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.30);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 5px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#map-dpad-widget.hidden {
  display: none !important;
}

.dpad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid rgba(148, 163, 184, 0.18);
  padding-bottom: 3px;
}

.dpad-title {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--sapphire);
  letter-spacing: 0.2px;
}

.dpad-hide-btn {
  background: rgba(255, 77, 109, 0.12);
  border: 0.5px solid rgba(255, 77, 109, 0.35);
  color: var(--text-secondary);
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dpad-hide-btn:hover {
  color: var(--pink-red);
  border-color: var(--pink-red);
  background: rgba(255, 77, 109, 0.22);
}

.dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 30px);
  grid-template-rows: repeat(3, 27px);
  gap: 3px;
  justify-content: center;
}

.dpad-arrow-btn,
.dpad-orbit-btn,
.dpad-center-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: var(--text-primary);
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  touch-action: none;
}

.dpad-orbit-btn {
  border-color: rgba(16, 185, 129, 0.36);
  color: var(--emerald);
  font-size: 11.5px;
  font-weight: 600;
}

.dpad-center-btn {
  color: var(--sapphire);
  font-size: 10px;
  border-color: rgba(148, 163, 184, 0.30);
}

.dpad-arrow-btn:hover,
.dpad-arrow-btn.pressing,
.dpad-center-btn:hover {
  background: rgba(56, 189, 248, 0.26);
  border-color: var(--sapphire);
  color: var(--sapphire);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
}

.dpad-orbit-btn:hover,
.dpad-orbit-btn.pressing {
  background: rgba(16, 185, 129, 0.24);
  border-color: var(--emerald);
  color: var(--emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.45);
}

.dpad-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding-top: 3px;
  border-top: 0.5px solid rgba(148, 163, 184, 0.18);
}

.dpad-mode-pill {
  background: rgba(15, 23, 42, 0.72);
  border: 0.5px solid rgba(148, 163, 184, 0.28);
  color: var(--text-secondary);
  font-size: 8.5px;
  font-weight: 500;
  padding: 2.5px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dpad-mode-pill:hover {
  color: var(--text-primary);
  border-color: var(--sapphire);
}

.dpad-mode-pill.active[data-dpad-drag="pan"] {
  background: rgba(56, 189, 248, 0.20);
  border-color: var(--sapphire);
  color: var(--sapphire);
  font-weight: 600;
}

.dpad-mode-pill.active[data-dpad-drag="orbit"] {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--emerald);
  color: var(--emerald);
  font-weight: 600;
}

#map-zoom-pad {
  position: fixed;
  bottom: 96px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 6px;
  z-index: 80;
  background: rgba(10, 16, 26, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.zoom-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-primary);
  font-size: 10.5px;
  padding: 3px 7px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-weight: 500;
}

.zoom-btn:hover,
.zoom-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--sapphire);
  color: var(--sapphire);
}

/* 3D Map Brightness Controls (Sapphire & Emerald Fine Controls) */
.brightness-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 66px;
  height: 4px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.28);
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  accent-color: var(--sapphire);
}

.brightness-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sapphire);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
  cursor: pointer;
  border: 1px solid #ffffff;
  transition: transform 0.15s ease;
}

.brightness-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.brightness-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sapphire);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
  cursor: pointer;
  border: 1px solid #ffffff;
}

.brightness-slider-compact {
  width: 54px;
}

.brightness-boost-btn {
  font-weight: 600;
}

.brightness-boost-btn.active {
  color: var(--emerald) !important;
  border-color: var(--emerald) !important;
  background: rgba(16, 185, 129, 0.22) !important;
}

.brightness-pct-btn {
  min-width: 38px;
  text-align: center;
  font-family: var(--font-mono, monospace);
  font-size: 9.5px;
}

/* =========================================================================
   Real-Time Data Ingestion Status (🔵 / ❌) & Linkage Wizard Styles
   ========================================================================= */
.api-linkage-kpi-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(15, 23, 38, 0.78);
  border: var(--hairline-sapphire);
}

.badge-ingest-blue {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 8px;
  border-radius: 12px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--sapphire);
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.50);
  white-space: nowrap;
}

.badge-ingest-red {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 8px;
  border-radius: 12px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--pink-red);
  background: rgba(255, 77, 109, 0.14);
  border: 1px solid rgba(255, 77, 109, 0.48);
  white-space: nowrap;
}

.btn-start-linkage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
  color: #070A10;
  background: linear-gradient(135deg, #38BDF8 0%, #10B981 100%);
  border: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-start-linkage:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

.btn-manage-linkage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3.5px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  color: var(--sapphire);
  background: rgba(56, 189, 248, 0.12);
  border: 0.5px solid var(--sapphire);
  white-space: nowrap;
}

.linkage-wizard-drawer {
  background: rgba(8, 14, 26, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.linkage-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================================================================
   72-Hour Weather & Thermal Simulator Card
   ========================================================================= */
.forecast-72h-card {
  background: var(--glass-card);
  border: var(--hairline-sapphire);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.forecast-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.forecast-stat-box {
  background: rgba(15, 23, 42, 0.6);
  border: var(--hairline);
  border-radius: 4px;
  padding: 5px;
  text-align: center;
}

.forecast-stat-label {
  font-size: 8.5px;
  color: var(--text-muted);
}

.forecast-stat-val {
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.forecast-svg-wrap {
  width: 100%;
  height: 110px;
  background: rgba(4, 8, 16, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

/* All-Domain Scenario Launch Grid */
.all-domain-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.btn-all-domain-scenario {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 4px;
  padding: 8px 6px;
  color: var(--text-primary);
  font-size: 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-all-domain-scenario:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--sapphire);
}

.btn-all-domain-scenario.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--sapphire);
  box-shadow: 0 0 10px var(--sapphire-glow);
}

/* =========================================================================
   Arc Municipal Emergency Push Modal
   ========================================================================= */
#arc-notify-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 8, 16, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#arc-notify-modal.open {
  display: flex;
}

.arc-modal-container {
  width: 780px;
  max-width: 95vw;
  max-height: 90vh;
  background: rgba(10, 16, 26, 0.96);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 24px rgba(16, 185, 129, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.arc-modal-header {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, 0.08);
}

.arc-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.arc-phone-mockup {
  background: #000;
  border: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
}


