/* Earthwatch - situational awareness console
   Identity: deep blue-black field, monospace telemetry, a four-step severity
   spectrum (low->critical) instead of one accent. Signature: the live wire with
   severity pulses. Everything else stays quiet. */

:root {
  --bg: #05060C;
  --bg-2: #0A0F1C;
  --panel: rgba(11, 16, 27, 0.86);
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.06);
  --ink: #E6EDF3;
  --mute: #7D8BA0;
  --brand: #6FE9FF;   /* SpaceSphere signature cyan (from spacesphere.sygnito.com); single point of truth */

  --sev-low: #2CC6FF;       /* SpaceSphere fog palette: blue / amber / orange / pink-red */
  --sev-elevated: #FFD64B;
  --sev-high: #FF8A3D;
  --sev-critical: #FF4D67;

  --mono: "Space Mono", ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#map { position: fixed; inset: 0; z-index: 0; background: var(--bg); }
/* Recolor the CARTO dark basemap toward the SpaceSphere deep-space blue so the map
   no longer reads identical to WorldMonitor. Only tiles are filtered; markers, borders
   and the day/night overlay live in other panes and keep their true colors. Tunable in one line. */
.leaflet-tile-pane { filter: brightness(0.92) sepia(0.65) hue-rotate(182deg) saturate(1.3); }

/* EW-LBL1: labels ride in their own pane above the imagery; brighten them so place and
   country names stay legible (they do not inherit the tilePane deep-space recolor). Tunable in one line. */
.leaflet-labels-pane { filter: brightness(1.55) contrast(1.05); }

.muted { color: var(--mute); }

/* ---------- severity helpers ---------- */
.sev-low    { --sv: var(--sev-low); }
.sev-elevated { --sv: var(--sev-elevated); }
.sev-high   { --sv: var(--sev-high); }
.sev-critical { --sv: var(--sev-critical); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sv, var(--mute));
  box-shadow: 0 0 8px var(--sv, transparent); display: inline-block; flex: none; }

/* ---------- top bar ---------- */
.ew-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(7, 11, 16, 0.94), rgba(7, 11, 16, 0.55) 70%, transparent);
  border-bottom: 1px solid var(--line-2);
}
.ew-brand { display: flex; align-items: baseline; gap: 10px; }
a.ew-brand { text-decoration: none; color: inherit; cursor: pointer; }
a.ew-brand:focus-visible { outline: 2px solid #6fe9ff; outline-offset: 3px; }
.ew-glyph { width: 12px; height: 12px; border-radius: 50%; align-self: center; flex: none;
  background: var(--brand); box-shadow: 0 0 10px color-mix(in srgb, var(--brand) 70%, transparent); position: relative; }
.ew-glyph::after { content: ""; position: absolute; inset: -5px; border: 1px solid var(--brand);
  border-radius: 50%; opacity: .35; animation: ring 3s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.7); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
.ew-brand-name { font-family: var(--mono); font-weight: 700; letter-spacing: .22em; font-size: 15px; }
.ew-brand-sub { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: none; color: var(--mute); }

.ew-tabs { display: flex; gap: 4px; margin-left: 8px; }
.ew-tab {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  color: var(--mute); background: transparent; border: 1px solid transparent;
  padding: 7px 12px; border-radius: 8px; cursor: pointer; transition: .2s;
}
.ew-tab:hover { color: var(--ink); }
.ew-tab.is-active { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  background: color-mix(in srgb, var(--brand) 10%, transparent); }

.ew-status { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.ew-live { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono);
  font-size: 11px; letter-spacing: .16em; color: var(--sev-critical); }
.ew-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--sev-critical);
  box-shadow: 0 0 10px var(--sev-critical); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.ew-clock { font-family: var(--mono); font-size: 12.5px; color: var(--ink); letter-spacing: .06em; }

/* NAV-2 W4: SpaceSphere nav group (leave Earthwatch, back into the app). Own
   palette and fonts; the house icon matches the React header with a CSS-only
   line-draw. Placed after ew-status as a distinct top-right cluster. */
