/* ==========================================================================
   AeroChronik: High-Tech Cockpit & Avionics Radar Interface
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", Menlo, Monaco, Consolas, monospace;
  
  /* Dark / Cockpit Night Palette (Default) */
  --canvas: #070a0f;
  --paper: #0d131f;
  --panel: #131d2b;
  --panel-elevated: #1a273a;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.08);
  --line-focus: rgba(14, 165, 233, 0.6);
  --line-strong: rgba(255, 255, 255, 0.16);
  
  /* Tactical Avionics Accents */
  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-glow: rgba(14, 165, 233, 0.25);
  --bos-red: #f43f5e;
  --bos-red-glow: rgba(244, 63, 94, 0.25);
  --police-blue: #3b82f6;
  --civil-sky: #38bdf8;
  --live-green: #10b981;
  --live-green-glow: rgba(16, 185, 129, 0.35);
  --amber: #f59e0b;
  
  /* Glassmorphism & Elevation */
  --glass-bg: rgba(13, 19, 31, 0.82);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-blur: blur(16px);
  --shadow-card: 0 12px 36px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-hud: 0 8px 32px rgba(0, 0, 0, 0.45);
  
  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  font-family: var(--font-sans);
  color: var(--ink);
  color-scheme: dark;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="light"] {
  --canvas: #f1f5f9;
  --paper: #ffffff;
  --panel: #f8fafc;
  --panel-elevated: #ffffff;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-focus: rgba(2, 132, 199, 0.6);
  --line-strong: #cbd5e1;
  
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.15);
  --bos-red: #e11d48;
  --bos-red-glow: rgba(225, 29, 72, 0.15);
  --police-blue: #2563eb;
  --civil-sky: #0284c7;
  --live-green: #059669;
  --live-green-glow: rgba(5, 150, 105, 0.2);
  --amber: #d97706;
  
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(226, 232, 240, 0.85);
  --shadow-card: 0 10px 25px -4px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-hud: 0 8px 30px rgba(15, 23, 42, 0.12);
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button, select {
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

svg {
  display: block;
}

/* Global icon sizing — SVG symbols have no intrinsic dimensions */
button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.chip svg {
  width: 16px;
  height: 16px;
}

.alert-center-icon {
  width: 15px;
  height: 15px;
}

.alert-row-icon,
.alert-row-desc svg,
.geofence-icon svg,
.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

/* Glass Panel Utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-hud);
}

/* Base Icon Button (generic icon-only button used across the app) */
button.icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: color 0.15s, background 0.15s;
}

button.icon:hover {
  color: var(--ink);
  background: var(--panel);
}

/* Badge icon containers in cards */
.incident-badge-icon svg,
.poi-badge-icon svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   Shell Grid Layout
   ========================================================================== */

.shell {
  height: 100dvh;
  min-height: 500px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-rows: 52px minmax(0, 1fr);
  overflow: hidden;
  transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.shell.sidebar-collapsed {
  grid-template-columns: 0px minmax(0, 1fr);
}

/* ==========================================================================
   Command Header (Slim 52px Cockpit Bar)
   ========================================================================== */

.header {
  grid-column: 1 / -1;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 600;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-collapse-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line-strong);
}

.sidebar-collapse-btn[aria-expanded="false"] {
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent);
  border-color: rgba(14, 165, 233, 0.4);
}

.brand-logo {
  height: 32px;
  width: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent);
  background: rgba(14, 165, 233, 0.08);
  flex-shrink: 0;
}

.brand-logo svg {
  width: 20px;
  height: 20px;
}

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

.brand-text strong {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.brand-radar-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--live-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.radar-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live-green);
  box-shadow: 0 0 0 0 var(--live-green-glow);
  animation: radarLivePulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes radarLivePulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* View Switcher Tabs */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 3px;
}

:root[data-theme="light"] .view-tabs {
  background: #e2e8f0;
}

.view-tabs button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 5px 13px;
  min-height: 28px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.view-tabs button:hover {
  color: var(--ink);
}

