:root {
  color-scheme: light;
  --navy-900: #0c1730;
  --navy-800: #132449;
  --navy-700: #1e3b7f;
  --navy-600: #2a4c99;
  --navy-300: #8fa2ce;
  --navy-100: #e4e9f5;
  --gold: #ffcd00;
  --gold-deep: #c99a00;
  --gold-soft: #fff6d1;
  --paper: #f4f6fa;

  --bg: #ffffff;
  --bg-side: #f4f6fa;
  --bg-raise: #ffffff;
  --bg-sunk: #f4f6fa;
  --ink: #16213a;
  --ink-2: #4a5370;
  --ink-3: #6b738c;
  --rule: #e3e8f1;
  --rule-strong: #cdd5e4;
  --link: #1e3b7f;
  --link-hover: #2a4c99;
  --inline-bg: #e9edf6;
  --inline-ink: #132449;
  --get: #0b7a54;
  --get-bg: #e2f3ec;
  --post: #1e3b7f;
  --post-bg: #e4e9f5;
  --note-bg: #eef2fa;
  --note-rule: #2a4c99;
  --warn-bg: #fff6d1;
  --warn-rule: #c99a00;
  --danger-bg: #fbeceb;
  --danger-rule: #c1352b;
  --focus: #2a4c99;
  --mark: #fff0a6;

  --code-bg: #0c1730;
  --code-head: #101d3b;
  --code-rule: #1f3260;
  --code-ink: #dce4f5;
  --code-dim: #8fa2ce;
  --tk-key: #b8cbfa;
  --tk-str: #ffe08a;
  --tk-num: #86dcc2;
  --tk-kw: #8fb4ff;
  --tk-com: #7584ab;
  --tk-var: #ffb98a;
  --tk-fn: #ffffff;

  --sans: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --top-h: 60px;
  --side-w: 264px;
  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1428;
    --bg-side: #0c1730;
    --bg-raise: #101d3b;
    --bg-sunk: #0f1a35;
    --ink: #e6ebf5;
    --ink-2: #b6c0d8;
    --ink-3: #8f9bbb;
    --rule: #1d2d55;
    --rule-strong: #2a3d6c;
    --link: #a9bff5;
    --link-hover: #cad8fb;
    --inline-bg: #17264b;
    --inline-ink: #dce6fb;
    --get: #6fd6ae;
    --get-bg: rgba(111, 214, 174, 0.12);
    --post: #b4c6f6;
    --post-bg: rgba(143, 162, 206, 0.16);
    --note-bg: #111f40;
    --note-rule: #8fa2ce;
    --warn-bg: rgba(255, 205, 0, 0.08);
    --warn-rule: #ffcd00;
    --danger-bg: rgba(193, 53, 43, 0.14);
    --danger-rule: #ef7d73;
    --focus: #ffcd00;
    --mark: rgba(255, 205, 0, 0.28);
    --code-bg: #070f22;
    --code-head: #0b1530;
    --code-rule: #1a2a52;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1428;
  --bg-side: #0c1730;
  --bg-raise: #101d3b;
  --bg-sunk: #0f1a35;
  --ink: #e6ebf5;
  --ink-2: #b6c0d8;
  --ink-3: #8f9bbb;
  --rule: #1d2d55;
  --rule-strong: #2a3d6c;
  --link: #a9bff5;
  --link-hover: #cad8fb;
  --inline-bg: #17264b;
  --inline-ink: #dce6fb;
  --get: #6fd6ae;
  --get-bg: rgba(111, 214, 174, 0.12);
  --post: #b4c6f6;
  --post-bg: rgba(143, 162, 206, 0.16);
  --note-bg: #111f40;
  --note-rule: #8fa2ce;
  --warn-bg: rgba(255, 205, 0, 0.08);
  --warn-rule: #ffcd00;
  --danger-bg: rgba(193, 53, 43, 0.14);
  --danger-rule: #ef7d73;
  --focus: #ffcd00;
  --mark: rgba(255, 205, 0, 0.28);
  --code-bg: #070f22;
  --code-head: #0b1530;
  --code-rule: #1a2a52;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 20px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); }
::selection { background: var(--mark); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--gold); color: var(--navy-900); padding: 8px 14px; border-radius: 6px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 10px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-left));
  background: var(--navy-800);
  color: #fff;
  border-bottom: 1px solid #0c1730;
}
:root[data-theme="dark"] .topbar { background: var(--navy-900); border-bottom-color: var(--rule); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar { background: var(--navy-900); border-bottom-color: var(--rule); } }
.topbar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.4;
  background-image: repeating-linear-gradient(0deg, #1a3066 0 1px, transparent 1px 12px);
}
.topbar > * { position: relative; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: none; }
.brand:hover { color: #fff; }
.brand img { width: 30px; height: 30px; border-radius: 3px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-name span { font-weight: 400; color: var(--navy-300); }
.ver { font: 600 11.5px/1 var(--mono); color: var(--navy-900); background: var(--gold); padding: 4px 6px; border-radius: 4px; }
.top-spacer { flex: 1; }
.search { position: relative; width: min(420px, 38vw); }
.search input {
  width: 100%; height: 38px; padding: 0 44px 0 36px;
  border-radius: 8px; border: 1px solid #2c447e; background: #0f1d3d; color: #fff;
  font: 400 14.5px/1 var(--sans);
}
.search input::placeholder { color: var(--navy-300); }
.search input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.search svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--navy-300); pointer-events: none; }
.search kbd { position: absolute; right: 9px; top: 9px; font: 600 11.5px/1 var(--mono); color: var(--navy-300); border: 1px solid #2c447e; border-radius: 4px; padding: 4px 6px; }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; z-index: 60;
  max-height: 70vh; overflow-y: auto;
  background: var(--bg-raise); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 10px;
  box-shadow: 0 16px 40px -12px rgba(12, 23, 48, 0.45);
  padding: 6px; margin: 0; list-style: none;
}
.search-results[hidden] { display: none; }
.search-results li a { display: block; padding: 9px 10px; border-radius: 7px; text-decoration: none; color: var(--ink); }
.search-results li a .r-title { display: block; font-weight: 600; font-size: 14.5px; }
.search-results li a .r-page { display: block; font-size: 12.5px; color: var(--ink-3); }
.search-results li a .r-text { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.search-results li[aria-selected="true"] a, .search-results li a:hover { background: var(--note-bg); }
.search-results .r-empty { padding: 12px 10px; font-size: 14px; color: var(--ink-2); }
.search-results mark { background: var(--mark); color: inherit; border-radius: 2px; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: #fff; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.icon-btn svg { width: 19px; height: 19px; }
.app-link {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 8px;
  background: var(--gold); color: var(--navy-900); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.app-link:hover { background: #ffda3d; color: var(--navy-900); }
.menu-btn { display: none; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}

/* Layout */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.sidebar {
  position: sticky; top: var(--top-h); align-self: start;
  height: calc(100vh - var(--top-h)); overflow-y: auto;
  background: var(--bg-side); border-right: 1px solid var(--rule);
  padding: 22px 14px 40px 18px;
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-title { font-size: 13px; font-weight: 700; color: var(--ink); padding: 0 10px 6px; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px;
  color: var(--ink-2); text-decoration: none; font-size: 14.5px; line-height: 1.35;
}
.nav-list a:hover { color: var(--ink); background: var(--bg-raise); }
.nav-list a[aria-current="page"] { color: var(--ink); font-weight: 700; background: var(--bg-raise); box-shadow: inset 3px 0 0 var(--gold); }
.nav-sub { list-style: none; margin: 2px 0 6px 10px; padding: 0 0 0 10px; border-left: 1px solid var(--rule-strong); }
.nav-sub a { font-size: 13.5px; padding: 4px 10px; }
.nav-sub .m { font: 700 10.5px/1 var(--mono); padding: 3px 4px; border-radius: 3px; min-width: 34px; text-align: center; }
.side-foot { margin-top: 28px; padding: 14px 10px 0; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); }
.side-foot a { color: var(--ink-2); }

.main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 48px; padding: 40px 48px 96px; }
.main.no-toc { grid-template-columns: minmax(0, 1fr); }
.article { min-width: 0; max-width: var(--measure); }
.main.wide .article { max-width: none; }
.toc { position: sticky; top: calc(var(--top-h) + 32px); align-self: start; max-height: calc(100vh - var(--top-h) - 64px); overflow-y: auto; font-size: 13.5px; }
.toc-title { font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule-strong); }
.toc li a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-3); text-decoration: none; line-height: 1.35; }
.toc li.sub a { padding-left: 26px; font-size: 13px; }
.toc li a:hover { color: var(--ink); }
.toc li a.active { color: var(--ink); border-left-color: var(--gold); font-weight: 600; }

