/* Golos Text (Paratype, SIL Open Font License 1.1), kept here: the site opens where Google's servers do not. */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/golos-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/golos-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f5f6f3;
  --panel: #ffffff;
  --ink: #16191d;
  --ink2: #3a4148;
  --muted: #5d6670;
  --line: #e3e6e8;
  --line2: #eef0f2;
  --soft: #f1f3f5;
  --tile: #f5f6f3;
  --field: #d5d9de;
  --map: #eceee8;
  --accent: #2f6fde;
  --accent-soft: #eaf0fc;
  --on-accent: #ffffff;
  --good: #1e9457;
  --good-soft: #e3f3ea;
  --good-ink: #17663f;
  --fair: #c78a00;
  --weak: #d64532;
  --seen: #7d868f;
  /* A repeater with something wrong: the «!» by it. */
  --warn: #f0a020;
  --warn-soft: #fdf1d8;
  --warn-ink: #7a4f00;
  /* The chance there and back: 90 % and over, 70-90 %; under that the map takes --fair and --weak. */
  --p90: #0f6b3a;
  --p70: #3a9e63;
  --agent: #7c4ddb;
  --mqtt: #0b8f86;
  /* «Планирование»: a planned point, its coverage and beam. */
  --plan: #b62fc4;
  --plan-soft: #f8eafa;
  --plan-ink: #7e1d89;
  --a: #2f6fde;
  --b: #c2410c;
  --ground: #a3a08f;
  --fresnel: rgba(47, 111, 222, 0.14);
  /* What stands on the ground in a profile: buildings and woods. */
  --roof: #9a6a4f;
  --tree: #3f8550;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-up: 0 -6px 24px rgba(0, 0, 0, 0.12);
  /* The chat, as Ommesh draws it: a swatch and a name in a hue hashed from the sender. */
  --bubble: #f1f3f5;
  --avatar-l: 62%;
  --avatar-c: 0.11;
  --name-l: 50%;
  --name-c: 0.14;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --panel: #181c21;
    --ink: #e6e9ed;
    --ink2: #c3c9d0;
    --muted: #8b949e;
    --line: #2a3038;
    --line2: #232930;
    --soft: #222830;
    --tile: #1f242a;
    --field: #39414b;
    --map: #14181d;
    --accent: #6ea0ff;
    --accent-soft: #1d2a42;
    --on-accent: #0b1220;
    --good: #3ccf86;
    --good-soft: #173527;
    --good-ink: #7fe0ae;
    --fair: #f0c419;
    --weak: #ff6b57;
    --seen: #6b7480;
    --warn: #f5a524;
    --warn-soft: #33270f;
    --warn-ink: #f7c56a;
    --p90: #3ccf86;
    --p70: #2a9a62;
    --agent: #a78bfa;
    --mqtt: #36cfc0;
    --plan: #e879f9;
    --plan-soft: #2e1b33;
    --plan-ink: #f5b8fb;
    --a: #6ea0ff;
    --b: #ff9a5a;
    --ground: #6f6c5f;
    --fresnel: rgba(110, 160, 255, 0.16);
    --roof: #b5876a;
    --tree: #4f9a5f;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    --bubble: #262c34;
    --name-l: 78%;
    --name-c: 0.1;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); font-variant-numeric: tabular-nums; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.mono { font-variant-ligatures: none; font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1 1 0; }
code { font-variant-ligatures: none; font-family: var(--mono); font-size: 0.92em; }
a { color: var(--accent); }

/* ---- the header ---- */

