:root {
  --ink: #1c2430;
  --muted: #5c6b80;
  --faint: #8b97a8;
  --line: #e6e9ef;
  --line-strong: #d8dee8;
  --bg: #ffffff;
  --soft: #f6f8fb;
  --blue: #175cd3;
  --blue-soft: #eef4ff;
  --green: #067647;
  --green-soft: #ecfdf3;
  --orange: #b54708;
  --orange-soft: #fff6ed;
  --red: #b42318;
  --red-soft: #fef3f2;
  --code-bg: #0f1419;
  --code-ink: #e6edf3;
  --header: 72px;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
code {
  font-family: var(--mono);
  font-size: 0.86em;
}
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--ink);
  color: white;
  padding: 6px 10px;
  z-index: 80;
}
.skip:focus { top: 8px; }

header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.logo {
  height: 56px;
  width: auto;
  display: block;
}
.top-nav { display: flex; gap: 4px; }
.top-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 550;
  font-size: 14px;
}
.top-nav a[aria-current="page"] { background: var(--blue-soft); color: var(--blue); }
.spacer { flex: 1; }
.menu-btn, .icon-btn {
  display: none;
  border: 1px solid var(--line-strong);
  background: white;
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--ink);
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 440px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--header);
  height: calc(100vh - var(--header));
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 16px 12px 32px;
  background: #fff;
}
.search {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 14px;
  outline: none;
}
.search:focus { border-color: #b9d0fb; background: white; box-shadow: 0 0 0 3px #e7f0ff; }
.nav-group { margin-bottom: 8px; }
.nav-label {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 8px 6px;
  cursor: pointer;
}
.nav-label::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(45deg);
  margin-right: 4px;
}
.nav-group.is-collapsed .nav-label::after { transform: rotate(-45deg); }
.nav-group.is-collapsed .nav-items { display: none; }
.nav-items a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #344054;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13.5px;
}
.nav-items a:hover { background: var(--soft); }
.nav-items a.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav-items .mini {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--faint);
  width: 36px;
  flex: none;
}
.nav-items a.active .mini { color: var(--blue); }
.mini.GET { color: var(--blue); }
.mini.POST { color: var(--green); }
.mini.PUT { color: var(--orange); }
.mini.DELETE { color: var(--red); }
.nav-empty { color: var(--faint); font-size: 13px; padding: 8px; display: none; }
.sidebar.is-filtering .nav-group.is-collapsed .nav-items { display: block; }

main {
  padding: 36px 48px 96px;
  min-width: 0;
}
.page { scroll-margin-top: 88px; }
.page + .page { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.kicker {
  color: var(--faint);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
h1, h2 { letter-spacing: -0.025em; line-height: 1.2; margin: 0 0 10px; }
h1 { font-size: 32px; }
h2 { font-size: 26px; }
.lead, .prose p { color: #3e4c5e; margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }
.endpoint-line { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.path {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}
.full-url {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  margin: 0 0 16px;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.method.GET { color: var(--blue); background: #eff8ff; }
.method.POST { color: var(--green); background: var(--green-soft); }
.method.PUT { color: var(--orange); background: var(--orange-soft); }
.method.DELETE { color: var(--red); background: var(--red-soft); }

.switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0 18px;
  background: white;
}
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0;
  background: white;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--muted);
}
.seg button.on { background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.host-readout { font-family: var(--mono); font-size: 13px; color: var(--ink); }

.callout {
  border: 1px solid #d6e4ff;
  background: #f5f8ff;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  color: #24344d;
}
.callout.warn { border-color: #f5d9a8; background: #fff8ee; }
.callout strong { font-weight: 650; }
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }

.schema {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0 8px;
  background: white;
}
.schema h3 {
  margin: 0;
  padding: 10px 14px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-top: 1px solid var(--line); }
th {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
  border-top: 0;
}
td code { font-size: 12.5px; color: #1d2939; }
.type { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.need {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.need.required { color: var(--red); background: var(--red-soft); }
.need.optional { color: #475467; background: #f2f4f7; }
.need.conditional { color: var(--orange); background: var(--orange-soft); }
.group-row td {
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.desc { color: #3e4c5e; font-size: 13.5px; }

.matrix { width: 100%; margin: 8px 0 16px; }
.matrix td, .matrix th { font-size: 13.5px; }

.steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.step {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 120px;
  background: white;
}
.step b { display: block; font-family: var(--mono); font-size: 12px; }
.step span { color: var(--muted); font-size: 13px; }

.code-panel {
  position: sticky;
  top: var(--header);
  height: calc(100vh - var(--header));
  overflow: auto;
  background: var(--code-bg);
  color: var(--code-ink);
}
.inline-sample { display: none; }
.sample {
  padding: 18px 16px 28px;
}
.sample-kicker {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.sample-kicker h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aa6b2;
  font-weight: 650;
}
.sample .endpoint-line { margin: 4px 0 12px; }
.sample .path { color: #d0d7de; }
.seg.dark { border-color: #2c3541; }
.seg.dark button { background: transparent; color: #9aa6b2; }
.seg.dark button.on { background: #1c2633; color: white; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid #2c3541;
  margin-bottom: 0;
}
.tabs button {
  border: 0;
  background: transparent;
  color: #9aa6b2;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tabs button.on { color: white; border-bottom-color: #3b82f6; }
.code-block { position: relative; }
.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid #2c3541;
  background: #161b22;
  color: #d0d7de;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
}
.copy:hover { border-color: #4b5563; }
.code-block pre {
  margin: 0;
  padding: 16px 16px 18px;
  overflow: auto;
  max-height: 420px;
  background: #0d1117;
}
.code-block pre code.hljs,
.hljs { background: transparent; padding: 0; }
.resp-note { color: #9aa6b2; font-size: 12.5px; margin: 8px 0 0; }
.sample .tabs + .code-block { border-top: 0; }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 35;
}
.scrim[hidden] { display: none; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 260px minmax(0, 1fr); }
  .code-panel { display: none; }
  .inline-sample { display: block; margin-top: 22px; }
  .inline-sample .sample {
    border-radius: 12px;
    overflow: hidden;
    background: var(--code-bg);
  }
  .inline-sample .code-block pre { max-height: none; }
  main { padding: 28px 28px 72px; }
}

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .logo { height: 44px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 40;
    top: var(--header);
    left: 0;
    bottom: 0;
    height: auto;
    width: min(320px, 88vw);
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: 8px 0 24px rgba(16, 24, 40, 0.08);
  }
  .sidebar.open { transform: none; }
  main { padding: 22px 16px 64px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  table { display: block; overflow-x: auto; }
}

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