/* Fundamental — hoja unica. Tokens arriba, componentes abajo. */

:root {
  --negro: #000;
  --blanco: #fff;
  --verde: #2E6F40;        /* unico acento de marca */
  --verde-claro: #4BB469;  /* solo para texto verde sobre fondo oscuro */

  --bg: #fff;
  --superficie: #fff;
  --borde: #e6e6e6;
  --texto: #111;
  --texto-suave: rgba(0, 0, 0, 0.62);
  --texto-tenue: rgba(0, 0, 0, 0.42);
  --acento: var(--verde);
  --acento-texto: var(--verde);
  --campo-bg: #fff;
  --celda-vacia: #f1f1f1;
  --peligro: #B3261E;
  --sombra: 0 1px 2px rgba(0, 0, 0, .05);

  --ancho: 42rem;      /* columna de lectura de la app */
  --ancho-form: 26rem; /* formularios: un boton de 700px deja de leerse como boton */
  --r: 10px;
  --nav-h: 60px;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --superficie: #131313;
  --borde: rgba(255, 255, 255, .12);
  --texto: #fff;
  --texto-suave: rgba(255, 255, 255, .68);
  --texto-tenue: rgba(255, 255, 255, .45);
  --acento-texto: var(--verde-claro);
  --campo-bg: #1a1a1a;
  --celda-vacia: rgba(255, 255, 255, .07);
  --peligro: #F2554A;
  --sombra: none;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
.logo-oscuro { display: none; }
[data-theme="dark"] .logo-claro { display: none; }
[data-theme="dark"] .logo-oscuro { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acento-texto); }

:focus-visible {
  outline: 2px solid var(--acento-texto);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Tipografia */

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
p { margin: 0; }

.display { font-size: clamp(1.9rem, 6vw, 2.75rem); }
.titulo { font-size: clamp(1.4rem, 4vw, 1.75rem); }
.subtitulo { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.cuerpo { color: var(--texto-suave); }
.nota { font-size: .875rem; color: var(--texto-suave); }
.tenue { color: var(--texto-tenue); }
.acento { color: var(--acento-texto); }

.rotulo {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--texto-tenue);
}

.cita {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic; font-size: 1.4rem; line-height: 1.3; color: var(--texto);
}

/* Layout */

.wrap { width: 100%; max-width: var(--ancho); margin: 0 auto; padding: 0 20px; }
.wrap-form { max-width: var(--ancho-form); }

.pila > * + * { margin-top: 16px; }
.pila-sm > * + * { margin-top: 8px; }
.pila-lg > * + * { margin-top: 32px; }

.seccion { padding: 32px 0; }
.fila { display: flex; align-items: center; gap: 12px; }
.fila-sep { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Navegacion: barra superior fija, misma en movil y escritorio. */

.nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--borde);
}
.nav-in {
  display: flex; align-items: center; gap: 4px;
  height: var(--nav-h); max-width: var(--ancho); margin: 0 auto; padding: 0 8px;
  overflow-x: auto; scrollbar-width: none;
}
.nav-in::-webkit-scrollbar { display: none; }
.nav-marca { display: flex; align-items: center; padding: 0 8px; margin-right: auto; }
.nav-tab {
  flex: none; background: none; border: 0; cursor: pointer;
  padding: 8px 12px; min-height: 44px; border-radius: var(--r);
  font-size: .9rem; font-weight: 600; color: var(--texto-suave);
  transition: color .15s var(--ease), background .15s var(--ease);
}
.nav-tab:hover { color: var(--texto); }
.nav-tab[aria-current="page"] { color: var(--texto); background: var(--superficie); box-shadow: inset 0 0 0 1px var(--borde); }

