/* ==========================================================================
   humano.css — capa visual "cálida" (se carga al final y sobrescribe).
   Dirección: pastel durazno/rosa, índigo profundo como color de trabajo,
   frambuesa para riesgo, formas orgánicas y sombras difusas en lugar de
   bordes negros y sombras desplazadas. Sin mayúsculas gritonas.
   Absorbe lo que quedaba de neobrutalism.css (2026-10-17).
   ========================================================================== */


/* Los tokens viven en humano-tokens.css (se carga justo antes que este archivo). */

/* ==========================================================================
   Componentes base. Antes vivían en neobrutalism.css (borde negro, sombra
   desplazada) y aquí se sobrescribían con !important; ahora se definen una vez.
   ========================================================================== */

/* --- Campos de formulario --- */
input[type="text"],
input[type="number"],
input[type="search"],
textarea,
select {
  border: 1px solid color-mix(in srgb, var(--text-main) 28%, transparent);
  border-radius: var(--radius-input);
  background-color: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-neo-xs);
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
textarea:hover,
select:hover {
  border-color: color-mix(in srgb, var(--text-main) 30%, transparent);
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
  outline: none; /* lista negra: el anillo de foco es la sombra de arriba */
}
/* Campos con forma propia: buscador de la paleta, interruptores, casillas. */
.cmd-palette__header input,
.cmd-palette__header input:focus {
  border: none;
  box-shadow: none;
  background: transparent;
  font-weight: 400;
}
.home-search-input { border-radius: 999px; }
input[type="checkbox"],
input[type="radio"],
input.pill-switch {
  border: none;
  box-shadow: none;
}
input.pill-switch { border-radius: 999px; font-weight: normal; }

/* --- Botón sólido (primario) y su variante secundaria --- */
.btn-solid {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--color-primary) 60%, transparent);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.btn-solid:hover {
  transform: translateY(-1px);
  background: var(--color-primary-dark);
  box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--color-primary) 70%, transparent);
}
.btn-solid:active { transform: translateY(0); box-shadow: var(--shadow-press); }
.btn-solid:disabled,
.btn-solid:disabled:hover {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: var(--color-primary);
}
.btn-solid--secondary,
.btn-solid--secondary:disabled {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}
.btn-solid--secondary:hover { background: var(--bg-hover); box-shadow: none; }
[data-theme="dark"] .btn-solid:not(.btn-solid--secondary) {
  background: var(--h-btn);
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .btn-solid:not(.btn-solid--secondary):hover { background: var(--h-btn-hover); }
#disclaimer-accept.btn-solid { width: 100%; padding: 16px; font-size: 16px; border-radius: 16px; }

/* --- Tarjeta de alerta clínica (riesgo) --- */
.alert-card {
  width: 100%;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--ritual-red) 40%, transparent);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--ritual-red) 7%, var(--bg-surface));
  box-shadow: var(--shadow-neo-sm);
}
[data-theme="dark"] .alert-card { border-color: rgba(255, 255, 255, 0.05); }
.alert-card__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.alert-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 10px;
  background: var(--ritual-red);
}
.alert-card__icon svg { width: 1.5rem; height: 1.5rem; fill: #fff; stroke: none; }
.alert-card__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}
.alert-card__message { font-size: 0.95rem; font-weight: 500; line-height: 1.4; color: var(--text-main); }
@media (max-width: 480px) {
  .alert-card__title { font-size: 1rem; }
}

/* --- Tarjeta de autor (aviso inicial) --- */
.profile-card {
  position: relative;
  max-width: 320px;
  margin: 20px auto;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  box-shadow: var(--shadow-neo-sm);
}
.profile-card__band {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 88px;
  padding: 0 16px;
  background: var(--hero-gradient);
}
.profile-card__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: -28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--h-pink), var(--h-raspberry));
  box-shadow: 0 0 0 3px var(--bg-surface);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}
.profile-card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}
.profile-card__body { padding: 36px 16px 0; }
.profile-card__name {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-main);
}
.profile-card__bio {
  margin-bottom: 16px;
  padding-left: 10px;
  border-left: 3px solid var(--h-pink);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.profile-card__link {
  display: block;
  margin: 0 16px 16px;
  padding: 12px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.profile-card__link:hover { background: var(--color-primary-dark); }
[data-theme="dark"] .profile-card__link { background: var(--h-btn); }
[data-theme="dark"] .profile-card__link:hover { background: var(--h-btn-hover); }

@media (prefers-reduced-motion: reduce) {
  .btn-solid:hover,
  .btn-solid:active { transform: none; }
}

body {
  background-color: var(--bg-app);
  letter-spacing: -0.005em;
}

/* --- Tipografía: títulos amables, no gritones --- */
h1, h2, h3, .ritual-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
}
h1 { font-weight: 600; }
h2 { color: var(--text-main); }

/* --- Header: sin la línea negra estructural --- */
.m3-header,
[data-theme="dark"] .m3-header {
  border-bottom: 1px solid var(--glass-border);
  box-shadow: none;
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}

.m3-header-logo {
  text-transform: none;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.m3-header-logo::first-letter { color: var(--h-raspberry); }

.lang-btn { text-transform: none; font-weight: 600; }
.lang-btn.active { background: var(--color-primary); box-shadow: var(--shadow-neo-xs); }

/* --- Sidebar --- */
.m3-sidebar {
  border-right: 1px solid var(--glass-border);
  box-shadow: none;
  background: var(--bg-app);
}
.m3-sidebar-item { border-radius: 14px; }
.m3-sidebar-item.active {
  background: var(--bg-surface);
  box-shadow: var(--shadow-neo-sm);
}

/* --- Tarjetas --- */
.med-card,
.mission-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-neo-sm);
  background: var(--bg-surface);
}
.med-card:hover {
  box-shadow: var(--shadow-neo-md);
  border-color: var(--glass-border);
  transform: none;
}
.mission-card:hover {
  box-shadow: var(--shadow-neo-lg);
  transform: translateY(-2px);
}
.mission-card::before { display: none; }
.mission-card__icon {
  border-radius: 16px;
  background: color-mix(in srgb, var(--card-accent) 14%, transparent);
}
.mission-card__title { font-family: var(--font-display); font-weight: 600; }

