/* === AI Doctor — Dark Medical Theme v4.0 (Nova Session 30 — Modern UI) === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');
* { box-sizing: border-box; margin: 0; padding: 0; }
fieldset { border: none; padding: 0; margin: 0; }
fieldset legend { padding: 0; }
:root {
  --primary: #6366f1; --primary-dark: #4f46e5; --primary-light: #eef2ff;
  --blue: #6366f1; --blue-dark: #4f46e5; --blue-light: #eef2ff;
  --green: #34d399; --yellow: #fbbf24; --red: #f87171; --cyan: #22d3ee;
  --accent-violet: #8b5cf6; --accent-rose: #f43f5e; --accent-emerald: #10b981; --accent-amber: #f59e0b;
  --bg: #080c18; --bg-card: rgba(255,255,255,0.04); --bg-elevated: rgba(255,255,255,0.07);
  --text: #f1f5f9; --text-muted: #94a3b8; --text-dim: #64748b;
  --border: rgba(255,255,255,0.08); --border-light: rgba(255,255,255,0.12);
  --glass-border: rgba(148,163,184,0.08); --glass-highlight: rgba(255,255,255,0.03);
  --radius: 16px; --radius-sm: 10px; --radius-lg: 24px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3); --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-glow: 0 8px 32px rgba(99,102,241,0.15);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1); --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --glass-blur: 16px;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}
body.pediatric-mode {
  --primary: #7C3AED; --primary-dark: #6D28D9; --primary-light: #EDE9FE;
  --blue: #7C3AED; --blue-dark: #6D28D9; --blue-light: #EDE9FE;
  --bg: #0c0818; --bg-card: rgba(124,58,237,0.06); --bg-elevated: rgba(124,58,237,0.12);
  --border: rgba(124,58,237,0.15); --border-light: rgba(124,58,237,0.25);
  --accent-violet: #c084fc;
}
body.pediatric-mode .onboarding-overlay { background: linear-gradient(135deg, #1a0f2e 0%, #3d2b5e 40%, #7C3AED 100%); }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ONBOARDING */
.onboarding-overlay { position: fixed; inset: 0; background: linear-gradient(145deg, #080c18 0%, #1a1e3a 30%, #312e81 60%, #6366f1 100%); z-index: 1000; display: flex; align-items: center; justify-content: center; overflow-y: auto; }
.onboarding-container { max-width: 540px; width: 90%; text-align: center; color: #fff; padding: 40px 20px; }
.onboarding-step { display: none; animation: fadeIn 0.4s ease; }
.onboarding-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.onboarding-logo { margin-bottom: 24px; }
.logo-icon, .onboarding-logo .logo-pulse { font-size: 4rem; display: block; margin-bottom: 8px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.onboarding-step h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; }
.tagline, .onboarding-subtitle { opacity: 0.85; font-size: 1.1rem; margin-bottom: 20px; }
.onboarding-features { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; text-align: left; }
.onb-feature { display: flex; align-items: flex-start; gap: 12px; background: rgba(255,255,255,0.08); border-radius: var(--radius-sm); padding: 12px 16px; }
.onb-icon { font-size: 1.5rem; flex-shrink: 0; }
.onb-feature div { font-size: 0.9rem; line-height: 1.4; }
.onb-feature div strong { display: block; margin-bottom: 2px; }
.onb-desc { opacity: 0.85; font-size: 0.95rem; margin-bottom: 16px; }
.onb-next, .onboarding-next { width: 100%; padding: 14px; font-size: 1rem; border-radius: var(--radius); margin-top: 8px; }
.onb-branding, .onboarding-built-by { opacity: 0.6; font-size: 0.8rem; margin: 20px 0; }
.onb-branding a, .onboarding-built-by a { color: #93c5fd; }
.disclaimer-icon-lg { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.onboarding-icon { font-size: 3rem; margin-bottom: 12px; display: block; }
.onboarding-step h2 { font-size: 1.4rem; margin-bottom: 16px; }
.disclaimer-card { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,200,50,0.3); border-radius: var(--radius); padding: 24px; text-align: left; margin-bottom: 20px; line-height: 1.7; }
.disclaimer-card p { margin-bottom: 10px; opacity: 0.9; font-size: 0.9rem; }
.disclaimer-card ul { margin: 10px 0 10px 20px; }
.disclaimer-card ul li { margin-bottom: 6px; opacity: 0.9; font-size: 0.88rem; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; }
.mode-card { background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.15); border-radius: var(--radius); padding: 24px 16px; cursor: pointer; transition: all 0.2s; text-align: center; }
.mode-card:hover { background: rgba(255,255,255,0.12); }
.mode-card.selected { border-color: #fff; background: rgba(255,255,255,0.18); }
.mode-card-icon { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.mode-card strong { font-size: 1rem; display: block; margin-bottom: 4px; }
.mode-card p { opacity: 0.75; font-size: 0.8rem; }

/* BUTTONS */
.btn { padding: 10px 20px; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all 0.2s; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--accent-violet)); color: #fff; box-shadow: 0 2px 12px rgba(99,102,241,0.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--blue-dark), var(--blue)); box-shadow: 0 4px 20px rgba(99,102,241,0.4); }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-lg { padding: 14px 28px; font-size: 1rem; width: 100%; margin-top: 16px; border-radius: var(--radius); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-icon { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; }
.btn-icon:hover { color: var(--red); }

/* APP LAYOUT */
.app { min-height: 100vh; }
.disclaimer-banner, .top-disclaimer { background: rgba(245,158,11,0.12); color: var(--yellow); text-align: center; padding: 8px 16px; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
.disclaimer-banner p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 0; }
.disclaimer-banner button { background: none; border: 1px solid rgba(245,158,11,0.4); color: var(--yellow); border-radius: var(--radius-sm); padding: 2px 10px; cursor: pointer; font-size: 0.8rem; font-family: inherit; }
.disclaimer-banner button:hover { background: rgba(245,158,11,0.15); }
.nav { background: rgba(8,12,24,0.7); backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2); border-bottom: 1px solid var(--glass-border); position: sticky; top: 0; z-index: 100; display: flex; align-items: center; padding: 0 20px; }
.nav-brand { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 12px 0; flex-shrink: 0; }
.nav-logo { font-size: 1.5rem; }
.nav-title { font-size: 1.2rem; font-weight: 700; color: var(--blue); }
.nav-links { display: flex; gap: 2px; flex: 1; justify-content: center; }
.nav-link { padding: 14px 12px; color: var(--text-dim); font-size: 0.85rem; font-weight: 500; border-bottom: 2px solid transparent; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--blue); border-bottom-color: var(--blue); text-shadow: 0 0 20px rgba(99,102,241,0.3); }
.nav-controls { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.mode-select, .model-select, .control-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.8rem; background: var(--bg-elevated); color: var(--text); cursor: pointer; font-family: inherit; }
.hamburger, .nav-menu-btn { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 1.2rem; }
.mobile-menu { position: absolute; top: 56px; left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); z-index: 99; padding: 8px 0; }
.mobile-menu a { display: block; padding: 12px 20px; color: var(--text); font-size: 0.9rem; cursor: pointer; text-decoration: none; }
.mobile-menu a:hover { background: var(--bg-elevated); text-decoration: none; }
.bottom-nav { display: none; position: fixed; bottom: 12px; left: 12px; right: 12px; background: rgba(8,12,24,0.85); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); border: 1px solid rgba(255,255,255,0.08); border-radius: 20px; z-index: 100; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; color: var(--text-dim); font-size: 0.65rem; font-weight: 500; text-decoration: none; cursor: pointer; flex: 1; border-radius: 12px; transition: all 0.2s ease; }
.bottom-nav-item:hover { text-decoration: none; }
.bottom-nav-item.active { color: var(--blue); background: rgba(99,102,241,0.12); }
.bottom-nav-item span:first-child { font-size: 1.3rem; transition: transform 0.2s ease; }
.bottom-nav-item.active span:first-child { transform: scale(1.15); }

