/* ==========================================================================
   CausalDataAI — Design System
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surface */
  --bg-app: #fafafa;
  --bg-card: #ffffff;
  --bg-muted: #f5f5f7;
  --bg-hover: #f0f0f3;
  --bg-inverse: #0a0a0f;
  --bg-inverse-hover: #16161f;

  /* Border */
  --border: #e6e6ea;
  --border-strong: #d4d4d8;
  --border-focus: #6366f1;

  /* Text */
  --text-1: #0a0a0f;      /* Highest emphasis */
  --text-2: #52525b;      /* Body */
  --text-3: #71717a;      /* Secondary */
  --text-4: #a1a1aa;      /* Muted / captions */
  --text-inv-1: #fafafa;
  --text-inv-2: #a1a1aa;
  --text-inv-3: #71717a;

  /* Brand */
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-active: #3730a3;
  --brand-soft: #eef2ff;
  --brand-ring: rgba(99, 102, 241, 0.35);

  /* Semantic */
  --success: #059669;
  --success-soft: #ecfdf5;
  --success-text: #065f46;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-text: #991b1b;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-text: #92400e;

  /* Data viz semantic (R/NR × Pre/Post) */
  --data-r-pre: #2563eb;
  --data-r-post: #059669;
  --data-nr-pre: #dc2626;
  --data-nr-post: #d97706;
  --data-r-pred: #0891b2;
  --data-nr-pred: #7c3aed;

  /* Radii */
  --r-1: 6px;
  --r-2: 8px;
  --r-3: 10px;
  --r-4: 12px;
  --r-5: 16px;
  --r-6: 20px;
  --r-pill: 999px;

  /* Shadows — layered for realism */
  --shadow-xs: 0 1px 1px rgba(15, 15, 25, 0.03);
  --shadow-sm: 0 1px 2px rgba(15, 15, 25, 0.06), 0 1px 1px rgba(15, 15, 25, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(15, 15, 25, 0.06), 0 2px 4px -2px rgba(15, 15, 25, 0.04);
  --shadow-lg: 0 12px 24px -8px rgba(15, 15, 25, 0.12), 0 4px 8px -4px rgba(15, 15, 25, 0.06);
  --shadow-xl: 0 24px 48px -12px rgba(15, 15, 25, 0.18);
  --shadow-focus: 0 0 0 3px var(--brand-ring);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 260ms;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --content-max: 1280px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

a { color: var(--brand); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--brand-hover); }

::selection { background: var(--brand-soft); color: var(--brand-active); }

button { font-family: inherit; }

hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Focus rings */
:where(button, a, input, select, textarea, [tabindex]):focus { outline: none; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-2);
}

/* Icons */
.icon { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }
.icon-lg { width: 20px; height: 20px; }

/* ==========================================================================
   Typography
   ========================================================================== */
.h-display { font-size: 2.5rem; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
.h-1 { font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; }
.h-2 { font-size: 1.125rem; line-height: 1.4; letter-spacing: -0.01em; font-weight: 600; }
.h-3 { font-size: 0.9375rem; line-height: 1.4; font-weight: 600; }
.text-body { font-size: 0.875rem; line-height: 1.55; color: var(--text-2); }
.text-caption { font-size: 0.8125rem; line-height: 1.5; color: var(--text-3); }
.text-mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.text-eyebrow { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-4); }
.text-num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Layout
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--bg-inverse);
  color: var(--text-inv-1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
}