/* --- Botones: tactos suaves, sin MAYÚSCULAS ni sombra desplazada --- */
.nav-btn {
  border: none;
  border-radius: var(--radius-btn);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--color-primary) 60%, transparent);
  font-weight: 600;
}
.nav-btn--ghost {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: none;
}

/* Botones secundarios que el JS pinta con fondo de superficie */

/* Etiquetas en mayúsculas → versalitas discretas */
.home-hero__badge {
  text-transform: none;
  letter-spacing: 0;
}

/* --- Inicio: encabezado con formas orgánicas (blobs) --- */
.home-hero {
  position: relative;
  padding: 36px 20px 28px;
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  background: var(--hero-gradient);
}
.home-hero::before,
.home-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.home-hero::before {
  width: 280px; height: 280px;
  right: -90px; top: -120px;
  background: var(--h-pink);
  opacity: 0.55;
}
.home-hero::after {
  width: 220px; height: 220px;
  left: -80px; bottom: -130px;
  background: var(--h-indigo);
  opacity: 0.16;
}

.home-hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 5vw, 34px);
}
.home-hero__badge {
  background: rgba(255, 255, 255, 0.7);
  color: var(--h-indigo);
  font-weight: 600;
}
[data-theme="dark"] .home-hero__badge { background: rgba(255, 255, 255, 0.08); color: var(--accent); }
.pulse-dot { background: var(--h-raspberry); }
.home-hero__search-container {
  background: var(--bg-surface);
  border: 1px solid transparent;
  box-shadow: var(--shadow-neo-sm);
}

.home-quick-actions button {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: none;
  font-weight: 500;
}

/* --- Chips de riesgo y pills --- */
.ritual-chip,
.risk-badge { border-radius: 999px; }

/* --- Navegación inferior (móvil) --- */
.m3-bottom-nav {
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -8px 24px rgba(46, 56, 112, 0.06);
  background: var(--glass-bg);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}

/* --- Modal de aviso --- */
.modal {
  border: none;
  box-shadow: var(--shadow-neo-xl);
}

/* --- Tablas --- */
.ritual-table-wrapper {
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--shadow-neo-sm);
}

/* Detalles/acordeones */
details {
  border-radius: 14px;
}

/* ==========================================================================
   Superficies flotantes: modales, paleta de búsqueda, hoja inferior, toasts.
   Misma gramática en ambos temas: velo teñido (no negro), esquinas amplias,
   una forma orgánica en la cabecera y sombras difusas.
   ========================================================================== */

/* Velo: índigo translúcido en lugar de negro al 85 % */
#disclaimer-backdrop {
  background: rgba(42, 45, 69, 0.45);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}
[data-theme="dark"] #disclaimer-backdrop { background: rgba(10, 11, 22, 0.6); }

.modal { border-radius: 28px; }

.modal-header {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 26px 28px 20px;
  background: var(--hero-gradient);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.modal-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--color-primary);
  transform: scale(1.05);
}
.modal-close-btn:active {
  transform: scale(0.95);
}
.modal-close-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.modal-header::before,
.modal-header::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.modal-header::before {
  width: 190px; height: 190px;
  right: -60px; top: -90px;
  background: var(--h-pink);
  opacity: 0.5;
}
.modal-header::after {
  width: 120px; height: 120px;
  right: 70px; top: -70px;
  background: var(--h-indigo);
  opacity: 0.14;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--text-main);
}
.modal-body { padding-top: 20px; }

.disclaimer-lead {
  border-left: none;
  border-radius: 16px;
  background: var(--accent-soft);
}

.modal-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--glass-border);
}

.donation-cta {
  border-radius: 999px;
}

/* Tarjeta de autor */

/* Paleta de búsqueda (Ctrl+K) */
.cmd-palette-overlay { background: rgba(42, 45, 69, 0.35); backdrop-filter: blur(6px); }
[data-theme="dark"] .cmd-palette-overlay { background: rgba(10, 11, 22, 0.55); }
.cmd-palette {
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-neo-xl);
}
.cmd-palette__header { border-bottom: 1px solid var(--glass-border); padding: 16px 18px; }
.cmd-palette__item {
  margin: 2px 8px;
  border-radius: 12px;
}

