:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;

  --navy: #1e3a8a;
  --navy-light: #eff6ff;
  --emerald: #059669;
  --emerald-light: #ecfdf5;
  --crimson: #dc2626;
  --crimson-light: #fef2f2;
  --amber: #d97706;
  --amber-light: #fffbeb;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  --topbar-h: 58px;
  --sidebar-w: 296px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top Bar */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 40;
}

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

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-subtitle {
  margin: 0;
  font-size: 11px;
  color: var(--text-soft);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
}

.nav-tab.active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
}

.nav-badge.alert {
  background: var(--crimson-light);
  color: var(--crimson);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.source-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy);
}

.status-dot.live {
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  padding: 7px 12px;
  font-size: 12.5px;
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  padding: 6px 10px;
  font-size: 12px;
}

.btn-ghost:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 11.5px;
}

.text-btn {
  border: none;
  background: none;
  color: var(--navy);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

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

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.mobile-only {
  display: none;
}

/* Workspace Layout */
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 30;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.count-pill {
  background: var(--navy);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 10px;
  color: var(--text-soft);
  pointer-events: none;
}

.input-with-icon input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-subtle);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.input-with-icon input:focus,
.mini-search:focus,
.date-inputs input:focus,
.select-sm:focus,
.form-field input:focus,
.form-field select:focus {
  border-color: var(--navy);
  background: var(--surface);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: var(--border-strong);
}

.filter-chip[data-active="true"] {
  background: var(--navy-light);
  border-color: var(--navy);
  color: var(--navy);
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.chip-dot.crimson { background: var(--crimson); }
.chip-dot.emerald { background: var(--emerald); }
.chip-dot.amber { background: var(--amber); }
.chip-dot.navy { background: var(--navy); }

/* Date Range */
.preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.preset-btn {
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.preset-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mini-label {
  display: block;
  font-size: 10.5px;
  color: var(--text-soft);
  margin-bottom: 2px;
}

.date-inputs input {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 11.5px;
  background: var(--surface-subtle);
  color: var(--text);
  outline: none;
}

/* Conference Tabs */
.conference-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.conf-tab {
  padding: 4px 2px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}

.conf-tab.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.mini-search {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  background: var(--surface-subtle);
  outline: none;
}

/* Pick Lists */
.pick-list {
  max-height: 175px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
  transition: background 0.1s;
}

.pick-item:hover {
  background: rgba(15, 23, 42, 0.04);
}

.pick-item.selected {
  background: var(--navy-light);
  color: var(--navy);
  font-weight: 600;
}

.pick-item input[type="checkbox"] {
  margin: 0;
  accent-color: var(--navy);
  cursor: pointer;
}

.school-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.12);
}

.pick-meta {
  margin-left: auto;
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-soft);
}

.airport-code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--navy);
  min-width: 38px;
}

.pick-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 14px 16px;
}

.view-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.view-pane.active {
  display: flex;
}

/* KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  flex-shrink: 0;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.kpi-value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.kpi-value.emerald { color: var(--emerald); }
.kpi-value.crimson { color: var(--crimson); }
.kpi-value.amber { color: var(--amber); }

/* Map Section */
.map-section {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 435px;
  min-height: 360px;
  flex-shrink: 0;
  transition: height 0.2s ease;
}

.map-section.expanded {
  height: 580px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 10;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  width: 18px;
  height: 3px;
  border-radius: 2px;
}
.legend-line.crimson { background: var(--crimson); }
.legend-line.emerald { background: var(--emerald); }
.legend-line.navy { background: #3b82f6; }

.map-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.inline-toggle input {
  margin: 0;
  accent-color: var(--navy);
  cursor: pointer;
}

.radar-banner {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--emerald-light);
  color: var(--emerald);
  border-bottom: 1px solid #a7f3d0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.radar-banner.err {
  background: var(--crimson-light);
  color: var(--crimson);
  border-bottom-color: #fecaca;
}

.flight-map {
  flex: 1;
  width: 100%;
  background: #edf2f7;
  z-index: 1;
}

.flight-map .leaflet-tile-pane {
  filter: saturate(0.45) brightness(1.04) contrast(0.92);
}

