/* Shared styles for the team docs site and the admin dashboard: design
   tokens (light and dark), base type, and the components both use (buttons,
   badges, code, tables, callouts, cards). The dashboard adds admin.css.

   Themes: light by default, dark when the system asks for it, unless the
   viewer picked one (`<html data-theme="light|dark">`, set before first paint
   by /assets/theme.js from web/theme-init.ts). */

:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --radius: 0.6rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-foreground: #ffffff;
  --primary-soft: #eef2ff;
  --primary-soft-foreground: #4338ca;
  --secondary: #f4f4f5;
  --secondary-hover: #e9e9ec;
  --secondary-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #65656e;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --destructive: #dc2626;
  --destructive-hover: #b91c1c;
  --destructive-foreground: #ffffff;
  --border: #e4e4e7;
  /* Form-control borders: at least 3:1 against the background, card and popover. */
  --input: #8b8b94;
  /* Button borders (the label already identifies a button). */
  --control-border: #d4d4d8;
  --ring: #6366f1;
  --sidebar: #fafafa;
  --code-bg: #f4f4f5;
  --overlay: rgb(9 9 11 / 50%);

  --success: #15803d;
  --success-soft: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 5%);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 8%), 0 1px 2px -1px rgb(0 0 0 / 8%);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 8%), 0 2px 4px -2px rgb(0 0 0 / 6%);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 8%);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 12%), 0 8px 10px -6px rgb(0 0 0 / 8%);

  /* Older names, still used by a few rules. */
  --bg: var(--background);
  --bg-soft: var(--muted);
  --text: var(--foreground);
  --accent-text: var(--primary);
  --ok: var(--success);
  --warn: var(--warning);
  --bad: var(--danger);

  color-scheme: light;
}

/* Dark: the system asks for it and the viewer didn't pick light, or they picked dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #0f0f12;
    --card-foreground: #fafafa;
    --popover: #131316;
    --popover-foreground: #fafafa;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-foreground: #0b0a1f;
    --primary-soft: rgb(129 140 248 / 14%);
    --primary-soft-foreground: #c7d2fe;
    --secondary: #27272a;
    --secondary-hover: #323237;
    --secondary-foreground: #fafafa;
    --muted: #1c1c20;
    --muted-foreground: #a1a1aa;
    --accent: #27272a;
    --accent-foreground: #fafafa;
    --destructive: #dc2626;
    --destructive-hover: #b91c1c;
    --destructive-foreground: #ffffff;
    --border: #27272a;
    --input: #66666f;
    --control-border: #3f3f46;
    --ring: #818cf8;
    --sidebar: #0c0c0e;
    --code-bg: #18181b;
    --overlay: rgb(0 0 0 / 65%);
    --success: #4ade80;
    --success-soft: rgb(34 197 94 / 12%);
    --success-border: rgb(34 197 94 / 30%);
    --warning: #fbbf24;
    --warning-soft: rgb(245 158 11 / 12%);
    --warning-border: rgb(245 158 11 / 30%);
    --danger: #f87171;
    --danger-soft: rgb(239 68 68 / 12%);
    --danger-border: rgb(239 68 68 / 32%);
    --info: #60a5fa;
    --info-soft: rgb(59 130 246 / 12%);
    --info-border: rgb(59 130 246 / 30%);
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 40%);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 45%), 0 1px 2px -1px rgb(0 0 0 / 40%);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 45%), 0 2px 4px -2px rgb(0 0 0 / 40%);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 50%), 0 4px 6px -4px rgb(0 0 0 / 40%);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 55%), 0 8px 10px -6px rgb(0 0 0 / 45%);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --background: #09090b;
  --foreground: #fafafa;
  --card: #0f0f12;
  --card-foreground: #fafafa;
  --popover: #131316;
  --popover-foreground: #fafafa;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-foreground: #0b0a1f;
  --primary-soft: rgb(129 140 248 / 14%);
  --primary-soft-foreground: #c7d2fe;
  --secondary: #27272a;
  --secondary-hover: #323237;
  --secondary-foreground: #fafafa;
  --muted: #1c1c20;
  --muted-foreground: #a1a1aa;
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --destructive: #dc2626;
  --destructive-hover: #b91c1c;
  --destructive-foreground: #ffffff;
  --border: #27272a;
  --input: #66666f;
  --control-border: #3f3f46;
  --ring: #818cf8;
  --sidebar: #0c0c0e;
  --code-bg: #18181b;
  --overlay: rgb(0 0 0 / 65%);
  --success: #4ade80;
  --success-soft: rgb(34 197 94 / 12%);
  --success-border: rgb(34 197 94 / 30%);
  --warning: #fbbf24;
  --warning-soft: rgb(245 158 11 / 12%);
  --warning-border: rgb(245 158 11 / 30%);
  --danger: #f87171;
  --danger-soft: rgb(239 68 68 / 12%);
  --danger-border: rgb(239 68 68 / 32%);
  --info: #60a5fa;
  --info-soft: rgb(59 130 246 / 12%);
  --info-border: rgb(59 130 246 / 30%);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 40%);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 45%), 0 1px 2px -1px rgb(0 0 0 / 40%);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 45%), 0 2px 4px -2px rgb(0 0 0 / 40%);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 50%), 0 4px 6px -4px rgb(0 0 0 / 40%);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 55%), 0 8px 10px -6px rgb(0 0 0 / 45%);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; color: var(--foreground); }

a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
/* Links inside running text are underlined, so they don't rest on colour alone. */
.hint a, .callout a, .card-description a, .page-description a, .empty-description a, .toast a, .confirm-text a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
}
.hint a:hover, .callout a:hover, .card-description a:hover, .page-description a:hover, .empty-description a:hover, .toast a:hover, .confirm-text a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }

img, svg { vertical-align: middle; }

hr, .separator { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.separator-vertical { display: inline-block; width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 500;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.icon { flex: none; display: inline-block; }

.muted { color: var(--muted-foreground); }

/* ---------- Code ---------- */

code, kbd, samp { font-family: var(--mono); font-size: 0.88em; font-variant-ligatures: none; }
code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}
kbd {
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 0.05em 0.4em;
  background: var(--muted);
}
pre {
  margin: 16px 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 14.5px;
  tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
pre:focus-visible { outline-offset: 0; }

/* ---------- Buttons ---------- */

.btn {
  --btn-h: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: var(--radius-md);
  border: 1px solid var(--control-border);
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--accent); color: var(--accent-foreground); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn[aria-busy='true'] { cursor: progress; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-foreground); }

.btn-secondary { background: var(--secondary); border-color: transparent; color: var(--secondary-foreground); box-shadow: none; }
.btn-secondary:hover { background: var(--secondary-hover); color: var(--secondary-foreground); }

.btn-outline { background: var(--background); }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--accent); }

.btn-danger, .btn-destructive { background: var(--destructive); border-color: var(--destructive); color: var(--destructive-foreground); }
.btn-danger:hover, .btn-destructive:hover { background: var(--destructive-hover); border-color: var(--destructive-hover); color: var(--destructive-foreground); }
.btn-danger-outline { color: var(--danger); border-color: var(--danger-border); }
.btn-danger-outline:hover { background: var(--danger-soft); color: var(--danger); }

.btn-link { background: none; border-color: transparent; box-shadow: none; color: var(--primary); padding: 0 2px; min-height: auto; }
.btn-link:hover { background: none; text-decoration: underline; color: var(--primary); }

.btn-small, .btn-sm { --btn-h: 32px; padding: 0 12px; font-size: 14px; gap: 6px; border-radius: var(--radius-sm); }
.btn-lg { --btn-h: 44px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-icon .icon { width: 18px; height: 18px; }
.btn-small.btn-icon .icon, .btn-sm.btn-icon .icon { width: 16px; height: 16px; }

.spinner { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges and status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 9px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  vertical-align: middle;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-default, .badge-admin { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-foreground); }
.badge-secondary, .badge-source, .badge-viewer { background: var(--secondary); border-color: transparent; color: var(--secondary-foreground); }
.badge-outline { background: transparent; }
.badge-success { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.badge-warning { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.badge-destructive { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.badge-info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }

.status-ok { color: var(--success); font-weight: 500; }
.status-warn { color: var(--warning); font-weight: 500; }
.status-bad { color: var(--danger); font-weight: 500; }

/* ---------- Tables ---------- */

.table-wrap {
  position: relative;
  width: 100%;
  overflow: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th {
  font-weight: 500;
  font-size: 14px;
  color: var(--muted-foreground);
  background: var(--muted);
  white-space: nowrap;
  vertical-align: bottom;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 0.12s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td code, th code { white-space: nowrap; font-size: 14px; }

/* ---------- Callouts ---------- */

.callout, blockquote {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--foreground);
}
.callout > .icon { width: 20px; height: 20px; margin-top: 2px; }
.callout-body { min-width: 0; flex: 1; }
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 600; margin: 0 0 4px; }
.callout p { margin: 0 0 6px; }
.callout ul { margin: 6px 0; padding-left: 20px; }
.callout-info, blockquote { background: var(--info-soft); border-color: var(--info-border); }
.callout-info > .icon { color: var(--info); }
.callout-success { background: var(--success-soft); border-color: var(--success-border); }
.callout-success > .icon, .callout-success .callout-title { color: var(--success); }
.callout-warning { background: var(--warning-soft); border-color: var(--warning-border); }
.callout-warning > .icon, .callout-warning .callout-title { color: var(--warning); }
.callout-destructive { background: var(--danger-soft); border-color: var(--danger-border); }
.callout-destructive > .icon, .callout-destructive .callout-title { color: var(--danger); }
.callout-neutral { background: var(--muted); }
.callout-neutral > .icon { color: var(--muted-foreground); }
blockquote { display: block; }
blockquote > :first-child { margin-top: 0; }
blockquote > :last-child { margin-bottom: 0; }

/* ---------- Cards ---------- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
}

/* ---------- Logo ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--foreground);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}
.brand:hover { text-decoration: none; }
.brand-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 28px; height: 28px; flex: none; }

/* ---------- Docs site ---------- */

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
}
.docs-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.docs-topbar .badge { flex: none; }
.docs-menu { display: none; }

.docs-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 220px;
  max-width: 1440px;
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  overflow-y: auto;
  padding: 24px 16px 40px;
  border-right: 1px solid var(--border);
  font-size: 15px;
}
.docs-sidebar ul { list-style: none; margin: 0 0 18px; padding: 0; }
.docs-sidebar li a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  line-height: 1.4;
}
.docs-sidebar li a:hover { background: var(--accent); color: var(--foreground); text-decoration: none; }
.docs-sidebar li a[aria-current='page'] { background: var(--primary-soft); color: var(--primary-soft-foreground); font-weight: 500; }
.nav-section { margin: 4px 10px 6px; font-size: 13.5px; font-weight: 600; color: var(--foreground); }