@media (max-width: 1240px) {
  .main { grid-template-columns: minmax(0, 1fr); padding: 36px 40px 88px; }
  .toc { display: none; }
}

/* Mobile */
.backdrop { display: none; }
@media (max-width: 920px) {
  :root { --top-h: 108px; }
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--top-h); padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
  .menu-btn { display: inline-grid; }
  .search { order: 5; width: 100%; }
  .search kbd { display: none; }
  .search input { padding-right: 12px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; height: 100%;
    width: min(320px, 86vw); padding-top: 20px;
    transform: translateX(-102%); visibility: hidden;
    box-shadow: 0 0 40px rgba(12, 23, 48, 0.35);
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(12, 23, 48, 0.5); }
  .main, .main.no-toc { padding: 28px 16px 72px; }
  .side-close { display: inline-grid !important; }
}
@media (max-width: 920px) and (prefers-reduced-motion: no-preference) {
  .sidebar { transition: transform 0.2s ease, visibility 0.2s; }
}
@media (max-width: 520px) {
  .topbar { column-gap: 8px; }
  .brand-name span { display: none; }
  .app-link { padding: 0 10px; font-size: 13px; }
  .top-actions { gap: 2px; }
}
.side-close { display: none; float: right; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--rule-strong); background: var(--bg-raise); color: var(--ink); cursor: pointer; }

