/* ==========================================================================
   Haia v2 — capa de la estructura nueva (DISENO_V2.md), ENCIMA de los tokens
   de ../css/style.css (no los redefine: misma marca, mismo claro/oscuro).
   Lo nuevo: barra inferior de 3 botones, hojas que suben desde abajo, la
   portada Hoy (Ahora / Hoy / Pronto) y tarjetas grandes para «Más».
   Pensado para el pulgar y el cansancio: letra grande, toques de ≥48 px,
   nada que escribir en la portada.
   ========================================================================== */

body.v2 { padding-bottom: calc(96px + env(safe-area-inset-bottom)); background: var(--color-bg); }
[hidden] { display: none !important; }

/* Vínculos dentro de una frase (pedido del usuario, 2026-11-04): sin subrayado,
   en negrita y azul de marca, para que se vean tocables sin parecer de otra web.
   Especificidad baja a propósito: cualquier estilo de componente que venga
   después (botones, grillas, listas) manda sobre esto. */
:where(body.v2) a:not([class]) { color: var(--color-primary); font-weight: 700; text-decoration: none; }
:where(body.v2) a:not([class]):hover, :where(body.v2) a:not([class]):focus-visible { text-decoration: underline; }

/* --- Barra superior: solo la marca y «Más» --- */
.v2-top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.v2-top-inner {
  max-width: var(--ancho-lectura); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 16px;
}
.v2-marca {
  font-family: "Haia Wordmark", ui-rounded, sans-serif; font-weight: 600; font-size: 1.45rem;
  display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--color-text);
  min-height: 44px;
}
.v2-marca img { width: 30px; height: 30px; }
.v2-top-acciones { display: flex; align-items: center; gap: 8px; }
.v2-btn-mas {
  min-height: 44px; padding: 0 14px; border-radius: 22px;
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); font: inherit; font-size: 1rem; cursor: pointer;
  display: inline-flex; align-items: center; text-decoration: none;
}

.v2-main { max-width: var(--ancho-lectura); margin: 0 auto; padding: 8px 16px 24px; }
.v2-main h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); margin: 10px 0 4px; }

/* --- Barra inferior --- */
.v2-barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.v2-barra-inner {
  max-width: 560px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.v2-barra a, .v2-barra button {
  background: none; border: 0; min-height: 58px; font: inherit; font-size: 0.875rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--color-text-soft); text-decoration: none; cursor: pointer;
}
.v2-barra .ico { font-size: 1.4rem; line-height: 1; }
.v2-barra [aria-current="page"] { color: var(--color-text); font-weight: 800; }
/* «Hoy» es el centro de la app: es el que destaca (óvalo dorado detrás del ícono
   cuando es la pantalla actual) sin salirse de la barra. «＋ Anotar» y los demás
   miden lo mismo (pedido del usuario tras probar la vista previa, 2026-11-05).
   Solo la pestaña actual va en negrita (plan de simplificación, 2026-11-11). */