.view-tabs button[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.tab-icon {
  font-size: 12px;
}

/* Header Right Utilities */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--panel-elevated);
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.chip.alert-center-chip {
  position: relative;
  border-color: var(--line);
}

.alerts-count-badge {
  background: var(--bos-red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  border-radius: var(--radius-full);
  padding: 1px 5px;
  min-width: 15px;
  height: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.incident-chip {
  background: rgba(244, 63, 94, 0.15) !important;
  border-color: rgba(244, 63, 94, 0.35) !important;
  color: var(--bos-red) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
}

.incident-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bos-red);
  animation: incidentPulse 1.2s infinite ease-in-out;
}

@keyframes incidentPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
}

.connection {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  display: inline-block;
  flex: none;
}

.dot.live {
  background: var(--live-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.theme-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  place-items: center;
}

.theme-button:hover {
  color: var(--ink);
  background: var(--panel);
}

.theme-button svg {
  width: 16px;
  height: 16px;
}

.header-link {
  font-size: 11px;
  text-decoration: none;
  color: var(--muted);
  background: none;
  border: none;
  padding: 4px 6px;
}

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

.sidebar-toggle {
  display: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.settings-btn:hover {
  background: var(--panel-elevated, rgba(255, 255, 255, 0.08));
  color: var(--ink);
  border-color: var(--line-strong);
}

.settings-btn svg {
  width: 18px;
  height: 18px;
}

.settings-modal {
  max-width: 480px;
}

.settings-content {
  margin-top: 18px;
}

.setting-desc {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 10px 0;
}

.setting-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.setting-chip:hover {
  background: var(--panel-elevated, rgba(255, 255, 255, 0.08));
  border-color: var(--line-strong);
}

.setting-chip.active {
  background: var(--accent-subtle, rgba(2, 132, 199, 0.15));
  border-color: var(--accent, #38bdf8);
  color: var(--accent-text, #e0f2fe);
}

.setting-chip strong {
  font-size: 13px;
  font-weight: 600;
}

.setting-chip small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.setting-chip.active small {
  color: var(--accent-text, #bae6fd);
  opacity: 0.9;
}

/* ==========================================================================
   Sidebar (Tactical Operations & Flight Strips)
   ========================================================================== */

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 500;
  width: 360px;
  min-width: 360px;
  max-width: 360px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state on desktop: completely hide and slide out */
.shell.sidebar-collapsed .sidebar {
  min-width: 0 !important;
  max-width: 0 !important;
  width: 0 !important;
  border-right: none !important;
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sidebar-top-bar {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.sidebar-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-search-row .search-box {
  flex: 1;
  min-width: 0;
}

.sidebar-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  place-items: center;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  color: var(--ink);
  background: var(--panel-elevated);
}

.sidebar-close-btn svg {
  width: 16px;
  height: 16px;
}

/* Search Box with Hotkey */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

input[type="search"] {
  height: 36px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 32px 7px 32px;
  font-size: 12px;
  background: var(--panel);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  outline: none;
}

.search-shortcut {
  position: absolute;
  right: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted);
  pointer-events: none;
}

/* Fleet Segmented Switcher (Alle / BOS / Zivil) */
.fleet-segmented {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.1fr;
  gap: 2px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px;
}

:root[data-theme="light"] .fleet-segmented {
  background: #e2e8f0;
}

.fleet-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  padding: 6px 4px;
  min-height: 28px;
  border-radius: 4px;
  white-space: nowrap;
  text-align: center;
  transition: all 0.15s ease;
}

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

.fleet-btn.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.fleet-btn.emergency.active {
  color: var(--bos-red);
  font-weight: 750;
}

.fleet-btn.civil.active {
  color: var(--civil-sky);
  font-weight: 750;
}

/* Quick Filter Chips */
.filter-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.filter-row .chip {
  flex: 1;
  justify-content: center;
  font-size: 10.5px;
  padding: 4px 6px;
  min-height: 28px;
}

.config-toggle-chip {
  flex: 0 0 30px !important;
  padding: 4px !important;
  display: grid !important;
  place-items: center;
}

.config-toggle-chip svg {
  width: 14px;
  height: 14px;
}

/* Collapsible Settings Drawer */
.advanced-drawer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: drawerSlideDown 0.2s ease;
}

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

.drawer-toggles {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.modern-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-secondary);
  cursor: pointer;
}

.modern-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  width: 28px;
  height: 16px;
  background: var(--line-strong);
  border-radius: var(--radius-full);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.modern-toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.modern-toggle input:checked + .toggle-slider::before {
  transform: translateX(12px);
}

.track-controls {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.track-control-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .45px;
  text-transform: uppercase;
}

.track-mode-segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.track-mode-btn {
  min-width: 0;
  min-height: 28px;
  padding: 4px 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-secondary);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.track-mode-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.track-mode-btn.active,
.track-mode-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--paper));
  color: var(--ink);
}

