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

/* ── Theme variables ── */
:root {
  --bg: #0d1117; --bg2: #161b22; --bg3: #21262d;
  --border: rgba(255,255,255,0.08); --border2: rgba(255,255,255,0.14);
  --text: #e6edf3; --text2: #8b949e; --text3: #484f58;
  --blue: #378ADD; --blue-dim: rgba(55,138,221,0.15);
  --green: #3fb950; --red: #f85149;
  --amber: #d29922; --amber-dim: rgba(210,153,34,0.12);
  --bgfc: #C85A0A; --bgfc-dim: rgba(200,90,10,0.18);
  --nsa: #7B3FBE;  --nsa-dim: rgba(123,63,190,0.18);
  --pfc: #2176CC;  --pfc-dim: rgba(33,118,204,0.18);
  --nsc: #C49A00;  --nsc-dim: rgba(196,154,0,0.18);
  --radius: 8px; --radius-lg: 12px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;
  --sidebar-w: 240px;
  --map-tile-filter: brightness(0.7) saturate(0.5);
}

/* ── Light mode overrides ── */
[data-theme="light"] {
  --bg: #f5f6f8; --bg2: #ffffff; --bg3: #eaecf0;
  --border: rgba(0,0,0,0.08); --border2: rgba(0,0,0,0.14);
  --text: #1a1d23; --text2: #5a6070; --text3: #9ba3af;
  --blue-dim: rgba(55,138,221,0.12);
  --bgfc-dim: rgba(200,90,10,0.12);
  --nsa-dim: rgba(123,63,190,0.12);
  --pfc-dim: rgba(33,118,204,0.12);
  --nsc-dim: rgba(196,154,0,0.12);
  --map-tile-filter: brightness(1) saturate(0.85);
}

html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; transition: background 0.2s, color 0.2s; }
.screen { height: 100vh; }

/* ── Login ── */
.login-wrap { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 360px; padding: 2.5rem; background: var(--bg2); border: 0.5px solid var(--border2); border-radius: var(--radius-lg); overflow: hidden; }
.login-wrap::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(to right, #7c3aed, #1a1d23, #3b7dd8); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 1.75rem; text-align: center; }
.login-logo { height: 74px; width: auto; object-fit: contain; }
.brand-text-lockup { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.brand-kicker { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); }
.brand-name { font-size: 28px; line-height: 1; font-weight: 600; letter-spacing: -0.03em; color: var(--text); }
.login-title { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-sub { color: var(--text2); font-size: 13px; margin-bottom: 1.5rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.field input, .field select, select { width: 100%; padding: 8px 12px; height: 36px; background: var(--bg3); border: 0.5px solid var(--border2); border-radius: var(--radius); color: var(--text); font-family: var(--font); font-size: 14px; outline: none; transition: border-color 0.15s; }
.field input:focus, .field select:focus { border-color: var(--blue); }
.field input::placeholder, input::placeholder { color: var(--text3); }
.field-help { margin-top: 6px; font-size: 11px; line-height: 1.45; color: var(--text3); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }

.btn-primary { width: 100%; padding: 9px 16px; height: 38px; background: var(--blue); border: none; border-radius: var(--radius); color: #fff; font-family: var(--font); font-size: 14px; font-weight: 500; cursor: pointer; transition: opacity 0.15s; }
.btn-primary:hover { opacity: 0.88; }
.btn-primary.small { width: auto; padding: 6px 14px; height: 32px; font-size: 13px; }
.btn-primary:disabled, .btn-ghost:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-ghost { padding: 6px 14px; height: 32px; background: transparent; border: 0.5px solid var(--border2); border-radius: var(--radius); color: var(--text2); font-family: var(--font); font-size: 13px; cursor: pointer; transition: background 0.15s; }
.btn-ghost:hover { background: var(--bg3); }
.btn-link { padding: 0; margin: 0 0 12px; background: transparent; border: none; color: var(--blue); font-family: var(--font); font-size: 12px; font-weight: 500; cursor: pointer; text-align: left; }
.btn-link:hover { opacity: 0.82; }
.error-msg { font-size: 12px; color: var(--red); padding: 8px 10px; background: rgba(248,81,73,0.1); border-radius: var(--radius); margin-bottom: 12px; }
.info-msg { font-size: 12px; color: var(--blue); padding: 8px 10px; background: rgba(55,138,221,0.12); border-radius: var(--radius); margin-bottom: 12px; }
.inline-panel { margin-top: 16px; padding-top: 16px; border-top: 0.5px solid var(--border); }
.inline-panel-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.inline-panel-text { font-size: 12px; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }
.inline-panel-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── App layout ── */
#app-screen { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
aside#sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--bg2); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }

.sidebar-top { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }

/* Logo + brand — centered, large */
.sidebar-brand { display: flex; align-items: center; gap: 16px; padding: 0.25rem 1rem 0.2rem; border-bottom: 0.5px solid var(--border); flex-shrink: 0; }
.sidebar-logo-img { height: 62px; width: 62px; object-fit: contain; display: block; flex-shrink: 0; }
.sidebar-brand-name { font-size: 20px; line-height: 1; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }

/* Search in sidebar */
.sidebar-search-wrap { padding: 2px 10px 1px; flex-shrink: 0; }
.search-wrap-sidebar { position: relative; }
.search-wrap-sidebar svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text3); }
.search-wrap-sidebar input { width: 100%; height: 30px; padding: 0 10px 0 30px; background: var(--bg3); border: 0.5px solid var(--border2); border-radius: var(--radius); color: var(--text); font-family: var(--font); font-size: 12px; outline: none; }
.search-wrap-sidebar input:focus { border-color: var(--blue); }
.search-result { position: absolute; top: 34px; left: 0; right: 0; z-index: 2000; background: var(--bg2); border: 0.5px solid var(--border2); border-radius: var(--radius); max-height: 180px; overflow-y: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.search-item { padding: 8px 12px; cursor: pointer; font-size: 12px; display: flex; justify-content: space-between; align-items: center; border-bottom: 0.5px solid var(--border); }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg3); }
.search-item-tail { font-family: var(--mono); font-weight: 500; }

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; flex-shrink: 0; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius); color: var(--text2); text-decoration: none; font-size: 13px; transition: background 0.15s, color 0.15s; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--blue-dim); color: var(--blue); }