/* Detail Drawer floating over map right side */
.detail-drawer {
  position: absolute;
  top: 44px;
  right: 10px;
  width: 332px;
  max-height: calc(100% - 54px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 11px 12px;
  z-index: 500;
}

.drawer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.drawer-tail {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.drawer-aircraft {
  font-size: 11.5px;
  color: var(--text-soft);
}

.drawer-route-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  margin-bottom: 7px;
}

.drawer-airport {
  display: flex;
  flex-direction: column;
}

.drawer-airport.right {
  text-align: right;
}

.drawer-icao {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}

.drawer-school {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.drawer-arrow {
  color: var(--text-soft);
  font-size: 15px;
}

.drawer-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 7px;
  font-size: 11.5px;
}

.drawer-meta-item label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 600;
}

.drawer-notes {
  background: var(--amber-light);
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 11.5px;
  margin-bottom: 7px;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* History Table Section */
.history-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 260px;
  flex: 1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.section-header h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
}

.section-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

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

.select-sm {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.table-wrap {
  overflow-x: auto;
  flex: 1;
}

.flight-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.flight-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.flight-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.flight-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.flight-table tbody tr:hover {
  background: #f8fafc;
}

.flight-table tbody tr.selected-row {
  background: var(--navy-light);
}

.tail-cell {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 5px;
}

.star-indicator {
  color: var(--amber);
  font-size: 13px;
}

.sub-text {
  display: block;
  font-size: 11.5px;
  color: var(--text-soft);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

.route-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.icao-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}

.school-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Status & Signal Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-live {
  background: var(--emerald-light);
  color: var(--emerald);
}

.badge-landed {
  background: #f1f5f9;
  color: var(--text-muted);
}

.badge-scheduled {
  background: var(--navy-light);
  color: var(--navy);
}

.badge-high {
  background: var(--crimson-light);
  color: var(--crimson);
}

.badge-medium {
  background: var(--amber-light);
  color: var(--amber);
}

.badge-low {
  background: #f1f5f9;
  color: var(--text-soft);
}

/* Carousel Radar View */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  gap: 12px;
}

.pane-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.radar-filter-pills {
  display: flex;
  gap: 6px;
}

.radar-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
  align-items: start;
}

.column-title {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.corridor-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.corridor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.corridor-route {
  font-weight: 700;
  font-size: 14px;
}

.radar-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 4px solid var(--crimson);
}

.radar-card.medium {
  border-left-color: var(--amber);
}

.radar-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.radar-reason {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.radar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Watchlist View */
.watchlist-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  align-items: start;
}

.watchlist-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watchlist-form h3 {
  margin: 0 0 2px;
  font-size: 14.5px;
}

.watchlist-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wl-type-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--navy-light);
  color: var(--navy);
}

/* Forms & Modals */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-field input,
.form-field select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  background: var(--surface-subtle);
  color: var(--text);
  outline: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-intro {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

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

.source-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.source-option:hover {
  background: var(--surface-subtle);
}

.source-option input {
  margin-top: 3px;
  accent-color: var(--navy);
}

.source-option p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

.api-config-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.helper-text {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--text-soft);
}

.api-status {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
}

.api-status.ok {
  background: var(--emerald-light);
  color: var(--emerald);
}

.api-status.err {
  background: var(--crimson-light);
  color: var(--crimson);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.modal-footer.flush {
  padding: 12px 0 0;
  background: transparent;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-soft);
}

/* Custom Leaflet plane icon */
.plane-marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.airport-tooltip {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 1024px) {
  .mobile-only {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .radar-grid,
  .watchlist-layout {
    grid-template-columns: 1fr;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .brand-subtitle {
    display: none;
  }
  #logSightingBtn span {
    display: none;
  }
  .topbar {
    padding: 0 10px;
    gap: 8px;
  }
  .nav-tab {
    padding: 5px 8px;
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .brand-title {
    font-size: 13.5px;
  }
  .nav-tab span:not(.nav-badge) {
    display: none;
  }
  .map-legend {
    display: none;
  }
  .detail-drawer {
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 62%;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
