/* =========================================================================
   Tareas Caseras — hoja de estilos
   Dirección visual: juguetona (rosa, redondeada, mochi como mascota)
   ========================================================================= */

:root {
  --marca:        #e0457b;
  --marca-clara:  #ff8fb1;
  --marca-suave:  #ffb3d1;
  --fondo:        #fff4f8;
  --superficie:   #ffffff;
  --pista:        #ffe3ee;
  --texto:        #5b3547;
  --texto-suave:  #a8798c;
  --inactivo:     #c9a5b4;
  --hecho:        #7cbb95;
  --hecho-fondo:  #e9f7ef;
  --opcional:     #d99418;
  --opcional-bd:  #ffd9a0;
  --opcional-fd:  #fffaf0;
  --error:        #c2352f;

  --sombra:    0 2px 8px rgba(224, 69, 123, .08);
  --sombra-md: 0 6px 20px rgba(224, 69, 123, .14);

  --r-tarjeta: 18px;
  --r-grande:  22px;

  /* Alto de la navegación inferior, para reservar espacio al contenido */
  --nav-alto: calc(74px + env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: var(--marca); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

/* --- Cabecera ---------------------------------------------------------- */

.cabecera {
  background: linear-gradient(160deg, var(--marca-suave) 0%, var(--marca-clara) 100%);
  padding: calc(26px + env(safe-area-inset-top, 0px)) 20px 42px;
  border-radius: 0 0 30px 30px;
}

.cabecera--admin { padding-bottom: 20px; }

.cabecera__fila {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cabecera__avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 rgba(180, 40, 92, .16);
  flex-shrink: 0;
}

.cabecera__saludo {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  opacity: .92;
}

.cabecera__titulo {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin: 0;
}

/* --- Tarjeta de progreso (montada sobre la cabecera) ------------------- */

.progreso {
  margin: -26px 16px 0;
  background: var(--superficie);
  border-radius: var(--r-grande);
  padding: 17px;
  box-shadow: var(--sombra-md);
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.progreso__cifras {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.progreso__etiqueta {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--texto-suave);
  letter-spacing: .4px;
}

.progreso__numero {
  font-size: 29px;
  font-weight: 800;
  line-height: 1;
}

.progreso__numero--hoy { color: var(--marca); }
.progreso__numero--mes { color: var(--texto); }

.barra {
  height: 13px;
  border-radius: 10px;
  background: var(--pista);
  overflow: hidden;
}

.barra__relleno {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--marca-clara), var(--marca));
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}

.progreso__pie {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: #8a6475;
}

.progreso__euros {
  color: var(--marca);
  font-weight: 800;
}

/* --- Lista de tareas --------------------------------------------------- */

.contenido {
  padding: 18px 16px;
  padding-bottom: calc(var(--nav-alto) + 16px);
}

.seccion__titulo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--texto);
}

.seccion__contador {
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-suave);
}

.tareas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.tarea {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--superficie);
  border: 1.5px solid transparent;
  border-radius: var(--r-tarjeta);
  padding: 13px 14px;
  box-shadow: var(--sombra);
  text-align: left;
  color: inherit;
  transition: background .2s, box-shadow .2s, opacity .2s;
  min-height: 60px;
}

.tarea:active { transform: scale(.985); }

.tarea--opcional {
  background: var(--opcional-fd);
  border: 1.5px dashed var(--opcional-bd);
  box-shadow: none;
}

.tarea--hecha { background: var(--superficie); }

.tarea__marca {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--pista);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s;
}

.tarea--opcional .tarea__marca { border-color: var(--opcional-bd); }

.tarea--hecha .tarea__marca {
  background: var(--hecho);
  border-color: var(--hecho);
}

.tarea__marca svg { display: none; }
.tarea--hecha .tarea__marca svg { display: block; }

.tarea__cuerpo {
  flex: 1;
  min-width: 0;
}

.tarea__nombre {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--texto);
}

.tarea--hecha .tarea__nombre {
  color: #a8b5ad;
  text-decoration: line-through;
}

.tarea__sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-suave);
  margin-top: 1px;
}

.tarea--hecha .tarea__sub  { color: var(--hecho); }
.tarea--opcional .tarea__sub { color: var(--opcional); }

.tarea__mochis {
  font-size: 14px;
  font-weight: 800;
  color: var(--marca);
  flex-shrink: 0;
}

.tarea--hecha .tarea__mochis   { color: var(--hecho); }
.tarea--opcional .tarea__mochis { color: var(--opcional); }

.tarea[disabled] { opacity: .75; }

/* Icono de la tarea, junto al nombre */
.tarea__icono {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--pista);
  color: var(--marca);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tarea--opcional .tarea__icono {
  background: #fff3dd;
  color: var(--opcional);
}