.sidebar-brand {
  padding: 1.125rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.sidebar-brand-name { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; color: #fff; }

.sidebar-section-label {
  padding: 1.25rem 1rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-inv-3);
}

.sidebar-nav { flex: 1; padding: 0.5rem; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-2);
  color: var(--text-inv-2);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item .icon { color: var(--text-inv-3); }
.nav-item.active .icon { color: #a5b4fc; }

.sidebar-user {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0.75rem;
  display: flex; align-items: center; gap: 0.625rem;
}
.avatar {
  width: 32px; height: 32px; border-radius: var(--r-pill);
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 0.75rem; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8125rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: 0.6875rem; color: var(--text-inv-3); }
.sidebar-user button.icon-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-inv-2);
  width: 30px; height: 30px;
  border-radius: var(--r-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.sidebar-user button.icon-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }

/* Main content */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
}
.topbar-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-1); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.content {
  flex: 1;
  padding: 2rem;
  max-width: var(--content-max);
  width: 100%;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  --btn-bg: var(--bg-card);
  --btn-color: var(--text-1);
  --btn-border: var(--border);
  --btn-shadow: var(--shadow-xs);
  --btn-hover-bg: var(--bg-muted);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.5rem 0.875rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--r-2);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-color);
  cursor: pointer;
  box-shadow: var(--btn-shadow);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--btn-hover-bg); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { color: currentColor; opacity: 0.75; }

.btn-primary {
  --btn-bg: var(--brand);
  --btn-color: #fff;
  --btn-border: var(--brand);
  --btn-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
  --btn-hover-bg: var(--brand-hover);
}
.btn-primary:hover { border-color: var(--brand-hover); }

.btn-dark {
  --btn-bg: var(--bg-inverse);
  --btn-color: #fff;
  --btn-border: var(--bg-inverse);
  --btn-hover-bg: var(--bg-inverse-hover);
}

.btn-danger {
  --btn-bg: var(--bg-card);
  --btn-color: var(--danger);
  --btn-border: var(--border);
  --btn-hover-bg: var(--danger-soft);
}
.btn-danger:hover { border-color: #fecaca; }

.btn-ghost {
  --btn-bg: transparent;
  --btn-color: var(--text-2);
  --btn-border: transparent;
  --btn-shadow: none;
  --btn-hover-bg: var(--bg-muted);
}

.btn-lg { padding: 0.6875rem 1.125rem; font-size: 0.875rem; }
.btn-sm { padding: 0.375rem 0.625rem; font-size: 0.75rem; gap: 0.25rem; }
.btn-icon { padding: 0.5rem; width: 32px; }
.btn-block { width: 100%; }

/* Button group */
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-top-left-radius: var(--r-2); border-bottom-left-radius: var(--r-2); }
.btn-group .btn:last-child { border-top-right-radius: var(--r-2); border-bottom-right-radius: var(--r-2); }
.btn-group .btn + .btn { border-left-width: 0; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.field-hint { font-size: 0.75rem; color: var(--text-3); }
.field-error { color: var(--danger); font-size: 0.75rem; }

.input, .select, .textarea {
  width: 100%;
  padding: 0.5625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
  background: var(--bg-card);
  color: var(--text-1);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}
.input::placeholder { color: var(--text-4); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.input-group { position: relative; }
.input-group .input { padding-left: 2.25rem; }
.input-group .icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-pill);
  transition: background var(--dur-base) var(--ease-out);
  cursor: pointer;
}
.switch-track::before {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--dur-base) var(--ease-out);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::before { transform: translateX(14px); }

/* ==========================================================================
   Card
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  overflow: hidden;
}
.card + .card { margin-top: 1rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header-left { display: flex; align-items: center; gap: 0.625rem; }
.card-header h2 { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.005em; }
.card-header-desc { font-size: 0.8125rem; color: var(--text-3); margin-top: 0.125rem; }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.step-number {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ==========================================================================
   Auth pages — cinematic entrance, brand-continuous with landing
   ========================================================================== */
