*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 260px;
  --toc-w:     220px;
  --header-h:  58px;

  --bg:            #ffffff;
  --sidebar-bg:    #f9fafb;
  --border:        #e5e7eb;
  --text:          #111827;
  --muted:         #6b7280;
  --primary:       #2563eb;
  --primary-hover: #1d4ed8;
  --code-bg:       #f3f4f6;
  --code-color:    #db2777;
  --code-block-bg: #1e1e2e;
  --info-bg:       #eff6ff;
  --info-border:   #93c5fd;
  --warn-bg:       #fffbeb;
  --warn-border:   #fcd34d;
  --tag-string:    #16a34a;
  --tag-bool:      #2563eb;
  --tag-int:       #d97706;
}

html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* ── TOP BAR ─────────────────────────────────────────────────────────── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}
.top-bar-left { display: flex; align-items: center; gap: 24px; }
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); font-weight: 700;
  font-size: 0.95rem; letter-spacing: -0.01em;
}
.logo-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: #0f172a;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem; font-weight: 900; letter-spacing: -0.05em;
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  color: var(--muted); font-size: 0.875rem; cursor: pointer;
  min-width: 220px;
}
.search-box svg { opacity: 0.5; }
.search-shortcut {
  margin-left: auto; display: flex; gap: 3px;
  font-size: 0.75rem; color: var(--muted);
}
.search-shortcut kbd {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-family: inherit;
}
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.btn-api { color: var(--muted); text-decoration: none; font-size: 0.875rem; }
.btn-api:hover { color: var(--text); }
.btn-demo {
  background: var(--primary); color: #fff; text-decoration: none;
  font-size: 0.875rem; font-weight: 500; padding: 6px 14px;
  border-radius: 6px; transition: background 0.15s;
}
.btn-demo:hover { background: var(--primary-hover); }