/* SCREENS */
.screen { display: none; animation: fadeIn 0.3s; }
.screen.active { display: block; }
.content-area, .container { max-width: 960px; margin: 0 auto; padding: 24px 20px 100px; }
.screen-header { margin-bottom: 24px; }
.screen-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.screen-header p, .screen-desc { color: var(--text-muted); font-size: 0.9rem; }

/* HOME */
.hero { text-align: center; padding: 48px 20px 24px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; margin-bottom: 10px; letter-spacing: -0.03em; line-height: 1.1; background: linear-gradient(135deg, #f0f0f5 0%, #818cf8 50%, #c084fc 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-sub { color: var(--text-muted); font-size: 1.1rem; }
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 28px 0; }
.action-card { background: var(--bg-card); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 28px 24px; cursor: pointer; transition: all 0.3s var(--ease-spring); position: relative; overflow: hidden; box-shadow: inset 0 1px 0 0 var(--glass-highlight), 0 4px 24px rgba(0,0,0,0.15); }
.action-card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, transparent 0%, rgba(99,102,241,0.3) 50%, rgba(34,211,238,0.2) 100%); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.action-card:hover::before { opacity: 1; }
.action-card:hover { transform: translateY(-6px) scale(1.01); box-shadow: var(--shadow-glow), 0 2px 8px rgba(0,0,0,0.3); border-color: rgba(99,102,241,0.3); background: rgba(255,255,255,0.06); }
.action-card:active { transform: translateY(-2px) scale(0.98); transition-duration: 0.1s; }
.action-icon-wrap { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; margin-bottom: 16px; background: rgba(99,102,241,0.12); transition: transform 0.3s var(--ease-bounce), box-shadow 0.3s; }
.action-card:hover .action-icon-wrap { transform: scale(1.1); }
.action-card:nth-child(1) .action-icon-wrap { background: rgba(99,102,241,0.15); box-shadow: 0 0 20px rgba(99,102,241,0.1); }
.action-card:nth-child(2) .action-icon-wrap { background: rgba(34,211,238,0.15); box-shadow: 0 0 20px rgba(34,211,238,0.1); }
.action-card:nth-child(3) .action-icon-wrap { background: rgba(52,211,153,0.15); box-shadow: 0 0 20px rgba(52,211,153,0.1); }
.action-card:nth-child(4) .action-icon-wrap { background: rgba(251,191,36,0.15); box-shadow: 0 0 20px rgba(251,191,36,0.1); }
.action-icon, .action-card-icon { font-size: 1.5rem; display: block; line-height: 1; }
.action-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.action-card p { color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; }
.sample-section { margin: 40px 0; }
.sample-section h2 { font-size: 1.4rem; margin-bottom: 6px; font-weight: 700; }
.sample-desc { color: var(--text-muted); margin-bottom: 24px; font-size: 0.95rem; }
.sample-group-title { font-size: 0.85rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin: 24px 0 10px; padding-left: 2px; }
.sample-desc, .section-subtitle { color: var(--text-muted); margin-bottom: 16px; font-size: 0.9rem; }
.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 8px; }
.sample-card { background: var(--bg-card); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 16px; text-align: left; cursor: pointer; transition: all 0.25s var(--ease-spring); display: flex; gap: 12px; align-items: flex-start; box-shadow: inset 0 1px 0 0 var(--glass-highlight); }
.sample-card:hover { border-color: rgba(99,102,241,0.3); background: rgba(255,255,255,0.06); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(99,102,241,0.1); }
.sample-icon { font-size: 1.3rem; flex-shrink: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: rgba(255,255,255,0.05); }
.sample-card strong { display: block; margin-bottom: 3px; font-size: 0.88rem; font-weight: 600; }
.sample-card p { color: var(--text-muted); font-size: 0.78rem; line-height: 1.4; }
.sample-group-title { font-size: 1rem; color: var(--text-muted); margin: 20px 0 8px; font-weight: 600; }
.sample-case-banner { background: var(--blue); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: 0.9rem; }
.sample-case-desc { background: var(--bg-elevated); color: var(--text-muted); padding: 12px 16px; border-radius: 0 0 var(--radius-sm) var(--radius-sm); font-size: 0.85rem; margin-bottom: 16px; border: 1px solid var(--border); border-top: none; }
.sample-icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }

/* Toast Notifications */
.toast-notification { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; max-width: 420px; box-shadow: var(--shadow-md); opacity: 0; transform: translateY(-10px); transition: all 0.3s ease; }
.toast-notification.visible { opacity: 1; transform: translateY(0); }
.toast-error { background: #7f1d1d; color: #fecaca; border: 1px solid #dc2626; }
.toast-warning { background: #78350f; color: #fef3c7; border: 1px solid #f59e0b; }
.toast-success { background: #14532d; color: #bbf7d0; border: 1px solid #22c55e; }
.toast-text { flex: 1; }
.toast-close { background: none; border: none; color: inherit; font-size: 1.2rem; cursor: pointer; opacity: 0.7; padding: 0 4px; }
.toast-close:hover { opacity: 1; }
.app-footer { margin-top: 40px; padding: 24px 0; border-top: 1px solid var(--border); }
.footer-disclaimer { background: rgba(245,158,11,0.06); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }
.footer-disclaimer p { color: var(--text-muted); font-size: 0.8rem; text-align: center; }
.footer-branding p { text-align: center; color: var(--text-dim); font-size: 0.8rem; margin-bottom: 4px; }
.footer-links { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.footer-links a { color: var(--blue); font-size: 0.85rem; }
.footer-sep { color: var(--text-dim); }
.footer-tech { color: var(--text-dim); font-size: 0.75rem; margin-top: 4px; }

/* IMAGE ANALYSIS */
.steps-bar { display: flex; align-items: center; justify-content: center; margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 0.85rem; font-weight: 500; }
.step.active { color: var(--blue); }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.step.active .step-num { background: var(--blue); color: #fff; }
.step-line { width: 40px; height: 2px; background: var(--border); margin: 0 8px; }
.image-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 24px; }
.type-card { background: var(--bg-card); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 2px solid var(--glass-border); border-radius: var(--radius); padding: 16px 12px; cursor: pointer; text-align: center; transition: all 0.25s var(--ease-spring); }
.type-card:hover { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.06); transform: translateY(-2px); }
.type-card.selected { border-color: var(--blue); background: rgba(99,102,241,0.1); box-shadow: 0 0 20px rgba(99,102,241,0.1); }
.type-icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.type-card strong { font-size: 0.85rem; display: block; margin-bottom: 2px; }
.type-card p { color: var(--text-muted); font-size: 0.75rem; }
.upload-section { margin-bottom: 20px; }
.upload-dropzone { border: 2px dashed var(--border-light); border-radius: var(--radius-lg); padding: 48px 24px; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--bg-card); }
.upload-dropzone:hover, .upload-dropzone.drag-over { border-color: var(--blue); background: rgba(99,102,241,0.08); }
.upload-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.upload-hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 4px; }
.image-preview-container { margin: 16px 0; text-align: center; }
.image-preview { max-width: 100%; max-height: 400px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 12px; display: block; }
.image-preview-sm { max-width: 200px; max-height: 200px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 8px; }
.analysis-options { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; align-items: center; }
.option-group { display: flex; flex-direction: column; gap: 4px; }
.option-group label { color: var(--text-muted); font-size: 0.85rem; }
.option-group input[type="number"] { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-family: inherit; font-size: 0.9rem; width: 100px; }
.option-group input[type="number"]:focus { outline: none; border-color: var(--blue); }
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; color: var(--text-muted); }
.toggle-label input[type="checkbox"] { accent-color: var(--blue); }

