:root {
  --bg: #f5f5f2; --panel: #ffffff; --ink: #1d1d1b; --muted: #6b6b66; --line: #e0e0da;
  --accent: #b4441c; --accent-ink: #ffffff; --edge: #c6c6bf; --burst: #d9622b; --field: #fafaf8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413; --panel: #1d1d1b; --ink: #ecece8; --muted: #9a9a93; --line: #34342f;
    --accent: #f08a5d; --accent-ink: #1d1d1b; --edge: #45453f; --burst: #f08a5d; --field: #232320;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141413; --panel: #1d1d1b; --ink: #ecece8; --muted: #9a9a93; --line: #34342f;
  --accent: #f08a5d; --accent-ink: #1d1d1b; --edge: #45453f; --burst: #f08a5d; --field: #232320;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }

.app { display: grid; grid-template-columns: 350px 1fr; grid-template-rows: 100vh; height: 100vh; }
.app > * { min-width: 0; min-height: 0; }
aside { background: var(--panel); border-right: 1px solid var(--line); overflow: auto; padding: 18px 16px 28px; }
main { position: relative; }
#net { position: absolute; inset: 0; }

h1 { font-size: 18px; margin: 0 0 2px; letter-spacing: -.01em; }
h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 20px 0 6px; font-weight: 600; }
.meta { color: var(--muted); font-size: 12.5px; margin: 0; }
header { margin-bottom: 14px; }

form { display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input:not([type=checkbox]), select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--field); color: var(--ink); font: inherit; font-weight: 400;
}
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .button:focus-within {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
details summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

.btns { display: flex; flex-wrap: wrap; gap: 8px; }
button, .button {
  display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: 600 13px system-ui, sans-serif; cursor: pointer;
}
.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.ghost:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
#status { min-height: 1.4em; font-variant-numeric: tabular-nums; }
#status.error { color: var(--accent); }

.labels { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.grad { height: 8px; flex: 1; border-radius: 4px; background: linear-gradient(90deg, hsl(140,55%,45%), hsl(45,85%,50%), hsl(8,75%,50%)); }

.row { padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.row:hover { background: var(--bg); }
.row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; font-size: 12.5px; }
.cluster { color: var(--muted); font-size: 12.5px; margin: 8px 0 2px; }
#detail { font-size: 13px; color: var(--ink); }
#detail dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
#detail dt { color: var(--muted); }
#detail dd { margin: 0; font-variant-numeric: tabular-nums; }
#detail a { color: var(--accent); }

.empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; color: var(--ink); }
.empty p { margin: 4px 0; }
.tip { max-width: 280px; font: 12px/1.4 system-ui, sans-serif; padding: 2px; }
div.vis-tooltip { background: var(--panel) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: 6px !important; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 70vh; height: auto; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); order: 1; }
  main { order: 2; }
}
