:root {
  color-scheme: light;
  --purple: #8f52ff;
  --purple-strong: #7640dd;
  --purple-soft: #f3edff;
  --ink: #17171b;
  --muted: #666672;
  --faint: #92929d;
  --line: #e7e7ec;
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --surface-3: #f1f1f4;
  --code: #15131b;
  --code-line: #292531;
  --header-height: 68px;
  --sidebar-width: 270px;
  --toc-width: 230px;
  --shadow: 0 16px 50px rgba(24, 15, 41, .10);
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f2f8;
  --muted: #aaa6b5;
  --faint: #817d8c;
  --line: #2d2935;
  --surface: #121116;
  --surface-2: #18171d;
  --surface-3: #211e28;
  --purple-soft: rgba(143, 82, 255, .14);
  --code: #0c0b0f;
  --code-line: #25222c;
  --shadow: 0 18px 60px rgba(0, 0, 0, .36);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 34px); }
body { margin: 0; color: var(--ink); background: var(--surface); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.7; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
code, pre, kbd { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace; }
p { margin: 0 0 16px; color: var(--muted); }
h1, h2, h3 { margin: 0; letter-spacing: -.035em; line-height: 1.15; }
h2 { margin-bottom: 18px; font-size: clamp(29px, 4vw, 40px); font-weight: 750; }
h3 { margin: 32px 0 12px; font-size: 19px; }
code { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--ink); font-size: .88em; }

.topbar { position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-height); display: flex; align-items: center; gap: 26px; padding: 0 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; min-width: calc(var(--sidebar-width) - 28px); gap: 10px; }
.brand-logo { display: block; width: 96px; height: auto; object-fit: contain; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: white; background: var(--purple); font-size: 20px; font-weight: 800; letter-spacing: -.08em; box-shadow: 0 8px 20px rgba(143, 82, 255, .25); }
.brand-mark.small { width: 28px; height: 28px; border-radius: 7px; font-size: 16px; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.04em; }
.brand-product { margin-left: 3px; padding-left: 12px; border-left: 1px solid var(--line); color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.search-trigger { display: flex; width: min(430px, 36vw); height: 38px; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--faint); background: var(--surface-2); cursor: pointer; }
.search-trigger:hover { border-color: color-mix(in srgb, var(--purple) 46%, var(--line)); }
.search-trigger svg, .search-input-wrap svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.search-trigger span { flex: 1; text-align: left; font-size: 12px; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--faint); font-size: 10px; box-shadow: 0 1px 0 var(--line); }
.top-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; font-size: 12px; font-weight: 600; }
.top-actions > a:hover { color: var(--purple); }
.dashboard-link { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 7px; }
.icon-button { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.moon, [data-theme="dark"] .sun { display: none; }
[data-theme="dark"] .moon { display: block; }
.menu-button { display: none; width: 38px; height: 38px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: transparent; }
.menu-button span { display: block; height: 1px; margin: 4px 0; background: currentColor; }

.page-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width); max-width: 1540px; margin: 0 auto; padding-top: var(--header-height); }
.sidebar { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); display: flex; flex-direction: column; padding: 28px 24px 22px 28px; border-right: 1px solid var(--line); overflow-y: auto; }
.nav-group { margin-bottom: 24px; }
.nav-group > p { margin: 0 0 7px 12px; color: var(--faint); font-size: 10px; font-weight: 750; letter-spacing: .105em; text-transform: uppercase; }
.nav-group a { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 6px 11px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 530; }
.nav-group a:hover { color: var(--ink); background: var(--surface-2); }
.nav-group a.active { color: var(--purple); background: var(--purple-soft); font-weight: 650; }
.nav-group a.active::before { position: absolute; left: 0; width: 2px; height: 14px; border-radius: 4px; background: var(--purple); content: ""; }
.sidebar-help { display: flex; gap: 10px; margin-top: auto; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 11px; }
.sidebar-help div { display: grid; }
.sidebar-help strong { font-size: 11px; }
.sidebar-help a { color: var(--purple); }
.status-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: #2fc981; box-shadow: 0 0 0 4px rgba(47, 201, 129, .12); }

