/* ============================================
   KalqiX Docs — theme
   Built on the trading app's own design tokens
   (kalqix-ui/src/styles/_theme.scss, "kalqix"
   palette): neutral greys, soft-violet accent,
   buy-green / sell-red semantics, and the
   rainbow brand line. Clash Grotesk (the app's
   title face) sets headings; Inter sets text.

   :root holds the light palette and
   [data-theme="dark"] overrides it. Dark is the
   default: index.html ships data-theme="dark";
   js/app.js applies the user's saved choice.

   Code always sits on a dark surface, in both
   themes, so the syntax palette is one set.
   ============================================ */

@font-face {
  font-family: 'Clash Grotesk';
  src: url('../static/fonts/ClashGrotesk-Variable.woff2') format('woff2');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Surfaces */
  --bg-root: #ffffff;
  --bg-topbar: rgba(255, 255, 255, 0.86);
  --bg-surface: #f6f7f9;
  --bg-hover: #f0f2f5;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-inline-code: #f2f3f6;

  /* Hairlines */
  --border: #e3e6eb;
  --border-subtle: #eef0f3;
  --border-strong: #c9cfd6;

  /* Text, brightest to dimmest */
  --text-heading: #0f1115;
  --text-primary: #1f232a;
  --text-body: #3b414a;
  --text-secondary: #4a5058;
  --text-muted: #6b7280;

  /* Accent: the app's violet, deepened for white ground (5.5:1) */
  --accent: #6b4fe0;
  --accent-hover: #5539c2;
  --accent-text: #5a3fd0;
  --accent-soft: rgba(107, 79, 224, 0.09);
  --accent-contrast: #ffffff;
  --link: #5a3fd0;

  /* Brand line: the app's `brand-line` gradient */
  --brand-line: linear-gradient(90deg, #ff9a68, #7f7fff 52%, #f63af8);

  /* Semantics: buy-is-green, sell-is-red */
  --positive: #07875a;
  --negative: #c7362a;
  --warning: #8a5a00;
  --info: #1d4ed8;

  /* HTTP methods ride the semantic colours */
  --method-get: var(--info);
  --method-post: var(--positive);
  --method-put: var(--warning);
  --method-delete: var(--negative);

  /* Code surface (dark in both themes) */
  --code-bg: #16171b;
  --code-header: #1d1e23;
  --code-border: #16171b;
  --code-rule: #2a2b31;
  --code-text: #e6e6e0;
  --code-muted: #9a9aa2;

  /* Layout */
  --topbar-height: 56px;
  --sidebar-width: 284px;
  --right-panel-width: 400px;
  --toc-width: 216px;
  --content-max-width: 740px;

  /* Radius: badges < controls < frames */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  /* Type */
  --font-display: 'Clash Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;

  --shadow-pop: 0 1px 2px rgba(15, 17, 21, 0.06), 0 12px 32px rgba(15, 17, 21, 0.12);

  --transition-fast: 120ms ease;
  --transition-normal: 200ms ease;
}

/* ============ Dark Theme ============ */
[data-theme="dark"] {
  color-scheme: dark;

  --bg-root: #0f0f0f;
  --bg-topbar: rgba(15, 15, 15, 0.86);
  --bg-surface: #161616;
  --bg-hover: #1c1c1c;
  --bg-elevated: #1a1a1a;
  --bg-input: #141414;
  --bg-inline-code: #1d1d1d;

  --border: #262626;
  --border-subtle: #1e1e1e;
  --border-strong: #363636;

  --text-heading: #efefe5;
  --text-primary: #d8d8d2;
  --text-body: #b6b6b0;
  --text-secondary: #a1a1a1;
  --text-muted: #868686;

  --accent: #a48bff;
  --accent-hover: #b9a6ff;
  --accent-text: #b4a0ff;
  --accent-soft: rgba(164, 139, 255, 0.12);
  --accent-contrast: #0f0f0f;
  --link: #b4a0ff;

  --positive: #2dce89;
  --negative: #ff5f52;
  --warning: #ffba1b;
  --info: #4b9aff;

  --code-bg: #141414;
  --code-header: #1a1a1a;
  --code-border: #262626;
  --code-rule: #262626;

  --shadow-pop: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv05', 'cv08';
  background: var(--bg-root);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button { font-family: inherit; }

/* ============ Scrollbar ============ */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); }

