:root {
  --agent: #8b5cf6;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #69727d;
  --line: #e2e5ea;
  --accent: #2f6fde;
  --good: #22a565;
  --fair: #d9a400;
  --weak: #e0503c;
  --seen: #9aa3ad;
  --a: #2f6fde;
  --b: #c2410c;
  --ground: #a3a08f;
  --fresnel: rgba(47, 111, 222, 0.14);
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.05);
  /* MQTT observers: radios that hand up every packet they hear. */
  --mqtt: #0b8f86;
  /* The chat, as Ommesh draws it: a swatch and a name in a hue hashed from the sender. */
  --bubble: #eceef1;
  --avatar-l: 62%;
  --avatar-c: 0.11;
  --name-l: 50%;
  --name-c: 0.14;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --panel: #181c21;
    --ink: #e6e9ed;
    --muted: #8b949e;
    --line: #2a3038;
    --accent: #6ea0ff;
    --agent: #a78bfa;
    --good: #3ccf86;
    --fair: #f0c419;
    --weak: #ff6b57;
    --seen: #6b7480;
    --a: #6ea0ff;
    --b: #ff9a5a;
    --ground: #6f6c5f;
    --fresnel: rgba(110, 160, 255, 0.16);
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --mqtt: #36cfc0;
    --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.4 system-ui, -apple-system, "Segoe UI", sans-serif; display: flex; flex-direction: column; }
.mono { font-variant-ligatures: none; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

.bar { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 650; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; }
.pill { font-weight: 500; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.pill.on { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.pill.off { background: color-mix(in srgb, var(--weak) 18%, transparent); color: var(--weak); }
.pill.passive { background: color-mix(in srgb, var(--fair) 20%, transparent); color: var(--fair); }
.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; font: inherit; }
.seg.on { background: var(--accent); color: white; }
.win { display: flex; gap: 6px; align-items: center; color: var(--muted); }
select, input[type=number] { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.timeline { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; min-width: 240px; }
.timeline .track { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.timeline .track input { width: 100%; margin: 0; }
/* How much was recorded when, under the slider and lined up with its thumb's travel. */
.density { height: 10px; margin: 0 8px; }
.density svg { display: block; width: 100%; height: 10px; }
.density rect { fill: var(--accent); opacity: 0.6; }
.track-ends { display: flex; justify-content: space-between; margin: 0 8px; font-size: 10px; line-height: 1; color: var(--muted); }
.spacer { flex: 1; }
.btn { font: inherit; border: 1px solid var(--accent); background: var(--accent); color: white; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon { font: inherit; border: 1px solid var(--line); background: transparent; color: var(--ink); width: 30px; height: 28px; border-radius: 6px; cursor: pointer; }

main { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; min-width: 0; }
aside { width: var(--aside-w, min(460px, 46vw)); max-width: calc(100% - 240px); flex: none; display: flex; flex-direction: column; background: var(--panel); min-height: 0; }
/* The border between the map and the panel, dragged to share the width: a hairline, wide to the pointer. */
.splitter { flex: none; width: 9px; margin: 0 -4px; z-index: 5; position: relative; cursor: col-resize; touch-action: none; background: transparent; }
.splitter::before { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: var(--line); transition: background 0.15s, width 0.15s, left 0.15s; }
.splitter:hover::before, .splitter.drag::before, .splitter:focus-visible::before { left: 3px; width: 3px; background: var(--accent); }
.splitter:focus-visible { outline: none; }
body.dragging { user-select: none; cursor: col-resize; }
body.dragging.stacked { cursor: row-resize; }
.owner-in { margin-right: auto; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1 0 auto; border: 0; background: transparent; color: var(--muted); padding: 9px 7px; font: inherit; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab { display: none; overflow: auto; padding: 12px; flex: 1; min-height: 0; }
.tab.on { display: block; }
h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); font-weight: 600; }
h2 { margin: 0 0 4px; font-size: 17px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }

.activity { display: flex; gap: 10px; align-items: flex-start; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--seen); }
.dot.busy { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; transform: scale(0.7); } }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.meter > div { height: 100%; background: var(--accent); }
.meter.hot > div { background: var(--weak); }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.tile b { display: block; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 12px; }

.log { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.log li { padding: 5px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 58px 1fr; gap: 8px; }
.log li time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log li.ok span::before { content: "● "; color: var(--good); }
.log li.warn span::before { content: "● "; color: var(--fair); }
.log li.error span::before { content: "● "; color: var(--weak); }
.log li.info span::before { content: "● "; color: var(--seen); }
.log li.fresh { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 18%, transparent); } }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--bg); }
.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); }

