:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --ink: #1b1d21;
  --muted: #6a6f78;
  --line: #e2e2dc;
  --line-strong: #cfcfc8;
  --accent: #2b55c9;
  --accent-ink: #ffffff;
  --ok: #1d7347;
  --ok-bg: #e3f3ea;
  --warn: #8a5a00;
  --warn-bg: #fbf0d6;
  --bad: #b3261e;
  --bad-bg: #fbe5e3;
  --chip: #eef0f3;
  --code: #f1f1ed;
  --focus: #2b55c966;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101113;
    --panel: #181a1e;
    --ink: #e6e7e9;
    --muted: #9aa0a8;
    --line: #2a2d33;
    --line-strong: #3a3e45;
    --accent: #86a8ff;
    --accent-ink: #0d1117;
    --ok: #5cc993;
    --ok-bg: #173325;
    --warn: #e6b450;
    --warn-bg: #3a2e12;
    --bad: #ff8a80;
    --bad-bg: #3c1a18;
    --chip: #23262c;
    --code: #141619;
    --focus: #86a8ff55;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 4px 0 14px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.top nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: 5px 9px; border-radius: 6px; }
.top nav a:hover { color: var(--ink); background: var(--chip); text-decoration: none; }
.top nav a.on { color: var(--ink); background: var(--chip); font-weight: 600; }
.top .sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.search { flex: 1; min-width: 200px; max-width: 420px; margin-left: auto; }
.search input { width: 100%; }
.me { display: flex; align-items: center; gap: 10px; }
.me form { margin: 0; }

main { max-width: 1320px; margin: 0 auto; padding: 18px 20px 60px; }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .tablewrap { margin: 0; }
.panel.summary { white-space: pre-wrap; }
.panel.reveal { border-color: var(--warn); background: var(--warn-bg); }
.panel.badline { border-color: var(--bad); }
.panel[id] { scroll-margin-top: 100px; }
.count { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 4px; }
.more { margin: 10px 0 0; font-size: 13px; }

.cols { display: flex; gap: 14px; align-items: flex-start; }
.cols .grow { flex: 1; min-width: 0; }
.cols .side { width: 360px; flex-shrink: 0; }
@media (max-width: 980px) { .cols { flex-direction: column; } .cols .side { width: 100%; } }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.tl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.tv { font-size: 26px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ts { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* tables */
.tablewrap { overflow-x: auto; margin: 0 -2px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: color-mix(in srgb, var(--chip) 55%, transparent); }
table.t .r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr.dim td { opacity: 0.55; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.strong { font-weight: 650; }
.sub { color: var(--muted); font-size: 12px; margin-top: 1px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dom { font-weight: 550; overflow-wrap: anywhere; }
.who { color: var(--ink); border-bottom: 1px dotted var(--line-strong); }
.who:hover { text-decoration: none; border-bottom-color: var(--ink); }
code.mono { background: var(--code); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
code.mono.short { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
code.mono.wrap { white-space: pre-wrap; }
.inert { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; cursor: text; }
.act { font-family: var(--mono); font-size: 12px; }

/* pills + chips */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap;
  background: var(--chip); color: var(--ink); border: 1px solid transparent; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.muted { color: var(--muted); }
.pill.soft { font-weight: 500; }
a.pill:hover { text-decoration: none; filter: brightness(0.97); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--chip); color: var(--ink); font-size: 12.5px; }
a.chip:hover { text-decoration: none; background: var(--line); }

/* domain header */
.dhead { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.mono-h { font-family: var(--mono); font-size: 22px; word-break: break-all; margin-bottom: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.claim { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 18px; margin: 10px 0 14px; }
.facts div { min-width: 0; }
.facts dt { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 2px 0 0; word-break: break-word; }
.jump { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 12px; position: sticky; top: 49px; z-index: 5; background: var(--bg); padding: 6px 0; }
.jump a { padding: 3px 9px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.jump a:hover { color: var(--ink); text-decoration: none; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.notes li:last-child { border-bottom: 0; }
.nh { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.nb { white-space: pre-wrap; margin-top: 3px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 3px 0; }

/* forms */
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 9px; min-width: 0; }
textarea { width: 100%; resize: vertical; }
input.mono, textarea.mono { font-family: var(--mono); font-size: 12.5px; }
button { font: inherit; font-weight: 600; cursor: pointer; border-radius: 7px; padding: 6px 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
button:hover { filter: brightness(1.06); }
button.ghost { background: transparent; color: var(--accent); }
button.linkish { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 500; }
button.linkish:hover { color: var(--ink); }
button.x { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); padding: 1px 8px; font-size: 12px; font-weight: 500; }
button.x:hover { color: var(--bad); border-color: var(--bad); }
form.inline { display: inline; margin: 0; }
form.inline select { padding: 4px 6px; margin-right: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.filters input[type="text"], .filters input:not([type]) { width: 180px; }
.fa { display: flex; align-items: center; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; align-items: end; margin-top: 10px; }
.grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.grid label.wide, .grid fieldset.wide { grid-column: 1 / -1; }
.grid label.check, label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; }
.grid .fa { grid-column: 1 / -1; }
fieldset.scopes { border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 16px; flex-wrap: wrap; padding: 8px 12px; }
fieldset.scopes legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
details.add { margin-top: 10px; }
details.add > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; list-style: none; }
details.add > summary::-webkit-details-marker { display: none; }
details.add > summary::before { content: "+ "; }
details.add[open] > summary::before { content: "- "; }

.flash { padding: 9px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }
.err { color: var(--bad); }

.pager { display: flex; gap: 14px; align-items: center; justify-content: flex-end; margin: 8px 0; font-size: 13px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab { padding: 5px 12px; border-radius: 7px; color: var(--muted); border: 1px solid var(--line); background: var(--panel); }
.tab.on { color: var(--ink); font-weight: 600; border-color: var(--line-strong); }
.tab:hover { text-decoration: none; color: var(--ink); }

.tokenrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
code.token { font-size: 14px; padding: 6px 10px; user-select: all; }
.secret { cursor: pointer; color: var(--accent); font-family: var(--mono); font-size: 12.5px; }

pre.src, pre.code { background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; font: 12px/1.5 var(--mono); max-height: 75vh; }
pre.src { counter-reset: none; white-space: pre; }
pre.src .ln { display: inline-block; width: 4.2em; color: var(--muted); user-select: none; text-align: right; margin-right: 1em; opacity: 0.7; }
.prose p { max-width: 900px; }
.method { display: inline-block; font: 700 11px var(--mono); padding: 2px 6px; border-radius: 4px; background: var(--chip); }
.method.get { color: var(--ok); }
.method.post { color: var(--accent); }
.method.patch { color: var(--warn); }
.method.delete { color: var(--bad); }
.params { margin-top: 4px; font-size: 12px; }

/* sign in: deliberately bare */
.login { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.login label { color: var(--muted); font-size: 13px; }
.login input { font-family: var(--mono); }

@media (max-width: 720px) {
  .top { padding: 8px 14px; position: static; }
  main { padding: 14px 14px 50px; }
  .search { order: 5; max-width: none; flex-basis: 100%; }
  .tv { font-size: 22px; }
  .jump { top: 0; position: static; }
}