.ew-ss-nav {
  display: flex; align-items: center; gap: 10px;
  margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--line);
}
.ew-home {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  color: var(--ink); text-decoration: none;
  transition: color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.ew-home-glyph { width: 24px; height: 24px; }
.ew-home-glyph path {
  stroke-dasharray: 1; stroke-dashoffset: 0;
  animation: ew-home-draw .6s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes ew-home-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.ew-home:hover {
  color: var(--brand); transform: translateY(-1px);
  box-shadow: 0 4px 16px -4px color-mix(in srgb, var(--brand) 42%, transparent);
}
.ew-home:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ew-ss-link {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--mute);
  text-decoration: none; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}
.ew-ss-link:hover {
  color: var(--ink); border-color: color-mix(in srgb, var(--brand) 35%, transparent);
  background: rgba(255, 255, 255, 0.04); transform: translateY(-1px);
}
.ew-ss-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 760px) {
  .ew-ss-nav { margin-left: 0; padding-left: 0; border-left: none; }
}

/* ---------- left dock ---------- */
.ew-dock {
  position: fixed; top: 74px; left: 14px; z-index: 20;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); backdrop-filter: blur(10px);
}
.ew-mod {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--ink); background: transparent; border: 1px solid transparent;
  padding: 9px 12px; border-radius: 8px; cursor: pointer; text-align: left; transition: .2s;
}
.ew-mod:hover { background: rgba(255, 255, 255, 0.05); }
.ew-mod.is-active { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.ew-mod.is-soon { color: var(--mute); cursor: not-allowed; opacity: .55; }
.ew-mod.is-soon::after { content: " soon"; font-size: 8px; opacity: .7; }

/* ---------- right controls ---------- */
.ew-controls {
  position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 20;
  display: flex; flex-direction: column; gap: 8px;
}
.ew-ctrl {
  width: 42px; height: 42px; border-radius: 10px; font-size: 20px; line-height: 1;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; backdrop-filter: blur(10px); transition: .2s;
}
.ew-ctrl:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }

/* ---------- panels ---------- */
.ew-panel {
  position: fixed; z-index: 25; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.ew-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--brand); padding: 13px 15px; border-bottom: 1px solid var(--line-2);
}
.ew-x { background: transparent; border: 0; color: var(--mute); font-size: 18px; cursor: pointer; line-height: 1; }
.ew-x:hover { color: var(--ink); }

/* wire panel */
.ew-wire { top: 74px; right: 14px; width: min(384px, 92vw); bottom: 58px; display: flex; flex-direction: column; }
.ew-counts { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 15px 4px; }
.cnt { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; padding: 4px 9px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--mute); }
.cnt.total { color: var(--ink); }
.cnt.sev-critical { color: var(--sev-critical); border-color: color-mix(in srgb, var(--sev-critical) 45%, transparent); }
.cnt.sev-high { color: var(--sev-high); border-color: color-mix(in srgb, var(--sev-high) 45%, transparent); }
.cnt.sev-elevated { color: var(--sev-elevated); border-color: color-mix(in srgb, var(--sev-elevated) 45%, transparent); }
.ew-search {
  margin: 10px 15px; padding: 10px 12px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  color: var(--ink); font-family: var(--sans); font-size: 13px;
}
.ew-search::placeholder { color: var(--mute); }
.ew-search:focus { outline: none; border-color: color-mix(in srgb, var(--brand) 50%, transparent); }