/* RESULTS */
.results-area, .panel-results-area, .results-container { margin-top: 24px; background: var(--bg-card); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 24px; animation: fadeIn 0.3s; }
.results-area h3, .results-container h3 { font-size: 1.2rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.results-area h4, .results-container h4 { margin: 16px 0 8px; font-size: 1rem; color: var(--text-muted); }
.finding-text, .result-text { color: var(--text); line-height: 1.7; margin-bottom: 12px; white-space: pre-wrap; }
.result-disclaimer { font-size: 0.75rem; color: var(--text-dim); margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); font-style: italic; }
.model-badge { background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1)); border: 1px solid rgba(99,102,241,0.2); border-radius: 20px; padding: 4px 12px; font-size: 0.75rem; color: #818cf8; font-weight: 500; letter-spacing: 0.02em; display: inline-flex; align-items: center; gap: 4px; }
.severity { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; margin-bottom: 12px; }
.severity-low { background: rgba(34,197,94,0.2); color: var(--green); }
.severity-moderate { background: rgba(245,158,11,0.2); color: var(--yellow); }
.severity-high { background: rgba(239,68,68,0.2); color: var(--red); }
.severity-urgent { background: var(--red); color: #fff; }
.differential-list { list-style: none; margin: 8px 0 16px; }
.differential-item { padding: 10px 14px; border-left: 3px solid var(--border); margin-bottom: 6px; background: var(--bg-elevated); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.differential-item.high { border-left-color: var(--red); }
.differential-item.moderate { border-left-color: var(--yellow); }
.differential-item.low { border-left-color: var(--green); }
.differential-item strong { display: block; font-size: 0.9rem; margin-bottom: 2px; }
.differential-item span { font-size: 0.8rem; color: var(--text-muted); }
.recommendations { list-style: none; margin: 8px 0; }
.recommendations li { padding: 6px 0 6px 20px; position: relative; font-size: 0.9rem; }
.recommendations li::before { content: "\2192"; position: absolute; left: 0; color: var(--blue); }

/* LAB RESULTS */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 18px; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-family: inherit; font-size: 0.9rem; color: var(--text-dim); font-weight: 500; transition: all 0.2s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content, .tab-panel { display: none; animation: fadeIn 0.3s; }
.tab-content.active, .tab-panel.active { display: block; }
.lab-entries { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.lab-entry { display: flex; gap: 8px; align-items: center; }
.lab-entry .lab-name { flex: 2; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-family: inherit; font-size: 0.9rem; }
.lab-entry .lab-value, .lab-entry .lab-unit { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-family: var(--font-mono); font-size: 0.9rem; }
.lab-entry .lab-name:focus, .lab-entry .lab-value:focus, .lab-entry .lab-unit:focus { outline: none; border-color: var(--blue); }
.lab-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.lab-table th { background: var(--bg-elevated); text-align: left; padding: 10px 12px; font-size: 0.8rem; color: var(--text-muted); border-bottom: 2px solid var(--border); font-weight: 600; }
.lab-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; font-family: var(--font-mono); }
.lab-table tr:hover { background: rgba(255,255,255,0.03); }
.status-normal { color: var(--green); font-weight: 600; }
.status-high, .status-critical_high { color: var(--red); font-weight: 600; }
.status-low, .status-critical_low { color: var(--cyan); font-weight: 600; }
.status-unknown { color: var(--text-dim); font-weight: 500; }
.sample-lab-grid, .sample-lab-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sample-lab-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all 0.2s; }
.sample-lab-card:hover { border-color: var(--blue); background: rgba(99,102,241,0.08); }
.sample-lab-card strong { display: block; margin-bottom: 4px; font-size: 0.95rem; }
.sample-lab-card p { color: var(--text-muted); font-size: 0.8rem; }
.sample-badge { display: inline-block; background: var(--bg-elevated); color: var(--text-dim); border-radius: 12px; padding: 2px 8px; font-size: 0.7rem; margin-top: 6px; }
.lab-trends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.lab-trend-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.trend-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.9rem; }
.trend-arrow { font-size: 0.85rem; font-weight: 600; }
.trend-normal { color: var(--green); }
.trend-high { color: var(--red); }
.trend-low { color: var(--cyan); }
.trend-body { display: flex; align-items: center; gap: 10px; }
.trend-value { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.trend-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 6px; }
.lab-sparkline { display: block; }
.lab-history-list { display: flex; flex-direction: column; gap: 1px; }
.lab-history-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s; }
.lab-history-item:hover { background: rgba(99,102,241,0.06); border-color: var(--blue); }
.lab-history-info { display: flex; flex-direction: column; gap: 2px; }
.lab-history-info strong { font-size: 0.9rem; }
.lab-history-info .text-muted { font-size: 0.75rem; }
.lab-history-stats { display: flex; gap: 12px; font-size: 0.8rem; font-family: var(--font-mono); }

/* CHAT */
.chat-layout, .chat-wrapper { display: flex; flex-direction: column; height: calc(100vh - 110px); max-width: 800px; margin: 0 auto; padding: 0 20px; }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.chat-header h2 { font-size: 1.2rem; flex: 1; }

