:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --topbar-bg: #ffffff;
  --topbar-fg: #1a1d24;
  --topbar-border: #e4e6eb;
  --topbar-hover: rgba(0, 0, 0, 0.05);
  --sidebar-bg: #f3f4f6;
  --sidebar-border: #e4e6eb;
  --sidebar-fg: #454b58;
  --sidebar-fg-dim: #7b8290;
  --sidebar-active: #e7e9ee;
  --sidebar-active-fg: #12141c;
  --fg: #1a1d24;
  --fg-dim: #5b616e;
  --border: #e4e6eb;
  --card-bg: #ffffff;
  --code-bg: #1a1d24;
  --code-fg: #e6e8ee;
  --accent: #e3342f;
  --accent-dim: #fceceb;
  --get: #0a8f5b;
  --get-bg: #e4f7ee;
  --post: #b25b00;
  --post-bg: #fdf0e2;
  --danger: #e3342f;
  --danger-bg: #fceceb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 30, 0.05), 0 1px 1px rgba(20, 22, 30, 0.04);
  --shadow-md: 0 8px 24px rgba(20, 22, 30, 0.08), 0 2px 6px rgba(20, 22, 30, 0.05);
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, Menlo, monospace;
  --sans: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0f1117;
  --bg-alt: #171a23;
  --topbar-bg: #0a0b10;
  --topbar-fg: #ffffff;
  --topbar-border: #000000;
  --topbar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-bg: #0a0b10;
  --sidebar-border: #000000;
  --sidebar-fg: #c7cad1;
  --sidebar-fg-dim: #767b8a;
  --sidebar-active: #1e2130;
  --sidebar-active-fg: #ffffff;
  --fg: #e7e9ee;
  --fg-dim: #9aa0ae;
  --border: #262a37;
  --card-bg: #171a23;
  --code-bg: #0a0b10;
  --code-fg: #dfe3ec;
  --accent: #ff5b53;
  --accent-dim: #3a1614;
  --get: #35d399;
  --get-bg: #0f2a22;
  --post: #ffab5c;
  --post-bg: #2c1f0f;
  --danger: #ff5b53;
  --danger-bg: #3a1614;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117;
    --bg-alt: #171a23;
    --topbar-bg: #0a0b10;
    --topbar-fg: #ffffff;
    --topbar-border: #000000;
    --topbar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #0a0b10;
    --sidebar-border: #000000;
    --sidebar-fg: #c7cad1;
    --sidebar-fg-dim: #767b8a;
    --sidebar-active: #1e2130;
    --sidebar-active-fg: #ffffff;
    --fg: #e7e9ee;
    --fg-dim: #9aa0ae;
    --border: #262a37;
    --card-bg: #171a23;
    --code-bg: #0a0b10;
    --code-fg: #dfe3ec;
    --accent: #ff5b53;
    --accent-dim: #3a1614;
    --get: #35d399;
    --get-bg: #0f2a22;
    --post: #ffab5c;
    --post-bg: #2c1f0f;
    --danger: #ff5b53;
    --danger-bg: #3a1614;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body, .side-card, .tester-card, .param-table td, .param-table th,
.doc-section, .sidebar, .try-url, .method-select, .sidebar-config input {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
code, pre, .mono { font-family: var(--mono); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 56px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  border-bottom: 1px solid var(--topbar-border);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  background: transparent; border: 1px solid var(--topbar-border); color: var(--topbar-fg);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--topbar-hover); }

.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-logo {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--topbar-border); border-radius: 7px; padding: 3px 8px; height: 34px;
}
.brand-logo img { height: 100%; width: auto; object-fit: contain; display: block; }
.brand-name { font-weight: 700; font-size: 16px; color: var(--topbar-fg); }
.brand-name .accent { color: var(--accent); }
.brand-sub { font-size: 12px; color: var(--topbar-fg); opacity: .55; }

#globalSearch {
  width: 100%; max-width: 420px;
  background: var(--topbar-hover); border: 1px solid var(--topbar-border); color: var(--topbar-fg);
  padding: 8px 12px; border-radius: 8px; font-size: 13px;
}
#globalSearch::placeholder { color: var(--topbar-fg); opacity: .5; }
#globalSearch:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227, 52, 47, 0.25); }

.layout { display: flex; min-height: calc(100vh - 56px); }

.version-picker {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 18px; padding: 8px 10px;
  border: 1px solid var(--sidebar-border); border-radius: 8px;
  color: var(--sidebar-fg-dim);
}
.version-picker svg { flex-shrink: 0; }
.version-picker select {
  flex: 1; min-width: 0; background: transparent; border: none; color: var(--sidebar-fg);
  font-family: var(--sans); font-size: 12.5px; font-weight: 700; cursor: not-allowed;
}
.version-picker select:disabled { opacity: 1; color: var(--sidebar-fg); }
.version-picker select option { background: var(--sidebar-bg); color: var(--fg); }

