/* ==========================================================================
   EW Triangulator

   Visual direction: an aeronautical night chart rather than a hacker terminal.
   The base is a deep desaturated chart navy, not black, so the CARTO basemap
   sits inside the shell instead of floating on it. Two signal colours carry all
   the meaning: amber for denial, violet for deception. Everything else is
   hairlines and cool paper-white ink, because on a monitoring screen the only
   things that should attract the eye are the things that changed.
   ========================================================================== */

:root {
  --base:       #0B1017;
  --base-2:     #0E141D;
  --panel:      #121A24;
  --panel-2:    #16202C;
  --rule:       #1E2A38;
  --rule-soft:  #18222E;
  --ink:        #C6D4E1;
  --ink-dim:    #91A5B8;
  --muted:      #6B8095;
  --faint:      #46586B;

  --jam:        #F2A33C;   /* denial  */
  --spoof:      #B36BE8;   /* deception */
  --mixed:      #E4572E;   /* both */
  --nominal:    #7FA6C9;   /* healthy traffic */
  --ok:         #4FB286;
  --ghost:      #56708A;

  --display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --bar-h: 46px;
  --status-h: 26px;
  --rail-w: 372px;
  --r: 2px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--display);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-rows: var(--bar-h) 1fr var(--status-h);
}

::selection { background: rgba(242, 163, 60, .28); }

.scroll { overflow-y: auto; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }
.scroll::-webkit-scrollbar-thumb:hover { background: #2A394B; }

:focus-visible {
  outline: 1px solid var(--jam);
  outline-offset: 1px;
}

/* ── Bars ───────────────────────────────────────────────────────────── */
.bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  background: var(--base-2);
  border-bottom: 1px solid var(--rule);
  z-index: 900;
}

.bar--bottom {
  border-bottom: 0;
  border-top: 1px solid var(--rule);
  gap: 20px;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .07em;
  color: var(--faint);
  overflow: hidden;
  white-space: nowrap;
}

.bar__group { display: flex; align-items: center; gap: 8px; }
.bar__group--end { margin-left: auto; }

/* ── Identity ───────────────────────────────────────────────────────── */
.ident { display: flex; align-items: center; gap: 10px; padding-right: 16px;
         border-right: 1px solid var(--rule); height: 100%; }
.ident__mark { width: 26px; height: 26px; }
.ident__ring { fill: none; stroke: var(--jam); stroke-width: 1.1; opacity: .55; }
.ident__dot  { fill: var(--jam); }
.ident__sweep {
  stroke: var(--jam); stroke-width: 1.4; stroke-linecap: round;
  transform-origin: 16px 16px;
  animation: sweep 5.5s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.ident__text { display: flex; flex-direction: column; line-height: 1.15; }
.ident__name {
  font-weight: 700; font-size: 13px; letter-spacing: .16em; color: var(--ink);
}
.ident__sub {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  color: var(--faint); text-transform: uppercase;
}

/* ── Fields & buttons ───────────────────────────────────────────────── */
.field { display: flex; align-items: center; gap: 7px; }
.field__label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em;
  color: var(--faint); text-transform: uppercase;
}
.field__input {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  color: var(--ink);
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 26px 5px 9px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.field__input:hover { border-color: #2C3D50; }
.field__input--slim { padding: 3px 24px 3px 7px; font-size: 11px; }

.btn {
  appearance: none;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  color: var(--ink-dim);
  font-family: var(--display); font-size: 12px; font-weight: 500;
  letter-spacing: .04em;
  padding: 6px 11px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .12s, color .12s, background .12s;
}
.btn:hover { border-color: #33465C; color: var(--ink); background: var(--panel-2); }
.btn:active { transform: translateY(.5px); }
.btn.is-active { border-color: var(--jam); color: var(--jam); }

.btn__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.btn--toggle.is-on { color: var(--ink); }
.btn--toggle.is-on .btn__dot { background: var(--ok); box-shadow: 0 0 6px rgba(79,178,134,.7); }

.btn--wide { justify-content: center; width: 100%; padding: 9px; }

/* ── Stage ──────────────────────────────────────────────────────────── */
.stage { position: relative; overflow: hidden; }
.stage__map { position: absolute; inset: 0; background: var(--base); }

.leaflet-container { background: #080C12; font-family: var(--mono); }
.leaflet-control-attribution {
  background: rgba(11,16,23,.82) !important;
  color: var(--faint) !important;
  font-size: 9px !important;
  font-family: var(--mono);
  border-top-left-radius: var(--r);
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--ink-dim) !important;
  border-color: var(--rule) !important;
  border-radius: var(--r) !important;
}
.leaflet-control-zoom a:hover { color: var(--jam) !important; }

/* ── Legend ─────────────────────────────────────────────────────────── */
.legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 620;
  background: rgba(14,20,29,.9);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 9px 11px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
  color: var(--ink-dim);
  backdrop-filter: blur(6px);
}
.legend__row { display: flex; align-items: center; gap: 7px; line-height: 1.75; }
.swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.swatch--jam   { background: var(--jam); }
.swatch--spoof { background: var(--spoof); }
.swatch--mixed { background: var(--mixed); }
.swatch--ac    { background: var(--nominal); border-radius: 50%; }
.swatch--acbad { background: var(--mixed); border-radius: 50%; }
.swatch--ghost { background: transparent; border: 1px dashed var(--ghost); border-radius: 50%; }

/* ── Intelligence rail ──────────────────────────────────────────────── */
.rail {
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--rail-w);
  z-index: 640;
  display: flex; flex-direction: column;
  background: rgba(11,16,23,.94);
  border-left: 1px solid var(--rule);
  backdrop-filter: blur(10px);
}

.rail__tabs { display: flex; border-bottom: 1px solid var(--rule); flex: none; }
.tab {
  appearance: none; flex: 1;
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  padding: 11px 4px 9px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--ink-dim); }
.tab.is-active { color: var(--jam); border-bottom-color: var(--jam); }

