:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-code: #0f172a;
  --text: #1f2937;
  --text-soft: #6b7280;
  --code-text: #e2e8f0;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --yes: #15803d;
  --yes-bg: #ecfdf3;
  --no: #9ca3af;
  --warn-bg: #fffbeb;
  --warn-border: #f59e0b;
  --sidebar-w: 280px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17;
    --bg-soft: #131a26;
    --bg-code: #060a12;
    --text: #e5e7eb;
    --text-soft: #9aa3b2;
    --border: #253043;
    --accent: #7aa7ff;
    --accent-soft: #15213a;
    --yes: #4ade80;
    --yes-bg: #10261a;
    --no: #556072;
    --warn-bg: #2a2110;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
:not(pre) > code { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
h1 { font-size: 28px; margin: 0 0 6px; line-height: 1.25; }
h2 { font-size: 20px; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--border); }
h3 { font-size: 16px; margin: 24px 0 8px; }
p { margin: 8px 0; }

/* ── Layout ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10; height: 56px;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; color: var(--text); }
.topbar .crumb { color: var(--text-soft); }
.topbar .menu { display: none; background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 4px 10px; cursor: pointer; }
.layout { display: flex; }
.sidebar {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  width: var(--sidebar-w); flex-shrink: 0; padding: 20px 12px;
  border-right: 1px solid var(--border); background: var(--bg-soft);
}
.sidebar .group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin: 18px 10px 6px; }
.sidebar .group:first-child { margin-top: 0; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); font-size: 14px; word-break: break-word; }
.sidebar a small { display: block; color: var(--text-soft); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; }
.sidebar a:hover { background: var(--accent-soft); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.content { flex: 1; min-width: 0; padding: 32px 48px 80px; max-width: 1100px; }
.lead { color: var(--text-soft); font-size: 16px; }

@media (max-width: 860px) {
  .topbar .menu { display: inline-block; }
  .sidebar { position: fixed; left: 0; z-index: 9; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .content { padding: 24px 16px 60px; }
}

/* ── Building blocks ────────────────────────────────── */
.chip { display: inline-block; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-right: 6px; }
.method { display: inline-block; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 4px; background: var(--accent); color: #fff; margin-right: 8px; }
.endpoint { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); }
.note { border-left: 3px solid var(--warn-border); background: var(--warn-bg); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 12px 0; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 40px; margin: 14px 0; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--border); }
th { background: var(--bg-soft); font-weight: 600; font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.name code, td:first-child > code { white-space: nowrap; }
.req { color: #dc2626; font-size: 12px; font-weight: 600; }
.opt { color: var(--text-soft); font-size: 12px; }

table.matrix th, table.matrix td { text-align: center; padding: 6px 8px; font-size: 12.5px; }
table.matrix th:first-child, table.matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--bg-soft); }
table.matrix th { white-space: normal; min-width: 72px; vertical-align: bottom; }
table.matrix .y { color: var(--yes); background: var(--yes-bg); font-weight: 700; }
table.matrix .n { color: var(--no); }

/* ── Code blocks ────────────────────────────────────── */
.code { position: relative; margin: 10px 0; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--bg-code); color: var(--code-text); border-radius: 8px; line-height: 1.5; }
.code .copy { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 3px 9px; border-radius: 5px; border: 1px solid #334155; background: #1e293b; color: #cbd5e1; cursor: pointer; }
.code .copy:hover { background: #334155; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.tabs button { font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.example { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin: 14px 0; }
.example h3 { margin: 0 0 4px; }
.example .scenario { color: var(--text-soft); margin: 0 0 6px; }

details { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 20px 0; }
.card { display: block; border: 1px solid var(--border); border-radius: 10px; padding: 18px; color: var(--text); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card strong { display: block; font-size: 16px; margin-bottom: 4px; }
.card span { color: var(--text-soft); font-size: 14px; }
