:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #14181f;
  --muted: #5d6675;
  --line: #dfe3ea;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --ok: #17703d;
  --ok-bg: #e3f4ea;
  --bad: #a4262c;
  --bad-bg: #fbe6e7;
  --warn: #7a5200;
  --warn-bg: #fdf1d3;
  --info: #2c4f7c;
  --info-bg: #e6eef8;
  --code-bg: #f0f2f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #181c22;
    --text: #e7eaf0;
    --muted: #98a2b3;
    --line: #2a3039;
    --accent: #6cb0f5;
    --accent-text: #0b1420;
    --ok: #7ad79d;
    --ok-bg: #173323;
    --bad: #f39a9f;
    --bad-bg: #3b1b1e;
    --warn: #f1c66b;
    --warn-bg: #3a2e12;
    --info: #a7c6ee;
    --info-bg: #1b2a3d;
    --code-bg: #1f242c;
  }
}

* { 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); text-decoration: none; }
a:hover { text-decoration: underline; }

header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
header.top .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
}
header.top .brand { font-weight: 650; color: var(--text); margin-right: 8px; }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 1; }
header.top nav a { color: var(--muted); }
header.top nav a.here { color: var(--text); font-weight: 600; }

main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
p.lead { color: var(--muted); margin: 0 0 18px; max-width: 75ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.grid .card { margin-bottom: 0; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.card .big { font-size: 20px; font-weight: 650; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.kv th { width: 220px; text-transform: none; letter-spacing: 0; font-size: 14px; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 0 0 14px;
}

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

.flash { border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.notice a { color: inherit; text-decoration: underline; }

form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, .button {
  font: inherit;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button.plain, .button.plain { background: transparent; color: var(--accent); }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
button:disabled { opacity: .45; cursor: not-allowed; }
.button:hover { text-decoration: none; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], select {
  font: inherit;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }

.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slots a { padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-variant-numeric: tabular-nums; }

ol.steps { list-style: none; padding: 0; margin: 0; }
ol.steps li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
ol.steps li .badge { flex: none; align-self: flex-start; min-width: 62px; text-align: center; }
ol.steps .detail { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.login { max-width: 360px; margin: 12vh auto 0; }