.v2-barra .v2-hoy .ico { width: 52px; height: 32px; border-radius: 16px; display: grid; place-items: center; font-size: 1.4rem; }
.v2-barra .v2-hoy[aria-current="page"] .ico { background: var(--color-oro); box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.v2-barra .v2-hoy[aria-current="page"] { font-weight: 800; }


/* --- Hojas que suben desde abajo (componente único) --- */
.v2-velo { position: fixed; inset: 0; z-index: 70; background: rgba(20,33,47,.5); }
.v2-hoja {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
  max-width: 600px; margin: 0 auto;
  background: var(--color-bg); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  transform: translateY(105%); transition: transform .22s ease;
  box-shadow: 0 -8px 30px rgba(0,0,0,.2);
}
.v2-hoja.abierta { transform: none; }
.v2-hoja .asa { width: 44px; height: 5px; border-radius: 3px; background: var(--color-border); margin: 0 auto 12px; }
.v2-hoja h3 { font-size: 1.35rem; margin: 2px 0 6px; }
.v2-hoja .sub { color: var(--color-text-soft); font-size: 0.95rem; margin: 0 0 14px; }
/* Cerrar = píldora chica centrada (pedido del usuario, 2026-11-04): antes era
   texto gris suelto y no se veía como botón. */
.v2-hoja-cerrar {
  display: block; margin: 14px auto 0; min-height: 44px; padding: 0 22px; border-radius: 999px;
  background: var(--color-surface, #fff); border: 1.5px solid var(--color-border); color: var(--color-text);
  font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.v2-mas-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.v2-mas-cab h3 { margin: 0; }
.v2-mas-cab .v2-hoja-cerrar { margin: 0; flex: none; }
/* «Cerrar sesión» en Más: discreto y lejos de «Cerrar» (arriba a la derecha). */
.v2-pie-sesion { margin-top: 26px; text-align: right; }
.v2-pie-sesion .v2-link-chico {
  background: none; border: 0; font: inherit; font-size: 0.875rem; color: var(--color-text-soft);
  text-decoration: underline; padding: 10px 4px; min-height: 44px; cursor: pointer;
}
.v2-hoja-volver {
  background: none; border: 0; padding: 6px 0; min-height: 44px; font: inherit; font-size: 0.98rem;
  color: var(--color-accent-dark); cursor: pointer;
}
.v2-banner-dia {
  background: var(--color-oro-soft); border-radius: 12px; padding: 8px 12px;
  font-size: 0.92rem; margin: 0 0 12px;
}

/* Botones grandes (Anotar, Más, opciones de una pantalla) */
.v2-grande { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.v2-grande > button, .v2-grande > a {
  min-height: 96px; border-radius: 18px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 1.02rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; text-align: center; text-decoration: none; cursor: pointer;
}
.v2-grande .ico { font-size: 1.9rem; line-height: 1; }
.v2-grande .mini { font-size: 0.875rem; color: var(--color-text-soft); }
.v2-grande.una-col { grid-template-columns: 1fr; }
.v2-grande.una-col > button, .v2-grande.una-col > a {
  min-height: 62px; flex-direction: row; justify-content: flex-start; padding: 0 16px; gap: 12px; text-align: left;
}
.v2-grande > [aria-pressed="true"] { border: 2px solid var(--color-accent); background: var(--color-oro-soft); }
.v2-grande > button:disabled { opacity: .5; }

/* --- Portada Hoy --- */
.v2-saludo h1 { margin: 8px 0 2px; }
.v2-saludo p { margin: 0 0 6px; color: var(--color-text-soft); }
.v2-sec {
  font-size: 0.875rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  color: var(--color-text-soft); margin: 22px 0 8px;
}
.v2-tarjeta {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 18px; padding: 14px 16px; box-shadow: var(--sombra);
}
.v2-tarjeta + .v2-tarjeta { margin-top: 10px; }
.v2-ahora { border: 2px solid var(--color-accent); }
.v2-fila { display: flex; align-items: center; gap: 12px; }
.v2-fila .que { flex: 1; min-width: 0; }
.v2-fila .que b { display: block; font-size: 1.15rem; }
.v2-fila .que span, .v2-fila .que small { color: var(--color-text-soft); font-size: 0.95rem; }
.v2-btn {
  min-height: 52px; min-width: 96px; padding: 0 18px; border: 0; border-radius: 16px;
  background: var(--color-accent); color: #3A2412; font: inherit; font-weight: 800; font-size: 1.05rem;
  cursor: pointer; white-space: nowrap;
}
/* Un <a class="v2-btn"> se veía subrayado y con el texto arriba: se centra igual que un botón. */
a.v2-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.v2-btn.ancho { width: 100%; margin-top: 14px; }
.v2-btn:disabled { opacity: .55; }
.v2-btn-sec {
  min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--color-accent);
  background: transparent; color: var(--color-text); font: inherit; font-weight: 700; font-size: 0.92rem;
  white-space: nowrap; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
.v2-btn-sec:disabled { opacity: .55; }
.v2-btn-sec.ancho { width: 100%; margin-top: 10px; min-height: 50px; justify-content: center; }
/* Acciones secundarias sueltas = píldora chica del ancho de su texto, como
   «Cerrar» y el pie de Más (pedido del usuario, 2026-11-04: antes eran palabras
   subrayadas). `.en-texto` = la que va dentro de una frase: negrita azul. */
.v2-link {
  display: inline-flex; align-items: center; justify-content: center; width: fit-content;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--color-border); background: var(--color-surface, #fff);
  color: var(--color-text); font: inherit; font-size: 0.92rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.v2-link:hover { border-color: var(--color-accent); }
/* Las mismas dos formas para los botones-texto que traían su propio subrayado
   en el <style> de cada página (Editar, Quitar, Historial de dosis…). `body.v2`
   gana por especificidad sin tocar esos archivos. */
body.v2 .nec-bloque-pie button, body.v2 .nec-fila .nec-acciones button,
body.v2 .form-necesidad .volver, body.v2 .necesidad-card .btn-desactivar,
body.v2 .cuidador-card .btn-editar, body.v2 .compromiso-fila .co-acciones button,
body.v2 .horario-dia .quitar {
  display: inline-flex; align-items: center; justify-content: center; width: fit-content;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--color-border); background: var(--color-surface, #fff);
  color: var(--color-text); font-weight: 600; text-decoration: none; cursor: pointer;
}
body.v2 .cambiar-seccion { color: var(--color-primary); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.v2-link.en-texto {
  display: inline-block; min-height: 44px; padding: 12px 4px; margin: -12px 0; line-height: 20px;
  border: 0; border-radius: 0; background: none;
  color: var(--color-primary); font-size: inherit; font-weight: 700;
}
.v2-hecho { color: var(--color-ok); font-weight: 700; }
.v2-siguiente {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border);
  color: var(--color-text-soft); font-size: 0.98rem;
}
.v2-chip-seguir {
  display: inline-flex; align-items: center; margin-top: 10px; min-height: 44px; padding: 8px 14px;
  border-radius: 22px; border: 1px solid var(--color-oro); background: var(--color-oro-soft);
  color: var(--color-text); font: inherit; font-size: 0.98rem; cursor: pointer;
}
.v2-confirma { font-size: 0.88rem; color: var(--color-text-soft); margin-top: 4px; }

.v2-estado { display: inline-block; font-size: 0.875rem; font-weight: 700; padding: 3px 10px; border-radius: 10px; margin-bottom: 6px; }
.v2-estado.ok { background: var(--color-salvia-soft); color: var(--color-ok); }
.v2-estado.ojo { background: var(--color-oro-soft); color: #8A6414; }
.v2-estado.algo { background: var(--color-accent-soft); color: var(--color-accent-dark); }
[data-theme="dark"] .v2-estado.ojo { color: var(--color-oro); }
.v2-cita { margin: 4px 0 0; font-size: 1.05rem; }
.v2-autor { font-size: 0.88rem; color: var(--color-text-soft); }

.v2-lista { padding: 2px 16px; }
.v2-item {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.v2-item:last-child { border-bottom: 0; }
.v2-item .cuando { width: 54px; flex: none; font-weight: 700; font-size: 0.95rem; color: var(--color-text-soft); }
.v2-item .que { flex: 1; min-width: 0; font-size: 1.02rem; }
.v2-item .que small { display: block; color: var(--color-text-soft); font-size: 0.875rem; }
.v2-item.falta .que { color: var(--color-alerta); }
.v2-item.hecho .que { color: var(--color-text-soft); text-decoration: line-through; }
/* R2: la fila se toca para ver la otra acción (pedírselo a alguien, preguntarle a X). */
.v2-fila-toque { cursor: pointer; }
.v2-fila-toque .que small::after, .v2-fila-toque .que:not(:has(small))::after { content: "\00a0›"; font-weight: 700; }
/* Hoy en teléfono (etapa 3): el texto usa todo el ancho y el único botón va debajo,
   en vez de apretar el texto en 5-6 líneas al lado del botón. */
@media (max-width: 520px) {
  .hoy-lista .v2-item { flex-wrap: wrap; gap: 6px 10px; min-height: 52px; }
  .hoy-lista .v2-item .cuando { width: 46px; }
  .hoy-lista .v2-item > .que { flex: 1 1 140px; }
  .hoy-lista .v2-item > .v2-btn-sec, .hoy-lista .v2-item > .v2-btn { margin-left: auto; }
}
/* Plan «Hoy con aire» (2026-11-12, §3.1): fecha, reloj y estado con aire debajo;
   «Qué sigue» es lo único con borde terracota; tres baldosas anchas que abren
   hojas; «Hay que comprar» en dorado (sin rojo ni ⚠️). */
.v2-saludo { margin-bottom: 24px; }
.v2-saludo #hoy-fecha { margin: 0; }
.hoy-reloj {
  display: block; min-height: 44px; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: clamp(1.9rem, 5.5vw, 2.7rem); font-weight: 400; line-height: 1.15;
  color: var(--color-text-soft); font-variant-numeric: tabular-nums; text-align: left;
}
.v2-saludo .hoy-estado { font-size: 0.95rem; margin: 2px 0 0; }
.hoy-hora { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.hoy-hora .hoy-en, .v2-siguiente .hoy-en { font-weight: 400; color: var(--color-text-soft); }
.v2-ahora .v2-fila .que small { display: block; }
.v2-ahora .v2-fila { flex-wrap: wrap; }
.v2-ahora .v2-fila .que { flex: 1 1 180px; }
.v2-ahora .v2-fila > .v2-btn, .v2-ahora .v2-fila > .v2-btn-sec { margin-left: auto; }
/* Las tres baldosas de Hoy: cuadradas, en una fila. */
.v2-baldosas.hoy-baldosas { margin-top: 14px; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.v2-baldosa.hoy-baldosa {
  aspect-ratio: 1 / 1; min-height: 0; padding: 10px; gap: 6px; justify-content: space-between;
}
.hoy-baldosa .hoy-cab { display: flex; align-items: flex-start; justify-content: space-between; }
.hoy-baldosa .ico { font-size: 1.6rem; }
.hoy-baldosa b { font-size: 0.95rem; line-height: 1.2; overflow-wrap: anywhere; }
.v2-baldosa .num { font-size: 1.35rem; font-weight: 400; color: var(--color-text-soft); line-height: 1.1; }
.v2-baldosa.vacia { opacity: .62; }
.hoy-prox .v2-item .cuando:empty { display: none; }
.hoy-dia { font-weight: 700; font-size: 0.95rem; color: var(--color-text-soft); margin: 16px 0 0; }
.hoy-comprar {
  margin-top: 16px; padding: 12px 16px 4px; border-radius: 18px;
  background: var(--color-oro-soft); border: 2px solid var(--color-oro);
}
.hoy-comprar-tit { font-weight: 800; font-size: 1.02rem; }
.hoy-comprar .v2-item { border-bottom-color: var(--color-oro); min-height: 52px; padding: 4px 0; }
.hoy-comprar .v2-ver-todo { padding: 6px 0 4px; }
.hoy-avisos { margin-top: 4px; }
.hoy-avisos .v2-aviso-linea { margin-top: 8px; padding: 10px 14px; }
#hoy-contenido .v2-terminar { margin-top: 18px; }
.v2-entrega-cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.v2-entrega-cab .v2-link { border: 0; background: none; padding: 0 4px; min-height: 44px; color: var(--color-accent-dark); }
.v2-link.chico { min-height: 44px; padding: 0 12px; font-size: 0.875rem; white-space: nowrap; }
.v2-vacio { color: var(--color-text-soft); padding: 12px 0; margin: 0; }
.v2-ver-todo {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 0 6px;
  min-height: 44px; color: var(--color-accent-dark); font: inherit; font-size: 1rem; cursor: pointer; text-decoration: none;
}
.v2-resumen { display: grid; gap: 6px; font-size: 1.02rem; }
.v2-resumen .v2-estado, .v2-resumen .v2-btn-sec { justify-self: start; }
.v2-terminar {
  display: block; width: 100%; margin: 26px 0 0; min-height: 54px; border-radius: 16px;
  border: 1.5px dashed var(--color-salvia); background: transparent; color: var(--color-text);
  font: inherit; font-size: 1.02rem; cursor: pointer;
}
.v2-selector-persona { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }

/* Aviso urgente (arriba de todo mientras esté activo) */
.v2-urgente {
  /* Fijo, no el token: en oscuro --color-alerta es claro y el texto blanco no se leía. */
  background: #B4523A; color: #FFF8F4; border-radius: 18px; padding: 14px 16px; margin: 10px 0 4px;
}
.v2-urgente .tipo { font-weight: 800; font-size: 1.15rem; }
.v2-urgente .detalle { margin-top: 4px; }
.v2-urgente .visto { font-size: 0.9rem; opacity: .92; margin-top: 6px; }
.v2-urgente .acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.v2-urgente button {
  min-height: 46px; padding: 0 16px; border-radius: 14px; border: 0; background: #FFF8F4; color: #5A2414;
  font: inherit; font-weight: 800; cursor: pointer;
}
.v2-urgente a { color: #FFF8F4; font-weight: 700; }

/* Avisos de una línea en Hoy (D13: «¿sigue tomándola?»). No se apagan solos. */
.v2-aviso-linea {
  display: block; width: 100%; margin: 12px 0 0; min-height: 48px; padding: 12px 14px; box-sizing: border-box;
  border: 2px dashed var(--color-oro); border-radius: 14px; background: var(--color-surface, transparent);
  color: var(--color-text); font: inherit; font-size: 1rem; text-align: left; text-decoration: none; cursor: pointer;
}
p.v2-aviso-linea { cursor: default; }
.v2-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

/* --- Formularios dentro de las hojas --- */
.v2-campo { margin: 12px 0; }
.v2-campo label { display: block; font-weight: 700; margin-bottom: 6px; }
.v2-hoja input[type="text"], .v2-hoja input[type="date"], .v2-hoja input[type="time"],
.v2-hoja input[type="number"], .v2-hoja select, .v2-hoja textarea,
.v2-main .v2-input {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 16px; padding: 10px 12px;
}
.v2-hoja textarea { min-height: 90px; }
.v2-opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.v2-opciones button {
  min-height: 48px; padding: 0 16px; border-radius: 24px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 1rem; cursor: pointer;
}
.v2-opciones button[aria-pressed="true"] { border: 2px solid var(--color-accent); background: var(--color-oro-soft); font-weight: 700; }
.v2-contador { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.v2-contador .n { min-width: 44px; text-align: center; font-weight: 800; font-size: 1.2rem; }
.v2-contador button {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); font-size: 1.3rem; cursor: pointer;
}
.v2-progreso { height: 6px; border-radius: 3px; background: var(--color-border); margin: 0 0 14px; overflow: hidden; }
.v2-progreso > span { display: block; height: 100%; background: var(--color-salvia); }
.v2-pasos-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }

/* --- Toast con deshacer --- */
.v2-toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 90;
  max-width: 560px; margin: 0 auto;
  background: var(--color-text); color: var(--color-bg); border-radius: 14px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.v2-toast.visible { opacity: 1; pointer-events: auto; }
.v2-toast button { background: none; border: 0; color: var(--color-arena); font-weight: 700; min-height: 44px; font: inherit; cursor: pointer; }

/* --- Pantallas de «Más» --- */
.v2-cabeza { margin: 6px 0 14px; }
.v2-cabeza p { color: var(--color-text-soft); margin: 0; }
.v2-pie-mas { margin-top: 18px; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Pie de «Más» en píldoras chicas, del ancho de su texto (pedido del usuario, 2026-11-04). */
.v2-pie-mas .v2-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--color-border); background: var(--color-surface, #fff);
  color: var(--color-text); text-decoration: none; font-size: 0.9rem; font-weight: 600;
}

/* Páginas copiadas de la v1: su topbar se reemplaza por la de la v2, y su
   contenedor deja espacio a la barra inferior. */
body.v2 .container { padding-left: 16px; padding-right: 16px; }

@media print {
  .v2-top, .v2-barra, .v2-toast, .v2-hoja, .v2-velo, .no-imprimir { display: none !important; }
  body.v2 { padding-bottom: 0; }
}

/* La tarjeta del día (copiada de Turnos de la v1) sube desde abajo en el
   teléfono, como el resto de las hojas de la v2. */
@media (max-width: 640px) {
  body.v2 .tarjeta-flotante {
    top: auto; bottom: 0; left: 0; transform: none; width: 100%;
    max-height: 88vh; border-radius: 24px 24px 0 0; z-index: 75;
  }
  body.v2 .tarjeta-fondo { z-index: 74; }
}

/* Barra del asistente (pantallas abiertas desde Ajustes paso a paso). */
.v2-asistente-bar {
  position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 61;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 12px;
  background: var(--color-oro-soft); border-top: 1px solid var(--color-border);
}
.v2-asistente-bar span { flex: 1; font-size: 0.9rem; color: var(--color-text-soft); }
.v2-asistente-bar .v2-btn { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
body.v2.con-asistente { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }

/* --- «Haia te acompaña» (guia.js, DISENO_GUIA.md) ---
   El punto dorado del isotipo + una burbuja. Va sobre las hojas (z 71-75) y
   bajo el toast (90). Con «reducir movimiento», quieto. */
.v2-guia {
  position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 85;
  max-width: 520px; margin: 0 auto; display: flex; gap: 12px; align-items: flex-start;
  background: var(--color-surface); color: var(--color-text);
  border: 2px solid var(--color-oro); border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(20,33,47,.25);
  animation: v2-guia-entra .35s ease-out;
}
body.con-hoja .v2-guia { display: none; }
body.con-asistente .v2-guia { bottom: calc(150px + env(safe-area-inset-bottom)); }
/* Anclada junto al botón que señala (guia.js › colocar). La flecha apunta a él. */
.v2-guia.anclada, body.con-asistente .v2-guia.anclada, body.en-recorrido .v2-guia.anclada {
  bottom: auto; right: auto; margin: 0;
}
.v2-guia.anclada.lista { transition: top .2s ease, left .2s ease; }
.v2-guia.anclada::before {
  content: ""; position: absolute; left: var(--flecha-x, 50%); width: 16px; height: 16px;
  margin-left: -8px; background: var(--color-surface); transform: rotate(45deg);
}
.v2-guia.bajo::before { top: -10px; border-left: 2px solid var(--color-oro); border-top: 2px solid var(--color-oro); }
.v2-guia.sobre::before { bottom: -10px; border-right: 2px solid var(--color-oro); border-bottom: 2px solid var(--color-oro); }
.v2-guia-punto {
  flex: 0 0 auto; width: 36px; height: 36px; margin-top: 2px; border-radius: 50%;
  background: #F9F3E9 url("../assets/isotipo-96.png") center / 80% no-repeat;
  box-shadow: 0 0 0 2px var(--color-oro), 0 0 0 7px var(--color-oro-soft);
  animation: v2-guia-respira 2.6s ease-in-out infinite;
}
.v2-guia-cuerpo { flex: 1; min-width: 0; }
.v2-guia-cuerpo p { margin: 0 0 10px; font-size: 1.08rem; line-height: 1.4; }
.v2-guia-acciones { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.v2-guia-n { margin-right: auto; font-size: 0.875rem; color: var(--color-text-soft); }
.v2-guia-apagar { display: block; margin-top: 8px; font-size: .9rem; color: var(--color-text-soft); }
.v2-guia-foco {
  position: relative; z-index: 2;
  outline: 3px solid var(--color-oro) !important; outline-offset: 4px; border-radius: 12px;
  animation: v2-guia-senala 1.6s ease-in-out infinite;
}
@keyframes v2-guia-entra { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes v2-guia-respira { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes v2-guia-senala { 0%, 100% { outline-offset: 4px; } 50% { outline-offset: 8px; } }
@media (prefers-reduced-motion: reduce) {
  .v2-guia, .v2-guia-punto, .v2-guia-foco { animation: none; }
}
.v2-guia-pasos .v2-progreso { margin: 0 0 10px; }
.v2-guia-todos { margin-top: 12px; }
.v2-guia-todos summary { cursor: pointer; color: var(--color-accent-dark); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.v2-guia-todos ul { list-style: none; margin: 4px 0 8px; padding: 0; }
.v2-guia-todos li { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.v2-guia-todos li > span { width: 1.4em; text-align: center; color: var(--color-text-soft); }
.v2-guia-todos li.hecho a { color: var(--color-text-soft); text-decoration: line-through; }
.v2-guia-como > a { justify-content: flex-start; text-align: left; }

/* --- Bienvenida (primera entrada) y recorrido encadenado --- */
.v2-bienvenida {
  position: fixed; inset: 0; z-index: 95; overflow-y: auto;
  background: var(--color-bg); display: flex; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
body.con-bienvenida { overflow: hidden; }
.v2-bienvenida-panel { width: 100%; max-width: 480px; margin: auto 0; animation: v2-guia-entra .35s ease-out; }
.v2-bienvenida h1 { margin: 14px 0 10px; font-size: 1.8rem; }
.v2-bienvenida .aj-grande { font-size: 1.15rem; line-height: 1.5; }
.v2-bienvenida .v2-btn.ancho, .v2-bienvenida .v2-btn-sec.ancho { width: 100%; min-height: 54px; font-size: 1.1rem; justify-content: center; }
.v2-bienvenida .v2-link { display: block; margin-left: auto; margin-right: auto; }
.v2-guia-punto.grande { display: block; width: 72px; height: 72px; margin: 8px 0 0 6px; box-shadow: 0 0 0 3px var(--color-oro), 0 0 0 14px var(--color-oro-soft); }
.v2-bv-puntos { display: flex; gap: 6px; margin-bottom: 18px; }
.v2-bv-puntos span { width: 8px; height: 8px; border-radius: 50%; background: var(--color-border); }
.v2-bv-puntos span.on { background: var(--color-oro); width: 22px; border-radius: 4px; }
.v2-input-grande {
  width: 100%; box-sizing: border-box; min-height: 54px; font-size: 1.2rem; padding: 10px 14px;
  border: 2px solid var(--color-border); border-radius: 14px; background: var(--color-surface); color: var(--color-text);
}
.v2-input-grande:focus { outline: none; border-color: var(--color-oro); }
.v2-bienvenida .v2-grande > button { min-height: 56px; font-size: 1rem; }
.v2-recorrido-bar {
  position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 61;
  padding: 8px 14px 6px; background: var(--color-oro-soft); border-top: 1px solid var(--color-border);
}
.v2-recorrido-info { font-size: .95rem; }
.v2-recorrido-info span { color: var(--color-text-soft); }
.v2-recorrido-acc { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; }
.v2-recorrido-acc .v2-btn { min-height: 44px; }
.v2-recorrido-fin { font-size: 0.875rem; color: var(--color-text-soft); min-height: 44px; margin-top: 2px; }
body.v2.en-recorrido { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }
body.en-recorrido .v2-guia { bottom: calc(200px + env(safe-area-inset-bottom)); }
body.en-recorrido .v2-pasos-nav { display: none; }
.v2-bienvenida h1:focus { outline: none; }
body.en-recorrido #aj .v2-cabeza, body.en-recorrido #aj .v2-progreso { display: none; }

/* --- Alta de la v2 (entrar/, unirse/): una pregunta por pantalla --- */
body.v2-alta .v2-main { min-height: 100vh; display: flex; justify-content: center; padding-top: max(24px, env(safe-area-inset-top)); }
.v2-alta-panel { width: 100%; max-width: 480px; margin: auto 0; padding-bottom: 40px; animation: v2-guia-entra .3s ease-out; }
.v2-alta-panel h1 { margin: 14px 0 10px; font-size: 1.8rem; }
.v2-alta-panel h1:focus { outline: none; }
.v2-alta-panel .aj-grande { font-size: 1.15rem; line-height: 1.5; }
.v2-alta-panel .v2-btn.ancho, .v2-alta-panel .v2-btn-sec.ancho { width: 100%; min-height: 54px; font-size: 1.1rem; }
.v2-alta-panel .v2-link { display: block; margin: 12px auto 0; min-height: 44px; }
.v2-alta-panel .v2-grande > button { min-height: 56px; font-size: 1rem; }
.v2-alta-modo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0 8px; }
.v2-alta-modo button {
  min-height: 52px; border-radius: 14px; border: 2px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); font-weight: 700; font-size: 1rem;
}
.v2-alta-modo button[aria-pressed="true"] { border-color: var(--color-accent); background: var(--color-oro-soft); }
.v2-alta-label { display: block; font-weight: 700; margin: 14px 0 6px; }
.v2-alta-error { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--color-accent-soft); }
.v2-alta-error p { margin: 0 0 8px; }
.v2-alta-o { text-align: center; color: var(--color-text-soft); margin: 14px 0; }
.v2-alta-que p { margin: 0 0 10px; font-size: 1.08rem; line-height: 1.45; padding: 12px 14px; border-radius: 14px; background: var(--color-surface); border: 1px solid var(--color-border); }
.v2-alta-h2 { font-size: 1.2rem; margin: 18px 0 10px; }
.v2-alta-wa { display: flex; justify-content: center; align-items: center; text-decoration: none; }

.v2-version { text-align: center; font-size: 0.875rem; color: var(--color-text-soft); margin: 10px 0 0; }

/* --- Organizar: el hub de baldosas (etapa 1 del rediseño de claridad) --- */
.v2-baldosas { display: grid; grid-template-columns: 1fr; gap: 10px; }
.v2-baldosas.dos { grid-template-columns: 1fr 1fr; }
.v2-baldosa {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 18px;
  padding: 14px; min-height: 108px; display: flex; flex-direction: column; gap: 3px;
  color: var(--color-text); text-decoration: none; min-width: 0;
}
.v2-baldosa:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 2px; }
.v2-baldosa .ico { font-size: 1.7rem; line-height: 1.1; }
.v2-baldosa b { font-size: 1.05rem; }
.v2-baldosa .est { font-size: 0.875rem; color: var(--color-text-soft); overflow-wrap: anywhere; }
.v2-baldosa .est.fal { color: var(--color-accent-dark, var(--color-alerta)); font-weight: 800; }
.v2-baldosa .puntos { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.v2-baldosa .pto { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.v2-baldosa.grande { flex-direction: row; align-items: center; gap: 12px; min-height: 0; }
.v2-baldosa.grande .que { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* Plan de simplificación (2026-11-11): en Organizar, lo que espera a alguien es UNA
   línea que abre una hoja, y «Preparar el cuidado» otra línea al pie. */
button.v2-baldosa { font: inherit; text-align: left; width: 100%; cursor: pointer; }
.v2-baldosa.org-sin { border: 2px solid var(--color-accent); margin-top: 10px; }
.v2-baldosa.org-sin[hidden] { display: none; }
.v2-baldosa.org-preparar { margin-top: 18px; }
.v2-baldosa.prio { border: 2px solid var(--color-accent); }
.v2-baldosa .flecha { color: var(--color-text-soft); font-size: 1.4rem; }
@media (max-width: 340px) { .v2-baldosas.dos { grid-template-columns: 1fr; } }

/* --- Mi cuenta --- */
.mc-yo { display: flex; gap: 14px; align-items: center; }
.mc-yo b { font-size: 1.2rem; }
.mc-yo > div { min-width: 0; overflow-wrap: anywhere; }
.mc-av { width: 56px; height: 56px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.4rem; }
.mc-colores { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.mc-color {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 1.1rem;
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 3px var(--color-border);
}
.mc-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 5px var(--color-text); }
.mc-color:disabled { opacity: .25; cursor: not-allowed; }
.mc-color:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; }
.mc-falta { color: var(--color-accent-dark, var(--color-alerta)) !important; font-weight: 700; }
.mc-sw { position: relative; width: 56px; height: 44px; background: none; flex: none; opacity: .6; }
.mc-sw::before { content: ""; position: absolute; left: 5px; top: 8px; width: 46px; height: 28px; border-radius: 14px; background: var(--color-border); }
.mc-sw::after { content: ""; position: absolute; left: 8px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.mc-sw.on::before { background: var(--color-salvia); }
.mc-sw.on::after { left: auto; right: 8px; }
button.mc-sw { border: 0; padding: 0; opacity: 1; cursor: pointer; }
button.mc-sw::before { transition: background .15s; }
button.mc-sw::after { transition: left .15s, right .15s; }
button.mc-sw:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 2px; }
.mc-horas { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: .9rem; }
.mc-horas input { font-size: 16px; padding: 4px 6px; margin-left: 4px; }

/* 2026-11-09 (caminata): en la presentación el punto es el logo y va quieto;
   solo «respira» el chico del globo, cuando hace de asistente. */
.v2-guia-punto.grande { animation: none; }
/* Con el teclado abierto, las barras de abajo no suben con él: se esconden
   y dejan el espacio al campo que se está llenando (base.js › con-teclado). */
body.con-teclado .v2-barra, body.con-teclado .v2-recorrido-bar,
body.con-teclado .v2-asistente-bar, body.con-teclado .v2-guia { display: none !important; }

/* Formularios en tarjetas (V2.pasos, remedios, quiénes cuidan). */
.fm-progreso { margin: 0 0 6px; font-size: .95rem; color: var(--color-text-soft); }
.fm-titulo { margin: 0 0 14px; font-size: 1.3rem; }
.fm-nav { display: flex; gap: 10px; margin-top: 18px; }
.fm-nav > button { flex: 1; min-height: 52px; font-size: 1.05rem; justify-content: center; }
.fm-nav > button[hidden], .fm-nav-sec > button[hidden] { display: none; }
.fm-nav-sec { display: flex; justify-content: space-between; margin-top: 10px; }
form.v2-tarjeta, .form-insumo { scroll-margin-top: 84px; }

/* Emergencia (revisión empática 2026-11-10). El único lugar con fondo de alerta
   lleno: lo urgente se distingue porque no se usa para nada más. Texto blanco
   sobre #B4523A = 4,9:1 (AA). */
.an-emergencia {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 60px; margin: 0 0 12px; border: 0; border-radius: 18px;
  background: var(--color-alerta); color: #fff; font: inherit; font-weight: 800; font-size: 1.1rem; cursor: pointer;
}
.an-emergencia span { font-size: 1.5rem; line-height: 1; }
.an-emergencia.chica { min-height: 50px; font-size: 1rem; margin-top: 4px; }
.an-em-llamar {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 20px;
  background: var(--color-alerta); color: #fff; text-decoration: none; min-height: 76px;
}
.an-em-llamar > span:first-child { font-size: 2rem; }
.an-em-llamar span { display: flex; flex-direction: column; font-weight: 700; font-size: 1.05rem; }
.an-em-llamar b { font-size: 1.9rem; line-height: 1.1; letter-spacing: .02em; }
.an-em-tels { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.an-em-dato { padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 1.05rem; }
.an-em-dato:last-child { border-bottom: 0; }
.an-em-dato small { display: block; font-size: 0.9rem; color: var(--color-text-soft); }
:root[data-theme="dark"] .an-emergencia, :root[data-theme="dark"] .an-em-llamar { background: #B4523A; }

/* 2026-11-11 · Etapa A: ojo para la contraseña y aviso de «correo enviado». */
.v2-alta-clave { position: relative; }
.v2-alta-clave .v2-input-grande { padding-right: 56px; }
.v2-alta-ojo { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 0; background: transparent; font-size: 22px; cursor: pointer; border-radius: 12px; opacity: .65; }
.v2-alta-ojo[aria-pressed="true"] { opacity: 1; background: var(--color-oro-soft); }
.v2-alta-error.v2-alta-ok { background: var(--color-oro-soft); }
.an-em-dir { margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--color-oro-soft); }
.an-em-dir small { display: block; font-size: 0.9rem; color: var(--color-text-soft); }
.an-em-dir b { display: block; font-size: 1.35rem; line-height: 1.3; }

/* «‹ Volver» único (etapa D, 2026-11-11): arriba a la izquierda, dice adónde vuelve. */
.v2-volver {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px 0 0; margin: 0 0 4px;
  color: var(--color-primary); font-weight: 800; font-size: 1rem; text-decoration: none;
}
.v2-volver:hover { text-decoration: underline; }

/* Hoja del día (etapa D): filas que se abren, un solo pie, dos campos lado a lado. */
.v2-item.cal-ir { width: 100%; text-align: left; font: inherit; color: inherit; text-decoration: none; cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; }
.v2-item.cal-ir:first-child { border-top: 0; }
.cal-ir-flecha { margin-left: auto; padding-left: 8px; color: var(--color-text-soft); font-weight: 800; font-size: 1.2rem; align-self: center; }
.cal-pie { position: sticky; bottom: 0; padding: 12px 0 4px; margin-top: 8px; background: linear-gradient(to bottom, transparent, var(--color-bg) 30%); }
.cal-pie .v2-btn-sec { width: 100%; justify-content: center; min-height: 48px; }
.cal-dos { display: flex; gap: 10px; } .cal-dos .v2-campo { flex: 1; }
.v2-item.dado .que small { color: var(--color-ok); font-weight: 600; }

/* --- Etapa F: fuera de casa --- */
.fuera-franja { background: var(--color-salvia-soft, #EDEFE3); border: 1px solid var(--color-border); border-radius: 18px; padding: 12px 14px; margin: 12px 0; }
.fuera-franja p { margin: 4px 0 8px; color: var(--color-text-soft); }
.fuera-franja.chica { padding: 8px 12px; font-size: .95rem; }
.fuera-lugar { color: var(--color-text) !important; }
.fuera-linea { margin: 6px 0; }
.fuera-lbl { font-weight: 700; margin: 14px 0 6px; }
.fuera-opc { font-weight: 400; color: var(--color-text-soft); }
.fuera-ico { font-size: 2rem; margin: 4px 0 0; }
.fuera-op button small { display: block; font-size: 0.875rem; color: var(--color-text-soft); font-weight: 400; }
.fuera-med { margin-top: 8px; }
.fuera-rev { margin-top: 8px; }
.fuera-falta a { display: block; padding: 12px 0; font-weight: 700; border-bottom: 1px solid var(--color-border); min-height: 44px; }
.v2-punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* R5 (etapa 6): todo campo de texto, lista o selector mide al menos 44 px de alto. */
body.v2 input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]), body.v2 select { min-height: 44px; }
/* R5: un enlace dentro de un párrafo se toca sin acertarle a una línea de letra: su zona mide 44 px
   (el relleno se compensa con margen negativo para no abrir el párrafo). */
.acordeon-cuerpo a, body.v2 .vacio a, body.v2 .suave a, .v2-hoja p a, .v2-hoja .sub a, .v2-hoja .v2-autor a { display: inline-block; padding: 12px 2px; margin: -12px 0; line-height: 20px; }