/* Typography */
.article > :first-child { margin-top: 0; }
.crumb { font-size: 13.5px; color: var(--ink-3); margin: 0 0 10px; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: clamp(30px, 4vw, 40px); font-weight: 700; margin: 0 0 14px; }
h2 { font-size: 25px; font-weight: 700; margin: 56px 0 14px; padding-top: 22px; border-top: 1px solid var(--rule); }
h3 { font-size: 19px; font-weight: 700; margin: 34px 0 10px; }
h4 { font-size: 16px; font-weight: 700; margin: 24px 0 8px; }
h2 .anchor, h3 .anchor { margin-left: 8px; color: var(--ink-3); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
p { margin: 0 0 14px; }
.lead { font-size: 18.5px; line-height: 1.6; color: var(--ink-2); margin-bottom: 26px; max-width: 40em; }
ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin: 5px 0; }
li > ul, li > ol { margin-bottom: 4px; }
strong { font-weight: 700; color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; }
code, kbd, samp { font-family: var(--mono); }
:not(pre) > code {
  font-size: 0.86em; background: var(--inline-bg); color: var(--inline-ink);
  padding: 1.5px 5px; border-radius: 4px; overflow-wrap: anywhere;
}
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums lining-nums; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 12px 0 22px; border: 1px solid var(--rule); border-radius: 10px; background: var(--bg-raise); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.table-wrap table { min-width: 560px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
thead th { font-size: 13px; font-weight: 700; color: var(--ink-2); background: var(--bg-sunk); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.k, th.k { white-space: nowrap; }
td.k code { background: none; padding: 0; font-weight: 600; color: var(--ink); font-size: 13.5px; }
td .req { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--gold-soft); color: #5c4700; }
:root[data-theme="dark"] td .req { background: rgba(255, 205, 0, 0.14); color: #ffe48a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) td .req { background: rgba(255, 205, 0, 0.14); color: #ffe48a; } }
td .opt { font-size: 12.5px; color: var(--ink-3); }
td .cond { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--note-bg); color: var(--ink-2); }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.yes { color: var(--get); font-weight: 700; }
.no { color: var(--ink-3); }

/* Method badges */
.m { display: inline-block; font: 700 11.5px/1 var(--mono); padding: 4px 6px; border-radius: 4px; letter-spacing: 0.02em; vertical-align: 0.1em; }
.m-get { color: var(--get); background: var(--get-bg); }
.m-post { color: var(--post); background: var(--post-bg); }
.endpoint-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg-sunk); }
.endpoint-line code { background: none !important; padding: 0 !important; font-size: 14.5px !important; font-weight: 600; color: var(--ink) !important; }