.panel { display: none; flex-direction: column; min-height: 0; flex: 1; }
.panel.is-active { display: flex; }

.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 14px 9px; flex: none;
}
.panel__title {
  margin: 0;
  font-size: 11px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-dim);
}
.pill {
  font-family: var(--mono); font-size: 10px;
  border: 1px solid var(--rule); border-radius: 9px;
  padding: 1px 8px; color: var(--muted);
}

.panel .scroll { padding: 0 10px 14px; flex: 1; min-height: 0; }

/* ── Zone cards ─────────────────────────────────────────────────────── */
.zone {
  border: 1px solid var(--rule);
  border-left: 2px solid var(--muted);
  border-radius: var(--r);
  background: var(--panel);
  padding: 10px 11px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.zone:hover { background: var(--panel-2); border-color: #2B3B4E; }
.zone[data-class="JAMMING"]  { border-left-color: var(--jam); }
.zone[data-class="SPOOFING"] { border-left-color: var(--spoof); }
.zone[data-class="MIXED"]    { border-left-color: var(--mixed); }
.zone.is-new { animation: flash 1.6s ease-out; }
@keyframes flash {
  0%   { background: rgba(242,163,60,.22); }
  100% { background: var(--panel); }
}

.zone__top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.zone__cid {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; color: var(--ink);
}
.zone__class {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.zone__sev {
  margin-left: auto;
  font-family: var(--mono); font-size: 15px; font-weight: 600; line-height: 1;
}
.zone[data-class="JAMMING"]  .zone__sev { color: var(--jam); }
.zone[data-class="SPOOFING"] .zone__sev { color: var(--spoof); }
.zone[data-class="MIXED"]    .zone__sev { color: var(--mixed); }

.zone__meter { height: 2px; background: var(--rule-soft); margin-bottom: 8px; }
.zone__meter i { display: block; height: 100%; background: currentColor; }
.zone[data-class="JAMMING"]  .zone__meter { color: var(--jam); }
.zone[data-class="SPOOFING"] .zone__meter { color: var(--spoof); }
.zone[data-class="MIXED"]    .zone__meter { color: var(--mixed); }

.kv {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 4px 12px;
  font-family: var(--mono); font-size: 10.5px;
}
.kv div { display: flex; justify-content: space-between; gap: 6px; }
.kv span { color: var(--faint); }
.kv b { color: var(--ink-dim); font-weight: 500; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em;
  border: 1px solid var(--rule-soft); border-radius: 2px;
  padding: 1px 5px; color: var(--muted); white-space: nowrap;
}

/* ── Activity feed ──────────────────────────────────────────────────── */
.sparkline-wrap { padding: 0 14px 10px; flex: none; }
#sparkline { width: 100%; height: 46px; display: block; }
.sparkline-wrap__label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em;
  color: var(--faint);
}

.evt {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 9px; align-items: baseline;
  padding: 6px 4px;
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--mono); font-size: 10.5px;
  cursor: pointer;
}
.evt:hover { background: var(--panel); }
.evt__t { color: var(--faint); }
.evt__id { color: var(--ink); }
.evt__cs { color: var(--muted); }
.evt__k { color: var(--ink-dim); font-size: 9.5px; }
.evt__s { color: var(--jam); font-weight: 600; }
.evt.is-in { animation: slidein .3s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateX(8px); } }

