/* ── Reset & base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #ffffff;
  --bg-sidebar:   #f6f8fa;
  --bg-code:      #0d1117;
  --bg-inline:    #f0f2f4;
  --border:       #d0d7de;
  --border-light: #e8ecf0;
  --text:         #1f2328;
  --text-sec:     #57606a;
  --text-muted:   #8c959f;
  --accent:       #0969da;
  --accent-light: #dbeafe;
  --green:        #1a7f37;
  --green-light:  #dafbe1;
  --red:          #cf222e;
  --red-light:    #ffebe9;
  --orange:       #9a6700;
  --orange-light: #fff8c5;
  --purple:       #8250df;
  --purple-light: #fbefff;
  --sidebar-w:    260px;
  --content-max:  780px;
  --radius:       6px;
}

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

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

h1 { font-size: 28px; font-weight: 700; line-height: 1.25; margin-bottom: 12px; }
h2 { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--border-light); }
h3 { font-size: 17px; font-weight: 600; line-height: 1.4; margin: 28px 0 8px; }
h4 { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-sec); margin: 20px 0 6px; }

p  { margin-bottom: 14px; color: var(--text); }
ul, ol { margin: 0 0 14px 22px; }
li { margin-bottom: 4px; }

code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  background: var(--bg-inline);
  border: 1px solid var(--border-light);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--red);
}

pre {
  background: var(--bg-code);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 14px 0 20px;
  position: relative;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e6edf3;
  font-size: 13px;
  line-height: 1.6;
}

.comment { color: #8b949e; }
.key     { color: #79c0ff; }
.str     { color: #a5d6ff; }
.num     { color: #f2cc60; }
.kw      { color: #ff7b72; }
.method-get    { color: #3fb950; }
.method-post   { color: #79c0ff; }
.method-delete { color: #f85149; }
.url-path { color: #a5d6ff; }

.hidden { display: none !important; }

/* ── Top nav ─────────────────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}
.nav-logo:hover { text-decoration: none; }
.logo-hex { color: var(--accent); font-size: 20px; }
.nav-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.nav-links {
  margin-left: auto;
  display: flex;
  gap: 20px;
  align-items: center;
}
.nav-links a {
  color: var(--text-sec);
  font-size: 14px;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links .btn-nav {
  background: var(--accent);
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-weight: 500;
}
.nav-links .btn-nav:hover { opacity: 0.85; text-decoration: none; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 20px 0;
}
.sidebar-section { margin-bottom: 4px; }
.sidebar-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 12px 20px 4px;
}
.sidebar a {
  display: block;
  padding: 5px 20px;
  font-size: 13.5px;
  color: var(--text-sec);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.1s;
  line-height: 1.4;
}
.sidebar a:hover { color: var(--text); background: var(--border-light); }
.sidebar a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-light);
  font-weight: 500;
}

/* ── Content ─────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  max-width: calc(var(--content-max) + 80px);
  padding: 40px 60px 80px;
  min-width: 0;
}
.docs-section { margin-bottom: 60px; }

/* ── Method badges ───────────────────────────────────────────────────── */
.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-code);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 14px 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 14px;
}
.method {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.method-GET    { background: #1a3a24; color: #3fb950; }
.method-POST   { background: #1f3a5c; color: #79c0ff; }
.method-DELETE { background: #3d1f1f; color: #f85149; }
.endpoint-path { color: #e6edf3; }
.endpoint-desc { color: #8b949e; font-size: 12px; margin-left: auto; }

/* ── Params table ────────────────────────────────────────────────────── */
.params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 13.5px;
}
.params-table th {
  text-align: left;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}
.params-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  line-height: 1.5;
}
.params-table tr:last-child td { border-bottom: none; }
.param-name { font-family: monospace; font-weight: 600; color: var(--text); font-size: 13px; }
.param-type { color: var(--purple); font-family: monospace; font-size: 12px; }
.param-req  { color: var(--red); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.param-opt  { color: var(--text-muted); font-size: 11px; }
.param-desc { color: var(--text-sec); }

/* ── Callout boxes ───────────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
  border-left: 4px solid;
}
.callout-info    { background: var(--accent-light);  border-color: var(--accent);  color: #0550ae; }
.callout-warning { background: var(--orange-light);  border-color: var(--orange);  color: var(--orange); }
.callout-success { background: var(--green-light);   border-color: var(--green);   color: var(--green); }
.callout-danger  { background: var(--red-light);     border-color: var(--red);     color: var(--red); }
.callout strong  { font-weight: 600; }
.callout code    { background: rgba(0,0,0,0.07); border: none; }

/* ── Error table ─────────────────────────────────────────────────────── */
.error-row td:first-child { font-family: monospace; font-weight: 600; font-size: 13px; }
.type-auth    { color: var(--red);    background: var(--red-light);    padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.type-invalid { color: var(--orange); background: var(--orange-light); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.type-item    { color: var(--purple); background: var(--purple-light); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.type-api     { color: var(--text-sec); background: var(--bg-inline); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ── Token flow diagram ──────────────────────────────────────────────── */
.flow {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 20px 0;
  flex-wrap: wrap;
  gap: 4px;
}
.flow-step {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
  min-width: 120px;
}
.flow-step strong { display: block; font-size: 12px; color: var(--text-sec); margin-bottom: 2px; }
.flow-step code { background: none; border: none; color: var(--accent); font-size: 12px; padding: 0; }
.flow-arrow { color: var(--text-muted); font-size: 20px; padding: 0 4px; }

/* ── Webhook event badges ────────────────────────────────────────────── */
.event-name {
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-code);
  color: #79c0ff;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 24px 20px 60px; }
  .topnav  { padding: 0 16px; }
  .nav-links { display: none; }
}
