:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-2: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6eaf2;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #dc2626;
  --top-bg: #ffffff;
  --pre-bg: #f8fafc;
  --pre-text: #1e293b;
  --card-from: #ffffff;
  --table-bg: #ffffff;
  --th-bg: #f8fafc;
  --foot-bg: #ffffff;
  --pill-text: #2563eb;
  --heading-soft: #0f172a;
  --path-text: #0f172a;
  --code-bg: #eef2ff;
  --code-border: #e0e7ff;
  --nav-active-bg: #eef2ff;
  --glow: transparent;
  --glow-2: transparent;
  --shadow: none;
  --btn-primary-text: #ffffff;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --page: 1440px;
  --max: 100%;
  --sidebar: 260px;
  --header-h: 68px;
  --radius: 14px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-2: #0b1220;
  --surface: #111827;
  --surface-2: #0f172a;
  --border: #1f2a44;
  --text: #e5eefc;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-2: #3b82f6;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --top-bg: #111827;
  --pre-bg: #0b1220;
  --pre-text: #dbeafe;
  --card-from: #111827;
  --table-bg: #111827;
  --th-bg: #0f172a;
  --foot-bg: #111827;
  --pill-text: #93c5fd;
  --heading-soft: #e5eefc;
  --path-text: #e5eefc;
  --code-bg: rgba(96, 165, 250, 0.12);
  --code-border: rgba(96, 165, 250, 0.22);
  --nav-active-bg: rgba(96, 165, 250, 0.14);
  --glow: transparent;
  --glow-2: transparent;
  --shadow: none;
  --btn-primary-text: #ffffff;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
  padding-top: var(--header-h);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
code {
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 1px 6px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
pre {
  margin: 0 0 12px;
  padding: 14px 16px;
  background: var(--pre-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--pre-text);
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 60;
  height: var(--header-h);
  background: var(--top-bg);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  height: 100%;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.brand img {
  display: block;
  height: 30px;
  width: auto;
}
.brand-sep {
  color: #cbd5e1;
  font-weight: 500;
  font-size: 1.1rem;
}
.brand-crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}
.brand-crumb i {
  color: var(--muted);
  font-size: 1rem;
}
.btn.menu-toggle,
.btn.menu-close {
  display: none;
  min-width: 42px;
  padding: 8px 10px;
}
.menu-toggle svg,
.menu-close svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}
.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.docs-overlay {
  display: none;
}

.docs-shell {
  display: flex;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
  min-width: 0;
}

.docs-sidebar {
  position: fixed;
  top: var(--header-h);
  left: max(0px, calc((100vw - min(100vw, var(--page))) / 2));
  width: var(--sidebar);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 18px 14px 28px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
}
.docs-sidebar::-webkit-scrollbar {
  width: 6px;
}
.docs-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.docs-sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}
.docs-sidebar:hover {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.docs-sidebar:hover::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}
.docs-sidebar:hover::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.docs-sidebar-head {
  display: none;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-nav .nav-group {
  margin: 16px 12px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.docs-nav .nav-group:first-child {
  margin-top: 2px;
}

.docs-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
}

.docs-nav a i {
  font-size: 1.05rem;
  width: 1.15rem;
  text-align: center;
  color: #94a3b8;
}

.docs-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.docs-nav a.active {
  color: var(--accent);
  background: var(--nav-active-bg);
  font-weight: 600;
}

.docs-nav a.active i {
  color: var(--accent);
}

.docs-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  margin-left: var(--sidebar);
  overflow-x: hidden;
}

main {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 28px 32px 64px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none !important;
}
.btn.primary {
  background: var(--accent);
  color: var(--btn-primary-text);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}
.btn.primary:hover {
  background: var(--accent-2);
}
.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.sm { padding: 6px 10px; font-size: 0.78rem; }
.btn.theme-toggle {
  min-width: 42px;
  padding: 8px 10px;
}
.btn.theme-toggle .theme-icon {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
}
html[data-theme="dark"] .btn.theme-toggle .icon-sun {
  display: block;
}
html[data-theme="light"] .btn.theme-toggle .icon-moon,
html:not([data-theme]) .btn.theme-toggle .icon-moon {
  display: block;
}