.ew-list { list-style: none; overflow-y: auto; flex: 1; padding: 4px 8px 8px; }
.wire-item {
  display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px;
  cursor: pointer; border-left: 2px solid var(--sv, var(--mute)); transition: background .15s;
}
.wire-item:hover, .wire-item:focus { background: rgba(255, 255, 255, 0.05); outline: none; }
.wi-sev {
  font-family: var(--mono); font-size: 11px; font-weight: 700; width: 20px; height: 20px; flex: none;
  display: grid; place-items: center; border-radius: 6px; color: var(--bg);
  background: var(--sv, var(--mute));
}
.wi-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wi-title { font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wi-meta { font-family: var(--mono); font-size: 10px; color: var(--mute); letter-spacing: .04em; }
.wire-empty { color: var(--mute); font-size: 13px; padding: 20px 12px; line-height: 1.5; }

.ew-detail { border-top: 1px solid var(--line-2); padding: 14px 15px; }
.det-sev { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--sv); margin-bottom: 6px; }
.det-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.det-sum { font-size: 13px; color: var(--mute); line-height: 1.5; margin-bottom: 12px; }
.det-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.det-meta dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.det-meta dd { font-size: 12.5px; }
.det-link { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 11px; color: var(--brand); }

/* aftermath aerial imagery control (M-OAM1), injected into the detail card */
.ew-oam { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.ew-oam-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ew-oam-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.ew-oam-count { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.ew-oam-note { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--ink); margin-top: 3px; }
.ew-oam-btn { margin-top: 10px; width: 100%; padding: 7px 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--bg); background: var(--brand); border: 0; border-radius: 8px; cursor: pointer; }
.ew-oam-btn.ew-oam-close { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.ew-oam-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.ew-oam-oplab { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.ew-oam-op { flex: 1; accent-color: var(--brand); }
.ew-oam-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.ew-oam-step { font-family: var(--mono); font-size: 13px; line-height: 1; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.ew-oam-step[disabled] { opacity: .35; cursor: default; }
.ew-oam-pos { font-family: var(--mono); font-size: 10.5px; color: var(--ink); }
.ew-oam-attrib { font-family: var(--mono); font-size: 10px; line-height: 1.5; color: var(--mute); margin-top: 10px; }

/* imagery source toggle (M-OAM3): OAM vs Sentinel-2 */
.ew-oam-src { display: flex; gap: 6px; margin-top: 10px; }
.ew-oam-srcbtn { flex: 1; padding: 6px 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.ew-oam-srcbtn.is-active { color: var(--bg); background: var(--brand); border-color: var(--brand); }

/* ---------- aerial imagery index (M-OAM2) ---------- */
.ew-imagery { left: 14px; top: 74px; width: min(340px, 92vw); bottom: 96px; display: flex; flex-direction: column; }
.ew-imagery-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--mute); padding: 8px 15px 4px; }
.ew-imagery-list { list-style: none; margin: 0; padding: 6px 8px; overflow-y: auto; }
.ew-imagery-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ew-imagery-item:hover, .ew-imagery-item:focus { background: var(--line-2); outline: none; }
.ew-imagery-name { font-size: 13px; color: var(--ink); }
.ew-imagery-meta { font-family: var(--mono); font-size: 10px; letter-spacing: .05em; color: var(--mute); }
.ew-imagery-empty { list-style: none; font-family: var(--mono); font-size: 10.5px; color: var(--mute); padding: 10px; }
.ew-oam-float {
  position: fixed; left: 14px; bottom: 96px; z-index: 30; width: min(300px, 92vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8); backdrop-filter: blur(14px); padding: 13px 15px;
}
@media (max-width: 640px) {
  .ew-imagery { left: 8px; right: 8px; width: auto; }
  .ew-oam-float { left: 8px; right: 8px; width: auto; }
}

/* layers panel */
.ew-layers { top: 74px; left: 14px; width: min(320px, 92vw); max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.ew-lyr-body { overflow-y: auto; padding-bottom: 10px; }
.ew-lyr { display: flex; align-items: center; gap: 10px; padding: 9px 15px; font-size: 13px; cursor: pointer; }
.ew-lyr input { accent-color: var(--brand); }
.ew-lyr em { font-family: var(--mono); font-size: 10px; color: var(--mute); font-style: normal; margin-left: auto; letter-spacing: .05em; }
.ew-lyr.is-soon { opacity: .5; cursor: not-allowed; }
.ew-lyr-sep { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mute); padding: 12px 15px 6px; border-top: 1px solid var(--line-2); margin-top: 6px; }

/* globe note (non-blocking card, map stays interactive behind it) */
.ew-globe-note {
  position: fixed; left: 50%; top: 92px; transform: translateX(-50%); z-index: 26;
  width: min(480px, 92vw); padding: 18px 22px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); backdrop-filter: blur(12px); text-align: center;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.ew-globe-note .ew-x { position: absolute; top: 8px; right: 12px; }
.ew-globe-note p { font-family: var(--mono); font-size: 12.5px; line-height: 1.85; color: var(--ink);
  letter-spacing: .03em; }
.ew-globe-note strong { color: var(--brand); }

/* ticker */
.ew-ticker {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 40px; overflow: hidden;
  display: flex; align-items: center;
  background: linear-gradient(0deg, rgba(7, 11, 16, 0.96), rgba(7, 11, 16, 0.5));
  border-top: 1px solid var(--line-2);
}
.ew-ticker-track { display: inline-flex; align-items: center; gap: 14px; white-space: nowrap;
  padding-left: 100%; animation: ticker 200s linear infinite; }
.ew-ticker:hover .ew-ticker-track { animation-play-state: paused; }
.tk { font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: var(--sv, var(--ink)); }
.tk[data-id] { cursor: pointer; transition: filter .15s; }
.tk[data-id]:hover { filter: brightness(1.3); text-decoration: underline; text-underline-offset: 3px; }
.tk-dot { color: var(--mute); }
@keyframes ticker { to { transform: translateX(-100%); } }

/* offline banner */
.ew-banner {
  position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%); z-index: 30;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  color: #ffdca8; background: rgba(60, 40, 12, 0.9); border: 1px solid rgba(245, 197, 66, 0.4);
  padding: 8px 14px; border-radius: 999px; max-width: 92vw; text-align: center;
}

/* ---------- markers ---------- */
.sig { position: relative; display: block; width: 22px; height: 22px; }
.sig i { position: absolute; inset: 0; margin: auto; width: 9px; height: 9px; border-radius: 50%;
  background: var(--sv); box-shadow: 0 0 10px var(--sv); }
.sig.lvl-2 i { width: 11px; height: 11px; }
.sig.lvl-3 i { width: 13px; height: 13px; }
.sig::before { content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px;
  border-radius: 50%; border: 1px solid var(--sv); opacity: .35; }
.sig.is-crit::before { animation: sigPulse 1.8s ease-out infinite; }
@keyframes sigPulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }

/* ---------- Leaflet dark overrides ---------- */
.leaflet-container { background: var(--bg); font-family: var(--sans); }
.leaflet-control-attribution {
  background: rgba(7, 11, 16, 0.7) !important; color: var(--mute) !important;
  font-size: 10px !important; font-family: var(--mono);
}
.leaflet-control-attribution a { color: var(--brand) !important; }
.leaflet-popup-content-wrapper {
  background: var(--bg-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
}
.leaflet-popup-tip { background: var(--bg-2); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; font-family: var(--sans); }
.leaflet-popup-close-button { color: var(--mute) !important; }
.pop-sev { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--sv); margin-bottom: 5px; }
.pop-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; line-height: 1.3; }
.pop-sum { font-size: 12.5px; color: var(--mute); line-height: 1.5; margin-bottom: 7px; }
.pop-meta { font-family: var(--mono); font-size: 10px; color: var(--mute); }
.pop-link { margin-top: 6px; font-family: var(--mono); font-size: 11px; }
.pop-link a { color: var(--brand); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .ew-brand-sub { display: none; }
  .ew-tabs { display: none; }
  .ew-wire { left: 8px; right: 8px; width: auto; top: auto; bottom: 46px; height: 46vh; }
  .ew-layers { left: 8px; right: 8px; width: auto; }
  .ew-controls { top: auto; bottom: 92px; transform: none; }
  .ew-dock { top: auto; bottom: 46px; left: 8px; flex-direction: row; flex-wrap: wrap; }
}