.empty {
  padding: 26px 14px; text-align: center;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.7;
  color: var(--faint);
}
.empty b { display: block; color: var(--muted); margin-bottom: 4px; font-weight: 500; }

/* ── Inspector ──────────────────────────────────────────────────────── */
.inspector {
  position: absolute; left: 12px; top: 12px; z-index: 660;
  width: 300px; max-height: calc(100% - 24px);
  overflow-y: auto;
  background: rgba(14,20,29,.95);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 13px 14px;
  backdrop-filter: blur(10px);
}
.inspector__close {
  position: absolute; top: 6px; right: 8px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted); font-size: 19px; line-height: 1; padding: 2px 5px;
}
.inspector__close:hover { color: var(--ink); }
.inspector h3 {
  margin: 0 0 2px; font-size: 15px; font-weight: 600; letter-spacing: .06em;
}
.inspector__sub {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  margin-bottom: 10px; letter-spacing: .05em;
}
.inspector .kv { grid-template-columns: 1fr; gap: 3px; }
.inspector hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 10px 0; }

.ev-line {
  font-family: var(--mono); font-size: 10px;
  padding: 5px 7px; margin-bottom: 4px;
  border-left: 2px solid var(--mixed);
  background: rgba(228,87,46,.07);
  color: var(--ink-dim);
}
.ev-line b { color: var(--ink); font-weight: 500; letter-spacing: .05em; }
.ev-line em { font-style: normal; color: var(--faint); }

/* ── Status strip ───────────────────────────────────────────────────── */
.stat { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.stat b { color: var(--ink-dim); font-weight: 500; }
.stat--grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
              color: var(--jam); }
.stat__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--faint); flex: none;
}
.stat__dot.is-live { background: var(--ok); box-shadow: 0 0 6px rgba(79,178,134,.8); }
.stat__dot.is-down { background: var(--mixed); box-shadow: 0 0 6px rgba(228,87,46,.8); }

/* ── Settings drawer ────────────────────────────────────────────────── */
.drawer[hidden] { display: none; }
.drawer {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(5,8,12,.6);
  display: flex; justify-content: flex-end;
}
.drawer__panel {
  width: 420px; max-width: 92vw; height: 100%;
  background: var(--base-2);
  border-left: 1px solid var(--rule);
  display: flex; flex-direction: column;
  animation: slidepanel .18s ease-out;
}
@keyframes slidepanel { from { transform: translateX(24px); opacity: .4; } }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--rule); position: relative;
}
.drawer__body { padding: 16px; overflow-y: auto; flex: 1; }
.drawer__foot { display: grid; gap: 8px; margin-top: 20px;
                padding-top: 16px; border-top: 1px solid var(--rule); }

.setting { margin-bottom: 20px; }
.setting__label {
  display: block;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.setting__range { width: calc(100% - 74px); vertical-align: middle; accent-color: var(--jam); }
.setting__out {
  display: inline-block; width: 70px; text-align: right;
  font-family: var(--mono); font-size: 11.5px; color: var(--jam);
}
.setting__help {
  margin: 7px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--faint);
}

.switch { display: flex; align-items: center; gap: 9px; margin: 14px 0 0;
          font-size: 12.5px; color: var(--ink-dim); cursor: pointer; }
.switch input { accent-color: var(--jam); width: 15px; height: 15px; }

/* ── Toasts ─────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; right: 16px; bottom: 42px; z-index: 1400;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 290px; max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--jam);
  border-radius: var(--r);
  padding: 10px 13px;
  box-shadow: 0 8px 26px rgba(0,0,0,.55);
  animation: toastin .22s ease-out;
  cursor: pointer;
}
.toast--critical { border-left-color: var(--mixed); }
.toast--info { border-left-color: var(--nominal); }
.toast__title {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; color: var(--ink); margin-bottom: 4px;
}
.toast__body { font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.toast.is-out { animation: toastout .25s ease-in forwards; }
@keyframes toastin { from { opacity: 0; transform: translateX(18px); } }
@keyframes toastout { to { opacity: 0; transform: translateX(18px); } }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  :root { --rail-w: 320px; }
  .ident__sub { display: none; }
}
@media (max-width: 900px) {
  body { grid-template-rows: auto 1fr var(--status-h); }
  .bar--top { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .ident { border-right: 0; padding-right: 0; }
  .bar__group--end { margin-left: 0; }
  .rail {
    position: absolute; left: 0; right: 0; top: auto; bottom: 0;
    width: auto; height: 46%;
    border-left: 0; border-top: 1px solid var(--rule);
  }
  .legend { display: none; }
  .inspector { width: calc(100% - 24px); max-height: 44%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Patterns panel ─────────────────────────────────────────────────────── */
