/* ==========================================================================
   Fijate Tools - Secuelas del COVID-19 en deportistas
   Tema oscuro por defecto en :root / [data-theme="dark"] y claro en [data-theme="light"]
   ========================================================================== */

:root,
[data-theme="dark"] {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-page: #090d16;
  --bg-surface: #111827;
  --bg-card: #111827;
  --bg-card-subtle: #162033;
  --bg-input: #0f172a;
  --border-color: #273549;
  --border-focus: #38bdf8;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-color: #38bdf8;
  --primary-light: rgba(56, 189, 248, 0.14);
  --primary-border: rgba(56, 189, 248, 0.35);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.14);
  --success-border: rgba(16, 185, 129, 0.38);
  --success-text: #6ee7b7;

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --warning-border: rgba(245, 158, 11, 0.38);
  --warning-text: #fcd34d;

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.42);
  --danger-text: #fca5a5;

  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.14);
  --purple-border: rgba(168, 85, 247, 0.4);
  --purple-text: #d8b4fe;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-color: #0284c7;
  --primary-light: #e0f2fe;
  --primary-border: #7dd3fc;

  --success: #059669;
  --success-bg: #ecfdf5;
  --success-border: #6ee7b7;
  --success-text: #065f46;

  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fcd34d;
  --warning-text: #92400e;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fca5a5;
  --danger-text: #991b1b;

  --purple: #7e22ce;
  --purple-bg: #faf5ff;
  --purple-border: #d8b4fe;
  --purple-text: #6b21a8;

  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title {
  font-family: var(--font-heading);
}

.mono,
.text-mono,
code {
  font-family: var(--font-mono);
}

.main-wrapper.tool-layout {
  margin-top: 1.25rem;
  margin-bottom: 3rem;
  flex: 1 0 auto;
}

/* ==========================================================================
   Hero Clínico y KPIs de Evidencia
   ========================================================================== */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 2rem);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}

.hero-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.hero-top-row > div:first-child {
  flex: 1 1 460px;
  min-width: 0;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.22;
  margin-bottom: 0.65rem;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.65;
  max-width: 920px;
}

.hero-desc strong {
  color: var(--text-main);
}

.btn-clinical-disclaimer {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.5rem 0.95rem;
  border-radius: 9999px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-clinical-disclaimer:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.95rem;
  margin-top: 1.35rem;
}

.kpi-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.kpi-val {
  font-family: var(--font-mono);
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.kpi-val.is-danger { color: var(--danger); }
.kpi-val.is-warning { color: var(--warning); }
.kpi-val.is-success { color: var(--success); }

.kpi-label {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Presets bar */
.preset-bar {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.preset-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.presets-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.btn-preset {
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 9999px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.btn-preset:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.btn-preset.is-active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   Navegación principal por pestañas de la suite
   ========================================================================== */
.suite-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.45rem;
  box-shadow: var(--shadow-card);
}

.suite-tab-btn {
  flex: 1 1 200px;
  min-height: 44px;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.suite-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-subtle);
}

.suite-tab-btn.is-active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.suite-panel {
  display: none;
}

.suite-panel.is-active {
  display: block;
}

/* ==========================================================================
   Módulo 1: Evaluador de Triaje, Red Flags, POTS, PEM y Retorno (GRTP)
   ========================================================================== */
.triage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.35rem;
  align-items: start;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1.15rem, 2.2vw, 1.65rem);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.panel-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.btn-ghost-reset {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost-reset:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.form-block {
  margin-bottom: 1.45rem;
}

.form-block:last-child {
  margin-bottom: 0;
}

.block-subtitle {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.form-group label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.label-note {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.77rem;
}

.input-with-unit {
  display: flex;
  align-items: stretch;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.input-with-unit:focus-within {
  border-color: var(--border-focus);
}

.input-with-unit input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  min-height: 42px;
  padding: 0.5rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  outline: none;
}

.input-unit {
  display: inline-flex;
  align-items: center;
  padding: 0 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  border-left: 1px solid var(--border-color);
  white-space: nowrap;
}

select.form-select,
input.form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

select.form-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

select.form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

select.form-select:focus,
input.form-input:focus {
  border-color: var(--border-focus);
}

/* Checklists clínicos (Red flags & PEM) */
.clinical-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.check-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 44px;
}

.check-tile:hover {
  border-color: var(--primary-border);
}

.check-tile.is-red-flag:has(input:checked) {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.check-tile.is-pem-flag:has(input:checked) {
  background: var(--purple-bg);
  border-color: var(--purple-border);
}

.check-tile input[type="checkbox"] {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}

.check-tile.is-red-flag input[type="checkbox"] {
  accent-color: var(--danger);
}

.check-tile.is-pem-flag input[type="checkbox"] {
  accent-color: var(--purple);
}

.check-tile-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.86rem;
  color: var(--text-main);
  line-height: 1.4;
}

.check-tile-sub {
  font-size: 0.77rem;
  color: var(--text-muted);
}

/* Orthostatic test helper */
.ortho-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem;
}

.ortho-tip {
  font-size: 0.81rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  line-height: 1.5;
}

.action-row-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.15rem;
}

