/* ============================================================
   Bitácora — sistema de diseño
   Estética Apple/iOS: fondo agrupado, tarjetas, título grande,
   materiales translúcidos, springs. Modo noche = negro OLED real,
   sin animaciones, sin blancos puros.
   ============================================================ */

:root {
  --fondo: #F2F2F7;
  --tarjeta: #FFFFFF;
  --tarjeta2: #F7F7FA;
  --tinta: #1C1C1E;
  --tinta2: #66666B;
  --tinta3: #AEAEB2;
  --linea: rgba(60, 60, 67, 0.12);
  --azul: #007AFF;
  --azul-suave: rgba(0, 122, 255, 0.12);
  --fiebre: #FF375F;
  --fiebre-suave: rgba(255, 55, 95, 0.10);
  --verde: #34C759;
  --naranja: #FF9500;
  --rojo: #FF3B30;
  --morado: #AF52DE;
  --material: rgba(246, 246, 248, 0.78);
  --material-borde: rgba(255, 255, 255, 0.45);
  --sombra: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(28,28,30,0.06);
  --radio: 18px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --rapido: 160ms;
  --medio: 380ms;
  --ic-tam: 24px;
  --sa-abajo: env(safe-area-inset-bottom, 0px);
}

html[data-tema="noche"] {
  --fondo: #000000;
  --tarjeta: #161618;
  --tarjeta2: #1D1D20;
  --tinta: #E6E1DA;
  --tinta2: #97918A;
  --tinta3: #5A5650;
  --linea: rgba(235, 225, 210, 0.10);
  --azul: #4E8FD1;
  --azul-suave: rgba(78, 143, 209, 0.16);
  --fiebre: #C7566E;
  --fiebre-suave: rgba(199, 86, 110, 0.14);
  --verde: #4E9E63;
  --naranja: #C08145;
  --rojo: #C05248;
  --morado: #8E6AAE;
  --material: rgba(12, 12, 13, 0.86);
  --material-borde: rgba(235, 225, 210, 0.06);
  --sombra: none;
  --ic-tam: 26px;
}

/* Modo noche: cero animaciones ni transiciones (§H1 del PRD) */
html[data-tema="noche"] *,
html[data-tema="noche"] *::before,
html[data-tema="noche"] *::after {
  animation: none !important;
  transition: none !important;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--fondo);
  color: var(--tinta);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hc-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.hc-ic {
  width: var(--ic-tam); height: var(--ic-tam);
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}
.hc-ic .rel { fill: currentColor; stroke: none; }

/* ── Barra superior (material translúcido) ─────────────────── */

.hc-barra {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 6px 0;
  background: var(--material);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid transparent;
  transition: border-color var(--rapido) ease;
}
.hc-barra.con-borde { border-bottom-color: var(--linea); }
.hc-barra-lado { display: flex; align-items: center; min-width: 0; }
.hc-barra-der { justify-content: flex-end; }
.hc-barra-titulo {
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--rapido) ease, transform var(--rapido) ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw;
}
.hc-barra.con-borde .hc-barra-titulo { opacity: 1; transform: none; }

.hc-volver {
  display: inline-flex; align-items: center; gap: 0;
  color: var(--azul); text-decoration: none;
  font-size: 17px; padding: 8px 10px 8px 2px; border-radius: 12px;
  min-height: 44px;
}
.hc-volver:active { opacity: 0.5; }
.hc-volver span { margin-left: -2px; }

.hc-accion-barra {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; background: none;
  color: var(--azul); border-radius: 50%; cursor: pointer;
}
.hc-accion-barra:active { transform: scale(0.92); opacity: 0.6; }

/* ── Layout ────────────────────────────────────────────────── */

.hc-main {
  max-width: 680px; margin: 0 auto;
  padding: 8px 16px calc(32px + var(--sa-abajo));
}
.hc-main.con-tabs { padding-bottom: calc(96px + var(--sa-abajo)); }