/* Hoja inferior "Más" (móvil) */
.bottom-sheet,
[data-theme="dark"] .bottom-sheet {
  border-radius: 28px 28px 0 0; /* lista negra: radio, no sombra desplazada */
  border-top: none;
  background: var(--bg-surface);
  box-shadow: 0 -18px 44px rgba(46, 56, 112, 0.14);
}
[data-theme="dark"] .bottom-sheet { box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.45); }
.bottom-sheet-handle { background: var(--text-muted); opacity: 0.35; }
.bottom-sheet-title { text-transform: none; letter-spacing: 0; font-family: var(--font-display); font-weight: 600; }
.sheet-nav-item,
[data-theme="dark"] .sheet-nav-item {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  border-radius: 18px;
  box-shadow: none;
}
.sheet-nav-item.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.pin-toggle,
[data-theme="dark"] .pin-toggle {
  background: var(--bg-surface);
  border: none;
  box-shadow: var(--shadow-neo-xs);
  width: 24px; height: 24px; padding: 5px;
}
.pin-toggle.active { background: var(--h-raspberry); color: #fff; box-shadow: none; }

/* Toasts */
.toast-ritual {
  border: none;
  border-radius: 16px;
  font-weight: 600;
  box-shadow: var(--shadow-neo-lg);
  max-width: min(92vw, 520px);
  text-align: center;
  line-height: 1.4;
}
.toast-ritual--warn {
  background: var(--h-warn-bg);
  color: var(--h-warn-text);
  border-left: 4px solid var(--h-amber);
}
.toast-ritual--error { color: var(--h-raspberry); }

/* ==========================================================================
   Tema oscuro: mismas formas, luz de noche (no un negativo del claro).
   Fondo índigo-tinta, blobs como halos tenues, superficies que flotan.
   ========================================================================== */
[data-theme="dark"] .home-hero,
[data-theme="dark"] .modal-header {
  background: linear-gradient(135deg, var(--hero-dark-a) 0%, var(--hero-dark-b) 100%);
}
[data-theme="dark"] .home-hero::before,
[data-theme="dark"] .modal-header::before {
  background: radial-gradient(circle at 35% 35%, var(--blob-dark-pink-a), var(--blob-dark-pink-b));
  opacity: 0.28;
}
[data-theme="dark"] .home-hero::after,
[data-theme="dark"] .modal-header::after {
  background: var(--blob-dark-indigo);
  opacity: 0.22;
}
[data-theme="dark"] .med-card,
[data-theme="dark"] .mission-card,
[data-theme="dark"] .modal,
[data-theme="dark"] .cmd-palette {
  background: var(--bg-surface);
  border-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .nav-btn { box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .m3-header-logo::first-letter { color: var(--h-pink); }
[data-theme="dark"] .disclaimer-lead { background: var(--accent-soft); }
[data-theme="dark"] .mission-card__icon { background: color-mix(in srgb, var(--card-accent) 22%, transparent); }

/* Caja de totales (CPZ / Maudsley) */

/* Botones sólidos en oscuro: fondo propio con contraste AA para texto blanco */
[data-theme="dark"] .nav-btn:not(.nav-btn--ghost),
[data-theme="dark"] .lang-btn.active {
  background: var(--h-btn);
  color: #fff;
}
[data-theme="dark"] .nav-btn:not(.nav-btn--ghost):hover {
  background: var(--h-btn-hover);
}

/* ==========================================================================
   Accesibilidad (auditoría axe, 2026-10-09)
   Texto atenuado = color --text-muted (AA) sin opacity encima: la opacidad lo
   dejaba en 2.7–4.3:1. El tono suave lo da el color, no la transparencia.
   ========================================================================== */
.m3-sidebar:not(.collapsed) .m3-sidebar-label,
.m3-sidebar-label {
  color: var(--text-muted);
  opacity: 1;
}
.hdr-version,
.hdr-crumb-home,
.afin-controls-footer,
.empty-state__hint,
.dose-card .dose-max {
  color: var(--text-muted);
  opacity: 1;
}
.dose-card .dose-max { font-weight: 500; }

/* La frambuesa base (--h-raspberry) no llega a AA sobre superficies oscuras. */
[data-theme="dark"] .m3-tab.active { color: var(--ritual-red); }

/* Foco visible y consistente en ambos temas (teclado), sin tocar el clic. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline-offset: 2px;
  border-radius: var(--radius-input);
}
.scroll-x:focus-visible { outline-offset: -2px; }

/* ==========================================================================
   Filas de calculadora (CPZ y Maudsley)
   Tres columnas con la misma gramática: etiqueta pequeña arriba, control
   abajo. El resultado se alinea a la derecha como una cifra, no como texto.
   ========================================================================== */
.calc-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(7.5rem, 0.8fr) 2.25rem;
  gap: 12px 14px;
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}
.calc-row__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.calc-row__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.calc-row select,
.calc-row input {
  width: 100%;
  min-height: 44px;
  font-size: 15px;
  font-weight: 500;
  padding: 0 12px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
}
.calc-row__field--out {
  align-items: flex-end;
  text-align: right;
  align-self: stretch;
  justify-content: flex-end;
}
.calc-row__value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 44px;
  min-height: 44px;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}
.calc-row__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -4px;
}
.calc-row__flag {
  font-size: 11px;
  font-weight: 600;
  color: var(--ritual-red);
  background: color-mix(in srgb, var(--ritual-red) 10%, transparent);
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: -2px;
}
.calc-row__action {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 44px;
}
.calc-row__del {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--ritual-red);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.calc-row__del:hover { background: var(--bg-hover); }

@media (max-width: 600px) {
  .calc-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 12px;
  }
  .calc-row__field--med { grid-column: 1 / -1; }
  .calc-row { position: relative; }
  .calc-row__action { display: none; }
  /* Quitar fila: esquina superior derecha, a la altura de la etiqueta. */
  .calc-row__action:has(button) {
    display: flex;
    position: absolute;
    top: 6px;
    right: 8px;
    height: auto;
  }
  .calc-row__del { width: 32px; height: 32px; }
}