/* ============ Top bar ============ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--bg-topbar);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(var(--sidebar-width) - 20px);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  text-decoration: none;
  color: var(--text-heading);
}

.logo-img { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }

.logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.logo-text-sub { color: var(--text-muted); font-weight: 500; }

.logo-version {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0 7px;
  line-height: 19px;
  border-radius: 999px;
}
.logo-version:empty { display: none; }

.topbar-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 4px;
  flex: 1;
}

.topbar-link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.topbar-link:hover { color: var(--text-heading); }
.topbar-link.active { color: var(--text-heading); }

/* The brand line marks where you are */
.topbar-link.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand-line);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.theme-toggle:hover { color: var(--text-heading); background: var(--bg-hover); border-color: var(--border-strong); }

.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: block; }

.topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background var(--transition-fast);
  white-space: nowrap;
}
.topbar-cta:hover { background: var(--accent-hover); }
.topbar-cta svg { opacity: 0.8; }

/* ============ Layout shell ============ */
.layout { padding-top: var(--topbar-height); }

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  background: var(--bg-root);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

/* Search */
.sidebar-search { padding: 14px 16px 12px; position: relative; z-index: 3; }

.sidebar-search input {
  width: 100%;
  height: 36px;
  padding: 0 52px 0 34px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search input:hover { border-color: var(--border-strong); }
.sidebar-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sidebar-search input:focus-visible { outline: none; }

.search-icon {
  position: absolute;
  left: 28px;
  top: 32px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-kbd {
  position: absolute;
  right: 24px;
  top: 32px;
  transform: translateY(-50%);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0 6px;
  border-radius: var(--radius-xs);
  pointer-events: none;
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% - 6px);
  left: 12px;
  width: 440px;
  max-height: min(560px, calc(100vh - var(--topbar-height) - 100px));
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 6px;
}
.search-results.visible { display: block; }
.search-result {
  display: block;
  width: 100%;
  padding: 9px 10px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
}
.search-result:hover,
.search-result.active { background: var(--bg-hover); }
.search-result.active { box-shadow: inset 2px 0 0 var(--accent); }
.search-result-topline { display: flex; align-items: center; gap: 7px; min-width: 0; }
.search-result-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}
.search-result-kind {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}
.search-result-meta {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-snippet {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.search-result mark {
  color: var(--text-heading);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 2px;
}
.search-empty {
  padding: 18px 12px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.sidebar-product-nav { display: none; }

.sidebar-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin: 0 16px 10px;
  padding: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.sidebar-mode-tabs button {
  min-width: 0;
  height: 28px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.sidebar-mode-tabs button:hover { color: var(--text-heading); }
.sidebar-mode-tabs button[aria-selected="true"] {
  color: var(--text-heading);
  background: var(--bg-root);
  box-shadow: 0 0 0 1px var(--border-strong);
}

/* Nav tree */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 32px; }
.sidebar-pane { min-height: 100%; }

.nav-section { margin-bottom: 2px; }

.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-heading);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  text-align: left;
  transition: background var(--transition-fast);
}
.nav-section-toggle:hover { background: var(--bg-hover); }

.toggle-chevron {
  display: flex;
  color: var(--text-muted);
  transform: rotate(90deg);
  transition: transform var(--transition-fast);
}
.nav-section-toggle.collapsed .toggle-chevron { transform: none; }

.nav-section-items {
  margin: 2px 0 10px 8px;
  border-left: 1px solid var(--border);
}
.nav-section-items.collapsed { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-left: -1px;
  padding: 5px 8px 5px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  border-left: 1px solid transparent;
  user-select: none;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.nav-item:hover { color: var(--text-heading); border-left-color: var(--border-strong); }
.nav-item.active {
  color: var(--accent-text);
  font-weight: 500;
  border-left-color: var(--accent);
}

/* "Endpoint index" / "Model index" sit above the tree */
.nav-item.nav-mode-home {
  margin: 0 0 8px;
  padding: 7px 8px;
  font-weight: 500;
  color: var(--text-heading);
  border-left: none;
  border-radius: var(--radius-sm);
}
.nav-item.nav-mode-home:hover { background: var(--bg-hover); }
.nav-item.nav-mode-home.active { color: var(--accent-text); background: var(--accent-soft); }

/* Method tags: filled by default, text-only in the sidebar */
.method-badge,
.endpoint-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--method-color, var(--text-secondary));
  background: color-mix(in srgb, var(--method-color, var(--text-secondary)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--method-color, var(--text-secondary)) 24%, transparent);
  border-radius: var(--radius-xs);
}
.method-badge { font-size: 10px; line-height: 16px; padding: 0 5px; min-width: 44px; }
.get { --method-color: var(--method-get); }
.post { --method-color: var(--method-post); }
.put, .patch { --method-color: var(--method-put); }
.delete { --method-color: var(--method-delete); }