.btn-primary-action {
  flex: 1 1 200px;
  min-height: 44px;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #090d16;
  font-family: var(--font-heading);
  font-size: 0.93rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

[data-theme="light"] .btn-primary-action {
  color: #ffffff;
}

.btn-primary-action:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary-action {
  flex: 1 1 160px;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.btn-secondary-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   Panel Derecho de Resultados Clínicos (Semáforo, Zonas, GRTP)
   ========================================================================== */
.verdict-banner {
  border-radius: var(--radius-md);
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  margin-bottom: 1.15rem;
}

.verdict-banner.is-red-cardio {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.verdict-banner.is-red-pem {
  background: var(--purple-bg);
  border-color: var(--purple-border);
}

.verdict-banner.is-amber {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.verdict-banner.is-green {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.26rem 0.7rem;
  border-radius: 9999px;
  margin-bottom: 0.55rem;
}

.verdict-banner.is-red-cardio .verdict-badge { background: rgba(239,68,68,0.22); color: var(--danger-text); }
.verdict-banner.is-red-pem .verdict-badge { background: rgba(168,85,247,0.22); color: var(--purple-text); }
.verdict-banner.is-amber .verdict-badge { background: rgba(245,158,11,0.22); color: var(--warning-text); }
.verdict-banner.is-green .verdict-badge { background: rgba(16,185,129,0.22); color: var(--success-text); }

.verdict-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.verdict-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.metrics-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.metric-mini-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
}

.metric-mini-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.metric-mini-val {
  font-family: var(--font-mono);
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-main);
}

.metric-mini-val.is-good { color: var(--success); }
.metric-mini-val.is-warn { color: var(--warning); }
.metric-mini-val.is-bad { color: var(--danger); }
.metric-mini-val.is-purple { color: var(--purple); }

.metric-mini-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.35;
}

/* Roadmap de fases GRTP / Pacing */
.roadmap-section {
  margin-bottom: 1.15rem;
}

.roadmap-heading {
  font-family: var(--font-heading);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.phase-step-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s ease;
}

.phase-step-card.is-current {
  border-color: var(--primary);
  background: var(--primary-light);
}

.phase-step-card.is-blocked {
  opacity: 0.68;
}

.phase-step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.phase-step-name {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.phase-step-pill {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.16rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--primary);
}

.phase-step-card.is-current .phase-step-pill {
  background: var(--primary);
  color: #090d16;
  border-color: var(--primary);
}

[data-theme="light"] .phase-step-card.is-current .phase-step-pill {
  color: #ffffff;
}

.phase-step-desc {
  font-size: 0.81rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Pruebas médicas sugeridas */
.tests-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}

.tests-box h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.tests-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.tests-list li {
  font-size: 0.83rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.45;
}

.tests-list li::before {
  content: "▸";
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
}

/* ==========================================================================
   Módulo 2: Mapa Fisiológico SVG Interactivo y Atlas de Secuelas
   ========================================================================== */
.atlas-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.filter-chip.is-active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.atlas-split-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}

.anatomy-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-card);
}