/* Total de calculadora: franja de resumen alineada a la derecha. */
.calc-total {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 18px;
  border-radius: var(--radius-card);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
.calc-total__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.calc-total__value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}
.calc-total__value small {
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.calc-total__value .high-risk { color: var(--ritual-red); }
@media (max-width: 600px) {
  .calc-total { margin-left: 0; width: 100%; justify-content: space-between; }
}

/* Alertas (dosis alta, QTc): sin sombra desplazada; borde y fondo teñidos. */

/* Enlace "saltar al contenido": la sombra se asomaba en el borde superior
   aunque el enlace estuviera oculto. Sólo se ve (y proyecta sombra) con foco. */
.skip-link:not(:focus):not(:focus-visible) { box-shadow: none; }
[data-theme="dark"] .skip-link { background: var(--h-btn); }

/* Tema: íconos de trazo en lugar de emoji (regla 11 de AGENTS.md). */
#toggleDarkMode svg,
.sheet-theme-icon svg { width: 18px; height: 18px; display: block; }
.sheet-theme-icon { display: inline-flex; color: var(--accent); }

/* "Ctrl+K" no significa nada en pantallas táctiles. */
@media (hover: none), (max-width: 600px) {
  .home-hero__search-container kbd { display: none; }
}

/* ==========================================================================
   Tablas con scroll horizontal: el borde que aún esconde contenido se
   difumina (mask). Las clases las pone updateScrollHints() en app.js.
   Una máscara no depende del fondo de las celdas (la 1.ª columna es sticky
   y opaca, y tapaba cualquier sombra pintada detrás).
   ========================================================================== */
.scroll-x.has-more-right,
.ritual-table-wrapper.has-more-right {
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 36px);
  mask-image: linear-gradient(to left, transparent 0, #000 36px);
}
.scroll-x.has-more-left.has-more-right,
.ritual-table-wrapper.has-more-left.has-more-right {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent 100%);
}
.scroll-x.has-more-left:not(.has-more-right),
.ritual-table-wrapper.has-more-left:not(.has-more-right) { -webkit-mask-image: none; mask-image: none; }

/* ==========================================================================
   Revisión estética 2026-10-09 (segunda pasada)
   ========================================================================== */

/* Tablas de texto (Efectos, Beers): en móvil cada fila es una tarjeta.
   Tres columnas en 390 px partían palabras ("anticoliné rgico"). */
@media (max-width: 600px) {
  .stack-sm thead { display: none; }
  /* !important: las celdas traen anchos en línea desde app.js y en móvil deben apilarse. */
  .stack-sm, .stack-sm tbody, .stack-sm tr, .stack-sm td { display: block; width: 100% !important; }
  .stack-sm tr {
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--border-subtle);
  }
  .stack-sm tr:last-child { border-bottom: none; }
  .stack-sm td {
    padding: 0 !important;
    border: none !important;
    word-break: normal;
    overflow-wrap: anywhere;
  }
  .stack-sm td + td { margin-top: 10px; }
  .stack-sm td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
  }
}

/* Botones cortos que no deben partirse ("Cop / iar"). */
.nowrap { white-space: nowrap; flex-shrink: 0; }

/* Comparador: en móvil el título no compite con el botón Limpiar. */
@media (max-width: 600px) {
  .comp-head { flex-wrap: wrap; }
  /* !important: vence al tamaño en línea del título en pantallas estrechas. */
  .comp-head__title { font-size: 1.05rem !important; line-height: 1.3; }
  .comp-head > button { margin-left: auto; }
}

/* LAI ⇄ VO: la fila de paliperidona 6M es un aviso informativo, no un riesgo:
   índigo de trabajo en lugar de frambuesa. */
.laivo-table tr.highlight-row {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
}
.laivo-table tr.highlight-row td:first-child { color: var(--accent); }

/* Switching: sólo las alertas reales llevan frambuesa. */
#sw-safety-notes .sw-alert { color: var(--ritual-red); font-weight: 500; }

/* Cabecera de las tarjetas de alerta: sin línea negra de 2 px (regla de diseño). */

/* Afinidad: el nombre del fármaco queda fijo al desplazar el gráfico en horizontal. */
.afin-chart-scroll .afin-drug-label {
  position: sticky;
  left: 0;
  z-index: 60; /* por encima de los marcadores (3), resaltados (10) y hover (50) */
  background: var(--bg-surface);
  box-shadow: 6px 0 8px -6px rgba(46, 56, 112, 0.18);
}
/* Las filas deben medir lo que mide su contenido; si no, el nombre "sticky"
   no puede quedarse visible más allá del ancho de la pantalla. */
.afin-chart-scroll .afin-groups-wrap,
.afin-chart-scroll .afin-axis-header-row { width: max-content; min-width: 100%; }
.afin-chart-scroll .afin-group-header {
  position: sticky;
  left: 0;
  z-index: 61;
  width: max-content;
  max-width: min(100%, calc(100vw - 72px));
  background: var(--bg-surface);
  background-image: linear-gradient(color-mix(in srgb, var(--accent) 6%, transparent), color-mix(in srgb, var(--accent) 6%, transparent));
}

.afin-filter-dot {
  background: var(--chip-color, var(--accent));
}

.afin-d2-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--afin-d2) 18%, transparent);
  border: 1px solid var(--afin-d2);
  box-shadow: inset 0 0 0 1px var(--afin-d2);
  vertical-align: -1px;
}