.hc-titulo-grande-zona { padding: 10px 4px 14px; }
.hc-titulo-grande {
  font-size: 34px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.1;
}
html[data-tema="noche"] .hc-titulo-grande { font-size: 36px; }
.hc-subtitulo { color: var(--tinta2); margin-top: 4px; font-size: 16px; }

.hc-seccion {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--tinta2);
  margin: 26px 4px 8px;
}
.hc-seccion:first-child { margin-top: 8px; }

/* ── Tarjetas y listas agrupadas ───────────────────────────── */

.hc-tarjeta {
  background: var(--tarjeta); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 16px;
}
html[data-tema="noche"] .hc-tarjeta { border: 0.5px solid var(--linea); }

.hc-lista {
  background: var(--tarjeta); border-radius: var(--radio);
  box-shadow: var(--sombra); overflow: hidden;
}
html[data-tema="noche"] .hc-lista { border: 0.5px solid var(--linea); }

.hc-fila {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; min-height: 48px;
  color: inherit; text-decoration: none;
  border: 0; background: none; width: 100%; text-align: left;
  font: inherit; cursor: pointer; position: relative;
}
.hc-fila + .hc-fila::before,
.hc-fila-sep::before {
  content: ""; position: absolute; top: 0; left: 52px; right: 0;
  border-top: 0.5px solid var(--linea);
}
.hc-fila.sin-icono + .hc-fila.sin-icono::before { left: 16px; }
.hc-fila:active { background: var(--tarjeta2); }
.hc-fila-texto { flex: 1; min-width: 0; }
.hc-fila-titulo { font-weight: 500; letter-spacing: -0.01em; }
.hc-fila-det { font-size: 14px; color: var(--tinta2); margin-top: 1px; }
.hc-fila .hc-chevron { color: var(--tinta3); }
.hc-fila-valor { color: var(--tinta2); font-size: 16px; }

.hc-fila-ic {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; flex: none;
}
.hc-fila-ic .hc-ic { width: 19px; height: 19px; }

/* ── Botones ───────────────────────────────────────────────── */

.hc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px;
  border-radius: 14px; border: 0;
  background: var(--azul); color: #fff;
  font: inherit; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer; text-decoration: none; width: 100%;
  transition: transform 100ms ease-out, opacity 100ms ease-out;
}
.hc-btn:active { transform: scale(0.97); opacity: 0.85; }
.hc-btn.sec { background: var(--azul-suave); color: var(--azul); }
.hc-btn.gris { background: var(--tarjeta2); color: var(--tinta); }
.hc-btn.peligro { background: none; color: var(--rojo); }
.hc-btn.chico { min-height: 40px; padding: 8px 14px; font-size: 15px; width: auto; border-radius: 11px; }
.hc-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* Los dos botones grandes del corazón del producto */
.hc-acciones-grandes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.hc-btn-grande {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px 12px 18px; border-radius: 22px; border: 0;
  font: inherit; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 120ms ease-out;
  box-shadow: var(--sombra);
}
.hc-btn-grande:active { transform: scale(0.96); }
.hc-btn-grande .hc-ic { width: 30px; height: 30px; }
.hc-btn-grande.sintoma { background: var(--fiebre); color: #fff; }
.hc-btn-grande.remedio { background: var(--azul); color: #fff; }
html[data-tema="noche"] .hc-btn-grande { padding: 26px 12px 22px; }

/* ── Grilla de miembros (inicio) ───────────────────────────── */

.hc-ninos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.hc-nino {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--tarjeta); border-radius: 22px; padding: 20px 12px 16px;
  text-decoration: none; color: inherit; position: relative;
  border: 0; font: inherit; cursor: pointer;
  box-shadow: var(--sombra);
  transition: transform 140ms ease-out;
}
html[data-tema="noche"] .hc-nino { border: 0.5px solid var(--linea); }
.hc-nino:active { transform: scale(0.96); }
.hc-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; position: relative; flex: none;
}
.hc-avatar.chico { width: 34px; height: 34px; font-size: 19px; }
.hc-avatar.medio { width: 56px; height: 56px; font-size: 30px; }
.hc-nino-nombre { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; text-align: center; }
.hc-nino-edad { font-size: 14px; color: var(--tinta2); margin-top: -6px; }
.hc-punto {
  position: absolute; top: 4px; right: 4px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--fiebre); border: 2.5px solid var(--tarjeta);
}
.hc-badge-dosis {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  background: var(--naranja); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: 0;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  border: 2px solid var(--tarjeta);
}
.hc-badge-dosis.ya { background: var(--rojo); }

