/* ===========================================================
   Geneticker Vault demo — themes, base styles
   =========================================================== */

:root {
  --font-display: 'Inter', system-ui, sans-serif;
  --font-mono: 'Space Mono', monospace;
  --font-code: 'JetBrains Mono', monospace;
}

/* -------- THEME: google-light (default) -------- */
[data-theme='google-light'] {
  --bg-base: #ffffff;
  --bg-surface: #f8f9fa;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f3f4;
  --bg-inset: #e8eaed;
  --bg-tint: #e8f0fe;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --text-inverse: #ffffff;
  --accent: #1a73e8;
  --accent-hover: #1557b0;
  --accent-soft: #d2e3fc;
  --border: #dadce0;
  --border-strong: #bdc1c6;
  --success: #0d904f;
  --success-soft: #e6f4ea;
  --warning: #f9ab00;
  --warning-soft: #fef7e0;
  --error: #d93025;
  --error-soft: #fce8e6;
  --info-soft: #e8f0fe;
  --shadow-1: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --shadow-2: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
  --shadow-3: 0 4px 8px 3px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.3);
  --gradient-hero: linear-gradient(135deg, #e8f0fe 0%, #ffffff 100%);
  --gradient-accent: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
  --font-body: var(--font-mono);
}

/* -------- THEME: helix-dark -------- */
[data-theme='helix-dark'] {
  --bg-base: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #1f2937;
  --bg-hover: #21262d;
  --bg-inset: #0a0e13;
  --bg-tint: #142242;
  --text-primary: #e6edf3;
  --text-secondary: #9aa6b2;
  --text-tertiary: #6e7681;
  --text-inverse: #0d1117;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-soft: #1f3a5f;
  --border: #30363d;
  --border-strong: #484f58;
  --success: #3fb950;
  --success-soft: #1a3a2a;
  --warning: #d29922;
  --warning-soft: #3a2e10;
  --error: #f85149;
  --error-soft: #3a1416;
  --info-soft: #1f3a5f;
  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, 0.6);
  --gradient-hero: linear-gradient(135deg, #142242 0%, #0d1117 100%);
  --gradient-accent: linear-gradient(135deg, #58a6ff 0%, #79b8ff 100%);
  --font-body: var(--font-mono);
}

/* -------- THEME: midnight-lab -------- */
[data-theme='midnight-lab'] {
  --bg-base: #050a17;
  --bg-surface: #0a1428;
  --bg-elevated: #11203b;
  --bg-hover: #15294a;
  --bg-inset: #030712;
  --bg-tint: #1c2e57;
  --text-primary: #e0f2fe;
  --text-secondary: #93c5fd;
  --text-tertiary: #60a5fa;
  --text-inverse: #050a17;
  --accent: #22d3ee;
  --accent-hover: #67e8f9;
  --accent-soft: #1e4658;
  --border: #1e3a5f;
  --border-strong: #2d4d7a;
  --success: #34d399;
  --success-soft: #064e3b;
  --warning: #fbbf24;
  --warning-soft: #78350f;
  --error: #f87171;
  --error-soft: #7f1d1d;
  --info-soft: #1e4658;
  --shadow-1: 0 0 0 1px rgba(34, 211, 238, 0.1);
  --shadow-2: 0 4px 16px rgba(34, 211, 238, 0.15);
  --shadow-3: 0 8px 32px rgba(34, 211, 238, 0.25);
  --gradient-hero: linear-gradient(135deg, #11203b 0%, #050a17 100%);
  --gradient-accent: linear-gradient(135deg, #22d3ee 0%, #6366f1 100%);
  --font-body: var(--font-mono);
}

/* -------- THEME: terminal -------- */
[data-theme='terminal'] {
  --bg-base: #000000;
  --bg-surface: #0a0a0a;
  --bg-elevated: #111111;
  --bg-hover: #1a1a1a;
  --bg-inset: #050505;
  --bg-tint: #032a14;
  --text-primary: #00ff88;
  --text-secondary: #00cc6a;
  --text-tertiary: #008844;
  --text-inverse: #000000;
  --accent: #00ff88;
  --accent-hover: #44ffaa;
  --accent-soft: #013b1c;
  --border: #00ff8830;
  --border-strong: #00ff8860;
  --success: #00ff88;
  --success-soft: #013b1c;
  --warning: #ffaa00;
  --warning-soft: #2a1a00;
  --error: #ff3366;
  --error-soft: #2a0010;
  --info-soft: #013b1c;
  --shadow-1: 0 0 0 1px #00ff8820;
  --shadow-2: 0 0 12px #00ff8830;
  --shadow-3: 0 0 24px #00ff8840;
  --gradient-hero: linear-gradient(135deg, #032a14 0%, #000000 100%);
  --gradient-accent: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
  --font-body: var(--font-code);
}
[data-theme='terminal'] body {
  text-shadow: 0 0 1px currentColor;
}

/* -------- THEME: sunset -------- */
[data-theme='sunset'] {
  --bg-base: #fff7ed;
  --bg-surface: #fef3e2;
  --bg-elevated: #ffffff;
  --bg-hover: #fed7aa;
  --bg-inset: #fde4c7;
  --bg-tint: #ffe4cc;
  --text-primary: #431407;
  --text-secondary: #7c2d12;
  --text-tertiary: #9a3412;
  --text-inverse: #ffffff;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-soft: #fed7aa;
  --border: #fdba74;
  --border-strong: #fb923c;
  --success: #65a30d;
  --success-soft: #ecfccb;
  --warning: #ca8a04;
  --warning-soft: #fef9c3;
  --error: #dc2626;
  --error-soft: #fee2e2;
  --info-soft: #ffe4cc;
  --shadow-1: 0 1px 3px rgba(124, 45, 18, 0.15);
  --shadow-2: 0 4px 12px rgba(124, 45, 18, 0.2);
  --shadow-3: 0 8px 24px rgba(124, 45, 18, 0.25);
  --gradient-hero: linear-gradient(135deg, #ffe4cc 0%, #fff7ed 100%);
  --gradient-accent: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%);
  --font-body: var(--font-display);
}

/* -------- THEME: sequoia -------- */
[data-theme='sequoia'] {
  --bg-base: #1a2419;
  --bg-surface: #243024;
  --bg-elevated: #2d3a2d;
  --bg-hover: #354435;
  --bg-inset: #14201a;
  --bg-tint: #2c4631;
  --text-primary: #ecfccb;
  --text-secondary: #bef264;
  --text-tertiary: #84cc16;
  --text-inverse: #1a2419;
  --accent: #84cc16;
  --accent-hover: #a3e635;
  --accent-soft: #2c4631;
  --border: #3a4a3a;
  --border-strong: #506450;
  --success: #84cc16;
  --success-soft: #2c4631;
  --warning: #eab308;
  --warning-soft: #4a3a0a;
  --error: #f87171;
  --error-soft: #4a1f1f;
  --info-soft: #2c4631;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, 0.5);
  --gradient-hero: linear-gradient(135deg, #2c4631 0%, #1a2419 100%);
  --gradient-accent: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
  --font-body: var(--font-display);
}

/* -------- THEME: rose-quartz -------- */
[data-theme='rose-quartz'] {
  --bg-base: #fff1f5;
  --bg-surface: #fdf2f8;
  --bg-elevated: #ffffff;
  --bg-hover: #fce7f3;
  --bg-inset: #fbcfe8;
  --bg-tint: #fce7f3;
  --text-primary: #500724;
  --text-secondary: #831843;
  --text-tertiary: #9d174d;
  --text-inverse: #ffffff;
  --accent: #db2777;
  --accent-hover: #be185d;
  --accent-soft: #fce7f3;
  --border: #f9a8d4;
  --border-strong: #f472b6;
  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #ca8a04;
  --warning-soft: #fef9c3;
  --error: #dc2626;
  --error-soft: #fee2e2;
  --info-soft: #fce7f3;
  --shadow-1: 0 1px 3px rgba(131, 24, 67, 0.15);
  --shadow-2: 0 4px 12px rgba(131, 24, 67, 0.2);
  --shadow-3: 0 8px 24px rgba(131, 24, 67, 0.25);
  --gradient-hero: linear-gradient(135deg, #fce7f3 0%, #fff1f5 100%);
  --gradient-accent: linear-gradient(135deg, #db2777 0%, #f472b6 100%);
  --font-body: var(--font-display);
}

/* ===========================================================
   Base
   =========================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent);
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ===========================================================
   Demo banner
   =========================================================== */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--gradient-accent);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
  z-index: 100;
}
.banner-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: inherit;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.banner-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ===========================================================
   Layout
   =========================================================== */
.app-root {
  display: flex;
  min-height: calc(100vh - 36px);
  background: var(--bg-base);
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 36px;
  height: calc(100vh - 36px);
  overflow-y: auto;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--gradient-accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-mono);
}
.sidebar-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 14px 18px 6px;
}
.sidebar-nav {
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.sidebar-link .material-icons-outlined,
.sidebar-link .material-icons-round {
  font-size: 20px;
}
.sidebar-link .new-pill {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  background: var(--accent);
  color: var(--text-inverse);
  padding: 2px 6px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}
.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-tertiary);
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 36px;
  z-index: 10;
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.icon-btn .material-icons-outlined {
  font-size: 22px;
}
.notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
}
.main {
  padding: 24px 32px 64px;
  flex: 1;
}
@media (max-width: 900px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-link span:not(.material-icons-outlined):not(.material-icons-round):not(.new-pill) {
    display: none;
  }
  .sidebar-title,
  .sidebar-subtitle,
  .sidebar-section-label,
  .sidebar-footer,
  .new-pill {
    display: none;
  }
  .main {
    padding: 16px;
  }
}

/* ===========================================================
   Cards & primitives
   =========================================================== */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-1);
  padding: 20px;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.card-hover:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.card-h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.card-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}
