/* ============================================
   SpaceDB — app.css
   Modern dark design system
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg:           #0d1117;
  --bg-2:         #010409;
  --surface:      #161b22;
  --surface-2:    #21262d;
  --surface-3:    #2d333b;
  --border:       #21262d;
  --border-2:     #30363d;
  --text:         #e6edf3;
  --text-2:       #8b949e;
  --muted:        #6e7681;
  --accent:       #1f6feb;
  --accent-light: #58a6ff;
  --accent-glow:  rgba(31, 111, 235, 0.15);
  --purple:       #bc8cff;
  --purple-glow:  rgba(188, 140, 255, 0.12);
  --green:        #3fb950;
  --green-dim:    rgba(63, 185, 80, 0.12);
  --red:          #f85149;
  --red-dim:      rgba(248, 81, 73, 0.12);
  --yellow:       #d29922;
  --yellow-dim:   rgba(210, 153, 34, 0.12);
  --blue:         #58a6ff;
  --blue-dim:     rgba(88, 166, 255, 0.12);
  --radius:       5px;
  --radius-lg:    7px;
  --radius-xl:    9px;
  --font:         'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono:         'SF Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  --shadow:       0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg:    0 4px 8px rgba(0,0,0,0.5), 0 12px 40px rgba(0,0,0,0.4);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--text); }
img, svg { display: block; }

/* ---- Typography ---- */
h1, h2, h3, h4 { letter-spacing: -0.03em; line-height: 1.2; }

/* ---- Buttons ---- */
.btn-primary, .btn-ghost, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s ease;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #388bfd;
  color: #fff;
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-2);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
  transform: translateY(-1px);
}
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(248,81,73,0.3);
}
.btn-danger:hover {
  background: rgba(248,81,73,0.2);
  color: #fff;
  border-color: rgba(248,81,73,0.5);
}
.btn-lg { padding: 0.75rem 1.75rem; font-size: 0.95rem; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }
.btn-block { display: flex; justify-content: center; width: 100%; margin-top: 1rem; }

/* ---- Brand ---- */
.brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-accent { color: var(--accent-light); }

/* ====================================================
   Marketing Layout
   ==================================================== */