/* Chat History Panel */
.chat-history-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; max-height: 240px; overflow-y: auto; animation: fadeIn 0.2s; }
.chat-history-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); }
.chat-history-header strong { font-size: 0.9rem; }
.chat-history-list { display: flex; flex-direction: column; }
.chat-history-item { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); transition: background 0.15s; }
.chat-history-item:last-child { border-bottom: none; }
.chat-history-item:hover { background: var(--bg-elevated); }
.chat-history-item.active { background: rgba(99,102,241,0.1); color: var(--blue); }
.chat-history-item .history-preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-item .history-meta { font-size: 0.75rem; color: var(--text-dim); flex-shrink: 0; }
.chat-history-item .history-delete { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 2px 4px; font-size: 0.8rem; opacity: 0; transition: opacity 0.15s; }
.chat-history-item:hover .history-delete { opacity: 1; }
.chat-history-item .history-delete:hover { color: var(--red); }
.chat-history-empty { padding: 16px; text-align: center; color: var(--text-dim); font-size: 0.85rem; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 0; }
.chat-msg { max-width: 85%; animation: fadeIn 0.3s; padding: 12px 16px; border-radius: 16px; font-size: 0.9rem; line-height: 1.6; }
.chat-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--blue), var(--accent-violet)); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; box-shadow: 0 2px 12px rgba(99,102,241,0.2); }
.chat-msg.assistant { align-self: flex-start; background: var(--bg-card); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--glass-border); border-bottom-left-radius: 4px; }
.chat-msg.assistant p { margin: 0 0 8px; }
.chat-msg.assistant p:last-child { margin-bottom: 0; }
.chat-msg.assistant ul { margin: 4px 0 8px 20px; padding: 0; }
.chat-msg.assistant li { margin-bottom: 4px; }
.chat-msg.assistant strong { color: var(--text); }
.chat-msg.assistant em { color: var(--text-muted); font-style: italic; }
.chat-msg.system { align-self: center; background: var(--bg-elevated); color: var(--text-muted); font-size: 0.85rem; text-align: center; max-width: 100%; }
.chat-msg.system p { margin-bottom: 4px; }
.chat-msg.system em { font-size: 0.8rem; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.chat-suggestions button, .suggestion-chip { background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 0.8rem; color: var(--text-muted); cursor: pointer; font-family: inherit; transition: all 0.2s; }
.chat-suggestions button:hover, .suggestion-chip:hover { border-color: var(--blue); color: var(--blue); }
/* Chat image attachment */
.chat-image-preview { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 0 0 4px; background: var(--bg-elevated); border-radius: var(--radius-sm); }
.chat-img-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.btn-remove-attach { font-size: 1.2rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0 4px; line-height: 1; }
.btn-remove-attach:hover { color: var(--red); }
.btn-attach { font-size: 1.2rem; padding: 6px 8px; background: none; border: none; color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.btn-attach:hover { color: var(--primary); }
/* Chat continue-in-chat section */
.chat-continue-section { margin-top: 16px; text-align: center; }
.chat-continue-section .btn { display: inline-flex; align-items: center; gap: 8px; }
.chat-input-area { display: flex; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); align-items: flex-end; }
#chat-input { flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: 24px; background: var(--bg-card); color: var(--text); font-family: inherit; font-size: 0.9rem; resize: none; max-height: 150px; }
#chat-input:focus { outline: none; border-color: var(--blue); }
.chat-disclaimer { text-align: center; color: var(--text-dim); font-size: 0.75rem; padding: 4px 0 8px; font-style: italic; }

/* PANEL OF EXPERTS */
.panel-model-selection { margin-bottom: 24px; }
.panel-model-selection h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text-muted); }
.model-checkboxes, .panel-models { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.model-checkbox { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: all 0.2s; font-size: 0.9rem; }
.model-checkbox:hover { border-color: var(--blue); }
.model-checkbox input { accent-color: var(--blue); }
.panel-input-section { margin-bottom: 20px; }
.panel-input-section label { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }
#panel-query { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-family: inherit; font-size: 0.9rem; resize: vertical; min-height: 100px; }
#panel-query:focus { outline: none; border-color: var(--blue); }
.panel-upload-section { margin-bottom: 20px; }
.panel-upload-section label { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }
.upload-dropzone-sm { border: 2px dashed var(--border-light); border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--bg-card); font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 8px; }
.upload-dropzone-sm:hover { border-color: var(--blue); background: rgba(99,102,241,0.06); }
.consensus-card { background: rgba(99,102,241,0.1); border: 1px solid var(--blue); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.consensus-card h3 { color: var(--blue); margin-bottom: 8px; }
.consensus-text { color: var(--text); line-height: 1.7; margin: 8px 0; }
.confidence-bar { height: 8px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; margin: 10px 0; }
.confidence-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--yellow), var(--green)); border-radius: 4px; transition: width 0.6s; }
.panel-model-results, .panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.panel-model-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.panel-model-card h4 { color: var(--blue); margin-bottom: 8px; font-size: 0.9rem; }
.model-response { color: var(--text); font-size: 0.85rem; line-height: 1.6; white-space: pre-wrap; max-height: 300px; overflow-y: auto; }