.anatomy-svg-wrap {
  background: radial-gradient(circle at 50% 35%, rgba(56, 189, 248, 0.08), transparent 72%), var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.9rem;
  display: flex;
  justify-content: center;
}

.anatomy-svg {
  width: 100%;
  max-width: 285px;
  height: auto;
  display: block;
}

.body-outline {
  fill: rgba(148, 163, 184, 0.08);
  stroke: #475569;
  stroke-width: 1.8;
}

[data-theme="light"] .body-outline {
  fill: rgba(148, 163, 184, 0.16);
  stroke: #64748b;
}

.organ-wire {
  fill: none;
  stroke: #64748b;
  stroke-width: 1.3;
  opacity: 0.65;
}

.svg-hotspot {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.svg-hotspot-ring {
  fill: none;
  stroke-width: 2;
  opacity: 0.65;
  animation: pulseRing 2.4s ease-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.svg-hotspot-core {
  stroke: #0b0f17;
  stroke-width: 2;
  transition: r 0.2s ease, opacity 0.2s ease;
}

[data-theme="light"] .svg-hotspot-core {
  stroke: #ffffff;
}

.svg-hotspot.is-active .svg-hotspot-ring {
  opacity: 1;
  stroke-width: 3;
}

@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.75; }
  70% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

.systems-legend-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.system-legend-btn {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.system-legend-btn:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.system-legend-btn.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.system-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.system-legend-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.system-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.selected-system-banner {
  background: var(--bg-card);
  border: 1px solid var(--primary-border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  box-shadow: var(--shadow-card);
}

.selected-system-banner strong {
  color: var(--text-main);
}

.atlas-results-col {
  min-width: 0;
}

.atlas-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.atlas-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.anatomy-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.sequelae-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.sequela-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.sequela-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
}

.sequela-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.sev-pill {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
}

.sev-pill.is-alta {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.sev-pill.is-media-alta {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.sev-pill.is-media {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.sev-pill.is-baja-media {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.sequela-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.sequela-meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--primary);
  margin-bottom: 0.45rem;
}

.sequela-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.btn-open-dossier {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.btn-open-dossier:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   Módulo 3: Casos Reales Documentados en el Deporte
   ========================================================================== */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
}

.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  box-shadow: var(--shadow-card);
}

.case-sport-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 0.22rem 0.65rem;
  border-radius: 9999px;
  margin-bottom: 0.6rem;
}

.case-athlete {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.case-diagnosis {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 0.6rem;
}

.case-text {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.65rem;
}

.case-lesson {
  background: var(--bg-card-subtle);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.65rem 0.8rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.48;
}

/* ==========================================================================
   Modales Accesibles (Cero window.alert())
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(5, 8, 15, 0.78);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.is-open {
  display: flex;
}

.modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-modal-close {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
}

.btn-modal-close:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.dossier-block {
  margin-bottom: 1.1rem;
}

.dossier-block:last-child {
  margin-bottom: 0;
}

.dossier-block h4 {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.dossier-list {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.95rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
}

/* Report sheet inside modal */
.report-sheet {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  font-size: 0.87rem;
  line-height: 1.55;
}

.report-sheet-head {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.report-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.report-kv-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
}

/* Impresión A4 limpia para el informe médico */
#print-clinical-mount {
  display: none;
}

@media print {
  body > *:not(#print-clinical-mount) {
    display: none !important;
  }

  #print-clinical-mount {
    display: block !important;
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 12mm;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  #print-clinical-mount .report-sheet {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
  }

  #print-clinical-mount .report-kv-item {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
  }
}

/* ==========================================================================
   Adaptación Responsiva (Móvil <= 960px y <= 640px)
   ========================================================================== */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .kpi-grid,
  .form-row-2,
  .form-row-3,
  .metrics-cards-grid,
  .report-kv-grid {
    grid-template-columns: 1fr;
  }

  .suite-tab-btn,
  .btn-preset,
  .filter-chip,
  .btn-primary-action,
  .btn-secondary-action,
  .btn-clinical-disclaimer {
    width: 100%;
    justify-content: center;
  }

  .hero-top-row {
    flex-direction: column;
    align-items: stretch;
  }
}
