/* netprobe panel. No framework and no CDN: the binary is the whole deploy,
   and a node on a locked-down network must render this without fetching
   anything. */

:root {
  --bg: #faf9f7;
  --panel: #fff;
  --ink: #1c1a17;
  --muted: #6b6862;
  --line: #e2ded7;
  --accent: #7c3aed;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --panel: #1e1d24;
    --ink: #ece9f0;
    --muted: #9b96a6;
    --line: #322f3b;
    --accent: #a78bfa;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

code, pre, .mono, td.num { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

header h1 { font-size: 18px; margin: 0; letter-spacing: -0.01em; }
.spacer { flex: 1; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }

.tab { padding: 20px; max-width: 1100px; }

h2 { font-size: 15px; margin: 24px 0 10px; }
h2:first-child { margin-top: 0; }
h3 { font-size: 14px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th { color: var(--muted); font-weight: 600; font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; }
td.na { color: var(--muted); }

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid currentColor;
}

/* The v4-vs-v6 delta columns. Coloured by which family won rather than by the
   sign of the subtraction, so the reader's question — "is IPv6 worse here" — is
   what the colour answers. */
td.delta-ok { color: var(--ok); }
td.delta-bad { color: var(--bad); }

.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.idle { color: var(--muted); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--muted); }

.row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.row.wrap { align-items: center; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; }

input, select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}

input[type=checkbox] { width: auto; padding: 0; }

button {
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:disabled { opacity: 0.5; cursor: default; }
button.link, a.link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 6px;
  cursor: pointer;
}
button.small { padding: 3px 9px; font-size: 12px; }
button.ghost { background: none; color: var(--ink); }
button.danger { background: none; color: var(--bad); border-color: var(--bad); }

/* The enroll token is meant to be read off the screen and copied by hand when
   the clipboard API is unavailable, so it gets a selectable box rather than the
   inline-code treatment. */
.token {
  user-select: all;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  word-break: break-all;
}

fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; padding: 12px; }
legend { color: var(--muted); font-size: 12px; padding: 0 4px; }

form#campaign-form .row { margin-bottom: 12px; }

pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
  font-size: 12px;
}

.best {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
}

#chart-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow-x: auto; }
#chart { width: 100%; height: 260px; display: block; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 2px; display: inline-block; }

#login, #unconfigured { display: grid; place-items: center; min-height: 100vh; padding: 20px; }

#login form, .notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: min(340px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notice { width: min(520px, 100%); }
.notice p { margin: 0; font-size: 13px; }

#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 10;
  max-width: 90vw;
}

@media (max-width: 640px) {
  .tab { padding: 14px; }
  table { display: block; overflow-x: auto; }
}
