:root {
  color-scheme: light;
  --bg: #fff;
  --panel: #fbfcfe;
  --panel-strong: #f3f5f8;
  --text: #172033;
  --muted: #667085;
  --border: #e5e9f0;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --code: #f7f8fa;
  --shadow: 0 18px 60px rgb(15 23 42 / 14%);
  --sidebar: 284px;
  --toc: 240px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: #10141b;
  --panel-strong: #181d27;
  --text: #edf1f7;
  --muted: #9aa4b2;
  --border: #252c38;
  --brand: #9994ff;
  --brand-soft: #242345;
  --code: #121720;
  --shadow: 0 18px 60px rgb(0 0 0 / 45%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.doc-heading a,
h1 a, h2 a, h3 a, h4 a {
  color: inherit;
  text-decoration: none;
}
.doc-heading a:hover,
h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover {
  text-decoration: none;
  color: inherit;
}
.static-label { color: inherit; cursor: default; }
.static-label:hover { text-decoration: none; }
img { max-width: 100%; height: auto; }
button, input { font: inherit; }
button { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: -60px;
  left: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}
.skip-link:focus { top: 12px; }

.topbar {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  left: var(--sidebar);
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.brand, .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 750;
  letter-spacing: -.02em;
}
.brand:hover, .sidebar-brand:hover { text-decoration: none; }
.brand img, .sidebar-brand img { width: 27px; height: 27px; }
.brand { display: none; }
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  cursor: pointer;
}
.menu-button { display: none; }
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: calc(100% - 28px);
  margin: 14px;
  padding: 8px 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}