.docs-content { min-width: 0; padding: 40px 48px 80px; }
.prose { max-width: 780px; overflow-wrap: break-word; }
.prose h1 { margin: 0 0 16px; font-size: 34px; font-weight: 700; letter-spacing: -0.025em; }
.prose h2 { margin: 48px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 24px; scroll-margin-top: 80px; }
.prose h3 { margin: 32px 0 10px; font-size: 19px; scroll-margin-top: 80px; }
.prose h4 { margin: 24px 0 8px; font-size: 16.5px; scroll-margin-top: 80px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0; }
.prose strong { font-weight: 600; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
.prose .table-wrap { margin: 20px 0; }
.prose table { font-size: 15px; }
.prose th { background: var(--muted); }
.heading-anchor { margin-left: 8px; color: var(--muted-foreground); opacity: 0; font-weight: 400; text-decoration: none !important; }
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }

.code-block { position: relative; margin: 18px 0; }
.code-block pre { margin: 0; padding-top: 14px; }
.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 4px 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--muted);
  font-size: 13.5px;
  color: var(--muted-foreground);
}
.code-block-head + pre { border-top-left-radius: 0; border-top-right-radius: 0; }

.toc { position: sticky; top: 60px; align-self: start; padding: 40px 16px; font-size: 14px; max-height: calc(100vh - 60px); overflow-y: auto; }
.toc-title { margin: 0 0 8px; font-weight: 600; font-size: 14px; color: var(--foreground); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a { display: block; padding: 4px 0; color: var(--muted-foreground); line-height: 1.4; }
.toc li a:hover { color: var(--foreground); text-decoration: none; }
.toc li a[aria-current='location'] { color: var(--primary); font-weight: 500; }

.pager { display: flex; justify-content: space-between; gap: 12px; max-width: 780px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); }
.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 0;
  max-width: 48%;
  color: var(--foreground);
  font-weight: 500;
}
.pager a:hover { background: var(--accent); text-decoration: none; }
.pager a span { font-size: 13.5px; font-weight: 400; color: var(--muted-foreground); }
.pager .pager-next { margin-left: auto; text-align: right; }

.docs-backdrop { display: none; }

.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--muted); }
.theme-switch[hidden] { display: none; }
.theme-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}
.theme-switch button:hover { color: var(--foreground); }
.theme-switch button[aria-checked='true'] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.theme-switch button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

.status-bar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin: 16px 0 4px; }
.prose button.btn { font-size: 14px; }
.prose .callout p { margin: 0; }

@media (max-width: 1200px) {
  .docs-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-menu { display: inline-flex; }
  .docs-topbar { padding: 0 12px; gap: 8px; }
  .docs-topbar .badge, .docs-topbar-actions .btn-label { display: none; }
  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(300px, 85vw);
    height: 100%;
    background: var(--background);
    box-shadow: var(--shadow-xl);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
  }
  body.nav-open .docs-sidebar { transform: none; visibility: visible; }
  body.nav-open .docs-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: var(--overlay); }
  .docs-content { padding: 28px 16px 64px; }
  .prose h1 { font-size: 28px; }
  .prose h2 { font-size: 21px; }
}

@media (max-width: 420px) {
  .docs-topbar .brand-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .docs-topbar-actions { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
