/* ==========================================================================
   Toolnexa — Design System v2
   Mobile-first, dual-theme (dark default + light), token driven.
   Developed by Asad Ullah.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-display: "Sora", "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;
  --blur: 14px;

  --maxw: 1180px;
  --nav-h: 62px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-fast: .16s var(--ease);
  --t: .28s var(--ease);
}

/* Dark (default) */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b16;
  --bg-soft: #0a1020;
  --bg-card: rgba(20, 27, 45, .72);
  --bg-card-hover: rgba(28, 37, 60, .86);
  --bg-elevated: #121a2c;
  --bg-inset: #0c1322;

  --border: rgba(148, 163, 184, .16);
  --border-strong: rgba(148, 163, 184, .34);

  --text: #eef2f9;
  --text-dim: #a3aec4;
  --text-faint: #6b7893;

  --accent: #22d3ee;
  --accent-2: #8b5cf6;
  --accent-dim: rgba(34, 211, 238, .12);
  --accent-text: #22d3ee;

  --success: #34d399;
  --success-dim: rgba(52, 211, 153, .12);
  --danger: #fb7185;
  --danger-dim: rgba(251, 113, 133, .12);
  --warn: #fbbf24;

  --gradient-btn: linear-gradient(120deg, #22d3ee 0%, #6366f1 55%, #8b5cf6 100%);
  --gradient-text: linear-gradient(100deg, #67e8f9 0%, #a78bfa 100%);
  --glow: 0 0 0 3px rgba(34, 211, 238, .16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .9);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .95);
  --nav-bg: rgba(7, 11, 22, .78);
  --grid-line: rgba(148, 163, 184, .07);
}

/* Light */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f9fc;
  --bg-soft: #eef2f8;
  --bg-card: rgba(255, 255, 255, .86);
  --bg-card-hover: #ffffff;
  --bg-elevated: #ffffff;
  --bg-inset: #eff3f9;

  --border: rgba(15, 23, 42, .1);
  --border-strong: rgba(15, 23, 42, .22);

  --text: #0d1526;
  --text-dim: #4a5670;
  --text-faint: #7b879e;

  --accent: #0891b2;
  --accent-2: #7c3aed;
  --accent-dim: rgba(8, 145, 178, .1);
  --accent-text: #0e7490;

  --success: #059669;
  --success-dim: rgba(5, 150, 105, .1);
  --danger: #e11d48;
  --danger-dim: rgba(225, 29, 72, .09);
  --warn: #b45309;

  --gradient-btn: linear-gradient(120deg, #0891b2 0%, #4f46e5 55%, #7c3aed 100%);
  --gradient-text: linear-gradient(100deg, #0e7490 0%, #6d28d9 100%);
  --glow: 0 0 0 3px rgba(8, 145, 178, .14);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 16px 36px -24px rgba(15, 23, 42, .35);
  --shadow-lg: 0 30px 60px -32px rgba(15, 23, 42, .4);
  --nav-bg: rgba(247, 249, 252, .82);
  --grid-line: rgba(15, 23, 42, .05);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(680px 380px at 12% -8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(620px 420px at 92% 4%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 72%);
}

body > * { position: relative; z-index: 1; }

img, svg, video { max-width: 100%; display: block; }
svg { flex-shrink: 0; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -.02em;
  color: var(--text);
  overflow-wrap: break-word;
}

h1 { font-size: clamp(1.85rem, 7vw, 3.25rem); }
h2 { font-size: clamp(1.4rem, 4.6vw, 2.1rem); }
h3 { font-size: 1.06rem; }

p { color: var(--text-dim); overflow-wrap: break-word; }

code, pre, kbd { font-family: var(--font-mono); }

::selection { background: color-mix(in srgb, var(--accent) 34%, transparent); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 18px;
}

@media (min-width: 768px) { .container { padding-inline: 28px; } }

.section { padding: 52px 18px; }
@media (min-width: 768px) { .section { padding: 84px 28px; } }

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 34px;
}
.section-head h2 { margin-top: 10px; }
.section-head p { margin-top: 12px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  padding: 5px 12px;
  border-radius: var(--radius-full);
}
.eyebrow-center { margin-inline: auto; }

.grid-2, .grid-3 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.breadcrumbs {
  font-size: 13px;
  color: var(--text-faint);
  padding-top: 20px;
}
.breadcrumbs a { color: var(--accent-text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast), box-shadow var(--t), background var(--t), border-color var(--t), opacity var(--t);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--gradient-btn);
  color: #fff;
  box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--accent-2) 90%, transparent);
}
.btn-primary:hover { box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--accent-2) 95%, transparent); }

