:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --bg-1: #121212;
  --bg-2: #181818;
  --line: #1e1e1e;
  --line-2: #2a2a2a;
  --text: #e6e6e6;
  --text-2: #a0a0a0;
  --muted: #6b6b6b;
  --good: #86b893;
  --warn: #d4ae5c;
  --bad: #de7a6e;
  --res: #86b893;
  --mob: #7ea3c4;
  --dc: #cc8d57;
  --unk: #363636;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }
.link, .prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link:hover, .prose a:hover { text-decoration-color: var(--text-2); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; letter-spacing: -0.01em; }
h2 { font-size: 13px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { color: var(--text); }
.num, td, .v { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.small { font-size: 12px; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
main { flex: 1; padding-bottom: 72px; }

#progress { position: fixed; top: 0; left: 0; height: 1px; width: 0; background: var(--text); z-index: 100; opacity: 0; transition: width 0.25s ease, opacity 0.3s ease; }
#progress.on { opacity: 1; }

/* ---- header / footer ---- */
.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 28px; height: 52px; }
.site { font-weight: 600; font-size: 14px; }
.nav { display: flex; align-items: center; gap: 22px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav a, .nav button { color: var(--muted); white-space: nowrap; }
.nav a:hover, .nav button:hover { color: var(--text); }
.nav a.active { color: var(--text); }
.nav button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 18px; padding-bottom: 24px; }
.foot a:hover { color: var(--text); }

/* ---- page head & figures ---- */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; padding: 36px 0 22px; }
.head .title { flex: 1; min-width: 220px; }
.meta { color: var(--muted); font-size: 13px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.figures { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.figure { padding: 14px 18px 14px 0; min-width: 0; }
.figure + .figure { padding-left: 18px; border-left: 1px solid var(--line); }
.figure .k { color: var(--muted); font-size: 12px; }
.figure .v { font-size: 20px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figure .s { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

section { margin-top: 36px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.sec-head h2 { flex: 1; }
.sec-head .muted { font-size: 12px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.cols > section { min-width: 0; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 10px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; user-select: none; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:hover td { background: var(--bg-1); }
th.r, td.r { text-align: right; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--text-2); }
th.asc::after { content: ' ↑'; }
th.desc::after { content: ' ↓'; }
tr[data-href] { cursor: pointer; }
.rank { width: 28px; color: var(--muted); }
.prov { display: flex; flex-direction: column; min-width: 0; }
.prov .name { font-weight: 500; }
.prov .sub { color: var(--muted); font-size: 12px; }
td .sub { color: var(--muted); font-size: 12px; }
tr.unranked td { color: var(--text-2); }
table.plain td { padding-top: 8px; padding-bottom: 8px; }
.empty { padding: 40px 0; color: var(--muted); }

/* ---- small data marks ---- */
.score { display: inline-flex; align-items: center; gap: 10px; }
.score b { font-weight: 600; min-width: 32px; }
.bar { display: block; width: 56px; height: 2px; background: var(--line-2); }
.bar > i { display: block; height: 100%; background: var(--text-2); }
.bar.full { width: 100%; }
.stack { display: flex; width: 100%; height: 3px; background: var(--unk); margin-top: 6px; }
.stack.tall { height: 6px; margin-top: 0; }
.stack span { display: block; height: 100%; }
.res { background: var(--res); }
.mob { background: var(--mob); }
.dc { background: var(--dc); }
.unk { background: var(--unk); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 7px; vertical-align: 0; }
.kind-residential { color: var(--res); }
.kind-mobile { color: var(--mob); }
.kind-datacenter { color: var(--dc); }
.kind-unknown, .kind-pending { color: var(--muted); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; vertical-align: 1px; }
.dot.on { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.o-ok { color: var(--good); }
.o-timeout { color: var(--warn); }
.o-error, .o-invalid { color: var(--bad); }
.o-quota { color: var(--warn); }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.row .bar { grid-column: 1 / -1; width: 100%; height: 1px; background: transparent; }
.row .bar > i { background: var(--line-2); height: 1px; }

/* ---- charts ---- */
.chart { position: relative; margin: 14px 0 0; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .line { fill: none; stroke: var(--text-2); stroke-width: 1.25; }
.chart .base { stroke: var(--line-2); }
.chart rect { fill: var(--line-2); }
.chart rect.last { fill: var(--text-2); }
.chart-label { position: absolute; font-size: 11px; color: var(--muted); }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.chart-empty { display: flex; align-items: center; color: var(--muted); font-size: 12px; }
.spark { display: block; }
.spark polyline { fill: none; stroke: var(--text-2); stroke-width: 1; }

/* ---- provider page ---- */
.crumbs { color: var(--muted); font-size: 13px; padding-top: 28px; }
.crumbs a:hover { color: var(--text); }
.p-score { text-align: right; }
.p-score .n { font-size: 32px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.p-score .l { color: var(--muted); font-size: 12px; margin-top: 6px; }
.parts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.part .k { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.part .k b { color: var(--text); font-weight: 500; }

.prose { max-width: 700px; color: var(--text-2); font-size: 14.5px; }
.prose h2 { color: var(--text); font-size: 15px; margin: 32px 0 8px; }
.prose p, .prose li { line-height: 1.7; }
.prose ul { padding-left: 18px; }
.prose strong { color: var(--text); font-weight: 500; }

/* ---- forms & buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 4px; background: transparent; color: var(--text); font: 13px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg-2); color: #fff; }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.primary:hover { background: #fff; color: var(--bg); }
.btn.danger { color: var(--bad); }
.btn.quiet { border-color: transparent; color: var(--text-2); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; margin: 0; }
.form { display: flex; flex-direction: column; }
.form section { margin-top: 28px; }
.fields { display: grid; gap: 16px; padding-top: 16px; }
.fields.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
input[type='text'], input[type='password'], input[type='number'], input[type='url'], select, textarea {
  width: 100%; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 4px; color: var(--text);
  font: 13px var(--sans); padding: 7px 9px; outline: none;
}
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; resize: vertical; min-height: 110px; }
input:focus, select:focus, textarea:focus { border-color: #4a4a4a; }
input[readonly] { color: var(--text-2); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 52%, calc(100% - 10px) 52%; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 26px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin: 3px 0 0; accent-color: var(--text); }
.check small { display: block; color: var(--muted); font-size: 12px; }
.submit-row { display: flex; gap: 8px; padding-top: 24px; }
.flash { margin-top: 20px; padding: 9px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.flash.ok { color: var(--good); }
.flash.err { color: var(--bad); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 20px; font-size: 13px; margin: 14px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.copy { display: flex; gap: 6px; }
.copy input { font-family: var(--mono); font-size: 12.5px; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ---- admin ---- */
.status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.status > div { padding: 11px 16px 11px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.status .k { font-size: 12px; color: var(--muted); }
.status .v { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed { font-family: var(--mono); font-size: 12px; max-height: 420px; overflow-y: auto; }
.feed-row { display: grid; grid-template-columns: 70px minmax(90px, 160px) 92px 64px minmax(110px, 150px) minmax(0, 1fr); gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.feed-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { display: flex; flex-direction: column; margin-top: 8px; }
.step { display: grid; grid-template-columns: 14px 120px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.matrix th, .matrix td { text-align: center; font-size: 12px; padding: 8px 6px; }
.matrix th.rowh { text-align: left; font-size: 13px; color: var(--text); }
.test-results { font-family: var(--mono); font-size: 12px; margin-top: 12px; }
.test-results div { padding: 4px 0; border-bottom: 1px solid var(--line); }
.login { max-width: 320px; margin: 14vh auto 0; display: flex; flex-direction: column; gap: 14px; }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .parts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fields.c4, .fields.c5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-lat, .col-fresh { display: none; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .figures { --n: 2 !important; }
  .figure:nth-child(odd) { padding-left: 0; border-left: 0; }
  .figure:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .fields.c2, .fields.c3 { grid-template-columns: minmax(0, 1fr); }
  .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-net, .col-shared, .col-pool-sub { display: none; }
  .top .wrap { gap: 16px; }
  .nav { gap: 16px; }
  .feed-row { grid-template-columns: 62px minmax(0, 1fr) 86px 56px; }
  .feed-row .f-ip, .feed-row .f-err { display: none; }
  .p-score { text-align: left; }
}
@media (max-width: 520px) {
  .col-pool, .col-success { display: none; }
  .fields.c4, .fields.c5 { grid-template-columns: minmax(0, 1fr); }
  .status { grid-template-columns: minmax(0, 1fr); }
  .bar { width: 36px; }
}
