:root {
  --bg: #0b1220;
  --panel: #111827;
  --panel-2: #0f172a;
  --line: #1f2a44;
  --text: #e5eefc;
  --muted: #93a4c3;
  --accent: #3b82f6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --get: #38bdf8;
  --post: #34d399;
  --del: #fb7185;
  --patch: #fbbf24;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: 15px/1.55 "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app { display: flex; height: 100%; min-height: 0; }
.sidebar {
  width: 300px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  padding: 18px 10px 0 14px;
  overflow: hidden;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #22d3ee);
  font-weight: 800;
}
.brand small { display: block; color: var(--muted); font-size: 12px; }
.autofill-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.search-wrap { display: block; flex-shrink: 0; padding-right: 4px; }
.search-wrap input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
}
@keyframes docs-on-autofill { from { opacity: .99; } to { opacity: 1; } }
.search-wrap input:-webkit-autofill,
.search-wrap input:-webkit-autofill:hover,
.search-wrap input:-webkit-autofill:focus {
  animation-name: docs-on-autofill;
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}
.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 6px 28px 0;
}
.docs-nav::-webkit-scrollbar { width: 8px; }
.docs-nav::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 8px;
}
.nav-folder {
  margin: 0 0 4px;
}
.nav-folder > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  user-select: none;
}
.nav-folder > summary::-webkit-details-marker { display: none; }
.nav-folder > summary::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #64748b;
  transform: rotate(0deg);
  transition: transform .15s ease;
}
.nav-folder[open] > summary::before { transform: rotate(90deg); }
.nav-folder > summary:hover { background: #1e293b; color: var(--text); }
.nav-folder-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 6px 10px;
  border-left: 1px solid var(--line);
  margin: 0 0 4px 10px;
}
.nav-folder.nested > summary {
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: none;
  color: #cbd5e1;
  font-weight: 650;
}
.nav-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 14px 8px 6px;
}
.docs-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  width: 100%;
  min-height: 32px;
  line-height: 1.35;
  color: var(--text);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  flex-shrink: 0;
}
.docs-nav a > span {
  min-width: 0;
}
.docs-nav a > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-nav a:hover, .docs-nav a.active { background: #1e293b; }
.method {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  width: 42px;
  flex-shrink: 0;
}
.method.GET { color: var(--get); }
.method.POST { color: var(--post); }
.method.DELETE { color: var(--del); }
.method.PATCH, .method.PUT { color: var(--patch); }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, .9);
  position: sticky;
  top: 0;
  z-index: 5;
}
.crumbs { flex: 1; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions input, .top-actions select, .base-switch {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.top-actions input { width: 220px; }
.base-switch { display: flex; gap: 8px; align-items: center; }
.base-switch span { color: var(--muted); font-size: 12px; }
.menu-btn {
  display: none;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}

.workspace { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.content { flex: 1; padding: 28px 32px 80px; max-width: 860px; overflow-y: auto; }
.content h1 { margin: 0 0 12px; font-size: 28px; }
.content h2 { margin: 28px 0 10px; font-size: 18px; }
.content p, .content li { color: #d6e2f5; }
.content code, .try-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: #0a1222;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}
.content pre, .try-out {
  background: #070d18;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.45;
}
.content table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 13px; }
.content th, .content td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.content th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.auth { color: var(--warn); }
.path-line { display: flex; gap: 10px; align-items: center; margin: 8px 0 18px; flex-wrap: wrap; }

.try {
  width: 380px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  padding: 18px 16px 40px;
  background: var(--panel);
  overflow: auto;
}
.try h3 { margin: 0 0 8px; }
.try-path { display: block; margin-bottom: 12px; word-break: break-all; }
.try label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.try input, .try textarea, .try select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font: 12.5px/1.4 ui-monospace, monospace;
}
.try textarea { min-height: 140px; resize: vertical; }
.btn {
  margin-top: 12px;
  width: 100%;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.try-out { margin-top: 12px; min-height: 120px; }

.hidden { display: none !important; }

@media (max-width: 980px) {
  .try { display: none; }
  .try.open-mobile { display: block; position: fixed; inset: 56px 0 0 0; width: auto; z-index: 8; }
  .sidebar { display: none; }
  .sidebar.open {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 9;
    height: 100%;
  }
  .menu-btn { display: inline-block; }
  .top-actions input { width: 120px; }
}