/* ---------- a11y ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  .ew-ticker-track { animation: none; padding-left: 12px; }
  .ew-glyph::after, .ew-live i, .sig.is-crit::before { animation: none; }
  .ew-home-glyph path { animation: none; stroke-dashoffset: 0; }
  .ew-home:hover, .ew-ss-link:hover { transform: none; }
}

/* ---------- time range bar ---------- */
.ew-range {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); backdrop-filter: blur(10px);
}
.ew-range button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--mute);
  background: transparent; border: 0; padding: 6px 13px; border-radius: 999px; cursor: pointer; transition: .2s;
}
.ew-range button:hover { color: var(--ink); }
.ew-range button.is-active { color: var(--bg); background: var(--brand); font-weight: 700; }

/* ---------- country panel ---------- */
.ew-country { left: 14px; top: 74px; width: min(360px, 92vw); bottom: 58px; display: flex; flex-direction: column; }
.ew-cfacts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 14px 15px 6px; }
.ew-cfacts dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.ew-cfacts dd { font-size: 13px; }
.ew-note {
  margin: 8px 15px 14px; padding: 10px 12px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-2);
  font-size: 11.5px; line-height: 1.55; color: var(--mute);
}
.cty-sig { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border-left: 2px solid var(--sv, var(--mute)); font-size: 12.5px; }
.cty-sig:hover, .cty-sig:focus { background: rgba(255, 255, 255, 0.05); outline: none; }
.cty-sig .dot { background: var(--sv); box-shadow: 0 0 8px var(--sv); }
.cty-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cty-sig em { font-family: var(--mono); font-size: 9.5px; color: var(--mute); font-style: normal; flex: none; }
.cty-empty { color: var(--mute); font-size: 12.5px; padding: 14px 12px; line-height: 1.5; }

@media (max-width: 760px) {
  .ew-range { top: 58px; }
  .ew-country { left: 8px; right: 8px; width: auto; top: 96px; bottom: 46px; }
}

/* ---------- M-I1: reference layers, legend, command palette ---------- */
.ew-cmd { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--mute);
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.ew-cmd:hover { color: var(--ink); border-color: var(--brand); }

/* categorized layer picker */
.ew-lyr-cat { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand); padding: 12px 15px 4px; display: flex; align-items: baseline; gap: 8px; }
.ew-lyr-hint { color: var(--mute); letter-spacing: .04em; text-transform: none; font-size: 9px; }
.dia { width: 9px; height: 9px; flex: none; display: inline-block; transform: rotate(45deg);
  background: var(--rc, var(--mute)); box-shadow: 0 0 7px var(--rc, transparent); }
.dline { width: 14px; height: 0; flex: none; display: inline-block;
  border-top: 2px dashed var(--rc, var(--mute)); }
.dnw { width: 10px; height: 10px; flex: none; border-radius: 50%; display: inline-block;
  background: linear-gradient(90deg, #cfd8e6 0 50%, #0a1018 50% 100%); border: 1px solid var(--line); }

/* reference markers on the map (diamonds, distinct from live circles) */
.refm { width: 11px; height: 11px; display: block; transform: rotate(45deg);
  background: var(--rc, var(--mute)); border: 1px solid rgba(255,255,255,0.85);
  box-shadow: 0 0 8px var(--rc, transparent); }
.pop-ref .pop-refhead { color: var(--rc, var(--brand)); }

/* legend */
.ew-legend { border-top: 1px solid var(--line-2); margin-top: 6px; }
.ew-leg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; padding: 4px 15px 8px; }
.ew-leg-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink); }
.ew-leg-note { padding: 0 15px 12px; font-size: 10.5px; line-height: 1.5; color: var(--mute); }