.nav-item .method-badge {
  min-width: 36px;
  padding: 0;
  justify-content: flex-start;
  font-size: 9.5px;
  background: none;
  border: none;
}

.nav-endpoint-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.nav-item:has(.method-badge) { gap: 8px; }

/* ============ Main ============ */
.main { margin-left: var(--sidebar-width); }

.main-inner {
  display: flex;
  align-items: flex-start;
  gap: 64px;
  max-width: calc(var(--content-max-width) + var(--right-panel-width) + 128px);
  margin: 0 auto;
  padding: 36px 56px 128px;
}

.content-col { flex: 1 1 auto; min-width: 0; max-width: var(--content-max-width); }

/* Page head: breadcrumbs + copy-page */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  min-height: 30px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
}
.breadcrumbs a { color: var(--text-muted); text-decoration: none; transition: color var(--transition-fast); }
.breadcrumbs a:hover { color: var(--text-heading); }
.breadcrumbs .crumb-sep { color: var(--border-strong); }
.breadcrumbs .crumb-current { color: var(--text-secondary); }

/* Ghost buttons */
.copy-page-btn,
.endpoint-copy-url,
.endpoint-examples-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.copy-page-btn:hover,
.endpoint-copy-url:hover,
.endpoint-examples-toggle:hover { color: var(--text-heading); background: var(--bg-hover); border-color: var(--border-strong); }
.copy-page-btn.copied,
.endpoint-copy-url.copied { color: var(--positive); border-color: color-mix(in srgb, var(--positive) 50%, transparent); }
.main:not(.has-panel) .endpoint-examples-toggle { display: none; }

/* Right rail (holds either TOC or code panel) */
.aside-right {
  width: var(--toc-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-height) + 36px);
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-height) - 60px);
  overflow: visible;
}
.main.has-panel .aside-right { width: var(--right-panel-width); }

