/* ====================================================
   CAB-CF · Cognitive Assessment Battery
   Design System: Luxury Medical Dark · Neural Glassmorphism
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ── */
:root {
  --bg-void:       #060b16;
  --bg-deep:       #0a1020;
  --bg-surface:    #0f1929;
  --glass-1:       rgba(255,255,255,0.04);
  --glass-2:       rgba(255,255,255,0.07);
  --glass-3:       rgba(255,255,255,0.11);
  --border-dim:    rgba(255,255,255,0.08);
  --border-glow:   rgba(0,210,255,0.25);
  --cyan:          #00d4ff;
  --cyan-dim:      rgba(0,212,255,0.15);
  --violet:        #8b5cf6;
  --violet-dim:    rgba(139,92,246,0.15);
  --emerald:       #10b981;
  --emerald-dim:   rgba(16,185,129,0.15);
  --amber:         #f59e0b;
  --rose:          #f43f5e;
  --text-primary:  #e8edf5;
  --text-secondary:#8b99b5;
  --text-dim:      #4a5568;
  --font-display:  'Playfair Display', Georgia, serif;
  --font-body:     'DM Sans', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     22px;
  --radius-xl:     32px;
  --shadow-glow:   0 0 40px rgba(0,212,255,0.12);
  --shadow-card:   0 8px 40px rgba(0,0,0,0.5);
  --blur-glass:    blur(20px) saturate(180%);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-primary);
  min-height: 100%;
  height: 100%;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--cyan); text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); touch-action: manipulation; }
input, select, textarea {
  font-family: var(--font-body);
  color: var(--text-primary);
  font-size: 16px; /* Prevents iOS auto-zoom on focus */
}

/* ── Neural Background ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(0,90,140,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(60,20,120,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 50% 50%, rgba(0,30,60,0.3) 0%, transparent 70%),
    var(--bg-void);
  animation: bgShift 20s ease-in-out infinite alternate;
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background-image:
    radial-gradient(circle 1px at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}
@keyframes bgShift {
  0%   { opacity: 1; }
  50%  { background-position: 5% 5%; }
  100% { opacity: 0.85; }
}

/* ── Layout ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
/* The sidebar is taken out of flow so it never affects any row heights */
.main-wrapper {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}
.main-content {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 260px;
  height: 100vh;
  background: var(--glass-1);
  backdrop-filter: var(--blur-glass);
  border-right: 1px solid var(--border-dim);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
}
.sidebar-logo {
  padding: 0.5rem 0 2rem;
  border-bottom: 1px solid var(--border-dim);
  margin-bottom: 1rem;
}
.sidebar-logo h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--cyan);
  line-height: 1.2;
}
.sidebar-logo span {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.nav-link:hover, .nav-link.active {
  background: var(--glass-2);
  color: var(--text-primary);
  border-color: var(--border-dim);
}
.nav-link.active { color: var(--cyan); border-color: var(--border-glow); }
.nav-icon {
  width: 20px; height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-link.active .nav-icon { opacity: 1; filter: drop-shadow(0 0 4px var(--cyan)); }
.sidebar-section {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 1rem 1rem 0.3rem;
}

/* ── Top Bar ── */
.topbar {
  background: var(--glass-1);
  backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--border-dim);
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
}
.topbar-breadcrumb {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ── Glass Cards ── */
.card {
  background: var(--glass-1);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.card:hover { border-color: var(--border-glow); box-shadow: var(--shadow-glow), var(--shadow-card); }
.card-sm { padding: 1.25rem; border-radius: var(--radius-md); }
.card-glow { border-color: var(--border-glow); box-shadow: var(--shadow-glow), var(--shadow-card); }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--glass-1);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-color, var(--cyan)), transparent);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-glow); }
.stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
}
.stat-change {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  margin-top: 0.5rem;
}
.stat-icon {
  position: absolute; right: 1.25rem; top: 1.25rem;
  font-size: 1.8rem; opacity: 0.2;
}

/* ── Page Headers ── */
.page-header { margin-bottom: 2rem; }
.page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--cyan) 0%, #0099cc 100%);
  color: #000; border-color: var(--cyan);
}
.btn-primary:hover { box-shadow: 0 0 20px rgba(0,212,255,0.4); transform: translateY(-1px); }
.btn-secondary {
  background: var(--glass-2); color: var(--text-primary);
  border-color: var(--border-dim);
}
.btn-secondary:hover { background: var(--glass-3); border-color: var(--border-glow); }
.btn-danger {
  background: rgba(244,63,94,0.15); color: var(--rose);
  border-color: rgba(244,63,94,0.3);
}
.btn-danger:hover { background: rgba(244,63,94,0.25); }
.btn-success {
  background: linear-gradient(135deg, var(--emerald), #059669);
  color: #fff;
}
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
  font-size: 0.78rem; font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em; text-transform: uppercase;
}
.form-control {
  background: var(--glass-1);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
  background: var(--glass-2);
}
select.form-control option { background: var(--bg-surface); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Table ── */
.table-wrap {
  background: var(--glass-1);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--glass-2); }
