:root {
  --bg: #0B0E13;
  --bg-2: #0E1116;
  --panel: rgba(15, 22, 34, 0.94);
  --panel-solid: #111419;
  --border: rgba(255,255,255,0.08);
  --text: #FFFFFF;
  --muted: #9CA5B1;
  --accent: #1264F3;
  --ok: #00C560;
  --ok-dim: #0A8A46;
  --accent-dim: #0D52CC;
  --warn: #FFB300;
  --danger: #FF1744;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --radius: 12px;

  /* One scale for every boxed element. Panels sat at 6/8/10/12px radius with
     eighteen different padding pairs, which is what made the stack read as
     "small then big" rather than as one list. */
  --r-sm: 6px;          /* inner tiles inside a grid */
  --r-md: 8px;          /* list rows, advisories, cards */
  --r-lg: 12px;         /* floating panels */
  --pad-row: 10px 12px; /* anything that reads as a row in a list */
  --pad-tile: 9px 11px; /* cells inside a bordered grid */
  --row-min-h: 40px;    /* keeps short and long rows visually equal */
  --list-gap: 6px;
  --fs-label: 10px;     /* uppercase micro-labels */
  --fs-body: 12px;
  --fs-value: 14px;
  --topbar-h: 54px;
  --status-h: 26px;
}

* { box-sizing: border-box; }

/*
 * The [hidden] attribute is a low-specificity user-agent style, so any class
 * rule that sets `display` silently defeats it. That left the detail modal
 * permanently covering the app and the altitude hero unable to clear itself.
 * Make the attribute authoritative everywhere.
 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: relative; height: 100%; }

/* ------------------------------------------------------------------ topbar */
#topbar {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(10, 15, 24, 0.98), rgba(10, 15, 24, 0.86));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.brand-mark { width: 22px; height: 22px; fill: var(--accent); }
.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--accent);
}
.brand-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted);
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
}
@media (max-width: 900px) {
  .brand-tag { display: none; }
}

.search-wrap { position: relative; flex: 1; max-width: 420px; }
#search {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: #181C22;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#search:focus { border-color: var(--accent-dim); box-shadow: 0 0 0 2px rgba(18, 100, 243, 0.12); }