/* Airborne list */
.sidebar-airborne { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; border-top: 0.5px solid var(--border); margin-top: 4px; }
.sidebar-airborne-label { display: flex; align-items: center; gap: 6px; padding: 8px 12px 4px; font-size: 10px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.airborne-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.airborne-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; transition: background 0.12s; margin-bottom: 2px; }
.airborne-item:hover { background: var(--bg3); }
.airborne-item-shell { width: 100%; min-width: 0; }
.airborne-item-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.airborne-item-main-inline { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.airborne-item-top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.airborne-item-title-group { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.airborne-item-tail { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--text); }
.airborne-item-crew { font-size: 10px; color: var(--text2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aircraft-card-context { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.airborne-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.airborne-item-base { font-size: 10px; font-weight: 500; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; margin-left: auto; }
.airborne-item-alt { font-size: 10px; color: var(--text3); font-family: var(--mono); }
.sidebar-status-badge { flex-shrink: 0; padding: 1px 7px; font-size: 10px; }
.airborne-empty { font-size: 12px; color: var(--text3); padding: 12px 8px; text-align: center; }

/* Sidebar bottom */
.sidebar-bottom { padding: 10px 1rem; border-top: 0.5px solid var(--border); flex-shrink: 0; }
.sidebar-user { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 8px; padding: 8px; background: transparent; border: 0.5px solid transparent; border-radius: var(--radius); color: inherit; text-align: left; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.sidebar-user:hover { background: var(--bg3); border-color: var(--border); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-dim); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; flex-shrink: 0; }
.user-info { min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text2); text-transform: capitalize; }
.btn-signout { width: 100%; padding: 6px; background: transparent; border: 0.5px solid var(--border); border-radius: var(--radius); color: var(--text2); font-family: var(--font); font-size: 12px; cursor: pointer; }
.btn-signout:hover { background: var(--bg3); color: var(--text); }

/* ── Main content ── */
#main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.view { display: none; flex-direction: column; height: 100%; overflow: hidden; }
.view.active { display: flex; }

.view-header { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 1.25rem; border-bottom: 0.5px solid var(--border); flex-shrink: 0; gap: 12px; }
.view-header-left { display: flex; align-items: baseline; gap: 10px; }
.view-header-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.view-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.last-updated { font-size: 11px; color: var(--text3); white-space: nowrap; }
.header-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-alerts { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0; }
.weather-alert-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  max-width: min(280px, 100%);
  padding: 5px 12px;
  border-radius: 999px;
  border: 0.5px solid transparent;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1;
  --weather-alert-glow: rgba(255,255,255,0.1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.weather-alert-chip.button {
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
}
.weather-alert-chip.warning {
  background: rgba(248,81,73,0.16);
  color: #ffb0ab;
  border-color: rgba(248,81,73,0.42);
  --weather-alert-glow: rgba(248,81,73,0.18);
}
.weather-alert-chip.watch {
  background: rgba(210,153,34,0.2);
  color: #ffd579;
  border-color: rgba(210,153,34,0.46);
  --weather-alert-glow: rgba(210,153,34,0.18);
}
.weather-alert-chip.more {
  background: var(--bg3);
  color: var(--text2);
  border-color: var(--border2);
}
.weather-alert-chip-static {
  max-width: none;
  padding-inline: 13px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  flex-shrink: 0;
}
.weather-alert-chip.needs-attention {
  animation: weather-alert-attention 2.15s ease-in-out infinite;
}
@keyframes weather-alert-attention {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 1px var(--weather-alert-glow), 0 0 0 0 rgba(255,255,255,0);
  }
  40% {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 0 0 1px var(--weather-alert-glow), 0 0 0 12px var(--weather-alert-glow), 0 0 22px var(--weather-alert-glow);
  }
  72% {
    transform: translateY(0) scale(1.015);
    box-shadow: 0 0 0 1px var(--weather-alert-glow), 0 0 0 6px var(--weather-alert-glow), 0 0 14px var(--weather-alert-glow);
  }
}

[data-theme="light"] .weather-alert-chip.warning {
  background: rgba(220,38,38,0.14);
  color: #b42318;
  border-color: rgba(185,28,28,0.34);
  --weather-alert-glow: rgba(185,28,28,0.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.36);
}

[data-theme="light"] .weather-alert-chip.watch {
  background: rgba(202,138,4,0.18);
  color: #8a5a00;
  border-color: rgba(161,98,7,0.34);
  --weather-alert-glow: rgba(161,98,7,0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.38);
}

[data-theme="light"] .weather-alert-chip.more {
  background: #edf1f5;
  color: #475467;
  border-color: rgba(71,84,103,0.16);
  --weather-alert-glow: rgba(71,84,103,0.12);
}

/* Pill filter buttons */
.pill-group { display: flex; align-items: center; gap: 5px; }
.pill-btn { padding: 3px 10px; height: 26px; background: var(--bg3); border: 0.5px solid var(--border2); border-radius: 99px; color: var(--text2); font-family: var(--font); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.pill-btn:hover { background: var(--bg2); color: var(--text); }
.pill-btn.active { background: var(--blue-dim); color: var(--blue); border-color: var(--blue); }
.pill-btn[data-base="BGFC"].active { background: var(--bgfc-dim); color: var(--bgfc); border-color: var(--bgfc); }
.pill-btn[data-base="NSA"].active  { background: var(--nsa-dim);  color: var(--nsa);  border-color: var(--nsa); }
.pill-btn[data-base="PFC"].active  { background: var(--pfc-dim);  color: var(--pfc);  border-color: var(--pfc); }
.pill-btn[data-base="NSC"].active  { background: var(--nsc-dim);  color: var(--nsc);  border-color: var(--nsc); }

/* Status pill */
.status-pill { display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--bg3); border-radius: 99px; font-size: 12px; color: var(--text2); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); }
.status-pill.live .status-dot { background: var(--green); animation: pulse 2s infinite; }
.status-pill.error .status-dot { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.status-pill { position: relative; cursor: default; user-select: none; }
.status-tooltip { display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px; background: var(--bg2); border: 0.5px solid var(--border2); border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.18); z-index: 9999; }
.status-pill:hover .status-tooltip,
.status-pill:focus .status-tooltip { display: block; }
.status-tooltip-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); margin-bottom: 8px; }
.status-tooltip-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; color: var(--text2); }
.status-tooltip-row .tt-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-tooltip-row .tt-dot.ok { background: var(--green); }
.status-tooltip-row .tt-dot.err { background: var(--red); }
.status-tooltip-row .tt-label { flex: 1; }
.status-tooltip-row .tt-detail { font-size: 11px; color: var(--text3); }

