/* SWP Core Docs — Concept A "Reference". Tokens are the merchant app's
   shared/design-system/tokens.css, light and dark. */
:root {
  --paper: #f6f8fa; --surface: #fff; --sunk: #f1f5f8; --raised: #fff;
  --ink: #0f1b26; --ink-2: #44586b; --ink-3: #6c8093; --ink-4: #93a6b5; --text-muted: #586d80;
  --rule: #dfe6ed; --rule-2: #edf1f5; --rule-3: #f3f6f9;
  --accent: #0f6b8c; --accent-2: #0b5470; --accent-soft: #e2eff4; --accent-line: #9fcadb; --accent-ink: #fff;
  --good: #0e7a63; --good-bg: #e0f1ec; --good-line: #9bd4c4;
  --warn: #8b5e10; --warn-bg: #f8efdb; --warn-line: #e0c489;
  --bad: #a62c3e; --bad-bg: #fae9eb; --bad-line: #e8aeb6;
  --neutral: #44586b; --neutral-bg: #edf1f5; --neutral-line: #c6d2dc;
  --info: #0f6b8c; --info-bg: #e2eff4; --info-line: #9fcadb;
  --nav: #fff; --nav-ink: #44586b; --nav-ink-2: #8698a8; --nav-highlight: #edf1f5; --nav-brand: #0f1b26;
  --scrim: rgb(15 27 38 / 34%);
  --shadow-1: 0 1px 2px rgb(15 27 38 / 5%);
  --shadow-2: 0 1px 3px rgb(15 27 38 / 7%), 0 6px 16px -8px rgb(15 27 38 / 18%);
  --shadow-3: 0 12px 34px -12px rgb(15 27 38 / 28%), 0 2px 6px rgb(15 27 38 / 6%);
  --code-bg: #0f1b26; --code-ink: #dbe6ee; --code-rule: #1f2f3c; --code-muted: #7a8f9f; --code-tab: #1f2f3c;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 8px; --radius-s: 6px; --radius-xs: 4px;
  --topbar: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1418; --surface: #131c22; --sunk: #0f181d; --raised: #18242b;
    --ink: #e4edf2; --ink-2: #9bafbd; --ink-3: #7a8f9f; --ink-4: #63798a; --text-muted: #8ea3b2;
    --rule: #22303a; --rule-2: #1a2630; --rule-3: #16212a;
    --accent: #57adcb; --accent-2: #7cc2da; --accent-soft: #12242c; --accent-line: #2a5464; --accent-ink: #08161c;
    --good: #4dbba0; --good-bg: #0f231f; --good-line: #255249;
    --warn: #d5a855; --warn-bg: #271f11; --warn-line: #57482a;
    --bad: #e2848f; --bad-bg: #2a171b; --bad-line: #5c3238;
    --neutral: #9bafbd; --neutral-bg: #1b2630; --neutral-line: #374753;
    --info: #57adcb; --info-bg: #12242c; --info-line: #2a5464;
    --nav: #0a1014; --nav-ink: #9bafbd; --nav-ink-2: #6c8090; --nav-highlight: #17242c; --nav-brand: #e4edf2;
    --scrim: rgb(0 0 0 / 60%);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-2: 0 1px 3px rgb(0 0 0 / 50%), 0 6px 16px -8px rgb(0 0 0 / 70%);
    --shadow-3: 0 14px 38px -12px rgb(0 0 0 / 85%), 0 2px 6px rgb(0 0 0 / 50%);
    --code-bg: #0a1014; --code-rule: #1a2630; --code-tab: #1b2630;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1418; --surface: #131c22; --sunk: #0f181d; --raised: #18242b;
  --ink: #e4edf2; --ink-2: #9bafbd; --ink-3: #7a8f9f; --ink-4: #63798a; --text-muted: #8ea3b2;
  --rule: #22303a; --rule-2: #1a2630; --rule-3: #16212a;
  --accent: #57adcb; --accent-2: #7cc2da; --accent-soft: #12242c; --accent-line: #2a5464; --accent-ink: #08161c;
  --good: #4dbba0; --good-bg: #0f231f; --good-line: #255249;
  --warn: #d5a855; --warn-bg: #271f11; --warn-line: #57482a;
  --bad: #e2848f; --bad-bg: #2a171b; --bad-line: #5c3238;
  --neutral: #9bafbd; --neutral-bg: #1b2630; --neutral-line: #374753;
  --info: #57adcb; --info-bg: #12242c; --info-line: #2a5464;
  --nav: #0a1014; --nav-ink: #9bafbd; --nav-ink-2: #6c8090; --nav-highlight: #17242c; --nav-brand: #e4edf2;
  --scrim: rgb(0 0 0 / 60%);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 1px 3px rgb(0 0 0 / 50%), 0 6px 16px -8px rgb(0 0 0 / 70%);
  --shadow-3: 0 14px 38px -12px rgb(0 0 0 / 85%), 0 2px 6px rgb(0 0 0 / 50%);
  --code-bg: #0a1014; --code-rule: #1a2630; --code-tab: #1b2630;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font-sans); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; }
code { font-family: var(--font-mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
::selection { background: var(--accent-soft); }
kbd { background: var(--sunk); border: 1px solid var(--rule); border-radius: 3px; color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; padding: 1px 4px; line-height: 1.4; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- Shell ---------- */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 14px; padding: 0 16px 0 14px; background: var(--surface); border-bottom: 1px solid var(--rule); flex: none; z-index: 30; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--nav-brand); width: 210px; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-s); background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: -0.02em; }
.brand b { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand-path { color: var(--text-muted); font-family: var(--font-mono); font-size: 12.5px; }
.seg { display: flex; gap: 2px; padding: 3px; background: var(--sunk); border: 1px solid var(--rule); border-radius: var(--radius-s); flex: none; }
.seg button { height: 26px; padding: 0 12px; border-radius: 5px; color: var(--text-muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.search-trigger { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; max-width: 440px; height: 32px; padding: 0 10px; background: var(--sunk); border: 1px solid var(--rule); border-radius: var(--radius-s); color: var(--text-muted); font-size: 13px; text-align: left; }
.search-trigger:hover { border-color: var(--neutral-line); }
.search-trigger span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.topbar-link { color: var(--ink-2); font-size: 13px; font-weight: 500; padding: 0 4px; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-s); color: var(--text-muted); }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--radius-s); font-size: 13px; font-weight: 500; white-space: nowrap; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.btn:hover { background: var(--sunk); text-decoration: none; border-color: var(--neutral-line); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-small { height: 27px; font-size: 12px; padding: 0 9px; }
.menu-btn { display: none; }

.shell { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 248px; flex: none; background: var(--nav); border-right: 1px solid var(--rule); overflow-y: auto; padding: 8px 10px 28px; display: flex; flex-direction: column; }
.nav-group h2 { color: var(--text-muted); font-family: var(--font-sans); font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; padding: 14px 8px 5px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border-radius: var(--radius-s); color: var(--nav-ink); font-size: 13px; padding: 7px 8px; text-align: left; }
.nav-item:hover { background: var(--nav-highlight); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .nav-badge { margin-left: auto; color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; }
.sidebar-foot { margin-top: auto; padding: 16px 8px 0; display: flex; flex-direction: column; gap: 6px; color: var(--text-muted); font-size: 12px; }
.sidebar-legal { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 8px; }
.sidebar-legal a { color: var(--nav-ink); }

.main { flex: 1; min-width: 0; overflow-y: auto; position: relative; scroll-behavior: smooth; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }

/* ---------- Pages ---------- */
.page { display: block; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 44px; padding: 32px 40px 72px; max-width: 1100px; }
.page-body { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.page-body > p, .page-body .list, .step-body p, .status-meaning, .param-desc, .callout, .error-desc, .table { font-size: 14.5px; line-height: 1.6; }
.page-body > p, .step-body p { color: var(--ink-2); max-width: 68ch; }
.page-body h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; padding-top: 14px; scroll-margin-top: 16px; }
.page-body h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; padding-top: 4px; }
.page-body .list { color: var(--ink-2); padding-left: 22px; margin: 0; display: flex; flex-direction: column; gap: 6px; max-width: 68ch; }
.support-form { display: flex; flex-direction: column; gap: 16px; max-width: 58ch; padding: 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.support-field { display: flex; flex-direction: column; gap: 6px; }
.support-field label { font-size: 13px; font-weight: 600; }
.support-field input, .support-field select, .support-field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); font: inherit; }
.support-field textarea { resize: vertical; }
.support-form .btn { align-self: start; }
.support-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.page-body code, .step-body code, .status-meaning code, .param-desc code, .callout code, .error-desc code, .table code, .msg-bot code { background: var(--sunk); border: 1px solid var(--rule-2); border-radius: var(--radius-xs); padding: 1px 5px; color: var(--ink); font-size: 0.9em; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.crumb b { color: var(--ink-2); font-weight: 500; }
.page-head { display: flex; flex-direction: column; gap: 10px; }
.page-head h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.lede { font-size: 15.5px; line-height: 1.6; color: var(--ink-2); max-width: 68ch; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 1.5; padding: 2px 9px; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill-nodot::before { display: none; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.method { display: inline-flex; align-items: center; border-radius: var(--radius-xs); font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 6px; line-height: 1.5; background: var(--neutral-bg); color: var(--neutral); }
.method-get { background: var(--good-bg); color: var(--good); }
.method-post { background: var(--accent-soft); color: var(--accent); }
.method-put, .method-patch { background: var(--warn-bg); color: var(--warn); }
.method-delete { background: var(--bad-bg); color: var(--bad); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--info-line); background: var(--info-bg); color: var(--ink); max-width: 72ch; }
.callout-icon { flex: none; margin-top: 2px; color: var(--info); }
.callout-warn { background: var(--warn-bg); border-color: var(--warn-line); } .callout-warn .callout-icon { color: var(--warn); }
.callout-good { background: var(--good-bg); border-color: var(--good-line); } .callout-good .callout-icon { color: var(--good); }
.callout-bad { background: var(--bad-bg); border-color: var(--bad-line); } .callout-bad .callout-icon { color: var(--bad); }

/* Code panels */
.code-panel { background: var(--code-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-2); color: var(--code-ink); }
.code-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--code-rule); }
.code-head-resp { border-top: 1px solid var(--code-rule); }
.code-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--code-muted); margin-right: auto; }
.code-status { font-family: var(--font-mono); font-size: 11px; color: #8fd3c1; margin-right: auto; }
.code-tabs { display: flex; gap: 2px; }
.code-tab { height: 26px; padding: 0 10px; border-radius: 5px; color: var(--code-muted); font-size: 12px; font-weight: 500; }
.code-tab:hover { color: var(--code-ink); }
.code-tab.is-active { background: var(--code-tab); color: #fff; }
.copy-btn { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 5px; color: var(--code-muted); font-size: 12px; font-weight: 500; }
.copy-btn:hover { background: rgba(255,255,255,0.07); color: var(--code-ink); }
.copy-btn.is-done { color: #8fd3c1; }
.code-body { padding: 14px 16px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; }
.code-body pre { margin: 0; white-space: pre; tab-size: 2; font: inherit; color: var(--code-ink); }
.tk-kw, .tk-flag { color: #7cc2da; }
.tk-str { color: #8fd3c1; }
.tk-num { color: #e0c489; }
.tk-cmt { color: #6c8090; }
.tk-key { color: #9fcadb; }
.tk-punct { color: #93a6b5; }

/* Params / errors / status / tables */
.params { display: flex; flex-direction: column; }
.param { display: grid; grid-template-columns: 190px minmax(0, 1fr); column-gap: 16px; row-gap: 8px; padding: 12px 0; border-top: 1px solid var(--rule-2); }
.param-key { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.param-name { font-size: 12.5px; font-weight: 600; color: var(--ink); word-break: break-all; background: none !important; border: 0 !important; padding: 0 !important; }
.param-meta { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--text-muted); }
.param-meta .sep { color: var(--rule); }
.req { color: var(--bad); font-weight: 600; }
.opt { color: var(--text-muted); }
.param-desc { color: var(--ink-2); }
.enum { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.enum code { font-size: 11.5px; color: var(--ink-2); }
.params-nested { grid-column: 1 / -1; padding-left: 14px; border-left: 2px solid var(--rule-2); }
.params-nested .param { grid-template-columns: 190px minmax(0, 1fr); padding: 8px 0; }
.errors { display: flex; flex-direction: column; }
.error-row { display: grid; grid-template-columns: 48px 250px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule-2); align-items: baseline; }
.error-status { font-size: 12px; font-weight: 600; color: var(--bad); background: none !important; border: 0 !important; padding: 0 !important; }
.error-code { font-size: 12px; word-break: break-all; background: none !important; border: 0 !important; padding: 0 !important; }
.error-desc { color: var(--ink-2); }
.status-table { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.status-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--rule-2); }
.status-row:first-child { border-top: 0; }
.status-meaning { color: var(--ink-2); }
.enum-value { font-size: 12px; border-radius: var(--radius-xs); padding: 2px 6px; background: var(--neutral-bg); color: var(--neutral); border: 0 !important; }
.tone-good { background: var(--good-bg) !important; color: var(--good) !important; }
.tone-warn { background: var(--warn-bg) !important; color: var(--warn) !important; }
.tone-bad { background: var(--bad-bg) !important; color: var(--bad) !important; }
.tone-info { background: var(--info-bg) !important; color: var(--info) !important; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); padding: 9px 14px; border-bottom: 1px solid var(--rule); background: var(--sunk); white-space: nowrap; }
.table td { padding: 9px 14px; border-top: 1px solid var(--rule-2); color: var(--ink-2); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table td:first-child { color: var(--ink); }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; }
.step-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; margin-top: 1px; }
.step-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.step-body h3 { padding-top: 2px; }

/* Cards, lists */
.cards { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 18px; color: var(--ink); }
.card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-2); text-decoration: none; }
.card b { font-size: 14.5px; font-weight: 600; }
.card-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.card-text { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.link-list { display: flex; flex-direction: column; }
.link-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--rule-2); padding: 10px 4px; font-size: 13.5px; color: var(--ink); }
.link-row:first-child { border-top: 0; }
.link-row:hover { color: var(--accent); text-decoration: none; }
.link-row > span:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.link-row code { font-size: 12.5px; background: none !important; border: 0 !important; padding: 0 !important; }
.link-label { font-weight: 500; }
.link-stack { display: flex; flex-direction: column; gap: 1px; }
.link-sub { font-size: 12.5px; color: var(--text-muted); }
.related h2 { font-size: 16px; padding-top: 6px; }

/* Endpoint sections (reference layout) */
.page-reference .page-grid { grid-template-columns: minmax(0, 1fr); max-width: 1260px; padding-right: 32px; }
.endpoint { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 32px; padding: 26px 0 34px; border-top: 1px solid var(--rule); }
.endpoint:first-of-type { border-top: 0; padding-top: 6px; }
.endpoint-prose { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.endpoint-prose > p { color: var(--ink-2); font-size: 14.5px; line-height: 1.6; max-width: 68ch; }
.endpoint-title { padding-top: 0 !important; font-size: 20px; }
.endpoint-line { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-s); box-shadow: var(--shadow-1); overflow-x: auto; }
.endpoint-path { font-size: 13px; color: var(--ink); background: none !important; border: 0 !important; padding: 0 !important; white-space: nowrap; }
.endpoint-code { position: sticky; top: 24px; align-self: start; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* TOC */
.toc { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.toc-title { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding-left: 10px; }
.toc-list { display: flex; flex-direction: column; border-left: 1px solid var(--rule); }
.toc-link { border-left: 2px solid transparent; margin-left: -1px; padding: 4px 10px; text-align: left; font-size: 12.5px; color: var(--text-muted); }
.toc-link:hover { color: var(--ink); }
.toc-link.is-active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.toc-box { margin-top: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.toc-box b { font-weight: 600; }
.toc-box span { color: var(--ink-2); line-height: 1.5; }

/* Page footer */
.page-foot { display: flex; flex-direction: column; gap: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.feedback { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); flex-wrap: wrap; }
.feedback b { font-size: 13.5px; font-weight: 600; }
.feedback-actions { display: flex; gap: 6px; }
.feedback-thanks { display: none; align-items: center; gap: 8px; color: var(--good); font-size: 13.5px; }
.feedback.is-done .feedback-ask, .feedback.is-done .feedback-actions { display: none; }
.feedback.is-done .feedback-thanks { display: inline-flex; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager a { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.pager a:hover { border-color: var(--accent-line); text-decoration: none; }
.pager a.next { text-align: right; align-items: flex-end; }
.pager small { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.pager b { font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

/* Home pages */
.home { padding: 44px 48px 72px; display: flex; flex-direction: column; gap: 32px; max-width: 1100px; }
.hero { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.hero p { font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.home-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
.home-cols h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; padding-bottom: 6px; }
.help-hero { align-items: center; text-align: center; max-width: none; }
.help-hero h1 { font-size: 30px; }
.help-search { display: flex; align-items: center; gap: 10px; width: min(560px, 100%); height: 44px; padding: 0 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-2); color: var(--text-muted); font-size: 14px; text-align: left; }
.help-search:hover { border-color: var(--accent-line); }
.help-search span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-box { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); align-self: start; }
.support-box .card-icon { margin: 0; }
.support-box b { font-size: 14.5px; font-weight: 600; }
.support-box span { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.card.card-row { flex-direction: row; align-items: flex-start; gap: 14px; }
.card.card-row .card-icon { margin: 0; flex: none; width: 36px; height: 36px; }
.card.card-row > span:last-child { display: flex; flex-direction: column; gap: 4px; }

/* Flow diagram */
.flow { display: flex; align-items: center; gap: 10px; padding: 16px; background: var(--sunk); border: 1px solid var(--rule-2); border-radius: var(--radius); overflow-x: auto; }
.flow-box { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); min-width: 128px; text-align: center; box-shadow: var(--shadow-1); flex: none; }
.flow-box .card-icon { width: 30px; height: 30px; margin: 0; }
.flow-box b { font-size: 12.5px; font-weight: 600; }
.flow-box span { font-size: 11.5px; color: var(--text-muted); line-height: 1.35; }
.flow-arrow { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 70px; }
.flow-arrow span { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.flow-arrow i { display: flex; align-items: center; width: 100%; color: var(--accent); }
.flow-arrow i::before { content: ""; flex: 1; height: 1px; background: var(--accent-line); }

/* Search palette */
.palette { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; background: var(--scrim); }
.palette-panel { width: min(600px, 100%); background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-3); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--rule-2); color: var(--text-muted); }
.palette-input input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 15px; padding: 14px 0; color: var(--ink); }
.palette-results { overflow-y: auto; padding: 6px; }
.palette-group { color: var(--text-muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 9px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; border-radius: var(--radius-s); padding: 8px 10px; text-align: left; font-size: 13px; color: var(--ink); }
.palette-item .pi-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.palette-item .pi-copy small { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item em { color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; font-style: normal; flex: none; }
.palette-item:hover, .palette-item.is-active { background: var(--accent-soft); }
.palette-item mark { background: none; color: var(--accent); font-weight: 600; }
.palette-empty { color: var(--text-muted); padding: 20px 10px; text-align: center; font-size: 13px; }
.palette-foot { display: flex; gap: 12px; padding: 8px 14px; background: var(--sunk); border-top: 1px solid var(--rule-2); color: var(--text-muted); font-size: 10.5px; }

/* Assistant */
.launcher { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 14px; background: var(--accent); color: var(--accent-ink); border-radius: 20px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-3); }
.launcher:hover { background: var(--accent-2); }
.assistant { position: fixed; right: 24px; bottom: 80px; z-index: 50; width: 400px; height: min(620px, calc(100vh - 110px)); display: flex; flex-direction: column; background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-3); overflow: hidden; animation: rise 160ms ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.assistant-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--rule-2); }
.assistant-head .card-icon { width: 28px; height: 28px; margin: 0; }
.assistant-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.assistant-title b { font-size: 13.5px; font-weight: 600; }
.assistant-title span { font-size: 11.5px; color: var(--text-muted); }
.assistant-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.assistant-intro { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; padding: 4px 2px 0; }
.suggest { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 9px 12px; font-size: 13px; color: var(--ink); }
.suggest:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.suggest svg { flex: none; color: var(--text-muted); }
.msg { max-width: 92%; font-size: 13.5px; line-height: 1.55; animation: rise 160ms ease-out; }
.msg-user { align-self: flex-end; background: var(--accent-soft); color: var(--ink); border-radius: 12px 12px 3px 12px; padding: 9px 12px; max-width: 82%; }
.msg-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--rule); color: var(--ink); border-radius: 12px 12px 12px 3px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.msg-text { white-space: pre-line; }
.msg-sources { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--rule-2); }
.msg-sources small { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.msg-sources div { display: flex; flex-wrap: wrap; gap: 6px; }
.source-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--rule); background: var(--sunk); color: var(--accent); border-radius: 20px; padding: 3px 9px; font-size: 12px; font-weight: 600; }
.source-chip:hover { border-color: var(--accent-line); text-decoration: none; }
.msg-rate { display: flex; align-items: center; gap: 4px; color: var(--text-muted); }
.msg-rate button { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; color: var(--text-muted); }
.msg-rate button:hover, .msg-rate button.is-on { background: var(--sunk); color: var(--accent); }
.msg-rate span { font-size: 11px; margin-right: 4px; }
.thinking { display: flex; gap: 4px; align-items: center; padding: 8px 2px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0.35; animation: pulse 1.1s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: 0.18s; } .thinking i:nth-child(3) { animation-delay: 0.36s; }
@keyframes pulse { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.assistant-foot { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--rule-2); background: var(--raised); }
.assistant-row { display: flex; gap: 8px; align-items: center; }
.assistant-input { flex: 1; min-width: 0; height: 34px; padding: 0 11px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-s); font-size: 13px; color: var(--ink); box-shadow: var(--shadow-1); }
.assistant-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.assistant-send { width: 34px; padding: 0; }
.assistant-note { font-size: 11px; color: var(--text-muted); padding-left: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .endpoint { grid-template-columns: minmax(0, 1fr); }
  .endpoint-code { position: static; }
}
@media (max-width: 1000px) {
  .page-grid { grid-template-columns: minmax(0, 1fr); padding: 24px 24px 64px; }
  .toc { display: none; }
  .topbar-link, .btn-dashboard { display: none; }
  .home { padding: 32px 24px 64px; }
  .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-cols { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 760px) {
  .menu-btn { display: grid; }
  .brand { width: auto; }
  .brand-path, .seg, .btn-key { display: none; }
  .search-trigger { max-width: none; }
  .search-trigger span { display: none; }
  .search-trigger { flex: none; width: 32px; padding: 0; justify-content: center; }
  .search-trigger kbd { display: none; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); z-index: 45; transform: translateX(-100%); transition: transform 180ms ease; box-shadow: var(--shadow-3); }
  .sidebar.is-open { transform: none; }
  .sidebar .seg-mobile { display: flex; margin: 8px 8px 4px; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .param, .params-nested .param, .status-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .error-row { grid-template-columns: 48px minmax(0, 1fr); }
  .error-desc { grid-column: 1 / -1; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 28px; }
  .assistant { right: 8px; left: 8px; width: auto; bottom: 72px; height: min(560px, calc(100vh - 96px)); }
  .launcher { right: 12px; bottom: 16px; }
  .page-head h1 { font-size: 24px; }
}
@media (min-width: 761px) { .seg-mobile { display: none; } }
