/*
 * Four themes, one set of custom properties.
 *
 * Two separate border tokens, which is the one thing worth explaining here.
 * `--line` is a decorative hairline between panels; `--edge` is the border of
 * something you can click or type into. They were the same token until a
 * contrast test pointed out that every input and button on the page had a
 * border at 1.37:1 against its own background — invisible to anyone with low
 * vision, and a real WCAG 1.4.11 failure rather than a stylistic quibble.
 * Dividers stay subtle; controls became visible.
 *
 * Every foreground/surface pair in every theme below is checked against WCAG
 * AA by tests/theme.test.mjs. "Looks high contrast" is how a theme ends up at
 * 3.9:1, so the claim is measured rather than believed.
 */
:root {
  --bg: #0d1117;
  --bg-raised: #161b22;
  --bg-hover: #1f2630;
  --line: #262d38;
  --edge: #7d8590;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #2dd4a7;
  --accent-dim: #1a7f66;
  --warn: #f0a04b;
  --bad: #f05f5f;
  /* The label on a filled accent control. Per theme, because the light
     theme's accent is a dark teal and near-black text on it is 3.49:1. */
  --on-accent: #04120e;
  --sidebar-width: 360px;
  color-scheme: dark;
}

/* Light, for a bright room and for the default on a system set that way. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-raised: #f6f8fa;
  --bg-hover: #eaeef2;
  --line: #d0d7de;
  --edge: #6e7781;
  --text: #1f2328;
  --text-dim: #59636e;
  --accent: #0f766e;
  --accent-dim: #14907f;
  --warn: #8a5300;
  --bad: #b42318;
  --on-accent: #ffffff;
  color-scheme: light;
}

/*
 * High contrast. Not "the dark theme, darker": every pair here clears AA by a
 * wide margin, and the chrome is black so that the only bright things on the
 * screen are the ones carrying information.
 */
:root[data-theme="contrast"] {
  --bg: #000000;
  --bg-raised: #0a0a0a;
  --bg-hover: #1a1a1a;
  --line: #6a6a6a;
  --edge: #c8c8c8;
  --text: #ffffff;
  --text-dim: #e6e6e6;
  --accent: #00ffc8;
  --accent-dim: #00c8a0;
  --warn: #ffb000;
  --bad: #ff8a8a;
  --on-accent: #000000;
  color-scheme: dark;
}

/*
 * Follow the system when nobody has chosen. Guarded on the attribute being
 * absent, so an explicit dark choice still wins on a light system — which is
 * the whole reason for having the switch.
 */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #ffffff;
    --bg-raised: #f6f8fa;
    --bg-hover: #eaeef2;
    --line: #d0d7de;
    --edge: #6e7781;
    --text: #1f2328;
    --text-dim: #59636e;
    --accent: #0f766e;
    --accent-dim: #14907f;
    --warn: #8a5300;
    --bad: #b42318;
    --on-accent: #ffffff;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

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

#app { display: flex; height: 100%; }

/* ---------- sidebar ---------- */

#sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--bg-raised);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: margin-left .2s ease;
}
#app.collapsed #sidebar { margin-left: calc(var(--sidebar-width) * -1); }

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.brand-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: .2px; }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bad); flex: none;
  box-shadow: 0 0 0 3px rgba(240, 95, 95, .15);
}
.dot.on { background: var(--accent); box-shadow: 0 0 0 3px rgba(45, 212, 167, .15); }

.icon-btn {
  background: transparent; border: 1px solid var(--edge); color: var(--text-dim);
  border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 13px;
  display: grid; place-items: center; flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}
.stat { padding: 9px 6px; text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); }

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; padding: 9px 2px; background: transparent; border: 0;
  border-bottom: 2px solid transparent; color: var(--text-dim);
  font: inherit; font-size: 11.5px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.badge {
  display: none; background: var(--accent-dim); color: #fff; border-radius: 9px;
  padding: 0 5px; font-size: 10px; margin-left: 2px;
}
.badge.show { display: inline-block; }

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

