:root {
  --navy: #052b46;
  --navy-2: #084262;
  --blue: #0e95d9;
  --blue-dark: #0b78b0;
  --text: #1b2733;
  --muted: #5b6b7a;
  --faint: #8594a3;
  --line: #e3e8ee;
  --line-2: #eef2f6;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --code-bg: #0a2438;
  --code-bg-2: #06192a;
  --code-text: #dce8f2;
  --code-muted: #8fb0c8;
  --topbar-h: 56px;
  --sidebar-w: 272px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --get: #0f8a5f;
  --post: #0e7cc0;
  --put: #b8650a;
  --patch: #7a4fc2;
  --delete: #c2372f;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 13px; }
:not(pre) > code {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.86em;
  color: var(--navy);
  overflow-wrap: anywhere;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--navy);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { display: block; border-radius: 7px; }
.brand-name { font-size: 16px; letter-spacing: 0.1px; white-space: nowrap; }
.brand-name strong { font-weight: 600; }
.version-badge {
  font: 600 11px/1 var(--mono);
  padding: 4px 7px; border-radius: 999px;
  background: rgba(14, 149, 217, 0.22); color: #9fdcfb;
}
.spec-link { margin-left: auto; color: #b9d6ea; font: 13px var(--mono); }
.spec-link:hover { color: #fff; }
.menu-btn {
  display: none;
  width: 38px; height: 38px; margin-left: -8px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px;
}
.menu-btn span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; }
.menu-btn:focus-visible { outline: 2px solid var(--blue); }

/* Layout */
.layout { padding-top: var(--topbar-h); }
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 20;
  width: var(--sidebar-w);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 12px 40px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  font-size: 14px;
}
.content { margin-left: var(--sidebar-w); min-width: 0; }
.backdrop { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(5, 43, 70, 0.35); z-index: 15; }

/* Sidebar */
.search { position: sticky; top: -16px; margin: -16px -12px 8px; padding: 16px 12px 10px; background: var(--bg-soft); z-index: 1; }
.search input {
  width: 100%; height: 36px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238594a3' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center;
  font: 14px var(--sans); color: var(--text);
}
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(14, 149, 217, 0.18); }
.nav-heading {
  margin: 16px 8px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--faint);
}
.nav-list, .nav-ops { list-style: none; margin: 0; padding: 0; }
.nav-list a, .nav-tag, .nav-ops a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 8px; border-radius: 6px;
  color: var(--text);
}
.nav-list a:hover, .nav-tag:hover, .nav-ops a:hover { background: #e9eef4; text-decoration: none; }
.nav-list a.active, .nav-tag.active, .nav-ops a.active { background: #e1effa; color: var(--navy); font-weight: 600; }
.nav-tag { font-weight: 600; color: var(--navy); margin-top: 4px; }
.nav-ops a { padding-left: 14px; font-size: 13.5px; color: #34495c; }
.nav-ops a > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-muted { color: var(--faint); margin: 4px 8px; font-size: 13px; }
.nav-empty { color: var(--muted); margin: 8px; font-size: 13px; }
.nav-ops .method { flex: 0 0 44px; }

/* Method badges */
.method {
  display: inline-block;
  font: 700 10.5px/1 var(--mono); letter-spacing: 0.3px;
  text-transform: uppercase; text-align: center;
  color: var(--get);
}
.method.post { color: var(--post); }
.method.put { color: var(--put); }
.method.patch { color: var(--patch); }
.method.delete { color: var(--delete); }
.method.event { color: var(--navy-2); }
.method-badge {
  display: inline-block; padding: 4px 8px; border-radius: 5px;
  font: 700 12px/1 var(--mono); text-transform: uppercase; color: #fff;
  background: var(--get);
}
.method-badge.post { background: var(--post); }
.method-badge.put { background: var(--put); }
.method-badge.patch { background: var(--patch); }
.method-badge.delete { background: var(--delete); }
.method-badge.event { background: var(--navy-2); }

/* Sections: prose on the left, code on the right */
.doc-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}
.prose { padding: 40px 40px 44px; max-width: 760px; min-width: 0; }
.code-col {
  padding: 40px 32px;
  background: var(--code-bg);
  min-width: 0;
}
.code-col:empty { padding: 0; }
.code-col .code-block + .code-block { margin-top: 20px; }
.doc-section.tag-section { background: var(--bg-soft); }
.doc-section.tag-section .prose { padding-bottom: 28px; }

.prose h1 { font-size: 34px; line-height: 1.2; margin: 0 0 12px; color: var(--navy); letter-spacing: -0.4px; }
.prose h2 { font-size: 24px; line-height: 1.3; margin: 0 0 12px; color: var(--navy); letter-spacing: -0.2px; }
.prose h3 { font-size: 16px; margin: 26px 0 8px; color: var(--navy); }
.prose h4 { font-size: 13px; margin: 26px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--faint); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--blue); margin: 0 0 6px !important; }
.lead { font-size: 17px; color: #33475a; }
.anchor { color: inherit; }
.anchor:hover { text-decoration: none; color: var(--blue-dark); }

.table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 14px; }
.table th, .table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg-soft); border-top: 1px solid var(--line); }
.table td:first-child { white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 8px 0 16px; }
.table-wrap .table { margin: 0; }