:root {
  /* Shared cinematic tokens (reused in sidebar + page headers below) */
  --cin-navy-900: #06111f;
  --cin-navy-800: #0a1930;
  --cin-navy-700: #0d2033;
  --cin-navy-600: #122a44;
  --cin-cyan: #22d3ee;
  --cin-cyan-soft: rgba(34, 211, 238, 0.18);
  --cin-cyan-faint: rgba(34, 211, 238, 0.08);
  --cin-indigo: #818cf8;
  --cin-violet: #a78bfa;
  --cin-text-1: #e5edf7;
  --cin-text-2: #a6b4c8;
  --cin-text-3: #6c7a92;
  --cin-border: rgba(255, 255, 255, 0.08);
  --cin-border-strong: rgba(255, 255, 255, 0.14);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--cin-navy-900);
  color: var(--cin-text-1);
  position: relative;
  overflow: hidden;
  font-family: var(--font-sans);
}
/* Grid lines texture */
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  mask-image: radial-gradient(1200px 800px at 70% 50%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(1200px 800px at 70% 50%, #000 20%, transparent 70%);
  pointer-events: none;
}
/* Aurora glows */
.auth-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(720px circle at 18% 25%, rgba(34, 211, 238, 0.09), transparent 55%),
    radial-gradient(560px circle at 85% 85%, rgba(167, 139, 250, 0.07), transparent 60%);
  pointer-events: none;
}

/* LEFT STAGE — brand-strap column on wide screens */
.auth-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.25rem 2.5rem;
  min-height: 100vh;
  z-index: 1;
}
.auth-stage-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--cin-text-1);
  text-decoration: none;
  width: fit-content;
}
.auth-stage-brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(129, 140, 248, 0.22));
  border: 1px solid var(--cin-border-strong);
  color: var(--cin-cyan);
  box-shadow: 0 6px 20px -8px rgba(34, 211, 238, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.auth-stage-brand-mark svg { width: 18px; height: 18px; }
.auth-stage-brand-name {
  font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--cin-text-1);
}

.auth-stage-copy { max-width: 480px; }
.auth-stage-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cin-cyan);
  padding: 0.3125rem 0.625rem;
  border: 1px solid var(--cin-cyan-soft);
  border-radius: 999px;
  background: var(--cin-cyan-faint);
  margin-bottom: 1.25rem;
}
.auth-stage-eyebrow::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cin-cyan);
  box-shadow: 0 0 10px var(--cin-cyan);
}
.auth-stage-title {
  font-size: 2.125rem;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--cin-text-1);
  margin-bottom: 1rem;
}
.auth-stage-title .accent {
  background: linear-gradient(120deg, var(--cin-cyan), var(--cin-indigo) 60%, var(--cin-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-stage-sub {
  color: var(--cin-text-2);
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: 440px;
}
.auth-stage-trust {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 2rem;
}
.auth-stage-trust-item {
  display: flex; align-items: center; gap: 0.625rem;
  font-size: 0.8125rem;
  color: var(--cin-text-2);
}
.auth-stage-trust-item svg {
  width: 15px; height: 15px;
  color: var(--cin-cyan);
  flex-shrink: 0;
}

.auth-stage-footer {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--cin-text-3);
  text-transform: uppercase;
}
.auth-stage-footer .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--cin-text-3);
  opacity: 0.6;
}

/* RIGHT PANE — the auth container */
.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.75rem;
}

/* The visible brand in the auth container is hidden on wide screens
   (stage shows it instead), shown on narrow screens. */
.auth-brand {
  display: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 2.125rem 2rem 1.75rem;
  box-shadow:
    0 24px 60px -24px rgba(2, 10, 24, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
  isolation: isolate;
}
/* Thin cyan accent at top of the card */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cin-cyan) 30%, var(--cin-indigo) 70%, transparent);
  opacity: 0.9;
}
.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text-1);
  margin-bottom: 0.375rem;
}
.auth-card .subtitle {
  color: var(--text-3);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}
.auth-card form { display: flex; flex-direction: column; gap: 1rem; }
.auth-card .btn-block { margin-top: 0.5rem; }

.auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--cin-text-2);
}
.auth-footer a { font-weight: 500; color: var(--cin-cyan); }
.auth-footer a:hover { color: #67e8f9; }

/* Mobile / narrow */
@media (max-width: 900px) {
  .auth-page {
    grid-template-columns: 1fr;
  }
  .auth-stage {
    display: none;
  }
  .auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.75rem;
    color: var(--cin-text-1);
  }
  .auth-brand .auth-stage-brand-mark { width: 32px; height: 32px; }
  .auth-brand-name {
    font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--cin-text-1);
  }
  .auth-container {
    padding: 2.5rem 1.25rem;
  }
}