/* TV button */
.btn-tv { padding: 4px 10px; height: 26px; background: transparent; border: 0.5px solid var(--border2); border-radius: var(--radius); color: var(--text2); font-size: 12px; cursor: pointer; font-family: var(--font); white-space: nowrap; }
.btn-tv:hover { background: var(--bg3); color: var(--text); }

/* ── Theme toggle switch ── */
.theme-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.theme-toggle input { display: none; }
.theme-track { width: 36px; height: 20px; background: var(--bg3); border: 0.5px solid var(--border2); border-radius: 99px; position: relative; transition: background 0.2s; display: block; }
.theme-toggle input:checked ~ .theme-track { background: var(--blue); border-color: var(--blue); }
.theme-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text2); transition: transform 0.2s, background 0.2s; }
.theme-toggle input:checked ~ .theme-track .theme-thumb { transform: translateX(16px); background: #fff; }
.theme-label { display: flex; align-items: center; color: var(--text2); }
.icon-moon, .icon-sun { display: block; }

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
  background: var(--border);
}
.stats-row.single-base {
  grid-template-columns: repeat(3, 1fr);
}
.stat-card { padding: 10px 1.25rem; background: var(--bg); }
.stat-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.stat-val { font-size: 22px; font-weight: 500; font-family: var(--mono); letter-spacing: -0.02em; }
#stat-card-bgfc .stat-label, #stat-card-bgfc .stat-val { color: var(--bgfc); }
#stat-card-nsa  .stat-label, #stat-card-nsa  .stat-val { color: var(--nsa); }
#stat-card-pfc  .stat-label, #stat-card-pfc  .stat-val { color: var(--pfc); }
#stat-card-nsc  .stat-label, #stat-card-nsc  .stat-val { color: var(--nsc); }