.top { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 8px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; border: 0; background: transparent; font-size: 17px; font-weight: 700; color: var(--ink); cursor: pointer; }
.brand svg { flex: none; }
.sections { display: flex; flex-wrap: wrap; gap: 4px; }
.sections button { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; font-size: 15px; font-weight: 500; color: var(--ink2); cursor: pointer; }
.sections button:hover { background: var(--soft); }
.sections button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.sections svg { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; line-height: 18px; font-weight: 600; text-align: center; }
.status { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--seen); }
.status.on { background: var(--good-soft); color: var(--good-ink); }
.status.on::before { background: var(--good); }
.status.paused { background: color-mix(in srgb, var(--fair) 18%, transparent); color: color-mix(in srgb, var(--fair) 70%, var(--ink)); }
.status.paused::before { background: var(--fair); }
.status.off { background: color-mix(in srgb, var(--weak) 14%, transparent); color: color-mix(in srgb, var(--weak) 80%, var(--ink)); }
.status.off::before { background: var(--weak); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--field); border-radius: 10px; background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--seen); }
.btn.primary { min-height: 44px; padding: 0 18px; border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-size: 15px; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn .narrow, #help-open .narrow { display: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#flash-open .narrow { stroke-linejoin: round; }
.link { padding: 0; border: 0; background: transparent; font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ---- the body: the map with its panel, or a page ---- */

main { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
#map-pane { position: relative; flex: 1 1 auto; min-width: 0; background: var(--map); overflow: hidden; }
#map { position: absolute; inset: 0; }
aside#side { position: relative; flex: 0 0 clamp(340px, 30vw, 440px); min-width: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); }
.pane { display: none; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.pane.on { display: block; }
/* The panel folds away to a tab on the map's edge, and the map takes its place. */
.side-toggle { position: absolute; left: -28px; top: 50%; z-index: 5; display: flex; align-items: center; justify-content: center; width: 28px; height: 56px; margin-top: -28px; padding: 0; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: var(--panel); color: var(--muted); box-shadow: -2px 0 6px rgba(0, 0, 0, 0.06); cursor: pointer; }
.side-toggle:hover { color: var(--ink); }
.side-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.side-off aside#side { flex-basis: 0; border-left: 0; }
body.side-off aside#side .pane { display: none; }
body.side-off .side-toggle svg { transform: rotate(180deg); }
.page { flex: 1 1 100%; min-width: 0; overflow-y: auto; }
.page-in { max-width: 1120px; margin: 0 auto; padding: 32px 20px 56px; display: flex; flex-direction: column; gap: 20px; }
body[data-view="stats"] #map-pane, body[data-view="stats"] aside#side { display: none; }

/* ---- on the map ---- */

.map-tools { position: absolute; right: 16px; top: 16px; left: 76px; z-index: 4; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; pointer-events: none; }
.map-tools > * { pointer-events: auto; }
/* The tape's hint: a row of its own under the switches, however many rows they take. */
.map-tools > .ruler-hint { flex-basis: 100%; display: flex; justify-content: flex-end; margin: 0; pointer-events: none; }
.map-tools > .ruler-hint[hidden] { display: none; }
.ruler-hint span { padding: 8px 14px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-size: 13px; color: var(--ink2); text-align: center; }
.seg-group { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.seg-group > span { padding: 0 8px 0 12px; font-size: 13px; color: var(--muted); }
.seg-group button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.seg-group button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.seg-group.light { background: color-mix(in srgb, var(--line) 70%, var(--soft)); box-shadow: none; }
.seg-group.light button { font-size: 14px; padding: 0 16px; color: var(--ink2); }
.seg-group.light button[aria-pressed="true"] { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.tool { min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--panel); }

.map-legend { position: absolute; left: 16px; bottom: 16px; z-index: 3; border-radius: 10px; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: var(--shadow); font-size: 12px; color: var(--ink2); max-width: calc(100% - 32px); }
.lg-rows { display: flex; flex-direction: column; gap: 6px; padding: 2px 12px 10px; }
/* Folded, the legend is its title alone; the links it chose stay drawn. */
.lg-fold { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 32px; padding: 6px 8px 6px 12px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.lg-fold:hover { background: var(--soft); }
.lg-fold svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-legend.off .lg-rows { display: none; }
.map-legend.off .lg-fold svg { transform: rotate(180deg); }
.lg { display: flex; align-items: center; gap: 8px; }
.lg i { flex: 0 0 16px; height: 14px; display: flex; align-items: center; justify-content: center; }
.lg i::before { content: ""; display: block; }
/* How far the agents got with a repeater: grey outline, blue outline, blue, green; dashed when silent. */
.lg .lv::before, .dia { width: 10px; height: 10px; box-sizing: border-box; border-radius: 2px; transform: rotate(45deg); }
.lv-0::before, .dia.lv-0 { background: transparent; border: 2px dashed var(--seen); opacity: 0.6; }
.lv-1::before, .dia.lv-1 { background: var(--panel); border: 2px solid var(--seen); }
.lv-2::before, .dia.lv-2 { background: var(--panel); border: 3px solid var(--accent); }
.lv-3::before, .dia.lv-3 { background: var(--accent); border: 2px solid var(--panel); box-shadow: 0 0 0 1px rgba(22, 25, 29, 0.25); }
.lv-4::before, .dia.lv-4 { background: var(--good); border: 2px solid var(--panel); box-shadow: 0 0 0 1px rgba(22, 25, 29, 0.25); }
.lg span { flex: 1 1 auto; }
.lg .lg-n { flex: 0 0 auto; padding-left: 10px; font-weight: 600; color: var(--muted); }
.warn-tri { flex: 0 0 auto; vertical-align: -1px; }
.lg .warn-tri { margin: 0 1px; }
.warn-tri .t { fill: var(--warn); stroke: var(--panel); stroke-width: 1.6; stroke-linejoin: round; }
.warn-tri .m { fill: none; stroke: #16191d; stroke-width: 1.6; stroke-linecap: round; }
.lg .agent::before { width: 12px; height: 12px; border-radius: 50%; background: var(--agent); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--agent); transform: scale(0.8); }
.lg .obs::before { width: 10px; height: 10px; border-radius: 50%; background: var(--mqtt); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px color-mix(in srgb, var(--mqtt) 55%, transparent); }
.lg .l-route::before { width: 16px; height: 3px; border-radius: 2px; }
.lg .l-route::before { background: var(--accent); height: 4px; }
/* A square of the measured coverage, as the map fills it: its colour faint, its edge whole. */
.lg .cv::before, .cell-tone .cv { flex: none; width: 11px; height: 11px; box-sizing: border-box; border-radius: 2px; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 45%, transparent); }
.cell-tone { display: flex; align-items: center; gap: 8px; margin: 12px 0 10px; font-weight: 600; color: var(--ink); }
.cell-tone .muted { font-weight: 400; }
/* The links' steps: a button each, pressed when drawn. */
.lg-title { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 600; color: var(--ink); }
.lg-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.lg-step { width: calc(100% + 8px); min-height: 26px; padding: 0 4px; margin: 0 -4px; border: 0; border-radius: 6px; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.lg-step:hover { background: var(--soft); }
.lg-step span { flex: 1 1 auto; }
.lg-step b { flex: 0 0 auto; padding-left: 10px; font-weight: 600; color: var(--muted); }
.lg-step[aria-pressed="false"] { color: var(--muted); }
.lg-step[aria-pressed="false"] .sw { opacity: 0.3; }
.lg .sw { flex: 0 0 auto; overflow: visible; }
.sw line { stroke-linecap: round; }
.lg-looks { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.lg-looks span { display: inline-flex; align-items: center; gap: 4px; }
.lg-note { color: var(--muted); }
.lg-sub { margin-top: 2px; color: var(--muted); }/* Numbers over the links. */
.link-tags { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.link-tag { position: absolute; left: 0; top: 0; padding: 1px 8px; border: 1.5px solid var(--c); border-radius: 999px; background: var(--panel); font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; color: color-mix(in srgb, var(--c) 75%, var(--ink)); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); }
button.link-tag { min-height: 24px; font-family: inherit; cursor: pointer; pointer-events: auto; }
button.link-tag:hover { background: var(--soft); }
.lg-scale { margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.relief-bar { width: 180px; height: 8px; margin-top: 6px; border-radius: 4px; background: linear-gradient(90deg, #1f7a6a 0%, #3f9a4e 20%, #9cc15a 40%, #e3c75c 60%, #d9894a 80%, #b45a3a 100%); }
.relief-ticks { display: flex; justify-content: space-between; width: 180px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.reach-bar { width: 180px; height: 8px; margin-top: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--weak), var(--fair), var(--good)); }

/* MapLibre's own parts, in the page's dress. */
.maplibregl-map { font: inherit; background: var(--map); }
.maplibregl-ctrl-top-left .maplibregl-ctrl { margin: 16px 0 0 16px; }
.maplibregl-ctrl-group { background: var(--panel); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-group button { width: 44px; height: 44px; color: var(--ink); }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 16px 16px 0; }
@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
  .maplibregl-ctrl-attrib, .maplibregl-ctrl-scale { background: rgba(24, 28, 33, 0.8); color: var(--muted); }
  .maplibregl-ctrl-attrib a { color: var(--muted); }
}
.node-canvas, .live-overlay { position: absolute; left: 0; top: 0; pointer-events: none; }
.live-overlay { width: 100%; height: 100%; overflow: visible; }
.map-down { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; width: min(420px, calc(100% - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; font-size: 13.5px; line-height: 1.5; }
.map-down p { margin: 6px 0 0; }
.trace-run { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 10 12; animation: run 0.7s linear infinite; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.35)); transition: opacity 0.8s; }
.trace-run.ok { stroke: var(--good); }
.trace-run.fail { stroke: var(--weak); }
.trace-run.gone { opacity: 0; }
@keyframes run { to { stroke-dashoffset: -22; } }
.asking circle { fill: none; stroke: var(--accent); stroke-width: 3; }
.asking .wave { animation: wave 1.4s ease-out infinite; transform-origin: 0 0; }
@keyframes wave { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(2.6); } }
.plan-mark > circle { fill: var(--panel); stroke: var(--plan); stroke-width: 2.5; }
.plan-mark text { text-anchor: middle; font: 700 13px/1 var(--font, inherit); fill: var(--plan); }
.plan-mark.on > circle { fill: var(--plan); stroke: var(--panel); stroke-width: 3; }
.plan-mark.on text { fill: var(--panel); font-size: 15px; }
.plan-mark.held > circle { filter: drop-shadow(0 3px 4px rgb(0 0 0 / 0.35)); }
.plan-mark .aim-line { fill: none; stroke: var(--plan); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1 5; }
.plan-mark .aim-knob circle { fill: var(--panel); stroke: var(--plan); stroke-width: 2.5; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.3)); }
.plan-mark .aim-knob path { fill: var(--plan); }
.plan-mark .drop circle { fill: var(--panel); stroke: var(--muted); stroke-width: 1.5; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.3)); }
.plan-mark .drop path { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.plan-mark.on text.label { text-anchor: start; font-size: 12px; font-weight: 600; fill: var(--plan-ink); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }

/* ---- the panel ---- */

.side-head { display: flex; flex-direction: column; gap: 14px; padding: 20px 20px 14px; border-bottom: 1px solid var(--line2); }
.side-head h1, .pane h1 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; }
.side-body { display: flex; flex-direction: column; gap: 18px; padding: 16px 20px 28px; }
.tiles3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles3 > div { padding: 10px 12px; border-radius: 12px; background: var(--tile); min-width: 0; }
.tiles3 b { display: block; font-size: 21px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.tiles3 span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.3; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--field); border-radius: 10px; background: var(--panel); font-size: 15px; color: var(--ink); }
.list-cap { display: flex; justify-content: space-between; padding: 10px 20px 4px; font-size: 12px; color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0 8px 8px; }
.row-btn { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--ink); cursor: pointer; }
.row-btn:hover, .row-btn:focus-visible { background: var(--soft); outline: none; }
.row-btn .t { flex: 1 1 auto; min-width: 0; }
.row-btn .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-btn .t span, .row-btn .r span { display: block; font-size: 12px; color: var(--muted); }
.row-btn .r { flex: 0 0 auto; text-align: right; }
.row-btn .r b { display: block; font-weight: 600; }
.dia { flex: 0 0 auto; display: inline-block; width: 10px; height: 10px; box-sizing: border-box; border-radius: 2px; transform: rotate(45deg); background: var(--panel); border: 2px solid var(--seen); }
.dia.old { opacity: 0.45; }
.dia.agent { border-radius: 50%; transform: none; background: var(--agent); border-color: var(--panel); box-shadow: 0 0 0 1px var(--agent); }
.foot-note { margin: 0; padding: 10px 20px 24px; font-size: 13px; color: var(--muted); }

.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 8px; border: 0; border-radius: 8px; background: var(--soft); font-size: 14px; color: var(--ink); cursor: pointer; }
.back svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.node-title h1 { font-size: 24px; overflow-wrap: anywhere; }
.node-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.state { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-weight: 600; background: var(--soft); color: var(--ink2); }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--seen); }
.state.fresh { background: var(--good-soft); color: var(--good-ink); }
.state.fresh::before { background: var(--good); }
.state.old { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1 1 150px; min-height: 44px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sec-head h2, .pane h2 { margin: 0; font-size: 16px; font-weight: 700; }
.sec-head span { font-size: 12px; color: var(--muted); }
.nb { list-style: none; margin: 8px 0 0; padding: 0; }
.nb li { border-top: 1px solid var(--line2); }
.nb button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px; border: 0; background: transparent; text-align: left; color: var(--ink); cursor: pointer; }
.nb button:hover { background: var(--soft); }
/* Each neighbour both ways: how it hears this node, how this node hears it, and there and back. */
.nb-head { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; padding: 0 4px 4px; font-size: 11px; line-height: 1.2; color: var(--muted); }
.nb-head span, .nb .cell { flex: 0 0 62px; text-align: center; }
.nb .n, .nb-head .n { flex: 1 1 auto; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb .n small { margin-left: 6px; font-size: 12px; color: var(--muted); }
.nb .p, .nb-head .p { flex: 0 0 40px; text-align: right; font-weight: 700; }
.nb .cell { box-sizing: border-box; padding: 2px 0; border-radius: 6px; font-size: 13px; font-weight: 600; }
.q-good { --q: var(--good); } .q-fair { --q: var(--fair); } .q-weak { --q: var(--weak); } .q-none { --q: var(--seen); }
.nb .cell, .side-dir .pill { background: color-mix(in srgb, var(--q) 15%, var(--panel)); color: color-mix(in srgb, var(--q) 70%, var(--ink)); }
/* A node's card: what is wrong with it, how far the agents got. */
.faults { display: flex; flex-direction: column; gap: 8px; }
.faults h2 { margin: 0; }
.fault { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); }
.fault .warn-tri { width: 18px; height: 17px; margin-top: 2px; }
.fault .warn-tri .t { stroke: none; }
.fault > div { min-width: 0; }
.fault b { color: var(--warn-ink); }
.fault p { margin: 4px 0 0; color: var(--ink2); }
.fault .fix { font-size: 13px; }
.fault .when { margin-top: 2px; font-size: 12px; color: var(--muted); }
.fault .fix b { color: inherit; }
/* How its antenna stands, as people said; the form to say it. */
.mount-now { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.mount-now span { font-size: 12px; color: var(--muted); }
.mount-history { margin-top: 10px; font-size: 13px; }
.mount-history summary { cursor: pointer; color: var(--muted); }
.mount-history ul { list-style: none; margin: 6px 0 0; padding: 0; }
.mount-history li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line2); }
.mount-history li > span { flex: 1 1 auto; min-width: 0; }
.mount-history li small { display: block; color: var(--muted); }
.mount-history li.undone > span { color: var(--muted); text-decoration: line-through; }
.mount-history li.undone small { text-decoration: none; }
/* What the model guesses of the antenna from its links: asked of people before anyone told, beside what was told after. */
.guess { display: flex; flex-direction: column; gap: 8px; }
.guess-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; margin: 0; font-weight: 600; }
.guess-head span { font-size: 12px; font-weight: 400; color: var(--muted); }
.guess-lines { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 18px; color: var(--ink2); }
.guess .actions { margin: 0; }
.guess.told { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line2); font-size: 13px; }
.guess.told .guess-lines { color: var(--muted); }
.mount-form { display: flex; flex-direction: column; gap: 12px; }
.mount-form .field > span { font-size: 13px; color: var(--muted); }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: var(--panel); font-size: 13px; color: var(--ink); cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--panel); font-weight: 600; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; }
.step { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line2); }
.step i { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--soft); display: flex; align-items: center; justify-content: center; }
.step i::before { content: "—"; font-style: normal; font-weight: 700; font-size: 12px; color: var(--muted); }
.step.ok i { background: var(--good-soft); }
.step.ok i::before { content: "✓"; color: var(--good-ink); }
.step.no i { background: color-mix(in srgb, var(--weak) 15%, var(--panel)); }
.step.no i::before { content: "✕"; color: color-mix(in srgb, var(--weak) 75%, var(--ink)); }
.step b { display: block; }
.step span { display: block; font-size: 13px; color: var(--muted); }
/* A link's card: there and back, the verdict, each side against the threshold. */
.tiles2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tiles2 > div { padding: 10px 12px; border-radius: 12px; background: var(--tile); min-width: 0; }
.tiles2 b { display: block; font-size: 28px; font-weight: 700; line-height: 1.15; }
.tiles2 span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.3; color: var(--muted); }
.verdict-box { padding: 12px 14px; border-radius: 12px; --v: var(--fair); background: color-mix(in srgb, var(--v) 14%, var(--panel)); color: color-mix(in srgb, var(--v) 55%, var(--ink)); }
.verdict-box.good { --v: var(--good); } .verdict-box.bad { --v: var(--weak); }
.verdict-box b { display: block; font-size: 16px; }
.verdict-box p { margin: 4px 0 0; }
.side-dir { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 12px; }
.sd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sd-head > div { min-width: 0; }
.sd-head b { display: block; overflow-wrap: anywhere; }
.sd-head span { font-size: 12px; color: var(--muted); }
.side-dir .pill { flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sd-v { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.sd-v b { font-size: 24px; color: color-mix(in srgb, var(--q) 75%, var(--ink)); }
.sd-v span { font-size: 13px; color: var(--ink2); }
.snr-scale { position: relative; height: 12px; margin-top: 4px; }
.snr-scale .zones { display: flex; height: 100%; overflow: hidden; border-radius: 6px; }
.snr-scale .zones span { flex: 0 0 auto; }
.snr-scale .zones span:nth-child(1) { background: color-mix(in srgb, var(--weak) 22%, var(--panel)); }
.snr-scale .zones span:nth-child(2) { background: color-mix(in srgb, var(--fair) 26%, var(--panel)); }
.snr-scale .zones span:nth-child(3) { flex: 1 1 auto; background: color-mix(in srgb, var(--good) 22%, var(--panel)); }
.snr-scale i { position: absolute; top: -4px; bottom: -4px; }
.snr-scale .limit { width: 2px; margin-left: -1px; background: var(--weak); }
.snr-scale .mark { width: 6px; margin-left: -3px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 1.5px var(--panel); }
.snr-ticks { position: relative; height: 16px; font-size: 11px; color: var(--muted); }
.snr-ticks span { position: absolute; white-space: nowrap; }
.snr-ticks span:not(:first-child):not(:last-child) { transform: translateX(-50%); }
.snr-ticks .lim { color: color-mix(in srgb, var(--weak) 75%, var(--ink)); }
.side-dir .kv { margin-top: 4px; }
details.about { padding-top: 12px; border-top: 1px solid var(--line2); }
details.about > summary { min-height: 32px; font-weight: 600; cursor: pointer; }
.deep { display: flex; flex-direction: column; gap: 4px; }
.deep > h3:first-child { margin-top: 4px; }

/* The agents. */
.agent-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.agent-card:hover { border-color: var(--field); }
.agent-card .hd { display: flex; align-items: center; gap: 8px; }
.agent-card .hd i { width: 10px; height: 10px; border-radius: 50%; background: var(--agent); flex: none; }
.agent-card .hd i.busy { animation: pulse 1s ease-in-out infinite; }
.agent-card .hd b { flex: 1 1 auto; font-size: 16px; }
.agent-card .act { margin: 8px 0 0; font-size: 13px; color: var(--ink2); }
.agent-card .air { margin-top: 12px; }
.agent-card .air > div:first-child { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.agent-card .home { margin-top: 10px; font-size: 12px; color: var(--muted); }
@keyframes pulse { 50% { opacity: 0.3; transform: scale(0.7); } }
.meter { height: 6px; overflow: hidden; border-radius: 3px; background: var(--line2); }
.meter > div { height: 100%; border-radius: 3px; background: var(--accent); }
.meter.hot > div { background: var(--weak); }
.plain { list-style: none; margin: 6px 0 0; padding: 0; }
.plain li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); }
.plain li button { padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.plain .r { font-size: 13px; color: var(--muted); text-align: right; }
.tag { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--fair) 18%, transparent); color: color-mix(in srgb, var(--fair) 70%, var(--ink)); font-size: 12px; font-weight: 600; }
.mq { width: 8px; height: 8px; border-radius: 50%; background: var(--mqtt); flex: none; }
.mq.off { background: var(--seen); }
.owner-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line2); font-size: 13px; color: var(--muted); }
.owner-line .btns, .sec-head .btns { display: flex; flex-wrap: wrap; gap: 8px; }
details.plain-d > summary { min-height: 32px; font-size: 15px; font-weight: 700; cursor: pointer; }
.bad-contacts { background: color-mix(in srgb, var(--fair) 14%, transparent); border: 1px solid color-mix(in srgb, var(--fair) 45%, transparent); border-radius: 8px; padding: 6px 10px; margin: 8px 0 0; font-size: 12.5px; cursor: auto; }
.bad-contacts ul { margin: 4px 0 0; padding-left: 16px; line-height: 1.45; max-height: 180px; overflow-y: auto; }

