*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e4e4e7;
  --muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #34d399;
  --orange: #fb923c;
  --red: #f87171;
  --blue: #60a5fa;
  --radius: 8px;
  --sidebar-w: 220px;
}
html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Layout ───────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
nav.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  height: 100vh; overflow-y: auto;
  padding: 1.5rem 0.75rem 2rem 1rem;
  border-right: 1px solid var(--border);
  background: var(--bg); z-index: 10;
}
nav.sidebar .logo { font-weight: 700; font-size: 0.95rem; color: var(--text); margin-bottom: 1.25rem; letter-spacing: -0.02em; }
nav.sidebar a {
  display: block; padding: 0.3rem 0.5rem; border-radius: 4px;
  font-size: 0.8rem; color: var(--muted); text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
nav.sidebar a:hover, nav.sidebar a.active { color: var(--text); background: rgba(99,102,241,0.1); }
nav.sidebar .sep { height: 1px; background: var(--border); margin: 0.6rem 0.5rem; }
nav.sidebar .section-label {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); padding: 0.5rem 0.5rem 0.15rem; margin-top: 0.2rem;
}
main { flex: 1; min-width: 0; padding: 2rem 2rem 4rem; max-width: 860px; }
@media (max-width: 768px) {
  nav.sidebar { display: none; }
  main { padding: 1.5rem 1rem 3rem; }
}

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin-top: 2.5rem; margin-bottom: 0.6rem; color: var(--accent-hover); }
h2.section-heading {
  font-size: 1.2rem; font-weight: 700; margin-top: 3rem; margin-bottom: 0.4rem;
  color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem;
}
p, li { color: var(--muted); font-size: 0.875rem; }
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.12rem 0.5rem; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-get  { background: rgba(96,165,250,0.15); color: var(--blue); }
.badge-post { background: rgba(251,146,60,0.15); color: var(--orange); }
.badge-auth { background: rgba(251,146,60,0.12); color: var(--orange); font-size: 0.65rem; }
.badge-pub  { background: rgba(52,211,153,0.12); color: var(--green); font-size: 0.65rem; }

/* ── Credit cost pill + test button ───────────────────────── */
.ep-cost-group {
  margin-left: auto;
  display: flex; align-items: center; gap: 0.4rem;
}
.ep-cost {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--green);
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.25);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
}
.btn-test {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent); background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25); border-radius: 4px;
  padding: 0.15rem 0.5rem; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-test:hover { background: rgba(99,102,241,0.2); color: var(--accent-hover); }

/* ── Endpoint cards ───────────────────────────────────────── */
.ep {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 0.75rem;
}
.ep-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.35rem; flex-wrap: wrap; }
.ep-path { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 500; color: var(--text); }
.ep-desc { font-size: 0.82rem; margin-bottom: 0.5rem; }

/* ── Tables ────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.82rem; }
th {
  text-align: left; padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border); color: var(--muted);
  font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
}
td { padding: 0.35rem 0.6rem; border-bottom: 1px solid rgba(42,45,58,0.4); color: var(--text); }
td:first-child { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--green); }

/* ── Code ──────────────────────────────────────────────────── */
pre {
  background: #12141c; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.85rem 1rem; overflow-x: auto; margin: 0.5rem 0;
}
code { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; line-height: 1.55; color: var(--text); }
.c { background: rgba(99,102,241,0.1); padding: 0.08rem 0.35rem; border-radius: 3px; font-size: 0.78rem; }

/* ── API Tester ────────────────────────────────────────────── */
#tester {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: 0.75rem;
}
#tester-bar { display: flex; gap: 0.5rem; align-items: center; }
#tester-method {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; font-weight: 600;
  background: rgba(96,165,250,0.15); color: var(--blue);
  border: 1px solid rgba(96,165,250,0.25); border-radius: 4px;
  padding: 0.4rem 0.6rem; cursor: pointer; appearance: none; -webkit-appearance: none;
}
#tester-method option { background: var(--surface); color: var(--text); }
#tester-url {
  flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 0.82rem;
  background: #12141c; color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.45rem 0.75rem;
  outline: none; transition: border-color 0.15s;
}
#tester-url:focus { border-color: var(--accent); }
#tester-send {
  font-size: 0.78rem; font-weight: 600;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius); padding: 0.45rem 1rem;
  cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
#tester-send:hover { background: var(--accent-hover); }
#tester-send:disabled { opacity: 0.5; cursor: default; }
#tester-key-row { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
#tester-key-row label { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
#tester-key {
  flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  background: #12141c; color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.35rem 0.6rem; outline: none;
}
#tester-key:focus { border-color: var(--accent); color: var(--text); }
#tester-body-row { display: none; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
#tester-body-row label { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
#tester-body {
  flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  background: #12141c; color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.35rem 0.6rem; outline: none;
}
#tester-body:focus { border-color: var(--accent); color: var(--text); }
#tester-status {
  font-size: 0.72rem; font-family: 'JetBrains Mono', monospace;
  margin-top: 0.5rem; color: var(--muted);
}
#tester-status .ok { color: var(--green); }
#tester-status .err { color: var(--red); }
#tester-output {
  margin-top: 0.5rem; max-height: 640px; overflow: auto;
  background: #12141c; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem; display: none;
}
#tester-output pre { background: none; border: none; padding: 0; margin: 0; }

/* ── Pricing ───────────────────────────────────────────────── */
.price-box { display: flex; gap: 1rem; margin: 0.75rem 0; flex-wrap: wrap; }
.price-card {
  flex: 1; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; text-align: center;
}
.price-card .amount {
  font-size: 1.5rem; font-weight: 700; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.price-card .unit { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
#pricing-country { font-size: 0.82rem; color: var(--muted); margin-top: 0.5rem; }
#pricing-country .flag { font-size: 1.1rem; vertical-align: middle; margin-right: 0.3rem; }

/* ── Misc ──────────────────────────────────────────────────── */
.note {
  background: rgba(99,102,241,0.06); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.65rem 0.85rem; margin: 0.5rem 0; font-size: 0.82rem;
}
.note strong { color: var(--text); }
.tier-list { font-size: 0.78rem; color: var(--muted); margin: 0.3rem 0; }
.tier-list code { font-size: 0.75rem; }
footer {
  margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.75rem; text-align: center;
}
.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); margin-right: 0.4rem;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }
.observed { scroll-margin-top: 1.5rem; }
