:root,
html[data-theme="dark"] {
  --bg: #071033;
  --panel: #00126d;
  --panel-2: #01124a;
  --line: #24357a;
  --text: #e8eef8;
  --muted: #b7c3e6;
  --accent: #80ddfa;
  --accent-2: #ff7b00;
  --gold: #ffde81;
  --ok: #34d399;
  --warn: #ffde81;
  --err: #fb7185;
  --get: #80ddfa;
  --post: #34d399;
  --del: #fb7185;
  --patch: #ffde81;
  --code-bg: #050b24;
  --pre-bg: #040818;
  --hover: #12215c;
  --shadow: 0 10px 30px rgba(0, 8, 40, .4);
  --topbar: rgba(7, 16, 51, .92);
  --mark-grad: linear-gradient(135deg, #00126d, #ff7b00);
  --scrollbar: #3d4f8a;
}

html[data-theme="light"] {
  --bg: #f7f7f7;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --line: #d7e2f0;
  --text: #1b2433;
  --muted: #5a6b80;
  --accent: #011788;
  --accent-2: #ff7b00;
  --gold: #e05d06;
  --ok: #10743f;
  --warn: #e05d06;
  --err: #b91c1c;
  --get: #011788;
  --post: #0f766e;
  --del: #be123c;
  --patch: #e05d06;
  --code-bg: #ecf7ff;
  --pre-bg: #f4f8fc;
  --hover: #ecf7ff;
  --shadow: 0 8px 24px rgba(0, 18, 109, .08);
  --topbar: rgba(247, 247, 247, .94);
  --mark-grad: linear-gradient(135deg, #00126d, #011788);
  --scrollbar: #c5d0de;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: 15px/1.6 "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;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  background: transparent;
}
.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: var(--scrollbar);
  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 var(--muted);
  transform: rotate(0deg);
  transition: transform .15s ease;
}
.nav-folder[open] > summary::before { transform: rotate(90deg); }
.nav-folder > summary:hover { background: var(--hover); 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: var(--text);
  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: var(--hover); }
.docs-nav a.active { box-shadow: inset 2px 0 0 var(--gold); }
.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: var(--topbar);
  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, .theme-btn {
  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; }
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 700;
  color: var(--gold);
}
.theme-btn:hover { border-color: var(--gold); }
.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; letter-spacing: -.02em; }
.content h2 { margin: 28px 0 10px; font-size: 18px; }
.content p, .content li { color: var(--text); }
.content a { color: var(--accent-2); }
html[data-theme="dark"] .content a { color: #7cbcf5; }
.content code, .try-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text);
}
.content pre, .try-out {
  background: var(--pre-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
}
.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; }

.callout {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.callout strong { color: var(--gold); }
.callout ol, .callout ul { margin: 8px 0 0; padding-left: 1.2rem; }
.pre-wrap { position: relative; }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent-2); }

.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(--gold); border-color: var(--gold); }
.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-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.try-hint a { color: var(--accent-2); }
.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-2);
  color: #00126d;
  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; }
  .theme-btn span:last-child { display: none; }
}

/* Clouding chrome: navy sidebar, orange accent, light content */
html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #00126d 0%, #011788 100%);
  border-right-color: rgba(255, 255, 255, .12);
  color: #fff;
}
html[data-theme="light"] .sidebar .brand,
html[data-theme="light"] .sidebar .brand strong { color: #fff; }
html[data-theme="light"] .sidebar .brand small { color: #ffde81; }
html[data-theme="light"] .sidebar .docs-nav a { color: #e7ecff; }
html[data-theme="light"] .sidebar .docs-nav a:hover,
html[data-theme="light"] .sidebar .nav-folder > summary:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}
html[data-theme="light"] .sidebar .docs-nav a.active {
  background: #ff7b00;
  box-shadow: inset 3px 0 0 #ffde81;
  color: #00126d;
}
html[data-theme="light"] .sidebar .method.GET { color: #80ddfa; }
html[data-theme="light"] .sidebar .method.POST { color: #6ee7b7; }
html[data-theme="light"] .sidebar .method.DELETE { color: #fda4af; }
html[data-theme="light"] .sidebar .method.PATCH,
html[data-theme="light"] .sidebar .method.PUT { color: #ffde81; }
html[data-theme="light"] .sidebar .docs-nav a.active .method { color: #00126d; }
html[data-theme="light"] .sidebar .nav-folder > summary { color: #ffde81; }
html[data-theme="light"] .sidebar .nav-folder > summary::before { border-left-color: #ffde81; }
html[data-theme="light"] .sidebar .nav-folder.nested > summary { color: #fff; }
html[data-theme="light"] .sidebar .nav-folder-body { border-left-color: rgba(255, 255, 255, .18); }
html[data-theme="light"] .sidebar .nav-label { color: #ffde81; }
html[data-theme="light"] .sidebar .search-wrap input {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .2);
  color: #fff;
}
html[data-theme="light"] .sidebar .search-wrap input::placeholder { color: rgba(255, 255, 255, .55); }
html[data-theme="light"] .content a,
html[data-theme="light"] .try-hint a,
html[data-theme="light"] .callout strong,
html[data-theme="light"] .theme-btn { color: #c2410c; }
html[data-theme="light"] .btn { background: #ff7b00; color: #00126d; border-radius: 6px; }
html[data-theme="light"] .brand-mark {
  background: #fff;
  border-radius: 50%;
  padding: 2px;
}