/* ── LAYOUT ──────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  overflow-y: auto;
  padding: 20px 0 40px;
}
.nav-section { margin-bottom: 4px; }
.nav-section-title {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 20px 4px;
}
.nav-link {
  display: block; padding: 6px 20px;
  color: var(--muted); text-decoration: none;
  font-size: 0.875rem; border-left: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.nav-link:hover { color: var(--text); background: rgba(0,0,0,0.03); }
.nav-link.active {
  color: var(--primary); border-left-color: var(--primary);
  background: rgba(37,99,235,0.05); font-weight: 500;
}
.nav-sub { padding-left: 14px; }
.nav-sub .nav-link { font-size: 0.8375rem; padding: 5px 20px 5px 14px; }

/* ── MAIN CONTENT ────────────────────────────────────────────────────── */
.content {
  margin-left: var(--sidebar-w);
  margin-right: var(--toc-w);
  flex: 1;
  min-width: 0;
}
.content-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── RIGHT TOC ───────────────────────────────────────────────────────── */
.toc {
  width: var(--toc-w);
  flex-shrink: 0;
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 40px 20px;
}
.toc-title {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.toc-link {
  display: block; font-size: 0.8125rem; color: var(--muted);
  text-decoration: none; padding: 3px 0; border-left: 2px solid transparent;
  padding-left: 10px; transition: color 0.1s, border-color 0.1s;
}
.toc-link:hover { color: var(--text); }
.toc-link.active { color: var(--primary); border-left-color: var(--primary); }

/* ── TYPOGRAPHY ──────────────────────────────────────────────────────── */
.page-title {
  font-size: 2rem; font-weight: 700; letter-spacing: -0.03em;
  color: var(--text); margin-bottom: 10px; line-height: 1.2;
}
.page-subtitle { font-size: 1rem; color: var(--muted); margin-bottom: 40px; }
h2.section-title {
  font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); margin: 48px 0 16px;
  padding-top: 20px; border-top: 1px solid var(--border);
}
h2.section-title:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }
h3.sub-title {
  font-size: 1rem; font-weight: 600; color: var(--text); margin: 28px 0 10px;
}
p { color: #374151; margin-bottom: 14px; font-size: 0.9375rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 20px; margin-bottom: 14px; }
li { color: #374151; font-size: 0.9375rem; margin-bottom: 4px; }

/* ── INLINE CODE ─────────────────────────────────────────────────────── */
code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", monospace;
  font-size: 0.84em;
  color: var(--code-color);
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 4px;
  padding: 1px 5px;
}
pre code { color: inherit; background: none; border: none; padding: 0; font-size: 0.875rem; }

/* ── CODE BLOCKS ─────────────────────────────────────────────────────── */
.code-block {
  background: var(--code-block-bg);
  border-radius: 10px;
  margin: 16px 0;
  overflow: hidden;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.code-lang { font-size: 0.75rem; color: #94a3b8; font-weight: 500; }
.copy-btn {
  font-size: 0.75rem; color: #94a3b8; background: none; border: none;
  cursor: pointer; display: flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px; transition: color 0.1s, background 0.1s;
}
.copy-btn:hover { color: #e2e8f0; background: rgba(255,255,255,0.08); }
.copy-btn.copied { color: #4ade80; }
pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.84rem;
  line-height: 1.7;
  color: #e2e8f0;
}
.hl-key   { color: #7dd3fc; }
.hl-str   { color: #a5f3a1; }
.hl-num   { color: #fbbf24; }
.hl-bool  { color: #c084fc; }
.hl-null  { color: #94a3b8; }
.hl-comment { color: #64748b; font-style: italic; }
.hl-route { color: #f472b6; font-weight: 600; }
.hl-method { color: #fbbf24; font-weight: 600; }

/* ── TABLES ──────────────────────────────────────────────────────────── */
.param-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.875rem; }
.param-table thead tr { background: var(--sidebar-bg); }
.param-table th {
  text-align: left; padding: 10px 14px; font-weight: 600;
  font-size: 0.8rem; color: var(--muted); letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
.param-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.param-table tr:last-child td { border-bottom: none; }
.param-table tr:hover td { background: var(--sidebar-bg); }
.param-name  { font-family: "SF Mono","Fira Code",monospace; font-size: 0.84em; color: var(--code-color); background: #fdf2f8; border: 1px solid #fbcfe8; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.param-type  { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 0.78rem; font-weight: 500; white-space: nowrap; }
.type-string { background: #dcfce7; color: var(--tag-string); }
.type-int    { background: #fef3c7; color: var(--tag-int); }
.type-bool   { background: #dbeafe; color: var(--tag-bool); }
.type-float  { background: #fef3c7; color: var(--tag-int); }
.type-object { background: #f3e8ff; color: #7c3aed; }
.required    { color: #dc2626; font-size: 0.75rem; font-weight: 600; margin-left: 4px; }
.param-default { font-family: monospace; font-size: 0.84em; color: var(--muted); }

/* ── CALLOUTS ────────────────────────────────────────────────────────── */
.callout {
  display: flex; gap: 12px; padding: 14px 16px;
  border-radius: 8px; margin: 16px 0; font-size: 0.875rem;
}
.callout-info  { background: var(--info-bg); border: 1px solid var(--info-border); }
.callout-warn  { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.callout-icon  { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.callout-body  { color: #1e3a5f; }
.callout-warn .callout-body { color: #78350f; }
.callout-body strong { font-weight: 600; }

/* ── METHOD BADGE ────────────────────────────────────────────────────── */
.endpoint {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--code-block-bg); color: #e2e8f0;
  font-family: "SF Mono","Fira Code",monospace; font-size: 0.875rem;
  padding: 10px 16px; border-radius: 8px; margin: 12px 0 20px;
}
.method { padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 0.78rem; }
.method-post { background: #16a34a; color: #fff; }
.method-get  { background: #2563eb; color: #fff; }
.method-delete { background: #dc2626; color: #fff; }

/* ── RESPONSE TABS ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: -1px; }
.tab-btn {
  padding: 8px 16px; font-size: 0.875rem; color: var(--muted);
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-family: inherit; margin-bottom: -1px;
  transition: color 0.1s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab-btn:hover { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── STATUS BADGES ───────────────────────────────────────────────────── */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.status-ok  { background: #dcfce7; color: #15803d; }
.status-err { background: #fee2e2; color: #dc2626; }

/* ── DIVIDER ─────────────────────────────────────────────────────────── */
hr.divider { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) { .toc { display: none; } .content { margin-right: 0; } }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; z-index: 50; }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .content-inner { padding: 32px 20px 60px; }
  .top-bar { padding: 0 16px; }
  .search-box { display: none; }
}