/* EKG COMPARISON */
.ekg-compare-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.ekg-compare-header h3 { font-size: 1.15rem; font-weight: 700; }
.ekg-compare-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.ekg-preview-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-card); }
.ekg-preview-item img { width: 100%; height: 120px; object-fit: cover; }
.ekg-label { display: block; text-align: center; font-size: 0.8rem; font-weight: 600; padding: 6px 0; color: var(--text-muted); }

/* LOADING */
.loading-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.88); backdrop-filter: blur(8px); z-index: 200; display: flex; align-items: center; justify-content: center; }
.loading-content { text-align: center; min-width: 320px; max-width: 420px; padding: 32px; background: var(--bg-card); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-radius: var(--radius-lg); border: 1px solid var(--glass-border); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.loading-spinner { width: 56px; height: 56px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
.loading-model { color: var(--cyan); font-size: 0.85rem; font-weight: 500; margin: 4px 0 12px; min-height: 1.2em; }
.progress-bar-container { width: 100%; height: 8px; background: var(--bg-elevated); border-radius: 4px; margin: 12px 0 8px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: 4px; width: 0%; transition: width 0.4s ease; position: relative; }
.progress-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); animation: shimmer 1.5s ease-in-out infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.progress-info { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.progress-detail { color: var(--text-muted); font-size: 0.8rem; min-height: 1.2em; transition: opacity 0.3s; }
.progress-percent { color: var(--blue); font-size: 0.85rem; font-weight: 600; font-family: var(--font-mono); min-width: 3em; text-align: right; }
.loading-eta { color: var(--text-muted); font-size: 0.75rem; margin-top: 8px; min-height: 1em; opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ERROR */
.error-card { background: rgba(239,68,68,0.1); border: 1px solid var(--red); border-radius: var(--radius); padding: 20px; }
.error-card h3 { color: var(--red); margin-bottom: 8px; }
.error-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.error-card p strong { color: var(--text); }

/* USER PROFILE */
.profile-header-card { display: flex; align-items: center; gap: 16px; background: var(--bg-card); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--accent-violet)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 4px 20px rgba(99,102,241,0.3); }
.profile-avatar span { font-size: 1.4rem; font-weight: 700; color: #fff; }
.profile-info { flex: 1; }
.profile-info h3 { font-size: 1.2rem; margin-bottom: 2px; }
.profile-meta { color: var(--text-muted); font-size: 0.85rem; }
.profile-section { background: var(--bg-card); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; }
.profile-section h3 { font-size: 1.05rem; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.profile-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.profile-field { display: flex; flex-direction: column; gap: 4px; }
.profile-field-wide { grid-column: span 3; }
.profile-field label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.profile-field input, .profile-field select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text); font-family: inherit; font-size: 0.9rem; }
.profile-field input:focus, .profile-field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(99,102,241,0.2); }
.health-score-card { display: flex; align-items: center; gap: 24px; }
.health-score-ring { flex-shrink: 0; }
.score-svg { width: 120px; height: 120px; }
.score-bg { fill: none; stroke: var(--bg-elevated); stroke-width: 8; }
.score-fill { fill: none; stroke: var(--green); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 71.9; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 0.6s ease; }
.score-number { fill: var(--text); font-size: 2rem; font-weight: 800; text-anchor: middle; dominant-baseline: auto; }
.score-label { fill: var(--text-muted); font-size: 0.8rem; text-anchor: middle; }
.health-score-details { flex: 1; }
.health-score-details p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.health-score-details ul { list-style: none; }
.health-score-details li { font-size: 0.85rem; color: var(--text-muted); padding: 4px 0; }
.health-score-details li strong { color: var(--text); }
.profile-prefs { display: flex; flex-direction: column; gap: 12px; }
.profile-prefs .toggle-label { font-size: 0.9rem; }
.health-timeline { max-height: 400px; overflow-y: auto; }
.timeline-date { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.timeline-event { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--radius-sm); transition: background 0.15s; }
.timeline-event:hover { background: rgba(255,255,255,0.03); }
.timeline-icon { font-size: 1.1rem; flex-shrink: 0; width: 28px; text-align: center; }
.timeline-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.timeline-info strong { font-size: 0.85rem; }
.timeline-info .text-muted { font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-time { font-size: 0.7rem; color: var(--text-dim); font-family: var(--font-mono); white-space: nowrap; }
.profile-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-danger { color: var(--red); border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }

/* DEMO MODE BANNER */
.demo-banner { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: var(--yellow); padding: 10px 16px; border-radius: var(--radius-sm); font-size: 0.85rem; margin: 8px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.demo-banner strong { color: var(--yellow); }
.demo-banner-icon { font-size: 1.2rem; }
.demo-banner-text { font-size: 0.85rem; color: var(--yellow); }
.demo-banner-text strong { color: var(--yellow); }

/* VOICE CONTROLS (#80) */
.btn-voice-mic { background: none; border: 2px solid var(--blue); color: var(--blue); border-radius: 50%; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; padding: 0; }
.btn-voice-mic:hover { background: rgba(99,102,241,0.15); }
.btn-voice-mic.listening { background: var(--blue); color: #fff; animation: pulse-mic 1.5s infinite; }
.btn-voice-mic.unsupported { opacity: 0.3; cursor: not-allowed; }
@keyframes pulse-mic { 0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); } 50% { box-shadow: 0 0 0 10px rgba(99,102,241,0); } }

/* Voice Overlay (Listening/Processing) */
.voice-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.95); backdrop-filter: blur(12px); z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.voice-overlay-content { text-align: center; position: relative; display: flex; flex-direction: column; align-items: center; }
.voice-mic-icon { color: var(--blue); z-index: 2; }
.voice-mic-icon.processing { opacity: 0.4; }
.voice-rings { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -70%); }
.voice-ring { position: absolute; border: 2px solid rgba(99,102,241,0.2); border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.voice-ring-1 { width: 100px; height: 100px; animation: ring-pulse 2s ease-out infinite; }
.voice-ring-2 { width: 140px; height: 140px; animation: ring-pulse 2s ease-out infinite 0.4s; }
.voice-ring-3 { width: 180px; height: 180px; animation: ring-pulse 2s ease-out infinite 0.8s; }
@keyframes ring-pulse { 0% { opacity: 0.6; transform: translate(-50%,-50%) scale(0.8); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.2); } }
.voice-waveform { display: flex; align-items: center; gap: 4px; height: 40px; margin-top: 24px; }
.voice-waveform span { width: 4px; background: var(--blue); border-radius: 2px; animation: waveform 0.8s ease-in-out infinite alternate; }
.voice-waveform span:nth-child(1) { height: 12px; animation-delay: 0s; }
.voice-waveform span:nth-child(2) { height: 24px; animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { height: 36px; animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { height: 24px; animation-delay: 0.3s; }
.voice-waveform span:nth-child(5) { height: 12px; animation-delay: 0.4s; }
@keyframes waveform { from { transform: scaleY(0.4); } to { transform: scaleY(1); } }
.voice-waveform.paused span { animation-play-state: paused; }
.voice-status { color: var(--blue); font-size: 1.1rem; font-weight: 600; margin-top: 16px; }
.voice-hint { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; }
.voice-overlay-close { background: none; border: 1px solid var(--border); color: var(--text-muted); padding: 8px 24px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; font-family: inherit; margin-top: 24px; }
.voice-overlay-close:hover { background: var(--bg-elevated); color: var(--text); }

/* TTS Reading Indicator */
.tts-indicator { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--bg-card); border: 1px solid var(--blue); border-radius: 24px; padding: 8px 20px; display: flex; align-items: center; gap: 10px; z-index: 150; cursor: pointer; box-shadow: var(--shadow-md); }
.tts-waveform { display: flex; align-items: center; gap: 2px; height: 20px; }
.tts-waveform span { width: 3px; background: var(--blue); border-radius: 1px; animation: waveform 0.6s ease-in-out infinite alternate; }
.tts-waveform span:nth-child(1) { height: 6px; animation-delay: 0s; }
.tts-waveform span:nth-child(2) { height: 12px; animation-delay: 0.08s; }
.tts-waveform span:nth-child(3) { height: 18px; animation-delay: 0.16s; }
.tts-waveform span:nth-child(4) { height: 14px; animation-delay: 0.24s; }
.tts-waveform span:nth-child(5) { height: 10px; animation-delay: 0.32s; }
.tts-waveform span:nth-child(6) { height: 16px; animation-delay: 0.4s; }
.tts-waveform span:nth-child(7) { height: 8px; animation-delay: 0.48s; }
.tts-label { color: var(--blue); font-size: 0.85rem; font-weight: 500; }
.tts-stop { color: var(--text-dim); font-size: 0.75rem; }

/* Speaker button on assistant messages */
.chat-msg .btn-speak { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 2px 6px; font-size: 0.8rem; opacity: 0; transition: opacity 0.2s; float: right; margin: -4px -8px 0 8px; }
.chat-msg:hover .btn-speak { opacity: 1; }
.chat-msg .btn-speak:hover { color: var(--blue); }
.chat-msg .btn-speak.speaking { color: var(--blue); opacity: 1; }

/* FOCUS INDICATORS (Accessibility) */
*:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(99,102,241,0.4); }
.nav-link:focus-visible { outline-offset: -2px; }
.sample-card:focus-visible, .action-card:focus-visible, .type-card:focus-visible, .mode-card:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