.select-group label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin-bottom: 3px;
}

.select-group select {
  width: 100%;
  height: 28px;
  min-height: 28px;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
}

.track-status {
  font-size: 10px;
  color: var(--muted);
  margin: 5px 0 0;
}

/* Results Header Bar */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.results-header strong {
  color: var(--ink);
  font-size: 11.5px;
}

.in-view-badge {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.count-pill {
  font-weight: 700;
}

.count-pill.emergency {
  color: var(--bos-red);
}

.count-pill.civil {
  color: var(--civil-sky);
}

.coverage-summary {
  font-size: 9.5px;
  color: var(--muted);
  padding: 4px 14px 6px;
  background: var(--paper);
}

/* ==========================================================================
   Flight Strips (Aircraft List)
   ========================================================================== */

.aircraft-list {
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
  padding: 6px 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.list-section-header {
  padding: 5px 8px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 8px 0 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.list-section-header.emergency {
  color: var(--bos-red);
  background: rgba(244, 63, 94, 0.08);
  border-left: 3px solid var(--bos-red);
}

.list-section-header.civil {
  color: var(--civil-sky);
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--civil-sky);
}

.list-section-header.archive {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-left: 3px solid var(--accent);
}

.aircraft-row {
  content-visibility: auto;
  contain-intrinsic-block-size: auto 54px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  text-align: left;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin: 3px 0;
  min-height: 52px;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.aircraft-row:hover {
  background: var(--panel-elevated);
  border-color: var(--line-strong);
}

.aircraft-row.archive-only {
  color: var(--ink);
  text-decoration: none;
  border-left-color: var(--accent);
}

.aircraft-row.archive-only .row-main > strong {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-row-action {
  flex: none;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.aircraft-row.active {
  background: var(--panel-elevated);
  border-left-color: var(--air-color, var(--accent));
  border-color: var(--line-strong);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.aircraft-row.emergency {
  border-left-color: rgba(244, 63, 94, 0.4);
}

.aircraft-row.emergency.active {
  border-left-color: var(--bos-red);
}

.aircraft-row.civil {
  border-left-color: rgba(56, 189, 248, 0.3);
}

.aircraft-row.civil.active {
  border-left-color: var(--civil-sky);
}

.aircraft-row.parked {
  opacity: 0.6;
}

.aircraft-row.parked.active {
  opacity: 1;
}

.row-symbol {
  width: 32px;
  height: 32px;
  flex: none;
  color: var(--air-color, var(--accent));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

.row-symbol svg {
  height: 20px;
  width: 20px;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.row-title-wrap strong {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.row-service-badge {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.row-service-badge.badge-hems {
  background: rgba(244, 63, 94, 0.15);
  color: var(--bos-red);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.row-service-badge.badge-police {
  background: rgba(59, 130, 246, 0.15);
  color: var(--police-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.row-service-badge.badge-military {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.row-service-badge.badge-civil {
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.row-main small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.row-metric {
  text-align: right;
  font-size: 11px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}

.row-metric small {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  margin-top: 2px;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--muted);
}

.legal-trigger-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 10.5px;
  padding: 0;
  cursor: pointer;
}

.legal-trigger-btn:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Map Stage & Floating Glassmorphic HUDs
   ========================================================================== */

.map-area {
  position: relative;
  overflow: hidden;
  background: var(--canvas);
}

.map {
  height: 100%;
  width: 100%;
  background: var(--canvas);
  z-index: 0;
}

.map-head {
  position: absolute;
  z-index: 450;
  left: 18px;
  top: 16px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}

.map-caption {
  border-radius: var(--radius-md);
  padding: 9px 14px;
  pointer-events: auto;
  min-width: 170px;
}

.map-caption h2 {
  font-size: 13.5px;
  font-weight: 750;
  letter-spacing: -0.2px;
  margin: 0 0 2px;
}

.map-caption p {
  font-size: 10px;
  color: var(--muted);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: var(--radius-md);
  pointer-events: auto;
}

.map-actions .chip {
  height: 32px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 11px;
}

.map-actions .icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
}

.map-actions .icon:hover {
  background: var(--panel-elevated);
  color: var(--ink);
}

.map-actions .action-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 2px;
}

.map-actions .primary {
  height: 32px;
  min-height: 32px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.map-actions .primary:hover {
  background: var(--accent-hover);
}

/* Notice Toast */
.notice {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 72px;
  z-index: 450;
  border: 1px solid #d97706;
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 6, 0.15);
  backdrop-filter: var(--glass-blur);
  color: #f59e0b;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.5;
  max-width: 600px;
}

/* ==========================================================================
   Cockpit MFD Detail Panel (#detail)
   ========================================================================== */

.detail {
  position: absolute;
  z-index: 460;
  right: 18px;
  top: 72px;
  width: 320px;
  border-radius: var(--radius-lg);
  max-height: calc(100% - 90px);
  overflow-y: auto;
  scrollbar-width: thin;
  animation: detailSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.detail-top {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.detail-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.detail-category-badge {
  font-size: 9.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-bottom: 4px;
}

.detail h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 2px;
  font-family: var(--font-mono);
}

.detail .subtitle {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
}

.detail-buttons {
  display: flex;
  gap: 4px;
}

.detail-buttons .icon {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
}

.detail-buttons .icon:hover {
  color: var(--ink);
  background: var(--panel-elevated);
}

.service-detail-banner {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-detail-banner .banner-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.service-detail-banner.badge-hems {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--bos-red);
}

.service-detail-banner.badge-police {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--police-blue);
}

.service-detail-banner.badge-civil {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--muted);
}

.detail-source {
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 6px;
}

/* Route Selector Row */
.route-format-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--line);
}

.route-format-row .field-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.segmented-mini {
  display: flex;
  gap: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 2px;
  border-radius: var(--radius-sm);
}

.route-chip {
  border: none;
  background: transparent;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  color: var(--muted);
}

.route-chip[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* Telemetry Grid (MFD Display) */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 12px 16px;
  margin: 0;
}

.detail-grid div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.detail-grid dt {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin-bottom: 3px;
}

.detail-grid dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-grid dd.small {
  font-size: 11px;
}

.detail-bottom {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.detail-track-status {
  font-size: 10px;
  color: var(--muted);
}

.detail-actions-row {
  display: flex;
  gap: 6px;
}

.detail-action-btn {
  flex: 1;
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 8px;
  min-height: 30px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  text-align: center;
}

.detail-action-btn:hover:not(:disabled) {
  background: var(--panel-elevated);
  border-color: var(--line-strong);
}

.detail-action-btn.history-link {
  color: var(--accent);
}

/* ==========================================================================
   Multi-Selection Detail Cards & Flight Tracks
   ========================================================================== */

.detail.multi-detail {
  width: 360px;
}

.multi-detail-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 12px 14px;
  max-height: 60vh;
  overflow-y: auto;
}

.multi-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md, 8px);
  background: var(--glass-bg, rgba(20, 30, 50, 0.55));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.multi-item:hover {
  background: var(--glass-bg-hover, rgba(30, 45, 70, 0.75));
  border-color: var(--air-color, var(--accent));
}

.multi-item.primary {
  border-color: var(--air-color, var(--accent));
  background: rgba(30, 48, 76, 0.8);
  box-shadow: 0 0 0 1px var(--air-color, var(--accent)), 0 3px 10px rgba(0, 0, 0, 0.35);
}

.multi-item.emergency {
  border-left: 3.5px solid var(--bos-red, #ef4444);
}

.multi-item-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--air-color, var(--accent));
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

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

.multi-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.multi-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.multi-item-head strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi-item-body small {
  font-size: 11px;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi-item-metrics {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.75));
  margin-top: 1px;
}

.multi-item-metrics span {
  white-space: nowrap;
}

.multi-item-metrics .metric-sep {
  color: var(--text-muted, rgba(255, 255, 255, 0.35));
}

.multi-item-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.multi-item-remove svg {
  width: 14px;
  height: 14px;
}

.multi-item-remove:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.75);
}

/* Aircraft flight track polylines on map */
.aircraft-track {
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.aircraft-track.selected-track {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.45));
}

/* ==========================================================================
   Incident & POI Cards
   ========================================================================== */

.incident-card, .poi-card {
  position: absolute;
  z-index: 460;
  left: 18px;
  top: 72px;
  width: 320px;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  animation: detailSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.incident-card {
  border-left: 4px solid var(--bos-red);
}

.dispatch-card {
  border-left: 4px solid var(--police-blue);
}

.incident-card-head, .poi-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.incident-card-head > div, .poi-card-head > div {
  flex: 1;
  min-width: 0;
}

.incident-card-head button, .poi-card-head button {
  margin-left: auto;
  flex-shrink: 0;
}

.incident-badge-icon, .poi-badge-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.incident-badge-icon {
  background: rgba(244, 63, 94, 0.15);
  color: var(--bos-red);
}

.poi-badge-icon.hospital {
  background: rgba(225, 29, 72, 0.15);
  color: var(--bos-red);
}

.poi-badge-icon.dispatch {
  background: rgba(59, 130, 246, 0.15);
  color: var(--police-blue);
}

.incident-card-head h3, .poi-card-head h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 750;
}

.incident-card-head .subtitle, .poi-card-head .subtitle {
  margin: 0;
  font-size: 10.5px;
  color: var(--muted);
}

.incident-aircraft-list, .dispatch-helis {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
}

.incident-aircraft-item, .dispatch-heli-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border-radius: 4px;
  background: var(--panel);
  font-size: 10.5px;
}

/* ==========================================================================
   Map Bottom Legend
   ========================================================================== */

.map-bottom {
  position: absolute;
  left: 18px;
  bottom: 20px;
  z-index: 450;
  pointer-events: none;
}

.legend {
  border-radius: var(--radius-full);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  pointer-events: auto;
}

.legend-item {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--ink-secondary);
}

.legend-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.legend-mark.emergency { background: var(--bos-red); }
.legend-mark.civil { background: var(--civil-sky); }
.legend-mark.last-known { background: #fff; border: 1px dashed var(--muted); }
.legend-mark.parked { background: #7d8b91; opacity: 0.5; }
.legend-mark.incident { background: var(--bos-red); }
.legend-mark.dispatch { background: var(--police-blue); }
.legend-mark.hospital { background: var(--bos-red); }
.legend-mark.traffic { background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); width: 14px; border-radius: 2px; }

/* ==========================================================================
   Leaflet Customizations & Markers
   ========================================================================== */

.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-hud) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--glass-bg) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  backdrop-filter: var(--glass-blur);
}

