:root {
  --ink: #16181d; --ink-2: #3c414b; --muted: #646b78; --line: #e2e5ea; --paper: #f4f5f7; --surface: #ffffff;
  --accent: #d9480f; --accent-ink: #ffffff; --accent-soft: #fff0e8;
  --ok: #2b8a3e; --ok-soft: #e6f4e8; --bad: #c92a2a; --bad-soft: #fdecec; --wait: #5c6b7f; --wait-soft: #edf0f4;
  --run: #1864ab; --run-soft: #e7f1fb; --warn: #a15c00; --code: #10131a; --code-ink: #e7e9ee;
  --radius: 10px; --gap: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceef2; --ink-2: #c9cdd6; --muted: #9aa1ad; --line: #2b2f37; --paper: #121418; --surface: #1a1d23;
    --accent: #ff7a3d; --accent-ink: #1a0d05; --accent-soft: #2e1a10;
    --ok: #69db7c; --ok-soft: #15301b; --bad: #ff8787; --bad-soft: #3a1717; --wait: #a9b4c4; --wait-soft: #232831;
    --run: #74c0fc; --run-soft: #12283b; --warn: #ffc078; --code: #0b0d11; --code-ink: #dfe3ea;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 20px; }
.main { padding-block: 32px 64px; min-height: 60vh; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); padding-block: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.lamp { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--ink); }
.inline { display: inline; margin: 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-2); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 6px 12px; font-size: .875rem; }
.nav .btn { color: var(--accent-ink); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.nav button.link { color: var(--ink-2); text-decoration: none; font-size: .95rem; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; border: 1px solid var(--line); background: var(--surface); }
.flash.ok { border-color: var(--ok); background: var(--ok-soft); }
.flash.warn { border-color: var(--warn); background: var(--accent-soft); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack > * + * { margin-top: 12px; }
.empty { text-align: left; max-width: 640px; }
.narrow { max-width: 640px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; margin-bottom: 20px; }
.head-row h1, .head-row h2 { margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
section + section { margin-top: 48px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; letter-spacing: .02em; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.wait { background: var(--wait-soft); color: var(--wait); }
.pill.run { background: var(--run-soft); color: var(--run); }
.tag { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }

.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding-block: 24px 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--accent); font-weight: 700; margin-bottom: 12px; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 60ch; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.q-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.q-t { font-weight: 600; font-size: .95rem; }
.q-m { color: var(--muted); font-size: .85rem; }
.q-foot { margin: 12px 0 0; }
.grid3 { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); counter-reset: step; }
.grid3 li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; counter-increment: step; }
.grid3 li::before { content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.api-band { display: grid; grid-template-columns: .9fr 1.1fr; gap: 32px; align-items: center; }
.faq dl { margin: 0; display: grid; gap: 18px; max-width: 760px; }
.faq dt { font-weight: 700; }
.faq dd { margin: 4px 0 0; color: var(--ink-2); }

.code { background: var(--code); color: var(--code-ink); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; font-size: .86rem; line-height: 1.55; margin: 0 0 1em; }
.code code { font-size: inherit; }

.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.ch-head { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; margin-bottom: 14px; }
.ch-head h2 { font-size: 1.05rem; margin: 0; }
.ch-head p { margin: 0; }
.avatar { border-radius: 50%; width: 44px; height: 44px; object-fit: cover; }
.avatar.blank { display: inline-block; background: var(--wait-soft); }
.facts, .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 0 0 14px; }
.facts dt, .stats dt { font-size: .8rem; color: var(--muted); }
.facts dd, .stats dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 700; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.ch-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.cap { display: inline-flex; align-items: center; gap: 6px; }
.cap input { width: 70px; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=file] { padding: 7px; }
textarea { resize: vertical; }
.form { max-width: 760px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.field > label:first-child, .field > legend { font-weight: 600; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400 !important; }
.check input { margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: 640px; margin-bottom: 20px; }
.inline-form input { flex: 1 1 200px; width: auto; }
.inline-form label { font-weight: 600; }
.newkey { border-color: var(--ok); margin-bottom: 20px; }
.keybox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--paper); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; }
.keybox code { word-break: break-all; flex: 1 1 260px; }
.danger-zone { margin-top: 20px; border-color: var(--bad-soft); max-width: 640px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table .t { display: block; font-weight: 600; }
.err { display: block; color: var(--bad); }
.warn-t { display: block; color: var(--warn); }

.prose { max-width: 72ch; }
.prose.wide { max-width: 900px; }
.prose h2 { margin-top: 1.8em; }
.prose ul { padding-left: 1.2em; }
.prose li + li { margin-top: .4em; }

.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-in { padding-block: 24px; display: grid; gap: 10px; }
.foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.foot nav a { color: var(--ink-2); font-size: .9rem; }

@media (max-width: 760px) {
  .hero, .api-band, .row2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
  .q-row { grid-template-columns: 84px 1fr; }
  .q-m { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
