:root {
  --bg: #f4f6f8; --surface: #ffffff; --surface-2: #eef2f5; --text: #0f1b24; --muted: #52616d; --border: #d9e0e6;
  --accent: #0f766e; --accent-ink: #ffffff; --ok: #15803d; --ok-bg: #dcfce7; --info: #1d4ed8; --info-bg: #dbeafe;
  --off: #64748b; --off-bg: #e2e8f0; --err: #b91c1c; --err-bg: #fee2e2; --shadow: 0 1px 2px rgb(15 27 36 / .06), 0 4px 16px rgb(15 27 36 / .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1218; --surface: #121c24; --surface-2: #1a2630; --text: #e6edf2; --muted: #9aabb8; --border: #26343f;
    --accent: #2dd4bf; --accent-ink: #062a27; --ok: #4ade80; --ok-bg: #0f2e1b; --info: #93c5fd; --info-bg: #13243d;
    --off: #94a3b8; --off-bg: #1e2a35; --err: #fca5a5; --err-bg: #3a1414; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top .wrap { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 6px 14px; padding-top: 18px; padding-bottom: 18px; }
.logo { width: 40px; height: 40px; flex: none; align-self: start; }
.brand h1 { margin: 0; font-size: 1.35rem; line-height: 1.2; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.top .pill { justify-self: end; }

main { padding: 28px 0 40px; }
h2 { font-size: 1.05rem; margin: 0 0 14px; letter-spacing: -.005em; }
section + section { margin-top: 32px; }

.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 0; }
@media (max-width: 860px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cards .card:last-child { grid-column: 1 / -1; } }
@media (max-width: 420px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card dt { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.card dd { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.card .value { font-size: 1.05rem; font-weight: 600; }
.card .note { color: var(--muted); font-size: .85rem; }
.card.is-error { border-color: var(--err); background: var(--err-bg); }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.info { color: var(--info); background: var(--info-bg); }
.pill.off { color: var(--off); background: var(--off-bg); }
.pill.err { color: var(--err); background: var(--err-bg); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; white-space: nowrap; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: .92rem; text-decoration: none; border: 1px solid transparent; }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }

.alert { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--err); background: var(--err-bg); color: var(--err); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; font-weight: 600; }

.map { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.map figure { margin: 0; }
.map svg { display: block; width: 100%; height: auto; }
.map .tall { display: none; }
@media (max-width: 640px) { .map .wide { display: none; } .map .tall { display: block; max-width: 420px; margin: 0 auto; } }
.map figcaption { color: var(--muted); font-size: .88rem; margin-top: 10px; }

.n-core rect { fill: var(--accent); }
.n-core text { fill: var(--accent-ink); font-weight: 700; }
.n-core .sub { font-weight: 500; }
.n-ext rect { fill: var(--surface-2); stroke: var(--off); stroke-width: 1.5; stroke-dasharray: 5 4; }
.n-ext text { fill: var(--text); font-weight: 600; }
.n-ext .sub { fill: var(--muted); font-weight: 500; }
.map text { font-family: inherit; font-size: 14px; text-anchor: middle; dominant-baseline: middle; }
.map text.sub { font-size: 12px; }
.n-ext.live rect { stroke: var(--ok); stroke-dasharray: none; stroke-width: 2; }
.edge { fill: none; stroke: var(--off); stroke-width: 2; stroke-dasharray: 7 6; }
.edge.on { stroke: var(--ok); stroke-width: 2.5; stroke-dasharray: none; }
.arrow { fill: var(--off); }
.arrow.on { fill: var(--ok); }
.edge-label rect { fill: var(--surface); stroke: var(--border); }
.edge-label text { fill: var(--muted); font-size: 11.5px; font-weight: 600; }
.edge-label .off { fill: var(--off); }
.edge-label .on { fill: var(--ok); }
.links .note { color: var(--muted); font-size: .82rem; font-weight: 500; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; flex: none; }
.sw-core { width: 16px; height: 16px; border-radius: 4px; background: var(--accent); }
.sw-ext { width: 16px; height: 16px; border-radius: 4px; background: var(--surface-2); border: 1.5px dashed var(--off); }
.sw-off { width: 26px; border-top: 2px dashed var(--off); }
.sw-on { width: 26px; border-top: 2px solid var(--ok); }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.links li { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: .92rem; }
.links b { font-weight: 600; min-width: 0; }

footer { color: var(--muted); font-size: .82rem; padding: 18px 0 32px; border-top: 1px solid var(--border); }

@media (max-width: 520px) {
  .top .wrap { grid-template-columns: 40px minmax(0, 1fr); }
  .top .pill { grid-column: 2; justify-self: start; }
  .brand h1 { font-size: 1.15rem; }
}