/* TOC */
.toc {
  max-height: calc(100vh - var(--topbar-height) - 60px);
  overflow-y: auto;
  padding-top: 4px;
}
.toc-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 10px;
}
.toc-nav { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.toc-link {
  margin-left: -1px;
  padding: 4px 0 4px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 1px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.toc-link:hover { color: var(--text-heading); }
.toc-link.toc-h3 { padding-left: 26px; font-size: 12.5px; }
.toc-link.active { color: var(--accent-text); border-left-color: var(--accent); }
.toc:empty, .toc-nav:empty { display: none; }

.right-panel { display: none; }
.right-panel.visible {
  display: block;
  max-height: calc(100vh - var(--topbar-height) - 60px);
  overflow-y: auto;
  padding: 0 2px 24px 0;
}

/* When the code panel is showing, hide the TOC and vice versa */
.main.has-panel .toc { display: none; }
.main.has-panel.panel-collapsed .aside-right { display: none; }
.main.has-panel.panel-collapsed .content-col { margin-left: auto; margin-right: auto; }

.panel-resize-handle {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: -26px;
  width: 12px;
  cursor: col-resize;
  touch-action: none;
}
.main.has-panel:not(.panel-collapsed) .panel-resize-handle { display: block; }
.panel-resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 1px;
  background: var(--border);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.panel-resize-handle:hover::after,
.panel-resize-handle:focus-visible::after {
  width: 2px;
  left: 5px;
  background: var(--accent);
}
.panel-resize-handle:focus-visible { outline: none; }
body.resizing-panel {
  cursor: col-resize;
  user-select: none;
}

/* ============ Content typography ============ */
.content h1, .content h2 {
  font-family: var(--font-display);
  color: var(--text-heading);
  scroll-margin-top: calc(var(--topbar-height) + 24px);
}
.content h3, .content h4 {
  font-family: var(--font-sans);
  color: var(--text-heading);
  scroll-margin-top: calc(var(--topbar-height) + 24px);
}

.content h1 {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0.002em;
  margin-bottom: 14px;
}

.content h2 {
  font-size: 26px;
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: 0.004em;
  margin-top: 56px;
  margin-bottom: 12px;
}

.content h3 {
  font-size: 17.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.012em;
  margin-top: 36px;
  margin-bottom: 8px;
}

.content h4 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.006em;
  margin-top: 26px;
  margin-bottom: 6px;
}

.content p {
  margin-bottom: 16px;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text-body);
}

/* The paragraph under a guide's title reads as its summary */
.guide-page > h1 + p {
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.content a:not([class]) {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--link) 38%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-fast);
}
.content a:not([class]):hover { text-decoration-color: var(--link); }

.content ul, .content ol {
  margin-bottom: 18px;
  padding-left: 1.3em;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text-body);
}
.content li { margin-bottom: 6px; padding-left: 2px; }
.content li > ul, .content li > ol { margin: 6px 0 0; }
.content li::marker { color: var(--text-muted); }

.content strong { color: var(--text-heading); font-weight: 600; }

/* Callout */
.content blockquote {
  margin: 22px 0;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.content blockquote p { font-size: 14.5px; line-height: 1.65; }
.content blockquote > :last-child { margin-bottom: 0; }

.content hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

.content img { max-width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border); }

/* Inline code */
.content :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  font-weight: 500;
  color: var(--text-heading);
  background: var(--bg-inline-code);
  border: 1px solid var(--border-subtle);
  padding: 0.12em 0.4em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

.content code, .right-panel code {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0, "clig" 0;
}

/* Code frames — dark in both themes. A pre that names its language
   (data-lang, set in js/app.js) gets a header strip with the label
   and an always-visible copy button. */
.content pre {
  position: relative;
  margin: 20px 0 24px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.content pre code {
  display: block;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--code-text);
  background: transparent;
}
.content pre[data-lang] { padding-top: 38px; }
.content pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--code-muted);
  background: var(--code-header);
  border-bottom: 1px solid var(--code-rule);
}

/* Tables (wrapped in .table-wrap by js/app.js so wide ones scroll) */
.table-wrap {
  margin: 20px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.content th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  color: var(--text-heading);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}
.content td {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-body);
  line-height: 1.6;
  vertical-align: top;
}
.content tr:first-child td { border-top: none; }
/* Key/value tables written with an empty header row */
.content thead:not(:has(th:not(:empty))) { display: none; }
/* Tables scroll sideways, so code stays whole rather than breaking mid-token */
.content td code { font-size: 12.5px; white-space: nowrap; overflow-wrap: normal; }

/* ============ Endpoint page ============ */
.endpoint-card { margin-bottom: 48px; }

.content .endpoint-title {
  font-size: 34px;
  margin-bottom: 18px;
}

.endpoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.endpoint-identity,
.endpoint-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.endpoint-identity { flex: 1; }
.endpoint-actions { flex-shrink: 0; gap: 8px; }
.main.has-panel .endpoint-header {
  position: sticky;
  top: var(--topbar-height);
  z-index: 20;
  margin-left: -12px;
  margin-right: -12px;
  padding: 11px 12px;
  background: var(--bg-topbar);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.endpoint-method { font-size: 11.5px; line-height: 22px; padding: 0 8px; }

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-heading);
  word-break: break-all;
}
.endpoint-path .path-param { color: var(--accent-text); }

.endpoint-summary { font-size: 15.5px; line-height: 1.72; color: var(--text-body); margin-bottom: 18px; }

.endpoint-guide-link {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 11px;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.endpoint-guide-link span { color: var(--text-muted); }
.endpoint-guide-link strong { color: var(--accent-text); font-weight: 600; }
.endpoint-guide-link:hover { border-color: var(--accent); background: var(--accent-soft); }

.endpoint-url-bar {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.endpoint-url-bar .url-server { color: var(--text-muted); }
.endpoint-url-bar .url-path { color: var(--text-heading); }

/* Auth chip */
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 24%, transparent);
  border-radius: 999px;
}
.auth-badge.public {
  color: var(--positive);
  background: color-mix(in srgb, var(--positive) 10%, transparent);
  border-color: color-mix(in srgb, var(--positive) 24%, transparent);
}
.auth-badge svg { flex-shrink: 0; }

/* Section headings: Parameters / Request body / Responses */
.content .section-label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 44px 0 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 20px;
  font-weight: 550;
  line-height: 1.3;
}
.section-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Field lists — parameters, request body, model properties, responses */
.schema-block { margin-bottom: 8px; }

.schema-field,
.response-schema-field {
  padding: 15px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.schema-field:last-child,
.response-schema-field:last-child { border-bottom: none; }

.schema-field-main,
.response-schema-field-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-width: 0;
}
.schema-field-name,
.param-name {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-heading);
  overflow-wrap: anywhere;
}
.schema-field-type,
.param-type {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.schema-field-location { font-size: 12px; color: var(--text-muted); }
.param-required {
  font-size: 12px;
  font-weight: 500;
  color: var(--warning);
}
.schema-field-desc,
.response-schema-field-desc,
.param-desc {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-body);
}
.param-default {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.param-enum { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.param-enum-value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 20px;
  padding: 0 7px;
  color: var(--text-primary);
  background: var(--bg-inline-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}

/* Responses */
.response-group { margin-top: 14px; margin-bottom: 18px; }

.response-status {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.response-status:hover { background: var(--bg-hover); }
.response-status.expanded { border-color: var(--border-strong); }

.status-code {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
}
.status-code::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-code.s2xx { color: var(--positive); }
.status-code.s4xx { color: var(--warning); }
.status-code.s5xx { color: var(--negative); }

.status-desc { color: var(--text-secondary); font-weight: 400; font-size: 13.5px; line-height: 1.45; }

.chevron {
  display: flex;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}
.response-status.expanded .chevron { transform: rotate(90deg); }

.response-body { display: none; padding: 0 0 14px; }
.response-body.visible { display: block; }

.response-errors { margin-top: 4px; }
.response-errors > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 2px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  list-style: none;
}
.response-errors > summary::-webkit-details-marker { display: none; }
.response-errors > summary:hover { color: var(--text-heading); }
.response-error-count { color: var(--text-muted); font-size: 12.5px; font-weight: 400; }
.response-errors[open] > summary .chevron { transform: rotate(90deg); }
.response-errors:not([open]) > .response-errors-body { display: none; }
.response-errors-body { padding: 4px 0 2px; }

.response-schema { padding: 0 2px; }
.response-schema-nested {
  margin-top: 12px;
  padding: 0 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.response-schema-nested > .response-schema-field { padding: 12px 0; }
.response-schema-variant + .response-schema-variant { margin-top: 18px; }
.response-schema-variant > .schema-title {
  padding: 8px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.response-schema-field.has-children > .response-schema-nested { display: none; }
.response-schema-field.has-children.expanded > .response-schema-nested { display: block; }

.schema-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin-top: 10px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.schema-toggle-btn:hover { color: var(--text-heading); border-color: var(--border-strong); background: var(--bg-hover); }
.schema-toggle-icon { font-size: 14px; font-weight: 500; line-height: 1; }

/* ============ Right panel: the code console ============ */
/* Code is always on a dark surface, so method tags inside it use the
   dark-mode semantic colours in both themes. */
.code-example-card,
.panel-example-body {
  --method-get: #4b9aff;
  --method-post: #2dce89;
  --method-put: #ffba1b;
  --method-delete: #ff5f52;
}

.code-example-card {
  position: relative;
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
}
.code-example-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--brand-line);
  z-index: 1;
}

.code-example-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 9px 10px 9px 14px;
  background: var(--code-header);
  border-bottom: 1px solid var(--code-rule);
}
.code-example-endpoint {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--code-text);
}
.code-example-endpoint > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-example-tabs { display: flex; gap: 2px; overflow-x: auto; }
.code-tab {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--code-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.code-tab:hover { color: var(--code-text); }
.code-tab.active { color: #ffffff; background: rgba(255, 255, 255, 0.09); }

.right-panel pre { position: relative; margin: 0; }
.right-panel pre code {
  display: block;
  padding: 16px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--code-text);
  background: transparent;
}
.code-example-body pre code { max-height: 520px; }
.mobile-examples-title { display: none; }

.panel-example { margin-top: 20px; }
.panel-example-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}
.panel-example-body {
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
}
.panel-example-body pre code { max-height: 420px; }