.marketing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.marketing-nav .nav-links { display: flex; align-items: center; gap: 0.25rem; }
.marketing-nav .nav-links-left { margin-left: 1.5rem; flex: 1; }
.marketing-nav .nav-links a {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: color .12s, background .12s;
}
.marketing-nav .nav-links a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.marketing-nav .nav-links a.active { color: var(--text); background: var(--surface); }
.marketing-nav .nav-links .btn-primary { color: #fff; padding: 0.4rem 1rem; }
.marketing-nav .nav-links .btn-primary:hover { color: #fff; background: #388bfd; }

.marketing-footer {
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text-2); text-decoration: none; }

/* ====================================================
   Hero
   ==================================================== */

.hero-wrap {
  position: relative;
  overflow: hidden;
}
/* Radial glow behind headline */
.hero-wrap::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse at center, rgba(31,111,235,0.08) 0%, rgba(31,111,235,0.03) 40%, transparent 70%);
  pointer-events: none;
}
/* Subtle grid pattern */
.hero-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(110,118,129,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110,118,129,0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 4.5rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 3rem; padding: 4rem 2rem; } }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(31,111,235,0.35);
  background: rgba(31,111,235,0.08);
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.75rem;
}
.hero-badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 6px var(--accent-light);
}
.hero h1 {
  font-size: clamp(2.2rem, 4vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 2.25rem;
  max-width: 520px;
}
.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ====================================================
   Code window
   ==================================================== */

.code-window {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.code-window-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.code-window-header:empty { display: none; }
.code-window-title {
  font-size: 0.78rem;
  color: var(--text-2);
  margin-left: 0.5rem;
  font-family: var(--mono);
  flex: 1;
}
.code-block {
  padding: 1.35rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.75;
  color: #f0f0ff;
  overflow-x: auto;
  background: var(--bg-2);
}
.code-block code { font-family: inherit; }

/* Hero code window glow */
.hero-code .code-window {
  box-shadow: var(--shadow-lg), 0 0 40px rgba(31,111,235,0.08);
}

/* === Orbiting planets === */
.hero-code {
  display: grid;
  place-items: center;
}
.hero-code > * {
  grid-column: 1;
  grid-row: 1;
}
.planet-svg {
  width: 720px;
  overflow: visible;
  pointer-events: none;
}
.hero-code .code-window {
  position: relative;
  z-index: 1;
}

/* ====================================================
   Features section
   ==================================================== */

.features {
  padding: 6rem 0;
  border-top: 1px solid var(--border);
  position: relative;
}
.section-inner { max-width: 1100px; margin: 0 auto; padding: 0 2rem; }
.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  margin-bottom: 1rem;
}
.features h2 {
  text-align: center;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}
.features .section-sub {
  text-align: center;
  color: var(--text-2);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto 3.5rem;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
@media (max-width: 768px) { .feature-grid { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--surface);
  padding: 1.75rem;
  transition: background .2s;
}
.feature-card:hover { background: var(--surface-2); }
.feature-icon-wrap {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1rem;
}
.feature-card h3 { font-size: 0.925rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text); }
.feature-card p { color: var(--text-2); font-size: 0.85rem; line-height: 1.65; }

/* ====================================================
   CTA band
   ==================================================== */

.cta-band {
  padding: 6rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-band::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  background: radial-gradient(ellipse at bottom, rgba(31,111,235,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.cta-inner { position: relative; z-index: 1; }
.cta-band h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.cta-band p { color: var(--text-2); font-size: 1.05rem; margin-bottom: 2rem; }

/* ====================================================
   Pricing
   ==================================================== */

.pricing-hero { padding: 5rem 0 2rem; text-align: center; }
.pricing-hero h1 { font-size: clamp(1.8rem, 4vw, 2.75rem); font-weight: 800; letter-spacing: -0.04em; margin-bottom: 0.75rem; }
.pricing-hero p { color: var(--text-2); font-size: 1.05rem; }
.pricing-section { padding: 3rem 0 6rem; }
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 820px; margin: 0 auto; }
@media (max-width: 640px) { .pricing-grid { grid-template-columns: 1fr; } }

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  position: relative;
  transition: border-color .2s, transform .2s;
}
.pricing-card:hover { border-color: #484f58; transform: translateY(-2px); }
.pricing-card-featured {
  border-color: rgba(31,111,235,0.4);
  background: linear-gradient(145deg, var(--surface) 0%, rgba(31,111,235,0.04) 100%);
  box-shadow: 0 0 0 1px rgba(31,111,235,0.12), var(--shadow);
}
.pricing-card-featured:hover { border-color: rgba(31,111,235,0.6); }

.pricing-badge {
  position: absolute; top: -0.7rem; left: 50%; transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 0.2rem 0.875rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(31,111,235,0.4);
}
.pricing-tier { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.75rem; }
.pricing-price { font-size: 2.75rem; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 0.25rem; }
.pricing-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-2); }
.pricing-desc { color: var(--text-2); font-size: 0.875rem; margin-bottom: 1.75rem; }
.pricing-divider { height: 1px; background: var(--border); margin-bottom: 1.5rem; }
.pricing-features { list-style: none; margin-bottom: 2rem; display: flex; flex-direction: column; gap: 0.6rem; }
.pricing-features li { font-size: 0.875rem; color: var(--text-2); display: flex; align-items: center; gap: 0.6rem; }
.pricing-features li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--green-dim); border: 1px solid rgba(63,185,80,0.3); flex-shrink: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%233fb950'%3E%3Cpath d='M6.5 11.5L3 8l1.1-1.1 2.4 2.4 5.4-5.4L13 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; background-size: 12px; }
.pricing-features li.unavailable { opacity: 0.4; }
.pricing-features li.unavailable::before { background-image: none; background: var(--surface-3); }

/* ====================================================
   Auth
   ==================================================== */