.scope-row { display: flex; gap: 6px; padding: 9px 10px 0; }
.scope {
  flex: 1; padding: 5px 4px; border-radius: 6px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--edge); color: var(--text-dim);
  font: inherit; font-size: 11.5px; white-space: nowrap;
}
.scope:hover { color: var(--text); }
.scope.active { color: var(--text); border-color: var(--accent-dim); background: #14231f; }
.scope span { opacity: .65; font-variant-numeric: tabular-nums; }

.search-row { display: flex; gap: 6px; padding: 9px 10px; border-bottom: 1px solid var(--line); }

.reset-btn {
  align-self: flex-start; background: var(--bg); border: 1px solid var(--edge);
  color: var(--text-dim); border-radius: 6px; padding: 5px 10px; font: inherit;
  font-size: 12px; cursor: pointer;
}
.reset-btn:hover { color: var(--text); background: var(--bg-hover); }

/* ---------- network panel ---------- */

.network { padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.network select { width: 100%; }

/* One series, so one colour for every bar: a ramp here would double-encode the
   length as hue and say nothing the bar does not already say. */
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.bar-label {
  flex: 0 0 116px; color: var(--text-dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.bar-track { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.bar b { flex: 0 0 26px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* A 2px gap between adjacent bars, rounded data-ends, anchored to the baseline. */
.hours { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.hours .hour {
  flex: 1; min-height: 1px; background: var(--accent);
  border-radius: 3px 3px 0 0; opacity: .85;
}
.hours .hour:hover { opacity: 1; }
.hours .hour.empty { background: var(--line); }
.hour-axis {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-dim); margin-top: 4px;
}

.keycheck { font-size: 11.5px; }
.keycheck .ok { color: var(--accent); }
.keycheck .warn { color: var(--warn); }
.keycheck ul { list-style: none; margin: 6px 0 0; padding: 0; }
.keycheck li {
  border: 1px solid #6b4a22; border-radius: 6px; padding: 6px 8px; margin-bottom: 5px;
  background: rgba(240, 160, 75, .07);
}
.keycheck .fp { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; color: var(--text-dim); }

.route { list-style: none; margin: 0; padding: 0; font-size: 11.5px; }
.route li { border-bottom: 1px solid var(--line); padding: 6px 0; }
.route li:last-child { border-bottom: 0; }
.route .when { color: var(--text-dim); font-size: 10.5px; }
.route .hops { margin-top: 3px; line-height: 1.7; }
.route .hop { color: var(--text); }
.route .arrow { color: var(--text-dim); font-size: 10px; margin: 0 3px; }
.route .snr { color: var(--text-dim); font-size: 10px; }

.dx { list-style: none; margin: 0; padding: 0; counter-reset: dx; }
.dx li {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.dx li:hover { background: var(--bg-hover); }
.dx li::before {
  counter-increment: dx; content: counter(dx);
  color: var(--text-dim); font-size: 10.5px; min-width: 14px; flex: none;
}
.dx .dx-dist {
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; flex: none;
  min-width: 62px;
}
.dx .dx-pair { font-size: 11.5px; color: var(--text-dim); min-width: 0; line-height: 1.35; }
.dx .dx-pair b { color: var(--text); font-weight: 600; display: block; }
.dx .dx-snr { margin-left: auto; font-size: 11px; color: var(--text-dim); flex: none; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 4px; }
.summary div { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; }
.summary b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.summary span { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); }

/* Sequential scale legend for the coverage shading. */
.scale { margin-top: 6px; }
.scale-bar { height: 8px; border-radius: 4px; }
.scale-ends {
  display: flex; justify-content: space-between; font-size: 10px;
  color: var(--text-dim); margin-top: 3px;
}

/* ---------- telemetry stat tiles ---------- */

/* A section heading with a control sitting on its right. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-head h3 { margin-right: auto; }
.range-select { flex: none; font-size: 11px; padding: 3px 6px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px 5px; }
.tile-label {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-value { font-size: 15px; font-weight: 600; line-height: 1.25; }
.tile-value .unit { font-size: 10px; color: var(--text-dim); font-weight: 400; margin-left: 1px; }
.tile-read { font-size: 10px; color: var(--text-dim); min-height: 13px; font-variant-numeric: tabular-nums; }
.tile svg { display: block; width: 100%; height: 26px; overflow: visible; touch-action: none; }
.tile svg .spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile svg .spark-area { fill: var(--accent); opacity: .10; }
.tile svg .spark-dot { fill: var(--accent); }
.tile svg .spark-hit { fill: transparent; }
.tile svg .spark-cursor { stroke: var(--text-dim); stroke-width: 1; opacity: 0; }
.tile.hovering svg .spark-cursor { opacity: .7; }

.detail .note {
  font-size: 11.5px; color: var(--text-dim); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 9px; margin-top: 2px;
}
input[type="search"], select, input[type="text"], input[type="password"], textarea {
  background: var(--bg); border: 1px solid var(--edge); color: var(--text);
  border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12.5px; min-width: 0;
}
input[type="search"] { flex: 1; }
input:focus, select:focus { outline: 1px solid var(--accent-dim); border-color: var(--accent-dim); }

.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li {
  padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.list li:hover { background: var(--bg-hover); }
.list li.selected { background: #1b2b2a; box-shadow: inset 2px 0 0 var(--accent); }
.list .empty { color: var(--text-dim); cursor: default; text-align: center; padding: 26px 12px; }
.list .empty:hover { background: transparent; }

/* Packet type as a background tint. Categorical, so fixed hues in a fixed order
   and never cycled — the ninth type gets no tint rather than a reused colour.
   Every row also names its type in text, so colour is never carrying it alone. */
#packet-list li.port-position    { background: rgba(57, 135, 229, .11); }
#packet-list li.port-nodeinfo    { background: rgba(217, 89, 38, .11); }
#packet-list li.port-telemetry   { background: rgba(25, 158, 112, .12); }
#packet-list li.port-text        { background: rgba(201, 133, 0, .13); }
#packet-list li.port-neighborinfo { background: rgba(213, 81, 129, .11); }
#packet-list li.port-map         { background: rgba(0, 131, 0, .16); }
#packet-list li.port-traceroute  { background: rgba(144, 133, 233, .12); }
#packet-list li.port-routing     { background: rgba(230, 103, 103, .11); }
#packet-list li:hover { background: var(--bg-hover); }

.item-top { display: flex; align-items: baseline; gap: 6px; }
.item-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-id { color: var(--text-dim); font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.item-time { margin-left: auto; color: var(--text-dim); font-size: 11px; white-space: nowrap; flex: none; }
.item-sub { color: var(--text-dim); font-size: 11.5px; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.item-text { font-size: 12.5px; margin-top: 3px; word-break: break-word; }

.chip {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text-dim);
}
.chip.pos { color: var(--accent); border-color: var(--accent-dim); }
.chip.dm { color: var(--warn); border-color: #6b4a22; }

.settings { padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 11px; }
.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.settings .check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
/* A control that qualifies the one above it, indented to the checkbox's label. */
.settings .row.sub { padding-left: 22px; margin-top: -4px; }
.settings .row.sub span { color: var(--text-dim); }
.settings select { flex: 0 0 auto; }
.settings input[type="range"] { flex: 0 0 140px; accent-color: var(--accent); }
.muted { color: var(--text-dim); font-size: 11px; line-height: 1.5; margin: 4px 0 0; word-break: break-all; }

.settings-heading {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim);
  margin: 6px 0 -2px; font-weight: 600;
}
.settings-heading:first-child { margin-top: 0; }

.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert {
  border: 1px solid var(--line); border-left-width: 3px; border-radius: 6px;
  padding: 7px 9px; background: var(--bg); font-size: 11.5px;
}
.alert.serious { border-left-color: var(--bad); }
.alert.warning { border-left-color: var(--warn); }
.alert.info { border-left-color: var(--accent); }
.alert b { display: block; font-size: 12px; margin-bottom: 2px; }
.alert span { color: var(--text-dim); }
.alert .when { font-size: 10.5px; }

.findings { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
.finding-chip {
  border: 1px solid var(--line); border-radius: 10px; padding: 2px 9px; font-size: 10.5px;
  color: var(--text-dim); background: var(--bg); font: inherit; font-size: 10.5px;
  cursor: pointer;
}
.finding-chip:hover { background: var(--bg-hover); color: var(--text); }
.finding-chip b { color: var(--text); font-variant-numeric: tabular-nums; margin-right: 3px; }
.finding-chip.missing { border-color: #6b4a22; color: var(--warn); }
.finding-chip.unexpected { border-color: var(--accent-dim); color: var(--accent); }
.finding-chip.active {
  background: var(--bg-hover); color: var(--text);
  box-shadow: inset 0 0 0 1px currentColor;
}

.link-rows { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.link-rows li {
  display: flex; align-items: baseline; gap: 7px; padding: 5px 0;
  border-bottom: 1px solid var(--line); cursor: pointer; font-size: 11.5px;
}
.link-rows li:hover { background: var(--bg-hover); }
.link-rows .km { flex: none; font-variant-numeric: tabular-nums; width: 52px; text-align: right; }
.link-rows .aside { flex: none; margin-left: auto; color: var(--text-dim); font-size: 10.5px; }
.link-rows .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* One line telling a first-time visitor what they are looking at. */
.public-note {
  font-size: 11.5px; line-height: 1.5; margin: 0 0 10px;
  color: var(--text-dim); border-left: 2px solid var(--accent-dim); padding-left: 9px;
}

.source-list { display: flex; flex-direction: column; gap: 9px; }
.source {
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: var(--bg);
}
.source-head { display: flex; align-items: center; gap: 8px; }
.source-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.source-toggle .source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-toggle .dot { width: 8px; height: 8px; box-shadow: none; }
/* A radio is a cable rather than a subscription: a different dot colour says
   so at a glance, without a second badge or icon competing for the same spot. */
.source[data-kind="radio"] .dot.on { background: #58a6ff; box-shadow: 0 0 0 3px rgba(88, 166, 255, .15); }
.source-name { font-size: 12.5px; font-weight: 600; }
.source-detail { font-size: 11px; color: var(--text-dim); margin-top: 3px; padding-left: 24px; }
.source-detail.muted { word-break: break-all; margin-top: 1px; }
/* What only this source is carrying: the number that decides whether it stays. */
.source-detail.exclusive { color: var(--accent); }

.source-remove {
  margin-left: auto; flex: none; background: transparent; border: 0;
  color: var(--text-dim); font: inherit; font-size: 11px; cursor: pointer; padding: 0 2px;
}
.source-remove:hover { color: var(--bad); text-decoration: underline; }

.source-confirm {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 7px;
}
.source-warn { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--warn); }
.source-confirm input { width: 100%; }
.danger-btn {
  background: var(--bad); border: 0; color: #1a0606; border-radius: 6px;
  padding: 7px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.danger-btn:disabled { opacity: .55; cursor: default; }


.add-broker {
  background: transparent; border: 1px dashed var(--edge); color: var(--text-dim);
  border-radius: 7px; padding: 7px 10px; font: inherit; font-size: 12px; cursor: pointer;
}
.add-broker:hover { background: var(--bg-hover); color: var(--text); border-color: var(--accent-dim); }

.broker-form {
  display: flex; flex-direction: column; gap: 7px;
  border: 1px solid var(--line); border-radius: 7px; padding: 10px; background: var(--bg);
}
/* An explicit display beats the browser's own rule for [hidden], so anything
   toggled by that attribute has to say so itself. */
.broker-form[hidden] { display: none; }
.broker-form .field { display: flex; flex-direction: column; gap: 3px; }
.broker-form .field span {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim);
}
.broker-form input { width: 100%; }
.form-error { font-size: 11.5px; color: var(--bad); margin: 2px 0 0; line-height: 1.4; }
.form-buttons { display: flex; gap: 8px; margin-top: 3px; }
.primary-btn {
  background: var(--accent); border: 0; color: var(--on-accent); border-radius: 6px;
  padding: 7px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.primary-btn:disabled { opacity: .55; cursor: default; }
.plain-btn {
  background: transparent; border: 1px solid var(--edge); color: var(--text-dim);
  border-radius: 6px; padding: 7px 12px; font: inherit; font-size: 12px; cursor: pointer;
}
.plain-btn:hover { background: var(--bg-hover); color: var(--text); }

.dot.partial { background: var(--warn); box-shadow: 0 0 0 3px rgba(240, 160, 75, .15); }

/* ---------- map ---------- */

#map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #0b0f14; }
#map.crosshair, #map.crosshair .leaflet-grab { cursor: crosshair; }
/* Terrain coverage is an estimate laid over the map; let the map read through. */
.coverage-image { mix-blend-mode: screen; }
#map.light-tiles { background: #e8e4dd; }

/* ---------- view switch + topology ---------- */

.view-switch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1100;
  display: flex; gap: 2px; padding: 2px; border-radius: 8px;
  background: rgba(22, 27, 34, .94); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.view {
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 6px;
}
.view:hover { color: var(--text); }
.view.active { background: var(--accent-dim); color: #fff; }

#topology { position: absolute; inset: 0; background: var(--bg); z-index: 400; }
/* Leaflet's controls sit at z-index 1000 and would punch straight through the
   topology panel. Hide the map outright while the graph is up — the controls
   would be steering something nobody can see. Visibility rather than display,
   so Leaflet keeps its dimensions and its bounds stay meaningful. */
#map-wrap.showing-topology #map { visibility: hidden; }

/* Centred on the viewport rather than tucked into a corner, so it does not sit
   on top of the node list. */
.consent {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px;
  z-index: 2000; max-width: 380px;
  background: rgba(22, 27, 34, .97); border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}
.consent p { margin: 0 0 9px; font-size: 11.5px; line-height: 1.5; color: var(--text-dim); }
.consent-actions { display: flex; gap: 7px; justify-content: flex-end; }
.consent button {
  font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.consent .consent-yes { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.consent button:hover { filter: brightness(1.15); }

@media (max-width: 720px) {
  .consent { left: 8px; right: 8px; bottom: 8px; max-width: none; transform: none; }
}

/* ---------- terrain tools ---------- */

/* These beat .locate-btn on specificity rather than source order: the shared
   base rule is defined further down, and would otherwise win the tie and stack
   this button underneath the locate one. */
.locate-btn.measure-btn { bottom: 78px; }
.locate-btn.pick-btn { bottom: 122px; }
.locate-btn.pick-btn svg { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.locate-btn.pick-btn .filled { fill: currentColor; }
.locate-btn.pick-btn.armed { color: var(--accent); border-color: var(--accent-dim); }
.measure-hint {
  position: absolute; top: 54px; left: 50%; transform: translateX(-50%); z-index: 1100;
  background: rgba(240, 194, 75, .95); color: #1d1503; border-radius: 7px;
  padding: 5px 12px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.locate-btn.measure-btn svg { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.locate-btn.measure-btn .filled { fill: currentColor; }
.locate-btn.measure-btn.armed { color: var(--accent); border-color: var(--accent-dim); }

.map-panel {
  position: absolute; left: 12px; bottom: 12px; z-index: 1100; width: 270px;
  background: rgba(22, 27, 34, .96); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; box-shadow: 0 4px 18px rgba(0, 0, 0, .5); font-size: 11.5px;
}
.map-panel header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.map-panel header b { flex: 1; font-size: 12px; }
.map-panel header .icon-btn { width: 22px; height: 22px; }
.map-panel .kv { grid-template-columns: 96px 1fr; font-size: 11.5px; }
.map-panel-controls {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap;
  color: var(--text-dim);
}
.map-panel-controls input {
  width: 52px; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 5px; padding: 3px 5px; font: inherit; font-size: 11.5px;
}
.map-panel .scale { margin-top: 7px; }
.map-panel .muted { word-break: normal; }

/* ---------- elevation profile ---------- */

.profile-panel {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1200;
  background: rgba(13, 17, 23, .97); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px 12px; box-shadow: 0 -4px 26px rgba(0, 0, 0, .55);
}
.profile-panel header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.profile-panel header b { font-size: 12.5px; }
.profile-panel header span { font-size: 11.5px; color: var(--text-dim); flex: 1; }
.profile-panel header .icon-btn { width: 22px; height: 22px; flex: none; }

#profile-chart svg { display: block; width: 100%; height: 190px; overflow: visible; }
.pf-terrain { fill: url(#pf-fill); stroke: #6da7ec; stroke-width: 1.5; }
.pf-grid { stroke: var(--line); stroke-width: 1; }
.pf-axis { fill: var(--text-dim); font-size: 10px; }
.pf-fresnel { fill: rgba(240, 194, 75, .13); stroke: rgba(240, 194, 75, .45); stroke-width: 1; }
.pf-sight { fill: none; stroke-width: 2; stroke-linecap: round; }
.pf-sight.clear { stroke: var(--accent); }
.pf-sight.marginal { stroke: var(--warn); }
.pf-sight.blocked { stroke: var(--bad); }
.pf-worst { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 3 3; }
.pf-cursor { stroke: var(--text-dim); stroke-width: 1; opacity: 0; }
#profile-chart.hovering .pf-cursor { opacity: .8; }
.pf-end { fill: var(--text); font-size: 10.5px; font-weight: 600; }

.profile-readout {
  font-size: 11px; color: var(--text-dim); min-height: 15px; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.verdict { font-weight: 700; }
.verdict.clear { color: var(--accent); }
.verdict.marginal { color: var(--warn); }
.verdict.blocked { color: var(--bad); }

@media (max-width: 720px) {
  #profile-chart svg { height: 150px; }
}

.locate-btn {
  position: absolute; right: 12px; bottom: 34px; z-index: 1100;
  width: 36px; height: 36px; padding: 0; display: grid; place-items: center;
  background: rgba(22, 27, 34, .94); border: 1px solid var(--edge); border-radius: 9px;
  color: var(--text); cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.locate-btn:hover { background: var(--bg-hover); }
.locate-btn svg { width: 19px; height: 19px; fill: currentColor; stroke: currentColor; stroke-width: 2; }
.locate-btn.busy { color: var(--accent); }
.locate-btn.busy svg { animation: locate-pulse 1s ease-in-out infinite; }
.locate-btn.failed { color: var(--warn); border-color: #6b4a22; }
/* The map is hidden behind the graph, so steering it would be pointless. */
#map-wrap.showing-topology .locate-btn { display: none; }

@keyframes locate-pulse { 50% { opacity: .35; } }

.here-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #3987e5; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
}

.topo-scope {
  position: absolute; top: 12px; left: 12px; z-index: 450;
  display: flex; gap: 2px; padding: 2px; border-radius: 8px;
  background: rgba(22, 27, 34, .94); border: 1px solid var(--line);
}
.tscope {
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 11.5px; padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}
.tscope:hover { color: var(--text); }
.tscope.active { background: var(--accent-dim); color: #fff; }
#topo-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#topo-svg.dragging { cursor: grabbing; }
#topo-svg .edge { stroke: #4a7fb5; stroke-opacity: .35; stroke-width: 1; }
#topo-svg .edge.direct { stroke: #2dd4a7; stroke-opacity: .5; stroke-width: 1.4; }
#topo-svg .edge.neighbour { stroke: #c678dd; stroke-opacity: .45; stroke-dasharray: 4 4; }
#topo-svg .topo-node { cursor: pointer; stroke: #0d1117; stroke-width: 2; }
/* The map gives MQTT gateways a glow; do the same here. */
#topo-svg .topo-node.gateway { stroke: #fff; filter: drop-shadow(0 0 4px rgba(45, 212, 167, .85)); }
#topo-svg .topo-node.unmapped { stroke: var(--warn); stroke-dasharray: 2 2; }
#topo-svg .topo-node.selected { stroke: #fff; stroke-width: 3; }
#topo-svg .topo-divider { stroke: var(--line); stroke-width: 1; }
#topo-svg .topo-caption {
  font-size: 13px; fill: var(--text-dim); font-weight: 600;
}
#topo-svg .topo-mark { cursor: pointer; }
#topo-svg .topo-label {
  font-size: 12px; font-weight: 700; fill: var(--text); pointer-events: none;
  text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 3.5px;
}

.topo-status {
  position: absolute; left: 12px; bottom: 12px; font-size: 11px; color: var(--text-dim);
  background: rgba(22, 27, 34, .9); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 9px; font-variant-numeric: tabular-nums;
}
.topo-legend {
  position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 3px;
  font-size: 10.5px; color: var(--text-dim);
  background: rgba(22, 27, 34, .9); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px;
}
.topo-legend span { display: flex; align-items: center; gap: 6px; }
.topo-legend i { width: 14px; height: 0; border-top: 2px solid; flex: none; }
.topo-legend .key-direct { color: #2dd4a7; }
.topo-legend .key-neighbour { color: #c678dd; border-top-style: dashed; }
.topo-legend .key-unmapped {
  height: 9px; width: 9px; border: 2px dashed var(--warn); border-radius: 50%;
}

.floating {
  position: absolute; top: 12px; left: 12px; z-index: 1100;
  background: var(--bg-raised); width: 34px; height: 34px; display: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
#app.collapsed .floating { display: grid; }
/* Slide Leaflet's top-left controls clear of the toggle while it is showing. */
#app.collapsed .leaflet-top.leaflet-left { margin-top: 46px; }

.node-marker {
  background: transparent !important;
  border: 0 !important;
}
.node-marker .pin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #0d1117;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
}
/* Routers and repeaters share one shape: a square turned 45 degrees. It is sized
   so its diagonal matches the circle's width, keeping every pin the same size. */
.node-marker .pin.diamond {
  width: 12.5px; height: 12.5px; border-radius: 2px;
  transform: rotate(45deg);
}
.node-marker .pin.square { border-radius: 2px; }
.node-marker .pin.gateway { box-shadow: 0 0 0 1px #fff, 0 0 9px 2px rgba(45, 212, 167, .6); }
.node-marker .label {
  position: absolute; left: 50%; top: 19px; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 700; white-space: nowrap; color: #e6edf3;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 4px #000; pointer-events: none;
}
#map.light-tiles .node-marker .label {
  color: #11161d;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 4px #fff;
}
#map.light-tiles .node-marker .pin { border-color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
#map.light-tiles .node-marker .pin.gateway { box-shadow: 0 0 0 1px #0d1117, 0 0 9px 2px rgba(45, 212, 167, .7); }
.node-marker.dim { opacity: .45; }
.node-marker.selected .pin { box-shadow: 0 0 0 2px #fff, 0 0 11px 3px rgba(255, 255, 255, .5); }

.marker-cluster {
  background: rgba(45, 212, 167, .25); border-radius: 50%;
  display: grid !important; place-items: center;
}
.marker-cluster div {
  background: rgba(45, 212, 167, .75); color: #06231c; width: 34px; height: 34px;
  border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}

/* Traffic pulses are decorative: never let them swallow a click on a marker. */
.traffic-pulse {
  pointer-events: none;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px currentColor);
}

.leaflet-container { font: inherit; background: var(--bg); }
.leaflet-control-attribution {
  background: rgba(13, 17, 23, .8) !important; color: var(--text-dim) !important; font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-bar a {
  background: var(--bg-raised) !important; color: var(--text) !important;
  border-bottom-color: var(--line) !important;
}
.leaflet-bar a:hover { background: var(--bg-hover) !important; }

/* ---------- detail card ---------- */

.detail {
  position: absolute; right: 12px; top: 12px; bottom: 12px; width: 320px; z-index: 600;
  background: rgba(22, 27, 34, .97); border: 1px solid var(--line); border-radius: 10px;
  overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); padding: 0;
}
.detail header {
  position: sticky; top: 0; background: inherit; padding: 12px 14px;
  border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 8px;
}
.detail header h2 { font-size: 15px; margin: 0 0 2px; line-height: 1.25; }
.detail header .item-id { font-size: 11px; }
.detail .body { padding: 10px 14px 16px; }
.detail h3 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim);
  margin: 14px 0 6px; font-weight: 600;
}
.detail h3:first-child { margin-top: 2px; }
.kv { display: grid; grid-template-columns: 108px 1fr; gap: 3px 10px; font-size: 12.5px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; word-break: break-word; }
.detail .mini { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.detail .mini li {
  display: flex; justify-content: space-between; gap: 8px; padding: 3px 0;
  border-bottom: 1px solid var(--line);
}
.detail .mini li:last-child { border-bottom: 0; }
.detail .mini .who { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail .mini .how { color: var(--text-dim); flex: none; font-variant-numeric: tabular-nums; }
.link-btn {
  background: transparent; border: 0; color: var(--accent); cursor: pointer;
  font: inherit; font-size: 12px; padding: 0; text-align: left;
}
.link-btn:hover { text-decoration: underline; }

@media (max-width: 720px) {
  :root { --sidebar-width: 100%; }
  #app { flex-direction: column; }
  #sidebar { height: 55%; flex: 0 0 55%; border-right: 0; border-bottom: 1px solid var(--line); }
  #app.collapsed #sidebar { margin-left: 0; display: none; }
  .detail { left: 12px; width: auto; }

  /* The map buttons stack up the right-hand edge, so every panel that would
     otherwise span the full width has to stop short of them. */
  .map-panel { left: 8px; right: 56px; width: auto; }
  .profile-panel { left: 8px; right: 56px; bottom: 8px; padding: 8px 10px 10px; }
  #profile-chart svg { height: 130px; }
  .profile-panel header { gap: 8px; }
  .profile-panel header span { font-size: 10.5px; }

  /* A phone is too narrow for this on one line. */
  .measure-hint { white-space: normal; max-width: 68vw; text-align: center; font-size: 11px; }

  .topo-legend { font-size: 9.5px; padding: 5px 7px; }
  .topo-status { font-size: 10px; right: 56px; }
  .link-rows { max-height: 180px; }
  .link-rows .tag { width: 54px; }
}

/* ---------------------------------------------------------- traceroute popup

   Leaflet's default popup is a white card, which is jarring on this map.
   These lines are drawn in pink; the popup follows so the two read as one
   thing when a line is clicked. */
.traceroute-pop .leaflet-popup-content-wrapper,
.traceroute-pop .leaflet-popup-tip {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid #ff4fa3;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.traceroute-pop .leaflet-popup-content { margin: 9px 11px; max-height: 240px; overflow-y: auto; }
.traceroute-pop .leaflet-popup-close-button { color: var(--text-dim); }

.traceroute-popup h4 { margin: 0 0 6px; font-size: 11px; color: #ff4fa3; letter-spacing: .04em; text-transform: uppercase; }
.traceroute-popup .tr-route + .tr-route { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.traceroute-popup .tr-when { font-size: 10.5px; color: var(--text-dim); margin-bottom: 3px; }
/* The hop chain wraps rather than stretching the popup across the map. */
.traceroute-popup .tr-path { font-size: 11.5px; line-height: 1.55; word-break: break-word; }
.traceroute-popup .tr-leg { color: var(--accent); font-variant-numeric: tabular-nums; }
.traceroute-popup .tr-none { font-size: 11px; color: var(--text-dim); font-style: italic; margin-top: 2px; }

/* Reliability rows: a percentage, a bar, who heard it and how long it was gone. */
.reliability-row { display: flex; align-items: center; gap: 8px; }
.reliability-pct { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.reliability-bar { flex: 0 0 64px; height: 5px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; }
.reliability-fill { height: 100%; background: var(--accent); }

/* A label and its control on one line, for a picker that annotates a section. */
.field.inline { flex-direction: row; align-items: center; gap: 8px; }

/* Export: three plain links, not three buttons pretending to be one thing. */
.export-heading { margin-top: 18px; }
.export-links { display: flex; gap: 14px; }
.export-links a { color: var(--accent); text-decoration: none; font-size: 12px; }
.export-links a:hover { text-decoration: underline; }

/* The utilisation chart. Each hour is a full-height slot so the median bar and
   the worst-node mark share one 0-100 scale — utilisation is already a
   percentage, so the chart needs no normalising and two of them compare. */
.util-slot { flex: 1; position: relative; height: 100%; min-width: 2px; }
.util-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 1px 1px 0 0; }
.util-worst { position: absolute; left: 0; right: 0; height: 2px; background: #e3b341; border-radius: 1px; }

/* A message whose channel key this map does not hold. The traffic is real; the
   words are not ours to show. */
.item-text.redacted { color: var(--text-dim); font-style: italic; }
.search-note { margin: 0 0 6px; padding: 0 2px; }
#message-search { width: 100%; }

/* Nodes held side by side. Four columns is the readable limit, so they simply
   share the width rather than scrolling. */
/*
 * Clear of the detail card, which is 320px wide at right:12px and sits above
 * this one. Running the full width put the comparison's values underneath it,
 * where they read as an empty panel with a column of labels and nothing
 * beside them.
 */
.compare {
  position: absolute; left: 12px; right: 344px; bottom: 12px; z-index: 500;
  background: var(--bg-panel, #0f141a); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; max-height: 45vh; overflow: auto;
}
.compare header { display: flex; align-items: center; justify-content: space-between; }
.compare h2 { font-size: 13px; margin: 0 0 4px; }
.compare-table { display: flex; gap: 12px; }
/*
 * Bounded, so one node being compared does not stretch its column across the
 * whole panel — `justify-content: space-between` then throws the value to the
 * far edge, a long way from the label it belongs to.
 */
.compare-column { flex: 1 1 0; min-width: 0; max-width: 260px; }
.compare-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; }
.compare-cell { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; padding: 1px 0; }
.compare-label { color: var(--text-dim); }
.compare-value { color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The composer, and what has been sent. Operator-only: a visitor's page never
   renders any of this. */
.transmit-state { margin: 0 0 6px; padding: 0 2px; }
.compose { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
/* A display of its own outranks the browser's own [hidden] { display: none },
   which is how the add-a-broker form once shipped visible on first paint. */
.compose[hidden] { display: none; }
.compose-row { display: flex; gap: 6px; align-items: center; }
.compose-row #compose-to { flex: 1; }
.compose textarea { width: 100%; resize: vertical; font: inherit; }
#compose-count.over { color: var(--bad); }
.outbox li { opacity: 0.85; }
.outbox .outbox-failed .item-id { color: var(--bad); }
.outbox .outbox-delivered .item-id { color: var(--accent); }

@media (max-width: 720px) {
  /* The map buttons stack up the right-hand edge, so this has to stop short of
     them the way every other floating panel does. */
  .compare { right: 56px; max-height: 38vh; }
  /* Four columns on a phone is four columns of nothing. Two rows of two is
     still a comparison; a 90px column is not. */
  .compare-table { flex-wrap: wrap; }
  .compare-column { flex: 1 1 45%; }

  /* A composer needs room to type in more than it needs room to be tidy. */
  .compose textarea { font-size: 16px; }
  .compose-row { flex-wrap: wrap; }
}

/* 16px is the size below which iOS zooms the page when a field is focused,
   which on a map is a small catastrophe: the zoom persists after the keyboard
   goes and the whole layout is left off-centre. */
@media (max-width: 720px) {
  input[type="text"], input[type="search"], input[type="password"], textarea, select {
    font-size: 16px;
  }
}

/* The solar outlook: one line of verdict, one of provenance, and a bar per
   forecast day. */
.solar { margin: 4px 0 8px; display: flex; flex-direction: column; gap: 5px; }
.solar-verdict { color: var(--text); font-size: 12.5px; }
.solar-days { display: flex; align-items: flex-end; gap: 4px; height: 58px; }
.solar-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; }
.solar-bar { flex: 1; width: 100%; background: var(--bg-hover); border-radius: 3px; position: relative; overflow: hidden; }
.solar-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); }
.solar-fill.low { background: var(--bad); }
.solar-label { font-size: 9.5px; color: var(--text-dim); }

/* Every compared node's battery on one pair of axes — a shared time span and a
   fixed 0-100, so two nodes that look identical on their own cards are visibly
   different here. */
.compare-axis { font-size: 10px; color: var(--text-dim); margin-top: 8px; }
.compare-chart-wrap { height: 42px; margin-top: 2px; }
.compare-chart { width: 100%; height: 100%; display: block; background: var(--bg-hover); border-radius: 4px; }
.compare-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; font-size: 10.5px; color: var(--text-dim); }
.compare-legend-item::before {
  content: ''; display: inline-block; width: 8px; height: 2px; margin-right: 4px;
  vertical-align: middle; background: var(--dot, var(--accent));
}

/*
 * A reader who has asked their system for less motion.
 *
 * Everything stops — but the traffic pulse is information, not decoration, so
 * it degrades to a still line rather than to nothing. Hiding it would remove
 * the only indication that anything is moving through the mesh, which is a
 * worse answer than a line that does not travel.
 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  /* The traffic pulse, held still: drawn at full strength along its whole
     path rather than travelling down it. */
  .traffic-pulse {
    opacity: .85;
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
    filter: none;
  }

  /* The locate button's busy state loses its pulse, so it needs to say it some
     other way. */
  .locate-btn.busy svg { opacity: .55; }
}

/*
 * Where the keyboard is.
 *
 * :focus-visible rather than :focus, so a mouse click does not leave a ring
 * behind — which is the reason focus rings get removed altogether, and
 * removing them is the end of keyboard navigation.
 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* The map's own controls sit on imagery, so they need the ring to read against
   whatever happens to be behind them. */
.leaflet-container :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

/* What has been done here lately. Dense on purpose: it is a log, and the
   useful reading is the shape of it rather than any one line. */
/* Every action on one row, with space between them: inline buttons with
   nothing between run together into "Copy link to this nodeCompare". */
.detail-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 2px; }

/* Stopping a source collecting: the operator's action, and the one that
   affects everybody. Deliberately a button rather than a second checkbox, so
   it cannot be mistaken for the view filter beside it. */
.source-collect {
  background: transparent; border: 1px solid var(--edge); color: var(--text-dim);
  border-radius: 6px; padding: 2px 7px; font: inherit; font-size: 10.5px; cursor: pointer;
}
.source-collect:hover { background: var(--bg-hover); color: var(--text); }
.source-collect.stopped { color: var(--warn); border-color: var(--warn); }

.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.audit li { display: flex; flex-wrap: wrap; gap: 7px; font-size: 11px; align-items: baseline; }
.audit-when { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.audit-what { color: var(--text); }
.audit-outcome { color: var(--warn); }
.audit-detail, .audit-actor { color: var(--text-dim); }
/* Anything that did not simply work, marked so a run of refusals is visible
   without reading every line. */
.audit li.audit-notable .audit-what { color: var(--warn); }

/* The packet inspector, opened inside its own feed row. */
.inspect-btn {
  background: transparent; border: 0; padding: 0; font: inherit; font-size: 10.5px;
  color: var(--accent); cursor: pointer; text-decoration: underline;
}
.packet-detail {
  margin-top: 6px; padding: 7px 8px; border: 1px solid var(--edge); border-radius: 6px;
  background: var(--bg); display: flex; flex-direction: column; gap: 4px;
}
.packet-detail h4 { margin: 2px 0 0; font-size: 10.5px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.packet-fields { display: flex; flex-direction: column; gap: 1px; }
.packet-field { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.packet-key { color: var(--text-dim); }
.packet-value { color: var(--text); text-align: right; word-break: break-all; }
/* Hex wraps rather than scrolls: it is read a byte at a time, not skimmed. */
.packet-hex {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px;
  color: var(--text-dim); white-space: pre-wrap; word-break: break-all; line-height: 1.5;
}

/* Observed receptions drawn over a predicted coverage overlay. */
.coverage-check { margin-top: 6px; }
.coverage-observed { pointer-events: auto; }
