/* Speedtest — UI preview. Plain CSS, no build step. */
:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --surface-3: #e8e7e2;
  --line: #e3e2dd;
  --line-strong: #cfcdc6;
  --text: #1b1b1a;
  --text-2: #52514e;
  --muted: #6a6963;
  --accent: #2a78d6;
  --accent-strong: #1c5cab;
  --accent-soft: #e3effc;
  --on-accent: #ffffff;
  --good: #0a8a0a;
  --good-soft: #e2f4e2;
  --warn: #9a6a00;
  --warn-soft: #fdf1d3;
  --serious: #b8501f;
  --crit: #c22f2f;
  --crit-soft: #fbe3e3;
  --info-soft: #e3effc;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --heat-0: #cde2fb; --heat-1: #9ec5f4; --heat-2: #6da7ec; --heat-3: #3987e5;
  --heat-4: #256abf; --heat-5: #184f95; --heat-6: #0d366b;
  --shadow: 0 1px 2px rgba(20, 20, 18, .06), 0 4px 14px rgba(20, 20, 18, .05);
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --surface-2: #232321;
  --surface-3: #2c2c2a;
  --line: #2f2f2d;
  --line-strong: #444441;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8e8d85;
  --accent: #3987e5;
  --accent-strong: #6da7ec;
  --accent-soft: #19304d;
  --on-accent: #0b0b0a;
  --good: #3cc23c;
  --good-soft: #17301a;
  --warn: #e0a31a;
  --warn-soft: #3a2f10;
  --serious: #ec835a;
  --crit: #ee6a6a;
  --crit-soft: #3d1c1c;
  --info-soft: #19304d;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --heat-0: #0d366b; --heat-1: #104281; --heat-2: #184f95; --heat-3: #1c5cab;
  --heat-4: #2a78d6; --heat-5: #5598e7; --heat-6: #9ec5f4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .stat-value, .tabnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: -2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.demo-note { font-size: 12px; color: var(--text-2); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 56px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 2px; }