.hero {
  position: relative;
  padding: 28px 0 24px;
  animation: rise 0.45s var(--ease);
}
.hero-glow { display: none; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.4vw, 2.85rem);
  letter-spacing: -0.04em;
  line-height: 1.12;
  max-width: 18ch;
  color: var(--text);
}
.lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 54ch;
}
.path-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 18px;
}
.path-links span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.path-links a {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}
.path-links a:hover { text-decoration: underline; }
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.hero-pills span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pill-text);
  background: var(--nav-active-bg);
  border: 1px solid var(--code-border);
  padding: 6px 12px;
  border-radius: 999px;
}
.base-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 640px;
}
.base-box .label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.base-box code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.92rem;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.grid-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 10px 0 36px;
  min-width: 0;
  max-width: 100%;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  position: relative;
  min-width: 0;
  max-width: 100%;
}
.card.flat { box-shadow: none; }
.card.tip {
  background: var(--nav-active-bg);
}
.card h2, .card h3 { margin: 0 0 8px; letter-spacing: -0.02em; }
.card h2 { font-size: 1.1rem; }
.card h3 { font-size: 0.92rem; color: var(--heading-soft); }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.method {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 6px;
}
.method.post { background: rgba(61, 214, 140, 0.15); color: var(--ok); }
.method.get { background: rgba(37, 99, 235, 0.12); color: var(--accent); }
html[data-theme="dark"] .method.get {
  color: #93c5fd;
}
.path {
  font-size: 0.9rem;
  color: var(--path-text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.checklist {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}
.checklist li { margin-bottom: 6px; }

.block,
.grid-flow { margin-bottom: 40px; scroll-margin-top: calc(var(--header-h) + 16px); }
.block > .grid-flow { margin-bottom: 0; }
.block-head { margin-bottom: 14px; }
.block-head h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.block-head p { margin: 0; color: var(--muted); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.table-card {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--table-bg);
  margin: 12px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--th-bg);
}
tr:last-child td { border-bottom: none; }
.muted { color: var(--muted); }

.pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.pill.ok { background: rgba(61, 214, 140, 0.15); color: var(--ok); }
.pill.warn { background: rgba(230, 192, 123, 0.15); color: var(--warn); }
.pill.bad { background: rgba(240, 113, 120, 0.15); color: var(--bad); }
.pill.muted { background: rgba(143, 166, 158, 0.15); color: var(--muted); }

.rules {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.rules article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.rules h3 { margin: 0 0 6px; font-size: 0.98rem; }
.rules p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.steps {
  margin: 0 0 14px;
  padding: 18px 18px 18px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.steps li { margin-bottom: 10px; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.table-card + .card.flat,
.card.flat + .split {
  margin-top: 14px;
}

.foot {
  border-top: 1px solid var(--border);
  background: var(--foot-bg);
}
.foot-inner {
  width: 100%;
  margin: 0;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.foot img { height: 34px; width: auto; display: block; }

.page-shell {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
}
.page-shell > main {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}
.page-shell.narrow > main {
  max-width: 720px;
}
.page-shell.wide > main {
  max-width: 100%;
}
.page-shell .hero h1 {
  max-width: none;
}
body.site-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.site-page .page-shell {
  flex: 1;
  min-height: 0;
}
body.site-page > .foot .foot-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 20px 24px;
}
body.site-page .top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent-2);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 50;
  animation: rise 0.25s var(--ease);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .btn.menu-toggle,
  .btn.menu-close {
    display: inline-flex;
  }
  .top-inner {
    padding: 0 16px;
    gap: 10px;
  }
  .docs-overlay {
    display: block;
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
  }
  body.nav-open .docs-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  body.nav-open {
    overflow: hidden;
  }
  .docs-content {
    margin-left: 0;
  }
  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    z-index: 50;
    width: min(var(--sidebar), 86vw);
    padding-top: 14px;
    background: var(--surface);
    transform: translateX(-105%);
    transition: transform 0.22s var(--ease);
    box-shadow: none;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
  }
  .docs-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
  }
  body.nav-open .docs-sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }
  .docs-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 12px;
    margin-bottom: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
  }
  .grid-flow, .split, .rules { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
  main { padding: 20px 16px 48px; }
  .hero { padding: 24px 0 20px; }
  .lead { font-size: 0.98rem; }
  .base-box {
    max-width: none;
    padding: 10px 12px;
  }
  .base-box code {
    font-size: 0.8rem;
    word-break: break-all;
  }
  .card { padding: 16px 14px 14px; }
  pre {
    padding: 12px;
    font-size: 0.72rem;
    max-width: 100%;
  }
  .table-card {
    margin-left: 0;
    margin-right: 0;
  }
  th, td { padding: 10px 12px; }
  .block,
  .grid-flow { scroll-margin-top: calc(var(--header-h) + 12px); }
  .foot-inner {
    padding: 16px;
    gap: 10px;
  }
  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .brand img { height: 28px; }
  .brand-sep,
  .brand-crumb {
    display: none;
  }
  .top-actions .btn.ghost:not(.theme-toggle) {
    display: none;
  }
  body.site-page .top-actions .btn.ghost:not(.theme-toggle) {
    display: inline-flex;
  }
  .btn {
    padding: 7px 11px;
    font-size: 0.8rem;
  }
  .hero h1 { font-size: 1.55rem; }
  .hero-pills span {
    font-size: 0.7rem;
    padding: 5px 8px;
  }
  .block-head h2 { font-size: 1.2rem; }
  .card-top .path {
    font-size: 0.78rem;
    word-break: break-all;
  }
}