.sitebar {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  padding: 10px 14px 12px; border-bottom: 1px solid var(--rule);
}
.sitebar__f { display: flex; flex-direction: column; gap: 4px;
  font: 500 9.5px/1 var(--mono); letter-spacing: .10em;
  text-transform: uppercase; color: var(--muted); }
.sitebar__chk { display: flex; align-items: center; gap: 6px;
  font: 500 10px/1 var(--mono); color: var(--muted); cursor: pointer; }
.sitebar__note {
  margin: 0; padding: 10px 14px 12px;
  font: 400 11px/1.55 var(--display); color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

.site {
  padding: 12px 14px; border-bottom: 1px solid var(--rule);
  cursor: pointer; transition: background .15s ease;
}
.site:hover { background: rgba(127,166,201,.05); }
.site__top { display: flex; align-items: center; gap: 8px; }
.site__rank {
  width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%;
  display: grid; place-items: center; background: var(--rule);
  font: 600 9.5px/1 var(--mono); color: var(--ink);
}
.site__coord { flex: 1; font: 600 12px/1 var(--mono); color: var(--ink);
  letter-spacing: .02em; }
.site__score { font: 600 15px/1 var(--display); color: var(--mixed); }
.site__meter {
  height: 2px; margin: 8px 0 10px; background: var(--rule); overflow: hidden;
}
.site__meter i { display: block; height: 100%; background: var(--mixed); }

.kv--tight { gap: 3px 12px; }

.site__hours {
  display: flex; align-items: flex-end; gap: 1px;
  height: 26px; margin-top: 10px;
}
.site__hours i {
  flex: 1; background: var(--faint); min-height: 2px;
  border-radius: .5px;
}
.site__hoursaxis {
  display: flex; justify-content: space-between; margin-top: 3px;
  font: 400 8px/1 var(--mono); color: var(--faint);
}
.site__foot {
  margin-top: 9px; font: 400 9.5px/1 var(--mono); color: var(--faint);
}
.zone__why {
  margin: 8px 0 10px; font: 400 11px/1.5 var(--display); color: var(--muted);
}
.empty {
  padding: 22px 16px; margin: 0; text-align: center;
  font: 400 11.5px/1.6 var(--display); color: var(--muted);
}

/* ── Explainer ──────────────────────────────────────────────────────────── */
.tag--info { cursor: help; }
.tag--info:hover { border-color: var(--ink); color: var(--ink); }

.linkbtn {
  display: block; width: 100%; padding: 12px 14px; border: 0;
  background: none; color: var(--muted); cursor: pointer; text-align: left;
  font: 500 10.5px/1 var(--mono); letter-spacing: .04em;
  border-top: 1px solid var(--rule);
}
.linkbtn:hover { color: var(--ink); background: rgba(127,166,201,.05); }

.explain[hidden] { display: none; }
.explain {
  position: fixed; inset: 0; z-index: 1400;
  background: rgba(6,10,15,.72); display: grid; place-items: center;
  padding: 24px;
}
.explain__box {
  width: min(560px, 100%); max-height: 82vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--rule);
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.explain__top {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; background: var(--panel);
}
.explain__title {
  flex: 1; margin: 0; font: 600 14px/1.3 var(--display);
  color: var(--ink); letter-spacing: .01em;
}
.explain__x {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 4px;
}
.explain__x:hover { color: var(--ink); }
.explain__body { padding: 16px 18px 20px; }
.explain__body p {
  margin: 0 0 14px; font: 400 12.5px/1.65 var(--display); color: var(--muted);
}
.explain__what { color: var(--ink) !important; }
.explain__h {
  margin: 0 0 6px; font: 600 9.5px/1 var(--mono); letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
.explain__h--benign { color: var(--nominal); }
.explain__h--hostile { color: var(--mixed); }
.explain__foot {
  padding-top: 12px; border-top: 1px solid var(--rule);
  font-size: 11.5px !important; color: var(--faint) !important;
}
.zone__class--info { cursor: help; text-decoration: underline dotted 1px; text-underline-offset: 3px; }
.zone__class--info:hover { color: var(--ink); }

/* ── Search ─────────────────────────────────────────────────────────────── */
.search {
  position: relative; flex: 1 1 260px; max-width: 380px; min-width: 170px;
  display: flex; align-items: center;
}
.search__icon {
  position: absolute; left: 10px; width: 13px; height: 13px;
  fill: none; stroke: var(--faint); stroke-width: 1.5; pointer-events: none;
}
.search__input {
  width: 100%; box-sizing: border-box; padding: 7px 30px 7px 30px;
  background: var(--bg); border: 1px solid var(--rule); color: var(--ink);
  font: 400 11.5px/1 var(--mono);
  transition: border-color .15s ease;
}
.search__input::placeholder { color: var(--faint); }
.search__input:focus { outline: none; border-color: var(--nominal); }
.search__input:focus + .search__kbd { opacity: 0; }
.search__input::-webkit-search-cancel-button { display: none; }
.search__kbd {
  position: absolute; right: 8px; padding: 1px 5px;
  border: 1px solid var(--rule); color: var(--faint);
  font: 400 9px/1.5 var(--mono); pointer-events: none; transition: opacity .15s;
}

.search__results {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 1300;
  background: var(--panel); border: 1px solid var(--rule);
  box-shadow: 0 14px 40px rgba(0,0,0,.5); max-height: 60vh; overflow: auto;
}
.search__results[hidden] { display: none; }
.search__none {
  margin: 0; padding: 14px; text-align: center;
  font: 400 11px/1.4 var(--mono); color: var(--faint);
}
.sres {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 11px; border: 0; border-bottom: 1px solid var(--rule);
  background: none; cursor: pointer; text-align: left;
}
.sres:last-child { border-bottom: 0; }
.sres:hover, .sres.is-sel { background: rgba(127,166,201,.08); }
.sres__kind {
  width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%;
  background: var(--nominal);
}
.sres__kind--zone { background: var(--MIXED); border-radius: 0; }
.sres__kind--aircraft-bad { background: var(--JAMMING); }
.sres__kind--coord { background: var(--muted); border-radius: 1px; transform: rotate(45deg); }
.sres__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sres__title {
  font: 500 11.5px/1 var(--mono); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sres__sub {
  font: 400 9.5px/1.3 var(--mono); color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Layer toggles ──────────────────────────────────────────────────────── */
.layers { display: flex; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.lyr {
  display: flex; align-items: center; gap: 5px; padding: 6px 9px;
  border: 0; background: var(--panel); color: var(--faint); cursor: pointer;
  font: 500 9px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
  transition: color .12s ease, background .12s ease;
}
.lyr svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.lyr:hover { color: var(--muted); background: var(--panel-2); }
.lyr.is-on { color: var(--ink); background: var(--panel-2); }
.lyr.is-on svg { stroke: var(--JAMMING); }
.lyr[data-layer="heatmap"].is-on svg { stroke: var(--SPOOFING); fill: var(--SPOOFING); fill-opacity: .25; }

/* ── Overflow menu ──────────────────────────────────────────────────────── */
.menu { position: relative; }
.btn--icon { padding: 6px 9px; }
.btn--icon svg { width: 14px; height: 14px; fill: currentColor; display: block; }
.menu__pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1300;
  min-width: 208px; padding: 6px;
  background: var(--panel); border: 1px solid var(--rule);
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
}
.menu__pop[hidden] { display: none; }
.menu__field { display: block; padding: 6px 8px 9px; }
.menu__item {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 8px; border: 0; background: none; color: var(--ink); cursor: pointer;
  font: 400 11.5px/1 var(--display); text-align: left;
}
.menu__item:hover { background: rgba(127,166,201,.07); }
.menu__item--quiet { color: var(--muted); }
.menu__item--toggle .btn__dot { background: var(--faint); }
.menu__item--toggle.is-on .btn__dot { background: var(--JAMMING); }
.menu__rule { margin: 5px 0; border: 0; border-top: 1px solid var(--rule); }

@media (max-width: 1180px) {
  .lyr span { display: none; }
  .lyr { padding: 6px 8px; }
}
@media (max-width: 900px) {
  .search { min-width: 120px; }
  .layers { display: none; }
}

/* Viewer mode: controls that would only 403 are hidden outright. */
body.is-viewer .lyr[data-layer]           { }              /* layers stay: local only */
body.is-viewer #btn-pause,
body.is-viewer #btn-poll,
body.is-viewer #btn-custom-box,
body.is-viewer #btn-custom-box2,
body.is-viewer #btn-settings,
body.is-viewer #btn-fulltraffic          { display: none; }
body.is-viewer .bar__group--area .field  { opacity: .55; pointer-events: none; }

/* The hidden attribute must win. Any rule that sets display (flex, grid,
   block) silently overrides it, which has bitten this interface twice: once
   on the settings drawer and once on the sign-out item, where a viewer was
   shown a control meant only for the administrator. */
[hidden] { display: none !important; }

/* Simulated data must never be mistaken for live traffic. */
.attr--sim { color: var(--MIXED); font-weight: 600; }

/* ── Zone card: hierarchy ────────────────────────────────────────────────
   Nine metrics at equal weight is a table, not a card. The eye should land
   on position, then certainty, then the rest. */
.zone__where {
  margin: 10px 0 2px;
  font: 500 15px/1.2 var(--mono);
  color: var(--ink);
  letter-spacing: -.01em;
}
.zone__pm {
  margin-left: 6px;
  font: 400 11px/1 var(--mono);
  color: var(--muted);
}
.zone__conf { display: flex; align-items: center; gap: 9px; margin: 9px 0 11px; }
.zone__bar {
  flex: 1; height: 3px; background: var(--rule); overflow: hidden; border-radius: 2px;
}
.zone__bar i {
  display: block; height: 100%; background: currentColor;
  transition: width .5s cubic-bezier(.2,.7,.3,1);
}
.zone--JAMMING  .zone__bar i { background: var(--JAMMING); }
.zone--SPOOFING .zone__bar i { background: var(--SPOOFING); }
.zone--MIXED    .zone__bar i { background: var(--MIXED); }
.zone__confval {
  font: 600 12px/1 var(--mono); color: var(--ink); white-space: nowrap;
}
.zone__confval em {
  font: 400 9.5px/1 var(--mono); font-style: normal; color: var(--faint);
  margin-left: 3px; letter-spacing: .06em;
}

/* Selected card and its counterpart on the map read as one object. */
.zone.is-selected {
  background: rgba(127,166,201,.07);
  box-shadow: inset 2px 0 0 var(--ink);
}

/* ── Form controls: the browser defaults clash with the palette ───────── */
input[type="checkbox"], input[type="radio"] { accent-color: var(--JAMMING); }
select.field__input {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}

/* ── Toasts must not cover the panel they sit in front of ─────────────── */
.toasts { bottom: 46px; max-height: 42vh; overflow: hidden; pointer-events: none; }
.toasts > * { pointer-events: auto; }

/* ── Legend: present but recessive ───────────────────────────────────── */
.legend {
  transition: opacity .2s ease;
  opacity: .55;
}
.legend:hover { opacity: 1; }

/* Keyboard shortcut list */
.keys { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0; }
.keys dt { margin: 0; }
.keys dd {
  margin: 0; font: 400 12px/1.4 var(--display); color: var(--muted);
  align-self: center;
}
.keys kbd {
  display: inline-block; min-width: 22px; text-align: center;
  padding: 3px 7px; border: 1px solid var(--rule); border-bottom-width: 2px;
  background: var(--bg); color: var(--ink);
  font: 500 10.5px/1 var(--mono);
}

/* Refinements after review */
.zone__conf { gap: 11px; }
.zone__bar { max-width: 96px; flex: 0 0 96px; height: 4px; }
.zone__confval { margin-left: auto; }

/* Selection needs to be unmistakable: it is how the card and the map agree
   on which zone you are looking at. */
.zone.is-selected {
  background: rgba(127,166,201,.09);
  box-shadow: inset 3px 0 0 currentColor;
}
.zone--JAMMING.is-selected  { color: var(--JAMMING); }
.zone--SPOOFING.is-selected { color: var(--SPOOFING); }
.zone--MIXED.is-selected    { color: var(--MIXED); }
.zone.is-selected .zone__cid { color: var(--ink); }

/* Give the rail a scrollbar that belongs to the instrument. */
.scroll::-webkit-scrollbar { width: 9px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb {
  background: var(--rule); border: 3px solid var(--panel); border-radius: 5px;
}
.scroll::-webkit-scrollbar-thumb:hover { background: var(--faint); }
.scroll { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }

/* Focus rings: keyboard users should always know where they are. */
:focus-visible {
  outline: 2px solid var(--nominal); outline-offset: 2px;
}