.page-actions { min-width: 0; max-width: 100%; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.crumb a { color: var(--muted); }

/* ---------- Primitives ---------- */
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 14px 18px 18px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { max-width: 100%; flex-wrap: wrap; }
.stack { min-width: 0; display: grid; gap: 12px; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 550;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
:root[data-theme="dark"] .btn.primary:hover { color: #0b0b0a; }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.btn.danger.solid { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 28px; }

.input, .select, textarea.input {
  height: 34px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); width: 100%; min-width: 0;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
.select.auto, .input.auto { width: auto; }
.input:focus { border-color: var(--accent); }
.field { display: grid; gap: 5px; }
.field > label, .label { font-weight: 600; font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 56px; }
.input-suffix span { position: absolute; right: 10px; top: 7px; color: var(--muted); font-size: 13px; pointer-events: none; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.switch { position: relative; width: 38px; height: 22px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.crit { background: var(--crit-soft); color: var(--crit); }
.chip.info { background: var(--info-soft); color: var(--accent-strong); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--crit); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }

.seg { max-width: 100%; overflow-x: auto; display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.seg button { flex-shrink: 0; border: 0; background: transparent; height: 28px; padding: 0 11px; border-radius: 5px; cursor: pointer; color: var(--text-2); font-weight: 550; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 9px 12px; cursor: pointer; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }

.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 10px 3px 8px; cursor: pointer; font-size: 12.5px; color: var(--text); }
.legend button.off { opacity: .45; }
.legend button.off .dot { background: transparent !important; box-shadow: inset 0 0 0 2px var(--line-strong); }
.legend button:hover { background: var(--surface-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--text); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; }
table.data td.num, table.data th.num { padding-left: 6px; padding-right: 10px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Dashboard ---------- */
.stat { padding: 14px 16px; }
.stat-label { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.delta { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--good); } .delta.down { color: var(--crit); } .delta.flat { color: var(--muted); }

.node-card { padding: 14px 16px 12px; cursor: pointer; display: grid; gap: 10px; transition: border-color .15s, box-shadow .15s; }
.node-card:hover { border-color: var(--line-strong); }
.node-card:focus-visible { outline: 2px solid var(--accent); }
.node-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.node-name { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.node-meta { color: var(--muted); font-size: 12.5px; }
.speeds { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.speed-big { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.speed-big small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.speed-cap { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: visible; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.meter > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); border-radius: 1px; }
.meter-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.node-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 9px; font-size: 12.5px; color: var(--text-2); }
.spark { display: block; width: 100%; height: 34px; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11.5px; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis-line { stroke: var(--line-strong); }
.chart .hit { fill: transparent; }
.tooltip {
  position: absolute; z-index: 10; pointer-events: none; min-width: 150px; max-width: 280px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); font-size: 12.5px;
  transform: translate(-50%, -100%); opacity: 0; transition: opacity .08s;
}
.tooltip.show { opacity: 1; }
.tooltip .t-head { font-weight: 650; margin-bottom: 4px; color: var(--text); }
.tooltip .t-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tooltip .t-row span:first-child { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .t-row b { font-variant-numeric: tabular-nums; }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.heat-legend .ramp { width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--heat-0), var(--heat-1), var(--heat-2), var(--heat-3), var(--heat-4), var(--heat-5), var(--heat-6)); }

/* ---------- Map ---------- */
.map { position: relative; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.map svg { display: block; width: 100%; height: auto; }
.map .land { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; }
.map .graticule { stroke: var(--line); stroke-width: .6; stroke-dasharray: 2 4; }
.map .pin-label { font-size: 11.5px; fill: var(--text); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.map .tag { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; color: var(--muted); }

/* ---------- Timeline ---------- */
.timeline { position: relative; display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 7px; top: 16px; bottom: -2px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--line-strong); margin-top: 3px; }
.tl-title { font-weight: 600; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 10, 9, .5); display: grid; place-items: center; padding: 20px; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 14px; width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,.35); border: 1px solid var(--line); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; gap: 10px; }
.modal-body { padding: 14px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); align-items: center; }
.drawer-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(10,10,9,.4); animation: fade .12s ease-out; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: slide .16s ease-out; box-shadow: -16px 0 40px rgba(0,0,0,.2); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 16px 20px 32px; overflow: auto; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); max-width: 360px; display: flex; gap: 9px; align-items: center; animation: slide .16s ease-out; }
.toast.error { background: var(--crit); color: #fff; }

pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow: auto; font-family: var(--mono); font-size: 12.5px; margin: 0; white-space: pre-wrap; word-break: break-all; }
.code-copy { position: relative; }
.code-copy .btn { position: absolute; right: 6px; top: 6px; }

/* ---------- Wizard / progress ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.steps span.done { background: var(--accent); }
.choice { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; display: grid; gap: 2px; background: var(--surface); text-align: left; }
.choice:hover { background: var(--surface-2); }
.choice:disabled { opacity: .55; cursor: not-allowed; }
.checklist li.bad { color: var(--crit); }
.choice:disabled:hover { background: var(--surface); }
.choice.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.choice b { display: flex; align-items: center; gap: 8px; }
.checklist { display: grid; gap: 8px; }
.checklist li { list-style: none; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.checklist { padding: 0; margin: 0; }
.checklist li.run { color: var(--text); }
.checklist li.ok { color: var(--text); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.live-num { font-size: 40px; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

.callout { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); font-size: 13px; }
.callout.warn { background: var(--warn-soft); }
.callout.crit { background: var(--crit-soft); }
.setting { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .s-ctl { width: 260px; flex: none; }
.setting .s-ctl .switch { float: right; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.ev-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.ev-ico.crit { background: var(--crit-soft); color: var(--crit); }
.ev-ico.warn { background: var(--warn-soft); color: var(--warn); }
.ev-ico.info { background: var(--info-soft); color: var(--accent-strong); }
.ev-ico.good { background: var(--good-soft); color: var(--good); }

/* The view takes focus after navigation for screen readers; it is not a control, so it shows no ring. */
.content:focus, .content:focus-visible { outline: none; }

/* ---------- Sign-in ---------- */
.app.signed-out { grid-template-columns: 1fr; }
.app.signed-out .sidebar, .app.signed-out .topbar { display: none; }
.signin { min-height: 80vh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: min(400px, 100%); }
.form-error { color: var(--crit); background: var(--crit-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 248px; transform: translateX(-100%); transition: transform .18s; }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .cols-5, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { grid-template-columns: 1fr; }
  .setting { flex-direction: column; align-items: stretch; gap: 8px; }
  .setting .s-ctl { width: 100%; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .cols-5, .cols-4 { grid-template-columns: 1fr; }
  .speeds { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; }
}

/* Live map (Leaflet) */
.map-live { background: var(--surface-2); }
.map-live .map-canvas { height: 460px; width: 100%; border-radius: var(--radius); z-index: 0; }
.map-pin-wrap { background: none; border: 0; }
.map-pin { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / .45); }
.map-pin i { display: block; width: 12px; height: 12px; border-radius: 50%; }
.map-tip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.leaflet-container { font: inherit; }
.leaflet-container a { color: var(--accent); }
@media (max-width: 640px) { .map-live .map-canvas { height: 340px; } }

/* Top bar: keep the range label on one line and the selected range readable at every width. */
.topbar .row.muted { white-space: nowrap; }
.topbar select { min-width: 8.5em; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 88%, transparent) !important; color: var(--text-2) !important; }
.leaflet-control-attribution a { color: var(--accent-strong) !important; }

/* Tables marked "cards" (the node list) turn each row into a card on phones instead of scrolling sideways. */
@media (max-width: 640px) {
  table.data.cards, table.data.cards tbody, table.data.cards tr, table.data.cards td { display: block; width: 100%; }
  table.data.cards thead { position: absolute; left: -9999px; }
  table.data.cards tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.data.cards tbody tr:last-child { border-bottom: 0; }
  table.data.cards td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; white-space: normal; text-align: right; }
  table.data.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; flex: none; }
  table.data.cards td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 8px; }
  table.data.cards td:first-child::before { content: none; }
  table.data.cards td:last-child { justify-content: flex-end; }
  table.data.cards td:last-child::before { content: none; }
}