.auth-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.auth-body::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 700px; height: 500px;
  background: radial-gradient(ellipse at top, rgba(31,111,235,0.06) 0%, transparent 65%);
  pointer-events: none;
}
.auth-container { width: 100%; max-width: 400px; position: relative; z-index: 1; }
.auth-brand {
  display: block;
  text-align: center;
  margin-bottom: 2.25rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  text-decoration: none;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
}
.auth-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.25rem; }
.auth-sub { color: var(--text-2); font-size: 0.875rem; margin-bottom: 1.75rem; }
.auth-divider { height: 1px; background: var(--border); margin: 1.5rem 0; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-2); font-size: 0.875rem; }
.auth-footer a { color: var(--accent-light); font-weight: 500; }

/* ====================================================
   Forms
   ==================================================== */

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field textarea { resize: vertical; min-height: 80px; }
.field-help { font-size: 0.78rem; color: var(--muted); margin-top: 0.4rem; display: block; line-height: 1.5; }
.field-error { display: block; font-size: 0.8rem; color: var(--red); margin-top: 0.35rem; }
.field-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-label {
  display: flex; align-items: flex-start; gap: 0.625rem;
  cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--text-2);
}
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0;
  accent-color: var(--accent); margin-top: 2px;
}
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
.form-card { max-width: 620px; }
.help-text { font-size: 0.82rem; color: var(--text-2); margin-top: 0.5rem; }
.remember-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.75rem 0; }
.remember-row label { font-size: 0.875rem; color: var(--text-2); cursor: pointer; display: flex; align-items: center; gap: 0.5rem; }

/* ====================================================
   Alerts
   ==================================================== */

.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.5;
}
.alert-success { background: var(--green-dim); border: 1px solid rgba(63,185,80,0.25); color: #56d364; }
.alert-error   { background: var(--red-dim);   border: 1px solid rgba(248,81,73,0.25);  color: #ff7b72; }
.alert-info    { background: var(--blue-dim);  border: 1px solid rgba(88,166,255,0.25); color: #79c0ff; }

/* ====================================================
   Token reveal
   ==================================================== */

.token-reveal {
  background: rgba(63,185,80,0.06);
  border: 1px solid rgba(63,185,80,0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.token-reveal-header {
  display: flex; align-items: center; gap: 0.5rem;
  color: #56d364; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.875rem;
}
.token-code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--accent-light);
  user-select: all;
  cursor: text;
}
.token-copy-row { display: flex; align-items: stretch; gap: 0.5rem; }
.token-copy-row .token-code { flex: 1; }
.btn-copy {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0 0.875rem;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius); color: var(--text-2);
  font-size: 0.78rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background .12s, color .12s;
}
.btn-copy:hover { background: var(--surface-3); color: var(--text); }
.token-warn { font-size: 0.78rem; color: var(--muted); margin-top: 0.625rem; }

/* ====================================================
   Badges
   ==================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.badge-read  { background: rgba(31,111,235,0.12); border-color: rgba(31,111,235,0.3); color: var(--accent-light); }
.badge-write { background: rgba(188,140,255,0.12); border-color: rgba(188,140,255,0.3); color: var(--purple); }

/* ====================================================
   Portal nav
   ==================================================== */

.portal-nav {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 2rem;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
}
.portal-nav .nav-links { display: flex; gap: 0.1rem; flex: 1; margin-left: 1.5rem; align-items: center; }
.nav-divider { width: 1px; height: 18px; background: var(--border-2); margin: 0 0.5rem; flex-shrink: 0; }
.portal-nav .nav-links a {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: color .12s, background .12s;
}
.portal-nav .nav-links a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.portal-nav .nav-links a.active { color: var(--text); background: var(--surface-2); }
.portal-nav .nav-user { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.user-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all .12s;
}
.user-name:hover { color: var(--text); background: var(--surface); border-color: var(--border-2); text-decoration: none; }
.user-name-active { color: var(--text); background: var(--surface-2); border-color: var(--border-2); }

/* ====================================================
   Portal layout
   ==================================================== */

.portal-body { background: var(--bg); }
.portal-container { max-width: 1060px; margin: 0 auto; padding: 2.5rem 2rem; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.page-header p { color: var(--text-2); margin-top: 0.25rem; font-size: 0.875rem; }
.page-header-actions { display: flex; gap: 0.75rem; align-items: center; }

/* ====================================================
   Stats
   ==================================================== */

.stats-grid { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  display: block;
  transition: border-color .15s, background .15s;
}
a.stat-card {
  border-color: rgba(31,111,235,0.35);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(31,111,235,0.04) 100%);
}
a.stat-card:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--surface-2) 0%, rgba(31,111,235,0.08) 100%);
  text-decoration: none;
}
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; color: var(--text); line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--accent-light); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-card-link .stat-card-main { display: flex; align-items: center; justify-content: space-between; }
.stat-arrow { color: var(--accent); transition: color .15s, transform .15s; flex-shrink: 0; }
a.stat-card-link:hover .stat-arrow { transform: translateX(4px); }
.stat-sub { font-size: 0.8rem; color: var(--muted); margin-top: 0.625rem; padding-top: 0.625rem; border-top: 1px solid var(--border); }