.sidebar-search kbd { margin-left: auto; }
kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
}
.language-link {
  flex: 0 0 auto;
  margin-left: 8px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--panel);
}
.sidebar-brand { height: 64px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.sidebar-nav {
  height: calc(100vh - 122px);
  overflow: auto;
  padding: 0 12px 28px;
  scrollbar-width: thin;
}
.sidebar-nav details { margin: 2px 0; }
.sidebar-nav summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  list-style: none;
  cursor: pointer;
  border-radius: 8px;
}
.sidebar-nav summary::-webkit-details-marker { display: none; }
.sidebar-nav summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 11px;
  transition: transform .15s ease;
}
.sidebar-nav details:not([open]) > summary::after { transform: rotate(-90deg); }
.sidebar-nav summary:hover { background: var(--panel-strong); }
.sidebar-nav .nav-children { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line); }
.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
  padding: 6px 9px;
  overflow: hidden;
  color: var(--muted);
  border-radius: 8px;
  text-decoration: none;
}
.sidebar-nav a > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-nav a:hover { background: var(--panel-strong); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.sidebar-nav .method {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}
.sidebar-nav .method-get { color: #1a7f37; }
.sidebar-nav .method-post { color: #0969da; }
.sidebar-nav .method-put { color: #9a6700; }
.sidebar-nav .method-delete { color: #cf222e; }
[data-theme="dark"] .sidebar-nav .method-get { color: #3fb950; }
[data-theme="dark"] .sidebar-nav .method-post { color: #58a6ff; }
[data-theme="dark"] .sidebar-nav .method-put { color: #d29922; }
[data-theme="dark"] .sidebar-nav .method-delete { color: #ff7b72; }

.page {
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding: 84px calc(var(--toc) + 58px) 80px 58px;
}
.section-tabs {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  overflow-x: auto;
  border-bottom: 0;
  background: transparent;
  scrollbar-width: thin;
}
.section-tab {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 100%;
  padding: 0 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-weight: 650;
  white-space: nowrap;
}
.section-tab:hover { color: var(--text); text-decoration: none; }
.section-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
article { width: min(100%, 860px); margin: 0 auto; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.025em; color: var(--text); }
h1 { margin: 0 0 16px; font-size: clamp(2rem, 4vw, 2.65rem); }
h2, .doc-h2 {
  margin: 2.2em 0 .75em;
  padding: .15em 0 .45em;
  border-bottom: 1px solid var(--border);
  font-size: 1.45rem;
  font-weight: 750;
}
h3, .doc-h3 {
  margin: 1.7em 0 .55em;
  font-size: 1.18rem;
  font-weight: 700;
}
h4, .doc-h4 { margin: 1.4em 0 .45em; font-size: 1rem; font-weight: 700; }
.prose h2 svg,
.prose h3 svg,
.prose h4 svg,
.doc-heading svg { display: none !important; }
.lead { margin: 0 0 28px; color: var(--muted); font-size: 1.08rem; }
.prose {
  color: var(--text);
}
.prose > :first-child { margin-top: 0; }
p, ul, ol { margin-top: .65em; margin-bottom: .9em; }
li + li { margin-top: .28em; }
hr { margin: 2.2rem 0; border: 0; border-top: 1px solid var(--border); }
blockquote {
  margin: 1.4rem 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 12px 12px 0;
}
table { width: 100%; margin: 1.4rem 0; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--panel-strong); }
code {
  padding: .15em .38em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--code);
  color: color-mix(in srgb, var(--brand) 55%, var(--text));
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .88em;
}
pre,
pre.doc-pre,
figure.doc-code pre {
  position: relative;
  overflow: auto;
  margin: 1.3rem 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code) !important;
  color: var(--text);
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
}
pre code,
figure.doc-code code,
.doc-pre code {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-size: .92em;
  white-space: inherit;
}
figure.doc-code,
figure[class*="shiki"] {
  display: block;
  margin: 1.25rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code);
  box-shadow: none;
}
figure.doc-code pre,
figure[class*="shiki"] pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  max-width: 100%;
}
figure.doc-code .line,
figure[class*="shiki"] .line {
  display: block;
  min-height: 1.2em;
  white-space: pre;
}
.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

/* Callouts — keep bar + text as one aligned flex row */
.doc-callout {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin: 1.2rem 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.doc-callout-bar {
  flex: 0 0 4px;
  align-self: stretch;
  margin: 2px 0;
  border-radius: 999px;
  background: var(--brand);
}
.doc-callout-body {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--text);
}
.doc-callout-body > :first-child { margin-top: 0; }
.doc-callout-body > :last-child { margin-bottom: 0; }
.doc-callout-title {
  margin: 0 0 .35rem;
  color: var(--text);
  font-weight: 700;
}
.doc-callout-info { background: var(--brand-soft); background: color-mix(in srgb, var(--brand-soft) 70%, var(--panel)); }
.doc-callout-info .doc-callout-bar { background: #2563eb; }
.doc-callout-warning { background: #fff8eb; }
.doc-callout-warning .doc-callout-bar { background: #d97706; }
.doc-callout-error { background: #fff1f1; }
.doc-callout-error .doc-callout-bar { background: #dc2626; }
.doc-callout-success { background: #effcf3; }
.doc-callout-success .doc-callout-bar { background: #16a34a; }
[data-theme="dark"] .doc-callout-warning { background: #2a2114; }
[data-theme="dark"] .doc-callout-error { background: #2a1616; }
[data-theme="dark"] .doc-callout-success { background: #14241a; }

/* Steps */
.doc-steps {
  margin: 1.4rem 0;
  padding-left: 0;
  border-left: 0;
}
.doc-step {
  position: relative;
  margin: 0 0 1.2rem;
  padding: 0 0 0.4rem 2.4rem;
}
.doc-step::before {
  content: attr(data-step);
  position: absolute;
  top: 0;
  left: 0;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 750;
}
.doc-step:not([data-step])::before {
  content: "";
  background: var(--brand);
  width: .7rem;
  height: .7rem;
  top: .55rem;
  left: .5rem;
}
.doc-step h3 { margin-top: 0; }

/* OpenAPI / API panels */
.api-panel {
  display: block;
  margin: 1.2rem 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}
.api-panel .doc-code {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
}
.api-endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel-strong) 80%, var(--panel));
  font-family: "SFMono-Regular", Consolas, monospace;
}
.api-endpoint code {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  word-break: break-all;
}
.api-endpoint .method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.4rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 750;
}
.api-endpoint .method-get { color: #1a7f37; }
.api-endpoint .method-post { color: #0969da; }
.api-endpoint .method-put { color: #9a6700; }
.api-endpoint .method-delete { color: #cf222e; }
.api-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 1.4rem 0 .6rem;
}
.api-section-head h2,
.api-section-head h3 {
  margin: 0;
  border-bottom: 0;
  padding-bottom: 0;
}
.api-section-note {
  margin: 0 !important;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.api-fields {
  margin: 0 0 1.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.api-field {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.api-field:first-child { border-top: 0; }
.api-field-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 4px;
}
.api-field-name {
  padding: .1em .35em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--code);
  color: var(--text);
  font-size: .86em;
}
.api-field-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.4;
}
.api-field-flag-required {
  background: #fff1f1;
  color: #b42318;
}
.api-field-flag-optional {
  background: var(--panel-strong);
  color: var(--muted);
}
.api-field-type {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}
.api-field-desc {
  margin: .2rem 0 0;
  color: var(--text);
  font-size: 14px;
}
.api-field-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.api-field-meta code {
  margin-left: 4px;
}
.api-field .api-fields {
  margin: 8px 0 0;
}

.prose.flex-1 { flex: 1 1 auto; min-width: 0; }
figure { margin: 1.5rem 0; }
figure img, .prose > img, .prose p img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.doc-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 1rem 0 1.4rem;
}
.doc-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, white), var(--panel));
  color: var(--text);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.doc-card:hover {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgb(15 23 42 / 8%);
  text-decoration: none;
  color: var(--text);
}
.doc-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--brand);
}
.doc-card-icon svg { width: 18px; height: 18px; }
.doc-card-title {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.doc-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.home-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 1.25rem 0 0.5rem;
}
.home-card {
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, white), var(--panel));
  color: var(--text);
  text-decoration: none;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 8px 24px rgb(15 23 42 / 4%);
}
.home-card:hover {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgb(15 23 42 / 8%);
  text-decoration: none;
  color: var(--text);
}
.home-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--brand);
  box-shadow: none;
}
.home-card-icon svg { width: 18px; height: 18px; }
.home-card-title {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}
.home-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.knowledge-base-card {
  border-color: color-mix(in srgb, var(--brand) 22%, var(--border));
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--brand-soft) 70%, var(--panel)), var(--panel));
}
.support-email {
  margin: 0.75rem 0 0;
  font-size: 1rem;
}
.support-email a {
  color: var(--brand);
  font-weight: 650;
  text-decoration: none;
}
.support-email a:hover { text-decoration: underline; }
.home-cards + .prose > p:first-of-type,
.prose:has(.home-cards) > p:first-of-type {
  margin-top: 0;
  color: var(--muted);
}
.prose > p:first-of-type {
  margin-top: 0;
}
.rounded-xl { border-radius: 12px; }
.border { border: 1px solid var(--border); }

/* Quick Start: first section heading sits closer under the lead. */
body[data-category="index"] article h2.doc-h2:first-of-type,
body[data-category="index"] .prose h2:first-of-type {
  margin-top: 0.35rem;
}

.article-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.toc {
  position: fixed;
  z-index: 20;
  top: 94px;
  right: 24px;
  width: var(--toc);
  max-height: calc(100vh - 120px);
  overflow: auto;
  color: var(--muted);
  font-size: 13px;
}
.toc > strong { display: block; margin-bottom: 8px; color: var(--text); }
.toc-links a { display: block; padding: 4px 0; color: var(--muted); }
.toc-links .toc-h3 { padding-left: 12px; }

.search-dialog {
  width: min(720px, calc(100vw - 30px));
  max-height: min(680px, calc(100vh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}
.search-dialog::backdrop { background: rgb(15 23 42 / 48%); backdrop-filter: blur(3px); }
.dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}
.search-dialog label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 48px 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-dialog input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 17px; }
.search-results { max-height: 560px; overflow: auto; padding: 10px; }
.search-results > p { padding: 14px; color: var(--muted); }
.search-result { display: block; padding: 12px 14px; border-radius: 10px; color: var(--text); }
.search-result:hover, .search-result.selected { background: var(--panel-strong); text-decoration: none; }
.search-result strong { display: block; }
.search-result span { color: var(--muted); font-size: 13px; }
.sidebar-backdrop { display: none; }

@media (max-width: 1180px) {
  .toc { display: none; }
  .page { padding-right: 48px; }
}

@media (max-width: 820px) {
  .topbar { left: 0; padding: 0 10px; }
  .brand, .menu-button { display: flex; }
  .menu-button { align-items: center; justify-content: center; }
  .brand span { display: none; }
  .language-link { margin-left: 4px; }
  .sidebar { transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    z-index: 45;
    inset: 0;
    background: rgb(15 23 42 / 42%);
  }
  body.menu-open .sidebar-backdrop { display: block; }
  .page { margin-left: 0; padding: 84px 22px 64px; }
  .section-tabs {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0 4px;
  }
  .section-tab { padding: 0 10px; font-size: 13px; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .doc-card-grid,
  .home-cards { grid-template-columns: 1fr; }
  .home-card { min-height: 0; }
  .article-footer { flex-direction: column; gap: 8px; }
  .page { padding-right: 17px; padding-left: 17px; }
  .topbar { gap: 8px; }
}

@media print {
  .topbar, .sidebar, .toc, .search-dialog, .sidebar-backdrop { display: none !important; }
  .page { margin: 0; padding: 0; }
  article { width: 100%; }
}