.sidebar {
  width: 280px; flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 20px 14px 40px;
  position: sticky; top: 56px; height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
  transition: margin-left .2s ease;
}
.sidebar.collapsed { margin-left: -280px; }

.sidebar-section { margin-bottom: 22px; }
.sidebar-section h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--sidebar-fg-dim); margin: 0 0 8px 8px; font-weight: 600;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 7px; color: var(--sidebar-fg);
  font-size: 13.5px; border-left: 2px solid transparent; transition: background-color .15s ease, color .15s ease;
}
.sidebar li a:hover { background: var(--sidebar-active); text-decoration: none; }
.sidebar li a.active { background: var(--sidebar-active); color: var(--sidebar-active-fg); font-weight: 700; border-left-color: var(--accent); }
.sidebar li a .nav-method {
  font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
  min-width: 30px; text-align: center;
}
.nav-method.GET { background: var(--get-bg); color: var(--get); }
.nav-method.POST { background: var(--post-bg); color: var(--post); }

.sidebar-action-btn {
  width: 100%; background: transparent; border: none; text-align: left; cursor: pointer;
  font-family: var(--sans);
}
.sidebar-action-btn:hover { color: var(--accent); }
.sidebar-action-btn.copied { background: var(--get-bg); color: var(--get); }

.sidebar-config { padding: 0 8px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-config label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--sidebar-fg-dim);
}
.sidebar-config input {
  background: var(--bg); border: 1px solid var(--border); color: var(--fg);
  padding: 7px 9px; border-radius: 7px; font-size: 12.5px; font-family: var(--mono);
}
.sidebar-config input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227, 52, 47, 0.25); }
.sidebar-config .hint { font-size: 11px; color: var(--sidebar-fg-dim); margin: 2px 0 0; line-height: 1.5; }

.content {
  flex: 1; min-width: 0;
  padding: 32px 40px 80px;
  max-width: 1180px;
}

.doc-section { padding: 32px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 70px; }
.doc-section:last-child { border-bottom: none; }
.doc-section h1 { font-size: 32px; font-weight: 800; letter-spacing: -.01em; margin: 4px 0 12px; }
.doc-section h2 { font-size: 23px; font-weight: 800; margin: 0 0 14px; }
.eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 800;
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: var(--accent); display: inline-block; }
.lead { color: var(--fg-dim); font-size: 15.5px; max-width: 760px; }

.steps { padding-left: 20px; color: var(--fg-dim); }
.steps li { margin-bottom: 6px; }
.steps strong { color: var(--fg); }

code {
  background: var(--bg-alt); padding: 2px 6px; border-radius: 5px; font-size: 0.9em;
  border: 1px solid var(--border);
}

.notes-list {
  margin: 10px 0 18px; padding-left: 20px; color: var(--fg-dim); font-size: 13.5px; line-height: 1.7;
}
.notes-list li { margin-bottom: 4px; }
.notes-list code { color: var(--accent); }