.suggestions {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  z-index: 20;
}
.suggestions div {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.suggestions div:hover, .suggestions div.active { background: rgba(18, 100, 243, 0.1); }
.suggestions small { color: var(--muted); }
.suggestions .sug-head {
  padding: 5px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  cursor: default;
}
.suggestions .sug-head:hover { background: rgba(255, 255, 255, 0.04); }
.suggestions .sug-airport { box-shadow: inset 2px 0 0 #1677FF; }
.suggestions .sug-airport b { color: #9CC3FF; }
.suggestions .sug-place { box-shadow: inset 2px 0 0 var(--accent); }

.topbar-stats { display: flex; gap: 18px; margin-left: auto; }
.stat { text-align: right; line-height: 1.1; }
.stat span { font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 600; }
.stat label { display: block; font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.6px; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.icon-btn, .ghost-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: #181C22;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.icon-btn:hover, .ghost-btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.icon-btn.active { background: rgba(18, 100, 243, 0.14); border-color: var(--accent-dim); color: var(--accent); }

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge-live { color: var(--accent); background: rgba(18, 100, 243, 0.12); border-color: var(--accent-dim); }
.badge-sim { color: var(--warn); background: rgba(255, 179, 0, 0.12); border-color: #7a5410; }

/* --------------------------------------------------------------------- map */
#map {
  position: absolute;
  inset: var(--topbar-h) 0 var(--status-h) 0;
  background: var(--bg-2);
}
.leaflet-container { background: var(--bg-2); font-family: inherit; }
.leaflet-control-attribution {
  background: rgba(10, 15, 24, 0.75) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a {
  background: var(--panel-solid) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-bar a:hover { background: #17233a !important; }
#planes-canvas { position: absolute; inset: 0; z-index: 450; pointer-events: none; }

.airport-marker {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transform: translate(-6px, -6px);
}
.airport-dot {
  width: 7px; height: 7px;
  background: #1677FF;
  border: 1px solid var(--bg-2);
  border-radius: 3px;
  flex: none;
}
.airport-code {
  font-size: 10px;
  font-weight: 700;
  color: #9CC3FF;
  text-shadow: 0 1px 3px #000, 0 0 2px #000;
}

/* ----------------------------------------------------------------- popover */
.popover {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  right: 12px;
  z-index: 1300;
  width: 250px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.popover h4 {
  margin: 10px 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.popover h4:first-child { margin-top: 0; }
.popover label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.popover input[type="text"] {
  width: 100%; height: 30px; padding: 0 8px;
  background: #181C22; border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text);
}
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-row output { width: 56px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
#f-reset { width: 100%; margin-top: 12px; }

/* ----------------------------------------------------------------- sidebar */
#sidebar {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  right: 12px;
  bottom: calc(var(--status-h) + 12px);
  width: 300px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
#sidebar.hidden, #detail.hidden, .hidden { display: none !important; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.sidebar-head h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
#sort-by {
  background: #181C22; color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 11px; padding: 3px 6px;
}
.flight-list { overflow-y: auto; flex: 1; }
.flight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.flight-row:hover { background: rgba(255, 255, 255, 0.04); }
.flight-row.selected { background: rgba(18, 100, 243, 0.12); box-shadow: inset 2px 0 0 var(--accent); }
.fr-call { font-weight: 600; font-size: 13px; }
.fr-alt { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.fr-sub, .fr-speed { font-size: 11px; color: var(--muted); }
.fr-speed { text-align: right; font-variant-numeric: tabular-nums; }
.fr-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ detail */
#detail {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  left: 12px;
  width: 330px;
  max-height: calc(100% - var(--topbar-h) - var(--status-h) - 24px);
  overflow-y: auto;
  z-index: 1150;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.detail-close {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; line-height: 1;
  font-size: 18px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer;
}
.detail-close:hover { border-color: var(--border); color: var(--text); }
.detail-head { display: flex; justify-content: space-between; gap: 8px; padding-right: 26px; }
.detail-title h2 { margin: 0; font-size: 22px; letter-spacing: 0.5px; }
.detail-title p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.detail-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.chip {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); color: var(--muted); white-space: nowrap;
}
.chip.ground { background: rgba(255, 179, 0, 0.15); color: var(--warn); }
.chip.climb { background: rgba(0, 197, 96, 0.15); color: var(--ok); }
.chip.descend { background: rgba(22, 119, 255, 0.15); color: #1677FF; }
.chip.emerg { background: rgba(255, 23, 68, 0.18); color: var(--danger); }
.chip.sim { background: rgba(255, 179, 0, 0.15); color: var(--warn); }

.detail-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.cell { background: #181C22; padding: var(--pad-tile); }
.cell.wide { grid-column: span 2; }
.cell label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.cell span { font-size: 14px; font-variant-numeric: tabular-nums; }

.spark-wrap { margin-top: 12px; }
.spark-wrap label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
#d-spark { width: 100%; height: 60px; margin-top: 4px; background: #181C22; border: 1px solid var(--border); border-radius: var(--r-md); }
#d-spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
#d-spark path.area { fill: rgba(18, 100, 243, 0.14); stroke: none; }

.detail-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.muted { color: var(--muted); font-size: 11px; margin-left: auto; }

/* ------------------------------------------------- airport & UAS panels */
#airport-panel, #uas-panel {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  left: 12px;
  width: 370px;
  max-height: calc(100% - var(--topbar-h) - var(--status-h) - 24px);
  overflow-y: auto;
  z-index: 1160;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.tabs { display: flex; gap: 4px; margin-top: 12px; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1;
  padding: 7px 4px;
  font-size: 11px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
}
.tab span {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 10px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.active span { background: rgba(18, 100, 243, 0.2); color: var(--accent); }

.board { max-height: 260px; overflow-y: auto; }
.board-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2px 10px;
  align-items: center;
  padding: 7px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.board-row:hover { background: rgba(255, 255, 255, 0.04); }
.board-call { font-weight: 600; font-size: 13px; }
.board-sub { grid-column: 1; font-size: 11px; color: var(--muted); }
.board-alt { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.board-dist { font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.board-empty { padding: 16px 4px; color: var(--muted); font-size: 12px; }

.ap-tfr { margin-top: 10px; }
/* Mission inputs: one grid so fields line up instead of wrapping into a
   ragged row, and every control is the same height as every other. */
.mission {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--list-gap);
  margin: 12px 0 var(--list-gap);
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-wide { grid-column: span 2; }
.field > span {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.field select,
.field input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: #181C22;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  outline: none;
}
.field select:focus,
.field input:focus { border-color: var(--accent-dim); }
.field-suffix { position: relative; display: block; }
.field-suffix input { padding-right: 52px; }
.field-suffix small {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
.mission-actions { display: flex; gap: var(--list-gap); margin-bottom: 12px; }
.mission-actions .ghost-btn { flex: 1; height: 34px; }

/* Exporting is the end of the workflow, so it is pinned to the bottom of the
   panel as the primary action instead of sitting among the inputs that set
   the briefing up. */
.panel-footer {
  position: sticky;
  bottom: -14px;
  margin: 16px -14px -14px;
  padding: 12px 14px;
  /* Opaque: a sticky footer legitimately covers content while the panel
     scrolls, but a translucent one shows that content bleeding through. */
  background: var(--panel-solid);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 16px rgba(0, 0, 0, 0.25);
}
.primary-btn {
  width: 100%;
  height: 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent-dim);
  background: rgba(18, 100, 243, 0.16);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
}
.primary-btn:hover { background: rgba(18, 100, 243, 0.26); }
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.uas-section { margin-top: 14px; }
.uas-section h4 {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.mini-list { display: flex; flex-direction: column; gap: var(--list-gap); }
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: var(--pad-row);
  min-height: var(--row-min-h);
  background: #181C22;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-body);
  line-height: 1.4;
}
.mini-row b { font-weight: 600; }
.mini-row.clickable { cursor: pointer; }
.mini-row.clickable:hover { border-color: var(--accent-dim); background: rgba(18, 100, 243, 0.08); }
.mini-row.clickable::after { content: "↗"; color: var(--muted); font-size: 11px; }
.mini-row small { color: var(--muted); white-space: nowrap; }
.mini-sub {
  padding: 0 12px 9px;
  margin-top: calc(var(--list-gap) * -1);
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-empty { padding: 6px 8px; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------- weather / hero */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(18, 100, 243, 0.1), rgba(12, 20, 33, 0.9));
}
.hero.limited { background: linear-gradient(135deg, rgba(255, 179, 0, 0.12), rgba(12, 20, 33, 0.9)); }
.hero.grounded { background: linear-gradient(135deg, rgba(255, 23, 68, 0.14), rgba(12, 20, 33, 0.9)); }
.hero-main span {
  display: block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.hero-main label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.hero-side { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.hero-side small { font-size: 10px; color: var(--muted); max-width: 160px; line-height: 1.3; }

.hero-verdict {
  margin: 0 0 10px;
  padding: var(--pad-row);
  min-height: var(--row-min-h);
  display: flex;
  align-items: center;
  border-radius: var(--r-md);
  font-size: var(--fs-value);
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.verdict-go { background: rgba(0, 197, 96, 0.12); border-color: var(--ok-dim); color: var(--ok); }
.verdict-caution { background: rgba(255, 179, 0, 0.14); border-color: #7a5410; color: var(--warn); }
.verdict-nogo, .verdict-no-go {
  background: rgba(255, 23, 68, 0.18);
  border-color: #7d2530;
  color: var(--danger);
}
.verdict-authorization-required {
  background: rgba(255, 138, 61, 0.15);
  border-color: #8a4516;
  color: #ff8a3d;
}
.verdict-unknown { background: rgba(255, 255, 255, 0.07); border-color: var(--border); color: var(--muted); }

.wx-verdict {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.wx-go { background: rgba(0, 197, 96, 0.14); color: var(--ok); border: 1px solid var(--ok-dim); }
.wx-caution { background: rgba(255, 179, 0, 0.16); color: var(--warn); border: 1px solid #7a5410; }
.wx-nogo { background: rgba(255, 23, 68, 0.18); color: var(--danger); border: 1px solid #7d2530; }
.wx-auth { background: rgba(255, 138, 61, 0.18); color: #ff8a3d; border: 1px solid #8a4516; }
.wx-unknown { background: rgba(255, 255, 255, 0.08); color: var(--muted); border: 1px solid var(--border); }

.h4-note { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; }

.wx-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.wx-grid div { background: #181C22; padding: var(--pad-tile); text-align: center; }
.wx-grid label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.wx-grid b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wx-raw {
  margin-top: 6px;
  padding: 6px 8px;
  background: #0B0E13;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-word;
}
.wx-sun { margin-top: 6px; font-size: 11px; color: var(--muted); display: flex; gap: 12px; }
.taf-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
}
.taf-row time { color: var(--muted); font-variant-numeric: tabular-nums; }

.advisories { display: flex; flex-direction: column; gap: var(--list-gap); margin-bottom: 14px; }
.adv {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: var(--pad-row);
  min-height: var(--row-min-h);
  border-radius: var(--r-md);
  font-size: var(--fs-body);
  line-height: 1.45;
  border: 1px solid transparent;
}
.adv::before { font-weight: 700; }
.adv-critical { background: rgba(255, 23, 68, 0.13); border-color: #7d2530; color: #ffb3ba; }
.adv-critical::before { content: "!"; color: var(--danger); }
.adv-warning { background: rgba(255, 179, 0, 0.12); border-color: #7a5410; color: #ffd88a; }
.adv-warning::before { content: "▲"; color: var(--warn); }
.adv-ok { background: rgba(0, 197, 96, 0.1); border-color: var(--ok-dim); color: #7fe0b2; }
.adv-ok::before { content: "✓"; color: var(--accent); }
.adv-info { background: rgba(22, 119, 255, 0.1); border-color: #2b4f7a; color: #b8d8ff; }
.adv-info::before { content: "i"; color: #1677FF; }

.fineprint { margin: 12px 0 0; font-size: 10px; line-height: 1.5; color: var(--muted); }

.uas-crosshair {
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5), 0 0 14px rgba(18, 100, 243, 0.7);
}
.uas-crosshair::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px;
  background: var(--accent);
  border-radius: 50%;
}
.fria-label, .stadium-label {
  font-size: 10px;
  font-weight: 700;
  color: #ffd88a;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- statusbar */
#statusbar {
  position: absolute;
  inset: auto 0 0 0;
  height: var(--status-h);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(10, 15, 24, 0.92);
  border-top: 1px solid var(--border);
}
#statusbar a { color: var(--muted); }
.sep { opacity: 0.4; }

.info-modal {
  position: absolute;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 8, 14, 0.62);
  backdrop-filter: blur(3px);
}
.info-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 80%;
  overflow-y: auto;
  padding: 18px 20px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.info-card h3 { margin: 8px 0 0; font-size: 18px; line-height: 1.3; padding-right: 28px; }
.info-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.info-meta div { background: #181C22; padding: var(--pad-tile); }
/* An odd number of facts would otherwise leave a filled empty cell. */
.info-meta div:last-child:nth-child(odd) { grid-column: span 2; }
.info-meta label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.info-meta span { font-size: 13px; }
.info-body {
  margin-top: 12px;
  padding: 10px 12px;
  background: #0B0E13;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.55;
  color: #c8d6e8;
  white-space: pre-wrap;
  word-break: break-word;
}
.info-body:empty { display: none; }
.info-actions { display: flex; gap: 8px; margin-top: 14px; }
.info-actions .ghost-btn { flex: 1; text-align: center; line-height: 30px; text-decoration: none; }
@media (max-width: 760px) {
  .info-modal { padding: 10px; }
  .info-meta { grid-template-columns: 1fr; }
  .firstrun { left: 8px; right: 8px; width: auto; }
}

.firstrun {
  position: absolute;
  top: calc(var(--topbar-h) + 12px);
  right: 12px;
  z-index: 1400;
  width: 300px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.firstrun b { color: var(--accent); }
.firstrun p { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.firstrun-actions { display: flex; gap: 8px; margin-top: 12px; }
.firstrun-actions button { flex: 1; }

.toast {
  position: absolute;
  bottom: calc(var(--status-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1400;
  padding: 8px 14px;
  background: var(--panel-solid);
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  font-size: 12px;
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ mobile */
@media (max-width: 760px) {
  :root { --topbar-h: 96px; }
  /* Seven controls share the row on a phone; without this they overflow. */
  .topbar-actions { flex-wrap: wrap; row-gap: 4px; }
  .icon-btn { padding: 0 9px; font-size: 11px; height: 28px; }
  .topbar-sep { display: none; }
  #topbar { flex-wrap: wrap; align-content: center; padding: 6px 10px; gap: 8px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .topbar-stats { gap: 12px; }
  .stat span { font-size: 13px; }
  #sidebar { left: 8px; right: 8px; width: auto; top: auto; height: 45%; bottom: calc(var(--status-h) + 8px); }
  #detail, #airport-panel, #uas-panel { left: 8px; right: 8px; width: auto; max-height: 62%; }
  .popover { left: 8px; right: 8px; width: auto; }
  /* Four weather tiles are unreadable on a phone; stack them 2x2. */
  .wx-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { flex-wrap: wrap; gap: 8px; }
  .hero-main span { font-size: 26px; }
  .hero-side { align-items: flex-start; text-align: left; }
  .hero-side small { max-width: none; }
  .mission { grid-template-columns: 1fr; }
  .field-wide { grid-column: span 1; }
  .tabs { flex-wrap: wrap; }
  .tab { flex: 1 1 45%; }
}

/* ───────────────────────── monitored sites ───────────────────────── */
.count-badge {
  display: inline-block;
  min-width: 16px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
#sites-panel {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  right: 12px;
  bottom: calc(var(--status-h) + 12px);
  width: 340px;
  z-index: 1150;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
  padding-bottom: 8px;
}
.sites-list { padding: 10px 12px; overflow-y: auto; max-height: 42%; }
.site-row { position: relative; cursor: pointer; }
.site-row .site-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}
.site-row .site-del:hover { color: var(--danger); background: rgba(255, 23, 68, 0.12); }
.site-verdict { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; }
.sv-ok { color: var(--ok); }
.sv-warn { color: var(--warn); }
.sv-bad { color: var(--danger); }
.sv-unknown { color: var(--muted); }
.sites-alerts-head { border-top: 1px solid var(--border); }
.alerts-list { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: var(--list-gap); }
.alerts-list time { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
#sites-panel .fineprint { padding: 0 12px; }
.panel-footer { display: flex; gap: 8px; }
.panel-footer .primary-btn { flex: 1; }
.primary-alt {
  background: rgba(22, 119, 255, 0.14);
  border-color: #2b4f7a;
  color: #1677FF;
}
.primary-alt:hover { background: rgba(22, 119, 255, 0.24); }

/* ───────────────────── iOS safe areas (notch / home bar) ───────────────────── */
@supports (padding: env(safe-area-inset-top)) {
  #topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  #map { top: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  #statusbar { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--status-h) + env(safe-area-inset-bottom)); }
  #sidebar, #sites-panel { bottom: calc(var(--status-h) + env(safe-area-inset-bottom) + 12px); }
  #detail, #airport-panel, #uas-panel {
    top: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px);
    max-height: calc(100% - var(--topbar-h) - var(--status-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  }
}

/* ─────────────────── interaction polish (shared) ─────────────────── */
::selection { background: rgba(18, 100, 243, 0.28); color: #eafff7; }
:focus-visible { outline: 2px solid var(--accent-dim); outline-offset: 2px; border-radius: 4px; }
button, a, input, select { transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease; }
* { scrollbar-width: thin; scrollbar-color: #3A414B transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #3A414B; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #4A525E; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
@media (prefers-reduced-motion: reduce) {
  button, a, input, select { transition: none; }
}