th {
  padding: 0.9rem 1.25rem;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.1em;
  text-align: left; border-bottom: 1px solid var(--border-dim);
}
td {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-dim);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--glass-1); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.05em;
}
.badge-bajo   { background: var(--emerald-dim); color: var(--emerald); }
.badge-medio  { background: rgba(245,158,11,0.15); color: var(--amber); }
.badge-alto   { background: rgba(244,63,94,0.15); color: var(--rose); }
.badge-cyan   { background: var(--cyan-dim); color: var(--cyan); }
.badge-violet { background: var(--violet-dim); color: var(--violet); }

/* ── Progress Bars ── */
.progress-bar {
  height: 4px; background: var(--glass-2);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width 0.6s ease;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: min(600px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.3s;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), var(--shadow-glow);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-dim);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-primary);
}
.modal-close {
  background: none; border: none;
  color: var(--text-dim); font-size: 1.5rem;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--rose); }

/* ── Alert/Toast ── */
.toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-card);
  z-index: 200;
  transform: translateY(120%);
  transition: transform 0.3s;
  max-width: 360px;
}
.toast.show { transform: translateY(0); }
.toast-success { border-color: rgba(16,185,129,0.4); }
.toast-error   { border-color: rgba(244,63,94,0.4); }

/* ── Saliva Test ── */
.saliva-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.sample-visual {
  width: 100%; aspect-ratio: 1;
  max-width: 300px; margin: 0 auto;
  position: relative;
}
#saliva-canvas { border-radius: var(--radius-xl); }
.analysis-panel { display: flex; flex-direction: column; gap: 1rem; }
.metric-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--glass-1);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
}
.metric-name { font-size: 0.8rem; color: var(--text-secondary); flex: 1; }
.metric-value {
  font-family: var(--font-mono); font-size: 1rem;
  color: var(--cyan); font-weight: 600;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(1.5); }
}

/* ── Cognitive Test Player ── */
.test-player {
  max-width: 900px; margin: 0 auto;
}
.test-header {
  display: flex; align-items: center; gap: 1.5rem;
  margin-bottom: 2rem;
}
.test-number {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--text-dim);
}
.test-progress-track {
  display: flex; gap: 0.4rem; flex: 1;
}
.test-dot {
  flex: 1; height: 4px; border-radius: 999px;
  background: var(--glass-2); transition: all 0.4s;
}
.test-dot.done { background: var(--emerald); }
.test-dot.active { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.test-arena {
  background: var(--glass-1);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 500px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.test-intro {
  text-align: center;
  padding: 3rem;
  max-width: 600px;
}
.test-intro h2 {
  font-family: var(--font-display);
  font-size: 2rem; color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.test-intro p { color: var(--text-secondary); line-height: 1.7; margin-bottom: 2rem; }
.test-canvas-wrap {
  width: 100%; flex: 1;
  display: flex; align-items: center; justify-content: flex-start;
  padding: 1rem;
  overflow-x: auto;
  max-width: 100vw;
}
canvas.test-canvas {
  border-radius: var(--radius-md);
  min-width: 700px;
  max-width: none;
}
.rt-target {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cyan), #005577);
  box-shadow: 0 0 40px var(--cyan);
  cursor: pointer;
  transform: scale(0);
  transition: transform 0.15s;
  user-select: none;
}
.rt-target.visible { transform: scale(1); }

/* ── Digit Span ── */
.digit-display {
  font-family: var(--font-mono);
  font-size: 5rem; font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.3em;
  text-shadow: 0 0 30px rgba(0,212,255,0.5);
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.digit-input-pad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem; max-width: 280px; margin: 0 auto;
}
.digit-btn {
  background: var(--glass-2); border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.4rem; font-family: var(--font-mono);
  padding: 1rem;
  transition: all 0.15s;
}
.digit-btn:hover { background: var(--glass-3); border-color: var(--border-glow); }
.digit-btn:active { transform: scale(0.95); }

/* ── AI Chat ── */
.ai-chat {
  width: 100%; max-width: 680px;
  display: flex; flex-direction: column;
  gap: 1rem; padding: 1.5rem;
}
.chat-bubble {
  max-width: 85%; padding: 1rem 1.25rem;
  border-radius: var(--radius-md); line-height: 1.6;
  font-size: 0.9rem; animation: bubbleIn 0.3s ease;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bubble-ai {
  background: var(--violet-dim);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
  color: var(--text-primary); align-self: flex-start;
}
.bubble-user {
  background: var(--cyan-dim);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
  color: var(--text-primary); align-self: flex-end;
}
.bubble-ai .ai-label {
  font-size: 0.65rem; color: var(--violet);
  font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 0.35rem;
}
.chat-input-row {
  display: flex; gap: 0.75rem; padding: 0 1.5rem 1.5rem;
  width: 100%;
}
.chat-input {
  flex: 1; background: var(--glass-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem; color: var(--text-primary);
  font-size: 0.9rem; outline: none;
}
.chat-input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,0.1); }
.typing-indicator { display: flex; gap: 4px; padding: 0.5rem; }
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--violet); opacity: 0.4;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Flanker Test ── */
.flanker-display {
  font-family: var(--font-mono); font-size: 3rem;
  letter-spacing: 0.5em; color: var(--text-primary);
  text-align: center; min-height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.flanker-keys {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-top: 1.5rem;
}
.flanker-key {
  flex: 1; min-width: 130px;
  background: var(--glass-2); border: 2px solid var(--border-dim);
  border-radius: var(--radius-md); padding: 1.25rem 1rem;
  color: var(--text-primary); font-size: 1.1rem;
  font-family: var(--font-mono);
  transition: all 0.1s;
}
.flanker-key.pressed { background: var(--cyan-dim); border-color: var(--cyan); }

/* ── Report ── */
.report-hero {
  background: linear-gradient(135deg, var(--glass-2) 0%, var(--glass-1) 100%);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative; overflow: hidden;
}
.report-hero::before {
  content: '';
  position: absolute; right: -80px; top: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,255,0.08), transparent 70%);
}
.risk-gauge {
  width: 180px; height: 100px;
  position: relative; margin: 0 auto;
}
.risk-label {
  font-family: var(--font-display); font-size: 2rem;
  text-transform: capitalize;
}
.radar-wrap {
  width: 100%; max-width: 400px;
  margin: 0 auto; aspect-ratio: 1;
}
.score-timeline { position: relative; }
.timeline-point {
  position: absolute;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  transform: translate(-50%, -50%);
}