/* command palette */
.ew-pal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; }
.ew-pal-back { position: absolute; inset: 0; background: rgba(3,6,11,0.62); backdrop-filter: blur(2px); }
.ew-pal-box { position: relative; margin-top: 12vh; width: min(560px, 92vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 24px 70px rgba(0,0,0,0.6); overflow: hidden; }
.ew-pal-input { width: 100%; box-sizing: border-box; border: 0; outline: none;
  padding: 16px 18px; font-size: 15px; color: var(--ink); background: transparent;
  border-bottom: 1px solid var(--line-2); font-family: var(--sans); }
.ew-pal-input::placeholder { color: var(--mute); }
.ew-pal-list { list-style: none; margin: 0; padding: 6px; max-height: 46vh; overflow-y: auto; }
.pal-item { padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; gap: 10px; }
.pal-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-tag { flex: none; font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  color: var(--mute); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.pal-item.is-active { background: rgba(52,225,176,0.14); color: #fff; }
.pal-item.is-active .pal-tag { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.pal-item:hover { background: rgba(255,255,255,0.05); }
.pal-empty { padding: 14px 12px; color: var(--mute); font-size: 13px; }
.ew-pal-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--mute); }

/* ---------- M-I2: open-data layers ---------- */
.cir { width: 8px; height: 8px; flex: none; border-radius: 50%; display: inline-block;
  background: var(--rc, var(--mute)); box-shadow: 0 0 7px var(--rc, transparent); opacity: .9; }
.ew-lyr.is-loading em { color: var(--brand); }
.ew-lyr.is-loading em::after { content: ' loading...'; }
.ew-lyr.is-err em { color: var(--sev-critical); }
.ew-lyr.is-err em::after { content: ' unreachable'; }

/* ---------- M-I2: chokepoints panel + timeline ---------- */
.ew-chokes { left: 14px; top: 74px; width: min(340px, 92vw); bottom: 96px; display: flex; flex-direction: column; }
.ew-chokes-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--mute); padding: 8px 15px 4px; }
.ew-chokes-list { list-style: none; margin: 0; padding: 6px 8px; overflow-y: auto; }
.choke-item { padding: 9px 10px; border-radius: 8px; cursor: pointer; border-left: 2px solid var(--sev-high);
  display: flex; flex-direction: column; gap: 2px; }
.choke-item:hover, .choke-item:focus { background: rgba(255,255,255,0.05); outline: none; }
.choke-name { font-size: 13px; font-weight: 600; }
.choke-d { font-size: 11.5px; color: var(--mute); line-height: 1.45; }

.ew-timeline { position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%); z-index: 21;
  display: flex; align-items: center; gap: 10px; padding: 6px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); width: min(440px, 92vw); }
.ew-tl-play { flex: none; width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,0.05); color: var(--ink); font-size: 11px; line-height: 1; }
.ew-tl-play:hover { border-color: var(--brand); color: var(--brand); }
.ew-tl-range { flex: 1; accent-color: var(--brand); cursor: pointer; }
.ew-tl-label { flex: none; min-width: 96px; text-align: right; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .05em; color: var(--mute); }
.ew-tl-label.is-live { color: var(--brand); }

@media (max-width: 760px) {
  .ew-chokes { left: 8px; right: 8px; width: auto; }
  .ew-timeline { bottom: 44px; }
}

/* ---------- M-I3: layer guide ---------- */
.ew-head-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.ew-guide-btn { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); background: rgba(52,225,176,0.10); border: 1px solid rgba(52,225,176,0.35);
  border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.ew-guide-btn:hover { background: rgba(52,225,176,0.18); }
