:root {
  color-scheme: dark;
  --bg: #0e0b18;
  --surface: #1b152a;
  --surface-2: #241b34;
  --ink: #f5f1fb;
  --muted: #aaa0be;
  --line: rgba(200,174,242,.16);
  --accent: #bb9bff;
  font-family: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse 760px 450px at 76% 0%, rgba(95,55,160,.19), transparent 80%),
    var(--bg);
}
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #dac6ff; outline-offset: 3px; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 10px 15px; background: #c2a6ff; color: #120923; }
.skip:focus { top: 8px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 19px;
  min-height: 73px; padding: 12px clamp(20px, 3vw, 50px);
  border-bottom: 1px solid var(--line);
  background: rgba(16,12,27,.94);
  backdrop-filter: blur(20px);
}
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand img { display: block; width: 127px; height: auto; filter: drop-shadow(0 7px 18px rgba(125,69,238,.12)); }
.brand-divider { height: 19px; width: 1px; background: var(--line); }
.topbar-title { color: #c7b9da; font-size: 13px; font-weight: 650; white-space: nowrap; }
.topbar-links { display: flex; align-items: center; justify-content: flex-end; gap: 21px; flex: 1; }
.topbar-links a { color: #c0b5d2; font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.topbar-links a:hover { color: #fff; }
.topbar-links a.cabinet { padding: 10px 13px; border: 1px solid rgba(191,165,244,.34); border-radius: 10px; color: #f1e8ff; background: rgba(182,146,240,.12); }
.topbar-links a.cabinet:hover { border-color: #bb9bff; background: rgba(182,146,240,.22); }
.topbar-links a.back { padding: 11px 15px; border: 1px solid rgba(191,165,244,.34); border-radius: 10px; color: #edddff; background: rgba(182,146,240,.09); }
.layout { display: grid; grid-template-columns: 250px minmax(0,1fr); max-width: 1530px; margin: 0 auto; }
.toc {
  position: sticky; top: 73px;
  align-self: start; display: flex; flex-direction: column; gap: 13px;
  height: calc(100vh - 73px); padding: 40px 19px 30px 26px; overflow-y: auto;
  border-right: 1px solid var(--line);
}
.toc-eyebrow,.eyebrow { color: #ac91e5; font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.toc-eyebrow { margin: 0; }
.toc > strong { margin-bottom: 14px; font-size: 16px; }
.toc nav { display: grid; gap: 3px; }
.toc nav a {
  display: block; min-height: 38px; padding: 10px 12px;
  border: 1px solid transparent; border-radius: 9px;
  color: #aaa0bd; font-size: 12px; font-weight: 650; text-decoration: none;
}
.toc nav a:hover, .toc nav a.active { border-color: rgba(199,164,251,.2); background: rgba(152,111,235,.12); color: #f4ecff; }
.toc nav a.active { border-color: rgba(199,164,251,.36); }
.toc-help { display: inline-flex; gap: 6px; align-items: center; margin-top: auto; padding: 12px; color: #cab5ed; font-size: 12px; text-decoration: none; }
.toc-help:hover { color: #fff; }
main { width: 100%; max-width: 1060px; min-width: 0; padding: 50px clamp(24px,5vw,88px) 100px; }
.intro { margin-bottom: 62px; }
.intro h1 { max-width: 680px; margin: 18px 0 17px; font-size: clamp(35px,4.1vw,58px); line-height: 1.07; letter-spacing: -.055em; }
.intro > p { max-width: 65ch; color: #c4b9d3; font-size: 15px; line-height: 1.75; }
.base-url { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; max-width: 700px; margin-top: 28px; padding: 14px 17px; border: 1px solid rgba(196,166,246,.29); border-radius: 12px; background: linear-gradient(110deg,rgba(125,76,206,.18),rgba(28,21,41,.8)); }
.base-url span { font-size: 11px; font-weight: 750; color: #c9b4ef; }
.base-url code { flex: 1; min-width: 200px; overflow-wrap: anywhere; font-size: 12px; color: #efe6ff; }
.base-url button { min-height: 33px; padding: 0 10px; border: 1px solid rgba(194,159,253,.44); border-radius: 7px; background: rgba(159,116,231,.14); color: #f4eaff; font-size: 11px; font-weight: 700; }
.doc-section { padding-top: 36px; margin: 0 0 55px; border-top: 1px solid var(--line); scroll-margin-top: 87px; }
.section-heading span { color: #a88adf; font-size: 10px; letter-spacing: .16em; font-weight: 800; }
.section-heading h2 { margin: 12px 0 18px; font-size: clamp(25px,2.6vw,33px); line-height: 1.2; letter-spacing: -.034em; }
.doc-section p { max-width: 75ch; margin: 12px 0 20px; color: #c0b5cd; font-size: 14px; line-height: 1.72; }
.doc-section strong { color: #f5efff; }
.doc-section code:not(pre code) { padding: 3px 5px; border: 1px solid rgba(193,167,232,.14); border-radius: 5px; background: rgba(167,124,228,.095); color: #e4d2ff; font: 12px/1.5 ui-monospace,Consolas,monospace; word-break: break-word; }
.bullet { display: grid; gap: 9px; max-width: 70ch; padding: 0 0 0 20px; margin: 18px 0; color: #c4b8d4; line-height: 1.55; font-size: 13px; }
.bullet li::marker { color: #b99af4; }
.code-card { overflow: hidden; margin: 16px 0; border: 1px solid var(--line); border-radius: 13px; background: #120e1d; }
.code-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 42px; padding: 0 14px 0 17px; border-bottom: 1px solid var(--line); background: rgba(136,98,206,.08); color: #bbaacb; font-size: 11px; font-weight: 650; }
.code-top button { flex: 0 0 auto; min-height: 29px; padding: 0 10px; border: 1px solid rgba(195,168,250,.28); border-radius: 7px; background: rgba(145,106,216,.12); color: #e5d8fa; font-size: 11px; }
.code-card pre { max-width: 100%; overflow: auto; margin: 0; padding: 18px 20px 21px; font: 12px/1.68 ui-monospace,Consolas,"SFMono-Regular",monospace; color: #e0d8eb; tab-size: 2; }
.code-card code { white-space: pre; }
.doc-section p.note { padding: 13px 15px; border-left: 2px solid #a385df; background: rgba(156,107,229,.075); color: #baadcb; font-size: 12px; }
.endpoint { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 13px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.endpoint b { min-width: 51px; padding: 5px 7px; border: 1px solid rgba(89,212,171,.28); border-radius: 6px; color: #8ee3c1; background: rgba(49,171,130,.095); font: 750 10px/1 ui-monospace,Consolas,monospace; text-align: center; }
.endpoint:has(b:first-child:not(:only-child)) b { letter-spacing: 0; }
.endpoint:has(b:first-child) b:first-child { flex: 0 0 51px; }
.endpoint:has(b:first-child) code { padding: 0; border: 0; background: transparent; color: #e5d3fc; font-weight: 700; }
.endpoint > span { margin-left: auto; color: #8f819d; font-size: 11px; }
.model-widget { margin: 24px 0; border: 1px solid var(--line); border-radius: 14px; background: rgba(31,24,45,.7); }
.model-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.model-toolbar label { font-size: 12px; font-weight: 750; }
.model-toolbar input { width: min(280px,100%); min-height: 36px; padding: 0 11px; border: 1px solid rgba(191,167,233,.23); border-radius: 8px; background: rgba(19,14,30,.8); color: #eee5f9; font-size: 12px; }
#catalog-status { padding: 0 17px; font-size: 12px; color: #ada0c0; }
.model-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; max-height: 400px; overflow: auto; padding: 3px 16px 16px; }
.model-item { min-width: 0; padding: 11px 12px; border: 1px solid rgba(194,171,230,.13); border-radius: 9px; background: rgba(101,74,148,.09); }
.model-item strong { display: block; margin: 0 0 4px; font-size: 12px; overflow-wrap: anywhere; }
.model-item code { padding: 0 !important; border: 0 !important; background: none !important; color: #a792c4 !important; font-size: 11px !important; }
.model-item small { display: block; margin-top: 7px; color: #a593b8; font-size: 10px; }
.callout { padding: 17px 19px; margin: 22px 0; border: 1px solid rgba(197,158,255,.25); border-radius: 12px; background: rgba(138,88,215,.10); }
.callout strong { font-size: 13px; }
.callout p { margin: 8px 0 0; font-size: 12px; }
.error-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 20px 0; }
.error-grid > div { display: grid; gap: 8px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(120,86,176,.07); }
.error-grid strong { font: 750 12px ui-monospace,Consolas,monospace; color: #d1bcf8; }
.error-grid span { color: #b7a8c4; font-size: 12px; line-height: 1.45; }
.page-footer { display: flex; flex-wrap: wrap; gap: 15px 24px; align-items: center; padding-top: 24px; border-top: 1px solid var(--line); color: #8f829f; font-size: 11px; }
.page-footer span { margin-right: auto; }
.page-footer a { text-decoration: none; color: #bca4eb; }
.page-footer a:hover { color: #fff; }
@media (max-width: 1030px) {
  .layout { grid-template-columns: 211px minmax(0,1fr); }
  main { padding-inline: 30px; }
  .toc { padding-left: 15px; }
}
@media (max-width: 760px) {
  .topbar { min-height: 65px; padding: 11px 18px; flex-wrap: wrap; gap: 9px; }
  .brand img { width: 112px; }
  .topbar-title { font-size: 12px; }
  .topbar-links { gap: 14px; }
  .topbar-links > a:not(.back):not(.cabinet) { display: none; }
  .topbar-links a.cabinet { padding: 9px 10px; }
  .topbar-links a.back { padding: 9px 10px; }
  .layout { display: block; }
  .toc { position: sticky; top: 65px; z-index: 19; height: auto; padding: 11px 16px 9px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; background: rgba(16,12,27,.97); backdrop-filter: blur(16px); }
  .toc > strong,.toc-eyebrow,.toc-help { display: none; }
  .toc nav { display: flex; gap: 5px; padding-bottom: 5px; overflow-x: auto; scrollbar-width: thin; }
  .toc nav a { flex: 0 0 auto; min-height: 34px; padding: 9px 10px; white-space: nowrap; }
  main { max-width: none; padding: 31px 18px 70px; }
  .intro { margin-bottom: 37px; }
  .intro h1 { font-size: clamp(31px,9vw,43px); }
  .model-list,.error-grid { grid-template-columns: 1fr; }
  .doc-section { margin-bottom: 42px; scroll-margin-top: 130px; }
}
@media (max-width: 420px) {
  .topbar-title { display: none; }
  .brand-divider { display: none; }
  .topbar-links { gap: 0; }
  .topbar-links a.cabinet { padding: 8px 9px; margin-right: 7px; }
  .topbar-links a.back { padding: 8px 9px; }
  .base-url { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; padding: 12px; }
  .base-url code { min-width: 0; overflow-wrap: anywhere; }
  .base-url button { justify-self: start; }
  .endpoint > span { width: 100%; margin: 0 0 3px 64px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* Mobile docs fix: header and category rail never overlap. */
@media (max-width: 760px) {
  :root { --docs-mobile-topbar-height: 65px; }
  .topbar {
    min-height: var(--docs-mobile-topbar-height) !important;
    height: var(--docs-mobile-topbar-height) !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
  }
  .topbar-links { min-width: 0; overflow: hidden; }
  .topbar-links a.cabinet,
  .topbar-links a.back { flex: 0 0 auto; }
  .toc {
    position: sticky !important;
    top: var(--docs-mobile-topbar-height) !important;
    z-index: 19 !important;
    height: 62px !important;
    min-height: 62px !important;
    overflow: hidden !important;
    padding: 11px 16px 9px !important;
    isolation: isolate;
  }
  .toc::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background: rgba(16,12,27,.98);
  }
  .toc nav {
    position: relative;
    z-index: 1;
    height: 41px;
    align-items: center;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .toc nav a { flex: 0 0 auto !important; }
  main { position: relative; z-index: 0; }
  .doc-section { scroll-margin-top: 140px !important; }
}