.tarea--hecha .tarea__icono {
  background: var(--hecho-fondo);
  color: var(--hecho);
}

/* --- Navegación inferior ---------------------------------------------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--superficie);
  border-radius: 26px 26px 0 0;
  padding: 12px 8px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -3px 16px rgba(224, 69, 123, .1);
  z-index: 20;
}

.nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  min-height: 44px;
  color: var(--inactivo);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 600;
  position: relative;
}

.nav__item--activo {
  color: var(--marca);
  font-weight: 800;
}

.nav__punto {
  position: absolute;
  top: 2px;
  right: calc(50% - 16px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--marca);
}

/* --- Login ------------------------------------------------------------- */

.login {
  min-height: 100dvh;
  background: linear-gradient(170deg, #ffd9e6 0%, var(--fondo) 42%);
  display: flex;
  flex-direction: column;
  padding: 0 28px;
}

.login__centro {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
}

.login__mascota {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(224, 69, 123, .2);
}

.login__titulo {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
  text-align: center;
}

.login__lema {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--texto-suave);
  text-align: center;
  margin: 3px 0 0;
}

.login__form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campo {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #fff;
  border-radius: 16px;
  padding: 4px 16px;
  box-shadow: 0 2px 10px rgba(224, 69, 123, .09);
}

.campo svg { flex-shrink: 0; color: var(--marca); }

.campo input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  /* 16px como mínimo: por debajo, iOS hace zoom al enfocar */
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: var(--texto);
  padding: 15px 0;
}

.campo input::placeholder { color: var(--inactivo); font-weight: 600; }

.boton {
  background: linear-gradient(135deg, var(--marca-clara), var(--marca));
  border: 0;
  border-radius: 16px;
  padding: 17px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(224, 69, 123, .3);
  margin-top: 4px;
  min-height: 44px;
}

.boton:active { transform: translateY(1px); }

.aviso {
  background: #fdecec;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--error);
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
}

.login__pie {
  padding: 0 0 38px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--inactivo);
}

/* --- Panel de administración ------------------------------------------ */

.resumen {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}

.resumen__caja {
  background: var(--superficie);
  border-radius: var(--r-tarjeta);
  padding: 13px 10px;
  text-align: center;
  box-shadow: var(--sombra);
}