.btn-ghost {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}
.btn-ghost:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }

.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }

.btn-sm { padding: 9px 14px; font-size: 13.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 15px 26px; font-size: 16px; }
.btn-block { width: 100%; }

/* ---------- Header / Nav ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t), box-shadow var(--t);
}
.topbar.is-stuck { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }

.topbar-inner {
  min-height: var(--nav-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17.5px;
  letter-spacing: -.02em;
  color: var(--text);
  min-width: 0;
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--gradient-btn);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent);
}

.nav-links { display: none; }

@media (min-width: 1024px) {
  .topbar-inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: center;
    flex-wrap: nowrap;
  }
  .nav-links a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dim);
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    transition: color var(--t-fast), background var(--t-fast);
    white-space: nowrap;
  }
  .nav-links a:hover { color: var(--text); background: var(--bg-card); }
  .nav-links a.active { color: var(--accent-text); background: var(--accent-dim); }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-actions .btn { display: none; }
@media (min-width: 1024px) { .nav-actions .btn { display: inline-flex; } }

/* Theme toggle */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.theme-toggle:hover { color: var(--accent-text); border-color: var(--border-strong); }
.theme-toggle:active { transform: scale(.92) rotate(-12deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Hamburger */
.hamburger {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0;
}
.hamburger::after {
  content: "";
  width: 17px;
  height: 11px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  position: relative;
  transition: transform var(--t);
}
@media (min-width: 1024px) { .hamburger { display: none; } }

/* Mobile drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(3, 6, 15, .6);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  width: min(84vw, 330px);
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition: transform .32s var(--ease);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}
.drawer.open { transform: translateX(0); }
body.drawer-open { overflow: hidden; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.drawer-close {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: grid; place-items: center;
  font-size: 20px; line-height: 1;
}
.drawer-close:hover { color: var(--text); }

.drawer-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 14px 6px 6px;
}
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 15px;
  transition: background var(--t-fast), color var(--t-fast);
}
.drawer-nav a svg { width: 18px; height: 18px; opacity: .85; }
.drawer-nav a:hover { background: var(--bg-card); color: var(--text); }
.drawer-nav a.active { background: var(--accent-dim); color: var(--accent-text); }
.drawer-cta { display: grid; gap: 8px; margin-top: 18px; }
.drawer-foot {
  margin-top: auto;
  padding-top: 18px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.drawer-foot strong { color: var(--text-dim); }

/* ---------- Cards & panels ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  transition: transform var(--t), border-color var(--t), background var(--t), box-shadow var(--t);
}
.card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 8px; }
.card p { font-size: 14.5px; }

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: var(--accent-text);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ---------- Hero ---------- */
.hero { padding: 44px 18px 20px; }
@media (min-width: 768px) { .hero { padding: 76px 28px 28px; } }

.hero-grid { display: grid; gap: 30px; align-items: center; }
@media (min-width: 1000px) { .hero-grid { grid-template-columns: 1.05fr .95fr; gap: 46px; } }

.hero h1 { margin: 16px 0 14px; }
.hero h1 .grad {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { font-size: clamp(15px, 4vw, 17.5px); max-width: 54ch; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.hero-actions .btn { flex: 1 1 auto; min-width: 150px; }
@media (min-width: 640px) { .hero-actions .btn { flex: 0 0 auto; } }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 30px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.hero-stats div span {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 700;
  color: var(--text);
}
.hero-stats div small {
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* Terminal */
.terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-inset);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.terminal-body {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.85;
  overflow-x: auto;
}
@media (min-width: 480px) { .terminal-body { font-size: 12.5px; } }
.t-line { color: var(--text-dim); white-space: pre; }
.t-prompt { color: var(--accent-text); }
.t-str { color: var(--success); }
.t-key { color: var(--accent-2); }
.t-cursor {
  display: inline-block;
  width: 7px; height: 13px;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: -2px;
  animation: blink 1.1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- FAQ ---------- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--t);
}
.faq-item.open { border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}
.faq-q .chev { color: var(--text-faint); transition: transform var(--t); flex-shrink: 0; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); color: var(--accent-text); }
.faq-a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t);
}
.faq-item.open .faq-a { grid-template-rows: 1fr; }
.faq-a > * { overflow: hidden; }
.faq-a p { padding: 0 18px 16px; font-size: 14.5px; }
.faq-a a { color: var(--accent-text); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label,
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}
.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  font-size: 16px; /* prevents iOS zoom */
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.field select { appearance: none; background-image: none; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus { border-color: var(--accent); box-shadow: var(--glow); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 13.5px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
}
.check-row input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}
.check-row a { color: var(--accent-text); }