/* Callouts */
.callout { margin: 18px 0 22px; padding: 14px 16px 14px 18px; border-radius: 8px; border-left: 3px solid var(--note-rule); background: var(--note-bg); font-size: 15px; }
.callout > :last-child { margin-bottom: 0; }
.callout .c-title { display: block; font-weight: 700; margin-bottom: 4px; color: var(--ink); }
.callout.warn { border-left-color: var(--warn-rule); background: var(--warn-bg); }
.callout.danger { border-left-color: var(--danger-rule); background: var(--danger-bg); }

/* Code blocks */
.code { margin: 14px 0 22px; border-radius: 10px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--code-rule); }
.code-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 6px 0 14px; background: var(--code-head); border-bottom: 1px solid var(--code-rule); }
.code-title { flex: 1; min-width: 0; font-size: 13px; color: var(--code-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 6px; border: 1px solid var(--code-rule); background: transparent; color: var(--code-ink);
  font: 600 12.5px/1 var(--sans); cursor: pointer;
}
.copy:hover { background: rgba(255, 255, 255, 0.07); }
.copy:focus-visible { outline-color: var(--gold); }
.copy.done { color: var(--navy-900); background: var(--gold); border-color: var(--gold); }
.code pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; color: var(--code-ink); font: 400 13.25px/1.62 var(--mono); tab-size: 2; }
.code pre code { font: inherit; background: none; color: inherit; padding: 0; }
.code.wrap pre { white-space: pre-wrap; word-break: break-all; }
.code pre:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.tk-key { color: var(--tk-key); }
.tk-str { color: var(--tk-str); }
.tk-num { color: var(--tk-num); }
.tk-kw { color: var(--tk-kw); }
.tk-com { color: var(--tk-com); font-style: italic; }
.tk-var { color: var(--tk-var); }
.tk-fn { color: var(--tk-fn); font-weight: 600; }
.tk-meth { color: var(--gold); font-weight: 700; }

/* Language tabs */
.tabs { margin: 14px 0 22px; border-radius: 10px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--code-rule); }
.tabs .code { margin: 0; border: 0; border-radius: 0; }
.tablist { display: flex; gap: 2px; padding: 6px 6px 0; background: var(--code-head); border-bottom: 1px solid var(--code-rule); overflow-x: auto; }
.tab {
  flex: none; height: 34px; padding: 0 14px; border: 0; border-radius: 7px 7px 0 0; background: transparent;
  color: var(--code-dim); font: 600 13.5px/1 var(--sans); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--gold); }
.tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.tabs .code-head { background: var(--code-bg); border-bottom-color: var(--code-rule); }