.afin-sq {
  background: color-mix(in srgb, var(--sq-color, var(--afin-d2)) 28%, transparent);
  border: 1px solid var(--sq-color, var(--afin-d2));
  box-shadow: inset 0 0 0 1px var(--sq-color, var(--afin-d2)), var(--shadow-neo-xs);
}

.afin-sq--d2 {
  --sq-color: var(--afin-d2);
  background: color-mix(in srgb, var(--afin-d2) 14%, transparent);
  border: 1px solid var(--afin-d2);
  box-shadow: inset 0 0 0 1px var(--afin-d2), 0 0 10px color-mix(in srgb, var(--afin-d2) 30%, transparent);
}

.afin-sq-badge-lbl {
  color: var(--text-main);
  text-shadow: none;

}

/* ==========================================================================
   Guru (juego de preguntas)
   Misma gramática que el resto: superficie clara, esquinas amplias, cabecera
   con el degradado suave del inicio, índigo como color de acción. Sustituye
   al estilo arcade (fondo negro, neón y tipografía monoespaciada).
   ========================================================================== */
.guru {
  max-width: 640px;
  margin: 8px auto 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-neo-md);
  overflow: hidden;
  color: var(--text-main);
}
.guru__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 18px 22px;
  background: var(--hero-gradient);
}
.guru__title { margin: 0; font-size: 1.2rem; }
.guru__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.guru__meta strong { color: var(--text-main); font-variant-numeric: tabular-nums; }
.guru__body { padding: 22px; display: flex; flex-direction: column; }
.guru__body--start { gap: 16px; }
.guru__body--center { align-items: center; text-align: center; gap: 4px; }
.guru__lead { margin: 0; color: var(--text-muted); font-size: 15px; }
.guru__label { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.guru__big {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.guru__rank { margin: 0 0 8px; font-size: 1.1rem; font-weight: 600; }
.guru__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; }
.guru__foot {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  padding: 12px 22px 16px;
  border-top: 1px solid var(--border-subtle);
}

.guru-link {
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}
.guru-link:hover { color: var(--text-main); text-decoration: underline; }

.guru-btn {
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-subtle);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.guru-btn:hover { background: var(--bg-hover); }
.guru-btn:active { transform: translateY(1px); }
.guru-btn--primary { background: var(--h-indigo); border-color: transparent; color: #fff; }
.guru-btn--primary:hover { background: var(--h-indigo-deep); }
[data-theme="dark"] .guru-btn--primary { background: var(--h-btn); }
[data-theme="dark"] .guru-btn--primary:hover { background: var(--h-btn-hover); }
.guru-btn--block { width: 100%; }

.guru-panel {
  padding: 16px 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
}
.guru-panel h3 { margin: 0 0 6px; font-size: 14px; }
.guru-panel h3:not(:first-child) { margin-top: 16px; }
.guru-panel p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.guru-rules { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--text-muted); }
.guru-panel--record { width: 100%; max-width: 360px; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.guru-panel--record strong { color: var(--accent); }
.guru-panel--record label { font-size: 13px; color: var(--text-muted); }
.guru-initials { display: flex; gap: 10px; align-items: center; }
.guru-initials input {
  width: 96px;
  min-height: 44px;
  text-align: center;
  font: 600 1.3rem var(--font-display);
  text-transform: uppercase; /* lista negra: excepción, son iniciales (dato), no estilo */
  letter-spacing: 0.15em;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
}

.guru-lives { display: inline-flex; gap: 5px; }
.guru-life {
  width: 12px; height: 12px; border-radius: 50%;
  border: 0;
  box-shadow: inset 0 0 0 2px var(--ritual-red);
  background: transparent;
}
.guru-life.is-on { background: var(--ritual-red); }
.guru-streak { font-style: normal; font-weight: 600; color: var(--accent); }

.guru-question {
  padding: 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
}
.guru-question__text { margin: 6px 0 12px; font-size: 1.15rem; line-height: 1.45; font-weight: 500; }
.guru-question__text strong { color: var(--accent); font-weight: 600; }
.guru-hint summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.guru-hint p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-muted); }

.guru-options { display: flex; flex-direction: column; gap: 10px; }
.guru-option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 16px;
  text-align: left;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.guru-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.guru-option__key {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-container);
  color: var(--accent);
  font-size: 13px; font-weight: 700;
}

.guru-feedback { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--radius-card); border: 1px solid; }
.guru-feedback.is-correct { background: color-mix(in srgb, var(--h-mint) 12%, var(--bg-surface)); border-color: color-mix(in srgb, var(--h-mint) 45%, transparent); }
.guru-feedback.is-wrong { background: color-mix(in srgb, var(--ritual-red) 8%, var(--bg-surface)); border-color: color-mix(in srgb, var(--ritual-red) 40%, transparent); }
.guru-feedback__title { margin: 0; font: 600 1.35rem var(--font-display); }
.guru-feedback.is-correct .guru-feedback__title { color: color-mix(in srgb, var(--h-mint) 70%, var(--text-main)); }
.guru-feedback.is-wrong .guru-feedback__title { color: var(--ritual-red); }
.guru-feedback__text { font-size: 14px; line-height: 1.6; }

.guru-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.guru-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); }
.guru-table td { padding: 12px 8px; border-bottom: 1px solid var(--border-subtle); }
.guru-table tr.is-you td { background: var(--accent-soft); font-weight: 600; }