.form-error,
.form-success {
  display: none;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
}
.form-error { background: var(--danger-dim); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.form-success { background: var(--success-dim); border-color: color-mix(in srgb, var(--success) 45%, transparent); color: var(--success); }

/* Auth pages */
.auth-shell {
  min-height: calc(100vh - var(--nav-h));
  display: grid;
  place-items: center;
  padding: 36px 18px 60px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
}
@media (min-width: 480px) { .auth-card { padding: 34px 30px; } }
.auth-card h1 { font-size: clamp(1.5rem, 6vw, 1.85rem); }
.auth-sub { font-size: 14.5px; margin: 8px 0 22px; }
.auth-switch { margin-top: 20px; font-size: 14px; text-align: center; }
.auth-switch a { color: var(--accent-text); font-weight: 600; }

/* ---------- Dashboard shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding-block: 26px 60px;
  align-items: start;
}
@media (min-width: 900px) {
  .app-shell { grid-template-columns: 216px minmax(0, 1fr); gap: 28px; }
}

.sidebar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
@media (min-width: 900px) {
  .sidebar {
    flex-direction: column;
    overflow: visible;
    position: sticky;
    top: calc(var(--nav-h) + 20px);
  }
}
.side-link {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.side-link:hover { background: var(--bg-card); color: var(--text); }
.side-link.active {
  background: var(--accent-dim);
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.app-main { min-width: 0; }
.page-title { font-size: clamp(1.55rem, 6vw, 2.1rem); }
.page-sub { font-size: 14.5px; margin: 8px 0 24px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 860px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.stat-label {
  font-size: 11.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 5vw, 1.7rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.stat-value.accent {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.meta-list { display: grid; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.meta-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-elevated);
  font-size: 14px;
}
.meta-list > div > span:first-child { color: var(--text-faint); }
.meta-list > div > span:last-child { color: var(--text); font-weight: 500; text-align: right; overflow-wrap: anywhere; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid;
}
.badge-active { color: var(--success); background: var(--success-dim); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.badge-muted { color: var(--text-faint); background: var(--bg-inset); border-color: var(--border); }

.key-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-inset);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 13px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}
.key-box > span { min-width: 0; overflow-wrap: anywhere; }

/* Tables (mobile-safe) */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  overflow-wrap: anywhere;
}
tbody tr:last-child td { border-bottom: 0; }
tbody code { font-size: 12.5px; color: var(--accent-text); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Code blocks ---------- */
.code-block {
  position: relative;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.code-block pre {
  padding: 14px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-dim);
  -webkit-overflow-scrolling: touch;
}
.code-block pre code { color: inherit; }

.copy-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 7px;
  padding: 5px 10px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.copy-btn:hover { color: var(--accent-text); border-color: var(--border-strong); }
.copy-btn.copied { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); }