.metric {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  background: var(--success-soft);
  color: var(--success);
}
.metric-delta.negative {
  background: var(--error-soft);
  color: var(--error);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-1);
}
.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn .material-icons-outlined,
.btn .material-icons-round {
  font-size: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.chip-blue {
  background: var(--info-soft);
  color: var(--accent);
  border-color: var(--accent-soft);
}
.chip-green {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success);
}
.chip-amber {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning);
}
.chip-red {
  background: var(--error-soft);
  color: var(--error);
  border-color: var(--error);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-inset);
  border-radius: 4px;
  color: var(--text-secondary);
}
.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===========================================================
   Specialised components
   =========================================================== */
.helix-svg {
  width: 100%;
  height: 100%;
}

.theme-tile {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  font-family: inherit;
}
.theme-tile:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.theme-tile.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.theme-swatch-row {
  display: flex;
  gap: 4px;
  height: 28px;
}
.theme-swatch {
  flex: 1;
  border-radius: 4px;
}
.theme-tile-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}
.theme-tile-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.decoy-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  transition: transform 0.15s, box-shadow 0.15s;
}
.decoy-cell.real {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.decoy-cell.watermark {
  background: var(--warning);
  border-color: var(--warning);
}
.decoy-grid {
  display: grid;
  grid-template-columns: repeat(20, 14px);
  gap: 4px;
  padding: 12px;
  background: var(--bg-inset);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ancestry-bar {
  height: 28px;
  border-radius: 6px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
}
.ancestry-bar-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  position: relative;
}

.timeline {
  position: relative;
  padding-left: 24px;
  border-left: 2px solid var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 18px;
}
.timeline-dot {
  position: absolute;
  left: -32px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-elevated);
  box-shadow: 0 0 0 1px var(--accent);
}

