:root {
  --bg: #09090b;
  --bg-elev: #111115;
  --bg-card: #15151a;
  --bg-hover: #1c1c23;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.12);
  --slate-bg: rgba(161, 161, 170, 0.12);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --clerk-color-primary: #6366f1;
  --clerk-color-primary-foreground: #ffffff;
  --clerk-color-background: #15151a;
  --clerk-color-foreground: #f4f4f5;
  --clerk-color-muted: #1c1c23;
  --clerk-color-muted-foreground: #a1a1aa;
  --clerk-color-neutral: #ffffff;
  --clerk-color-input: #0d0d11;
  --clerk-color-input-foreground: #f4f4f5;
  --clerk-color-border: rgba(255, 255, 255, 0.14);
  --clerk-color-ring: rgba(99, 102, 241, 0.45);
  --clerk-color-danger: #fb7185;
  --clerk-color-success: #34d399;
  --clerk-color-modal-backdrop: rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
code, pre { font-family: var(--mono); }

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(9, 9, 11, 0.8);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--emerald));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 14px; color: var(--text-muted); }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.25); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger {
  background: var(--rose-bg);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fda4af;
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.22); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 15px; font-weight: 600; }

/* Cards & Grids */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-deliverable { background: var(--emerald-bg); color: #34d399; border: 1px solid rgba(16,185,129,0.28); }
.badge-risky { background: var(--amber-bg); color: #fbbf24; border: 1px solid rgba(245,158,11,0.28); }
.badge-undeliverable { background: var(--rose-bg); color: #fb7185; border: 1px solid rgba(244,63,94,0.28); }
.badge-unknown { background: var(--slate-bg); color: #d4d4d8; border: 1px solid rgba(255,255,255,0.12); }
.badge-accent { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }

/* Hero */
.hero {
  position: relative;
  padding: 88px 0 64px;
  text-align: center;
  background: radial-gradient(60% 50% at 50% 0%, rgba(99, 102, 241, 0.18), transparent 70%);
}
.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  max-width: 820px;
  margin: 18px auto 18px;
}
.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 30px;
}
.gradient-text {
  background: linear-gradient(90deg, #a5b4fc, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-cta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* Code blocks */
pre.code {
  background: #0c0c10;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
  color: #e4e4e7;
}
.code-wrap { position: relative; }
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11.5px;
  padding: 4px 9px;
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.input, select, textarea {
  width: 100%;
  background: #0c0c10;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.mono-input { font-family: var(--mono); }

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 10px 0 14px;
}
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #101014; color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.025); }
.row-clickable { cursor: pointer; }
.email-cell-main {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-cell-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
}
.btn-icon {
  padding: 5px 8px;
  font-size: 12.5px;
  line-height: 1;
  min-width: 28px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Progress Bar */
.progress-track {
  height: 10px;
  background: #0c0c10;
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--emerald));
  width: 0%;
  transition: width 0.25s ease;
}

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 11px;
  padding: 28px;
  text-align: center;
  background: #0d0d11;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(99,102,241,0.06); }

/* Factor pills */
.factor-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.factor-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  background: #0c0c10;
  border: 1px solid var(--border);
  font-family: var(--sans);
}
.factor-pill .delta-pos,
.factor-pill .delta-neg,
.factor-pill .delta-zero { font-family: var(--mono); font-size: 12px; }
.delta-pos { color: #34d399; font-weight: 700; }
.delta-neg { color: #fb7185; font-weight: 700; }
.delta-zero { color: var(--text-muted); font-weight: 600; }

/* Formatted table chips, provider indicators, and inline score meters */
.reason-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
}
.reason-good { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.24); color: #6ee7b7; }
.reason-warn { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.24); color: #fcd34d; }
.reason-bad { background: rgba(244, 63, 94, 0.08); border-color: rgba(244, 63, 94, 0.24); color: #fda4af; }
.reason-muted { background: rgba(161, 161, 170, 0.08); border-color: rgba(255, 255, 255, 0.1); color: #d4d4d8; }

.provider-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.score-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.score-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  min-width: 24px;
  text-align: right;
}
.score-bar-track {
  display: inline-block;
  width: 44px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}
.score-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.time-rel {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Stat cards */
.stat-card {
  background: #101014;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }

/* Alert / Toast */
.alert {
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.alert-err { background: var(--rose-bg); border: 1px solid rgba(244,63,94,0.3); color: #fda4af; }
.alert-ok { background: var(--emerald-bg); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.hidden { display: none !important; }

/* Docs layout (Mobile-first, zero horizontal overflow) */
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 36px;
  padding: 28px 0 80px;
}
.docs-main { min-width: 0; max-width: 100%; }
.docs-sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  padding-right: 8px;
}
.docs-nav-group {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  padding: 12px 10px 4px;
}
.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
}
.docs-nav a {
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.docs-nav a:hover, .docs-nav a.active {
  color: var(--text);
  background: rgba(99, 102, 241, 0.12);
}

/* Mobile section jumper */
.docs-mobile-toc {
  display: none;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
}
.docs-mobile-toc summary {
  list-style: none;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.docs-mobile-toc summary::-webkit-details-marker { display: none; }
.docs-mobile-toc-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.docs-mobile-toc-links a {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 7px;
  background: #0d0d11;
  border: 1px solid var(--border);
}
.docs-mobile-toc-links a:hover { color: var(--text); border-color: var(--accent); }

.docs-section {
  margin-bottom: 52px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.docs-section:last-child { border-bottom: none; }
.docs-section h2 { font-size: 24px; letter-spacing: -0.025em; margin-bottom: 10px; }
.docs-section h3 { font-size: 15.5px; margin: 24px 0 10px; color: #e4e4e7; font-weight: 600; }
.docs-section p { color: var(--text-muted); margin-bottom: 12px; font-size: 14.5px; }

/* Endpoint header bar */
.endpoint-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: #0d0d11;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  margin: 12px 0 16px;
  font-family: var(--mono);
  font-size: 13.5px;
  word-break: break-all;
}
.method {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.method-post { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.35); }
.method-get { background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.method-delete { background: rgba(244, 63, 94, 0.16); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.35); }

/* Mobile-friendly Stripe-style schema list (never forces horizontal scroll) */
.schema-box {
  background: #101014;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0 18px;
}
.schema-header {
  padding: 10px 14px;
  background: #141419;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.schema-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.schema-row:last-child { border-bottom: none; }
.schema-row-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.prop-name { font-family: var(--mono); font-size: 13.5px; font-weight: 700; color: #f4f4f5; }
.prop-type { font-family: var(--mono); font-size: 12px; color: #a5b4fc; background: rgba(99,102,241,0.1); padding: 1px 6px; border-radius: 5px; }
.prop-req { font-size: 11px; font-weight: 700; color: #fda4af; background: var(--rose-bg); padding: 1px 6px; border-radius: 5px; text-transform: uppercase; }
.prop-opt { font-size: 11px; font-weight: 600; color: var(--text-dim); background: rgba(255,255,255,0.05); padding: 1px 6px; border-radius: 5px; }
.prop-def { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
.prop-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.schema-nested {
  margin-top: 10px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
}

/* Code language tabs */
.lang-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #141419;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 6px 10px;
}
.lang-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.lang-tab.active { background: rgba(99,102,241,0.18); color: #fff; }
.lang-tabs + .code-wrap pre.code { border-radius: 0 0 10px 10px; }

/* Enum chips */
.enum-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 18px; }
.enum-item {
  background: #101014;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}
.enum-item code { color: #34d399; font-weight: 600; display: block; margin-bottom: 3px; }
.enum-item span { color: var(--text-muted); font-size: 12.5px; }

@media (max-width: 900px) {
  .container { padding: 0 16px; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 18px 0 60px; }
  .docs-sidebar { display: none; }
  .docs-mobile-toc { display: block; }
  .enum-grid { grid-template-columns: 1fr; }
  .docs-section h2 { font-size: 21px; }
  pre.code { font-size: 12px; padding: 14px 12px; }
  .nav-actions .btn { padding: 7px 11px; font-size: 13px; }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
}
@media (max-width: 480px) {
  .docs-mobile-toc-links { grid-template-columns: 1fr; }
}

.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