.dir { display: grid; grid-template-columns: 1fr; gap: 8px; }
.dir .card { margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
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; }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 16px 18px; width: min(420px, 92vw); }
dialog label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0; }
dialog input { width: 90px; }

.chan { margin-top: 8px; padding: 6px 8px; border-radius: 7px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); }
.chan span { color: var(--muted); }
.chan.busy { background: color-mix(in srgb, var(--weak) 12%, transparent); border-color: color-mix(in srgb, var(--weak) 35%, transparent); }
.chan.quiet { background: color-mix(in srgb, var(--good) 12%, transparent); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
dialog input[type=checkbox] { width: auto; }

.filters { position: absolute; top: 10px; right: 10px; z-index: 3; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); font-size: 12.5px; max-width: 260px; }
.filters-head { border: 0; background: transparent; color: var(--ink); font: 600 12.5px system-ui, sans-serif; padding: 7px 12px; cursor: pointer; width: 100%; text-align: left; }
.filters-head span { color: var(--accent); }
.filters-body { padding: 0 12px 10px; }
.fgroup { margin: 6px 0 8px; display: flex; flex-direction: column; gap: 2px; }
.fgroup b { font-weight: 600; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.fgroup label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.fgroup input[type=range] { width: 100%; }
.btn.small { padding: 3px 10px; font-size: 12px; }
.form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.form label.check { justify-content: flex-start; }
.form select { flex: 1; min-width: 0; max-width: 260px; }
.route { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 8px 0; background: var(--bg); }
.route.best { border-color: var(--accent); }
.route .path { font-size: 12.5px; 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: 650; font-variant-numeric: tabular-nums; }
.site-mark circle { fill: color-mix(in srgb, var(--accent) 25%, transparent); stroke: var(--accent); stroke-width: 2.5; }
.site-mark path { stroke: var(--accent); stroke-width: 2; }
.reach-legend { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--weak), var(--fair), var(--good)); margin: 4px 0; }

.logo { color: var(--agent); }
.agent { cursor: pointer; }
.agent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.agent-head .dot { margin-top: 0; }
.agent-head .version { margin-left: auto; font-variant-numeric: tabular-nums; }
.dot.on { background: var(--good); }
.kv dt .dot { display: inline-block; width: 8px; height: 8px; margin: 0 6px 0 0; }
.activity-line { margin: 4px 0 8px; }
.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; 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; }
.bad-contacts li + li { margin-top: 3px; }
.chan-busy { color: var(--weak); }
.chan-quiet { color: var(--good); }
.empty { text-align: center; padding: 18px 8px; border: 1px dashed var(--line); border-radius: 12px; margin-bottom: 10px; }
.empty p { margin: 6px 0 12px; }
.agent-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--agent); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--agent); margin: 0 8px 0 2px; vertical-align: -1px; }

.seg-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.seg-row input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
.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: 150px; overflow: hidden; text-overflow: ellipsis; }
.tbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-right: 4px; }

dialog.help { width: min(560px, 94vw); padding: 22px 24px; }
.help-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.help-head h2 { margin: 0; }
.help-head p { margin: 2px 0 0; }
.big-logo { font-size: 34px; line-height: 1; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 12px 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: white; font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 28px; bottom: 4px; width: 1px; background: var(--line); }
.steps p { margin: 4px 0; }
.cmd { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 10px; margin: 6px 0; }
.cmd code { font-variant-ligatures: none; flex: 1; font: 12.5px ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-x: auto; white-space: nowrap; }
.cmd.block { align-items: flex-start; }
.cmd.block code { white-space: pre; }
.cmd .copy { font: 12px system-ui, sans-serif; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.help-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 14px; }
.help-notes div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.help-notes span { color: var(--muted); }
@media (max-width: 600px) { .help-notes { grid-template-columns: 1fr; } }


.relief-scale { margin-top: 6px; }
.relief-bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #1f7a6a 0%, #3f9a4e 22%, #9cc15a 39%, #e3c75c 56%, #d9894a 72%, #b45a3a 100%); }
.relief-ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }

.manual { margin: 8px 0 0; }
.manual summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.builds { list-style: none; padding: 0; margin: 6px 0; }
.builds li { counter-increment: none; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.builds li::before, .builds li::after { content: none !important; }
.builds code { grid-column: 1 / -1; font: 11px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); overflow-wrap: anywhere; user-select: all; }
.os-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 6px 0 2px; }
.os-tabs .seg { font-size: 12.5px; padding: 4px 10px; }
dialog label.ble-pick { justify-content: flex-start; gap: 0; margin: 6px 0 0; font-size: 13px; cursor: pointer; }
.ble-pick input[type="checkbox"] { margin: 0 6px 0 0; accent-color: var(--accent); }
.ble-pick #install-pin { width: 8ch; margin-left: 4px; font: 12.5px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }

/* Map. */
#map { position: relative; }
.maplibregl-map { font: inherit; background: var(--bg); }
.node-canvas, .live-overlay { position: absolute; left: 0; top: 0; pointer-events: none; }
.live-overlay { width: 100%; height: 100%; overflow: visible; }
.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); } }
.maplibregl-popup.tip .maplibregl-popup-content { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.45; }
.maplibregl-popup.tip .maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-group { background: var(--panel); }
.maplibregl-ctrl-group button { color: var(--ink); }
@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); }
}
.map-toggles button { width: auto; padding: 0 9px; font: 600 12px system-ui, sans-serif; }
.map-toggles button.on { background: var(--accent); color: white; }
.map-legend { background: var(--panel); color: var(--ink); padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow); font-size: 12px; line-height: 1.6; }
.map-legend .gap { margin-top: 4px; }
.map-legend i { display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: 3px; border-radius: 2px; }
.map-legend i.dash { height: 0; border-top: 2px dashed var(--seen); }
.map-legend b.obs-dot { display: inline-block; width: 9px; height: 9px; 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); margin: 0 8px 0 2px; vertical-align: -1px; }
.map-legend i.mqtt-line { height: 0; background: none; border-top: 2px dashed var(--mqtt); }
.map-legend b.dia { display: inline-block; width: 8px; height: 8px; margin: 0 8px 0 2px; border: 2px solid; transform: rotate(45deg); vertical-align: 0; }

@media (max-width: 800px) {
  main { flex-direction: column; }
  #map { height: var(--map-h, 55vh); flex: none; }
  aside { width: 100%; max-width: none; flex: 1; }
  .splitter { width: auto; height: 9px; margin: -4px 0; cursor: row-resize; }
  .splitter::before { top: 4px; bottom: auto; left: 0; right: 0; width: auto; height: 1px; }
  .splitter:hover::before, .splitter.drag::before, .splitter:focus-visible::before { left: 0; top: 3px; width: auto; height: 3px; }
}

code { font-variant-ligatures: none; }

/* 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-variant-numeric: tabular-nums; 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; }

/* Without the map: the data takes the width, in a column a reader can follow. */
body.no-map #map, body.no-map .splitter { display: none; }
body.no-map aside { width: 100%; max-width: none; border-left: 0; border-top: 0; }
body.no-map .tabs { justify-content: center; }
body.no-map .tabs button { flex: 0 0 auto; padding: 10px 16px; }
body.no-map .tab { padding-inline: max(12px, calc((100% - 1100px) / 2)); }
body.no-map .tcharts { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
body.no-map svg.chart:not(.tchart) { max-width: 640px; }

/* Small things the new cards share. */
.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); }
.mqtt-key { display: inline-block; width: 14px; border-top: 2px dashed var(--mqtt); vertical-align: 3px; }
.tab-badge { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 4px; border-radius: 8px; background: var(--accent); color: white; font-size: 10.5px; line-height: 16px; font-weight: 600; text-align: center; }
.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)); }
.more { display: block; margin: 10px auto 0; }
.silent-line { margin: 8px 0 0; }
.silent-line .btn { margin-left: 4px; }