/* ============ Guide page ============ */
.guide-page { max-width: var(--content-max-width); }
.guide-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 72px;
}
.guide-pagination a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.guide-pagination a.next { align-items: flex-end; text-align: right; }
.guide-pagination a:hover { border-color: var(--accent); background: var(--accent-soft); }
.guide-pagination span { color: var(--text-muted); font-size: 12.5px; }
.guide-pagination strong { color: var(--text-heading); font-size: 15px; font-weight: 500; }

/* ============ API reference index ============ */
.reference-header {
  margin-bottom: 44px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.content .reference-header h1 { margin-bottom: 12px; }
.content .reference-lede {
  max-width: 600px;
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.server-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 24px;
  margin-top: 24px;
  font-size: 14px;
}
.server-list dt { color: var(--text-muted); }
.server-list dd { min-width: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.content .server-list dd code {
  padding: 0;
  font-size: 13.5px;
  color: var(--text-heading);
  background: none;
  border: none;
}

.directory-page > .directory-heading { margin-top: 6px; }
.directory-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.content .directory-heading h1,
.content .directory-heading h2 { margin: 0 0 6px; }
.content .directory-heading p { margin: 0; }
.directory-count {
  flex-shrink: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.endpoint-index-filters {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) repeat(3, minmax(128px, auto));
  gap: 8px;
  margin-bottom: 32px;
}
.endpoint-index-filters label { display: flex; flex-direction: column; min-width: 0; }
/* Each select's first option names it; the visible labels are for AT */
.endpoint-index-filters label > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.endpoint-index-filters input,
.endpoint-index-filters select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.endpoint-index-filters select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%23868686' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.endpoint-index-filters input::placeholder { color: var(--text-muted); }
.endpoint-index-filters input:hover,
.endpoint-index-filters select:hover { border-color: var(--border-strong); }
.endpoint-index-filters input:focus,
.endpoint-index-filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }

.endpoint-index-group { margin: 40px 0; scroll-margin-top: calc(var(--topbar-height) + 24px); }
.content .endpoint-index-group h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 550;
  letter-spacing: 0.004em;
}
.content .endpoint-index-group > p { margin: 0 0 14px; font-size: 14px; line-height: 1.6; }

