/* ============================================================
   Haiti Satellite Monitor — interface styles
   Dark mission-control theme; no external fonts or assets.
   ============================================================ */

:root {
  --bg:            #070b12;
  --bg-2:          #0b1220;
  --panel:         #0d1526;
  --panel-2:       #111c30;
  --line:          #1e2c44;
  --line-soft:     #172437;
  --text:          #e6edf7;
  --muted:         #8ba0bd;
  --dim:           #5f7595;

  --accent:        #2f81f7;
  --accent-2:      #58a6ff;
  --ok:            #3fb950;
  --warn:          #d29922;
  --danger:        #f85149;
  --ht-blue:       #00209f;
  --ht-red:        #d21034;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 10px 30px rgba(0,0,0,.45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(47,129,247,.14), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(210,16,52,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
code { font-family: var(--mono); font-size: .92em; background: #0a1120; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line-soft); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 1200;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 16px;
  background: rgba(8,13,22,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 11px; color: #cfe4ff;
  background: linear-gradient(145deg, rgba(47,129,247,.35), rgba(210,16,52,.28));
  border: 1px solid rgba(120,170,255,.35);
  box-shadow: inset 0 0 18px rgba(47,129,247,.25);
}
.brand-text h1 { font-size: 15px; white-space: nowrap; }
.brand-text p { margin: 1px 0 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-status { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.clock { font-family: var(--mono); font-size: 12.5px; color: #b9ccE6; background: #0a1424; border: 1px solid var(--line); padding: 5px 9px; border-radius: 7px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted); background: #0a1424;
}
.badge-live { color: #7ee787; border-color: rgba(63,185,80,.45); background: rgba(63,185,80,.10); }
.badge-pred { color: #9ecbff; border-color: rgba(47,129,247,.45); background: rgba(47,129,247,.10); }
.badge-obs  { color: #ffd479; border-color: rgba(210,153,34,.5); background: rgba(210,153,34,.12); }
.badge-cat  { color: var(--text); }
.badge-muted{ color: var(--dim); }
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 currentColor; animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(63,185,80,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(63,185,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); }
}

/* ---------------- buttons ---------------- */
.btn {
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text); background: #14203a;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; transition: .15s ease;
}
.btn:hover { background: #1a2a49; border-color: #2b3f60; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #2f81f7, #1f65c9); border-color: #4b93f8; color: #fff; }
.btn-primary:hover { background: linear-gradient(180deg, #3d8cf9, #2470d6); }
.btn-tiny { font-size: 11px; padding: 4px 8px; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-icon { padding: 6px 9px; }
.linkbtn { background: none; border: 0; color: var(--accent-2); font: inherit; font-size: 11px; cursor: pointer; padding: 0 3px; }
.linkbtn:hover { text-decoration: underline; }

/* ---------------- status strip ---------------- */
.status-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 16px; font-size: 12px;
  background: #0a1220; border-bottom: 1px solid var(--line-soft);
  color: var(--muted); min-height: 34px;
}
.status-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.status-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.status-strip.error { background: rgba(248,81,73,.10); border-bottom-color: rgba(248,81,73,.35); color: #ffb3ae; }
.status-strip.warn  { background: rgba(210,153,34,.10); border-bottom-color: rgba(210,153,34,.35); color: #ffd479; }
.status-strip.ok    { background: rgba(63,185,80,.07);  border-bottom-color: rgba(63,185,80,.28); color: #9be9a8; }
.counts { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }

.spinner {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 2px solid rgba(120,170,255,.25); border-top-color: var(--accent-2);
  animation: spin .8s linear infinite;
}
.spinner.done { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: 290px minmax(0,1fr) 320px;
  grid-template-rows: minmax(0, 1fr) minmax(0, 44vh);
  grid-template-areas:
    "left   center right"
    "table  table  table";
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 88px);
  min-height: 620px;
}
.panel-left   { grid-area: left; }
.center       { grid-area: center; }
.panel-right  { grid-area: right; }
.tableSection { grid-area: table; }


.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  scrollbar-width: thin;
}
.panel::-webkit-scrollbar { width: 9px; }
.panel::-webkit-scrollbar-thumb { background: #1d2c45; border-radius: 9px; }

.pane { padding: 12px 13px; border-bottom: 1px solid var(--line-soft); }
.pane:last-child { border-bottom: 0; }
.pane-tight { padding-bottom: 14px; }
.pane-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 10px;
}
.pane-sub { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dim); font-size: 10px; }
.pane-tools { display: flex; gap: 4px; }

/* ---------------- fields ---------------- */
.field { display: block; margin-bottom: 11px; }
.field > span { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.field > span b { color: var(--text); font-variant-numeric: tabular-nums; }
.field-row { display: flex; gap: 9px; }
.field-row .field { flex: 1; min-width: 0; }
.field.grow { flex: 2; }
.field input[type="text"], .field input[type="number"], .field input[type="search"], .field select, select, input[type="number"], input[type="text"] {
  width: 100%; font: inherit; font-size: 12.5px; color: var(--text);
  background: #0a1424; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 9px; outline: none;
}
.field input:focus, .field select:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,129,247,.18);
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
.hint { display: block; font-size: 10.5px; color: var(--dim); margin-top: 4px; line-height: 1.35; }
textarea {
  width: 100%; font-family: var(--mono); font-size: 11.5px; color: var(--text);
  background: #0a1424; border: 1px solid var(--line); border-radius: 8px; padding: 9px; resize: vertical;
}
.switch-row { display: flex; flex-direction: column; gap: 6px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); cursor: pointer; margin-bottom: 5px; }
.switch input { accent-color: var(--accent); width: 14px; height: 14px; }

/* ---------------- category list ---------------- */
.cat-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.cat-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 7px; border-radius: 7px; cursor: pointer; font-size: 12px;
  border: 1px solid transparent;
}
.cat-row:hover { background: #101b2d; }
.cat-row input { accent-color: var(--accent); width: 14px; height: 14px; }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.cat-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }

/* ---------------- key/value ---------------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 11.5px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 11px; color: #c9d9ee; word-break: break-word; }
.kv-compact { gap: 3px 10px; }

.warn {
  margin-top: 9px; padding: 8px 10px; border-radius: 8px; font-size: 11.5px;
  background: rgba(210,153,34,.10); border: 1px solid rgba(210,153,34,.4); color: #ffd479;
}
.warn.danger { background: rgba(248,81,73,.10); border-color: rgba(248,81,73,.4); color: #ffb3ae; }

/* ---------------- map ---------------- */
.center { min-width: 0; }
.map-shell { position: relative; height: 100%; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #08101d; }
#map { position: absolute; inset: 0; background: #08101d; }

.leaflet-container { background: #08101d; font-family: var(--sans); }

/* Optional dark basemap: inverts the light OSM raster so the colour-coded
   predicted positions stay readable. Toggle in "Map behaviour". */
body.tiles-dark .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.92) saturate(0.65);
}
body.tiles-dark .leaflet-container { background: #050a12; }
.leaflet-control-attribution {
  background: rgba(8,14,24,.82) !important; color: #8ba0bd !important; font-size: 10px !important;
  border-radius: 6px 0 0 0; padding: 2px 6px !important;
}
.leaflet-control-attribution a { color: #58a6ff !important; }
.leaflet-bar a { background: #0d1728 !important; color: #cfe0f5 !important; border-color: #1e2c44 !important; }
.leaflet-bar a:hover { background: #16233a !important; }

.map-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(6,10,18,.72); z-index: 900; }
.map-overlay-card { max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.map-overlay-card h3 { font-size: 14px; margin-bottom: 6px; }
.map-overlay-card p { font-size: 12px; color: var(--muted); margin: 0 0 10px; }

.map-legend {
  position: absolute; left: 10px; top: 10px; z-index: 1100;
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(9,15,26,.86); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; font-size: 10px; color: var(--muted); backdrop-filter: blur(6px);
  max-height: calc(100% - 130px); overflow: auto; line-height: 1.35;
}
.map-legend .cat-dot { width: 8px; height: 8px; }
.map-hud { z-index: 1100; }
.map-legend .lg-row { display: flex; align-items: center; gap: 6px; }
.map-legend .lg-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: 0; color: var(--dim); font: inherit; font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; padding: 0; }
.map-legend .lg-toggle:hover { color: var(--text); }
.map-legend.collapsed .lg-rows { display: none; }
.map-legend .lg-caret { transition: transform .15s ease; display: inline-block; }
.map-legend.collapsed .lg-caret { transform: rotate(-90deg); }
.map-legend .lg-title { font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }

.map-hud {
  position: absolute; left: 10px; bottom: 26px; right: 12px; z-index: 800;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.hud-pill {
  background: rgba(9,15,26,.88); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 10.5px; color: var(--muted); backdrop-filter: blur(6px);
}
.hud-pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.hud-pill.muted { color: var(--dim); }

.sat-glow { filter: drop-shadow(0 0 2px rgba(0,0,0,.55)); }
/* satellite markers */
.sat-marker { border-radius: 50%; box-shadow: 0 0 8px currentColor; border: 1px solid rgba(255,255,255,.55); transition: transform .2s ease; }
.sat-marker.selected { outline: 2px solid #fff; outline-offset: 2px; }
.leaflet-tooltip.sat-tip {
  background: rgba(9,15,26,.94); border: 1px solid var(--line); color: var(--text);
  font-size: 11px; border-radius: 7px; box-shadow: var(--shadow); padding: 4px 7px;
}
.leaflet-tooltip.sat-tip::before { display: none; }
.observer-marker { filter: drop-shadow(0 0 6px rgba(47,129,247,.9)); }

/* ---------------- sky view ---------------- */
.skywrap { position: relative; }
#skyview { width: 100%; max-width: 200px; height: auto; display: block; margin: 0 auto; }
.sky-ring { fill: none; stroke: #1c2b43; stroke-width: 1; }
.sky-axis { stroke: #1c2b43; stroke-width: 1; stroke-dasharray: 3 4; }
.sky-lbl { fill: #5f7595; font-size: 11px; font-family: var(--mono); }
.sky-horizon-label { fill: #7d93b3; font-size: 10px; font-family: var(--mono); }
.sky-dot { cursor: pointer; transition: r .2s ease; }
.sky-dot:hover { stroke: #fff; stroke-width: 1.4; }
.sky-selected { fill: none; stroke: #fff; stroke-width: 1.6; }
.sky-shade { fill: rgba(47,129,247,.04); }

/* ---------------- selection ---------------- */
.empty { font-size: 11.5px; color: var(--dim); padding: 10px 0; }
.sel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.sel-name { font-size: 14px; font-weight: 700; }
.sel-meta { font-size: 11px; color: var(--dim); font-family: var(--mono); }
.mini-title { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 14px 0 7px; }
.passes { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }
.pass-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 8px; border-radius: 7px; background: #0b1524; border: 1px solid var(--line-soft); }
.pass-row .p-time { font-family: var(--mono); font-size: 11px; color: #cfe0f5; }
.pass-row .p-el { font-family: var(--mono); font-size: 11px; color: #9ecbff; text-align: right; }
.pass-row .p-sub { grid-column: 1 / -1; font-size: 10px; color: var(--dim); }
.pass-row.optical { border-color: rgba(63,185,80,.35); background: rgba(63,185,80,.06); }
.tag { display: inline-block; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; margin-left: 5px; }
.tag-green { background: rgba(63,185,80,.16); color: #7ee787; border: 1px solid rgba(63,185,80,.35); }
.tag-grey  { background: rgba(139,160,189,.12); color: var(--muted); border: 1px solid var(--line); }

/* ---------------- table ---------------- */
.tableSection { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tableSection .table-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 9px; flex-wrap: wrap; }
.table-head h2 { font-size: 13px; }
.table-tools { display: flex; align-items: center; gap: 10px; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-height: 340px; }
.table-scroll.small { max-height: 220px; margin-top: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: #101b2d; color: var(--muted); text-align: left; font-weight: 700;
  font-size: 10px; letter-spacing: .05em; text-transform: uppercase;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
thead th:hover { color: var(--text); }
thead th[data-dir="asc"]::after { content: " ▲"; color: var(--accent-2); }
thead th[data-dir="desc"]::after { content: " ▼"; color: var(--accent-2); }
.th-sub { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--dim); }

tbody td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #101b2d; }
tbody tr.selected { background: rgba(47,129,247,.13); box-shadow: inset 2px 0 0 var(--accent); }
td.mono, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td .name-main { font-weight: 600; color: #dbe7f6; }
td .name-sub { font-size: 10px; color: var(--dim); font-family: var(--mono); }
.cat-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; }
.cat-chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
.age-warn { color: var(--warn); }
.age-bad  { color: var(--danger); }
.el-up    { color: #7ee787; }
.el-down  { color: var(--dim); }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #101b2d, #17253c, #101b2d); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-row td { padding: 12px 10px; }
.table-foot { padding: 8px 2px 0; font-size: 10.5px; color: var(--dim); }

/* ---------------- notice ---------------- */
.notice { padding: 0 12px 22px; }
.notice-inner {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(210,153,34,.08), rgba(210,153,34,.03));
  border: 1px solid rgba(210,153,34,.32);
}
.notice-icon {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 12px;
  background: rgba(210,153,34,.2); color: #ffd479; border: 1px solid rgba(210,153,34,.5);
}
.notice p { margin: 0; font-size: 12px; color: #e8d9b4; max-width: 110ch; }
.notice-sub { font-size: 11px; color: var(--dim); margin: 8px 4px 0; max-width: 120ch; line-height: 1.5; }

/* ---------------- drawers ---------------- */
.drawer { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 20px; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(4,7,13,.72); backdrop-filter: blur(3px); }
.drawer-card {
  position: relative; width: min(760px, 100%); max-height: min(88vh, 900px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0e1829, #0a1220);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  animation: rise .18s ease;
}
@keyframes rise { from { transform: translateY(10px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 15px; }
.drawer-head p { margin: 2px 0 0; }
.drawer-head .badge { margin-left: auto; }
.drawer-body { padding: 16px; overflow: auto; }

.tabs { display: flex; gap: 5px; margin-bottom: 13px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: #0b1524; border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; background: rgba(47,129,247,.18); border-color: rgba(47,129,247,.55); }
.tabpane { display: none; }
.tabpane.active { display: block; }

.callout { font-size: 11.5px; line-height: 1.5; padding: 10px 12px; border-radius: 9px; margin-bottom: 13px; }
.callout-warn { background: rgba(210,153,34,.09); border: 1px solid rgba(210,153,34,.35); color: #ecd9ac; }
.callout-info { background: rgba(47,129,247,.08); border: 1px solid rgba(47,129,247,.3); color: #bcd8f7; }

.result-box {
  margin-top: 11px; padding: 10px 12px; border-radius: 9px; font-size: 11.5px;
  background: #0a1424; border: 1px solid var(--line); color: var(--muted);
}
.result-box b { color: var(--text); }
.result-box .big { font-size: 20px; font-family: var(--mono); color: #fff; }
.row-actions { display: flex; gap: 8px; margin: 9px 0; flex-wrap: wrap; align-items: center; }
.filebtn { font-size: 12px; color: var(--accent-2); cursor: pointer; text-decoration: underline; }
.code-example { font-family: var(--mono); font-size: 11px; color: #9ecbff; background: #0a1424; border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; }
.mini-table thead th { position: static; background: #101b2d; }
.prose h3 { font-size: 13px; margin: 16px 0 6px; color: #cfe0f5; }
.prose h3:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 12px; color: var(--muted); line-height: 1.6; }
.prose ul { padding-left: 18px; margin: 6px 0; }

/* ---------------- responsive ---------------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 260px minmax(0,1fr) 280px; }
}
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: auto;
    grid-template-areas: "center" "left" "right" "table";
    height: auto;
  }
  .map-shell { height: min(70vh, 520px); }
  .tableSection { height: 420px; }
  .panel { max-height: none; }
  .panel-left, .panel-right { order: 2; }
  .center { order: 1; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand-text p { display: none; }
}
@media (max-width: 640px) {
  .map-legend { font-size: 9.5px; padding: 6px 8px; max-width: 172px; }
  .hud-pill.muted { display: none; }
  .topbar-status { width: 100%; margin-left: 0; justify-content: flex-start; }
  .topbar-actions { width: 100%; }
  .status-strip { flex-wrap: wrap; }
  .drawer { padding: 0; }
  .drawer-card { max-height: 100vh; border-radius: 0; width: 100%; }
}

/* clickable HUD pills */
.hud-btn { cursor: pointer; font: inherit; font-size: 10.5px; color: var(--accent-2); border-color: rgba(47,129,247,.45); }
.hud-btn:hover { background: rgba(47,129,247,.18); color: #fff; }