/* ---- «Статистика» ---- */

.page-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.page-title h1 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
/* The tabs stay at the top of the page while it scrolls: another report is one press away. */
.report-tabs { position: sticky; top: 0; z-index: 5; margin: -10px -20px; padding: 10px 20px; background: var(--bg); }
.report-tabs nav { display: flex; gap: 2px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); scrollbar-width: thin; }
.report-tabs button { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink2); white-space: nowrap; cursor: pointer; }
.report-tabs button:hover { background: var(--soft); }
.report-tabs button[aria-current="page"] { background: var(--ink); color: var(--panel); font-weight: 600; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.panel-head .link { min-height: 32px; font-size: 13px; font-weight: 500; text-decoration: none; }
.panel-head .link:hover { text-decoration: underline; }
/* «Как работает сеть»: a verdict, then four numbers on their scales. */
.health { padding: 24px; }
.verdict { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 14px; }
.v-icon { flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 16%, var(--panel)); }
.v-icon svg { fill: none; stroke: var(--c); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.v-text { flex: 1 1 420px; min-width: 0; }
.health .v-text h2 { font-size: 22px; line-height: 1.25; }
.v-text p { margin: 6px 0 0; max-width: 700px; font-size: 15px; color: var(--ink2); }
.v-meta { flex: 0 0 auto; padding: 4px 12px; border-radius: 999px; background: var(--soft); font-size: 13px; color: var(--ink2); }
.hmetrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin-top: 20px; }
.hm { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--tile) 45%, var(--panel)); }
.hm-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink2); }
.hm-head .chip { font-size: 12px; line-height: 20px; padding: 0 10px; }
.hm-v { font-size: 34px; font-weight: 700; line-height: 1; }
.hm-scale { position: relative; height: 10px; }
.hm-zones { display: flex; gap: 2px; height: 100%; }
.hm-zones span { border-radius: 3px; }
.hm-mark { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--panel); }
.hm-ticks { position: relative; height: 16px; margin-top: -6px; font-size: 11px; color: var(--muted); }
.hm-ticks span { position: absolute; white-space: nowrap; }
.hm p { margin: 0; font-size: 13px; }
.hm .hm-sub { color: var(--muted); }
.hm-days { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line2); }
.hm-cap { margin-bottom: 4px; font-size: 11px; color: var(--muted); }
.hm-bars { display: flex; align-items: flex-end; gap: 4px; height: 30px; }
.hm-bars i { flex: 1 1 0; border-radius: 2px; }
.hm-labels { display: flex; gap: 4px; margin-top: 2px; font-size: 10px; color: var(--muted); }
.hm-labels span { flex: 1 1 0; min-width: 0; text-align: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 12px; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); min-width: 0; }
.panel h2 { margin: 0; font-size: 17px; font-weight: 700; }
.panel > p.sub { margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.panel > p.foot { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.keys { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 14px; font-size: 12px; color: var(--ink2); }
.keys span { display: flex; align-items: center; gap: 6px; }
.keys i { width: 10px; height: 10px; border-radius: 2px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 180px; border-bottom: 1px solid var(--field); }
.bars > div { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.bars > div > i { display: block; }
.bars > div > i:first-child { border-radius: 3px 3px 0 0; }
.bar-labels { display: flex; gap: 3px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.bar-labels span { flex: 1 1 0; white-space: nowrap; overflow: visible; min-width: 0; }
.core { width: 100%; border-collapse: collapse; font-size: 14px; }
.core th { padding: 6px 4px; font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; border: 0; }
.core td { padding: 2px 4px; border-top: 1px solid var(--line2); border-bottom: 0; }
.core .num { text-align: right; }
.core button { min-height: 40px; padding: 0; border: 0; background: transparent; font-weight: 600; text-align: left; color: var(--ink); cursor: pointer; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.people .hd { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.people .hd b { font-weight: 600; }
.people .meter { height: 8px; margin-top: 4px; }
.people button { display: block; width: 100%; padding: 0; border: 0; background: transparent; font: inherit; text-align: left; color: inherit; cursor: pointer; }
.people button:hover b { color: var(--accent); }
#stats-summary { display: flex; flex-direction: column; gap: 20px; }
#stats-report { display: flex; flex-direction: column; gap: 6px; }
#stats-report a { color: var(--accent); text-decoration: none; }
#stats-report a:hover { text-decoration: underline; }
#stats-report table.tight td.small { white-space: normal; min-width: 140px; }
#report-body h3:first-child { margin-top: 4px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

/* ---- shared small pieces, the detailed reports and cards use them ---- */

h3 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.card { background: var(--tile); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.tile { background: var(--tile); border-radius: 12px; padding: 10px 12px; }
.tile b { display: block; font-size: 20px; font-weight: 700; }
.tile span { color: var(--muted); font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line2); }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--soft); }
.q { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.q.good { background: var(--good); } .q.fair { background: var(--fair); } .q.weak { background: var(--weak); } .q.seen { background: var(--seen); }
.q-good { color: color-mix(in srgb, var(--good) 85%, var(--ink)); }
.q-fair { color: color-mix(in srgb, var(--fair) 70%, var(--ink)); }
.q-weak { color: color-mix(in srgb, var(--weak) 85%, var(--ink)); }
.dir { display: grid; grid-template-columns: 1fr; gap: 8px; }
.dir .card { margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.kv.two { grid-template-columns: auto 1fr auto 1fr; }
@media (max-width: 520px) { .kv.two { grid-template-columns: auto 1fr; } }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--muted); font-size: 10px; }
svg.chart .axis { stroke: var(--line); }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.table-wrap { overflow-x: auto; }
table.sortable th { cursor: pointer; white-space: nowrap; user-select: none; }
table.sortable th.on { color: var(--ink); }
table.sortable th.on::after { content: " ▾"; }
table.sortable th.on.asc::after { content: " ▴"; }
table.sortable td { white-space: nowrap; }
td.name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.tbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-right: 4px; }
.chip { --c: var(--seen); display: inline-block; font-size: 11px; font-weight: 600; line-height: 17px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 78%, var(--ink)); white-space: nowrap; }
.chip.mqtt { --c: var(--mqtt); }
.chip.agent { --c: var(--agent); }
.warn { background: color-mix(in srgb, var(--fair) 14%, transparent); border: 1px solid color-mix(in srgb, var(--fair) 45%, transparent); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.seg-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.seg-row input { flex: 1; min-width: 0; min-height: 36px; color: var(--ink); background: var(--panel); border: 1px solid var(--field); border-radius: 8px; padding: 0 10px; }
.seg-row select, .form select, .form input { min-height: 36px; color: var(--ink); background: var(--panel); border: 1px solid var(--field); border-radius: 8px; padding: 0 8px; }
.modes { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg { border: 0; background: transparent; color: var(--ink); padding: 5px 12px; cursor: pointer; }
.seg.on { background: var(--ink); color: var(--panel); }
.form { display: flex; flex-direction: column; gap: 8px; }
.form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.route { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; background: var(--tile); }
.route.best { border-color: var(--accent); }
.route .path { font-size: 13px; margin: 4px 0 6px; line-height: 1.6; }
.route .hop { display: inline-block; padding: 0 2px; }
.route .leg { display: inline-block; font-size: 11px; padding: 0 4px; border-radius: 4px; margin: 0 2px; color: #fff; }
.big { font-size: 22px; font-weight: 700; }
.reach-legend { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--weak), var(--fair), var(--good)); margin: 4px 0; }

/* Charts over time (charts.js): small multiples on one time axis. */
.tcharts { display: grid; gap: 12px; margin-bottom: 6px; }
.tfig { margin: 0; }
.tfig figcaption { font-size: 12px; color: var(--ink); margin-bottom: 2px; }
svg.tchart { touch-action: pan-y; cursor: crosshair; border-radius: 4px; }
svg.tchart:focus { outline: none; }
svg.tchart:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .limit { stroke: var(--weak); stroke-width: 1; stroke-dasharray: 4 3; }
svg.chart .marker { stroke: var(--muted); stroke-width: 1; opacity: 0.6; }
svg.chart .xhair { stroke: var(--ink); stroke-width: 1; opacity: 0.45; pointer-events: none; }
svg.chart .dot { stroke: var(--panel); stroke-width: 2; paint-order: stroke; }
.legend i.key { width: 14px; height: 2px; border-radius: 1px; vertical-align: 3px; }
.legend i.key.dot { width: 8px; height: 8px; border-radius: 50%; vertical-align: 0; }
.legend .cross { color: var(--weak); margin-right: 4px; }
.ctip { position: fixed; z-index: 50; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px 9px; font-size: 12px; pointer-events: none; max-width: 280px; }
.ctip-when { color: var(--muted); margin-bottom: 3px; }
.ctip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1.5; }
.ctip-row b { font-weight: 650; }
.ctip-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ctip-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.page .tcharts { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.page svg.chart:not(.tchart) { max-width: 640px; }
.heat { overflow-x: auto; }
.heat svg.chart { width: auto; max-width: none; }
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.page .duo svg.chart { max-width: 420px; }
svg.chart .hrow { cursor: pointer; }
svg.chart .hrow:hover text { fill: var(--ink); }
/* «Неделя»: cards packed into columns, each thing on one line, its figure on the right. */
.digest { columns: 300px; column-gap: 8px; margin-top: 10px; }
.digest .card { break-inside: avoid; margin: 0 0 8px; }
.digest .card > b { display: block; font-size: 15px; }
.digest h4 { display: flex; align-items: baseline; gap: 6px; margin: 12px 0 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.digest h4 span { color: var(--ink); letter-spacing: 0; }
.digest .hint { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.digest .kv { margin-top: 8px; }
.digest .kv dd { white-space: nowrap; font-variant-numeric: tabular-nums; }
.drows { list-style: none; margin: 0 0 4px; padding: 0; font-size: 13px; line-height: 1.4; }
.drows li { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line2); }
.drows li:last-child { border-bottom: 0; }
.drows li > a, .drows .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drows li > span:last-child { flex: none; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
:where(.drows li > span:last-child) b { font-weight: 600; color: var(--ink); }
.drows a.pair { display: flex; gap: 5px; }
.drows a.pair span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.drows a.pair i { flex: none; font-style: normal; color: var(--muted); }

/* An observer's part of its details. */
.obs-mark { width: 11px; height: 11px; border-radius: 50%; background: var(--mqtt); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px color-mix(in srgb, var(--mqtt) 55%, transparent); flex: none; display: inline-block; }
.obs-mark.off { background: var(--seen); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--line); }
.obs-mark.big { width: 14px; height: 14px; box-shadow: 0 0 0 3px var(--panel), 0 0 0 5.5px color-mix(in srgb, var(--mqtt) 55%, transparent); margin: 4px 4px 0 3px; }
.obs-head { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 8px; }
.obs-head > div { min-width: 0; }
.obs-head b { font-size: 15px; }
.agent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 4px 0 3px; background: var(--line); }
.split > div { height: 100%; }
.stack { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 1px; background: var(--line); margin-top: 4px; }
.stack > div { height: 100%; min-width: 2px; }
.rbar { display: block; }
.rbar .zero { stroke: var(--line); }
.rbar .span { stroke: var(--seen); stroke-width: 3; stroke-linecap: round; }
.rbar .m { stroke: var(--panel); stroke-width: 1.5; }
.rbar .m.good { fill: var(--good); }
.rbar .m.fair { fill: var(--fair); }
.rbar .m.weak { fill: var(--weak); }
table.tight th, table.tight td { padding: 4px 4px; white-space: nowrap; }
table.tight td.name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
table.tight td.way { white-space: normal; min-width: 120px; }

/* «Пакеты»: the packets, newest first. */
#tab-air .seg-row .seg { padding: 4px 9px; font-size: 13px; }
#tab-air .seg-row select { margin-left: auto; max-width: 100%; }
.pk-head, .pk { display: grid; grid-template-columns: 70px 80px minmax(0, 1fr) 52px 28px; gap: 8px; align-items: center; padding: 7px 4px; font-size: 13px; }
.pk-head { color: var(--muted); border-bottom: 1px solid var(--line); padding-block: 4px; font-size: 12px; }
.pk { border-bottom: 1px solid var(--line2); cursor: pointer; }
.pk:hover { background: var(--soft); }
.pk.open { background: var(--tile); box-shadow: inset 2px 0 0 var(--accent); }
.pk time { color: var(--muted); }
.pk .path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pk .num, .pk-head .num { text-align: right; }
.pk-detail { padding: 8px 10px 12px; background: var(--tile); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; box-shadow: inset 2px 0 0 var(--accent); }
.pk-detail table { background: var(--panel); border-radius: 6px; }
.pk-detail p { margin: 0; }
.hex { font: 11px/1.5 var(--mono); word-break: break-all; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; color: var(--muted); margin: 0; white-space: pre-wrap; }
.said { padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.more { display: block; margin: 10px auto 0; }
@media (max-width: 480px) { .pk-head, .pk { grid-template-columns: 56px 64px minmax(0, 1fr) 38px 20px; gap: 6px; } }

/* «Чат»: Ommesh's bubbles, on this panel's ground. */
.chat-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; z-index: 2; background: var(--panel); }
.chat-top .seg-group { box-shadow: none; background: var(--soft); }
.chat-top .seg-group button { min-height: 34px; }
.chat-top .cnt { opacity: 0.7; margin-left: 5px; }
.chat { display: flex; flex-direction: column; gap: 2px; padding: 6px 16px 8px; }
.chat .day { width: fit-content; margin: 8px auto; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12px; }
.msg { display: flex; margin: 1px 0; }
.msg.lead { margin-top: 10px; }
.msg-avatar { flex: none; display: flex; align-self: flex-end; width: 32px; margin-right: 8px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; width: 32px; height: 32px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; background: oklch(var(--avatar-l) var(--avatar-c) var(--hue)); color: oklch(20% 0.03 var(--hue)); }
.avatar.emo { font-size: 16px; letter-spacing: 0; }
.msg-col { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; min-width: 0; }
.bubble { display: flow-root; max-width: 100%; padding: 8px 12px 6px; border-radius: 14px 14px 14px 4px; background: var(--bubble); color: var(--ink); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.msg-sender { display: block; font-size: 12px; font-weight: 600; color: oklch(var(--name-l) var(--name-c) var(--hue)); margin-bottom: 1px; white-space: nowrap; }
.msg-meta { display: flex; float: right; align-items: center; gap: 4px; margin: 5px 0 -3px 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.msg-tech { display: none; }
@media (hover: hover) { .msg:hover .msg-tech { display: inline; } }
.msg-break { display: block; }
.msg-reacts { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; vertical-align: bottom; white-space: normal; }
.react-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px 0 6px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 11px; font-weight: 600; }
.react-emoji { font-size: 15px; line-height: 1; }
.jumbo { display: flex; flex-direction: column; align-items: flex-start; cursor: pointer; border-radius: 12px; }
.jumbo .msg-text { font-size: 60px; line-height: 1.05; white-space: nowrap; }
.jumbo-2 .msg-text { font-size: 48px; }
.jumbo-3 .msg-text { font-size: 38px; }
.jumbo .msg-meta { float: none; align-self: flex-end; margin: 2px 0 0; padding: 1px 7px; border-radius: 10px; background: var(--soft); }
.jumbo .msg-break { display: none; }
.mention { color: var(--accent); font-weight: 500; }
.msg-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble:focus-visible, .jumbo:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.msg.on .bubble, .msg.on .jumbo { box-shadow: 0 0 0 2px var(--accent); }
.travel { margin-top: 6px; width: 100%; min-width: 0; font-size: 12px; background: var(--tile); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.travel table { background: var(--panel); border-radius: 6px; }
/* «Как дошло»: the tree of relays from the author, each with who heard it from there. */
.wt-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.wt-facts span { padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink2); }
.wt-facts b { color: var(--ink); }
.wt-tree { padding: 6px 4px 4px; border-radius: 8px; background: var(--panel); }
.wt-root { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 0 6px 4px; }
.wt-root b { font-size: 13px; }
.wt-row { display: flex; align-items: stretch; width: 100%; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; font: inherit; text-align: left; color: inherit; cursor: pointer; }
.wt-row:hover { background: var(--soft); }
.wt-row.on { background: var(--accent-soft); }
.wt-rail, .wt-elbow { flex: 0 0 16px; position: relative; }
.wt-rail.line::before, .wt-elbow::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 1.5px; background: var(--field); }
.wt-elbow.last::before { bottom: auto; height: 14px; }
.wt-elbow::after { content: ""; position: absolute; left: 6px; top: 13px; width: 9px; height: 1.5px; background: var(--field); }
.wt-body { flex: 1 1 auto; min-width: 0; padding: 4px 0 5px 2px; }
.wt-name { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.wt-chips { display: flex; flex-wrap: wrap; gap: 3px 5px; margin-top: 3px; }
.wt-root .wt-chips { flex-basis: 100%; margin-top: 0; }
.wt-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px 0 6px; border-radius: 999px; background: var(--soft); line-height: 19px; color: var(--ink2); white-space: nowrap; }
.wt-chip i, .wt-keys i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--agent); }
.wt-chip i.mqtt, .wt-keys i.mqtt { background: var(--mqtt); }
.wt-chip b { font-weight: 600; }
.wt-chip b.good { color: var(--good); }
.wt-chip b.fair { color: var(--fair); }
.wt-chip b.weak { color: var(--weak); }
.wt-unread { padding: 6px 6px 2px; }
.wt-keys { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); }
.wt-keys i { margin-right: 4px; }
.wt-all summary { min-height: 28px; color: var(--muted); cursor: pointer; }
.wt-all .table-wrap { margin-top: 4px; }
.chat-foot { margin: 0; padding: 12px 20px 16px; border-top: 1px solid var(--line2); font-size: 12px; color: var(--muted); }

