:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #14202e; --muted: #5b6878; --line: #dde2e8;
  --brand: #172d46; --accent: #b4561b; --ok: #1f7a4d; --warn: #9a6300; --bad: #b42318; --info: #1d5fa8;
  --ok-bg: #e5f4ec; --warn-bg: #fdf3dc; --bad-bg: #fde8e6; --info-bg: #e6eff9; --muted-bg: #eef0f3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1620; --surface: #17212d; --text: #e6ebf1; --muted: #9aa7b6; --line: #2a3644;
    --brand: #9cc3ec; --accent: #f0a46b; --ok: #6fd3a0; --warn: #f3c56a; --bad: #ff9b91; --info: #8cbcf2;
    --ok-bg: #173226; --warn-bg: #352a12; --bad-bg: #3a1d1a; --info-bg: #172a40; --muted-bg: #222d3a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--info); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .table-wrap:focus-visible, pre:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 2; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.shell > * { min-width: 0; }
nav.side { background: var(--brand); color: #fff; padding: 16px 12px; }
@media (prefers-color-scheme: dark) { nav.side { background: #0b121b; } }
nav.side .brand { font-weight: 700; letter-spacing: .04em; margin: 0 8px 4px; }
nav.side .tag { font-size: 12px; opacity: .75; margin: 0 8px 16px; }
nav.side a { display: block; color: #fff; text-decoration: none; padding: 6px 8px; border-radius: 6px; font-size: 14px; }
nav.side a[aria-current="page"], nav.side a:hover { background: rgba(255,255,255,.14); }
nav.side .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .6; margin: 14px 8px 4px; }
main { padding: 20px 28px 48px; min-width: 0; }
header.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
header.top form { display: inline; }
h1 { font-size: 24px; margin: 4px 0 4px; } h2 { font-size: 17px; margin: 24px 0 8px; }
p.lede { color: var(--muted); margin: 0 0 16px; max-width: 72ch; }
.banner { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600; }
.banner.sim { background: var(--info-bg); color: var(--info); } .banner.prod { background: var(--bad-bg); color: var(--bad); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin: 8px 0 16px; }
.flash { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 8px 0 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .label { color: var(--muted); font-size: 13px; } .card .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .source { color: var(--muted); font-size: 12px; }
.panel > h2:first-child { margin-top: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--muted-bg); color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
pre.json { background: var(--muted-bg); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; max-height: 420px; }
form.stack { display: grid; gap: 10px; max-width: 560px; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-height: 36px; }
textarea { min-height: 70px; }
button { font: inherit; font-weight: 600; border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer; background: var(--brand); color: #fff; min-height: 36px; }
@media (prefers-color-scheme: dark) { button { background: #2c5d8f; } }
button.secondary { background: var(--muted-bg); color: var(--text); } button.danger { background: var(--bad); color: #fff; } button.ok { background: var(--ok); color: #fff; }
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.tabs a { padding: 4px 10px; border-radius: 999px; background: var(--muted-bg); color: var(--text); text-decoration: none; font-size: 13px; }
.tabs a[aria-current="page"] { background: var(--brand); color: #fff; }
.login { max-width: 380px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.muted { color: var(--muted); }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  nav.side { padding: 10px 12px; } nav.side .tag { margin-bottom: 8px; }
  nav.side .links { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
  nav.side .links a { white-space: nowrap; flex: none; } nav.side .group { display: none; }
  main { padding: 16px; }
}
code.setup-key { font-size: 16px; letter-spacing: 1px; background: var(--muted-bg); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