.guru-cert {
  padding: 28px 24px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}
.guru-cert__eyebrow { margin: 0 0 6px; font-size: 13px; color: var(--text-muted); }
.guru-cert__name { margin: 0 0 14px; font: 600 2rem var(--font-display); color: var(--accent); }
.guru-cert__msg { margin: 0 auto 14px; max-width: 42ch; font-size: 14px; line-height: 1.6; color: var(--text-muted); }
.guru-cert__score { margin: 0; }
.guru-cert__date { margin: 6px 0 0; font-size: 12px; color: var(--text-muted); }

/* ==========================================================================
   Menos plantilla, más producto
   - Rótulos en minúscula normal (sin MAYÚSCULAS forzadas ni tracking de "eyebrow").
   - Íconos de trazo y puntos CSS en lugar de emojis pegados.
   - Sin degradados de "botón de app" ni brillos de color.
   ========================================================================== */
.sec-ico { display: inline-flex; vertical-align: -4px; margin-right: 6px; color: var(--accent); }
.sec-ico svg { width: 19px; height: 19px; }
.empty-ico { display: flex; justify-content: center; margin-bottom: 8px; color: var(--h-mint); }
.empty-ico svg { width: 30px; height: 30px; }

.status-dot { display: inline-block; flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%; }
.status-dot--ok { background: var(--h-mint); }
.status-dot--warn { background: var(--h-amber); }
.status-dot--risk { background: var(--ritual-red); }

.chip-badge {
  position: absolute; top: -4px; right: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-surface);
}

/* Apoyar el proyecto: botón secundario cálido, sin degradado naranja. */
.donation-cta {
  background: var(--h-peach);
  color: var(--text-main);
  border: 1px solid var(--h-peach-deep);
  font-weight: 600;
  box-shadow: none;
}
.donation-cta:hover { background: var(--h-peach-deep); }
[data-theme="dark"] .donation-cta {
  background: color-mix(in srgb, var(--h-peach) 12%, var(--bg-surface));
  border-color: color-mix(in srgb, var(--h-peach) 30%, transparent);
}

/* Etiquetas pequeñas que eran "eyebrow": tracking normal. */
.m3-sidebar-label, .effect-tag, .home-section-label { letter-spacing: 0.01em; }

/* Deslizadores (Switching: semanas / caída D2). Sin esto heredan el estilo de caja de
   texto (padding, borde, sombra, `transition: all`) y en el móvil el pulgar queda
   diminuto y el gesto se lo come el scroll vertical. */
input[type="range"].h-range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;              /* área táctil mínima */
  padding: 0;
  margin: 4px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transition: none;
  touch-action: none;        /* el arrastre horizontal es del control, no del scroll */
  cursor: pointer;
}
input[type="range"].h-range:hover,
input[type="range"].h-range:focus { background: transparent; box-shadow: none; border: 0; }
input[type="range"].h-range {
  --h-range-fill: var(--h-indigo);
  --h-range-rest: var(--h-indigo-soft);
}
[data-theme="dark"] input[type="range"].h-range {
  --h-range-fill: var(--color-primary);
  --h-range-rest: var(--border-subtle);
}
/* --pct lo fija app.js (posición actual) para pintar la parte recorrida. */
input[type="range"].h-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--h-range-fill) var(--pct, 50%), var(--h-range-rest) var(--pct, 50%));
}
input[type="range"].h-range::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--h-range-rest);
}
input[type="range"].h-range::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--h-range-fill);
}
input[type="range"].h-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px;         /* centra el pulgar sobre la pista de 8 px */
  border-radius: 50%;
  background: var(--h-range-fill);
  border: 0;
  box-shadow: inset 0 0 0 3px var(--bg-surface), 0 2px 8px rgba(30, 34, 70, 0.25);
}
input[type="range"].h-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--h-range-fill);
  border: 0;
  box-shadow: inset 0 0 0 3px var(--bg-surface), 0 2px 8px rgba(30, 34, 70, 0.25);
}
input[type="range"].h-range:focus-visible::-webkit-slider-thumb {
  box-shadow: inset 0 0 0 3px var(--bg-surface), 0 0 0 4px var(--accent-container);
}

/* Comparador: los hijos de la cuadrícula no se ensanchan con la tabla (min-width 520 px);
   la tabla ya tiene su propio contenedor con scroll. Sin esto, en 390 px se cortaban el
   radar, la nota de agonistas y la tabla. */
.comp-grid > * {
  min-width: 0;
}

/* Switching: estilos que antes iban en línea en app.js (renderSwitching, leyenda de la
   curva y "Variables a considerar"). Mismos valores; se acotan a .switch-page para que
   ganen a las reglas genéricas igual que lo hacía el atributo style. */
