/* Pulse portal design system, v2.
   Calm, precise and professional: Inter, one emerald accent, quiet neutral
   surfaces, hairline borders, generous space and tabular figures. Light and
   dark. No gradients, glow or decoration. */

@font-face {
  font-family: "Inter";
  src: url("/portal/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f7f6;
  --side: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --hover: #f1f4f2;
  --text: #0e1412;
  --text-2: #39433f;
  --muted: #6a7570;
  --faint: #98a29d;
  --border: #e6e9e7;
  --border-strong: #d3d9d6;
  --accent: #0e7a52;
  --accent-hover: #0b6544;
  --accent-soft: #e8f4ee;
  --accent-text: #0b6544;
  --on-accent: #ffffff;
  --brand-panel: #0b3b2a;
  --brand-ink: #e9f5ef;
  --ok: #157046; --ok-bg: #e7f5ed;
  --warn: #8d5b00; --warn-bg: #fdf3dc;
  --bad: #b42318; --bad-bg: #fdecea;
  --info: #1f5d93; --info-bg: #e8f1fa;
  --chart: #12936a;
  --chart-area: rgba(18, 147, 106, 0.08);
  --focus: 0 0 0 3px rgba(14, 122, 82, 0.2);
  --shadow: 0 1px 2px rgba(15, 23, 20, 0.04), 0 1px 1px rgba(15, 23, 20, 0.02);

  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --side-w: 264px;
  --content: 1440px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090c0b;
    --side: #0c100f;
    --surface: #111614;
    --surface-2: #151b19;
    --hover: #18201d;
    --text: #edf2ef;
    --text-2: #c3cbc7;
    --muted: #8a9590;
    --faint: #5e6964;
    --border: #1e2623;
    --border-strong: #2b3531;
    --accent: #2fa874;
    --accent-hover: #38bb83;
    --accent-soft: rgba(47, 168, 116, 0.12);
    --accent-text: #5cd19e;
    --on-accent: #04110b;
    --brand-panel: #0d1f18;
    --brand-ink: #dff1e8;
    --ok: #5cd19e; --ok-bg: rgba(92, 209, 158, 0.12);
    --warn: #e9c06a; --warn-bg: rgba(233, 192, 106, 0.12);
    --bad: #f2a29b; --bad-bg: rgba(242, 162, 155, 0.12);
    --info: #9cc6ee; --info-bg: rgba(156, 198, 238, 0.12);
    --chart: #3cc187;
    --chart-area: rgba(60, 193, 135, 0.08);
    --focus: 0 0 0 3px rgba(47, 168, 116, 0.32);
    --shadow: none;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14.5px; line-height: 1.55; letter-spacing: -0.006em;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
code, pre, .mono { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
h1, h2, h3 { margin: 0; color: var(--text); font-weight: 600; }
h1 { font-size: 26px; line-height: 1.25; letter-spacing: -0.022em; }
h2 { font-size: 15px; line-height: 1.4; letter-spacing: -0.012em; }
h3 { font-size: 14px; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.num, td.num, .metric-value { font-variant-numeric: tabular-nums; font-feature-settings: "tnum", "cv11"; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 30; background: var(--surface); padding: 8px 12px; border-radius: var(--r); }
.icon { width: 16px; height: 16px; flex: 0 0 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  background: var(--side); border-right: 1px solid var(--border); padding: 20px 14px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 22px; font-weight: 650; font-size: 17px; letter-spacing: -0.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: inline-grid; place-items: center; flex: 0 0 26px; }
.mark svg { width: 15px; height: 15px; stroke: var(--on-accent); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nav-label { padding: 14px 10px 6px; font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; font-size: 14px;
}
.nav a .icon { color: var(--muted); }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav a[aria-current="page"] .icon { color: var(--accent-text); }
.who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 4px; border-top: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--text-2); text-transform: uppercase; flex: 0 0 32px; }
.who-text { min-width: 0; flex: 1; }
.who-name { font-weight: 600; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who form { margin: 0; }
.icon-btn { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border); }

.content { min-width: 0; padding: 36px 48px 56px; }
.content-inner { max-width: var(--content); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head .lead { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; max-width: 72ch; }
.page-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- notices ---------- */
.flash, .alert, .notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); margin: 0 0 20px; font-size: 14px; border: 1px solid transparent; }
.flash { background: var(--ok-bg); color: var(--ok); }
.alert { background: var(--bad-bg); color: var(--bad); }
.notice { background: var(--info-bg); color: var(--info); }

/* ---------- grid and cards ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid > * { min-width: 0; margin: 0; }
.grid > .wide { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px 24px; box-shadow: var(--shadow); min-width: 0; margin-bottom: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-head .note { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.card > .table-wrap { margin: 0 -24px; }
.card > .table-wrap:last-child { margin-bottom: -22px; }
.bare { min-width: 0; }

/* ---------- metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.metric { padding: 20px 24px; border-left: 1px solid var(--border); min-width: 0; }
.metric:first-child { border-left: 0; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; margin-top: 6px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-sub { color: var(--faint); font-size: 12.5px; margin-top: 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
thead th { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; padding-top: 10px; padding-bottom: 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.strong { font-weight: 550; color: var(--text); }
td .sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.strong-line { font-weight: 550; color: var(--text); }
td.cont > * { visibility: hidden; }
td.cont { color: transparent; }
tr.first td { border-top: 1px solid var(--border-strong); }
tbody tr.first:first-child td { border-top: 0; }
td time { white-space: nowrap; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); margin: 0; }
.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 10px 28px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.kv .kv { background: var(--surface-2); border-radius: var(--r); padding: 12px; }
.kv + .table-wrap, .kv + .empty { margin-top: 22px; }
.json { word-break: break-all; color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.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); }

/* ---------- forms ---------- */
form { margin: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; margin-bottom: 22px; }
.fields .field:has(textarea), .fields .field:has(select[multiple]) { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-weight: 550; font-size: 13px; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12.5px; }
input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r); width: 100%;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
input, select { height: 42px; padding: 0 14px; }
textarea { padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.55; min-height: 104px; resize: vertical; }
select:not([multiple]) {
  appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238a9590' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select[multiple] { height: auto; padding: 6px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; grid-column: 1 / -1; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.form-actions { display: flex; gap: 12px; align-items: center; }
.inline-form form { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.inline-form .fields { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; }
.inline-form .field { width: 240px; }

/* ---------- buttons ---------- */
button, .button {
  font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  text-decoration: none; white-space: nowrap; transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
button:hover, .button:hover { background: var(--hover); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger, .button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-bg); border-color: transparent; }
.small, button.small, .button.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.block { width: 100%; }
.actions { display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
.actions form { display: inline; }
.actions .small { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); font-weight: 500; }
.actions .small:hover { background: var(--surface-2); color: var(--text); }
.actions .small.danger { color: var(--bad); }
.actions .small.danger:hover { background: var(--bad-bg); }
td.nowrap { white-space: nowrap; }

/* ---------- secrets, docs ---------- */
.secret { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--warn-bg); padding: 12px 16px; border-radius: var(--r); margin-bottom: 12px; }
.secret code { font-size: 15px; overflow-wrap: anywhere; background: none; border: 0; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; overflow-x: auto; font-size: 13px; }
pre code { background: none; border: 0; padding: 0; }
.prose { max-width: 78ch; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 32px 0 12px; font-size: 18px; }
.prose h3 { margin: 24px 0 8px; }
.prose ul, .prose ol { padding-left: 20px; margin: 0 0 12px; }
.prose table { margin: 12px 0 20px; border: 1px solid var(--border); border-radius: var(--r); }
.prose th:first-child, .prose td:first-child { padding-left: 16px; }
.prose th:last-child, .prose td:last-child { padding-right: 16px; }
.method { display: inline-block; min-width: 58px; text-align: center; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 6px; border-radius: 6px; background: var(--info-bg); color: var(--info); letter-spacing: 0.02em; }
.m-post { background: var(--ok-bg); color: var(--ok); }
.m-delete { background: var(--bad-bg); color: var(--bad); }
.m-put, .m-patch { background: var(--warn-bg); color: var(--warn); }
.endpoints { table-layout: fixed; }
.endpoints col.c-method { width: 96px; }
.endpoints col.c-path { width: 40%; }
.endpoints td { vertical-align: top; }
.endpoints td:nth-child(2) { overflow-wrap: anywhere; }
.endpoints td:nth-child(2) code { background: none; border: 0; padding: 0; color: var(--text); font-size: 13.5px; }
.api-group { margin-top: 28px; }
.api-group h2 { margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- charts ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-area); stroke: none; }
.chart .dot { fill: var(--surface); stroke: var(--chart); stroke-width: 2; }
.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis { fill: var(--faint); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart details { margin-top: 12px; font-size: 13px; color: var(--muted); }
.chart summary { cursor: pointer; }
figure.chart { margin: 0; }

/* ---------- sign in ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-main { display: flex; flex-direction: column; padding: 32px 48px; }
.auth-main .brand { padding: 0; }
.auth-form { width: 100%; max-width: 380px; margin: auto; padding: 48px 0; }
.auth-form h1 { font-size: 28px; letter-spacing: -0.025em; }
.auth-form .sub { color: var(--muted); margin: 8px 0 28px; font-size: 15px; }
.auth-form .field { margin-bottom: 16px; }
.auth-form .alert, .auth-form .notice { margin-bottom: 20px; }
.auth-form button.primary { height: 44px; margin-top: 8px; font-size: 15px; }
.auth-form .hint { color: var(--muted); font-size: 13px; margin: 24px 0 0; }
.auth-foot { color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 16px; }
.seg-input { position: absolute; opacity: 0; pointer-events: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 24px; }
.seg label { height: 34px; display: grid; place-items: center; border-radius: 7px; font-weight: 550; font-size: 13.5px; color: var(--muted); cursor: pointer; transition: color 120ms ease, background-color 120ms ease; }
.seg label:hover { color: var(--text); }
#mode-staff:checked ~ .seg label[for="mode-staff"],
#mode-key:checked ~ .seg label[for="mode-key"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border); }
#mode-staff:focus-visible ~ .seg label[for="mode-staff"], #mode-key:focus-visible ~ .seg label[for="mode-key"] { box-shadow: var(--focus); }
#mode-staff:checked ~ .panes .pane-key, #mode-key:checked ~ .panes .pane-staff { display: none; }
.auth-panel { background: var(--brand-panel); color: var(--brand-ink); padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; border-left: 1px solid var(--border); }
.auth-panel .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; margin-bottom: 16px; }
.auth-panel h2 { color: #fff; font-size: 34px; line-height: 1.18; letter-spacing: -0.03em; font-weight: 600; max-width: 18ch; margin-bottom: 18px; }
.auth-panel p { font-size: 15.5px; line-height: 1.6; opacity: 0.82; max-width: 46ch; margin-bottom: 36px; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; max-width: 46ch; }
.points li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; font-size: 14.5px; line-height: 1.5; }
.points .tick { width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; }
.points .tick svg { width: 15px; height: 15px; stroke: #7fe0b4; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.points strong { display: block; color: #fff; font-weight: 600; }
.points span { opacity: 0.78; }

.message { max-width: 560px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 28px 28px 48px; }
}
@media (max-width: 980px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-panel { display: none; }
  .auth-main { padding: 24px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .brand { padding: 0; }
  .nav-label { display: none; }
  .side nav { order: 3; flex: 1 0 100%; min-width: 0; display: flex; gap: 2px; overflow-x: auto; }
  .nav { flex-direction: row; flex: 0 0 auto; }
  .nav a { white-space: nowrap; height: 34px; }
  .who { margin: 0 0 0 auto; border: 0; padding: 0; }
  .who-text { display: none; }
  .content { padding: 20px 16px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px 16px; }
  .card > .table-wrap { margin: 0 -16px; }
  .card > .table-wrap:last-child { margin-bottom: -18px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 16px; border-left: 0; border-top: 1px solid var(--border); }
  .metric:nth-child(-n+2) { border-top: 0; }
  .metric:nth-child(even) { border-left: 1px solid var(--border); }
  .metric-value { font-size: 24px; }
  h1 { font-size: 22px; }
}
td .strong-line { white-space: nowrap; }
@media (max-width: 860px) {
  .chart { overflow-x: auto; }
  .chart svg { min-width: 640px; }
}

/* Supervision: back link, attention queue, league table, sparklines */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; margin-bottom: 8px; }
.back:hover { color: var(--text); }
.back .icon { width: 16px; height: 16px; }
.alerts { list-style: none; margin: 0 -24px -22px; padding: 0; }
.alert-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 24px; border-top: 1px solid var(--border); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--faint); }
.alert-row.crit .alert-dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.alert-row.warn .alert-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.alert-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-text a { color: var(--text); font-weight: 600; text-decoration: none; }
.alert-text a:hover { color: var(--accent-text); text-decoration: underline; }
.alert-text span { color: var(--muted); font-size: 13px; }
.alert-tag { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.alert-more { padding: 12px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.all-clear { display: flex; gap: 12px; align-items: flex-start; }
.all-clear .tick { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ok-bg); display: grid; place-items: center; }
.all-clear .tick svg { width: 16px; height: 16px; fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.all-clear strong { display: block; font-weight: 600; }
.all-clear span { color: var(--muted); font-size: 13px; }
th a.sort { color: inherit; text-decoration: none; }
th a.sort:hover { color: var(--text); }
th[aria-sort] a.sort { color: var(--text); }
th[aria-sort="descending"] a.sort::after { content: " \2193"; }
th[aria-sort="ascending"] a.sort::after { content: " \2191"; }
a.row-link { color: var(--text); text-decoration: none; }
a.row-link:hover { color: var(--accent-text); text-decoration: underline; }
.league td { vertical-align: middle; }
.spark { width: 96px; height: 26px; display: block; overflow: visible; }
.spark polyline { fill: none; stroke: var(--chart); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--chart); }
.rate-flag { color: var(--warn); font-weight: 600; }
.bad-text { color: var(--bad); }
@media (max-width: 860px) {
  .alerts { margin: 0 -16px -16px; }
  .alert-row { padding: 12px 16px; grid-template-columns: 10px minmax(0, 1fr); }
  .alert-tag { display: none; }
}

/* Developer documentation */
.docs { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 40px; align-items: start; }
.docs.has-code { grid-template-columns: 232px minmax(0, 1fr) minmax(400px, 540px); }
.docs-nav { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding-right: 4px; font-size: 13.5px; }
.docs-nav .nav-label { margin: 18px 10px 6px; }
.docs-nav a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; line-height: 1.35; }
.docs-nav a:hover { background: var(--surface-2); color: var(--text); }
.docs-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.docs-link-text { min-width: 0; }
.docs-nav a { align-items: flex-start; }
.docs-nav .verb { margin-top: 2px; }
.docs-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.docs-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.docs-search .icon { width: 16px; height: 16px; color: var(--faint); flex: none; }
.docs-search input { border: 0; outline: 0; background: none; height: 36px; padding: 0; box-shadow: none; font-size: 13.5px; width: 100%; color: var(--text); }
.docs-empty { color: var(--faint); padding: 8px 10px; margin: 0; }
.docs-body { min-width: 0; }
.docs-code { position: sticky; top: 24px; min-width: 0; }
.docs-h2 { font-size: 17px; margin: 36px 0 14px; padding-top: 4px; }
.docs-body > .docs-h2:first-child { margin-top: 0; }
.verb { flex: none; display: inline-block; width: 36px; text-align: center; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.02em; padding: 2px 0; border-radius: 5px; background: var(--info-bg); color: var(--info); }
.v-post { background: var(--ok-bg); color: var(--ok); }
.v-delete { background: var(--bad-bg); color: var(--bad); }
.v-put, .v-patch { background: var(--warn-bg); color: var(--warn); }
.start-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0 8px; }
.start-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); text-decoration: none; box-shadow: var(--shadow); transition: border-color 0.15s; }
.start-card:hover { border-color: var(--accent); }
.start-card strong { color: var(--text); font-weight: 600; }
.start-card span { color: var(--muted); font-size: 13.5px; }
.basics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.basics h3 { font-size: 14.5px; margin: 0 0 4px; }
.basics p { margin: 0; color: var(--muted); font-size: 13.5px; }
.api-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 24px 0 8px; }
.ep-list { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.ep { display: grid; grid-template-columns: 44px minmax(0, 340px) minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); }
.ep:first-child { border-top: 0; }
.ep:hover { background: var(--surface-2); }
.ep code { background: none; border: 0; padding: 0; font-size: 13px; overflow-wrap: anywhere; }
.ep-sum { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.op-line .verb { width: auto; padding: 3px 8px; font-size: 11px; }
.op-line code { background: none; border: 0; padding: 0; font-size: 15px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.op-summary { font-size: 15.5px; color: var(--text); margin: 0 0 12px; max-width: 70ch; }
.op-meta { display: grid; gap: 10px; margin: 20px 0 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); font-size: 13.5px; }
.op-meta > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
.op-meta-label { color: var(--muted); font-weight: 500; }
.fields-doc { margin: 0; border-top: 1px solid var(--border); }
.fd { padding: 12px 0; border-bottom: 1px solid var(--border); }
.fd dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.fd dt code { background: none; border: 0; padding: 0; font-weight: 600; font-size: 13.5px; color: var(--text); }
.fd-type { font-size: 12.5px; color: var(--faint); }
.fd-req { font-size: 11px; font-weight: 600; color: var(--warn); text-transform: uppercase; letter-spacing: 0.04em; }
.fd dd { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.fd dd p { margin: 2px 0; }
.fd-note { color: var(--muted); font-size: 13.5px; }
.fd-children { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r); padding: 0 14px; background: var(--surface); }
.fd-children > summary { cursor: pointer; padding: 8px 0; font-size: 13px; font-weight: 500; color: var(--text); }
.fd-children[open] > summary { border-bottom: 1px solid var(--border); }
.fd-children .fields-doc { border-top: 0; }
.fd-children .fd:last-child { border-bottom: 0; }
.responses { display: grid; gap: 8px; }
.resp { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; background: var(--surface); }
.resp-head { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; }
.resp-code { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 5px; }
.resp-code.ok { background: var(--ok-bg); color: var(--ok); }
.resp-code.bad { background: var(--bad-bg); color: var(--bad); }
.resp-code.info { background: var(--info-bg); color: var(--info); }
.resp .fd-children { border: 0; padding: 0; background: none; }
/* Code blocks are dark in both schemes, like a terminal. */
.code-block { --c-bg: #0d1412; --c-line: #1e2b27; --c-text: #d4e0da; --c-dim: #86a097; background: var(--c-bg); border: 1px solid var(--c-line); border-radius: 12px; overflow: hidden; margin: 0 0 14px; position: relative; }
.code-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--c-line); min-height: 40px; }
.code-title { color: var(--c-dim); font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.code-langs { display: flex; gap: 2px; }
.code-langs label { color: var(--c-dim); font-size: 12.5px; font-weight: 500; padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.code-langs label:hover { color: var(--c-text); }
.code-copy { margin-left: auto; height: 26px; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--c-dim); background: transparent; border: 1px solid var(--c-line); border-radius: 6px; box-shadow: none; cursor: pointer; }
.code-copy:hover { color: var(--c-text); border-color: var(--c-dim); background: transparent; }
.code-block pre { margin: 0; padding: 14px 16px; overflow: auto; max-height: 520px; background: none; border: 0; color: var(--c-text); font-size: 12.5px; line-height: 1.65; }
.code-block pre code { color: inherit; font-size: inherit; }
.code-tabs > input { position: absolute; opacity: 0; pointer-events: none; }
.code-panes > pre { display: none; }
.code-tabs > input:nth-of-type(1):checked ~ .code-panes > pre:nth-child(1),
.code-tabs > input:nth-of-type(2):checked ~ .code-panes > pre:nth-child(2),
.code-tabs > input:nth-of-type(3):checked ~ .code-panes > pre:nth-child(3) { display: block; }
.code-tabs > input:nth-of-type(1):checked ~ .code-bar label:nth-child(1),
.code-tabs > input:nth-of-type(2):checked ~ .code-bar label:nth-child(2),
.code-tabs > input:nth-of-type(3):checked ~ .code-bar label:nth-child(3) { color: var(--c-text); background: #1a2622; }
.code-tabs > input:nth-of-type(1):focus-visible ~ .code-bar label:nth-child(1),
.code-tabs > input:nth-of-type(2):focus-visible ~ .code-bar label:nth-child(2),
.code-tabs > input:nth-of-type(3):focus-visible ~ .code-bar label:nth-child(3) { outline: 2px solid #5cd19e; outline-offset: 1px; }
.tk-s { color: #a8e0bf; }
.tk-k { color: #8fc4f5; }
.tk-n { color: #f0c38a; }
.tk-c { color: #6e877e; font-style: italic; }
/* Quickstart: explanation beside its code */
.qs-step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; padding: 28px 0; border-top: 1px solid var(--border); }
.qs-step:first-child { border-top: 0; padding-top: 0; }
.qs-text h2 { font-size: 17px; margin: 10px 0 8px; }
.qs-text p { color: var(--muted); max-width: 60ch; }
.qs-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 13px; }
.qs-next { padding-top: 28px; border-top: 1px solid var(--border); }
.qs-next h2 { font-size: 17px; margin: 0; }
@media (max-width: 1600px) {
  .docs.has-code { grid-template-columns: 232px minmax(0, 1fr); }
  .docs.has-code .docs-code { grid-column: 2; position: static; }
}
@media (max-width: 1320px) {
  .qs-step { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 980px) {
  .docs, .docs.has-code { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .docs.has-code .docs-code { grid-column: 1; }
  .docs-nav { position: static; max-height: 300px; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; background: var(--surface); }
  .start-cards, .basics { grid-template-columns: minmax(0, 1fr); }
  .ep { grid-template-columns: 44px minmax(0, 1fr); }
  .ep-sum { grid-column: 2; white-space: normal; }
}

/* Dispute workspace */
.filter-tabs { margin-bottom: 16px; }
.filter-tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center; line-height: 18px; }
.filter-tabs a[aria-current="page"] .count { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.filter-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.filter-bar .field { margin: 0; }
.filter-actions { display: flex; gap: 8px; }
.empty-row { text-align: center; color: var(--muted); padding: 32px 16px !important; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--border); }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; background: var(--surface); border: 2px solid var(--accent); }
.tl-due .tl-dot { border-color: var(--warn); border-style: dashed; }
.tl-late .tl-dot { border-color: var(--bad); background: var(--bad-bg); }
.timeline strong { display: block; font-weight: 600; }
.timeline time { display: block; color: var(--faint); font-size: 12.5px; margin-top: 1px; }
.timeline p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.rule-form .choice { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rule-form legend { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.rule-form .choice label { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; background: var(--surface); }
.rule-form .choice label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rule-form .choice input { grid-row: span 2; margin-top: 3px; }
.rule-form .choice span { grid-column: 2; color: var(--muted); font-size: 13px; }
.rule-form textarea { width: 100%; }
@media (max-width: 980px) {
  .filter-bar { grid-template-columns: minmax(0, 1fr); }
  .rule-form .choice { grid-template-columns: minmax(0, 1fr); }
}

/* Exports and reports */
.card-head { align-items: flex-start; }
.card-action { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; text-decoration: none; white-space: nowrap; flex: none; }
.card-action:hover { color: var(--text); border-color: var(--faint); text-decoration: none; }
.card-action .icon { width: 14px; height: 14px; }
.report-list { margin: 0 -24px -22px; }
.report-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 24px; border-top: 1px solid var(--border); }
.report-row strong { display: block; font-weight: 600; }
.report-row span { color: var(--muted); font-size: 13.5px; }
.report-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.report-icon .icon { width: 20px; height: 20px; }
@media (max-width: 860px) {
  .report-list { margin: 0 -16px -16px; }
  .report-row { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .report-icon { display: none; }
}

/* Fraud signals */
.filter-tabs .tab-right.first { margin-left: auto; }
.note-cell { max-width: 280px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Guides */
.guide { max-width: 76ch; }
.guide h2 { font-size: 17px; margin: 32px 0 10px; }
.guide .code-block { margin: 14px 0 18px; }
.guide-kv { grid-template-columns: minmax(140px, max-content) minmax(0, 1fr); margin: 8px 0 16px; }
.guide-kv dd { color: var(--muted); }
.guide-list { columns: 2; column-gap: 24px; padding-left: 18px; }
.guide-list li { break-inside: avoid; margin-bottom: 4px; }
.guide .table-wrap { margin: 8px 0 20px; border: 1px solid var(--border); border-radius: var(--r); }
@media (max-width: 860px) { .guide-list { columns: 1; } .guide-kv { grid-template-columns: minmax(0, 1fr); } }
.code-block pre { tab-size: 4; }

/* Developer console */
code.path { background: none; border: 0; padding: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.sub-cell { font-size: 12px; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.webhook-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.event-choice { border: 0; padding: 0; margin: 12px 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.event-choice legend { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.event-choice code { background: none; border: 0; padding: 0; font-size: 12.5px; }