/* ====================================================
   Cards
   ==================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-header {
  padding: 1rem 1.375rem;
  border-bottom: 1px solid var(--border-2);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text);
}
.card-body { padding: 1.375rem; }
.card-body > p { color: var(--text-2); margin-bottom: 1rem; font-size: 0.875rem; line-height: 1.6; }

/* ====================================================
   App list
   ==================================================== */

.app-list { display: flex; flex-direction: column; gap: 0.75rem; }
.app-card .card-body {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding: 1.25rem 1.375rem;
}
.app-name { font-weight: 600; font-size: 0.925rem; color: var(--text); }
.app-card a.app-name:hover { color: var(--accent-light); text-decoration: none; }
.app-desc { color: var(--text-2); font-size: 0.82rem; margin-top: 0.2rem; }
.app-meta { display: flex; align-items: center; gap: 0.875rem; flex-shrink: 0; }

/* ====================================================
   Table
   ==================================================== */

.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  text-align: left; padding: 0.75rem 1.25rem;
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-2);
  background: var(--surface-2);
}
.table td { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(110,118,129,0.05); }
.token-name { font-family: var(--mono); font-size: 0.82rem; color: var(--text); }

/* ====================================================
   Text helpers
   ==================================================== */

.text-muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 0.8rem; }

/* ====================================================
   Empty state
   ==================================================== */

.empty-state {
  text-align: center; padding: 4rem 2rem; color: var(--muted);
}
.empty-state p { margin-bottom: 1.25rem; font-size: 0.875rem; }

/* ====================================================
   Quick start card
   ==================================================== */

.quick-start .code-window { box-shadow: none; }
.quick-start .code-block { margin: 0.875rem 0; border-radius: var(--radius); }
.quick-start .card-body > p { margin-bottom: 0.35rem; font-size: 0.875rem; }

/* ====================================================
   Profile
   ==================================================== */

.profile-sections { max-width: 620px; }
.profile-sections .card { margin-bottom: 1.5rem; }
.card-danger { border-color: rgba(248,81,73,0.2); }
.card-danger .card-header { color: #ff7b72; }
.delete-confirm-form { border-top: 1px solid var(--border-2); margin-top: 1.25rem; padding-top: 1.5rem; }

/* ====================================================
   Pagination
   ==================================================== */

nav[aria-label="pagination"] { display: flex; justify-content: center; margin-top: 2rem; }
.pagination { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ====================================================
   Docs page
   ==================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 60px);
  max-width: 1280px;
  margin: 0 auto;
}
.docs-sidebar {
  border-right: 1px solid var(--border);
  padding: 2.5rem 0;
}
.docs-nav {
  position: sticky;
  top: 76px;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.docs-nav-section { display: flex; flex-direction: column; gap: 0.1rem; }
.docs-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 0.625rem;
  margin-bottom: 0.35rem;
}
.docs-nav a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  padding: 0.35rem 0.625rem;
  border-radius: var(--radius);
  transition: color .12s, background .12s;
}
.docs-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.docs-nav a.active { color: var(--accent-light); background: rgba(31,111,235,0.08); }