/* Entrada escalonada de tarjetas */
@media (prefers-reduced-motion: no-preference) {
  .hc-entra { animation: hc-sube var(--medio) var(--spring) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
  @keyframes hc-sube {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: none; }
  }
}

/* ── Formularios ───────────────────────────────────────────── */

.hc-campo { display: block; margin-bottom: 14px; }
.hc-campo-etq { display: block; font-size: 14px; font-weight: 500; color: var(--tinta2); margin: 0 2px 6px; }
.hc-input, .hc-select, .hc-textarea {
  width: 100%; min-height: 50px; padding: 13px 14px;
  border-radius: 13px; border: 1px solid transparent;
  background: var(--tarjeta2); color: var(--tinta);
  font: inherit; font-size: 17px;
  appearance: none; -webkit-appearance: none;
}
.hc-sheet .hc-input, .hc-sheet .hc-select, .hc-sheet .hc-textarea { background: var(--fondo); }
html[data-tema="noche"] .hc-input, html[data-tema="noche"] .hc-select, html[data-tema="noche"] .hc-textarea { background: var(--tarjeta2); border-color: var(--linea); }
.hc-input:focus-visible, .hc-select:focus-visible, .hc-textarea:focus-visible,
.hc-btn:focus-visible, .hc-fila:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2.5px solid var(--azul); outline-offset: 1px;
}
.hc-textarea { min-height: 84px; resize: vertical; }
.hc-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.hc-error {
  background: var(--fiebre-suave); color: var(--rojo);
  border-radius: 12px; padding: 11px 14px; font-size: 15px; margin-bottom: 14px;
  display: none;
}
.hc-error.visible { display: block; }
.hc-nota-legal { font-size: 13px; color: var(--tinta3); line-height: 1.5; margin-top: 10px; }
.hc-nota-legal a { color: var(--tinta2); }