/* MQTT observers on «Сейчас», and 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-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; text-align: left; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; margin: 6px 0 4px; font: inherit; }
.obs-row:hover { border-color: var(--mqtt); }
.obs-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.obs-main .t { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.obs-main .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obs-side { text-align: right; font-variant-numeric: tabular-nums; }
.obs-side b { display: block; font-size: 16px; }
.obs-spark { grid-column: 2 / -1; display: flex; align-items: flex-end; gap: 10px; }
.obs-spark svg { flex: 1; min-width: 0; height: 24px; display: block; }
.obs-spark rect { fill: var(--mqtt); }
.obs-spark span { flex: none; }
.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); }
h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
table.tight th, table.tight td { padding: 4px 4px; white-space: nowrap; }
table.tight td.name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
table.tight td.way { white-space: normal; min-width: 120px; }
.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; }
.kv.two { grid-template-columns: auto 1fr auto 1fr; }
@media (max-width: 520px) { .kv.two { grid-template-columns: auto 1fr; } }

/* «Эфир»: the packets, newest first. */
#tab-air .seg-row { flex-wrap: wrap; }
#tab-air .seg-row .modes { flex: none; }
#tab-air .seg-row .seg { padding: 4px 9px; font-size: 12.5px; }
#tab-air .seg-row select { margin-left: auto; max-width: 100%; }
.pk-head, .pk { display: grid; grid-template-columns: 62px 72px minmax(0, 1fr) 44px 24px; gap: 8px; align-items: center; padding: 6px 4px; font-size: 12.5px; }
.pk-head { color: var(--muted); border-bottom: 1px solid var(--line); padding-block: 4px; font-size: 12px; }
.pk { border-bottom: 1px solid var(--line); cursor: pointer; }
.pk:hover { background: var(--bg); }
.pk.open { background: var(--bg); box-shadow: inset 2px 0 0 var(--accent); }
.pk time { color: var(--muted); font-variant-numeric: tabular-nums; }
.pk .path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pk .num, .pk-head .num { text-align: right; font-variant-numeric: tabular-nums; }
.pk-detail { padding: 8px 10px 12px; background: var(--bg); 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 ui-monospace, "Cascadia Mono", Consolas, monospace; 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; }
@media (max-width: 480px) { .pk-head, .pk { grid-template-columns: 56px 64px minmax(0, 1fr) 38px 20px; gap: 6px; } }

/* «Чат»: Ommesh's bubbles (apps/web/src/styles.css there), on this sidebar's ground. */
.chat-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.chat-head .seg { padding: 4px 10px; font-size: 12.5px; }
.chat-head .cnt { opacity: 0.7; margin-left: 5px; font-variant-numeric: tabular-nums; }
.chat-pace { font-size: 12px; padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line); margin-bottom: 4px; }
.chat-pace.quiet { border-color: color-mix(in srgb, var(--good) 35%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.chat-pace.busy { border-color: color-mix(in srgb, var(--weak) 35%, transparent); background: color-mix(in srgb, var(--weak) 10%, transparent); }
.chat { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 8px; }
.chat .day { width: fit-content; margin: 8px auto; padding: 2px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.msg { display: flex; margin: 1px 0; }
.msg.lead { margin-top: 8px; }
.msg-avatar { flex: none; display: flex; align-self: flex-end; width: 28px; margin-right: 6px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; width: 28px; height: 28px; font-size: 11px; font-weight: 600; 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: 15px; letter-spacing: 0; }
.msg-col { display: flex; flex-direction: column; align-items: flex-start; max-width: min(86%, 560px); min-width: 0; }
.bubble { display: flow-root; max-width: 100%; padding: 7px 11px 5px; border-radius: 16px; background: var(--bubble); color: var(--ink); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.msg-sender { display: block; font-size: 11px; 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; font-variant-numeric: tabular-nums; }
.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(--bg); border: 1px solid var(--line); }
.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(--bg); 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; }

/* «Статистика»: its sections, as pills that wrap on a narrow panel. */
.views { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.views button { border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 3px 10px; border-radius: 999px; font: inherit; font-size: 12.5px; cursor: pointer; }
.views button:hover { border-color: var(--accent); }
.views button.on { background: var(--accent); border-color: var(--accent); color: white; }
.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; }
body.no-map .duo svg.chart { max-width: 420px; }
svg.chart .hrow { cursor: pointer; }
svg.chart .hrow:hover text { fill: var(--ink); }
.digest { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-top: 10px; }
.digest .card { margin: 0; }
.digest p.small { margin: 8px 0 2px; color: var(--muted); }
.dlist { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.55; }
#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; }
.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; }
