/* ═══════════════════════════════════════════════════════════════
   Cancer Transcriptomics ML — Complete Design System
   cancertranscriptomics.space  ·  2026
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Variables ──────────────────────────────────────── */
:root {
  --c-bg: #f0f4f8;
  --c-surface: #ffffff;
  --c-surface-alt: #f7f9fc;
  --c-border: #e2e8f0;
  --c-border-light: #edf2f7;

  --c-text: #1a202c;
  --c-text-secondary: #4a5568;
  --c-text-muted: #718096;
  --c-text-faint: #a0aec0;

  --c-primary: #2b6cb0;
  --c-primary-light: #ebf4ff;
  --c-primary-dark: #1a365d;

  --c-accent: #6b46c1;
  --c-accent-light: #f5f0ff;

  --c-success: #276749;
  --c-success-bg: #f0fff4;
  --c-danger: #c53030;
  --c-danger-bg: #fff5f5;
  --c-warning: #b7791f;
  --c-warning-bg: #fffff0;
  --c-info: #2b6cb0;
  --c-info-bg: #ebf8ff;

  /* Cancer palette */
  --c-brca: #e53e3e;
  --c-blca: #dd6b20;
  --c-prad: #2b6cb0;
  --c-luad: #38a169;
  --c-ucec: #805ad5;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.04);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --nav-h: 60px;
  --max-w: 1280px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; color: var(--c-text); }
h1 { font-size: 2rem; letter-spacing: -.02em; }
h2 { font-size: 1.5rem; letter-spacing: -.015em; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

.text-muted { color: var(--c-text-muted); }
.text-secondary { color: var(--c-text-secondary); }
.text-sm { font-size: 0.87rem; }
.text-xs { font-size: 0.8rem; }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-content {
  padding-top: calc(var(--nav-h) + 1.5rem);
  padding-bottom: 3rem;
  min-height: calc(100vh - var(--nav-h));
}

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--c-primary-dark);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand:hover { text-decoration: none; opacity: .92; }

.nav-brand svg { width: 28px; height: 28px; flex-shrink: 0; }

.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: 2rem;
  list-style: none;
}

.nav-links a, .nav-links .dropdown-trigger {
  color: rgba(255,255,255,.82);
  padding: .45rem .75rem;
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .35rem;
  text-decoration: none;
}

.nav-links a:hover, .nav-links .dropdown-trigger:hover,
.nav-links a.active, .nav-links .dropdown-trigger.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}

/* Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown .dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--c-border);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all .18s ease;
  z-index: 1001;
  padding: .35rem 0;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: .55rem 1rem;
  color: var(--c-text-secondary);
  font-size: .87rem;
  font-weight: 450;
  transition: background .12s;
}

.dropdown-menu a:hover {
  background: var(--c-primary-light);
  color: var(--c-primary);
  text-decoration: none;
}

.dropdown-caret {
  width: 10px; height: 10px;
  fill: currentColor;
  opacity: .6;
  transition: transform .2s;
}

.nav-dropdown:hover .dropdown-caret { transform: rotate(180deg); }

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: .5rem;
  margin-left: auto;
}

.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--c-primary-dark);
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: .5rem 1rem 1rem;
    display: none;
    border-top: 1px solid rgba(255,255,255,.1);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  .nav-links a, .nav-links .dropdown-trigger { padding: .65rem .5rem; width: 100%; }
  .nav-dropdown .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: rgba(255,255,255,.05);
    border-radius: 6px;
    padding: 0;
    margin-top: .25rem;
    display: none;
  }
  .nav-dropdown.open .dropdown-menu { display: block; }
  .dropdown-menu a { color: rgba(255,255,255,.75); }
  .dropdown-menu a:hover { background: rgba(255,255,255,.1); color: #fff; }
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--c-border);
}

.page-header h1 { margin-bottom: .35rem; }
.page-header p { color: var(--c-text-muted); font-size: .95rem; max-width: 680px; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--c-text-faint);
  margin-bottom: .5rem;
}

.breadcrumbs a { color: var(--c-text-muted); }
.breadcrumbs span.sep { opacity: .4; }
.breadcrumbs .breadcrumb-section { color: var(--c-text-muted); font-weight: 500; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}

.card:hover { box-shadow: var(--shadow); }
.card-title { font-size: 1.05rem; font-weight: 600; margin-bottom: .75rem; }

/* Stat card */
.stat-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  padding: 1.1rem 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--c-primary);
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
  font-size: .8rem;
  color: var(--c-text-muted);
  font-weight: 500;
  margin-top: .3rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-card .stat-sub {
  font-size: .78rem;
  color: var(--c-text-faint);
  margin-top: .15rem;
}

