:root {
  --bg: #f7f7f5; --surface: #ffffff; --text: #1d1f21; --muted: #5f6368; --line: #e2e2de;
  --accent: #2f5bd3; --accent-text: #ffffff; --focus: #2f5bd3;
  --allow: #1e7d4f; --step_up: #9a6700; --review: #c2540a; --deny: #b3261e;
  --allow-bg: #e3f3ea; --step_up-bg: #fbf0d6; --review-bg: #fde7d6; --deny-bg: #fbe3e1;
  --err-bg: #fbe3e1; --ok-bg: #e3f3ea;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517; --surface: #1d1f22; --text: #e8e8e6; --muted: #a0a4a8; --line: #2e3135;
    --accent: #7d9cf0; --accent-text: #0e1220; --focus: #9fb6f5;
    --allow: #5cc48e; --step_up: #e0b54a; --review: #f0935a; --deny: #f2877f;
    --allow-bg: #173826; --step_up-bg: #3a2f12; --review-bg: #3d2414; --deny-bg: #401b19;
    --err-bg: #401b19; --ok-bg: #173826;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.top { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; }
.brand span { font-weight: 400; color: var(--muted); }
.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--text); background: var(--bg); }
.top nav a[aria-current] { color: var(--text); background: var(--bg); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.who > span:first-child { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { padding: 1px 8px; border: 1px solid var(--line); border-radius: 99px; }
.who form { margin: 0; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
main.narrow { max-width: 420px; padding-top: 12vh; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .k { color: var(--muted); font-size: 13px; }
.tile .v { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.mono, code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.a-allow { color: var(--allow); background: var(--allow-bg); }
.a-step_up { color: var(--step_up); background: var(--step_up-bg); }
.a-review { color: var(--review); background: var(--review-bg); }
.a-deny { color: var(--deny); background: var(--deny-bg); }
.status-disabled, .revoked { color: var(--deny); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 8px; }
.chart line { stroke: var(--line); }
.f-allow { fill: var(--allow); background: var(--allow); }
.f-step_up { fill: var(--step_up); background: var(--step_up); }
.f-review { fill: var(--review); background: var(--review); }
.f-deny { fill: var(--deny); background: var(--deny); }
.hbar { display: grid; grid-template-columns: 1fr 44px; grid-template-areas: "label label" "bar count"; column-gap: 10px;
  row-gap: 2px; align-items: center; margin: 0 0 10px; font-size: 13px; }
.hbar > :first-child { grid-area: label; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar > svg { grid-area: bar; } .hbar > .num { grid-area: count; text-align: right; }
.hbar .track { background: var(--bg); border-radius: 4px; height: 10px; overflow: hidden; }
.hbar .fill { background: var(--accent); height: 100%; }
.split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg); margin: 10px 0 4px; }

form.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; }
textarea { min-height: 64px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
button, .button { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--deny); border-color: var(--deny); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }
form.inline { display: inline; margin: 0; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.alert.error { background: var(--err-bg); color: var(--deny); }
.alert.notice { background: var(--ok-bg); color: var(--allow); }
.secret { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px dashed var(--line);
  border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.secret code { flex: 1; word-break: break-all; }
.once { border-color: var(--step_up); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 520px; font-size: 12px; }
.steps { padding-left: 20px; } .steps li { margin: 6px 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters label { min-width: 140px; }
@media (max-width: 640px) { main { padding: 16px; } .top { padding: 10px 16px; } }
.filters a { align-self: center; padding-top: 18px; }
td form.inline, td button.link + form.inline { margin-left: 12px; }
#login-brand { margin-bottom: 14px; }
.small { font-size: 13px; }
.narrow-card { max-width: 420px; }
svg.hb { width: 100%; height: 10px; display: block; }
svg.hb .track { fill: var(--bg); }
svg.hb .fill { fill: var(--accent); }
svg.split { width: 100%; height: 12px; display: block; margin: 10px 0 4px; border-radius: 6px; }
h2.spaced { margin-top: 22px; }