/* Steps */
ol.steps { list-style: none; padding: 0; margin: 20px 0 26px; counter-reset: step; }
ol.steps > li { position: relative; counter-increment: step; padding: 0 0 22px 48px; margin: 0; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -1px;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--navy-700); color: #fff; font-weight: 700; font-size: 14.5px;
}
ol.steps > li::after { content: ""; position: absolute; left: 14.5px; top: 36px; bottom: 6px; width: 1px; background: var(--rule-strong); }
ol.steps > li:last-child::after { display: none; }
ol.steps > li > h3 { margin: 0 0 6px; font-size: 18px; padding: 0; border: 0; }

/* Flow diagram */
.flow { margin: 20px 0 28px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--bg-raise); }
.flow-step { position: relative; padding: 18px 18px 18px; border-right: 1px solid var(--rule); }
.flow-step:last-child { border-right: 0; }
.flow-step .who { font-size: 12.5px; color: var(--ink-3); }
.flow-step .what { font-weight: 700; font-size: 16px; margin: 2px 0 8px; color: var(--ink); }
.flow-step p { font-size: 14px; color: var(--ink-2); margin: 0; }
.flow-step code { font-size: 12px !important; }
.flow-step:not(:last-child)::after {
  content: ""; position: absolute; right: -8px; top: 24px; z-index: 2;
  width: 14px; height: 14px; background: var(--bg-raise); border-top: 1px solid var(--rule); border-right: 1px solid var(--rule); transform: rotate(45deg);
}
.flow-step.hot { background: var(--navy-800); }
.flow-step.hot .who { color: var(--navy-300); }
.flow-step.hot .what { color: #fff; }
.flow-step.hot p { color: #d3dcf0; }
.flow-step.hot code { background: #1c3166 !important; color: #fff !important; }
.flow-step.hot::after { background: var(--navy-800); border-color: var(--navy-800); }
.flow-back { grid-column: 1 / -1; padding: 10px 18px; border-top: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-2); background: var(--bg-sunk); }
@media (max-width: 860px) {
  .flow { grid-template-columns: minmax(0, 1fr); }
  .flow-step { border-right: 0; border-bottom: 1px solid var(--rule); }
  .flow-step:not(:last-child)::after { right: auto; left: 24px; top: auto; bottom: -8px; transform: rotate(135deg); }
}

/* Canonical string anatomy */
.anatomy { margin: 16px 0 24px; border: 1px solid var(--code-rule); border-radius: 10px; overflow: hidden; background: var(--code-bg); color: var(--code-ink); }
.anatomy-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-bottom: 1px solid var(--code-rule); }
.anatomy-row:last-child { border-bottom: 0; }
.anatomy-row .lab { padding: 10px 14px; font-size: 13px; color: var(--code-dim); background: var(--code-head); border-right: 1px solid var(--code-rule); }
.anatomy-row .val { padding: 10px 14px; font: 400 13.25px/1.55 var(--mono); overflow-wrap: anywhere; }
.anatomy-row .val .nl { color: var(--tk-com); }
.anatomy-row.result .lab { color: var(--navy-900); background: var(--gold); font-weight: 700; border-right-color: var(--gold); }
.anatomy-row.result .val { color: #fff; font-weight: 600; }
@media (max-width: 560px) {
  .anatomy-row { grid-template-columns: minmax(0, 1fr); }
  .anatomy-row .lab { border-right: 0; border-bottom: 1px solid var(--code-rule); padding: 6px 12px; }
}

/* Key-value list */
dl.kv { margin: 12px 0 22px; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--bg-raise); }
dl.kv > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--rule); align-items: baseline; }
dl.kv > div:last-child { border-bottom: 0; }
dl.kv dt { font-size: 14px; font-weight: 700; color: var(--ink-2); }
dl.kv dd { margin: 0; font-size: 14.5px; min-width: 0; }
dl.kv dd code { overflow-wrap: anywhere; }
@media (max-width: 560px) { dl.kv > div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* Endpoint reference */
.ep { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; padding-top: 8px; }
.ep + .ep { margin-top: 24px; }
.ep-text > h2 { margin-top: 32px; }
.ep-code { position: sticky; top: calc(var(--top-h) + 20px); align-self: start; padding-top: 86px; }
.ep-code .tabs, .ep-code .code { margin-top: 0; }
.ep-code .code pre { max-height: 62vh; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 16px; padding: 0; list-style: none; font-size: 14px; color: var(--ink-2); }
.facts li { margin: 0; }
.facts b { color: var(--ink); font-weight: 700; }
.ref-index { list-style: none; padding: 0; margin: 12px 0 24px; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--bg-raise); }
.ref-index li { margin: 0; border-bottom: 1px solid var(--rule); }
.ref-index li:last-child { border-bottom: 0; }
.ref-index a { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; text-decoration: none; color: var(--ink); }
.ref-index a:hover { background: var(--bg-sunk); }
.ref-index .p { font: 600 13.5px/1.4 var(--mono); overflow-wrap: anywhere; }
.ref-index .d { font-size: 13.5px; color: var(--ink-3); text-align: right; }
@media (max-width: 1180px) {
  .ep { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ep-code { position: static; padding-top: 0; }
  .ep-code .code pre { max-height: none; }
}
@media (max-width: 640px) { .ref-index .d { display: none; } .ref-index a { grid-template-columns: 54px minmax(0, 1fr); } }

.status-list { list-style: none; padding: 0; margin: 8px 0 18px; }
.status-list li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule); margin: 0; font-size: 14.5px; }
.status-list li:last-child { border-bottom: 0; }
.status-list .s { font: 700 13px/1.6 var(--mono); }
.s-2 { color: var(--get); }
.s-4 { color: var(--warn-rule); }
.s-5 { color: var(--danger-rule); }

