/* FeedB2B Docs theme — matches the previous GitBook site (muted theme, filled sidebar). */

/* ---------- Fonts (self-hosted, OFL) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/inter-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/inter-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/inter-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/inter-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/inter-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/inter-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

/* ---------- Theme tokens (RGB triplets) ---------- */
:root {
  color-scheme: light;
  --bg: 250 250 250;
  --panel: 255 255 255;
  --soft: 247 247 247;
  --text: 29 29 29;
  --muted: 109 110 110;
  --subtle: 120 120 120;
  --border: 229 230 230;
  --border-strong: 216 217 217;
  --primary: 125 135 135;
  --active-bg: 246 248 248;
  --toc-active-bg: 241 243 243;
  --hover-bg: 241 243 243;
  --icon-alpha: .4;
  --row-hover: 242 242 242;
  --tk-orange: 187 92 0; --tk-green: 0 152 23; --tk-red: 228 0 33; --tk-fn: 113 124 124; --tk-punct: 109 110 110;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 12px rgb(0 0 0 / .05);
  --shadow-lg: 0 8px 30px rgb(0 0 0 / .12), 0 1px 3px rgb(0 0 0 / .06);
  --font: Inter, "Inter Fallback", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: 34 34 34; --panel: 29 29 29; --soft: 44 44 44; --text: 255 255 255; --muted: 192 192 192; --subtle: 150 150 150;
    --border: 57 57 57; --border-strong: 67 68 68; --primary: 243 255 255; --active-bg: 43 44 44; --toc-active-bg: 47 48 48; --hover-bg: 43 44 44;
    --row-hover: 44 44 44; --tk-orange: 224 184 145; --tk-green: 155 208 161; --tk-red: 248 168 161; --tk-fn: 189 193 193; --tk-punct: 255 255 255;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 12px rgb(0 0 0 / .25); --shadow-lg: 0 8px 30px rgb(0 0 0 / .5), 0 1px 3px rgb(0 0 0 / .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: 34 34 34; --panel: 29 29 29; --soft: 44 44 44; --text: 255 255 255; --muted: 192 192 192; --subtle: 150 150 150;
  --border: 57 57 57; --border-strong: 67 68 68; --primary: 243 255 255; --active-bg: 43 44 44; --toc-active-bg: 47 48 48; --hover-bg: 43 44 44;
    --row-hover: 44 44 44; --tk-orange: 224 184 145; --tk-green: 155 208 161; --tk-red: 248 168 161; --tk-fn: 189 193 193; --tk-punct: 255 255 255;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 12px rgb(0 0 0 / .25); --shadow-lg: 0 8px 30px rgb(0 0 0 / .5), 0 1px 3px rgb(0 0 0 / .3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 24px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: rgb(var(--bg)); color: rgb(var(--text));
  font: 400 16px/26px var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 8px 12px; background: rgb(var(--panel)); border-radius: 8px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid rgb(var(--primary) / .6); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: rgb(var(--bg) / .88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgb(var(--border));
}
.header-inner { max-width: 1536px; height: 100%; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.site-header .brand { width: 336px; flex-shrink: 0; }
.brand-logo { width: 32px; height: 32px; display: block; }
.brand-title { font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: rgb(var(--text)); }
.icon-btn:hover { background: rgb(var(--hover-bg)); }
.icon-btn .icon { width: 20px; height: 20px; }
.menu-toggle, .search-mobile { display: none; }

/* ---------- Search ---------- */
.search { position: relative; width: 512px; max-width: 100%; }
.search-trigger, .search-field {
  width: 100%; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px;
  background: rgb(var(--panel)); border: 1px solid rgb(var(--border-strong)); border-radius: 12px;
  font-size: 14px; line-height: 21px; color: rgb(var(--muted)); text-align: left;
  box-shadow: 0 1px 2px rgb(0 0 0 / .03);
  transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: rgb(var(--muted) / .5); }
.search-icon { width: 18px; height: 18px; color: rgb(var(--text) / .7); }
.search-placeholder { flex: 1; }
.search-kbd { display: inline-flex; gap: 2px; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px;
  font: 400 12px/16px var(--mono); color: rgb(var(--muted)); background: rgb(var(--panel));
  border: 1px solid rgb(var(--border)); border-radius: 6px;
}
.search-panel { position: absolute; inset: 0 0 auto 0; z-index: 45; }
.search-field { border-color: rgb(var(--muted) / .55); box-shadow: 0 0 0 3px rgb(var(--border) / .8); color: rgb(var(--text)); }
.search-clear { display: inline-flex; color: rgb(var(--muted)); }
.search-clear .icon { width: 18px; height: 18px; }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: rgb(var(--text)); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-count { font-size: 14px; color: rgb(var(--muted)); white-space: nowrap; padding-right: 8px; }
.search-dropdown {
  margin-top: 8px; background: rgb(var(--panel)); border: 1px solid rgb(var(--border)); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.search-results { list-style: none; margin: 0; padding: 12px; max-height: min(470px, calc(100vh - 160px)); overflow-y: auto; }
.search-result a { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 8px; text-decoration: none; }
.search-result .result-icon { width: 16px; height: 16px; color: rgb(var(--text) / .55); flex-shrink: 0; }
.search-result .result-body { flex: 1; min-width: 0; }
.search-result .result-group { display: block; font-size: 12px; line-height: 16px; color: rgb(var(--muted)); }
.search-result .result-title { display: block; font-size: 16px; line-height: 22px; font-weight: 600; color: rgb(var(--text)); }
.search-result .result-snippet { display: block; font-size: 14px; line-height: 20px; color: rgb(var(--text) / .8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result mark { background: rgb(var(--soft)); color: inherit; border-radius: 2px; box-shadow: 0 0 0 1px rgb(var(--border)); }
.search-result .result-go { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: rgb(var(--muted)); flex-shrink: 0; }
.search-result .result-go .icon-enter { display: none; }
.search-result.is-selected a { background: rgb(var(--soft)); }
.search-result.is-selected .result-go { background: rgb(var(--panel)); border: 1px solid rgb(var(--border)); color: rgb(var(--text)); }
.search-result.is-selected .result-go .icon-enter { display: inline-block; }
.search-result.is-selected .result-go .icon-chev { display: none; }
.search-empty { padding: 24px 12px; text-align: center; font-size: 14px; color: rgb(var(--muted)); }
.search-footer { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 10px 14px; border-top: 1px solid rgb(var(--border)); background: rgb(var(--soft) / .6); font-size: 14px; color: rgb(var(--muted)); }
.search-footer .key { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 3px; border: 1px solid rgb(var(--border)); border-radius: 6px; background: rgb(var(--panel)); }
.search-footer .key .icon { width: 12px; height: 12px; }
.search-footer .key-text { font: 400 11px/16px var(--mono); margin-left: 8px; }

/* ---------- Layout ---------- */
.site { max-width: 1536px; margin: 0 auto; padding: 0 32px; display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: var(--header-h); width: 288px; flex-shrink: 0; height: calc(100vh - var(--header-h));
  padding: 24px 24px 16px 0; margin-right: 48px;
}
.layout-wide .sidebar { padding-right: 0; margin-right: 0; }
.sidebar-panel {
  margin-left: -20px; height: 100%; background: rgb(var(--panel)); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer-head { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 18px 16px 8px; scrollbar-width: thin; scrollbar-color: rgb(var(--border-strong)) transparent; }
.nav-link > span { max-width: 175px; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-group-title {
  padding: 10px 12px 6px; font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
  color: rgb(var(--text));
}
.nav-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 12px; border-radius: 6px;
  font-size: 14px; line-height: 20px; color: rgb(var(--text) / .75); text-decoration: none;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: rgb(var(--hover-bg)); color: rgb(var(--text)); }
.nav-icon { width: 16px; height: 16px; color: rgb(var(--text) / var(--icon-alpha)); stroke-width: 1.8; }
.nav-link.is-active { background: rgb(var(--active-bg)); color: rgb(var(--primary)); font-weight: 600; }
.nav-link.is-active .nav-icon { color: rgb(var(--primary)); }

.main { flex: 1; min-width: 0; }
.main-inner { display: flex; align-items: flex-start; }
/* the page fills the viewport so the pager sits at the bottom on short pages (as on GitBook) */
.page { flex: 1; min-width: 0; max-width: 768px; padding: 32px 0 32px; display: flex; flex-direction: column; min-height: calc(100vh - var(--header-h)); }
.layout-wide .page { min-height: 0; }
.layout-wide .main-inner { padding-left: 48px; }
.layout-wide .page { max-width: 1040px; }

/* Cover (wide layout, home) */
.cover { margin: 0 -32px 0 0; height: 270px; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; display: block; }

/* ---------- Page header ---------- */
.page-header { position: relative; margin-bottom: 24px; }
.layout-wide .page-header { padding-right: 240px; }
.breadcrumb { font-size: 12px; line-height: 16px; color: rgb(var(--primary)); margin-bottom: 12px; }
.page-title-row { display: flex; align-items: center; gap: 18px; }
.page-icon { width: 36px; height: 36px; color: rgb(var(--text) / .55); stroke-width: 1.75; }
.page-title { margin: 0; font-size: 36px; line-height: 45px; font-weight: 700; letter-spacing: -.025em; }
.page-description { margin: 12px 0 0; font-size: 18px; line-height: 28px; color: rgb(var(--muted)); }

.page-actions { position: absolute; top: -8px; right: 0; display: flex; align-items: center; gap: 8px; }
.layout-wide .page-actions { top: 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 4px 8px;
  background: rgb(var(--panel)); border: 1px solid rgb(var(--border-strong)); border-radius: 8px;
  font-size: 14px; line-height: 17.5px; color: rgb(var(--muted)); white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: rgb(var(--hover-bg)); color: rgb(var(--text)); }
.btn .icon { width: 14px; height: 14px; }
.split-button { position: relative; display: inline-flex; }
.btn-split-main { border-radius: 8px 0 0 8px; padding-left: 10px; }
.btn-split-toggle { border-radius: 0 8px 8px 0; margin-left: -1px; padding: 4px 6px; }
.btn-split-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
/* copy buttons swap their copy icon for a check mark for a moment after copying */
.icon-done { display: none !important; }
.is-copied .icon-done { display: inline-block !important; }
.is-copied > .icon:first-child:not(.icon-done) { display: none; }
.btn-toc { display: none; }
.layout-wide .btn-toc { display: inline-flex; }

.menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 276px; padding: 6px;
  background: rgb(var(--panel)); border: 1px solid rgb(var(--border)); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.menu-item { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 8px 10px; border-radius: 8px; text-decoration: none; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: rgb(var(--hover-bg)); outline: 0; }
.menu-item-icon { width: 16px; height: 16px; margin-top: 2px; color: rgb(var(--text) / .7); }
.menu-item-text { display: flex; flex-direction: column; }
.menu-item-label { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; line-height: 20px; font-weight: 500; color: rgb(var(--text)); }
.menu-item-sub { font-size: 12px; line-height: 16px; color: rgb(var(--muted)); }
.icon-ext { width: 12px; height: 12px; color: rgb(var(--muted)); }
.menu-sep { height: 1px; margin: 6px 4px; background: rgb(var(--border)); }
.toc-menu { min-width: 260px; max-height: 60vh; overflow-y: auto; padding: 8px; }

/* ---------- Prose ---------- */
.prose { overflow-wrap: break-word; }
/* Block rhythm: every top-level block is 20px below the previous one (GitBook uses a 20px flex gap). */
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 20px; }
.layout-wide .prose > :is(p, ul, ol, blockquote, h2, h3, h4, h5, h6, .code-block) { max-width: 768px; }
.prose li > p, .prose td > p { margin: 0; }
.prose strong { font-weight: 600; }
.prose a:not(.card):not(.heading-anchor) {
  color: rgb(var(--text)); text-decoration: underline; text-decoration-color: rgb(var(--muted) / .5);
  text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color .15s;
}
.prose a:not(.card):not(.heading-anchor):hover { text-decoration-color: rgb(var(--text)); }

.heading { position: relative; }
/* Headings: 20px gap like every block, plus top padding for breathing room (measured from GitBook). */
.prose > h2 { padding-top: 30px; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -.0125em; }
.prose > h3 { padding-top: 18px; font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.0125em; }
.prose > h4 { padding-top: 12px; font-size: 20px; line-height: 28px; font-weight: 600; }
.prose > :is(h5, h6) { padding-top: 8px; font-size: 16px; line-height: 24px; font-weight: 600; }
.heading-anchor {
  position: absolute; left: -28px; bottom: 6px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  color: rgb(var(--muted)); opacity: 0; border-radius: 6px; transition: opacity .15s;
}
.heading-anchor .icon { width: 14px; height: 14px; }
.heading:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { background: rgb(var(--hover-bg)); color: rgb(var(--text)); }

.prose ul, .prose ol { padding-left: 28px; }
.prose li + li { margin-top: 6px; }
.prose li > ul, .prose li > ol { margin-top: 6px; }
.prose ul li::marker { color: rgb(var(--text) / .6); }
.prose ol li::marker { color: rgb(var(--muted)); }
.prose blockquote { margin-left: 0; padding: 0 0 0 16px; border-left: 2px solid rgb(var(--border-strong)); color: rgb(var(--muted)); }
.prose hr { border: 0; border-top: 1px solid rgb(var(--border)); margin-top: 24px; margin-bottom: 4px; }
.prose img { border-radius: 8px; display: block; }
.prose figure { margin: 0; }
.prose figure img { margin: 0 auto; }
.prose div[align="left"] figure img { margin: 0; }
.prose figcaption { margin-top: 8px; font-size: 14px; color: rgb(var(--muted)); text-align: center; }

.inline-code {
  font: 400 14px/20px var(--mono); background: rgb(var(--soft)); color: rgb(var(--text));
  border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; box-shadow: inset 0 0 0 1px rgb(var(--border-strong));
}
th .inline-code, td .inline-code { font-size: 12.25px; }

/* Code blocks */
.code-block { position: relative; background: rgb(var(--panel)); border: 1px solid rgb(var(--border)); border-radius: 12px; overflow: hidden; }
.code-block pre { margin: 0; padding: 10px 0; overflow-x: auto; font: 400 14px/20px var(--mono); tab-size: 2; scrollbar-width: thin; }
.code-block code { font: inherit; display: block; min-width: fit-content; }
.code-block .line { display: block; min-height: 20px; padding: 0 16px; }
.code-block .line:hover { background: rgb(var(--row-hover)); }
/* syntax colors (GitBook palette) */
.tk-key, .tk-num, .tk-var { color: rgb(var(--tk-orange)); }
.tk-str { color: rgb(var(--tk-green)); }
.tk-kw { color: rgb(var(--tk-red)); }
.tk-fn { color: rgb(var(--tk-fn)); }
.tk-punct { color: rgb(var(--tk-punct)); }
.tk-comment { color: rgb(var(--subtle)); }
.code-copy {
  position: absolute; top: 8px; right: 8px; z-index: 1; height: 28px; padding: 4px 8px; display: inline-flex; align-items: center;
  border-radius: 8px; border: 1px solid rgb(var(--border-strong)); background: rgb(var(--soft)); color: rgb(var(--muted));
  font: 400 14px/17.5px var(--font); opacity: 0; transition: opacity .15s;
}
.code-block:hover .code-copy, .code-copy:focus-visible, .code-copy.is-copied { opacity: 1; }
.code-copy:hover { color: rgb(var(--text)); background: rgb(var(--hover-bg)); }

/* Tables — rounded header strip, column dividers, row separators */
.table-search {
  display: flex; align-items: center; gap: 8px; height: 35px; padding: 6px 10px; margin-bottom: 12px;
  background: rgb(var(--panel)); border: 1px solid rgb(var(--border-strong)); border-radius: 12px; cursor: text;
}
.table-search:focus-within { border-color: rgb(var(--muted) / .6); }
.table-search .icon { width: 16px; height: 16px; color: rgb(var(--muted)); }
.table-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 14px/20px var(--font); color: rgb(var(--text)); }
.table-search input::placeholder { color: rgb(var(--muted) / .72); }
.table-search input::-webkit-search-cancel-button { cursor: pointer; }
.prose tbody tr:hover td { background: rgb(var(--row-hover)); }
.prose tbody tr.table-empty td { text-align: center; color: rgb(var(--muted)); }
.table-wrap { overflow-x: auto; scrollbar-width: thin; }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 14px; line-height: 20px; }
.prose thead th {
  padding: 8px 12px; text-align: left; font-weight: 500; vertical-align: middle;
  background: rgb(var(--soft)); border-top: 1px solid rgb(var(--border)); border-bottom: 1px solid rgb(var(--border));
}
.prose thead th:first-child { border-left: 1px solid rgb(var(--border)); border-radius: 8px 0 0 8px; }
.prose thead th:last-child { border-right: 1px solid rgb(var(--border)); border-radius: 0 8px 8px 0; }
.prose tbody td { padding: 8px 12px; vertical-align: middle; line-height: 21px; border-bottom: 1px solid rgb(var(--border)); overflow-wrap: anywhere; }
.prose tbody td + td { border-left: 1px solid rgb(var(--border)); }
.prose tbody tr:first-child td { padding-top: 12px; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td p { margin: 0; }
.prose td p + p { margin-top: 8px; }

/* Cards */
.prose .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.prose .card {
  display: block; padding: 16px 15px 18px; background: rgb(var(--panel)); border-radius: 6px; text-decoration: none; color: rgb(var(--text));
  box-shadow: 0 0 0 1px rgb(var(--border) / .7), var(--shadow); transition: box-shadow .15s;
}
.prose a.card:hover { box-shadow: 0 0 0 1px rgb(var(--border-strong)), var(--shadow-lg); }
.prose .card h4 { margin: 0 0 12px; padding: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.prose .card p { margin: 0; font-size: 14px; line-height: 21px; }

/* ---------- Page footer ---------- */
.page-footer { margin-top: auto; padding-top: 24px; }
.prose { flex: 0 0 auto; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager-single .pager-next { grid-column: 1 / -1; }
.pager-single .pager-prev { grid-column: 1 / 2; }
.pager-card {
  display: flex; align-items: center; gap: 12px; padding: 16px; min-height: 72px; text-decoration: none;
  border: 1px solid rgb(var(--border)); border-radius: 12px; color: rgb(var(--muted)); transition: border-color .15s, background-color .15s;
}
.pager-card:hover { border-color: rgb(var(--border-strong)); background: rgb(var(--panel) / .6); }
.pager-next { justify-content: flex-end; text-align: right; }
.pager-text { display: flex; flex-direction: column; }
.pager-label { font-size: 12px; line-height: 16px; color: rgb(var(--muted)); }
.pager-title { font-size: 16px; line-height: 24px; color: rgb(var(--text)); }
.pager-chevron { width: 14px; height: 14px; color: rgb(var(--muted)); }
.last-updated { margin-top: 24px; font-size: 14px; line-height: 20px; color: rgb(var(--muted)); }

/* ---------- Table of contents (right) ---------- */
.toc {
  position: sticky; top: var(--header-h); width: 224px; flex-shrink: 0; margin-left: 48px;
  height: calc(100vh - var(--header-h)); padding: 32px 0 16px; display: flex; flex-direction: column;
}
.toc-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toc-title { display: flex; align-items: center; gap: 4px; padding: 0 12px; margin-bottom: 12px; font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; color: rgb(var(--muted)); }
.toc-title .icon { width: 12px; height: 12px; }
.toc-nav { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item a {
  display: block; padding: 4px 12px; border-radius: 6px; font-size: 14px; line-height: 20px; color: rgb(var(--muted));
  text-decoration: none; transition: background-color .15s, color .15s;
}
.toc-item a:hover { color: rgb(var(--text)); }
.toc-item.depth-1 + .toc-item.depth-1, .toc-item.depth-2 + .toc-item.depth-1 { margin-top: 10px; }
.toc-item.depth-2 a { padding-left: 24px; }
.toc-item a.is-active { background: rgb(var(--toc-active-bg)); color: rgb(var(--primary)); }
.toc-bottom { padding-top: 16px; border-top: 1px solid rgb(var(--border)); display: flex; justify-content: flex-end; }

.theme-switch { display: inline-flex; gap: 8px; }
.theme-switch button { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: rgb(var(--muted)); }
.theme-switch button:hover { color: rgb(var(--text)); }
.theme-switch button[aria-checked="true"] { background: rgb(var(--soft)); color: rgb(var(--text)); }
.theme-switch .icon { width: 16px; height: 16px; }
.site-footer { display: none; justify-content: flex-end; padding: 16px 0 24px; border-top: 1px solid rgb(var(--border)); }
.layout-wide .site-footer, .no-toc .site-footer { display: flex; }

/* ---------- Drawer (mobile navigation) ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 49; background: rgb(var(--bg) / .4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  .toc { display: none; }
  .btn-toc { display: inline-flex; }
  .site-footer { display: flex; }
}
@media (max-width: 1023px) {
  :root { --header-h: 64px; }
  .header-inner { padding: 0 16px; gap: 12px; }
  .menu-toggle, .search-mobile { display: inline-flex; }
  .site-header .brand { width: auto; flex: 1; }
  .search { position: static; width: auto; }
  .search > .search-trigger { display: none; }
  .search-mobile { border: 1px solid rgb(var(--border)); }
  .search-panel { position: fixed; inset: 12px 12px auto 12px; }
  .site { padding: 0 16px; display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: min(312px, calc(100vw - 64px)); height: 100vh;
    padding: 12px 0 12px 12px; margin: 0; transform: translateX(-110%); transition: transform .2s ease;
  }
  .sidebar-panel { margin-left: 0; border: 1px solid rgb(var(--border)); box-shadow: var(--shadow-lg); }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 0 20px; }
  .drawer-head .icon-btn { position: fixed; top: 12px; right: 12px; left: auto; background: rgb(var(--panel)); border: 1px solid rgb(var(--border)); }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open { overflow: hidden; }
  .cover { margin: 0 -16px; height: 120px; }
  .page { padding-top: 24px; }
  .layout-wide .page-header { padding-right: 0; }
  .layout-wide .page-actions { position: static; margin-top: 16px; }
  .btn-toc .btn-label { display: none; }
  .btn-toc { padding: 4px 6px; }
  .page-title { font-size: 32px; line-height: 40px; }
  .page-icon { width: 32px; height: 32px; }
  .heading-anchor { display: none; }
}
@media (max-width: 640px) {
  .prose .cards { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager-single .pager-prev { grid-column: auto; }
  .layout-wide .menu { left: 0; right: auto; }
}

/* ---------- Print / Export as PDF ---------- */
@media print {
  .site-header, .sidebar, .toc, .page-actions, .pager, .site-footer, .heading-anchor, .code-copy, .cover, .drawer-backdrop { display: none !important; }
  body { background: #fff; color: #000; }
  .site, .main-inner { display: block; padding: 0; }
  .page { max-width: none; padding: 0; }
  .code-block, .prose table { break-inside: avoid; }
}
