:root {
  --bg: #0f1117;
  --surface: #161922;
  --surface-2: #1e222e;
  --border: #2a2f3d;
  --text: #e6e9ef;
  --muted: #939ab0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --get: #22c55e;
  --post: #3b82f6;
  --put: #f59e0b;
  --patch: #a855f7;
  --delete: #ef4444;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

.topbar {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-center { flex: 1; max-width: 380px; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.select, .search-input, .input {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}
.select:focus, .search-input:focus, .input:focus {
  border-color: var(--accent);
}
.search-input { width: 100%; }

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { border-color: var(--muted); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-sm { padding: 4px 8px; font-size: 12px; }

.layout {
  height: calc(100vh - 54px);
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: 300px;
  min-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 8px;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}
.tree-item:hover { background: var(--surface-2); }
.tree-item.active {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
}
.tree-folder-children { padding-left: 14px; }
.tree-caret {
  width: 14px;
  color: var(--muted);
  font-size: 11px;
  flex-shrink: 0;
}
.tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.method-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.method-GET { background: rgba(34, 197, 94, 0.16); color: var(--get); }
.method-POST { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.method-PUT { background: rgba(245, 158, 11, 0.18); color: var(--put); }
.method-PATCH { background: rgba(168, 85, 247, 0.18); color: #c084fc; }
.method-DELETE { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.method-OTHER { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }

.doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.doc-title { margin: 0; font-size: 24px; font-weight: 700; }
.doc-desc { color: var(--muted); margin: 8px 0 20px; white-space: pre-wrap; }

.url-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}
.url-bar .url-text { flex: 1; }

.section {
  margin-bottom: 26px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.kv-table th, .kv-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.kv-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}
.kv-table tr:last-child td { border-bottom: none; }
.kv-disabled { opacity: 0.5; text-decoration: line-through; }

.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-container {
  max-width: 900px;
  margin: 36px auto;
  padding: 0 20px;
  width: 100%;
  overflow-y: auto;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}
.auth-card {
  max-width: 420px;
  margin: 60px auto;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-group label { font-size: 13px; color: var(--muted); }
.error-banner {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}
.empty-state {
  color: var(--muted);
  padding: 40px 20px;
  text-align: center;
}
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.pill.public { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); }
.pill.private { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