/* Segmentado (día/noche, breve/detallado, sexo) */
.hc-seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--tarjeta2); border-radius: 12px; padding: 3px; gap: 2px;
}
html[data-tema="noche"] .hc-seg { background: var(--tarjeta2); }
.hc-seg button {
  border: 0; background: none; font: inherit; font-size: 15px; font-weight: 500;
  color: var(--tinta2); padding: 8px 6px; border-radius: 10px; cursor: pointer;
  min-height: 40px;
  transition: background var(--rapido) ease, color var(--rapido) ease;
}
.hc-seg button.activo { background: var(--tarjeta); color: var(--tinta); box-shadow: 0 1px 4px rgba(0,0,0,0.10); font-weight: 600; }
html[data-tema="noche"] .hc-seg button.activo { background: #2A2A2E; box-shadow: none; }

/* Interruptor */
.hc-switch { position: relative; width: 51px; height: 31px; flex: none; }
.hc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.hc-switch-pista {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(120,120,128,0.32);
  transition: background 200ms ease;
}
.hc-switch-bola {
  position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 260ms var(--spring);
}
.hc-switch input:checked ~ .hc-switch-pista { background: var(--verde); }
.hc-switch input:checked ~ .hc-switch-pista .hc-switch-bola { transform: translateX(20px); }

/* Chips (hora, dosis previas) */
.hc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hc-chip {
  border: 0; background: var(--tarjeta2); color: var(--tinta);
  font: inherit; font-size: 15px; font-weight: 500;
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  min-height: 40px;
  transition: transform 100ms ease-out, background var(--rapido) ease, color var(--rapido) ease;
}
.hc-sheet .hc-chip { background: var(--fondo); }
html[data-tema="noche"] .hc-chip, html[data-tema="noche"] .hc-sheet .hc-chip { background: var(--tarjeta2); border: 0.5px solid var(--linea); }
.hc-chip:active { transform: scale(0.94); }
.hc-chip.activo { background: var(--azul); color: #fff; }
html[data-tema="noche"] .hc-chip.activo { background: var(--azul); color: #0E0E10; }

/* ── Sheet inferior (material, arrastrable) ────────────────── */

.hc-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 300ms ease;
}
html[data-tema="noche"] .hc-scrim { background: rgba(0,0,0,0.6); }
.hc-scrim.visible { opacity: 1; pointer-events: auto; }

.hc-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  max-width: 680px; margin: 0 auto;
  background: var(--tarjeta); border-radius: 24px 24px 0 0;
  padding: 8px 20px calc(20px + var(--sa-abajo));
  transform: translateY(105%);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.16);
  max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  touch-action: pan-y;
  will-change: transform;
}
html[data-tema="noche"] .hc-sheet { border: 0.5px solid var(--linea); border-bottom: 0; }
.hc-sheet.abierta { transition: transform 420ms var(--spring); transform: translateY(0); }
.hc-sheet.cerrando { transition: transform 320ms var(--spring); transform: translateY(105%); }
.hc-sheet.arrastrando { transition: none; }
.hc-agarre {
  width: 40px; height: 5px; border-radius: 3px;
  background: var(--tinta3); opacity: 0.5;
  margin: 4px auto 14px; cursor: grab;
}
.hc-sheet-titulo { font-size: 21px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 14px; }
.hc-sheet-x {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: var(--tarjeta2); color: var(--tinta2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.hc-sheet-x .hc-ic { width: 16px; height: 16px; stroke-width: 2.4; }

@media (prefers-reduced-motion: reduce) {
  .hc-sheet, .hc-sheet.abierta, .hc-sheet.cerrando { transition: opacity 200ms ease; transform: none; opacity: 0; pointer-events: none; }
  .hc-sheet.abierta { opacity: 1; pointer-events: auto; }
  .hc-entra { animation: none; }
}

/* ── Grilla de síntomas ────────────────────────────────────── */

.hc-grilla-sintomas { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.hc-sintoma-btn {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 6px 12px; border-radius: 16px; border: 1.5px solid transparent;
  background: var(--fondo); font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--tinta); cursor: pointer;
  transition: transform 100ms ease-out, border-color var(--rapido) ease, background var(--rapido) ease;
}
html[data-tema="noche"] .hc-sintoma-btn { background: var(--tarjeta2); border-color: var(--linea); }
.hc-sintoma-btn:active { transform: scale(0.93); }
.hc-sintoma-btn.activo { border-color: var(--fiebre); background: var(--fiebre-suave); color: var(--fiebre); }
.hc-sintoma-btn .hc-ic { width: 27px; height: 27px; }

/* ── Regla de temperatura ──────────────────────────────────── */

.hc-temp-zona { text-align: center; padding: 6px 0 2px; }
.hc-temp-valor {
  font-size: 56px; font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
  color: var(--fiebre);
}
.hc-temp-valor small { font-size: 26px; font-weight: 600; color: var(--tinta3); letter-spacing: 0; }
.hc-regla {
  position: relative; height: 74px; margin: 10px -20px 0;
  overflow: hidden; cursor: grab; touch-action: pan-x none;
  user-select: none; -webkit-user-select: none;
}
.hc-regla:active { cursor: grabbing; }
.hc-regla-cinta { position: absolute; top: 12px; left: 50%; height: 44px; will-change: transform; }
.hc-regla-marca { position: absolute; top: 0; width: 2px; border-radius: 1px; background: var(--tinta3); height: 14px; }
.hc-regla-marca.mayor { height: 26px; background: var(--tinta2); }
.hc-regla-num { position: absolute; top: 30px; transform: translateX(-50%); font-size: 13px; font-weight: 600; color: var(--tinta2); font-variant-numeric: tabular-nums; }
.hc-regla-aguja {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 3px; height: 56px; border-radius: 2px; background: var(--fiebre);
}
.hc-regla::before, .hc-regla::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 60px; z-index: 2; pointer-events: none;
}
.hc-regla::before { left: 0; background: linear-gradient(to right, var(--tarjeta), transparent); }
.hc-regla::after { right: 0; background: linear-gradient(to left, var(--tarjeta), transparent); }

/* ── Autocompletado de remedios ────────────────────────────── */

.hc-auto { position: relative; }
.hc-auto-lista {
  margin-top: 8px; border-radius: 14px; overflow: hidden;
  background: var(--fondo); display: none;
}
html[data-tema="noche"] .hc-auto-lista { background: var(--tarjeta2); border: 0.5px solid var(--linea); }
.hc-auto-lista.visible { display: block; }
.hc-auto-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 14px; border: 0; background: none; font: inherit;
  color: var(--tinta); cursor: pointer; text-align: left; min-height: 48px;
}
.hc-auto-item:active { background: var(--linea); }
.hc-auto-item + .hc-auto-item { border-top: 0.5px solid var(--linea); }
.hc-auto-marcas { font-size: 13px; color: var(--tinta2); }