/* Botones */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: var(--r);
  border: 1px solid transparent; background: none; cursor: pointer;
  font-weight: 700; font-size: .95rem; text-decoration: none;
  transition: opacity .15s var(--ease), background .15s var(--ease), transform .1s var(--ease);
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primario { background: var(--verde); color: #fff; }
.btn-primario:hover:not(:disabled) { opacity: .88; }
.btn-secundario { border-color: var(--borde); background: var(--superficie); color: var(--texto); }
.btn-secundario:hover:not(:disabled) { border-color: var(--texto-tenue); }
.btn-fantasma { color: var(--acento-texto); padding: 12px 8px; }
.btn-fantasma:hover:not(:disabled) { text-decoration: underline; }
.btn-peligro { border-color: var(--peligro); color: var(--peligro); }
.btn-bloque { display: flex; width: 100%; }

.btn-icono {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  border: 0; background: none; border-radius: var(--r);
  color: var(--texto-suave); cursor: pointer;
}
.btn-icono:hover:not(:disabled) { color: var(--texto); background: var(--superficie); }
.btn-icono:disabled { opacity: .3; cursor: default; }

.enlace {
  background: none; border: 0; padding: 8px 0; cursor: pointer;
  color: var(--texto-suave); font-size: .875rem; text-decoration: underline;
  text-underline-offset: 3px;
}
.enlace:hover { color: var(--texto); }

/* Formularios */

.campo { display: block; }
.campo > .campo-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
.campo-ayuda { font-size: .8rem; color: var(--texto-tenue); margin-top: 6px; }
.campo-error { font-size: .8rem; color: var(--peligro); margin-top: 6px; min-height: 1rem; }

.input {
  width: 100%; min-height: 52px; padding: 12px 14px;
  background: var(--campo-bg); color: var(--texto);
  border: 1px solid var(--borde); border-radius: var(--r);
  font-size: 16px; /* menos de 16 y iOS hace zoom al enfocar */
}
.input::placeholder { color: var(--texto-tenue); }
.input:focus { border-color: var(--acento-texto); outline: none; box-shadow: 0 0 0 3px rgba(46, 111, 64, .18); }
.input[aria-invalid="true"] { border-color: var(--peligro); }
select.input { appearance: none; background-image: none; padding-right: 14px; }
.input:-webkit-autofill { -webkit-text-fill-color: var(--texto); -webkit-box-shadow: 0 0 0 60px var(--campo-bg) inset; }

/* Telefono: <select> nativo para el prefijo. En movil abre el selector del
   sistema operativo, que no se puede romper con un gesto de scroll. */
.tel { display: grid; grid-template-columns: 7.5rem 1fr; gap: 8px; }
@media (max-width: 380px) { .tel { grid-template-columns: 6.5rem 1fr; } }

.switch {
  position: relative; flex: none; width: 46px; height: 28px;
  border: 1px solid var(--borde); border-radius: 999px;
  background: var(--celda-vacia); cursor: pointer; padding: 0;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--texto-tenue);
  transition: transform .18s var(--ease), background .18s var(--ease);
}
.switch[aria-checked="true"] { background: var(--verde); border-color: var(--verde); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: #fff; }

/* Tarjetas */

.tarjeta {
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: var(--r); padding: 20px; box-shadow: var(--sombra);
}

.aviso {
  border-left: 3px solid var(--acento); padding: 12px 14px;
  background: var(--superficie); border-radius: 0 var(--r) var(--r) 0;
  font-size: .9rem; color: var(--texto-suave);
}

.pildora {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--borde); color: var(--texto-suave);
}
.pildora.nutricion { color: var(--acento-texto); border-color: currentColor; }
.pildora.sueno { color: var(--texto); border-color: var(--texto-tenue); }
.pildora.entrenamiento { color: var(--texto-suave); }

.punto-pilar { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--texto-tenue); }
.punto-pilar.nutricion { background: var(--verde); }
.punto-pilar.sueno { background: var(--texto); }
.punto-pilar.entrenamiento { background: var(--verde-claro); }
.punto-pilar.base { background: var(--texto-tenue); }

/* Landing */