.stat-card.primary .stat-value { color: var(--c-primary); }
.stat-card.accent .stat-value { color: var(--c-accent); }
.stat-card.success .stat-value { color: var(--c-success); }
.stat-card.danger .stat-value { color: var(--c-danger); }

/* Stats row — horizontal stat cards */
.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.stats-row .stat-card { flex: 1; min-width: 120px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; }

@media (max-width: 960px) {
  .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
}

/* ── Cancer color badges ─────────────────────────────────────── */
.cancer-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.cancer-badge.brca { background: #fff5f5; color: var(--c-brca); border: 1px solid #fed7d7; }
.cancer-badge.blca { background: #fffaf0; color: var(--c-blca); border: 1px solid #feebc8; }
.cancer-badge.prad { background: #ebf8ff; color: var(--c-prad); border: 1px solid #bee3f8; }
.cancer-badge.luad { background: #f0fff4; color: var(--c-luad); border: 1px solid #c6f6d5; }
.cancer-badge.ucec { background: #faf5ff; color: var(--c-ucec); border: 1px solid #e9d8fd; }

/* ── Cancer summary cards ────────────────────────────────────── */
.cancer-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}

.cancer-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.cancer-card-header {
  padding: .75rem 1.25rem;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cancer-card-header .count {
  background: rgba(255,255,255,.2);
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .78rem;
}

.cancer-card.brca .cancer-card-header { background: var(--c-brca); }
.cancer-card.blca .cancer-card-header { background: var(--c-blca); }
.cancer-card.prad .cancer-card-header { background: var(--c-prad); }
.cancer-card.luad .cancer-card-header { background: var(--c-luad); }
.cancer-card.ucec .cancer-card-header { background: var(--c-ucec); }

.cancer-card-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.cancer-card-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
}

.cancer-card-metric .label { color: var(--c-text-muted); }
.cancer-card-metric .value { font-weight: 600; font-family: var(--font-mono); font-size: .82rem; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

table.data-table th {
  background: var(--c-surface-alt);
  color: var(--c-text-secondary);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .7rem .85rem;
  text-align: left;
  border-bottom: 2px solid var(--c-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 2;
}

table.data-table th:hover { background: #edf2f7; }

table.data-table td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--c-border-light);
  color: var(--c-text-secondary);
}

table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #fafbfd; }

table.data-table td.num, table.data-table th.num { text-align: right; font-family: var(--font-mono); font-size: .82rem; }

.sort-indicator { font-size: .7rem; margin-left: .25rem; opacity: .5; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: 6px;
  font-size: .87rem;
  font-weight: 550;
  border: none;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #2c5282; text-decoration: none; color: #fff; }

.btn-outline { background: transparent; color: var(--c-primary); border: 1px solid var(--c-border); }
.btn-outline:hover { background: var(--c-primary-light); border-color: var(--c-primary); text-decoration: none; }

.btn-sm { padding: .35rem .75rem; font-size: .82rem; }

.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; border-right: 1px solid rgba(255,255,255,.15); }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; border-right: none; }
.btn-group .btn.active { background: var(--c-primary); color: #fff; }
.btn-group .btn:not(.active) { background: var(--c-surface); color: var(--c-text-secondary); border: 1px solid var(--c-border); }

/* ── Select / Form controls ──────────────────────────────────── */
.form-select {
  appearance: none;
  background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%234a5568' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 5h10z'/%3E%3C/svg%3E") no-repeat right .75rem center;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: .5rem 2.2rem .5rem .85rem;
  font-size: .87rem;
  font-family: var(--font-sans);
  color: var(--c-text);
  cursor: pointer;
  transition: border-color .15s;
}

.form-select:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(43,108,176,.12); }

.control-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.control-bar label { font-size: .82rem; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Alerts / Info boxes ─────────────────────────────────────── */
.alert {
  padding: .9rem 1.1rem;
  border-radius: var(--radius);
  font-size: .87rem;
  line-height: 1.5;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
}

.alert-info { background: var(--c-info-bg); color: #2a4365; border: 1px solid #bee3f8; }
.alert-success { background: var(--c-success-bg); color: #22543d; border: 1px solid #c6f6d5; }
.alert-warning { background: var(--c-warning-bg); color: #744210; border: 1px solid #fefcbf; }
.alert-danger { background: var(--c-danger-bg); color: #742a2a; border: 1px solid #fed7d7; }

.alert-icon { flex-shrink: 0; font-size: 1.1rem; line-height: 1.5; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-primary { background: var(--c-primary-light); color: var(--c-primary); }
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-danger { background: var(--c-danger-bg); color: var(--c-danger); }
.badge-accent { background: var(--c-accent-light); color: var(--c-accent); }
.badge-info { background: #ebf8ff; color: #2b6cb0; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: .6rem 1.2rem;
  font-size: .87rem;
  font-weight: 550;
  color: var(--c-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.tab-btn:hover { color: var(--c-text); }
.tab-btn.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Accordion ───────────────────────────────────────────────── */
.accordion-item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  background: var(--c-surface);
  overflow: hidden;
}

.accordion-header {
  padding: .85rem 1.15rem;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background .12s;
}

.accordion-header:hover { background: var(--c-surface-alt); }

.accordion-header .chevron {
  width: 16px; height: 16px;
  transition: transform .2s;
  flex-shrink: 0;
}

.accordion-item.open .accordion-header .chevron { transform: rotate(180deg); }

.accordion-body {
  display: none;
  padding: 0 1.15rem 1rem;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--c-text-secondary);
}

.accordion-item.open .accordion-body { display: block; }

/* ── Funnel viz ──────────────────────────────────────────────── */
.funnel {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-width: 360px;
}

.funnel-step {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  background: var(--c-surface-alt);
  border-radius: var(--radius);
  border-left: 3px solid var(--c-primary);
  transition: background .15s;
}

.funnel-step:hover { background: var(--c-primary-light); }
.funnel-step .step-count {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--c-primary);
  min-width: 56px;
}

.funnel-step .step-label {
  font-size: .84rem;
  color: var(--c-text-secondary);
}

.funnel-step:nth-child(2) { border-color: #4299e1; margin-left: .5rem; }
.funnel-step:nth-child(3) { border-color: #48bb78; margin-left: 1rem; }
.funnel-step:nth-child(4) { border-color: #ed8936; margin-left: 1.5rem; }
.funnel-step:nth-child(5) { border-color: #e53e3e; margin-left: 2rem; }

/* ── Plotly chart containers ─────────────────────────────────── */
.chart-container {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  padding: 1.25rem;
}

.chart-container .chart-title {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .75rem;
  color: var(--c-text);
}

.chart-placeholder {
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-faint);
  font-size: .9rem;
}

/* ── Improvement cards ───────────────────────────────────────── */
.improvement-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.improvement-card .metric-name {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
}

.improvement-card .before-after {
  display: flex;
  align-items: baseline;
  gap: .5rem;
}

.improvement-card .before {
  font-size: 1.1rem;
  color: var(--c-text-faint);
  text-decoration: line-through;
  font-family: var(--font-mono);
}

.improvement-card .arrow { color: var(--c-text-faint); }

.improvement-card .after {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--c-success);
  font-family: var(--font-mono);
}

.improvement-card .delta {
  font-size: .82rem;
  color: var(--c-success);
  font-weight: 600;
}

/* ── Section spacing ─────────────────────────────────────────── */
.section { margin-bottom: 2.5rem; }
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-title .icon { font-size: 1.2rem; }

/* ── Hero section (homepage) ─────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--c-primary-dark) 0%, #2a4365 40%, #2b6cb0 100%);
  color: #fff;
  padding: 3rem 0 2.5rem;
  margin: calc(-1 * (var(--nav-h) + 1.5rem)) -1.5rem 2rem;
  padding-top: calc(var(--nav-h) + 3rem);
}

.hero .container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

.hero h1 {
  font-size: 2.2rem;
  color: #fff;
  margin-bottom: .5rem;
  letter-spacing: -.025em;
}

.hero p {
  color: rgba(255,255,255,.8);
  font-size: 1.05rem;
  max-width: 640px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.hero-stat .hero-stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.hero-stat .hero-stat-label {
  font-size: .82rem;
  color: rgba(255,255,255,.6);
  margin-top: .25rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Pipeline features grid ──────────────────────────────────── */
.feature-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  padding: 1.1rem;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.feature-card .feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.feature-card .feature-icon.blue { background: var(--c-primary-light); }
.feature-card .feature-icon.green { background: var(--c-success-bg); }
.feature-card .feature-icon.purple { background: var(--c-accent-light); }
.feature-card .feature-icon.orange { background: #fffaf0; }

.feature-card .feature-text h4 { font-size: .88rem; margin-bottom: .2rem; }
.feature-card .feature-text p { font-size: .8rem; color: var(--c-text-muted); line-height: 1.4; }

/* ── Loading / skeleton ──────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--c-text-faint);
  font-size: .9rem;
  gap: .5rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tooltip ─────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: #fff;
  padding: .35rem .65rem;
  border-radius: 5px;
  font-size: .75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 100;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Gene panel (slide-over) ─────────────────────────────────── */
.gene-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 2000;
  opacity: 0;
  transition: opacity .2s;
}

.gene-panel-overlay.active { opacity: 1; }

.gene-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--c-surface);
  z-index: 2001;
  transform: translateX(100%);
  transition: transform .25s ease;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,.1);
}

.gene-panel.active { transform: translateX(0); }

.gene-panel-header {
  position: sticky;
  top: 0;
  background: var(--c-surface);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.gene-panel-header h2 { font-size: 1.2rem; }

.gene-panel-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: .25rem;
  line-height: 1;
}

.gene-panel-body { padding: 1.5rem; }

.gene-metric {
  display: flex;
  justify-content: space-between;
  padding: .5rem 0;
  border-bottom: 1px solid var(--c-border-light);
  font-size: .87rem;
}

.gene-metric .gm-label { color: var(--c-text-muted); }
.gene-metric .gm-value { font-weight: 600; font-family: var(--font-mono); font-size: .84rem; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--c-text-faint);
  font-size: .8rem;
  border-top: 1px solid var(--c-border);
  margin-top: 2rem;
}

/* ── Scroll-to-top ───────────────────────────────────────────── */
.scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 999;
  font-size: 1.1rem;
  transition: background .15s;
}

.scroll-top:hover { background: #2c5282; }
.scroll-top.visible { display: flex; }

/* ── Documentation render ────────────────────────────────────── */
.doc-content h1, .doc-content h2, .doc-content h3, .doc-content h4 { margin-top: 1.5rem; margin-bottom: .5rem; }
.doc-content p { margin-bottom: .75rem; }
.doc-content ul, .doc-content ol { margin-left: 1.5rem; margin-bottom: .75rem; }
.doc-content li { margin-bottom: .25rem; }
.doc-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .87rem; }
.doc-content th, .doc-content td { padding: .5rem .75rem; border: 1px solid var(--c-border); text-align: left; }
.doc-content th { background: var(--c-surface-alt); font-weight: 600; }
.doc-content code { background: var(--c-surface-alt); padding: .15rem .35rem; border-radius: 3px; font-size: .85em; font-family: var(--font-mono); }
.doc-content pre { background: #1a202c; color: #e2e8f0; padding: 1rem 1.25rem; border-radius: var(--radius); overflow-x: auto; margin: 1rem 0; font-size: .82rem; }
.doc-content pre code { background: none; padding: 0; color: inherit; }
.doc-content blockquote { border-left: 3px solid var(--c-primary); padding-left: 1rem; color: var(--c-text-muted); margin: 1rem 0; }
.doc-content a.headerlink { color: var(--c-text-faint); margin-left: .35rem; font-size: .85em; opacity: 0; transition: opacity .15s; }
.doc-content *:hover > a.headerlink { opacity: 1; }

/* ── Two-column layout ───────────────────────────────────────── */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ── Utilities ───────────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Mind-map (D3) ───────────────────────────────────────────── */
.mindmap-container {
  width: 100%;
  height: 600px;
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  position: relative;
  overflow: hidden;
}

.mindmap-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: .4rem;
  z-index: 10;
}

.mindmap-legend {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(255,255,255,.95);
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .78rem;
  z-index: 10;
  box-shadow: var(--shadow);
}

.legend-item { display: flex; align-items: center; gap: .4rem; margin-bottom: .2rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Detail panel for mind-map */
.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 20;
  overflow-y: auto;
  padding: 1.5rem;
}

.detail-panel.open { transform: translateX(0); }

.detail-panel-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--c-text-muted);
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .navbar, .scroll-top, .nav-toggle { display: none; }
  .page-content { padding-top: 0; }
  body { background: #fff; }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* ── Tablet (≤960px) ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .container { padding: 0 1rem; }
  .hero { padding: 2.5rem 1.5rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero p  { font-size: 1rem; }
  .hero-stats { gap: 1.5rem; flex-wrap: wrap; }

  .stat-card .stat-value { font-size: 1.5rem; }

  .split { grid-template-columns: 1fr; }

  .control-bar { flex-wrap: wrap; gap: .75rem; }
  .control-bar label { min-width: auto; }

  .chart-container { min-height: 300px; }

  .improvement-card { padding: 1rem; }
  .feature-card { padding: 1rem; }
}

/* ── Mobile (≤680px) ─────────────────────────────────────────── */
@media (max-width: 680px) {
  :root { --nav-h: 56px; }
  body { font-size: .88rem; }

  .container { padding: 0 .75rem; }
  .page-content { padding-top: calc(var(--nav-h) + 1rem); }

  .navbar { padding: 0 .75rem; }
  .navbar .logo { font-size: 1rem; gap: .4rem; }

  .hero { padding: 2rem 1rem; margin-bottom: 1.5rem; border-radius: var(--radius); }
  .hero h1 { font-size: 1.5rem; line-height: 1.3; }
  .hero p  { font-size: .9rem; }
  .hero-stats { flex-direction: column; gap: .75rem; align-items: stretch; }
  .hero-stat { text-align: center; }
  .hero-stat-value { font-size: 1.8rem; }

  .page-header h1 { font-size: 1.3rem; }
  .page-header p  { font-size: .85rem; }
  .breadcrumbs { font-size: .75rem; }

  .stat-card { padding: .85rem .75rem; }
  .stat-card .stat-value { font-size: 1.3rem; }
  .stat-card .stat-label { font-size: .72rem; }

  .card { padding: 1rem; }
  .card-title { font-size: .95rem; }

  .tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-btn { font-size: .82rem; padding: .6rem .75rem; white-space: nowrap; flex-shrink: 0; }

  .control-bar { flex-direction: column; align-items: stretch; }
  .form-select { width: 100%; }

  .chart-container { min-height: 260px; overflow-x: auto; }

  .funnel { gap: .35rem; }
  .funnel-step { padding: .6rem .75rem; flex-direction: column; gap: .15rem; }
  .step-count { font-size: 1rem; }
  .step-label { font-size: .72rem; }

  .data-table { font-size: .78rem; }
  .data-table th, .data-table td { padding: .5rem .4rem; }
  .table-wrap { margin: 0 -.75rem; padding: 0 .75rem; }

  .improvement-card { padding: .85rem; }
  .improvement-card h3 { font-size: .9rem; }

  .cancer-card { padding: .85rem; }

  .feature-card { padding: .85rem; }
  .feature-card h3 { font-size: .88rem; }

  .badge { font-size: .68rem; padding: .15rem .45rem; }

  .alert { flex-direction: column; gap: .5rem; padding: 1rem; }
  .alert-icon { font-size: 1.2rem; }

  .accordion-header { padding: .85rem 1rem; font-size: .9rem; }
  .accordion-body { padding: .85rem 1rem; }

  .gene-panel { width: 92vw; right: 0; }
  .gene-panel-header h2 { font-size: 1.1rem; }
  .gene-metric { flex-direction: column; gap: .15rem; }

  section, .section { margin-bottom: 1.5rem; }

  .quick-links { flex-direction: column; }
  .quick-links .btn { width: 100%; text-align: center; }
}

/* ── Small phone (≤480px) ────────────────────────────────────── */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.25rem; }
  .hero p  { font-size: .85rem; }
  .hero-stat-value { font-size: 1.5rem; }

  .page-header h1 { font-size: 1.15rem; }

  .stat-card .stat-value { font-size: 1.15rem; }
  .stat-card .stat-label { font-size: .68rem; }

  .card { padding: .85rem; }

  .data-table th, .data-table td { padding: .4rem .3rem; font-size: .72rem; }

  .chart-container { min-height: 220px; }

  .gene-panel { width: 100vw; border-radius: 0; }
}

/* ── Plotly chart responsive overrides ───────────────────────── */
@media (max-width: 680px) {
  [id^="chart-"], [id^="scatter-"], [id^="ct-scatter"],
  [id$="-chart"], [id$="-plot"] {
    height: 300px !important;
    min-height: 250px;
  }
}

@media (max-width: 480px) {
  [id^="chart-"], [id^="scatter-"], [id^="ct-scatter"],
  [id$="-chart"], [id$="-plot"] {
    height: 260px !important;
    min-height: 220px;
  }
}

/* ── Touch-friendly targets ──────────────────────────────────── */
@media (pointer: coarse) {
  .tab-btn { min-height: 44px; }
  .form-select { min-height: 44px; }
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .accordion-header { min-height: 48px; }
  th[style*="cursor"] { min-height: 44px; }
  .nav-links a, .dropdown-trigger { min-height: 44px; display: flex; align-items: center; }
}
