:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7c;
  --line: #dde2e8;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --ok-bg: #e3f4ea; --ok: #1d6b3c;
  --wait-bg: #fff3d6; --wait: #7a5300;
  --bad-bg: #fde6e4; --bad: #a3271c;
  --muted-bg: #eceff3;
  --radius: 8px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --text: #e6eaf0;
    --muted: #9aa7b6;
    --line: #2c3542;
    --accent: #6ea2f2;
    --accent-text: #0e1420;
    --ok-bg: #173826; --ok: #8fd9ad;
    --wait-bg: #3a2f12; --wait: #f2cf7d;
    --bad-bg: #44201d; --bad: #f4a59c;
    --muted-bg: #262e3a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
h1 { font-size: 24px; margin: 24px 0 16px; }
h2 { font-size: 18px; margin: 28px 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; min-height: 56px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 400; }
nav { display: flex; gap: 16px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
nav a[aria-current="page"] { color: var(--text); border-bottom: 2px solid var(--accent); }
.who { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 16px;
}
.narrow { max-width: 480px; }
.center { margin: 64px auto; text-align: center; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.actions h2 { grid-column: 1 / -1; margin-bottom: 0; }
.actions .card { margin: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; text-decoration: none; color: var(--text);
}
.tile-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clip { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--wait-bg); color: var(--wait); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.muted { background: var(--muted-bg); color: var(--muted); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin: 16px 0; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.warn { background: var(--wait-bg); color: var(--wait); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

pre.payload, pre.secret, .card pre {
  background: var(--muted-bg); border-radius: var(--radius); padding: 12px; overflow-x: auto; margin: 8px 0;
}
pre.secret { font-size: 15px; user-select: all; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 600; padding: 0 4px; }
.field-error { color: var(--bad); font-weight: 400; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filters .grow { flex: 1 1 240px; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0;
}
textarea { width: 100%; }
button, .button {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-block; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 7px 14px;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { border-color: var(--bad); color: var(--bad); }
button.linkish { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 400; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr; }
  .facts dt { margin-top: 6px; }
  .who { margin-left: 0; }
}