/* ---------- API docs ---------- */
.docs-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding-block: 24px 70px;
  align-items: start;
}
@media (min-width: 1000px) {
  .docs-shell { grid-template-columns: 236px minmax(0, 1fr); gap: 36px; }
}

.docs-nav {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 14px;
  max-height: 62vh;
  overflow-y: auto;
}
@media (min-width: 1000px) {
  .docs-nav { position: sticky; top: calc(var(--nav-h) + 20px); max-height: calc(100vh - var(--nav-h) - 46px); }
}
.docs-nav .drawer-label { margin: 12px 4px 6px; }
.docs-nav .drawer-label:first-child { margin-top: 0; }
.docs-nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  transition: color var(--t-fast), background var(--t-fast);
}
.docs-nav a:hover { color: var(--text); background: var(--bg-elevated); }
.docs-nav a.active { color: var(--accent-text); background: var(--accent-dim); }

.docs-main { min-width: 0; }
.docs-main h2 {
  margin: 42px 0 12px;
  padding-top: 6px;
  font-size: clamp(1.3rem, 5vw, 1.7rem);
}
.docs-main h2:first-child { margin-top: 0; }
.docs-main h3 { margin: 26px 0 10px; font-size: 1rem; }
.docs-main p { margin-bottom: 12px; font-size: 14.5px; }
.docs-main ul, .docs-main ol { margin: 0 0 14px 20px; color: var(--text-dim); font-size: 14.5px; }
.docs-main li { margin-bottom: 6px; }
.docs-main a { color: var(--accent-text); }
.docs-main code:not(pre code) {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
  color: var(--accent-text);
  overflow-wrap: anywhere;
}

.endpoint {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  overflow: hidden;
  margin-bottom: 20px;
}
.endpoint-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 15px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.endpoint-body { padding: 16px 15px 4px; }
.endpoint-body > *:last-child { margin-bottom: 16px; }

.method {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid;
  flex-shrink: 0;
}
.method-get { color: var(--accent); background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.method-post { color: var(--success); background: var(--success-dim); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.method-del { color: var(--danger); background: var(--danger-dim); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
  min-width: 0;
  flex: 1 1 190px;
}
.pill {
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text-faint);
  background: var(--bg-inset);
}
.pill-auth { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.pill-free { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-dim); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab {
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--bg-inset);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-dim); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 40px 0 26px;
  margin-top: 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 18px;
}
@media (min-width: 860px) { .footer-grid { grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; } }
.footer-col h4 {
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}
.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--text-dim);
  padding: 5px 0;
  transition: color var(--t-fast);
}
.footer-col a:hover { color: var(--accent-text); }
.footer-col p { font-size: 13.5px; }
.footer-brand { grid-column: 1 / -1; }
@media (min-width: 860px) { .footer-brand { grid-column: auto; } }

.footer-bottom {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}
@media (min-width: 640px) {
  .footer-bottom { flex-direction: row; justify-content: space-between; text-align: left; }
}
.dev-credit { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dev-credit strong {
  font-weight: 700;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 380px);
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 15px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .3s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Legal / prose pages ---------- */
.prose { max-width: 760px; }
.prose h1 { margin-bottom: 8px; }
.prose h2 { font-size: 1.15rem; margin: 30px 0 10px; }
.prose p, .prose li { font-size: 15px; color: var(--text-dim); }
.prose ul, .prose ol { margin: 0 0 14px 20px; line-height: 1.85; }
.prose a { color: var(--accent-text); }
.prose .updated { font-size: 13px; color: var(--text-faint); margin-bottom: 24px; }

/* ---------- Tool page shared bits ---------- */
.tool-hero { padding: 40px 18px 8px; text-align: center; }
@media (min-width: 768px) { .tool-hero { padding: 68px 28px 10px; } }
.tool-hero h1 { margin: 14px 0 12px; }
.tool-hero p { max-width: 560px; margin-inline: auto; font-size: 15.5px; }

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 700px;
  margin: 26px auto 0;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
}
@media (min-width: 640px) { .tool-card { padding: 28px; } }