.proof-line {
  font-family: var(--font-code);
  font-size: 11px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.5;
}
.proof-line .hex {
  color: var(--accent);
}

.kbd {
  font-family: var(--font-code);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  border-bottom-width: 2px;
  color: var(--text-secondary);
}

.haplotype-strand {
  height: 14px;
  border-radius: 4px;
  display: flex;
  overflow: hidden;
  background: var(--bg-inset);
}
.haplotype-block {
  height: 100%;
  flex: 1;
}

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 22px;
  background: var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  padding: 0;
}
.toggle.on {
  background: var(--accent);
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle.on::after {
  transform: translateX(16px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease-out;
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  max-width: 640px;
  width: calc(100% - 40px);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-3);
  animation: slideUp 0.2s ease-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dna-helix-anim {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
}
.dna-helix-anim::before,
.dna-helix-anim::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  border-color: var(--accent) transparent var(--accent) transparent;
  animation: spin 1.5s linear infinite;
}
.dna-helix-anim::after {
  border-color: transparent var(--accent) transparent var(--accent);
  animation-direction: reverse;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.shimmer {
  background: linear-gradient(90deg, var(--bg-inset) 0%, var(--bg-hover) 50%, var(--bg-inset) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.sparkline-svg {
  width: 100%;
  height: 40px;
}
.sparkline-svg path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}
.sparkline-svg .area {
  fill: var(--accent-soft);
  opacity: 0.5;
  stroke: none;
}

.world-map-svg {
  width: 100%;
  height: 240px;
  background: var(--bg-inset);
  border-radius: 8px;
}
.world-map-svg path {
  fill: var(--bg-elevated);
  stroke: var(--border);
  stroke-width: 0.5;
}
.world-map-svg .highlighted {
  fill: var(--accent);
}
.world-map-svg .pin {
  fill: var(--error);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-header p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

.tab-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  white-space: nowrap;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab:hover:not(.active) {
  color: var(--text-primary);
}

.kvp {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.kvp:last-child {
  border-bottom: none;
}
.kvp-key {
  color: var(--text-tertiary);
}
.kvp-val {
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.alert {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid;
}
.alert .material-icons-outlined {
  flex-shrink: 0;
}
.alert-info {
  background: var(--info-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.alert-success {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}
.alert-warning {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}
.alert-error {
  background: var(--error-soft);
  border-color: var(--error);
  color: var(--error);
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  min-width: 280px;
  z-index: 50;
  overflow: hidden;
}
.dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.dropdown-item:hover {
  background: var(--bg-hover);
}

.relative {
  position: relative;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.5;
}
.chat-user {
  background: var(--accent);
  color: var(--text-inverse);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-ai {
  background: var(--bg-surface);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.consent-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.consent-row:last-child {
  border-bottom: none;
}

.audit-row {
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  gap: 12px;
  padding: 8px 0;
  font-size: 12px;
  align-items: start;
  border-bottom: 1px dashed var(--border);
}
.audit-row:last-child {
  border-bottom: none;
}
.audit-row .ts {
  color: var(--text-tertiary);
  font-family: var(--font-code);
}

.progress {
  height: 6px;
  background: var(--bg-inset);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.3s ease;
}
.progress-fill.success {
  background: var(--success);
}
.progress-fill.warning {
  background: var(--warning);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.tooltip {
  position: relative;
}
.tooltip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-elevated);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 100;
  margin-bottom: 4px;
}

.empty-state {
  text-align: center;
  padding: 64px 16px;
  color: var(--text-tertiary);
}
.empty-state .material-icons-outlined {
  font-size: 56px;
  margin-bottom: 12px;
  display: block;
}

/* Locking the body to var-driven background even when tailwind tries to set it */
.bg-base {
  background: var(--bg-base);
}
.bg-surface {
  background: var(--bg-surface);
}
.bg-elevated {
  background: var(--bg-elevated);
}
.text-primary {
  color: var(--text-primary);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-tertiary {
  color: var(--text-tertiary);
}
.border-default {
  border-color: var(--border);
}

.fade-in {
  animation: fadeIn 0.2s ease-out;
}

/* For ancestry hexagon map */
.hex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 4px;
}
.hex {
  aspect-ratio: 1;
  background: var(--bg-inset);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.hex:hover {
  transform: scale(1.08);
  background: var(--bg-hover);
}
.hex.match {
  background: var(--accent);
  color: var(--text-inverse);
}
.hex.partial {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ===================== FUNNEL ===================== */
.funnel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.funnel-step {
  position: relative;
  display: flex;
  align-items: center;
}
.funnel-bar {
  height: 26px;
  background: var(--accent);
  border-radius: 6px;
  opacity: 0.85;
  margin-right: 12px;
  min-width: 24px;
  transition: width 0.3s;
}
.funnel-bar.success {
  background: var(--success);
}
.funnel-bar.warning {
  background: var(--warning);
}
.funnel-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