/* SKIP LINK (Accessibility) */
.skip-link { position: absolute; top: -40px; left: 0; background: var(--blue); color: #fff; padding: 8px 16px; z-index: 9999; font-size: 0.9rem; border-radius: 0 0 var(--radius-sm) 0; transition: top 0.2s; }
.skip-link:focus { top: 0; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger, .nav-menu-btn { display: block; }
  .bottom-nav { display: flex; }
  .screen { padding-bottom: 80px; }
  .hero h1 { font-size: 1.6rem; }
  .quick-actions { grid-template-columns: 1fr 1fr; gap: 10px; }
  .action-card { padding: 16px; }
  .sample-grid { grid-template-columns: 1fr 1fr; }
  .sample-lab-grid, .sample-lab-cards { grid-template-columns: 1fr; }
  .lab-entry { flex-wrap: wrap; }
  .model-checkboxes, .panel-models { grid-template-columns: 1fr; }
  .panel-model-results, .panel-grid { grid-template-columns: 1fr; }
  .mode-cards { grid-template-columns: 1fr; }
  .chat-layout, .chat-wrapper { height: calc(100vh - 160px); padding: 0 12px; }
  .nav-controls .mode-select, .nav-controls .model-select { display: none; }
  .image-type-grid { grid-template-columns: repeat(3, 1fr); }
  .steps-bar { gap: 0; }
  .step { font-size: 0.75rem; }
  .step-line { width: 20px; }
  .content-area { padding: 16px 12px 100px; }
  .profile-fields { grid-template-columns: 1fr; }
  .profile-field-wide { grid-column: span 1; }
  .profile-header-card { flex-direction: column; text-align: center; }
  .health-score-card { flex-direction: column; text-align: center; }
  .ekg-results-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .quick-actions { grid-template-columns: 1fr; }
  .sample-grid { grid-template-columns: 1fr 1fr; }
  .image-type-grid { grid-template-columns: 1fr 1fr; }
  .analysis-options { flex-direction: column; }
  .lab-entry { flex-direction: column; gap: 6px; }
  .lab-entry .lab-name, .lab-entry .lab-value, .lab-entry .lab-unit { flex: none; width: 100%; }
  .lab-entry .btn-icon { align-self: flex-end; }
}

/* === EKG DETAILED RESULTS (Issue #81) === */
.ekg-results-layout { padding: 0.5rem 0; }
.ekg-results-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.ekg-results-header h3 { font-size: 1.5rem; font-weight: 700; }
.ekg-results-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; }
.ekg-analysis-panel { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.5rem; }
.ekg-analysis-panel h4 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.75rem; color: var(--primary); }
.ekg-analysis-panel h4:first-child { margin-top: 0; }
.ekg-field { padding: 0.4rem 0; font-size: 0.95rem; line-height: 1.5; }
.ekg-field strong { color: var(--text); }
.ekg-field-detail { font-size: 0.85rem; color: var(--text-muted); padding: 0.2rem 0 0.4rem; }
.ekg-mono { font-family: var(--font-mono); font-weight: 500; }
.ekg-intervals-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.9rem; }
.ekg-intervals-table th { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); color: var(--text-muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ekg-intervals-table td { padding: 0.5rem; border-bottom: 1px solid var(--border-light, rgba(255,255,255,0.05)); }
.ekg-intervals-table td.ekg-mono { font-family: var(--font-mono); }
.ekg-status { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.ekg-status-normal { background: rgba(34,197,94,0.2); color: var(--green); }
.ekg-status-borderline { background: rgba(245,158,11,0.2); color: var(--yellow); }
.ekg-status-abnormal { background: rgba(239,68,68,0.2); color: var(--red); }
.ekg-status-irregular { background: rgba(245,158,11,0.2); color: var(--yellow); }
.ekg-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.ekg-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.25rem; }
.ekg-card h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.75rem; }
.ekg-card-desc { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; line-height: 1.5; }
.ekg-risk-badge { display: inline-block; padding: 0.4rem 1.2rem; border-radius: 9999px; font-weight: 700; font-size: 1.1rem; }
.ekg-risk-low { background: rgba(34,197,94,0.2); color: var(--green); }
.ekg-risk-moderate { background: rgba(245,158,11,0.2); color: var(--yellow); }
.ekg-risk-high { background: rgba(239,68,68,0.2); color: var(--red); }
.ekg-recommendations { padding-left: 1.25rem; font-size: 0.9rem; line-height: 1.7; }
.ekg-recommendations li { margin-bottom: 0.25rem; }
.ekg-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.ekg-actions .btn { width: 100%; text-align: center; }
.ekg-arrhythmias, .ekg-twave { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.25rem; margin-top: 1rem; }
.ekg-arrhythmias h4, .ekg-twave h4 { color: var(--yellow); margin-bottom: 0.5rem; }
.ekg-arrhythmia-item { padding: 0.3rem 0; font-size: 0.9rem; }
@media (max-width: 768px) {
  .ekg-results-grid { grid-template-columns: 1fr; }
  .ekg-actions { flex-direction: row; }
  .ekg-actions .btn { flex: 1; }
}

/* CHAT THINKING INDICATOR */
.chat-msg.thinking { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 4px; padding: 16px 24px; }
.thinking-dots { display: flex; align-items: center; gap: 6px; }
.thinking-dots span { width: 8px; height: 8px; background: var(--text-dim); border-radius: 50%; animation: thinking-bounce 1.4s ease-in-out infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* CHAT RETRY BUTTON */
.chat-retry-btn { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--blue); border-radius: var(--radius-sm); padding: 6px 16px; cursor: pointer; font-size: 0.8rem; font-family: inherit; margin-top: 8px; transition: all 0.2s; }
.chat-retry-btn:hover { background: rgba(99,102,241,0.15); border-color: var(--blue); }

/* REDUCED MOTION (Accessibility) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .loading-spinner { animation: none; border-top-color: var(--blue); }
  .score-fill { transition: none; }
}