/* ── Utility ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.text-cyan    { color: var(--cyan); }
.text-violet  { color: var(--violet); }
.text-emerald { color: var(--emerald); }
.text-amber   { color: var(--amber); }
.text-rose    { color: var(--rose); }
.text-dim     { color: var(--text-dim); }
.text-sm      { font-size: 0.85rem; }
.text-xs      { font-size: 0.75rem; }
.font-mono    { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.font-600     { font-weight: 600; }
.text-center  { text-align: center; }
.w-full       { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.2rem; color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-dim);
}
.empty-state {
  text-align: center; padding: 4rem;
  color: var(--text-dim);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  html, body { height: auto; }
  .app-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .sidebar {
    display: none;
  }
  .main-wrapper {
    margin-left: 0;
    height: auto;
    overflow: visible;
    flex: none;
  }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 1.25rem; width: 100%; box-sizing: border-box; flex-shrink: 0; }
  .main-content {
    padding: 1.25rem;
    width: 100%;
    box-sizing: border-box;
    overflow-y: visible;
    overflow-x: hidden;
    flex: none;
  }
  .saliva-container { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .test-header { flex-direction: column; align-items: flex-start; padding: 1.25rem; }
  .test-progress-track { width: 100%; flex: auto; }
  .ai-chat { padding: 1rem 0.5rem; }
  .chat-bubble { max-width: 95%; }
  .chat-input-row { padding: 0 0.5rem 1rem; }
}

/* ── Mobile Landscape Fix ── */
@media (max-width: 900px) and (orientation: landscape) {
  .app-shell { min-height: 100svh; }
}

/* ── Score Rings ── */
.score-ring {
  width: 90px; height: 90px;
  border-radius: 50%; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--ring-color, var(--cyan)) var(--pct, 0%), var(--glass-2) 0%);
}
.score-ring-inner {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.score-ring-value {
  font-family: var(--font-mono); font-size: 1rem;
  font-weight: 700; color: var(--text-primary);
}
.score-ring-label {
  font-size: 0.55rem; color: var(--text-dim);
  text-align: center; line-height: 1.2;
}

/* ── Flanker Feedback ── */
.feedback-correct { color: var(--emerald); animation: flashGreen 0.3s; }
.feedback-wrong   { color: var(--rose);    animation: flashRed 0.3s; }
@keyframes flashGreen { 0%,100% { background: transparent; } 50% { background: rgba(16,185,129,0.1); } }
@keyframes flashRed   { 0%,100% { background: transparent; } 50% { background: rgba(244,63,94,0.1); } }

/* ── Fatigue curve ── */
.fatigue-chart { width: 100%; height: 120px; }