/* Lifecycle */
.life { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px 16px; align-items: center; margin: 18px 0 24px; padding: 18px; border: 1px solid var(--rule); border-radius: 12px; background: var(--bg-raise); }
.life .st { font: 600 13.5px/1 var(--mono); padding: 8px 10px; border-radius: 7px; border: 1px solid var(--rule-strong); background: var(--bg-sunk); color: var(--ink); white-space: nowrap; }
.life .st.start { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.life .st.reserved { border-style: dashed; color: var(--ink-3); background: transparent; }
.life .arr { color: var(--ink-3); font-size: 14px; }
.life .col { display: flex; flex-direction: column; gap: 8px; }
.life .row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
@media (max-width: 640px) { .life { grid-template-columns: minmax(0, 1fr); } .life .arr { transform: rotate(90deg); justify-self: start; margin-left: 30px; } }

/* Next links */
.next { list-style: none; padding: 0; margin: 14px 0 0; border-top: 1px solid var(--rule); }
.next li { margin: 0; border-bottom: 1px solid var(--rule); }
.next a { display: grid; grid-template-columns: minmax(0, 14em) minmax(0, 1fr); gap: 16px; padding: 14px 4px; text-decoration: none; color: var(--ink); }
.next a b { color: var(--link); }
.next a span { color: var(--ink-2); font-size: 15px; }
.next a:hover b { text-decoration: underline; }
@media (max-width: 640px) { .next a { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 15px; }
.pager a { text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.pager a span { font-size: 12.5px; color: var(--ink-3); }
.pager a.nx { text-align: right; margin-left: auto; }

.changelog-entry { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 20px; padding: 18px 0; border-top: 1px solid var(--rule); }
.changelog-entry time { font: 600 14px/1.6 var(--mono); color: var(--ink); }
@media (max-width: 560px) { .changelog-entry { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

.site-foot { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-3); }

@media print {
  .topbar, .sidebar, .toc, .copy, .pager { display: none !important; }
  .shell, .main { display: block; padding: 0; }
  .code pre { white-space: pre-wrap; }
}
.ep-text .table-wrap table { min-width: 0; }
.ep-text td.k code { overflow-wrap: normal; }