.switch-page .sw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.switch-page .sw-header .ritual-title { margin: 0; }
.switch-page .sw-card { margin-bottom: 12px; }
.switch-page .sw-intro { font-size: 12px; margin-bottom: 10px; }
.switch-page .sw-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.switch-page .sw-row--first { margin-top: 16px; }
.switch-page .sw-field { flex: 1; min-width: 220px; }
.switch-page .sw-field--dose { min-width: 160px; }
.switch-page .sw-label { font-size: 12px; margin-bottom: 4px; }
.switch-page .sw-input { width: 100%; }
.switch-page .sw-meta { font-size: 11px; margin-top: 6px; }
.switch-page .sw-weeks-na { font-size: 12px; margin-top: 16px; }
.switch-page .sw-slider { display: block; margin-top: 16px; }
.switch-page .sw-hint { font-size: 11px; margin-top: 4px; }
.switch-page .sw-section-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 10px;
  color: var(--text-main);
  font-family: var(--font-display);
}
.switch-page .sw-section-title--tight { margin-bottom: 8px; }
.switch-page .sw-strategies { padding: 4px 0; }
.switch-page .sw-strategy-btn { padding: 8px 10px; font-size: 12px; position: relative; }
.switch-page .sw-details {
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px;
}
.switch-page .sw-details--context { margin-top: 12px; }
.switch-page .sw-details > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 12px;
  padding: 4px;
}
.switch-page .sw-details__body { padding: 8px 4px 4px; font-size: 12px; line-height: 1.5; }
.switch-page .sw-details__body p { margin: 0 0 8px; }
.switch-page .sw-details__body p.muted { margin: 0; }
.switch-page .sw-considerations {
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
}
.switch-page .sw-considerations__title { font-weight: 700; margin-bottom: 6px; }
.switch-page .sw-considerations__list { margin: 0; padding-left: 18px; }
.switch-page .sw-considerations__list li { margin-bottom: 4px; }
.switch-page .sw-profiles-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.switch-page .sw-profiles-head .sw-section-title { margin-bottom: 0; }
.switch-page .sw-compare-desc { font-size: 11px; margin-bottom: 12px; line-height: 1.4; }
.switch-page .sw-eq {
  margin-top: 20px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-app);
}
.switch-page .sw-eq__title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 4px;
  font-family: var(--font-display);
  color: var(--ritual-red);
}
.switch-page .sw-eq__text { font-size: 12px; line-height: 1.4; }
.switch-page .sw-chips { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.switch-page .sw-chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.switch-page .sw-notes { display: block; margin-top: 14px; }
.switch-page .sw-lai-banner {
  margin-bottom: 12px;
  border-left: 4px solid var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  padding: 16px;
  transform: translateY(0);
  animation: fadeIn 0.3s ease;
}
.switch-page .sw-lai-banner__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.switch-page .sw-lai-banner__text { flex: 1; min-width: 240px; }
.switch-page .sw-lai-banner__title {
  margin: 0 0 4px 0;
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: 12px;
}
.switch-page .sw-lai-banner__desc { margin: 0; font-size: 12px; line-height: 1.4; }
/* Sin color propio: en claro el texto --color-primary quedaba sobre el fondo sólido del
   botón (mismo tono, contraste 1:1, texto invisible). Usa el botón sólido del tema. */
.switch-page .sw-lai-banner__btn { font-size: 12px; white-space: nowrap; }
.switch-page .sw-plan { margin-top: 12px; }
.switch-page .sw-plan__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.switch-page .sw-plan__title { font-weight: 700; font-size: 16px; font-family: var(--font-display); }
.switch-page .sw-plan__actions { display: flex; gap: 10px; }
.switch-page .plan-section + .plan-section { margin-top: 20px; }
.switch-page .sw-plan-h { margin-bottom: 8px; font-size: 13px; }
.switch-page .sw-plan-h--recipe { color: var(--ritual-red); }
.switch-page .sw-plan-h--patient { color: var(--accent); }
.switch-page .sw-plan-h--safety { color: var(--text-main); }
.switch-page .sw-recipe {
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-app);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}
.switch-page .sw-patient {
  font-size: 13px;
  line-height: 1.5;
  font-style: italic;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  padding: 12px;
  border-radius: 8px;
}
.switch-page .sw-safety { font-size: 12px; line-height: 1.5; color: var(--text-main); }
.switch-page .sw-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 11px;
  margin-top: 6px;
}
.switch-page .sw-legend__item { display: inline-flex; align-items: center; gap: 5px; }
.switch-page .sw-legend__swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.switch-page .sw-legend__swatch--out { background: var(--ritual-red); }
.switch-page .sw-legend__swatch--in { background: var(--accent); }

/* ==========================================================================
   Comparador de equivalencias CPZ (antes, estilos en línea con colores sueltos)
   ========================================================================== */