/* Landing */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: var(--bg-app);
  position: relative;
  overflow: hidden;
}
.landing::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px circle at 30% 30%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(700px circle at 70% 70%, rgba(168, 85, 247, 0.06), transparent 60%);
  pointer-events: none;
}
.landing-inner { position: relative; max-width: 540px; }
.landing-mark {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.5rem;
  margin: 0 auto 1.5rem;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}
.landing h1 {
  font-size: 2.75rem;
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin-bottom: 1rem;
}
.landing p {
  color: var(--text-3);
  font-size: 1.0625rem;
  line-height: 1.55;
  margin-bottom: 2rem;
  max-width: 440px;
  margin-left: auto; margin-right: auto;
}
.landing-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* ==========================================================================
   Page header
   ========================================================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header-left { min-width: 0; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header p { color: var(--text-3); font-size: 0.875rem; margin-top: 0.25rem; }
.page-header-actions { display: flex; align-items: center; gap: 0.5rem; }

/* ==========================================================================
   Stepper (progress-style)
   ========================================================================== */
.stepper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-xs);
}
.step-tab {
  flex: 1;
  padding: 0.5625rem 0.875rem;
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  border-radius: var(--r-2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  border: none;
  background: transparent;
  font-family: inherit;
  position: relative;
}
.step-tab:hover { color: var(--text-1); background: var(--bg-muted); }
.step-tab.active { background: var(--bg-muted); color: var(--text-1); font-weight: 600; }
.step-tab .step-index {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-3);
  font-size: 0.6875rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}
.step-tab.active .step-index { background: var(--brand); color: #fff; }
.step-tab.done .step-index { background: var(--success); color: #fff; }
.step-tab.done { color: var(--text-2); }

.step-panel { display: none; }
.step-panel.active { display: block; animation: fade-slide var(--dur-slow) var(--ease-out); }
@keyframes fade-slide { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Toolbar row (context strip at top of dashboard)
   ========================================================================== */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-xs);
}
.toolbar-row > .field { min-width: 200px; }
.toolbar-row > .field-inline { flex: 1; display: flex; align-items: center; gap: 0.5rem; }
.toolbar-row .divider { width: 1px; align-self: stretch; background: var(--border); }

/* ==========================================================================
   KPI tiles
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: 0.875rem 1rem;
}
.kpi-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.375rem;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.kpi-hint { margin-top: 0.375rem; font-size: 0.75rem; color: var(--text-3); }

/* ==========================================================================
   Chips
   ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.3125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  transition: all var(--dur-fast) var(--ease-out);
}
.chip-info { background: var(--brand-soft); color: var(--brand-active); border-color: transparent; }

.chip-btn { cursor: pointer; user-select: none; }
.chip-btn:hover { border-color: var(--border-strong); }
.chip-btn.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-active);
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ==========================================================================
   Data table
   ========================================================================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-3); background: var(--bg-card); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; }
.data-table th {
  text-align: left;
  padding: 0.625rem 0.875rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.data-table td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--bg-muted); }
.data-table td.num { text-align: right; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-1); }
.data-table input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }

/* ==========================================================================
   Tags / status pills
   ========================================================================== */
.tag {
  display: inline-flex; align-items: center; gap: 0.3125rem;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  line-height: 1.2;
}
.tag-success { background: var(--success-soft); color: var(--success-text); }
.tag-danger { background: var(--danger-soft); color: var(--danger-text); }
.tag-warning { background: var(--warning-soft); color: var(--warning-text); }
.tag-neutral { background: var(--bg-muted); color: var(--text-2); border-color: var(--border); }
.tag-brand { background: var(--brand-soft); color: var(--brand-active); }

.tag-dot { width: 6px; height: 6px; border-radius: 50%; }
.tag-success .tag-dot { background: var(--success); }
.tag-danger .tag-dot { background: var(--danger); }
.tag-warning .tag-dot { background: var(--warning); }
.tag-neutral .tag-dot { background: var(--text-4); }
.tag-brand .tag-dot { background: var(--brand); }

/* ==========================================================================
   Charts
   ========================================================================== */
.chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: 0.75rem;
  min-height: 440px;
  position: relative;
}
.chart-title {
  padding: 0.25rem 0.5rem 0.75rem;
  display: flex; align-items: center; justify-content: space-between;
}
.chart-title h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.chart-empty {
  min-height: 380px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-4);
  font-size: 0.8125rem;
  text-align: center;
  padding: 2rem;
  gap: 0.75rem;
}
.chart-empty .icon { color: var(--text-4); }