.demo-banner { background: var(--amber-dim); border-bottom: 0.5px solid rgba(210,153,34,0.2); padding: 8px 1.25rem; font-size: 12px; color: var(--amber); flex-shrink: 0; }
.demo-banner code { font-family: var(--mono); background: rgba(210,153,34,0.15); padding: 1px 5px; border-radius: 4px; }

/* ── Map ── */
#map { flex: 1; min-height: 0; }
.leaflet-container { background: var(--bg) !important; }
#map .leaflet-control-attribution {
  font-size: 9px !important;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: max-width 0.3s ease;
  direction: rtl;
  text-align: left;
}

#map .leaflet-control-attribution:hover {
  max-width: 600px;
}

#map .leaflet-control-attribution a {
  direction: ltr;
  unicode-bidi: embed;
}
.fleet-basemap-pane { filter: var(--map-tile-filter); transition: filter 0.2s ease; }
#map[data-basemap="satellite"] .fleet-basemap-pane { filter: brightness(0.9) saturate(0.92) contrast(1.02); }
.ac-marker { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1.5px solid rgba(255,255,255,0.2); cursor: pointer; }
.ac-marker.ground { background: rgba(139,148,158,0.15) !important; border-color: var(--text3) !important; }
.ac-label { background: rgba(13,17,23,0.82); border: 0.5px solid rgba(255,255,255,0.1); border-radius: 3px; padding: 1px 5px; font-family: var(--mono); font-size: 10px; font-weight: 500; white-space: nowrap; pointer-events: none; }
[data-theme="light"] .ac-label { background: rgba(255,255,255,0.88); border-color: rgba(0,0,0,0.15); }
.leaflet-popup-content-wrapper { background: var(--bg2) !important; border: 0.5px solid var(--border2) !important; border-radius: var(--radius) !important; color: var(--text) !important; box-shadow: 0 4px 16px rgba(0,0,0,0.25) !important; }
.leaflet-popup-tip { background: var(--bg2) !important; }
.leaflet-popup-content { margin: 10px 14px !important; padding-right: 18px; font-family: var(--font) !important; font-size: 13px !important; line-height: 1.7; }
/* ── Popup v2 ── */
.popup-v2 {
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.popup-v2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.popup-v2-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-v2-tail {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.popup-v2-base-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.popup-v2-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.popup-status-airborne {
  background: rgba(63,185,80,0.15);
  color: var(--green);
}

.popup-status-ground {
  background: rgba(139,148,158,0.15);
  color: var(--text2);
}

.popup-stats-row {
  display: flex;
  gap: 4px;
}

.popup-stat {
  flex: 1;
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.popup-stat-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}

.popup-stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.popup-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.popup-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  margin-bottom: 2px;
}

.popup-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.popup-detail-label {
  font-size: 12px;
  color: var(--text2);
  flex-shrink: 0;
}

.popup-detail-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.popup-airport-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.popup-airport-icon {
  font-size: 12px;
}

.popup-last-seen {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

.popup-v2-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.popup-v2-actions .btn-fa,
.popup-v2-actions .btn-popup-secondary,
.popup-v2-actions .btn-map {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
  max-width: 100%;
  justify-content: center;
  font-size: 11px;
  padding: 6px 8px;
  height: 30px;
}
.crew-empty { font-size: 12px; color: var(--text3); }
.advisory-popup { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.advisory-row { display: flex; justify-content: space-between; gap: 14px; color: var(--text2); }
.advisory-row strong { color: var(--text); font-weight: 500; text-align: right; }
.advisory-summary, .advisory-raw { margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.advisory-summary span, .advisory-raw span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); margin-bottom: 4px; }
.advisory-summary p, .advisory-raw p { color: var(--text); line-height: 1.45; }
.tfr-alt-label {
  background: rgba(0, 0, 0, 0.65);
  border: none;
  border-radius: 3px;
  box-shadow: none;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  pointer-events: none;
  white-space: nowrap;
}
.tfr-alt-label::before {
  display: none;
}
.metar-popup { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.metar-popup-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.metar-popup-heading { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.metar-popup-header strong { font-size: 14px; color: var(--text); line-height: 1.2; }
.metar-popup-subtitle { font-size: 12px; color: var(--text2); line-height: 1.35; }
.metar-popup-badge { display: inline-flex; align-items: center; justify-content: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; }
.metar-popup-row { display: flex; justify-content: space-between; gap: 14px; color: var(--text2); }
.metar-popup-row strong { color: var(--text); font-weight: 500; text-align: right; }
.metar-popup-section { margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.metar-popup-section span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); margin-bottom: 4px; }
.metar-popup-section p { color: var(--text); line-height: 1.45; }
.metar-leaflet-popup .leaflet-popup-close-button { color: var(--text2); font-size: 18px; font-weight: 400; padding: 6px 8px 0 0; }
.metar-leaflet-popup .leaflet-popup-close-button:hover { color: var(--text); }
.metar-leaflet-popup .leaflet-popup-content,
.leaflet-popup:has(.advisory-popup) .leaflet-popup-content { padding-right: 24px; }
.metar-leaflet-popup .leaflet-popup-close-button,
.leaflet-popup:has(.advisory-popup) .leaflet-popup-close-button { top: 6px; right: 8px; }

/* ── Table ── */
.table-wrap { flex: 1; overflow: auto; }
.aircraft-table { width: 100%; border-collapse: collapse; }
.aircraft-table th { position: sticky; top: 0; background: var(--bg2); padding: 10px 1.25rem; text-align: left; font-size: 11px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 0.5px solid var(--border); white-space: nowrap; }
.aircraft-table td { padding: 10px 1.25rem; border-bottom: 0.5px solid var(--border); font-size: 13px; white-space: nowrap; vertical-align: middle; }
.aircraft-table tr:hover td { background: var(--bg3); }
.aircraft-table td:first-child { font-family: var(--mono); font-weight: 500; }
.table-subtle { font-size: 11px; color: var(--text3); margin-top: 3px; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.badge.airborne { background: var(--blue-dim); color: var(--blue); }
.badge.ground { background: var(--bg3); color: var(--text2); }
.badge.solo { background: rgba(223, 168, 53, 0.18); color: #e3b341; }
.table-status-badge { margin-left: 6px; }
.aircraft-table td:last-child { width: 238px; text-align: right; }
.table-actions { display: inline-grid; grid-template-columns: repeat(2, minmax(106px, 106px)); gap: 6px; align-items: center; justify-content: end; white-space: nowrap; }
.table-action-slot { display: flex; justify-content: flex-end; align-items: center; min-width: 106px; }
.table-action-slot > .btn-map,
.table-action-slot > .btn-fa { width: 106px; justify-content: center; }
.btn-map:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* ── Forms ── */
.card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-lg); }
.form-card { margin: 1.25rem; padding: 1.25rem; }
.form-title { font-size: 14px; font-weight: 500; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.settings-form .field:last-child { margin-bottom: 0; }
.btn-danger { padding: 4px 10px; height: 28px; background: transparent; border: 0.5px solid rgba(248,81,73,0.3); border-radius: var(--radius); color: var(--red); font-size: 12px; cursor: pointer; }
.btn-danger:hover { background: rgba(248,81,73,0.1); }
.btn-edit { padding: 4px 10px; height: 28px; background: transparent; border: 0.5px solid var(--border2); border-radius: var(--radius); color: var(--text2); font-size: 12px; cursor: pointer; }
.btn-edit:hover { background: var(--bg3); color: var(--text); }
.aircraft-form-grid { margin-bottom: 0.25rem; }
.aircraft-table .callsign-cell { font-family: var(--mono); color: var(--text2); }
.aircraft-mgmt-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }

.modal-overlay { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(7,10,15,0.58); backdrop-filter: blur(6px); }
.modal-card { width: min(640px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--bg2); border: 0.5px solid var(--border2); border-radius: var(--radius-lg); padding: 20px; box-shadow: 0 16px 48px rgba(0,0,0,0.35); }
.modal-card-compact { width: min(520px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.modal-subtitle { font-size: 13px; color: var(--text2); }
.modal-close { width: 34px; height: 34px; background: transparent; border: 0.5px solid var(--border2); border-radius: 999px; color: var(--text2); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-close:hover { background: var(--bg3); color: var(--text); }
.settings-modal-card {
  overflow-y: auto;
  overflow-x: hidden;
}
.settings-modal-header {
  position: static;
  margin-bottom: 16px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  border-bottom: none;
}
.settings-modal-header-main {
  min-width: 0;
  flex: 1 1 auto;
}
.aircraft-tail-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.aircraft-tail-primary { font-family: var(--mono); font-weight: 500; color: var(--text); line-height: 1.2; }
.flight-plan-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 0.5px solid rgba(88, 166, 255, 0.28);
  border-radius: 999px;
  background: rgba(56, 139, 253, 0.12);
  color: #9ecbff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.flight-plan-tag:hover {
  background: rgba(56, 139, 253, 0.18);
  border-color: rgba(88, 166, 255, 0.42);
  color: #c2e0ff;
}
.flight-plan-tag:focus-visible {
  outline: 2px solid rgba(88, 166, 255, 0.48);
  outline-offset: 2px;
}
.flight-plan-modal-card {
  width: min(430px, 100%);
  padding: 0;
  background: var(--bg2);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  overflow: hidden;
}
.flight-plan-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 10px;
}
.flight-plan-popup-header-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.flight-plan-popup-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.flight-plan-popup-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.flight-plan-popup-subtitle {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
}
.flight-plan-popup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(63,185,80,0.16);
  color: #86efac;
  border: 0.5px solid rgba(134,239,172,0.35);
}
.flight-plan-popup-badge.proposed {
  background: rgba(56,139,253,0.14);
  color: #9ecbff;
  border-color: rgba(88,166,255,0.32);
}
.flight-plan-popup-badge.inactive {
  background: var(--bg3);
  color: var(--text2);
  border-color: var(--border2);
}
.flight-plan-popup-close {
  color: var(--text2);
  font-size: 18px;
  font-weight: 400;
  width: 28px;
  height: 28px;
  line-height: 1;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.flight-plan-popup-close:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.flight-plan-popup-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 16px 10px;
}
.flight-plan-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--text2);
}
.flight-plan-popup-row strong {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}
.flight-plan-popup-section {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.flight-plan-popup-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.flight-plan-popup-section-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 6px;
}
.flight-plan-popup-section-note {
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}
.flight-plan-popup-footer {
  padding: 8px 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: var(--text3);
}
.settings-section { padding-top: 18px; margin-top: 18px; border-top: 0.5px solid var(--border); }
.settings-section:first-of-type { padding-top: 0; margin-top: 0; border-top: none; }
.settings-section-head { margin-bottom: 12px; }
.settings-section-head h3 { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.settings-section-head p { font-size: 12px; color: var(--text2); line-height: 1.5; }
.settings-inline-status {
  margin-top: -4px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #7dd3fc;
}
.settings-inline-status.error {
  color: var(--red);
}
.settings-sound-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.weather-alerts-modal-card {
  width: min(980px, 100%);
  height: min(760px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  padding: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.weather-alerts-modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -20px -20px 16px;
  padding: 14px 20px 12px;
  background: color-mix(in srgb, var(--bg2) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.weather-alerts-modal-header-main {
  min-width: 0;
  flex: 1 1 260px;
}
.weather-alerts-modal-header-right {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}
.weather-alerts-modal-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-top: 2px;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.45;
  text-align: right;
}
.weather-alerts-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.weather-alerts-list {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  padding-right: 8px;
}
.weather-alert-list-item {
  flex: 0 0 auto;
  width: 100%;
  padding: 12px 13px;
  background: var(--bg3);
  border: 0.5px solid var(--border2);
  border-radius: 12px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.weather-alert-list-item:hover,
.weather-alert-list-item.active {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
}
.weather-alert-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.weather-alert-list-event {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.weather-alert-list-title {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text2);
  margin-bottom: 6px;
}
.weather-alert-list-meta {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.45;
}
.weather-alerts-detail {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 14px 14px 6px 2px;
  overflow-y: auto;
  position: relative;
}
.weather-alert-detail-empty {
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 0.5px dashed var(--border2);
  border-radius: 14px;
  color: var(--text3);
  text-align: center;
}
.weather-alert-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}
.weather-alert-detail-head > :first-child {
  min-width: 0;
  flex: 1 1 280px;
}
.weather-alert-detail-event {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  margin-bottom: 5px;
}
.weather-alert-detail-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}
.weather-alert-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.weather-alert-detail-card {
  padding: 10px 12px;
  background: var(--bg3);
  border: 0.5px solid var(--border);
  border-radius: 10px;
}
.weather-alert-detail-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  margin-bottom: 5px;
}
.weather-alert-detail-card-value {
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
}
.weather-alert-map {
  height: 250px;
  border-radius: 14px;
  overflow: hidden;
  border: 0.5px solid var(--border2);
  background: var(--bg);
  margin-bottom: 14px;
}
.weather-alert-detail-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.weather-alert-detail-section span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 5px;
}
.weather-alert-detail-section p {
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}
[data-theme="light"] .weather-alerts-modal-header {
  background: color-mix(in srgb, var(--bg2) 96%, transparent);
  border-bottom-color: rgba(0,0,0,0.08);
}
.weather-alert-map .leaflet-control-attribution {
  font-size: 9px;
}

@media (max-width: 640px) {
  .flight-plan-modal-card { width: 100%; }
  .flight-plan-popup-row { flex-direction: column; gap: 2px; }
  .flight-plan-popup-row strong { text-align: left; }
  .weather-alerts-layout { grid-template-columns: 1fr; }
  .weather-alerts-list { max-height: 220px; height: auto; }
  .weather-alerts-modal-header-right { width: 100%; justify-content: space-between; }
  .weather-alerts-modal-meta { align-items: flex-start; text-align: left; }
  .weather-alert-detail-grid { grid-template-columns: 1fr; }
  .settings-sound-actions { flex-direction: column; }
  .header-alerts { justify-content: flex-start; }
}

/* Aircraft lookup */
.ac-lookup-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.ac-lookup-result { background: var(--bg3); border: 0.5px solid var(--border2); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; margin-bottom: 4px; }
.ac-lookup-result .ac-found-title { font-weight: 500; margin-bottom: 8px; color: var(--green); }
.ac-lookup-result .ac-found-row { display: flex; gap: 24px; flex-wrap: wrap; color: var(--text2); }
.ac-lookup-result .ac-found-row span strong { color: var(--text); font-weight: 500; }
.ac-not-found { color: var(--red); font-size: 13px; padding: 8px 0; }

/* Filter select */
.filter-select { width: auto; height: 30px; padding: 0 10px; font-size: 12px; background: var(--bg2); border: 0.5px solid var(--border2); border-radius: var(--radius); color: var(--text); }

/* ── TV mode ── */
.tv-bar { display: none; }

body.tv-mode aside#sidebar {
  width: 220px;
  flex-shrink: 0;
}
body.tv-mode .sidebar-search-wrap { display: none; }
body.tv-mode .sidebar-nav { display: none; }
body.tv-mode #sidebar-user-block { display: none; }
body.tv-mode .btn-signout { display: none; }
body.tv-mode .sidebar-brand { padding: 1rem; }
body.tv-mode #main-content { flex: 1; }
body.tv-mode #view-map { height: 100vh; }
body.tv-mode .stats-row .stat-val { font-size: 26px; }
body.tv-mode #map { height: calc(100vh - 154px); }
body.tv-mode .tv-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; height: 44px; background: var(--bg2); border-top: 0.5px solid var(--border); flex-shrink: 0; }
body.tv-mode .tv-clock { font-family: var(--mono); font-size: 20px; color: var(--text); font-weight: 500; }

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

