:root {
  --navy: #0a2540;
  --purple: #635bff;
  --purple-soft: #eeedfe;
  --bg: #f6f9fc;
  --surface: #fff;
  --border: #e3e8ee;
  --text: #1a2c44;
  --mute: #697386;
  --body: #425466;
  --ok: #09825d;
  --danger: #df1b41;
  --code-bg: #0a2540;
  --sidebar-w: 260px;
  --font: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Ubuntu, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #eef2f7;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre code { background: none; padding: 0; color: inherit; }

.docs-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 24px);
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  box-sizing: border-box;
}
.docs-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.03em;
  color: var(--navy);
  text-decoration: none;
}
.brand span { color: var(--mute); font-weight: 500; font-size: 14px; margin-left: 8px; }
.docs-nav-links { display: flex; gap: 16px; align-items: center; font-size: 14px; font-weight: 500; }
.docs-nav-links a { color: var(--body); text-decoration: none; }
.docs-nav-links a:hover { color: var(--navy); }
.btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
}
.btn-fill { background: var(--purple); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--navy); }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - 56px);
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px 40px;
}
.side-label {
  margin: 18px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8792a2;
}
.side-label:first-child { margin-top: 0; }
.side-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  text-decoration: none;
}
.side-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.side-link.active {
  background: #e8e7ff;
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--purple);
  border-radius: 0 6px 6px 0;
}

.content {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  justify-self: center;
  padding: 40px clamp(20px, 3vw, 32px) 96px;
}
.content h1 {
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.lead { margin: 0 0 28px; color: var(--mute); font-size: 18px; max-width: 62ch; }
.doc-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.doc-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.doc-header {
  margin: 0 0 20px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.doc-header.hero {
  margin-bottom: 28px;
  text-align: center;
}
.doc-header.hero p {
  margin-left: auto;
  margin-right: auto;
}
.doc-header .eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8792a2;
}
.doc-header h1,
.doc-header h2 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  letter-spacing: -0.02em;
}
.doc-header h1 { font-size: 34px; }
.doc-header h2 { font-size: 24px; }
.doc-header p {
  margin: 0;
  color: var(--mute);
  font-size: 15px;
  line-height: 1.55;
  max-width: 62ch;
}
.content h2 {
  margin: 48px 0 12px;
  padding-top: 12px;
  font-size: 24px;
  letter-spacing: -0.02em;
  border-top: 1px solid var(--border);
}
.content h2:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.content h3 { margin: 28px 0 10px; font-size: 18px; }
.content p { margin: 0 0 14px; color: var(--body); }
.content ul, .content ol { margin: 0 0 16px; padding-left: 1.25rem; color: var(--body); }
.content li { margin-bottom: 6px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 0 0 16px;
}
.card.tip { border-left: 3px solid var(--purple); }
.card.warn { border-left: 3px solid #b76e00; background: #fffaf0; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.mini {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.mini strong { display: block; margin-bottom: 4px; font-size: 13px; }
.mini span { font-size: 12px; color: var(--mute); }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 18px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f3f7;
  vertical-align: top;
}
th { background: #fafbff; color: var(--mute); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.method {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--purple-soft);
  color: var(--purple);
}
.method.get { background: #e6f9f1; color: var(--ok); }
.method.delete { background: #ffe8ec; color: var(--danger); }

.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
}

.lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 0;
  padding: 4px;
  background: #eef2f7;
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
}
.lang-tab {
  border: 0;
  background: transparent;
  padding: 7px 12px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  cursor: pointer;
}
.lang-tab.active { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(10,37,64,0.06); }

.code-block {
  position: relative;
  margin: 0 0 18px;
  background: var(--code-bg);
  color: #e8eef7;
  border-radius: 0 0 10px 10px;
  border: 1px solid var(--navy);
  overflow: hidden;
}
.code-block.solo { border-radius: 10px; }
.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
}
.code-block .lang-pane { display: none; }
.code-block .lang-pane.active { display: block; }
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { background: rgba(255,255,255,0.2); }

.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 20px;
}
.flow div {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}
.flow span { display: block; color: var(--mute); font-weight: 500; margin-top: 4px; font-size: 11px; }

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  height: 32px;
  padding: 0 10px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    max-width: none;
  }
  .content {
    max-width: 720px;
  }
  .sidebar {
    position: fixed;
    inset: 56px auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 30;
    box-shadow: 8px 0 24px rgba(10,37,64,0.12);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; align-items: center; }
  .grid-2, .flow { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .flow { grid-template-columns: 1fr; }
  .docs-nav-links .hide-sm { display: none; }
}

/* Stripe-style sticky footer */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 10px;
  background: #f6f9fc;
  border-top: 1px solid #e3e8ee;
  font-size: 13px;
  color: #425466;
}
.app-footer .footer-dev {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
}
.app-footer .footer-dev:hover { background: #f6f9fc; text-decoration: none; }
.app-footer .footer-dev svg { color: #697386; }
.app-footer .footer-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}
.app-footer .footer-tool {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #697386;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
}
.app-footer .footer-tool:hover { background: #eef2f7; color: #1a2c44; }
.app-footer .footer-dev:hover { background: #eef2f7; }
.footer-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #09825d;
  box-shadow: 0 0 0 2px rgba(9, 130, 93, 0.18);
  flex-shrink: 0;
}
.layout { padding-bottom: 44px; }
.sidebar { height: calc(100vh - 56px - 44px); }