.hero { padding: 56px 0 40px; }
.hero .display { margin-top: 16px; }
.hero-cta { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
@media (min-width: 560px) { .hero-cta { flex-direction: row; } .hero-cta .btn { flex: 1; } }

.pilares { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }

.pasos-info { display: grid; gap: 16px; }
@media (min-width: 720px) { .pasos-info { grid-template-columns: repeat(3, 1fr); } }
.paso-info-num {
  font-size: .75rem; font-weight: 800; color: var(--acento-texto);
  letter-spacing: .1em;
}

/* Onboarding y pasos de formulario */

.barra { height: 3px; background: var(--celda-vacia); border-radius: 999px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--verde); transition: width .3s var(--ease); }

.paso { animation: entrar .22s var(--ease) both; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } }

/* Plan de 6 dias */

.dias { display: flex; gap: 8px; }
.dia-punto {
  flex: 1; min-height: 40px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--borde); background: var(--superficie);
  color: var(--texto-suave); font-weight: 700; font-size: .85rem;
}
.dia-punto.hecho { background: var(--verde); border-color: var(--verde); color: #fff; }
.dia-punto.actual { border-color: var(--acento-texto); color: var(--texto); }
.dia-punto:disabled { opacity: .45; cursor: default; }

.check {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  padding: 12px; min-height: 48px; text-align: left; cursor: pointer;
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: var(--r); color: var(--texto);
}
.check:disabled { cursor: default; opacity: .75; }
.check[aria-checked="true"] { border-color: var(--verde); }
.check[aria-checked="true"] .caja { background: var(--verde); border-color: var(--verde); color: #fff; }
.check[aria-checked="true"] .check-txt { color: var(--texto-tenue); text-decoration: line-through; }

.caja {
  flex: none; width: 24px; height: 24px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--texto-tenue); border-radius: 6px; color: transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.check-txt { font-size: .95rem; }

.check-fila { display: flex; align-items: center; gap: 4px; }
.check-fila .check { flex: 1; }

.lista-limpia { list-style: none; padding: 0; margin: 0; }
.lista-limpia > li + li { margin-top: 8px; }

.libro {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 16px; border: 1px solid var(--borde); border-radius: var(--r);
  background: var(--superficie); color: var(--texto);
}
.libro:hover { border-color: var(--acento-texto); }

.tl { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 1px solid var(--borde); }
.tl > li { position: relative; padding: 8px 0; }
.tl > li::before {
  content: ""; position: absolute; left: -25px; top: 16px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--texto-tenue);
}
.tl > li.destacado::before { background: var(--verde); border-color: var(--verde); }
.tl-hora { font-weight: 700; }

/* Hoy */

.resumen { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.anillo { position: relative; width: 96px; height: 96px; flex: none; }
.anillo svg { transform: rotate(-90deg); }
.anillo circle { fill: none; stroke-width: 7; }
.anillo .fondo { stroke: var(--celda-vacia); }
.anillo .frente { stroke: var(--verde); stroke-linecap: round; transition: stroke-dashoffset .5s var(--ease); }
.anillo-pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 1.25rem;
}

.balance { flex: 1; min-width: 200px; display: grid; gap: 8px; }
.bal-fila { display: grid; grid-template-columns: 6.5rem 1fr 2.5rem; align-items: center; gap: 10px; font-size: .8rem; }
.barra-pilar { height: 6px; background: var(--celda-vacia); border-radius: 999px; overflow: hidden; }
.barra-pilar > i { display: block; height: 100%; background: var(--verde); transition: width .5s var(--ease); }
.bal-pct { text-align: right; color: var(--texto-suave); font-variant-numeric: tabular-nums; }

.habito { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.habito:last-child { border-bottom: 0; }
.habito-nombre {
  flex: 1; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 4px 0; font-size: .95rem; color: var(--texto);
}
.habito.hecho .habito-nombre { color: var(--texto-tenue); text-decoration: line-through; }
.habito-detalle { padding: 0 0 12px 36px; font-size: .85rem; color: var(--texto-suave); }

.marcar {
  flex: none; width: 28px; height: 28px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--texto-tenue); border-radius: 8px;
  background: none; color: transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.marcar[aria-checked="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }

.racha { display: inline-flex; align-items: baseline; gap: 6px; }
.racha-num { font-size: 1.6rem; font-weight: 800; line-height: 1; }

.score { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.score button {
  min-height: 44px; border: 1px solid var(--borde); border-radius: 8px;
  background: var(--superficie); color: var(--texto-suave);
  cursor: pointer; font-size: .85rem; font-weight: 600;
}
.score button[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }

/* Mes */

.mes-scroll { overflow-x: auto; padding-bottom: 8px; }
.mtabla { display: inline-block; min-width: 100%; }
.mfila { display: flex; align-items: center; }
.mfila + .mfila { margin-top: 4px; }
.mlabel {
  position: sticky; left: 0; z-index: 1; flex: none;
  width: 128px; padding-right: 10px; background: var(--bg);
  display: flex; align-items: center; gap: 6px;
  font-size: .75rem; color: var(--texto-suave);
  /* Sin stretch, la celda vacia de la cabecera mide 0 de alto y los numeros
     de los primeros dias se ven por debajo al desplazar la rejilla. */
  align-self: stretch; min-height: 22px;
}
.mlabel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mhead { flex: none; width: 24px; text-align: center; font-size: .65rem; color: var(--texto-tenue); }
.mcelda {
  flex: none; width: 20px; height: 20px; margin: 0 2px; padding: 0;
  border: 1px solid var(--borde); border-radius: 4px;
  background: var(--celda-vacia); cursor: pointer;
}
.mcelda.on { background: var(--verde); border-color: var(--verde); }
.mcelda.hoy { box-shadow: 0 0 0 2px var(--acento-texto); }
.mcelda:disabled { opacity: .35; cursor: default; }
.mresumen { flex: none; width: 20px; height: 20px; margin: 0 2px; border-radius: 4px; background: var(--celda-vacia); }

/* Progreso */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }

.mapa {
  display: grid; grid-auto-flow: column; gap: 3px;
  grid-template-rows: repeat(7, 12px); grid-auto-columns: 12px;
  justify-content: start; width: max-content;
}
.mapa i { width: 12px; height: 12px; border-radius: 3px; background: var(--celda-vacia); }
.mapa i.n1 { background: rgba(46, 111, 64, .25); }
.mapa i.n2 { background: rgba(46, 111, 64, .45); }
.mapa i.n3 { background: rgba(46, 111, 64, .65); }
.mapa i.n4 { background: rgba(46, 111, 64, .82); }
.mapa i.n5 { background: var(--verde); }
.mapa i.vacio { background: transparent; }

.chart { width: 100%; height: auto; }
.chart .grid-l { stroke: var(--borde); stroke-width: .5; }
.chart .eje { fill: var(--texto-tenue); font-size: 7px; }
.chart .linea { fill: none; stroke: var(--verde); stroke-width: 2; stroke-linejoin: round; }
.chart .punto { fill: var(--verde); }

/* Gestion de habitos */

.gh { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--borde); }
.gh:last-child { border-bottom: 0; }
.gh.inactivo { opacity: .5; }
.gh-nombre { flex: 1; min-width: 0; font-size: .9rem; }
.gh-nombre p { overflow: hidden; text-overflow: ellipsis; }

/* Modal y toast */

.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); padding: 16px;
  animation: aparecer .15s var(--ease);
}
@keyframes aparecer { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 28rem; max-height: 88vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--borde);
  border-radius: 14px; padding: 22px;
}
.modal-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.modal-acciones .btn { flex: 1; min-width: 8rem; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  transform: translateX(-50%); max-width: min(90vw, 26rem);
  padding: 12px 18px; border-radius: var(--r);
  background: var(--texto); color: var(--bg);
  font-size: .875rem; font-weight: 600; text-align: center;
  animation: subir .2s var(--ease);
}
@keyframes subir { from { opacity: 0; transform: translate(-50%, 8px); } }

.pie { border-top: 1px solid var(--borde); margin-top: 48px; padding: 32px 0 48px; }