.endpoint-index-rows,
.model-index {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.endpoint-index-row,
.model-index-row {
  display: grid;
  align-items: center;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: background var(--transition-fast);
}
.endpoint-index-row:first-child,
.model-index-row:first-child { border-top: none; }
.endpoint-index-row:hover,
.model-index-row:hover { background: var(--bg-hover); }

.endpoint-index-row {
  grid-template-columns: 58px minmax(180px, 0.9fr) minmax(200px, 1.4fr) 52px;
  gap: 14px;
  min-height: 46px;
  padding: 9px 14px;
}
.endpoint-index-row .method-badge { min-width: 58px; font-size: 10.5px; line-height: 20px; }
.content .endpoint-index-row code,
.content .model-index-row code {
  overflow: hidden;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
  background: none;
  border: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.endpoint-index-summary {
  overflow: hidden;
  font-size: 13.5px;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.endpoint-index-access {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: right;
}
.endpoint-index-access.public { color: var(--positive); }
.endpoint-index-empty {
  padding: 48px 20px;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.model-index-row {
  grid-template-columns: minmax(170px, 0.7fr) minmax(260px, 1.5fr) 32px;
  gap: 16px;
  min-height: 50px;
  padding: 10px 14px;
}
.model-index-row span {
  overflow: hidden;
  font-size: 13.5px;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-index-row strong {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ============ Code copy button ============ */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  height: 24px;
  padding: 0 9px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--code-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
pre:hover .copy-btn, pre:focus-within .copy-btn { opacity: 1; }
.content pre[data-lang] > .copy-btn { top: 7px; opacity: 1; }
.copy-btn:hover { color: #ffffff; background: rgba(255, 255, 255, 0.12); }
.copy-btn.copied { color: #2dce89; border-color: rgba(45, 206, 137, 0.4); }

/* ============ Syntax (highlight.js) — brand palette on dark ============ */
.hljs { color: var(--code-text); background: transparent; }
.hljs-comment,
.hljs-quote { color: #8a8a85; font-style: italic; }
.hljs-keyword,
.hljs-selector-tag,
.hljs-doctag,
.hljs-section { color: #c3b2ff; }
.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-template-tag { color: #8be3b8; }
.hljs-number,
.hljs-symbol,
.hljs-bullet { color: #ffc66b; }
.hljs-literal { color: #ff9ae8; }
.hljs-attr,
.hljs-attribute,
.hljs-property,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id { color: #9cc8ff; }
.hljs-title,
.hljs-title.function_,
.hljs-title.class_,
.hljs-name { color: #6fe0de; }
.hljs-built_in,
.hljs-type,
.hljs-class .hljs-title { color: #ffb08f; }
.hljs-variable,
.hljs-template-variable,
.hljs-params,
.hljs-subst { color: var(--code-text); }
.hljs-meta,
.hljs-meta .hljs-keyword { color: #8a8a85; }
.hljs-meta .hljs-string { color: #8be3b8; }
.hljs-deletion { color: #ff8a80; }
.hljs-tag,
.hljs-punctuation,
.hljs-operator { color: #b7b7b0; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* ============ Mobile nav toggle ============ */
.mobile-nav-toggle {
  display: none;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-overlay { display: none; position: fixed; inset: var(--topbar-height) 0 0 0; background: rgba(0, 0, 0, 0.5); z-index: 90; }

/* ============ Sidebar-less pages ============ */
/* OneFill is its own product: the guide/API sidebar does not describe it, so
   it is hidden there. Set by `SIDEBARLESS_ROUTES` in js/app.js. `.main` keeps
   its sidebar-width margin on purpose — the content stays exactly where it
   sits on every other page rather than sliding left as the sidebar goes. */
body.no-sidebar .sidebar,
body.no-sidebar .sidebar-overlay,
body.no-sidebar .mobile-nav-toggle { display: none; }

/* ============ Loading / empty ============ */
.loading { display: flex; align-items: center; justify-content: center; height: 240px; color: var(--text-muted); font-size: 14px; }
.loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.no-results { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ============ Responsive ============ */
@media (max-width: 1180px) {
  .toc { display: none; }
  .main:not(.has-panel) .aside-right { display: none; }
  .main.has-panel .main-inner { display: block; }
  .main.has-panel .aside-right {
    display: block;
    position: static;
    width: auto;
    max-width: var(--content-max-width);
    max-height: none;
    overflow: visible;
    margin: 48px auto 0;
    padding-top: 32px;
    border-top: 1px solid var(--border);
  }
  .main.has-panel.panel-collapsed .aside-right { display: none; }
  .panel-resize-handle { display: none !important; }
  .right-panel.visible { max-height: none; overflow: visible; padding-right: 0; }
  .main.has-panel .content-col { max-width: var(--content-max-width); margin: 0 auto; }
  .mobile-examples-title {
    display: block;
    margin-bottom: 16px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 550;
    color: var(--text-heading);
  }
  .main-inner { justify-content: center; }
}

@media (max-width: 1024px) {
  .topbar-nav { display: none; }
  /* With the nav hidden, the logo takes the free space and pushes the
     theme toggle and app link to the right edge. */
  .topbar-left { flex: 1; min-width: 0; }
  .mobile-nav-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .search-results { right: 12px; width: auto; }
  .sidebar-product-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin: 0 16px 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-product-nav a {
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
  }
  .sidebar-product-nav a:hover { color: var(--text-heading); background: var(--bg-hover); }
  .mobile-nav-toggle,
  .theme-toggle,
  .topbar-cta { min-width: 44px; min-height: 44px; }
  .topbar-cta { justify-content: center; }
  .nav-section-toggle,
  .nav-item,
  .sidebar-product-nav a,
  .sidebar-mode-tabs button { min-height: 44px; }
  .main { margin-left: 0; }
  .main-inner { padding: 32px 40px 100px; }
}

@media (max-width: 860px) {
  .topbar-left { width: auto; }
  .logo-text-sub { display: none; }
  .main-inner { padding: 28px 24px 80px; }
  .content h1 { font-size: 32px; }
  .content .endpoint-title { font-size: 28px; }
  .content h2 { font-size: 23px; margin-top: 44px; }
  .endpoint-index-filters { grid-template-columns: 1fr 1fr; }
  .endpoint-filter-search { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .page-head { align-items: flex-start; }
  .copy-page-label { display: none; }
  .endpoint-header,
  .main.has-panel .endpoint-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .endpoint-identity { width: 100%; }
  .endpoint-actions { width: 100%; }
  .endpoint-copy-url { margin-left: auto; }
  .endpoint-copy-url,
  .endpoint-examples-toggle,
  .copy-page-btn,
  .code-tab,
  .response-status,
  .response-errors > summary,
  .schema-toggle-btn { min-height: 44px; }
  .endpoint-path { font-size: 14px; }
  .directory-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .endpoint-index-filters { grid-template-columns: 1fr; }
  .endpoint-index-filters input,
  .endpoint-index-filters select { height: 44px; }
  .endpoint-index-row {
    grid-template-columns: 58px minmax(0, 1fr) 46px;
    gap: 4px 10px;
    min-height: 58px;
  }
  .endpoint-index-access { grid-row: 1; grid-column: 3; }
  .endpoint-index-summary {
    grid-column: 2 / -1;
    white-space: normal;
  }
  .model-index-row {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 4px 10px;
  }
  .model-index-row span {
    grid-column: 1 / -1;
    white-space: normal;
  }
  .guide-pagination { grid-template-columns: 1fr; }
  .guide-pagination > span { display: none; }
  .server-list { grid-template-columns: 1fr; gap: 2px; }
  .server-list dd + dt { margin-top: 10px; }
}

@media (max-width: 480px) {
  .topbar { gap: 10px; padding: 0 16px; }
  .topbar-cta span, .logo-version { display: none; }
  .logo-text { font-size: 18px; }
  .main-inner { padding-left: 16px; padding-right: 16px; }
  .content h1 { font-size: 29px; }
  .guide-page > h1 + p,
  .content .reference-lede { font-size: 16.5px; }
  .content pre code { padding: 14px; }
  .auth-badge { font-size: 11.5px; padding: 0 8px; }
  .response-schema-nested { padding: 0 12px; }
}

@media (hover: none) {
  .copy-btn { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