.resumen__numero {
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

.resumen__etiqueta {
  font-size: 11px;
  font-weight: 600;
  color: var(--texto-suave);
  margin-top: 3px;
}

.hija {
  background: var(--superficie);
  border-radius: var(--r-tarjeta);
  padding: 14px;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hija__fila {
  display: flex;
  align-items: center;
  gap: 11px;
}

.hija__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hija__nombre {
  font-size: 15.5px;
  font-weight: 800;
}

.etiqueta-turno {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--marca);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}

.hija__barra {
  height: 8px;
  border-radius: 6px;
  background: var(--pista);
  overflow: hidden;
}

.hija__barra span {
  display: block;
  height: 100%;
  border-radius: 6px;
}

/* --- Animación al confirmar ------------------------------------------- */

@keyframes salto {
  0%, 100% { transform: scale(1); }
  40%      { transform: scale(1.22) rotate(-7deg); }
}

.tarea--celebra .tarea__marca {
  animation: salto .42s cubic-bezier(.34, 1.56, .64, 1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* --- Modo oscuro ------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --fondo:       #2a1c23;
    --superficie:  #3a2630;
    --pista:       #4d3440;
    --texto:       #fdeef4;
    --texto-suave: #c79fb1;
    --inactivo:    #8d6a79;
    --opcional-fd: #3d2d28;
    --hecho-fondo: #26382e;
    --sombra:      0 2px 8px rgba(0, 0, 0, .3);
    --sombra-md:   0 6px 20px rgba(0, 0, 0, .38);
  }

  .campo  { background: var(--superficie); }
  .aviso  { background: #4a2a2a; color: #ffb4b0; }
  .login  { background: linear-gradient(170deg, #4a2c3a 0%, var(--fondo) 42%); }
  .login__mascota { background: var(--superficie); }
  .tarea--hecha .tarea__nombre { color: var(--inactivo); }
}

/* =========================================================================
   Pantallas: turnos, mensajes, perfil y gestión
   ========================================================================= */

/* --- Calendario -------------------------------------------------------- */

.mes-nav {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .24);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.calendario {
  background: var(--superficie);
  border-radius: var(--r-grande);
  padding: 14px;
  box-shadow: var(--sombra);
}

.calendario__cabecera,
.calendario__rejilla {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendario__cabecera {
  margin-bottom: 8px;
}

.calendario__cabecera span {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--texto-suave);
}

.dia {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: 12px;
  background: var(--pista);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--texto);
  border: 2px solid transparent;
}

.dia--vacio { background: transparent; min-height: 0; }

.dia__numero {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.dia__punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dia--mio {
  background: var(--marca);
}

.dia--mio .dia__numero { color: #fff; }

.dia--hoy {
  outline: 2.5px solid var(--texto);
  outline-offset: 1px;
}

.dia--cambiado { border-color: var(--opcional); }

.leyenda {
  background: var(--superficie);
  border-radius: var(--r-tarjeta);
  padding: 6px 14px;
  box-shadow: var(--sombra);
}

.leyenda__fila {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--pista);
}

.leyenda__fila:last-child { border-bottom: 0; }

.leyenda__punto { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.leyenda__nombre { flex: 1; font-size: 14px; font-weight: 700; }
.leyenda__cifra { font-size: 13px; font-weight: 700; color: var(--texto-suave); }

.nota {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--texto-suave);
  line-height: 1.5;
  margin: 14px 2px 0;
}

/* --- Mensajes ---------------------------------------------------------- */

.mensajes {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.mensaje {
  background: var(--superficie);
  border-radius: var(--r-tarjeta);
  border-left: 4px solid var(--c, var(--marca));
  padding: 13px 14px;
  box-shadow: var(--sombra);
}

.mensaje--nuevo { box-shadow: 0 0 0 2px var(--c, var(--marca)), var(--sombra); }
.mensaje--anulado { opacity: .5; }

.mensaje__alto {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.mensaje__tipo {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--c, var(--marca));
  letter-spacing: .4px;
  text-transform: uppercase;
}

.mensaje__cuando { font-size: 11.5px; font-weight: 600; color: var(--texto-suave); }

.mensaje__titulo { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.3; }

.mensaje__cuerpo {
  margin: 5px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--texto);
  line-height: 1.45;
}

.mensaje__pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--texto-suave);
}

.mensaje__mochis { font-weight: 800; }
.mensaje__mochis.es-mas   { color: var(--hecho); }
.mensaje__mochis.es-menos { color: var(--error); }

/* --- Formularios plegables -------------------------------------------- */

.envio {
  background: var(--superficie);
  border-radius: var(--r-tarjeta);
  box-shadow: var(--sombra);
  margin-bottom: 10px;
  overflow: hidden;
}

.envio--tarea { margin-bottom: 0; }
.envio.esta-inactiva { opacity: .6; }

.envio__abrir {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--marca);
  cursor: pointer;
  list-style: none;
  min-height: 44px;
}

.envio__abrir::-webkit-details-marker { display: none; }
.envio__abrir--tarea { color: var(--texto); }

.envio__form {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.campo--bloque {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 10px 14px;
  background: var(--fondo);
  box-shadow: none;
}

.campo__etiqueta {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--texto-suave);
}

.campo--bloque input,
.campo--bloque textarea {
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--texto);
  padding: 6px 0;
  width: 100%;
  resize: vertical;
}

.grupo { border: 0; padding: 0; margin: 0; }

.grupo__titulo {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--texto-suave);
  padding: 0;
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.tipos, .destinos {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tipo input, .destino input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tipo__caja, .destino__caja {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 13px;
  border: 2px solid var(--pista);
  background: var(--fondo);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--texto-suave);
  cursor: pointer;
}

.tipo input:checked + .tipo__caja,
.destino input:checked + .destino__caja {
  border-color: var(--c);
  background: var(--c);
  color: #fff;
}

.tipo input:focus-visible + .tipo__caja,
.destino input:focus-visible + .destino__caja {
  outline: 3px solid var(--texto);
  outline-offset: 2px;
}

.aviso--ok { background: var(--hecho-fondo); color: #2f7d52; }

/* --- Perfil ------------------------------------------------------------ */

.progreso__nota {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-suave);
  line-height: 1.45;
}

.historico {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--superficie);
  border-radius: var(--r-tarjeta);
  padding: 13px 14px;
  box-shadow: var(--sombra);
}

.historico__mes    { flex: 1; font-size: 14px; font-weight: 700; }
.historico__mochis { font-size: 12px; font-weight: 600; color: var(--texto-suave); }
.historico__euros  { font-size: 14px; font-weight: 800; color: var(--hecho); }

.vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.vacio__texto {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--texto-suave);
}

.salir {
  display: block;
  text-align: center;
  margin: 22px auto 0;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--texto-suave);
  text-decoration: none;
  min-height: 44px;
}

/* --- Botón secundario (activar avisos) --------------------------------- */

.boton--suave {
  width: 100%;
  background: var(--superficie);
  color: var(--marca);
  box-shadow: var(--sombra);
  font-size: 14.5px;
}

.boton--suave[disabled] {
  color: var(--texto-suave);
  box-shadow: none;
  background: var(--pista);
}