/* ── Línea de tiempo ───────────────────────────────────────── */

.hc-dia-etq {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--tinta2); margin: 20px 4px 8px;
}
.hc-evento {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--tarjeta); border-radius: 16px; padding: 12px 14px;
  margin-bottom: 8px; box-shadow: var(--sombra);
  border: 0; width: 100%; font: inherit; text-align: left; color: inherit; cursor: pointer;
}
html[data-tema="noche"] .hc-evento { border: 0.5px solid var(--linea); }
.hc-evento:active { background: var(--tarjeta2); }
.hc-evento-ic {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.hc-evento-ic .hc-ic { width: 22px; height: 22px; }
.hc-evento-cuerpo { flex: 1; min-width: 0; }
.hc-evento-titulo { font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hc-evento-temp { color: var(--fiebre); font-variant-numeric: tabular-nums; }
.hc-evento-det { font-size: 14px; color: var(--tinta2); margin-top: 1px; }
.hc-evento-hora { font-size: 14px; color: var(--tinta3); font-variant-numeric: tabular-nums; flex: none; padding-top: 2px; }

/* ── Tratamientos ──────────────────────────────────────────── */

.hc-trat { padding: 14px 16px; }
.hc-trat-cab { display: flex; align-items: center; gap: 11px; }
.hc-trat-info { flex: 1; min-width: 0; }
.hc-trat-nombre { font-weight: 600; letter-spacing: -0.01em; }
.hc-trat-det { font-size: 14px; color: var(--tinta2); }
.hc-trat-prox { font-size: 14px; margin-top: 2px; color: var(--naranja); font-weight: 500; }
.hc-trat-prox.ya { color: var(--rojo); }
.hc-dosis-puntos { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.hc-dosis-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--linea); }
.hc-dosis-punto.entregada { background: var(--verde); }
.hc-dosis-punto.omitida { background: var(--naranja); }
.hc-dosis-punto.proxima { background: transparent; border: 1.5px solid var(--azul); }
.hc-btn-entregado {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: 12px; padding: 10px 16px; min-height: 44px;
  background: var(--verde); color: #fff; font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform 100ms ease-out;
}
.hc-btn-entregado:active { transform: scale(0.95); }
.hc-btn-entregado .hc-ic { width: 18px; height: 18px; stroke-width: 2.2; }

/* ── KPI ───────────────────────────────────────────────────── */

.hc-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hc-kpi { background: var(--tarjeta); border-radius: 16px; padding: 14px 16px; box-shadow: var(--sombra); }
html[data-tema="noche"] .hc-kpi { border: 0.5px solid var(--linea); }
.hc-kpi-num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hc-kpi-etq { font-size: 13.5px; color: var(--tinta2); margin-top: 2px; line-height: 1.3; }
.hc-kpi-var { font-size: 13px; font-weight: 600; margin-top: 5px; }
.hc-kpi-var.sube { color: var(--rojo); }
.hc-kpi-var.baja { color: var(--verde); }
.hc-kpi-var.igual { color: var(--tinta3); }

/* ── Vista anual (heatmap) ─────────────────────────────────── */

.hc-anual-scroll { overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.hc-anual-svg, .hc-graf.hc-anual-svg { display: block; width: auto; max-width: none; height: auto; }

/* ── Gráficos SVG ──────────────────────────────────────────── */

.hc-graf { width: 100%; height: auto; display: block; }
.hc-graf text { font-family: inherit; fill: var(--tinta2); font-size: 11px; }
.hc-graf .eje { stroke: var(--linea); stroke-width: 1; }
.hc-graf .banda { fill: var(--fiebre); opacity: 0.06; }
.hc-graf .banda-linea { stroke: var(--fiebre); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.45; }
.hc-graf .curva { stroke: var(--fiebre); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hc-graf .area { fill: var(--fiebre); opacity: 0.08; }
.hc-graf .punto { fill: var(--tarjeta); stroke: var(--fiebre); stroke-width: 2; }
.hc-graf .oms-banda { fill: var(--azul); opacity: 0.08; }
.hc-graf .oms-linea { stroke: var(--azul); stroke-width: 1.2; fill: none; opacity: 0.5; }
.hc-graf .oms-mediana { stroke-dasharray: 4 4; }
.hc-graf .curva-crec { stroke: var(--verde); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.hc-graf .punto-crec { fill: var(--verde); }
.hc-leyenda { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: var(--tinta2); align-items: center; }
.hc-leyenda-item { display: inline-flex; align-items: center; gap: 6px; }
.hc-leyenda-cubo { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.hc-leyenda-letra {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: 0;
}
.hc-leyenda-ic { width: 17px; height: 17px; color: var(--tinta2); }
.hc-graf .marca-letra { fill: #fff; font-size: 11.5px; font-weight: 700; }

.hc-graf .sw-ic { stroke: var(--tinta); fill: none; stroke-width: 1.7; }
.hc-graf .sw-chip { fill: var(--linea); }
.hc-graf .hm-0 { fill: var(--linea); }
.hc-graf .hm-1 { fill: #FFD60A; }
.hc-graf .hm-2 { fill: #FF9F0A; }
.hc-graf .hm-3 { fill: var(--fiebre); }
.hc-graf .hm-ab { fill: var(--azul); }
html[data-tema="noche"] .hc-graf .hm-1 { fill: #8A7A1E; }
html[data-tema="noche"] .hc-graf .hm-2 { fill: #8A5F24; }

/* ── Toast ─────────────────────────────────────────────────── */

#hc-toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--sa-abajo)); z-index: 90;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--tinta); color: var(--fondo);
  padding: 11px 20px; border-radius: 999px;
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: transform 340ms var(--spring), opacity 250ms ease;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
html[data-tema="noche"] #hc-toast { background: #2A2A2E; color: var(--tinta); border: 0.5px solid var(--linea); }
#hc-toast.visible { transform: translate(-50%, 0); opacity: 1; }
.hc-main.con-tabs ~ #hc-toast, body:has(.hc-tabs) #hc-toast { bottom: calc(96px + var(--sa-abajo)); }

/* ── Tab bar ───────────────────────────────────────────────── */

.hc-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around;
  max-width: 680px; margin: 0 auto;
  padding: 6px 8px calc(6px + var(--sa-abajo));
  background: var(--material);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid var(--linea);
}
.hc-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--tinta3); text-decoration: none; font-size: 11px; font-weight: 500;
  padding: 4px 18px; border-radius: 12px; min-width: 64px;
}
.hc-tab:active { opacity: 0.6; }
.hc-tab.activa { color: var(--azul); }
.hc-tab .hc-ic { width: 26px; height: 26px; }

/* ── Login / portada ───────────────────────────────────────── */

.hc-hero { text-align: center; padding: 44px 0 26px; }
.hc-hero-logo {
  width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 24px;
  background: linear-gradient(150deg, #FF5F82, #FF375F 55%, #E22E55);
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 10px 30px rgba(255, 55, 95, 0.30);
}
html[data-tema="noche"] .hc-hero-logo { box-shadow: none; background: linear-gradient(150deg, #A95062, #8E3A4C); }
.hc-hero-logo .hc-ic { width: 46px; height: 46px; stroke-width: 1.6; }
.hc-hero h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.022em; }
.hc-hero p { color: var(--tinta2); margin-top: 6px; font-size: 16.5px; max-width: 42ch; margin-inline: auto; }

/* ── Ruido blanco ──────────────────────────────────────────── */

.hc-sonidos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hc-sonido {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 24px 10px 18px; border-radius: 20px; border: 1.5px solid transparent;
  background: var(--tarjeta); font: inherit; font-weight: 600; font-size: 15px;
  color: var(--tinta); cursor: pointer; box-shadow: var(--sombra);
  transition: transform 120ms ease-out, border-color var(--rapido) ease;
}
html[data-tema="noche"] .hc-sonido { border-color: var(--linea); }
.hc-sonido:active { transform: scale(0.95); }
.hc-sonido.activo { border-color: var(--azul); color: var(--azul); }
.hc-sonido .hc-ic { width: 30px; height: 30px; }
.hc-ruido-controles { margin-top: 18px; }
.hc-rango { width: 100%; accent-color: var(--azul); min-height: 44px; }

/* ── Impresión (exportar PDF) ──────────────────────────────── */

.hc-print-solo { display: none; }
@media print {
  /* que los colores del gráfico y la leyenda sobrevivan al PDF */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; color: #111; font-size: 12px; }
  .hc-graf text { fill: #444; }
  .hc-leyenda-ic { color: #444; }
  .hc-barra, .hc-tabs, .hc-no-print, #hc-toast { display: none !important; }
  .hc-print-solo { display: block; }
  .hc-main { max-width: none; padding: 0; }
  .hc-tarjeta, .hc-lista, .hc-kpi { box-shadow: none; border: 0.5px solid #ddd; break-inside: avoid; }
  .hc-graf text { fill: #555; }
  a { color: inherit; text-decoration: none; }
  @page { size: letter; margin: 14mm; }
}

/* ── Tablas (exportación) ──────────────────────────────────── */

.hc-tabla-scroll { overflow-x: auto; }
.hc-tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.hc-tabla th { text-align: left; font-weight: 600; color: var(--tinta2); padding: 8px 10px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
.hc-tabla td { padding: 8px 10px; border-bottom: 0.5px solid var(--linea); vertical-align: top; }

/* Fila de consentimiento (checkbox + texto) */
#consent-fila { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--tinta2); line-height: 1.45; }
#consent-fila input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--azul); flex: none; }
#consent-fila a { color: var(--azul); }

/* Texto largo (privacidad) */
#texto-privacidad h3 { font-size: 18px; letter-spacing: -0.01em; margin: 20px 0 6px; }
#texto-privacidad h3:first-child { margin-top: 0; }
#texto-privacidad p { margin-bottom: 10px; font-size: 15.5px; line-height: 1.55; }
#texto-privacidad ul { padding-left: 20px; margin-bottom: 10px; font-size: 15.5px; line-height: 1.55; }
#texto-privacidad li { margin-bottom: 4px; }

/* ── Utilidades ────────────────────────────────────────────── */

.hc-oculto { display: none !important; }
.hc-centrado { text-align: center; }
.hc-fila-botones { display: flex; gap: 10px; margin-top: 16px; }
.hc-fila-botones .hc-btn { flex: 1; }
.hc-sep-v { height: 8px; }
.hc-texto2 { color: var(--tinta2); }
.hc-texto3 { color: var(--tinta3); font-size: 14px; }
.hc-mt { margin-top: 16px; }
.hc-vacio { text-align: center; color: var(--tinta2); padding: 36px 20px; font-size: 15.5px; }
.hc-vacio .hc-ic { width: 44px; height: 44px; color: var(--tinta3); margin-bottom: 10px; }

@media (min-width: 700px) {
  .hc-ninos { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .hc-kpis { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-transparency: reduce) {
  .hc-barra, .hc-tabs { background: var(--fondo); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