.ew-guide { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; }
.ew-guide-back { position: absolute; inset: 0; background: rgba(3,6,11,0.62); backdrop-filter: blur(2px); }
.ew-guide-box { position: relative; margin-top: 10vh; width: min(560px, 94vw); max-height: 78vh;
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: 0 24px 70px rgba(0,0,0,0.6); overflow: hidden; }
.ew-guide-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid var(--line-2); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.ew-guide-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.guide-cat { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand); padding: 12px 10px 4px; }
.guide-item { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); }
.guide-item:last-child { border-bottom: 0; }
.guide-t { font-size: 13.5px; font-weight: 600; }
.guide-d { font-size: 12.5px; color: var(--ink); line-height: 1.5; margin-top: 2px; }
.guide-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 5px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .03em; color: var(--mute); }
.guide-lim { font-size: 11.5px; color: var(--sev-elevated); margin-top: 4px; }

/* ---------- M-I4: interactive filters ---------- */
.cnt { background: transparent; cursor: pointer; }
.cnt:hover { border-color: currentColor; }
.cnt.is-active { background: rgba(255,255,255,0.09); box-shadow: inset 0 0 0 1px currentColor; }
.ew-catfilter { padding: 0 15px; }
.catfilter-head { display: flex; align-items: center; gap: 8px; padding: 6px 0 2px; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--mute); }
.catfilter-head > span:first-child { flex: 1; }
.catfilter-caret { color: var(--brand); }
.catfilter-reset { color: var(--sev-high); border: 1px solid color-mix(in srgb, var(--sev-high) 40%, transparent);
  border-radius: 6px; padding: 1px 6px; }
.catfilter-chips { display: none; flex-wrap: wrap; gap: 5px; padding: 4px 0 8px; }
.catfilter-chips.is-open { display: flex; }
.catchip { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.04); color: var(--ink); cursor: pointer; }
.catchip i { color: var(--mute); font-style: normal; font-size: 9.5px; }
.catchip.is-off { opacity: 0.4; text-decoration: line-through; }
.catchip:hover { border-color: var(--brand); }

/* ---------- top toolbar (M-I4: surfaced actions) ---------- */
.ew-toolbar { display: flex; align-items: center; gap: 4px; padding-left: 12px;
  margin-left: 4px; border-left: 1px solid var(--line-2); }
.ew-tool { font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--mute); background: transparent; border: 1px solid transparent;
  padding: 7px 12px; border-radius: 8px; cursor: pointer; transition: .2s; }
.ew-tool:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.ew-tool.is-active { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  background: color-mix(in srgb, var(--brand) 10%, transparent); }
.ew-tool-cmd { color: var(--ink); border-color: var(--line); letter-spacing: .04em; }
.ew-tool-cmd:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.wire-clear { font-family: var(--mono); font-size: 11px; color: var(--brand);
  background: transparent; border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  border-radius: 6px; padding: 3px 9px; margin-top: 6px; cursor: pointer; }
.wire-clear:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
@media (max-width: 900px) {
  .ew-brand-sub { display: none; }
  .ew-top { flex-wrap: wrap; gap: 10px; }
  .ew-toolbar { border-left: none; padding-left: 0; margin-left: 0; }
}

/* ---------- live TV panel ---------- */
.ew-tv { left: 14px; top: 74px; width: min(440px, 94vw); display: flex; flex-direction: column; }
.tv-tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 12px 14px 6px; }
.tv-tab { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; color: var(--mute);
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer; transition: .2s; }
.tv-tab:hover { color: var(--ink); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.tv-tab.is-active { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  background: color-mix(in srgb, var(--brand) 12%, transparent); }
.tv-player { position: relative; margin: 6px 14px 0; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: #000; border: 1px solid var(--line); }
.tv-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tv-prompt { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 0 20px;
  color: var(--mute); font-size: 12.5px; }
.tv-open { display: inline-block; align-self: flex-start; margin: 10px 14px 0; font-family: var(--mono);
  font-size: 11px; color: var(--brand); text-decoration: none; border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  border-radius: 7px; padding: 5px 11px; }
.tv-open:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.tv-note { margin: 10px 14px 14px; font-size: 10.5px; line-height: 1.5; color: var(--mute); }
@media (max-width: 640px) { .ew-tv { left: 8px; right: 8px; width: auto; } }