.chart-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(2px);
  border-radius: var(--r-3);
  z-index: 5;
  gap: 0.75rem;
  color: var(--text-3);
  font-size: 0.8125rem;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* In-button spinner for async actions (LLM, Enrichr). Smaller than the
   full-panel .spinner so it sits comfortably inside a button row. */
.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.btn.is-busy { opacity: 0.85; cursor: progress; }

/* In-panel progress card shown while an LLM / Enrichr request is in flight. */
.inline-progress {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  margin-top: 0.75rem;
}
.inline-progress .btn-spinner {
  color: var(--brand);
  width: 18px; height: 18px;
  margin-top: 2px;
}
.inline-progress-title { font-weight: 600; color: var(--text-1); font-size: 0.875rem; }
.inline-progress-hint { color: var(--text-3); font-size: 0.75rem; margin-top: 0.125rem; }
.inline-progress-error {
  padding: 0.75rem 1rem;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--r-3);
  color: var(--danger, #b91c1c);
  font-size: 0.875rem;
}

/* ==========================================================================
   Alerts (inline info blocks)
   ========================================================================== */
.alert {
  display: flex; align-items: flex-start; gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--r-2);
  font-size: 0.8125rem;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert .icon { flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--brand-soft); color: var(--brand-active); border-color: #c7d2fe; }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: #a7f3d0; }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); border-color: #fde68a; }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); border-color: #fecaca; }
.alert-muted { background: var(--bg-muted); color: var(--text-2); border-color: var(--border); }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-region {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  z-index: 100;
  pointer-events: none;
}
.toast {
  min-width: 280px;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 0.875rem;
  display: flex; align-items: flex-start; gap: 0.625rem;
  font-size: 0.8125rem;
  pointer-events: auto;
  animation: toast-in var(--dur-slow) var(--ease-out);
}
.toast-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.toast.success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast.info .toast-icon { background: var(--brand-soft); color: var(--brand); }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-1); }
.toast-desc { color: var(--text-3); margin-top: 0.125rem; font-size: 0.75rem; white-space: pre-line; }
.toast-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-4); padding: 0; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-1);
}
.toast-close:hover { background: var(--bg-muted); color: var(--text-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Segmented control (for method radio in step 4)
   ========================================================================== */
.segment {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: var(--r-2);
  border: 1px solid var(--border);
}
.segment-option {
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  border: none;
  background: transparent;
  font-family: inherit;
}
.segment-option.active {
  background: var(--bg-card);
  color: var(--text-1);
  box-shadow: var(--shadow-sm);
}

/* Method cards (radio-styled) */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.method-card {
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: 0.875rem 1rem;
  cursor: pointer;
  background: var(--bg-card);
  transition: all var(--dur-fast) var(--ease-out);
}
.method-card:hover { border-color: var(--border-strong); }
.method-card.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--shadow-focus); }
.method-card input { display: none; }
.method-card-title { font-size: 0.875rem; font-weight: 600; color: var(--text-1); display: flex; align-items: center; gap: 0.375rem; }
.method-card-desc { font-size: 0.75rem; color: var(--text-3); margin-top: 0.25rem; line-height: 1.5; }
.method-card.active .method-card-desc { color: var(--brand-active); }