/* ---- the dialogs ---- */

dialog { border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); padding: 28px 28px 24px; width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
dialog::backdrop { background: rgba(22, 25, 29, 0.45); }
dialog h2 { margin: 0; font-size: 22px; font-weight: 700; }
.help-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.help-head p { margin: 4px 0 0; }
.close { flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: var(--soft); cursor: pointer; }
.close svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 22px; margin: 24px 0 0; padding: 0; }
.steps li { display: flex; gap: 14px; }
.steps li > div { flex: 1 1 auto; min-width: 0; }
.steps .n { flex: 0 0 auto; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--ink); color: var(--panel); font-size: 14px; font-weight: 700; }
.steps .n.done { background: var(--good); color: var(--on-accent); }
.steps h3 { margin: 2px 0 4px; font-size: 16px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); }
.steps p { margin: 0 0 10px; color: var(--ink2); }
.steps p.small { margin: 8px 0 0; }
.pin { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; }
.pin input { width: 120px; min-height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: var(--panel); font-size: 15px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; margin-top: 8px; font-size: 14px; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.cmd { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 6px 6px 14px; border-radius: 10px; background: #16191d; }
.cmd code { flex: 1 1 auto; min-width: 0; padding: 8px 0; overflow-x: auto; white-space: nowrap; font: 13px var(--mono); color: #e6e9ed; }
.cmd.block { align-items: flex-start; }
.cmd.block code { white-space: pre; }
.cmd .copy { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: #2d343c; font-size: 13px; font-weight: 600; color: #fff; cursor: pointer; }
.more-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line2); }
.more-box > summary { cursor: pointer; font-size: 14px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.more-box p { margin: 8px 0 0; }
.builds { list-style: none; padding: 0; margin: 8px 0; }
.builds li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.builds code { grid-column: 1 / -1; font: 11px var(--mono); color: var(--muted); overflow-wrap: anywhere; user-select: all; }
.help-foot { display: flex; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line2); }
.pace-list { margin-top: 14px; }

/* «Прошить репитер» */
.flash-no { margin: 16px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.flash-release { margin-top: 12px; flex-wrap: wrap; }
.flash-release[hidden] { display: none; }
.flash-go { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; }
.flash-bar { height: 8px; margin-top: 12px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.flash-bar > div { width: 0; height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.2s; }
#flash-state, #fl-state { margin: 10px 0 0; }
#flash-state:empty, #fl-state:empty { display: none; }
#flash .ok { color: var(--good-ink); }
#flash .bad { color: color-mix(in srgb, var(--weak) 80%, var(--ink)); }
.flash-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 4px; }
.flash-form label, .flash-form .wide-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; color: var(--ink2); }
.flash-form .wide-field { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: baseline; }
.flash-form .wide-field input { grid-column: 1 / -1; }
.flash-form .link { font-size: 13px; }
.flash-form input { min-height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 15px; }
.flash-log { max-height: 160px; margin: 12px 0 0; padding: 10px 12px; overflow: auto; border-radius: 10px; background: #16191d; color: #e6e9ed; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- «Пакеты»: the air over the map, the line under it, the packets in the panel ---- */

.tool svg { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
#packets-toggle path { opacity: 0.55; }
#packets-toggle circle { fill: currentColor; stroke: none; }
.snowy #packets-toggle circle { fill: #f6faff; stroke: #7f9fc0; stroke-width: 1.2; }
.snow-note { position: fixed; left: 50%; top: 136px; z-index: 50; margin: 0; padding: 8px 16px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-size: 14px; color: var(--ink); pointer-events: none; animation: snow-note 2.6s ease both; }
@keyframes snow-note { from { opacity: 0; transform: translate(-50%, -8px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .snow-note { animation: none; } }
.packet-canvas { position: absolute; left: 0; top: 0; pointer-events: none; }

.air-bar { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 4; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: var(--shadow); }
.air-bar[hidden] { display: none; }
.air-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.air-play { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--ink); cursor: pointer; }
.air-play svg { width: 16px; height: 16px; fill: none; stroke: var(--panel); stroke-width: 2.4; stroke-linecap: round; }
.air-play svg .fill { fill: var(--panel); stroke: none; }
.air-clock { flex: none; display: flex; flex-direction: column; line-height: 1.2; }
.air-clock b { font-size: 17px; font-variant-numeric: tabular-nums; }
.air-clock span { font-size: 12px; color: var(--muted); }
.seg-group.air-seg button { min-height: 36px; padding: 0 12px; font-size: 13px; }
.seg-group.air-seg button:disabled { opacity: 0.45; cursor: default; }
.seg-group.air-seg > span { padding: 0 4px 0 10px; font-size: 12px; }
.air-hint { flex: 1 1 200px; min-width: 0; font-size: 12px; line-height: 1.35; color: var(--muted); }
.air-kinds { display: flex; flex-wrap: wrap; gap: 4px; }
.air-kind { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.air-kind i { width: 10px; height: 10px; border-radius: 50%; }
.air-kind b { font-weight: 600; color: var(--muted); }
.air-kind[aria-pressed="false"] { background: transparent; opacity: 0.5; }
.air-hist { position: relative; display: flex; align-items: flex-end; gap: 2px; width: 100%; height: 40px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.air-bin { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column-reverse; }
.air-bin i { display: block; flex: none; }
.air-bin.ahead { opacity: 0.4; }
.air-head { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); pointer-events: none; }
.air-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* The legend and the map's corners stand over the line. */
body.air-on .map-legend { bottom: calc(var(--air-h, 128px) + 28px); }
body.air-on .maplibregl-ctrl-bottom-right, body.air-on .maplibregl-ctrl-bottom-left { bottom: calc(var(--air-h, 128px) + 16px); }

.air-body { display: flex; flex-direction: column; gap: 18px; padding: 16px 20px 28px; }
.air-body .tiles3 span, .air-facts4 span { display: block; margin-top: 2px; line-height: 1.3; }
.air-feed { display: flex; flex-direction: column; margin-top: 6px; }
.air-feed > p { margin: 4px 0 0; }
.air-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 4px; border: 0; border-top: 1px solid var(--line2); background: transparent; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.air-item:hover { background: var(--soft); }
.air-item > i { flex: 0 0 10px; height: 10px; border-radius: 50%; }
.air-item > span { flex: 1 1 auto; min-width: 0; }
.air-item b, .air-item small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.air-item b { font-weight: 600; }
.air-item small { font-size: 12px; color: var(--muted); }
.air-item time { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.air-how summary { min-height: 32px; font-weight: 600; cursor: pointer; }
.air-how-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--ink2); }
.air-how-row svg { flex: none; }

.air-back { align-self: flex-start; }
.air-kindline { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.air-text { margin: 6px 0 0; font-size: 15px; color: var(--ink2); overflow-wrap: anywhere; }
.side-head .air-text + .muted, .side-head h1 + .muted { margin: 8px 0 0; }
.air-facts4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.air-facts4 > div { min-width: 0; padding: 8px 10px; border-radius: 12px; background: var(--tile); }
.air-facts4 b { display: block; font-size: 18px; font-weight: 700; line-height: 1.2; }
.air-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.air-ctl .seg-group button { min-height: 34px; padding: 0 12px; font-size: 13px; }
/* A packet's hops: a row a transmission, its bar on the packet's own time, a line from where it waited. */
.air-gantt { --name: 168px; position: relative; margin-top: 8px; }
.ag-head, .ag-row { display: grid; grid-template-columns: var(--name) minmax(0, 1fr); gap: 10px; align-items: center; }
.ag-head { align-items: end; padding-bottom: 4px; }
.ag-ticks { position: relative; height: 16px; }
.ag-ticks span { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.ag-row { row-gap: 3px; padding: 5px 0; border-top: 1px solid var(--line2); }
.ag-row.on { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ag-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ag-name b { min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-name span { flex: none; font-size: 12px; }
/* Who heard it, under the name and the bar both. */
.ag-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 3px; font-size: 11px; }
.ag-track { position: relative; height: 14px; border-radius: 4px; background: var(--soft); }
.ag-bar { position: absolute; top: 2px; height: 10px; min-width: 3px; box-sizing: border-box; border-radius: 3px; background: var(--c); }
.ag-bar.est { background: transparent; border: 1.5px dashed var(--c); }
.ag-wait { position: absolute; top: 6px; height: 2px; background: var(--muted); opacity: 0.6; }
.ag-play { position: absolute; top: 20px; bottom: 0; left: calc(var(--name) + 10px + (100% - var(--name) - 10px) * var(--at, 0)); width: 2px; margin-left: -1px; background: var(--ink); opacity: 0.75; pointer-events: none; }

/* ---- a phone: the sections at the bottom, the panel a sheet over the map ---- */

@media (max-width: 800px) {
  .top { padding: 8px 12px; gap: 8px; }
  .brand { font-size: 16px; }
  .sections { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--panel); }
  .sections button { flex-direction: column; justify-content: center; gap: 3px; min-height: 0; padding: 0; border-radius: 0; font-size: 11px; color: var(--muted); }
  .sections button:hover { background: transparent; }
  .sections button[aria-current="page"] { background: transparent; color: var(--accent); font-weight: 600; }
  .sections svg { display: block; }
  .sections .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
  .status { padding: 4px 10px; font-size: 12px; }
  #help-open, #flash-open { width: 44px; padding: 0; }
  #help-open .wide, #flash-open .wide { display: none; }
  #help-open .narrow, #flash-open .narrow { display: block; }
  .flash-form { grid-template-columns: 1fr; }
  main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  aside#side { position: absolute; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 6; max-height: 46%; border: 0; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-up); overflow: hidden; }
  /* The sheet's handle is its fold: a tap leaves only the handle over the map. */
  .side-toggle { position: static; flex: none; width: 100%; height: 24px; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .side-toggle svg { display: none; }
  .side-toggle::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--field); }
  body.side-off aside#side .side-toggle { height: 32px; }
  body[data-view="chat"] aside#side, body[data-view="agents"] aside#side { max-height: 78%; }
  body.sheet-tall aside#side { max-height: 60%; }
  .map-tools { top: 12px; right: 12px; left: 68px; }
  .map-tools .seg-group > span { display: none; }
  .map-legend { display: none; }
  /* «Пакеты»: the line goes up under the switches, out of the sheet's way. */
  .air-bar { top: 64px; bottom: auto; left: 12px; right: 12px; gap: 4px; padding: 6px 8px; }
  .air-row { gap: 6px; }
  .air-play { width: 40px; height: 40px; }
  .air-clock b { font-size: 15px; }
  .air-clock span { font-size: 11px; }
  .seg-group.air-seg button { min-height: 34px; padding: 0 7px; }
  .seg-group.air-seg > span { padding: 0 2px 0 6px; }
  .air-hint, .air-axis { display: none; }
  .air-hist { height: 26px; }
  /* Zoomed by fingers there: the buttons give the line their corner. */
  body.air-on .maplibregl-ctrl-top-left { display: none; }
  .air-gantt { --name: 128px; }
  .air-facts4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.air-on .maplibregl-ctrl-bottom-right, body.air-on .maplibregl-ctrl-bottom-left { bottom: 0; }
  .maplibregl-ctrl-top-left .maplibregl-ctrl { margin: 12px 0 0 12px; }
  .page-in { padding: 20px 14px 40px; }
  .report-tabs { margin: -10px -14px; padding: 10px 14px; }
  .health { padding: 18px; }
  .side-head { padding-top: 8px; }
  .tiles3 b { font-size: 18px; }
}
@media (max-width: 480px) {
  .air-kinds { display: none; }
}
@media (max-width: 420px) {
  .status { display: none; }
}

/* ---- «Планирование»: points to put a repeater at, and what each would give ---- */

body:not([data-view="plan"]) .plan-only { display: none; }
body.ruler-on .plan-hint.plan-only { display: none; }
.ruler path.line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ruler path.tail { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 5; opacity: 0.7; }
.ruler circle { fill: var(--panel); stroke: var(--ink); stroke-width: 2.5; }
.ruler text { font: 600 12px/1 var(--font, inherit); fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.ruler text.leg { text-anchor: middle; }
.ruler text.sum { font-size: 14px; font-weight: 700; }
.plan-hint { position: absolute; left: 50%; bottom: 44px; z-index: 3; transform: translateX(-50%); margin: 0; padding: 8px 14px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-size: 13px; color: var(--ink2); white-space: nowrap; pointer-events: none; }
.plan-head { display: flex; flex-direction: column; gap: 10px; }
.plan-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-tabs:empty { display: none; }
.plan-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 6px; border: 1px solid var(--field); border-radius: 10px; background: var(--panel); font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.plan-tab b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--plan); color: var(--panel); font-size: 13px; }
.plan-tab[aria-selected="true"] { border-color: var(--plan); background: var(--plan-soft); color: var(--plan-ink); }
.plan-tiles b { font-size: 19px; }
.plan-now { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--tile); }
.plan-config { display: flex; flex-direction: column; gap: 16px; }
.plan-config h2 { margin: 0; font-size: 16px; }
.plan-row { display: flex; flex-direction: column; gap: 8px; }
.plan-row h3, .plan-profile h3 { margin: 0; font-size: 14px; font-weight: 600; }
.plan-config .chips button[aria-pressed="true"], .plan-now .chips button[aria-pressed="true"] { border-color: var(--plan); background: var(--plan-soft); color: var(--plan-ink); }
.chips .muted { align-self: center; margin-right: 4px; }
.warn-ink { color: var(--warn-ink) !important; font-weight: 600; }
.plan-ants { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px; }
.plan-ant { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 76px; padding: 8px 4px; border: 1px solid var(--field); border-radius: 10px; background: var(--panel); color: var(--ink); cursor: pointer; }
.plan-ant svg { width: 30px; height: 30px; }
.plan-ant svg circle { fill: none; stroke: var(--line); }
.plan-ant svg path { fill: none; stroke: var(--ink2); stroke-width: 1.4; stroke-linejoin: round; }
.plan-ant b { font-size: 12px; font-weight: 600; line-height: 1.2; }
.plan-ant span { font-size: 12px; color: var(--muted); }
.plan-ant[aria-pressed="true"] { border-color: var(--plan); background: var(--plan-soft); color: var(--plan-ink); }
.plan-ant[aria-pressed="true"] svg path { fill: color-mix(in srgb, var(--plan) 20%, transparent); stroke: var(--plan); }
.plan-ant[aria-pressed="true"] span { color: var(--plan-ink); }
.plan-bars { display: flex; align-items: flex-end; gap: 6px; }
.plan-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 4px 2px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; }
.plan-bar b { font-size: 12px; text-align: center; }
.plan-bar i { display: block; margin: 0 4px; background: var(--seen); }
.plan-bar i.ext { margin-bottom: -3px; border-radius: 4px 4px 0 0; background: var(--line); }
.plan-bar span { font-size: 12px; font-weight: 600; text-align: center; }
.plan-bar small { font-size: 11px; color: var(--muted); text-align: center; }
.plan-bar[aria-pressed="true"] { background: var(--plan-soft); }
.plan-bar[aria-pressed="true"] i { background: var(--plan); }
.plan-bar[aria-pressed="true"] i.ext { background: color-mix(in srgb, var(--plan) 40%, var(--panel)); }
.plan-profile { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; padding: 12px 14px; border-radius: 12px; background: var(--tile); }
.plan-profile svg { display: block; width: 100%; height: 140px; }
.plan-profile .ground { fill: var(--line); stroke: var(--seen); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plan-profile .roof { fill: var(--roof); }
.plan-profile .tree { fill: var(--tree); opacity: 0.85; }
.plan-profile-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; }
.plan-profile-key span { display: inline-flex; align-items: center; gap: 5px; }
.plan-profile-key i { width: 10px; height: 10px; border-radius: 2px; background: var(--roof); }
.plan-profile-key i.tree { background: var(--tree); }
.plan-profile .fresnel { fill: none; stroke: var(--fair); stroke-width: 1.3; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; }
.plan-profile .los { fill: none; stroke: var(--plan); stroke-width: 2; vector-effect: non-scaling-stroke; }
.plan-profile .mast { fill: none; stroke: var(--ink2); stroke-width: 3; vector-effect: non-scaling-stroke; }
.plan-profile-ends { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.plan-profile dd.q-good { color: var(--good-ink); } .plan-profile dd.q-weak { color: var(--weak); }
.plan-links-head, .plan-link { display: grid; grid-template-columns: minmax(0, 1fr) 64px 64px 48px; align-items: center; gap: 8px; }
.plan-links-head { padding: 0 8px 4px; font-size: 11px; color: var(--muted); }
.plan-links-head span:last-child, .plan-link .p { text-align: right; }
.plan-link { width: 100%; min-height: 50px; padding: 6px 8px; border: 0; border-top: 1px solid var(--line2); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.plan-link[aria-pressed="true"] { background: var(--plan-soft); }
.plan-link .n { min-width: 0; }
.plan-link .n b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.plan-link .n small { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12px; color: var(--muted); }
.plan-link .n svg { width: 10px; height: 10px; fill: var(--muted); }
.plan-link .tag { margin: 0; font-style: normal; background: var(--soft); color: var(--ink2); }
.plan-link .tag.on { background: var(--plan-soft); color: var(--plan-ink); }
.plan-link .half { display: flex; flex-direction: column; gap: 3px; background: linear-gradient(var(--soft), var(--soft)) top / 100% 6px no-repeat; }
.plan-link .half i { display: block; height: 6px; border-radius: 3px; background: var(--q); }
.plan-link .half small { font-size: 12px; color: var(--ink2); }
.plan-link .p { font-weight: 700; }
.plan-link .p.sure { color: var(--good-ink); } .plan-link .p.no { color: var(--muted); }
.plan-link .p small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.plan-compare { width: 100%; border-collapse: collapse; font-size: 13px; }
.plan-compare th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 4px 6px 6px 0; }
.plan-compare td { padding: 8px 6px 8px 0; border-top: 1px solid var(--line2); vertical-align: top; }
.plan-compare .num { text-align: right; }
.plan-compare small { display: block; font-size: 12px; color: var(--muted); }
.plan-compare tr[data-act] { cursor: pointer; }
.plan-compare tr.on td { background: var(--plan-soft); }
.plan-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.plan-legend span { display: inline-flex; align-items: center; gap: 6px; }
.plan-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.plan-legend .sw.now { background: color-mix(in srgb, var(--good) 35%, transparent); }
.plan-legend .sw.cov { border: 1.5px solid var(--plan); background: color-mix(in srgb, var(--plan) 22%, transparent); }
.plan-legend .sw.hata { border: 1.5px dashed var(--plan); }