.param-table { width: 100%; border-collapse: collapse; margin: 10px 0 20px; font-size: 13px; }
.param-table th, .param-table td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.param-table th { color: var(--fg-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.param-table td code { border: none; background: transparent; padding: 0; color: var(--accent); }
.param-table input, .param-table select {
  width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font-family: var(--mono); font-size: 12.5px;
}

.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge.req { background: var(--danger-bg); color: var(--danger); }
.badge.opt { background: var(--bg-alt); color: var(--fg-dim); border: 1px solid var(--border); }

.endpoint-section { padding-top: 40px; }
.endpoint-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.method-badge {
  font-size: 11.5px; font-weight: 800; padding: 5px 12px; border-radius: 20px; letter-spacing: .04em;
}
.method-badge.GET { background: var(--get-bg); color: var(--get); }
.method-badge.POST { background: var(--post-bg); color: var(--post); }
.endpoint-path { font-size: 15px; background: var(--bg-alt); font-weight: 600; }
.endpoint-name { color: var(--fg-dim); font-size: 14px; }
.endpoint-desc { color: var(--fg-dim); margin: 10px 0 6px; max-width: 760px; }

.subhead { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-dim); margin: 22px 0 8px; }

.two-col { display: grid; grid-template-columns: 0.95fr 1.15fr; gap: 28px; margin-top: 6px; align-items: start; min-width: 0; }
.col-main, .col-side { min-width: 0; }
.col-side {
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding: 2px 2px 2px 0;
}
@media (max-width: 980px) {
  .two-col { grid-template-columns: 1fr; }
  .col-side { position: static; max-height: none; overflow-y: visible; }
}

.example-tabs { margin: 14px 0; }
.tab-strip { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tab-btn {
  background: transparent; border: none; padding: 8px 12px; font-size: 13px; color: var(--fg-dim);
  cursor: pointer; border-bottom: 2px solid transparent; font-family: var(--sans); font-weight: 600;
  transition: color .15s ease, border-color .15s ease;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 800; }
.tab-btn:hover { color: var(--fg); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.side-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.side-card-title {
  margin: 0 0 12px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--fg-dim); font-weight: 700;
}

.ex-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ex-card-title { margin: 0; }
.status-pill {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: var(--bg-alt); color: var(--fg-dim); border: 1px solid var(--border);
  font-family: var(--mono);
}

.ex-panel {
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--code-bg);
}
.ex-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 8px; background: rgba(255, 255, 255, 0.045);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ex-select-group { display: flex; gap: 6px; min-width: 0; }
.ex-select, .ex-static-tab {
  background: rgba(255, 255, 255, 0.08); color: var(--code-fg); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px; padding: 4px 12px; font-family: var(--sans); font-size: 11.5px; font-weight: 700;
}
.ex-select { cursor: pointer; max-width: 130px; text-overflow: ellipsis; }
.ex-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227, 52, 47, 0.25); }
.ex-select optgroup, .ex-select option { background: var(--code-bg); color: var(--code-fg); }
.ex-static-tab { cursor: default; }

.ex-icon-group { display: flex; gap: 2px; flex-shrink: 0; }
.ex-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: transparent; color: rgba(255, 255, 255, 0.5);
  border: none; border-radius: 6px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.ex-icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.ex-icon-btn.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.ex-icon-btn.copied { color: #35d399; }

.code-block {
  background: var(--code-bg); color: var(--code-fg);
  border-radius: calc(var(--radius) - 4px); padding: 16px 18px; overflow-x: auto;
  font-size: 12.5px; line-height: 1.65; margin: 0; max-height: 380px; overflow-y: auto;
  white-space: pre;
}
.ex-code { border-radius: 0; border: none; }
.code-block.wrap { white-space: pre-wrap; word-break: break-word; overflow-x: hidden; }

.json .jk { color: #7bb1ff; }
.json .js { color: #9ee6a0; }
.json .jn { color: #ffb86b; }
.json .jb { color: #ff9df0; }
.json .jnull { color: #8b90a0; }

.tester-card {
  background: var(--card-bg); border: 1px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-md); flex-shrink: 0;
}
.tester-card h4 { margin: 0 0 14px; font-size: 14.5px; font-weight: 800; }
.tester-field { margin-bottom: 12px; }
.tester-field label { display: block; font-size: 11.5px; color: var(--fg-dim); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .03em; }
.url-row { display: flex; gap: 6px; min-width: 0; }
.method-select {
  flex-shrink: 0;
  border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  font-size: 12px; font-weight: 700; padding: 0 6px;
}
.try-url {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font-family: var(--mono); font-size: 12.5px;
}
.try-params { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.try-param label { display: block; font-size: 12px; color: var(--fg-dim); margin-bottom: 4px; }
.try-param input {
  width: 100%; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font-family: var(--mono); font-size: 12.5px;
}
.try-body textarea {
  width: 100%; min-height: 220px; padding: 10px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font-family: var(--mono); font-size: 12px; resize: vertical;
}
.try-url:focus, .try-param input:focus, .try-body textarea:focus, .method-select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227, 52, 47, 0.2);
}

.send-btn {
  width: 100%; background: var(--accent); color: #fff; border: none; padding: 11px 14px;
  border-radius: 8px; font-weight: 800; font-size: 13.5px; cursor: pointer; margin-top: 4px;
  box-shadow: 0 4px 14px rgba(227, 52, 47, 0.35);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.send-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(227, 52, 47, 0.4); }
.send-btn:active { transform: translateY(0); }
.send-btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }

.try-result { margin-top: 16px; }
.try-result-meta {
  display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.status-chip { font-weight: 700; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; }
.status-chip.ok { background: var(--get-bg); color: var(--get); }
.status-chip.err { background: var(--danger-bg); color: var(--danger); }
.timing-chip { color: var(--fg-dim); }

.doc-footer {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--fg-dim); font-size: 12.5px; text-align: center;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; z-index: 60; box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  .sidebar.collapsed { margin-left: -280px; }
  .content { padding: 24px 18px 60px; }
  .topbar-center { display: none; }
}