/* ==========================================================================
   Upload dropzone
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-4);
  padding: 2rem;
  text-align: center;
  background: var(--bg-muted);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.dropzone-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.75rem;
  border: 1px solid var(--border);
}
.dropzone-title { font-size: 0.875rem; font-weight: 600; color: var(--text-1); }
.dropzone-hint { font-size: 0.75rem; color: var(--text-3); margin-top: 0.25rem; }
.dropzone input[type="file"] { display: none; }

.upload-note {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: 1rem 1.125rem;
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.55;
}
.upload-note strong { color: var(--text-1); font-weight: 600; }
.upload-note ul { margin: 0.5rem 0 0 1.125rem; color: var(--text-2); }
.upload-note li { margin-bottom: 0.25rem; }
.upload-note code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-card);
  padding: 0.0625rem 0.375rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-1);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  margin-right: 0.25rem;
  vertical-align: middle;
}
.badge-muted { color: var(--text-3, #71717a); }

.section-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px dashed var(--border);
}
.section-subhead-title { font-weight: 600; color: var(--text-1); font-size: 0.875rem; }
.section-subhead-hint { color: var(--text-2); font-size: 0.75rem; }
.chart-frame {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--bg-card);
  padding: 0.25rem 0.5rem;
}
#spectrum-wrap { margin-bottom: 0.75rem; }

/* ==========================================================================
   Gene tables layout
   ========================================================================== */
.gene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.gene-panel-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8125rem; font-weight: 600;
  margin-bottom: 0.625rem;
  color: var(--text-1);
}

/* ==========================================================================
   Markdown output
   ========================================================================== */
.markdown-body { font-size: 0.875rem; line-height: 1.6; color: var(--text-2); }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1rem 0 0.5rem; color: var(--text-1); font-weight: 600; }
.markdown-body p { margin-bottom: 0.75rem; }
.markdown-body ul, .markdown-body ol { margin: 0.5rem 0 0.75rem 1.25rem; }
.markdown-body strong { color: var(--text-1); font-weight: 600; }
.markdown-body blockquote {
  border-left: 3px solid var(--brand);
  padding: 0.5rem 0.875rem;
  margin: 0.75rem 0;
  background: var(--brand-soft);
  border-radius: 0 var(--r-2) var(--r-2) 0;
  color: var(--brand-active);
}
.markdown-body code {
  font-family: var(--font-mono); font-size: 0.8125rem;
  background: var(--bg-muted);
  padding: 0.0625rem 0.3125rem;
  border-radius: 4px;
}

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-3);
}
.empty-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg-muted);
  color: var(--text-4);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.75rem;
}
.empty-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-1); margin-bottom: 0.25rem; }
.empty-desc { font-size: 0.8125rem; color: var(--text-3); max-width: 320px; margin: 0 auto 1rem; }

/* Compact variant for the step-1 "ready to load" card: when the dataset is
   already picked in the toolbar above, the card only needs to host the Load
   button. Avoids the giant redundant "Pick a dataset to begin" headline. */
.empty.empty-compact {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Details / Collapsible
   ========================================================================== */
details.expand {
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  overflow: hidden;
}
details.expand > summary {
  padding: 0.6875rem 0.875rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  display: flex; align-items: center; gap: 0.5rem;
  list-style: none;
  background: var(--bg-card);
  transition: background var(--dur-fast) var(--ease-out);
}
details.expand > summary::-webkit-details-marker { display: none; }
details.expand > summary::before {
  content: '';
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform var(--dur-fast) var(--ease-out);
  margin-right: 0.125rem;
}
details.expand[open] > summary::before { transform: rotate(45deg); }
details.expand > summary:hover { background: var(--bg-muted); }
details.expand > .expand-body { padding: 0.875rem; border-top: 1px solid var(--border); }

/* ==========================================================================
   Utilities
   ========================================================================== */
.stack-1 { display: flex; flex-direction: column; gap: 0.5rem; }
.stack-2 { display: flex; flex-direction: column; gap: 0.75rem; }
.stack-3 { display: flex; flex-direction: column; gap: 1rem; }
.stack-4 { display: flex; flex-direction: column; gap: 1.5rem; }

.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 0.375rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 0.75rem; } .mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 0.75rem; } .mb-3 { margin-bottom: 1rem; } .mb-4 { margin-bottom: 1.5rem; }
.flex-1 { flex: 1; }
.text-muted { color: var(--text-3); }
.text-strong { color: var(--text-1); font-weight: 600; }
.text-tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }

.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }

/* Usage meter (dashboard toolbar) */
.usage-meter {
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
}
.usage-meter-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.usage-meter-tier {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--brand);
  margin: 2px 0 8px;
}
.usage-meter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.6875rem;
  color: var(--text-2);
}
.usage-meter-row:last-child { margin-bottom: 0; }
.usage-meter-row span:first-child { flex: 1; min-width: 0; }
.usage-meter-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  max-width: 80px;
}
.usage-meter-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.usage-meter-fill.warn { background: var(--warning, #d97706); }
.usage-meter-fill.danger { background: var(--danger, #dc2626); }

/* Upgrade modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
}
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 201;
}
.modal.hidden, .modal-backdrop.hidden { display: none !important; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-4, 16px);
  padding: 2rem 1.75rem 1.5rem;
  box-shadow: var(--shadow-xl);
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
}
.modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 12px;
}
.modal-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1);
}
.modal-desc {
  color: var(--text-2);
  font-size: 0.9375rem;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.modal-features {
  text-align: left;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}
.modal-features li {
  padding: 0.375rem 0 0.375rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-2);
  position: relative;
}
.modal-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success, #059669);
  font-weight: 700;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.modal-footnote {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
.sidebar-backdrop { display: none; }
.mobile-menu-btn { display: none; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); z-index: 60; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-xl); }
  .main { margin-left: 0; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1.25rem; }
  .gene-grid, .method-grid, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .mobile-menu-btn { display: inline-flex; }
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 50; }
  .sidebar-backdrop.open { display: block; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .landing h1 { font-size: 2rem; }
  .stepper { flex-wrap: wrap; }
  .step-tab { flex: 1 1 45%; }
}

/* ==========================================================================
   Dashboard shell — cinematic refinement (additive overrides)
   Everything below targets the existing selectors used by dashboard.html,
   history.html, and _sidebar.html so JS hooks and template structure stay
   intact. We only elevate the visual language.
   ========================================================================== */

/* ---- Sidebar: deeper navy, cyan brand mark, left-rail active indicator ---- */
.sidebar {
  background:
    linear-gradient(180deg, var(--cin-navy-900, #050a16) 0%, #070e1c 55%, #050a16 100%);
  border-right: 1px solid var(--cin-border, rgba(148, 163, 184, 0.08));
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.02) inset, 24px 0 48px -24px rgba(2, 10, 24, 0.6);
}
.sidebar-brand {
  padding: 1.125rem 1rem 1.25rem;
  display: flex; align-items: center; gap: 0.625rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  background:
    radial-gradient(120% 120% at 20% 20%, rgba(34, 211, 238, 0.22), transparent 60%),
    linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(99, 102, 241, 0.14));
  border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.08) inset,
    0 6px 18px -6px rgba(34, 211, 238, 0.35);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--cin-cyan, #22d3ee);
  font-size: 0;
}
.sidebar-brand-mark svg { width: 16px; height: 16px; }
.sidebar-brand-name {
  font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; color: #fff;
}

.sidebar-section-label {
  padding: 1.5rem 1rem 0.5rem;
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(148, 163, 184, 0.6);
}

.nav-item {
  position: relative;
  padding: 0.5625rem 0.75rem;
  color: rgba(226, 232, 240, 0.78);
  font-weight: 500;
  border-radius: 8px;
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.nav-item:hover {
  background: rgba(148, 163, 184, 0.06);
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.10), rgba(34, 211, 238, 0.02));
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -0.5rem; top: 10%; bottom: 10%;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--cin-cyan, #22d3ee), var(--cin-indigo, #818cf8));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
}
.nav-item .icon { color: rgba(148, 163, 184, 0.65); }
.nav-item.active .icon { color: var(--cin-cyan, #22d3ee); }

.sidebar-user {
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  padding: 0.875rem;
}
.avatar {
  background: linear-gradient(135deg, var(--cin-cyan, #22d3ee), var(--cin-indigo, #818cf8));
  color: #0b1222;
  box-shadow: 0 6px 14px -6px rgba(34, 211, 238, 0.5);
}
.sidebar-user button.icon-btn {
  background: rgba(148, 163, 184, 0.04);
  border-color: rgba(148, 163, 184, 0.12);
  color: rgba(226, 232, 240, 0.72);
}
.sidebar-user button.icon-btn:hover {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.3);
  color: var(--cin-cyan, #22d3ee);
}

/* ---- Topbar: cleaner divider, subtle scroll shadow, tabular pill ---- */
.topbar {
  background: rgba(255, 255, 255, 0.78);
  border-bottom-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  padding: 0 2.25rem;
}
.topbar-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.005em;
}
.topbar-title::before {
  content: '';
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cin-cyan, #22d3ee), var(--cin-indigo, #818cf8));
  margin-right: 0.5rem;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

/* ---- Content canvas: subtle, premium rhythm ---- */
.main { background: #f7f8fb; }
.content { padding: 2rem 2.25rem; }

/* ---- Page header: optional eyebrow + refined scale ---- */
.page-header { margin-bottom: 1.75rem; }
.page-header h1 {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.15;
}
.page-header p {
  color: var(--text-3);
  font-size: 0.875rem;
  margin-top: 0.375rem;
  max-width: 56ch;
}
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}
.page-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cin-cyan, #22d3ee), var(--cin-indigo, #818cf8));
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

/* ---- Cards: deeper, softer shadow ---- */
.card {
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.02),
    0 12px 32px -16px rgba(15, 23, 42, 0.08);
}
.card:hover { box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), 0 16px 40px -16px rgba(15, 23, 42, 0.10); }

/* ---- Stepper: cleaner active with cyan accent underline ---- */
.stepper {
  background: #ffffff;
  padding: 6px;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}
.step-tab {
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
}
.step-tab:hover { background: #f3f5f9; color: var(--text-1); }
.step-tab.active {
  background: #ffffff;
  color: var(--text-1);
  font-weight: 600;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.04),
    0 2px 8px -2px rgba(15, 23, 42, 0.08),
    inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}
.step-tab.active::after {
  content: '';
  position: absolute;
  left: 20%; right: 20%; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cin-cyan, #22d3ee), var(--cin-indigo, #818cf8));
}
.step-tab .step-index {
  background: #e2e8f0;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.step-tab.active .step-index {
  background: linear-gradient(135deg, var(--cin-cyan, #22d3ee), var(--cin-indigo, #818cf8));
  color: #0b1222;
  box-shadow: 0 2px 8px -2px rgba(34, 211, 238, 0.4);
}
.step-tab.done .step-index {
  background: var(--success);
  color: #fff;
}

/* ---- Toolbar context strip: softer background ---- */
.toolbar-row {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  padding: 0.875rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}
.toolbar-row .divider { background: rgba(15, 23, 42, 0.08); }

/* ---- KPI tiles: better rhythm + tabular numerals + hint accent ---- */
.kpi {
  padding: 1rem 1.125rem;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.kpi:hover {
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), 0 10px 24px -12px rgba(15, 23, 42, 0.12);
}
.kpi-label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}
.kpi-value {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.kpi-hint {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ---- Tag (status pill) polish for topbar ---- */
.topbar .tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ==========================================================================
   Brand logo imagery — sidebar + auth stage + auth compact brand
   ========================================================================== */
.sidebar-brand-logo {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: block;
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.22),
    0 6px 18px -8px rgba(34, 211, 238, 0.4);
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
.sidebar-brand:hover .sidebar-brand-logo {
  transform: scale(1.04);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.35),
    0 10px 24px -8px rgba(34, 211, 238, 0.55);
}

.auth-brand-logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: block;
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.2),
    0 10px 26px -10px rgba(34, 211, 238, 0.45);
}
.auth-brand .auth-brand-logo {
  width: 32px; height: 32px;
  border-radius: 9px;
}

