:root {
  color-scheme: light;
  --ink: #15171a;
  --muted: #5c6470;
  --line: #dce3eb;
  --soft: #f5f8fb;
  --panel: #ffffff;
  --brand: #2387c9;
  --brand-strong: #0e6fae;
  --ok: #168b58;
  --warn: #b66d00;
  --danger: #bf3434;
  --code: #101820;
  --shadow: 0 18px 50px rgba(24, 40, 56, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.58;
}

a {
  color: var(--brand-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  padding: 12px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand img {
  width: auto;
  max-width: 178px;
  max-height: 42px;
  height: auto;
  display: block;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-switcher {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  background: #edf3f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.language-switcher button,
.outline-action {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.language-switcher button.is-active {
  color: white;
  background: var(--brand);
}

.outline-action {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.primary-action,
.outline-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 800;
}

.primary-action {
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 13px;
  background: var(--brand);
  color: white;
}

.primary-action:hover {
  background: var(--brand-strong);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  gap: 0;
  max-width: 1760px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 74px;
  height: calc(100vh - 74px);
  padding: 28px 18px 32px clamp(18px, 3vw, 38px);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fbfdff;
}

.sidebar-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: #2f3945;
  font-size: 0.94rem;
  border-left: 3px solid transparent;
}

.sidebar a[data-endpoint-nav-link] {
  padding-left: 20px;
  color: #516070;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
}

.sidebar a[data-endpoint-nav-link]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 999px;
  background: #9eb1c4;
  vertical-align: middle;
}

.sidebar a:hover {
  background: #edf5fb;
  text-decoration: none;
}

.sidebar a.is-active {
  border-left-color: var(--brand);
  background: #e8f4fb;
  color: var(--brand-strong);
  font-weight: 800;
}

.sidebar a[data-endpoint-nav-link].is-active::before {
  background: var(--brand);
}

.content {
  min-width: 0;
  padding: 34px clamp(16px, 3vw, 42px) 72px;
}

.hero {
  display: grid;
  gap: 22px;
  padding: clamp(26px, 5vw, 54px);
  background:
    linear-gradient(135deg, rgba(35, 135, 201, 0.1), rgba(255, 255, 255, 0) 48%),
    white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  color: var(--brand-strong);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  line-height: 1.16;
  letter-spacing: 0;
}

h1 {
  max-width: 920px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.25rem);
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(1.55rem, 2.5vw, 2.25rem);
}

h3 {
  margin: 0 0 10px;
  font-size: 1.18rem;
}

h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

p {
  margin: 0 0 14px;
}

.lead {
  max-width: 900px;
  color: #3d4652;
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfd;
  color: #33404c;
  font-size: 0.88rem;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hero-grid,
.grid-2,
.grid-3 {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric,
.card,
.endpoint-card,
.callout {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.94rem;
}

.section {
  margin-top: 36px;
  padding: clamp(24px, 4vw, 38px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  scroll-margin-top: 96px;
}

.hero {
  scroll-margin-top: 96px;
}

.section > p {
  color: #3f4854;
}

.card,
.endpoint-card {
  padding: 20px;
}

.endpoint-card {
  margin-top: 16px;
}

.endpoint-page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 370px);
  grid-template-areas:
    "tabs code"
    "content code";
  gap: 22px;
  align-items: start;
  margin-top: 22px;
}

.endpoint-tabs {
  grid-area: tabs;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.endpoint-tabs button {
  flex: 0 0 auto;
  min-width: 148px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
  color: #33404c;
  text-align: left;
  cursor: pointer;
}

.endpoint-tabs button:hover,
.endpoint-tabs button.is-active {
  border-color: rgba(35, 135, 201, 0.42);
  background: #eef7fd;
}

.endpoint-tabs span {
  display: block;
  color: var(--brand-strong);
  font-size: 0.72rem;
  font-weight: 900;
}

.endpoint-tabs strong {
  display: block;
  margin-top: 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  word-break: break-word;
}

.endpoint-page-content {
  grid-area: content;
  min-width: 0;
}

.endpoint-page-content .endpoint-card {
  margin-top: 0;
}

.endpoint-page-content .endpoint-card details {
  display: none;
}

.endpoint-code-panel {
  grid-area: code;
  position: sticky;
  top: 94px;
  min-width: 0;
}

.code-panel-card {
  overflow: hidden;
  border: 1px solid #253449;
  border-radius: 8px;
  background: #172235;
  box-shadow: 0 18px 42px rgba(23, 34, 53, 0.18);
}

.code-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #edf6ff;
}

.code-panel-head strong {
  min-width: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  word-break: break-word;
}

.code-tools-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
}

.code-select-label {
  display: grid;
  gap: 8px;
  color: #cdd9e5;
  font-size: 0.82rem;
  font-weight: 800;
}

.code-select-label select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 8px 10px;
  background: #eef4fb;
  color: #1c2735;
}

.code-copy-button {
  justify-self: end;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.code-copy-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.endpoint-code-panel pre {
  max-height: calc(100vh - 250px);
  margin: 0;
  border-radius: 0;
  background: #172235;
  font-size: 0.82rem;
}

.auth-code-panel {
  margin-top: 18px;
}

.auth-code-card pre {
  max-height: 520px;
  margin: 0;
  border-radius: 0;
  background: #172235;
  font-size: 0.84rem;
}

.response-examples {
  margin: 10px 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfdff;
}

.response-tabs {
  display: flex;
  gap: 6px;
  padding: 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #f5f8fb;
}

.response-tabs button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: white;
  color: #33404c;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.response-tabs button.is-active,
.response-tabs button:hover {
  border-color: rgba(35, 135, 201, 0.45);
  background: #eaf5fc;
  color: var(--brand-strong);
}

.response-examples pre {
  margin: 0;
  border-radius: 0;
}

.endpoint-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.method {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 6px;
  color: white;
  font-weight: 900;
  font-size: 0.78rem;
}

.get {
  background: #1471b8;
}

.post {
  background: #168b58;
}

.put {
  background: #9a6410;
}

.path {
  margin-left: 10px;
  color: #202a35;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-weight: 800;
  word-break: break-word;
}

.auth-note {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dense-table {
  margin: 14px 0 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: white;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f4f8fb;
  color: #2c3642;
  font-size: 0.88rem;
}

td {
  color: #38424e;
}

tr:last-child td {
  border-bottom: 0;
}

.dense-table table {
  min-width: 980px;
}

.dense-table th {
  white-space: nowrap;
}

.dense-table td {
  font-size: 0.92rem;
}

.dense-table td:first-child {
  width: 180px;
}

code,
kbd {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:not(pre) > code,
kbd {
  padding: 2px 5px;
  border-radius: 5px;
  background: #edf3f8;
  color: #23313f;
  font-size: 0.92em;
}

pre {
  position: relative;
  margin: 14px 0 0;
  padding: 18px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--code);
  color: #eaf2f8;
  font-size: 0.9rem;
  line-height: 1.55;
}

pre code {
  color: inherit;
}

details {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

details[open] {
  background: white;
}

summary {
  min-height: 42px;
  padding: 10px 14px;
  color: #23313f;
  font-weight: 800;
  cursor: pointer;
}

details pre {
  margin: 0;
  border-radius: 0 0 8px 8px;
}

.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
  font-size: 0.78rem;
}

.callout {
  margin: 16px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--brand);
  background: #f8fbfd;
}

.callout.warn {
  border-left-color: var(--warn);
}

.callout.danger {
  border-left-color: var(--danger);
}

.checklist {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
}

.checklist li::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border: 2px solid var(--brand);
  border-radius: 5px;
  background: white;
}

.footer {
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.92rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px;
  }

  .sidebar nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .hero-grid,
  .grid-2,
  .grid-3,
  .endpoint-page-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tabs"
      "content"
      "code";
  }

  .endpoint-code-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand img {
    max-width: 150px;
    max-height: 38px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .endpoint-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-note {
    white-space: normal;
  }
}

@media print {
  .topbar,
  .sidebar,
  .copy-button,
  .outline-action {
    display: none !important;
  }

  body {
    background: white;
  }

  .layout,
  .content {
    display: block;
    max-width: none;
    padding: 0;
  }

  .section,
  .hero,
  .endpoint-card,
  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}