.cpz-eq-row > td { padding: 8px 10px; }
.cpz-eq-row--self { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cpz-eq-empty { text-align: center; padding: 32px; color: var(--risk-high); font-size: 13px; }
.cpz-eq-drug { display: flex; align-items: center; gap: 6px; }
.cpz-eq-drug__name { font-weight: 600; font-size: 13px; }
.cpz-eq-row--self .cpz-eq-drug__name { font-weight: 700; }
.cpz-eq-drug__group { font-size: 10px; color: var(--text-muted); }
.cpz-eq-origin {
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.cpz-eq-dose { text-align: center; }
.cpz-eq-dose__value { font-weight: 600; font-size: 14px; color: var(--text-main); font-variant-numeric: tabular-nums; }
.cpz-eq-row--self .cpz-eq-dose__value { font-weight: 700; font-size: 16px; color: var(--accent); }
.cpz-eq-dose__unit,
.cpz-eq-dose__factor { font-size: 10px; font-weight: 400; color: var(--text-muted); }
.cpz-eq-risks { display: flex; flex-direction: column; gap: 3px; }
.cpz-eq-risk { display: flex; align-items: center; gap: 4px; }
.cpz-eq-risk__label { font-size: 10px; color: var(--text-muted); width: 26px; }
.cpz-eq-risk__track { width: 40px; height: 5px; border-radius: 3px; background: var(--border-subtle); overflow: hidden; }
.cpz-eq-risk__fill { height: 100%; border-radius: 3px; }
.cpz-eq-risk__fill--low { background: var(--h-mint); }
.cpz-eq-risk__fill--mod { background: var(--h-amber); }
.cpz-eq-risk__fill--high { background: var(--ritual-red); }
.cpz-eq-risk__value { font-size: 10px; color: var(--text-muted); min-width: 20px; }
.cpz-eq-mx { text-align: center; }
.cpz-eq-mx__yes {
  font-size: 10px;
  color: var(--risk-low);
  background: color-mix(in srgb, var(--h-mint) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--h-mint) 25%, transparent);
  padding: 2px 6px;
  border-radius: 999px;
}
.cpz-eq-mx__no { font-size: 10px; color: var(--text-muted); }
.cpz-eq-note { margin-top: 10px; font-size: 11px; color: var(--text-muted); line-height: 1.6; padding: 0 4px; }

/* Notas dentro de la ficha (emergencias, farmacogenómica) */
.note-box {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}
.note-box__title { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.note-box__body { font-size: 12px; color: var(--text-main); line-height: 1.4; }
.note-box--risk {
  border-left-color: var(--ritual-red);
  background: color-mix(in srgb, var(--ritual-red) 6%, var(--bg-surface));
}
.note-box--risk .note-box__title { color: var(--risk-high); }

/* Pestañas segmentadas (CPZ: calculadora / comparador) */
.seg-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--border-subtle); }
.seg-tab {
  padding: 10px 18px;
  margin-bottom: -1px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s ease, box-shadow 0.15s ease;
}
.seg-tab:hover { color: var(--text-main); }
.seg-tab.is-active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }

/* Switching: estrategia sugerida (anillo, no borde grueso) */
.switch-page .sw-strategy-btn--suggested { box-shadow: inset 0 0 0 2px var(--accent); }

/* STOPP: hallazgos con su nivel de riesgo */
.stopp-finding { padding: 14px; border-radius: 12px; margin-bottom: 10px; border-left: 4px solid var(--ritual-red); background: color-mix(in srgb, var(--ritual-red) 7%, var(--bg-surface)); }
.stopp-finding--mod { border-left-color: var(--h-amber); background: color-mix(in srgb, var(--h-amber) 9%, var(--bg-surface)); }
.stopp-finding__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.stopp-finding__code { font-size: 13px; font-weight: 700; font-family: var(--font-mono); color: var(--risk-high); }
.stopp-finding--mod .stopp-finding__code { color: var(--risk-mod); }
.stopp-finding__text { font-size: 13px; line-height: 1.5; }
.stopp-finding__action { margin-top: 8px; font-size: 12px; background: var(--bg-app); border: 1px dashed var(--border-subtle); border-radius: 8px; padding: 6px 8px; }

/* QTc: chip de resultado y bandas de la leyenda */
.qtc-chip { justify-content: center; font-weight: 700; }
.qtc-chip--mod {
  color: var(--risk-mod);
  background: color-mix(in srgb, var(--h-amber) 10%, transparent);
  border-color: color-mix(in srgb, var(--h-amber) 30%, transparent);
}
.qtc-chip--ok {
  color: var(--risk-low);
  background: color-mix(in srgb, var(--h-mint) 10%, transparent);
  border-color: color-mix(in srgb, var(--h-mint) 30%, transparent);
}
.qtc-band { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 1px solid var(--risk-low); background: color-mix(in srgb, var(--h-mint) 5%, transparent); }
.qtc-band--mod { border-color: var(--risk-mod); background: color-mix(in srgb, var(--h-amber) 5%, transparent); }
.qtc-band--high { border-color: var(--risk-high); background: color-mix(in srgb, var(--ritual-red) 5%, transparent); }

/* QTc: resultado del cálculo */
.qtc-result-box {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
}
.qtc-results-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qtc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.qtc-card {
  background: var(--bg-elevated);
  padding: 8px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border);
}
.qtc-card__title {
  font-size: 10px;
}
.qtc-card__val--primary {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
}
.qtc-card__val--secondary {
  font-weight: 700;
  font-size: 14px;
  opacity: 0.8;
}
.qtc-card__val {
  font-size: 13px;
}
.qtc-note {
  font-size: 10px;
  text-align: center;
  margin-top: 4px;
}

/* Chip base. Antes sólo tenía radio: "Alto riesgo" de QTc o "Metabólico: Alto" no se distinguían. */
.ritual-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-surface);
}
.ritual-chip.high-risk {
  color: var(--risk-high);
  background: color-mix(in srgb, var(--ritual-red) 10%, transparent);
  border-color: color-mix(in srgb, var(--ritual-red) 30%, transparent);
}
.qtc-chip { display: flex; padding: 8px 12px; font-size: 13px; }

/* Barra lateral: enlace de apoyo con el mismo botón cálido que el aviso inicial */
.sidebar-support { margin-top: 20px; padding: 0 10px; }
.sidebar-support__link { display: flex; width: 100%; justify-content: center; text-decoration: none; font-size: 14px; }
.sidebar-support__icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; }
.cpz-eq-form { display: grid; grid-template-columns: minmax(160px, 1.5fr) minmax(100px, 1fr) auto; gap: 12px; align-items: flex-end; }
@media (max-width: 600px) {
  .cpz-eq-form { grid-template-columns: 1fr 1fr; }
  .cpz-eq-form > :first-child { grid-column: 1 / -1; }
}