.leaflet-right .leaflet-control { margin-right: 18px; }
.leaflet-bottom .leaflet-control-zoom { margin-bottom: 45px; }
.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.4) !important;
  color: var(--muted) !important;
  font-size: 9px !important;
  border-radius: 4px;
  margin: 4px !important;
}

.leaflet-control-attribution a { color: var(--accent) !important; }

/* Marker GPU Containment & Focus Reset */
.leaflet-marker-icon,
.air-icon {
  border: none;
  background: transparent;
  contain: layout paint;
  will-change: transform;
  border-radius: 50% !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

.leaflet-marker-icon:focus,
.leaflet-marker-icon:focus-visible,
.air-icon:focus,
.air-icon:focus-visible,
.air-icon:active,
.air-icon .marker-body:focus,
.air-icon .marker-body:focus-visible {
  outline: none !important;
  box-shadow: none;
}

/* ==========================================================================
   Luftfahrzeug-Marker: Rund & formgetreu (keine viereckigen Konturen / Boxen)
   ========================================================================== */

/* Basis-Fallback für Marker */
.air-icon .marker-body {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  contain: layout paint;
  will-change: transform;
  transition: transform 0.1s linear;
  border-radius: 50% !important;
  outline: none !important;
}

/* 1. BOS- & RETTUNGS-LUFTFAHRZEUGE: Kreis, sichtbarer Rand und Hintergrund */
.air-icon.service-emergency .marker-body {
  width: 34px !important;
  height: 34px !important;
  background: var(--paper, #0d131f) !important;
  border-radius: 50% !important;
  border: 1.8px solid var(--air-color, #ef4444) !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55), 0 0 8px rgba(239, 68, 68, 0.25) !important;
  color: var(--air-color, #ef4444) !important;
}

.air-icon.service-emergency .marker-body svg {
  width: 20px !important;
  height: 20px !important;
  transform: rotate(var(--heading, 0deg));
}

.air-icon.service-emergency.selected .marker-body {
  background: var(--air-color, #ef4444) !important;
  color: #fff !important;
  border-color: #fff !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45), 0 4px 14px rgba(0, 0, 0, 0.7) !important;
  transform: scale(1.15);
}

.air-icon.service-emergency.parked .marker-body {
  opacity: 0.5;
  filter: grayscale(1);
}

.air-icon.service-emergency.last-known .marker-body {
  border-style: dashed !important;
  opacity: 0.45;
  filter: grayscale(1);
}

/* 2. ZIVILE LUFTFAHRZEUGE: Runde Silhouette, kein viereckiger Kasten */
.air-icon.service-civil .marker-body {
  width: 34px !important;
  height: 34px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  color: var(--civil-sky, #38bdf8) !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.9));
}

.air-icon.service-civil .marker-body svg {
  width: 26px !important;
  height: 26px !important;
  transform: rotate(var(--heading, 0deg));
  transform-origin: center center;
}

.air-icon.service-civil:hover .marker-body {
  filter: drop-shadow(0 0 5px var(--civil-sky, #38bdf8)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.95));
  transform: scale(1.12);
}

.air-icon.service-civil.selected .marker-body {
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: 0 0 0 2.5px var(--accent, #38bdf8), 0 0 14px rgba(56, 189, 248, 0.6) !important;
  color: #fff !important;
  filter: drop-shadow(0 0 6px var(--accent, #38bdf8)) drop-shadow(0 0 12px rgba(56, 189, 248, 0.95)) !important;
  transform: scale(1.22);
}

.air-icon.service-civil.parked .marker-body {
  opacity: 0.45;
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  filter: grayscale(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}

.air-icon.service-civil.last-known .marker-body {
  opacity: 0.45;
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  filter: grayscale(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}

:root[data-theme="light"] .air-icon.service-civil .marker-body {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
}

:root[data-theme="light"] .air-icon.service-civil.selected .marker-body {
  color: var(--civil-sky, #0284c7) !important;
  box-shadow: 0 0 0 2.5px var(--civil-sky, #0284c7), 0 0 10px rgba(2, 132, 199, 0.4) !important;
  filter: drop-shadow(0 0 5px var(--civil-sky, #0284c7)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6)) !important;
}

.air-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-hud);
  color: var(--ink);
  border-radius: 9999px !important;
  padding: 3px 8px;
}

.leaflet-tooltip.air-label::before { display: none; }

.poi-marker, .incident-marker {
  background: transparent;
  border: none;
  border-radius: 50% !important;
  outline: none !important;
  contain: layout paint;
  will-change: transform;
}

.poi-body {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow-hud);
  display: grid;
  place-items: center;
  color: var(--ink);
  contain: layout paint;
}

.poi-body.hospital { border-color: var(--bos-red); color: var(--bos-red); }
.poi-body.airbase { border-color: var(--accent); color: var(--accent); }
.poi-body.dispatch { border-color: var(--police-blue); color: var(--police-blue); }
.poi-body svg { width: 14px; height: 14px; }

/* Dialog Modals */
.modal-backdrop {
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  position: relative;
  max-width: 520px;
  width: 100%;
  max-height: 85dvh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: 24px;
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute !important;
  top: 18px !important;
  right: 18px !important;
  z-index: 20 !important;
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 6px !important;
  border-radius: var(--radius-sm) !important;
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  color: var(--muted) !important;
  display: grid !important;
  place-items: center !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.modal-close:hover {
  color: var(--ink) !important;
  background: var(--panel-elevated) !important;
  border-color: var(--line-strong) !important;
}

.modal-close svg {
  width: 16px !important;
  height: 16px !important;
}

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2100;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  max-width: 90vw;
  text-align: center;
}

/* Sidebar Backdrop for Mobile Drawer */
.sidebar-backdrop {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 490;
  animation: backdropFadeIn 0.2s ease;
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================= */

@media (max-width: 1024px) {
  .brand-radar-pill { display: none; }
  .header { padding: 0 12px; gap: 10px; }
}

@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 52px minmax(0, 1fr);
  }
  
  .shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  
  /* Keep hamburger button visible at top-left on mobile */
  .sidebar-collapse-btn { 
    display: grid !important; 
  }
  
  .sidebar-toggle { 
    display: none !important; 
  }
  
  .sidebar-close-btn {
    display: grid;
  }
  
  /* Mobile off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: min(340px, 85vw) !important;
    min-width: 0 !important;
    max-width: 85vw !important;
    transform: translateX(-105%) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 500;
  }
  
  .sidebar.open {
    transform: translateX(0) !important;
  }
  
  /* Override desktop collapsed styles on mobile */
  .shell.sidebar-collapsed .sidebar {
    min-width: 0 !important;
    max-width: 85vw !important;
    width: min(340px, 85vw) !important;
    transform: translateX(-105%) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    border-right: 1px solid var(--line) !important;
  }
  
  .shell.sidebar-collapsed .sidebar.open {
    transform: translateX(0) !important;
  }
  
  /* Compact header on mobile */
  .brand-radar-pill { display: none; }
  .brand-logo { width: 28px; height: 28px; }
  .brand-logo svg { width: 16px; height: 16px; }
  .brand-text strong { font-size: 14px; }
  
  .header {
    padding: 0 10px;
    gap: 8px;
  }
  
  .view-tabs {
    padding: 2px;
    gap: 2px;
  }
  
  .view-tabs button {
    padding: 4px 7px;
    font-size: 10px;
    gap: 3px;
  }
  
  .header-right {
    gap: 6px;
  }
  
  .header-link, .connection { 
    display: none !important; 
  }
  
  .map-head {
    left: 10px;
    right: 10px;
    top: 10px;
  }
  
  .detail {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 30px;
    width: auto;
    max-height: 60%;
  }
}

@media (max-width: 480px) {
  .brand-text strong { display: none; }
  .header-right .button-text { display: none; }
  .chip.alert-center-chip { padding: 4px 6px; }
}

/* Aircraft Photo Gallery & Carousel */
.detail-photo-container {
  width: 100%;
  margin: 8px 0 10px;
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background: rgba(10, 15, 24, 0.6);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
}

.photo-viewport {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #080d14;
}

.photo-slides {
  width: 100%;
  height: 100%;
  position: relative;
}

.photo-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.photo-nav-btn svg {
  width: 16px;
  height: 16px;
}

.photo-nav-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%) scale(1.08);
}

.photo-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.photo-nav-btn.photo-prev {
  left: 8px;
}

.photo-nav-btn.photo-next {
  right: 8px;
}

.photo-counter {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #f1f5f9;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.photo-attribution {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 5px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 50%, rgba(0, 0, 0, 0.95));
  color: rgba(241, 245, 249, 0.85);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  z-index: 10;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-attribution a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
}

.photo-attribution a:hover {
  text-decoration: underline;
}

.photo-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 6px 0 4px;
  background: rgba(10, 15, 24, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.photo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-dot.active {
  background: var(--brand, #38bdf8);
  width: 14px;
  border-radius: 3px;
}

/* ==========================================================================
   AeroChronik Enhancements: Base Tiles, Emergency Banner, Elevation & Tools
   ========================================================================== */

/* Satellite & Light Tile overrides (no invert filter) */
.map-satellite-active .leaflet-tile-pane,
.map-light-active .leaflet-tile-pane {
  filter: none !important;
}

.aircraft-canvas-layer {
  display: block;
  pointer-events: none;
  contain: strict;
}
.map-satellite-active .leaflet-tile {
  background: #050b14 !important;
}

/* Emergency Banner (Squawk 7700 / 7600 / 7500) */
.emergency-banner {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(225, 29, 72, 0.25);
  border: 1px solid rgba(244, 63, 94, 0.65);
  box-shadow: 0 8px 32px rgba(225, 29, 72, 0.35);
  border-radius: var(--radius-md, 12px);
  backdrop-filter: blur(16px);
  animation: emergencyPulse 2s infinite ease-in-out;
  max-width: 92vw;
}

@keyframes emergencyPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(225, 29, 72, 0.3); border-color: rgba(244, 63, 94, 0.5); }
  50% { box-shadow: 0 8px 36px rgba(225, 29, 72, 0.7); border-color: rgba(244, 63, 94, 1); }
}

.emergency-pulse-beacon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 12px #f43f5e;
  animation: beaconFlash 0.9s infinite alternate;
  flex-shrink: 0;
}

@keyframes beaconFlash {
  0% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1.25); }
}

.emergency-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.emergency-badge {
  background: #f43f5e;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.emergency-code {
  background: rgba(0, 0, 0, 0.45);
  color: #fecdd3;
  font-family: monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.emergency-desc {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.emergency-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

/* Detail Altitude Chart */
.detail-altitude-chart {
  margin: 10px 0;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 8px);
}

.alt-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 10px;
}

.alt-chart-title {
  font-weight: 600;
  color: var(--brand, #38bdf8);
}

.alt-chart-stats {
  color: var(--muted);
}

.alt-chart-svg {
  width: 100%;
  height: 70px;
  display: block;
}

/* GPX & KML Export Buttons */
.detail-action-btn.export-btn {
  min-width: 62px;
  background: rgba(30, 41, 59, 0.8);
  color: var(--ink);
}

.detail-action-btn.export-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.2);
  color: var(--brand, #38bdf8);
  border-color: rgba(56, 189, 248, 0.4);
}

/* Shortcuts Dialog */
.shortcuts-modal {
  max-width: 440px;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  margin-top: 16px;
  align-items: center;
}

.shortcut-row {
  display: contents;
  font-size: 13px;
}

.shortcut-row kbd {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: var(--ink);
  text-align: center;
  min-width: 24px;
}

/* Incident rows in Incident Card */
.incident-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.incident-row:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
}

.incident-row strong {
  font-size: 13px;
  color: var(--ink);
}

.incident-row small {
  font-size: 11px;
  color: var(--muted);
}