.docs-content { padding: 3rem 3.5rem 5rem; max-width: 840px; }
.docs-section { padding-bottom: 3.5rem; padding-top: 3rem; margin-bottom: 0; border-bottom: 1px solid var(--border); }
.docs-section:first-child { padding-top: 0; }
.docs-section:last-child { border-bottom: none; }
.docs-section h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 0.875rem; }
.docs-section h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.75rem; scroll-margin-top: 80px; }
.docs-section h3 { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 2rem 0 0.875rem; }
.docs-section p { color: var(--text-2); margin-bottom: 1rem; line-height: 1.75; font-size: 0.9rem; }
.docs-section p:last-child { margin-bottom: 0; }
.docs-lead { font-size: 1rem; color: var(--text-2); }
.docs-download { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 1rem; }
.docs-section code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  padding: 0.12em 0.45em;
  border-radius: 4px;
  color: var(--accent-light);
}

.docs-table-wrap { overflow-x: auto; margin: 1rem 0; border-radius: var(--radius-lg); border: 1px solid var(--border-2); }
.docs-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.docs-table thead tr { background: var(--surface-2); }
.docs-table th { text-align: left; padding: 0.7rem 1.125rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--border-2); }
.docs-table td { padding: 0.7rem 1.125rem; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; line-height: 1.5; }
.docs-table tr:last-child td { border-bottom: none; }
.docs-table td:first-child { color: var(--text); white-space: nowrap; }
.docs-table code { white-space: nowrap; }

.http-status { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; padding: 0.18rem 0.5rem; border-radius: 4px; }
.http-2xx { background: var(--green-dim); color: #56d364; border: 1px solid rgba(63,185,80,0.25); }
.http-4xx { background: var(--red-dim);   color: #ff7b72; border: 1px solid rgba(248,81,73,0.25); }

.endpoint-group {
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 1.25rem;
}
.endpoint { padding: 1.25rem 1.375rem; border-bottom: 1px solid var(--border); transition: background .12s; }
.endpoint:last-child { border-bottom: none; }
.endpoint:hover { background: rgba(110,118,129,0.04); }
.endpoint p { margin: 0.6rem 0 0.75rem; }
.docs-section > .code-window { margin: 1.25rem 0; }
.endpoint .code-window { margin-top: 0.875rem; }
.endpoint-header { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.endpoint-path { font-family: var(--mono); font-size: 0.875rem; color: var(--text); background: none; border: none; padding: 0; }
.endpoint-summary { color: var(--text-2); font-size: 0.85rem; }

.method {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 800;
  padding: 0.2rem 0.55rem; border-radius: 5px;
  min-width: 62px; letter-spacing: 0.04em;
}
.method-get    { background: var(--green-dim);  color: #56d364; border: 1px solid rgba(63,185,80,0.25); }
.method-post   { background: rgba(31,111,235,0.12); color: var(--accent-light); border: 1px solid rgba(31,111,235,0.25); }
.method-put    { background: var(--yellow-dim); color: #e3b341; border: 1px solid rgba(210,153,34,0.25); }
.method-patch  { background: rgba(188,140,255,0.12); color: var(--purple); border: 1px solid rgba(188,140,255,0.25); }
.method-delete { background: var(--red-dim);    color: #ff7b72; border: 1px solid rgba(248,81,73,0.25); }

.auth-required {
  margin-left: auto; font-size: 0.7rem; font-weight: 700;
  color: var(--yellow); background: var(--yellow-dim);
  border: 1px solid rgba(210,153,34,0.25);
  padding: 0.18rem 0.6rem; border-radius: 999px; white-space: nowrap;
}

#introduction, #base-url, #authentication, #responses,
#pagination, #errors, #stars, #planets, #moons, #spaceships {
  scroll-margin-top: 80px;
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { border-right: none; border-bottom: 1px solid var(--border); padding: 1.25rem; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.5rem 1.25rem; padding: 0; }
  .docs-nav-section { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.25rem; }
  .docs-nav-label { display: none; }
  .docs-content { padding: 2rem 1.25rem; }
}