.content { width: min(100%, 880px); min-width: 0; margin: 0 auto; padding: 0 58px; }
.doc-section { padding: 88px 0; border-bottom: 1px solid var(--line); }
.hero { padding-top: 92px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; color: var(--purple); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.version { padding: 2px 7px; border-radius: 99px; color: var(--purple); background: var(--purple-soft); font-size: 9px; }
.hero h1 { max-width: 730px; margin-bottom: 24px; font-size: clamp(45px, 6.2vw, 72px); font-weight: 780; letter-spacing: -.065em; }
.hero h1 span { color: var(--purple); }
.hero-copy { max-width: 690px; font-size: 18px; line-height: 1.72; }
.hero-actions { display: flex; gap: 10px; margin: 32px 0 56px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 15px; min-height: 43px; padding: 0 18px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-weight: 700; }
.button.primary { border-color: var(--purple); color: white; background: var(--purple); box-shadow: 0 9px 24px rgba(143, 82, 255, .23); }
.button.primary:hover { background: var(--purple-strong); }
.button.secondary:hover { border-color: var(--purple); color: var(--purple); }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.principle-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.principle-grid h3 { margin: 18px 0 7px; font-size: 15px; }
.principle-grid p { margin: 0; font-size: 12px; line-height: 1.6; }
.card-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 6px; color: var(--purple); background: var(--purple-soft); font: 600 10px "JetBrains Mono"; }
.section-kicker { margin-bottom: 12px; color: var(--purple); font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.lead { max-width: 690px; font-size: 16px; }

.steps { margin: 34px 0; }
.steps article { display: grid; grid-template-columns: 44px 1fr; gap: 16px; padding: 19px 0; border-top: 1px solid var(--line); }
.steps article:last-child { border-bottom: 1px solid var(--line); }
.steps article > span { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid color-mix(in srgb, var(--purple) 38%, var(--line)); border-radius: 50%; color: var(--purple); font: 600 11px "JetBrains Mono"; }
.steps h3 { margin: 1px 0 5px; font-size: 15px; }
.steps p { margin: 0; font-size: 13px; }
.callout { margin: 28px 0; padding: 17px 19px; border: 1px solid var(--line); border-left: 3px solid var(--purple); border-radius: 7px; background: var(--surface-2); }
.callout strong { display: block; margin-bottom: 4px; font-size: 12px; }
.callout p { margin: 0; font-size: 12px; }
.callout.warning { border-left-color: #e5a127; background: color-mix(in srgb, #fff5dc 65%, var(--surface)); }
[data-theme="dark"] .callout.warning { background: rgba(229, 161, 39, .08); }
.callout.info { border-left-color: #4c92ff; }

.environment-card { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 20px; margin: 28px 0 18px; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.environment-card > div { display: grid; gap: 3px; }
.environment-card p { margin: 0; font-size: 11px; }
.environment-card code { width: fit-content; }
.environment-badge { width: fit-content; color: #19895c; font-size: 11px; font-weight: 700; }
.environment-badge::before { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #2fc981; content: ""; }
.copy-button, .copy-code { border: 0; color: var(--faint); background: transparent; font-size: 10px; font-weight: 600; cursor: pointer; }
.copy-button:hover, .copy-code:hover { color: var(--purple); }
.header-example { display: flex; align-items: center; gap: 15px; margin: 24px 0 32px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); }
.header-example span { color: var(--purple); font: 600 11px "JetBrains Mono"; }
.header-example code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field-table { margin: 18px 0 30px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.field-row { display: grid; grid-template-columns: 175px 105px 1fr; min-height: 48px; align-items: center; border-top: 1px solid var(--line); }
.field-row:first-child { border: 0; }
.field-row > * { margin: 0; padding: 11px 15px; font-size: 12px; }
.field-row > span { color: var(--faint); font-size: 11px; }
.field-row > code { border: 0; background: transparent; color: var(--purple); }
.field-row b { color: #dd4b55; }
.default-value { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 4px; color: var(--purple); background: var(--purple-soft); font-size: 9px; font-weight: 650; white-space: nowrap; }
.field-head { min-height: 38px; background: var(--surface-2); color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.field-head span { font-size: 9px; }

.code-card { margin: 24px 0; border: 1px solid var(--code-line); border-radius: 9px; background: var(--code); overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .08); }
.code-head { display: flex; min-height: 43px; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--code-line); color: #aca6b8; background: #1a1720; font-size: 10px; }
.tabs { display: flex; height: 43px; gap: 18px; }
.tabs button { position: relative; border: 0; color: #827d8b; background: transparent; font-size: 10px; cursor: pointer; }
.tabs button.active { color: white; }
.tabs button.active::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--purple); content: ""; }
.code-panel { display: none; max-height: 510px; margin: 0; padding: 20px; overflow: auto; color: #e8e5ed; font-size: 11.5px; line-height: 1.78; tab-size: 2; }
.code-panel.active { display: block; }
.code-panel code { padding: 0; border: 0; color: inherit; background: none; font-size: inherit; }
.split-code { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split-code .code-panel { min-height: 305px; }
.endpoint { display: flex; align-items: center; gap: 10px; margin: 23px 0 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.endpoint code { border: 0; background: none; font-size: 13px; }
.method { padding: 4px 8px; border-radius: 5px; font: 700 9px "JetBrains Mono"; }
.method.post { color: #755a06; background: #fff0b7; }
.method.get { color: #2668c9; background: #e4efff; }
[data-theme="dark"] .method.post { color: #ffdc70; background: rgba(255, 208, 70, .14); }
[data-theme="dark"] .method.get { color: #79afff; background: rgba(76, 146, 255, .14); }
.response-label { display: flex; align-items: center; gap: 10px; margin: 30px 0 -14px; font-size: 11px; font-weight: 700; }
.http-ok { padding: 2px 7px; border-radius: 99px; color: #19895c; background: rgba(47, 201, 129, .12); font-size: 9px; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 28px; }
.compare-grid article { padding: 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.compare-grid h3 { margin: 20px 0 9px; font-size: 17px; }
.compare-grid p, .compare-grid li { font-size: 12px; }
.compare-grid ul { margin: 18px 0 0; padding: 17px 0 0 18px; border-top: 1px solid var(--line); color: var(--muted); }
.type-pill { padding: 5px 9px; border-radius: 5px; color: var(--purple); background: var(--purple-soft); font: 700 9px "JetBrains Mono"; }
.type-pill.multi { color: #087b92; background: rgba(25, 185, 211, .12); }
.flow-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 25px 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--faint); }

.header-grid, .delivery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 24px 0; }
.header-grid > div { display: grid; gap: 8px; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.header-grid span { color: var(--faint); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.header-grid code { width: fit-content; }
.verify-list { margin: 28px 0; padding: 0; list-style: none; }
.verify-list li { display: grid; grid-template-columns: 30px 1fr; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.verify-list li > span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 6px; color: var(--purple); background: var(--purple-soft); font: 600 10px "JetBrains Mono"; }
.verify-list p { margin: 0; font-size: 13px; }
.delivery-grid { grid-template-columns: repeat(3, 1fr); }
.delivery-grid > div { padding: 18px; border: 1px solid var(--line); border-radius: 8px; }
.delivery-grid h3 { margin: 14px 0 5px; font-size: 15px; }
.delivery-grid p { margin: 0; font-size: 11px; }
.delivery-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; font-weight: 700; }
.delivery-icon.success { color: #168658; background: rgba(47, 201, 129, .14); }
.delivery-icon.retry { color: #b47913; background: rgba(229, 161, 39, .14); }

.status-list { margin: 16px 0 32px; border-top: 1px solid var(--line); }
.status-list > div { display: grid; grid-template-columns: 160px 1fr; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.status-list p { margin: 0; font-size: 12px; }
.status-list code { width: fit-content; }
.status.paid { color: #168658; background: rgba(47, 201, 129, .1); }
.status.processing { color: #b47913; background: rgba(229, 161, 39, .1); }
.status.declined { color: #cf4250; background: rgba(221, 75, 85, .1); }
.error-table { margin-top: 28px; border-top: 1px solid var(--line); }
.error-table > div { display: grid; grid-template-columns: 54px 245px 1fr; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.error-table strong { font-size: 11px; }
.error-table code { width: fit-content; color: var(--purple); font-size: 10px; }
.error-table p { margin: 0; font-size: 11px; }

.toc { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); padding: 36px 28px 24px 22px; border-left: 1px solid var(--line); }
.toc > p { margin: 0 0 12px; color: var(--faint); font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.toc nav { display: grid; gap: 2px; }
.toc nav a { padding: 5px 0 5px 11px; border-left: 1px solid var(--line); color: var(--faint); font-size: 10.5px; line-height: 1.4; }
.toc nav a.active { border-left-color: var(--purple); color: var(--purple); }
.toc-card { margin-top: 30px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.toc-card > span { font-size: 11px; font-weight: 700; }
.toc-card p { margin: 4px 0 9px; font-size: 10px; line-height: 1.5; }
.toc-card a { color: var(--purple); font-size: 10px; font-weight: 700; }
.docs-footer { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 20px; padding: 35px 0 60px; color: var(--faint); font-size: 11px; }
.docs-footer > div { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.footer-logo { display: block; width: 76px; height: auto; object-fit: contain; }
.docs-footer p { margin: 0; font-size: 11px; }
.docs-footer a:hover { color: var(--purple); }

.search-dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding-top: 14vh; }
.search-dialog[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; border: 0; background: rgba(15, 11, 22, .54); backdrop-filter: blur(4px); }
.search-box { position: relative; width: min(590px, calc(100vw - 30px)); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.search-input-wrap { display: flex; height: 58px; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--faint); }
.search-input-wrap input { flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.search-results { max-height: 360px; padding: 8px; overflow-y: auto; }
.search-result { display: grid; padding: 12px; border-radius: 7px; }
.search-result:hover, .search-result.active { background: var(--surface-2); }
.search-result strong { font-size: 12px; }
.search-result span { color: var(--faint); font-size: 10px; }
.search-empty { margin: 0; padding: 24px; text-align: center; font-size: 11px; }

@media (max-width: 1180px) {
  :root { --toc-width: 0px; }
  .page-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .toc { display: none; }
  .content { width: min(100%, 920px); }
}

@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .brand { min-width: auto; }
  .brand-product, .top-actions > a, .search-trigger { display: none; }
  .menu-button { display: block; }
  .page-shell { display: block; }
  .sidebar { position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 45; width: min(310px, 86vw); height: auto; transform: translateX(-100%); background: var(--surface); box-shadow: var(--shadow); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .content { width: 100%; padding: 0 24px; }
  .hero { padding-top: 64px; }
  .doc-section { padding: 64px 0; }
  .principle-grid, .compare-grid, .split-code, .delivery-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr 90px; padding: 8px 0; }
  .field-row p { grid-column: 1 / -1; padding-top: 0; }
  .field-head { display: none; }
  .environment-card { grid-template-columns: 1fr auto; }
  .environment-card > code { grid-column: 1 / -1; overflow-wrap: anywhere; }
  .header-grid { grid-template-columns: 1fr; }
  .error-table > div { grid-template-columns: 45px 1fr; }
  .error-table p { grid-column: 1 / -1; margin-top: 6px; }
  .docs-footer { grid-template-columns: 1fr auto; }
  .docs-footer p { display: none; }
}

@media (max-width: 520px) {
  .content { padding: 0 17px; }
  .hero h1 { font-size: 43px; }
  .hero-copy { font-size: 15px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .environment-card { grid-template-columns: 1fr; }
  .copy-button { justify-self: start; }
  .field-row { grid-template-columns: 1fr 72px; }
  .flow-line { align-items: stretch; flex-direction: column; }
  .flow-line span { transform: rotate(90deg); align-self: center; }
  .status-list > div { grid-template-columns: 130px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