/* ── Ground/Airborne toggle ── */
.sidebar-toggle { display: flex; gap: 0; margin: 6px 10px 0; border: 0.5px solid var(--border2); border-radius: var(--radius); overflow: hidden; flex-shrink: 0; }
.toggle-btn { flex: 1; padding: 5px 8px; background: transparent; border: none; color: var(--text2); font-family: var(--font); font-size: 11px; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s; }
.toggle-btn.active { background: var(--blue-dim); color: var(--blue); }
.toggle-btn:first-child { border-right: 0.5px solid var(--border2); }

/* Ground list items */
.ground-item { display: flex; flex-direction: column; padding: 7px 8px; border-radius: var(--radius); cursor: pointer; transition: background 0.12s; margin-bottom: 2px; }
.ground-item:hover { background: var(--bg3); }
.ground-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.ground-item-tail { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--text); }
.ground-item-time { font-size: 10px; color: var(--text3); font-family: var(--mono); }
.ground-item-airport { font-size: 10px; color: var(--text2); margin-top: 1px; }
.ground-item-base { font-size: 10px; font-weight: 500; padding: 1px 5px; border-radius: 3px; }

/* Weather radar toggle */
.radar-toggle { display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--bg3); border: 0.5px solid var(--border2); border-radius: var(--radius); color: var(--text2); font-size: 12px; cursor: pointer; font-family: var(--font); white-space: nowrap; transition: all 0.15s; }
.radar-toggle.active { background: rgba(63,185,80,0.15); color: #3fb950; border-color: #3fb950; }
.radar-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.metar-toggle.active { background: rgba(34,197,94,0.12); color: #86efac; border-color: rgba(134,239,172,0.65); }
.advisory-toggle.sigmet.active { background: rgba(249,115,22,0.14); color: #f97316; border-color: rgba(249,115,22,0.7); }
.advisory-toggle.gairmet.active { background: rgba(56,189,248,0.12); color: #38bdf8; border-color: rgba(56,189,248,0.65); }
.advisory-toggle.tfr.active { background: rgba(244,63,94,0.14); color: #fb7185; border-color: rgba(251,113,133,0.68); }

.list-section-header { display: flex; align-items: center; gap: 10px; padding: 0 20px 10px; flex-wrap: wrap; }
.list-section-title { font-size: 12px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: 0.05em; }
.list-section-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.list-section-note { font-size: 12px; color: var(--text3); }
.list-section-divider { flex: 1; height: 1px; background: var(--border); }

.practice-area-label {
  background: rgba(13,17,23,0.88);
  border: 1px solid rgba(124,179,66,0.45);
  border-radius: 999px;
  color: #c9f27b;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 9px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

[data-theme="light"] .practice-area-label {
  background: rgba(255,255,255,0.94);
  border-color: rgba(98,150,35,0.35);
  color: #496c18;
}

/* ── View on Map button (Aircraft List) ── */
.btn-map {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--accent, #1f6feb);
  background: transparent;
  color: var(--accent, #1f6feb);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-map:hover { background: var(--accent, #1f6feb); color: #fff; }
.btn-map-ground { border-color: var(--text3, #484f58); color: var(--text3, #484f58); }
.btn-map-ground:hover { background: var(--text3, #484f58); color: #fff; }
.btn-popup-secondary {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid rgba(88,166,255,0.34);
  background: rgba(56,139,253,0.12);
  color: #9ecbff;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-popup-secondary:hover {
  background: rgba(56,139,253,0.22);
  color: #d0e6ff;
  border-color: rgba(88,166,255,0.48);
}
.btn-popup-tracking {
  background: rgba(250,204,21,0.15);
  color: #facc15;
  border-color: rgba(250,204,21,0.42);
}
.btn-popup-tracking:hover {
  background: rgba(250,204,21,0.26);
  color: #fde047;
  border-color: rgba(250,204,21,0.62);
}

/* Advisory stack disambiguation popup */
.advisory-stack-menu { display: flex; flex-direction: column; gap: 6px; min-width: 210px; }
.advisory-stack-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 2px;
}
.advisory-stack-btn {
  background: rgba(56,189,248,0.08);
  border: 1px solid rgba(56,189,248,0.22);
  color: var(--text2);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.advisory-stack-btn:hover {
  background: rgba(56,189,248,0.18);
  color: var(--text);
}

/* Fleet basemap drawer */
.leaflet-top.leaflet-right .fleet-basemap-control {
  position: relative;
  margin-top: 12px;
  margin-right: 12px;
}

.fleet-basemap-trigger {
  min-width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  background: rgba(13,17,23,0.92);
  border: 0.5px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  box-shadow: 0 12px 28px rgba(0,0,0,0.28);
  backdrop-filter: blur(12px);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.fleet-basemap-trigger-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
}

.fleet-basemap-trigger:hover,
.fleet-basemap-control.open .fleet-basemap-trigger {
  background: rgba(22,27,34,0.96);
  border-color: rgba(255,255,255,0.16);
  box-shadow: 0 16px 34px rgba(0,0,0,0.34);
}

.fleet-basemap-control.open .fleet-basemap-trigger {
  transform: translateX(-2px);
}

.fleet-basemap-trigger-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.fleet-basemap-panel {
  position: absolute;
  top: 0;
  right: calc(100% + 12px);
  width: 320px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px) scale(0.98);
  transform-origin: top right;
  background: rgba(13,17,23,0.96);
  border: 0.5px solid var(--border2);
  border-radius: 14px;
  box-shadow: 0 20px 44px rgba(0,0,0,0.36);
  backdrop-filter: blur(14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fleet-basemap-control.open .fleet-basemap-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.fleet-basemap-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 0.5px solid var(--border);
}

.fleet-basemap-panel-title-wrap {
  min-width: 0;
}

.fleet-basemap-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.fleet-basemap-panel-subtitle,
.fleet-basemap-panel-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}

.fleet-basemap-panel-subtitle {
  margin-top: 3px;
}

.fleet-basemap-current {
  color: var(--text2);
}

.fleet-basemap-close {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
  border: 0.5px solid var(--border);
  border-radius: 9px;
  color: var(--text2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fleet-basemap-close:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.16);
  color: var(--text);
}

.fleet-basemap-panel-section-label {
  padding: 12px 14px 8px;
}

.fleet-basemap-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 12px;
}

.fleet-basemap-option {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 13px;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.fleet-basemap-option:hover:not(:disabled) {
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,0.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
  transform: translateX(-2px);
}

.fleet-basemap-option.active {
  background: rgba(55,138,221,0.12);
  border-color: rgba(55,138,221,0.55);
  box-shadow: inset 0 0 0 1px rgba(55,138,221,0.16);
}

.fleet-basemap-option-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fleet-basemap-option-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.fleet-basemap-option-desc {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.35;
  white-space: nowrap;
}

.fleet-basemap-option-state {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}

.fleet-basemap-option.active .fleet-basemap-option-state { color: var(--blue); }
.fleet-basemap-option.is-future {
  opacity: 0.58;
  background: rgba(255,255,255,0.015);
}

.fleet-basemap-option:disabled { cursor: default; }

[data-theme="light"] .leaflet-top.leaflet-right .fleet-basemap-control {
  background: transparent;
}

[data-theme="light"] .fleet-basemap-trigger,
[data-theme="light"] .fleet-basemap-panel {
  background: rgba(255,255,255,0.95);
  box-shadow: 0 12px 28px rgba(15,23,42,0.12);
}

[data-theme="light"] .fleet-basemap-trigger-icon {
  color: var(--text);
}

[data-theme="light"] .fleet-basemap-option {
  background: rgba(15,23,42,0.02);
}

[data-theme="light"] .fleet-basemap-option:hover:not(:disabled) {
  background: rgba(15,23,42,0.04);
}

@media (max-width: 900px) {
  .fleet-basemap-panel {
    width: 290px;
  }

  .fleet-basemap-option-label,
  .fleet-basemap-option-desc {
    white-space: normal;
  }
}

.fleet-basemap-overlays {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px 8px;
}

.fleet-overlay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.fleet-overlay-row:hover {
  background: var(--surface-hover, rgba(255,255,255,0.06));
}

.fleet-overlay-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.fleet-overlay-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--surface-3, #3a3a3a);
  flex-shrink: 0;
  transition: background 0.2s;
  cursor: pointer;
  outline: none;
}

.fleet-overlay-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--accent, #3b82f6);
}

.fleet-overlay-toggle.is-on {
  background: var(--accent, #3b82f6);
}

.fleet-overlay-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  pointer-events: none;
}

.fleet-overlay-toggle.is-on .fleet-overlay-toggle-knob {
  transform: translateX(16px);
}

.airborne-item-context {
  font-size: 10px;
  color: var(--text-muted, #888);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