/* Code blocks */
.code-block {
  background: var(--code-bg-2);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.code-head {
  display: flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 8px 0 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--code-muted);
  font: 600 12px var(--sans);
}
.code-head > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-block pre, .inline-pre {
  margin: 0; padding: 14px 16px;
  overflow-x: auto;
  color: var(--code-text);
  line-height: 1.55;
  tab-size: 2;
}
.code-block pre { max-height: 560px; }
.inline-pre { background: var(--code-bg-2); border-radius: 8px; margin: 4px 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-btn {
  margin-left: auto; flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 6px;
  background: transparent; color: var(--code-muted);
  font: 600 11.5px var(--sans); padding: 4px 9px; cursor: pointer;
}
.copy-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.copy-btn.done { color: #7ee2b0; border-color: rgba(126, 226, 176, 0.5); }
.tabs { gap: 2px; padding-left: 6px; }
.tabs button {
  border: 0; background: transparent; color: var(--code-muted);
  font: 600 12px var(--sans); padding: 11px 10px 9px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tabs button:hover { color: #fff; }
.tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--blue); }
.tabbed.js-tabs pre + pre { border-top: 0; }
.tabbed:not(.js-tabs) pre + pre { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.status-code { font-family: var(--mono); font-weight: 700; }
.tok-key { color: #8fd3ff; }
.tok-str { color: #a9e5a0; }
.tok-num { color: #ffc98a; }
.tok-lit { color: #f5a3c7; }

/* Endpoint sections */
.op-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.op-path { font: 600 14.5px var(--mono); color: var(--navy); overflow-wrap: anywhere; }
.op-path .param { color: var(--blue-dark); }
.op-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: #e8f4fc; color: var(--navy-2);
  border: 1px solid #cfe6f5;
}
.pill code { background: transparent; border: 0; padding: 0; color: inherit; font-size: 12px; }
.pill.warn { background: #fff4e5; color: #8a4b00; border-color: #fbdcb3; }
.pill.muted { background: var(--bg-soft); color: var(--muted); border-color: var(--line); }

.param-table td:first-child { width: 34%; }
.param-name { font: 600 13px var(--mono); color: var(--navy); overflow-wrap: anywhere; }
.param-in { display: block; font-size: 11.5px; color: var(--faint); }
.type { font: 12px var(--mono); color: var(--muted); }
.req { font-size: 11px; font-weight: 700; color: #c2372f; text-transform: uppercase; letter-spacing: 0.4px; margin-left: 6px; }
.desc { color: #3a4c5d; font-size: 14px; }
.desc p { margin: 2px 0 6px; }
.desc p:last-child { margin-bottom: 0; }
.constraints { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.constraints code { font-size: 11.5px; }

/* Schema tree */
.schema { border: 1px solid var(--line); border-radius: 8px; margin: 6px 0 16px; background: #fff; }
.schema-note { padding: 10px 14px; color: var(--muted); font-size: 13.5px; }
.prop-list { list-style: none; margin: 0; padding: 0; }
.prop { padding: 10px 14px; border-top: 1px solid var(--line-2); }
.prop-list > .prop:first-child { border-top: 0; }
.prop-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.prop .desc { margin-top: 2px; }
.children { margin-top: 8px; }
.children > .prop-list, .children > .variants { border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); }
.children .prop { border-top-color: var(--line); }
details.nest > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--blue-dark);
  list-style: none; display: inline-flex; align-items: center; gap: 4px;
}
details.nest > summary::-webkit-details-marker { display: none; }
details.nest > summary::before { content: "+"; font: 700 13px/1 var(--mono); width: 14px; }
details.nest[open] > summary::before { content: "−"; }
details.nest[open] > summary { margin-bottom: 8px; }
.variants { padding: 8px 12px; }
.variant-label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 0 4px; }
.enum-list { display: inline; }
.enum-list code { margin-right: 3px; }

.responses { margin: 6px 0 16px; }
.response { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: #fff; }
.response > summary {
  display: flex; align-items: baseline; gap: 10px; cursor: pointer;
  padding: 10px 14px; list-style: none;
}
.response > summary::-webkit-details-marker { display: none; }
.response > summary::after { content: "+"; margin-left: auto; font: 700 14px var(--mono); color: var(--faint); }
.response[open] > summary::after { content: "−"; }
.response[open] > summary { border-bottom: 1px solid var(--line-2); }
.response .body { padding: 10px 14px 4px; }
.response .schema { margin-top: 0; }
.code-2xx { color: var(--get); }
.code-3xx { color: var(--put); }
.code-4xx, .code-5xx { color: var(--delete); }
.resp-headers { font-size: 13px; margin: 0 0 10px; }

.op-section.search-hidden, .tag-section.search-hidden, .nav-group.search-hidden, .nav-ops li.search-hidden { display: none; }

.spec-error { border: 1px solid #f3c2bd; background: #fff4f2; color: #7d2019; border-radius: 8px; padding: 12px 14px; }
.footer { padding: 28px 40px 48px; color: var(--muted); font-size: 13px; }

/* Stack code under prose on medium screens */
@media (max-width: 1199px) {
  .doc-section { grid-template-columns: minmax(0, 1fr); }
  .prose { max-width: 820px; padding-bottom: 12px; }
  .code-col { background: transparent; padding: 0 40px 40px; max-width: 820px; }
  .code-col:empty { display: none; }
  .code-block { border: 0; }
  .doc-section.tag-section .code-col { display: none; }
}

/* Off-canvas sidebar on small screens */
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: min(86vw, 320px);
    box-shadow: none;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 10px 40px rgba(5, 43, 70, 0.25); }
  body.nav-open { overflow: hidden; }
  .content { margin-left: 0; }
}

@media (max-width: 600px) {
  body { font-size: 15px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .spec-link { display: none; }
  .prose { padding: 28px 16px 8px; }
  .code-col { padding: 0 16px 28px; }
  .prose h1 { font-size: 28px; }
  .prose h2 { font-size: 21px; }
  .footer { padding: 24px 16px 40px; }
  .table { font-size: 13.5px; }
  .table th, .table td { padding: 7px 8px; }
  .table td:first-child { white-space: normal; }
  .param-table td:first-child { width: 40%; }
  .prop { padding: 10px 12px; }
  code, pre { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Method colours on dark code panels */
.code-block .method { color: #5fd3a0; }
.code-block .method.post { color: #6cc4f5; }
.code-block .method.put { color: #f5b465; }
.code-block .method.patch { color: #c3a4f5; }
.code-block .method.delete { color: #f58c84; }

/* Fixes */
.prose .prop-list { padding: 0; margin: 0; }
.prose .prop { margin: 0; }
.prose h3.op-title { margin-top: 0; font-size: 19px; }
.code-block { color-scheme: dark; }
.code-block pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-section { border-bottom: 0; }
.doc-section > .prose { border-bottom: 1px solid var(--line); max-width: none; }
.doc-section > .code-col { border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.doc-section > .prose > * { max-width: 760px; }
@media (max-width: 1199px) {
  .doc-section { border-bottom: 1px solid var(--line); }
  .doc-section > .prose, .doc-section > .code-col { border-bottom: 0; }
}
.code-block pre { word-break: break-all; }
.tabbed pre { white-space: pre; word-break: normal; overflow-wrap: normal; }
.table td code { overflow-wrap: normal; word-break: normal; white-space: nowrap; }
.table td:not(:first-child) code { white-space: normal; overflow-wrap: anywhere; }
.error-table td:first-child .status-code { display: inline-block; min-width: 30px; color: var(--muted); font-size: 13px; }
@media (max-width: 600px) {
  .error-table td:first-child .status-code { display: block; }
}
