@font-face {
  font-family: "Advercase";
  src: url("fonts/Advercase-Bold.woff2") format("woff2"), url("fonts/Advercase-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: block;
}
@font-face {
  font-family: "Fredoka";
  src: url("fonts/Fredoka-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  --crema: #FFF8EC;
  --papel: #FFFDF8;
  --rosa: #F7C3DA;
  --rosa-suave: #FCE5EF;
  --fucsia: #EF7BB0;
  --fucsia-osc: #B23F77;
  --azul: #1F3F8F;
  --azul-suave: #E1EEF6;
  --lila: #8C7BE8;
  --verde: #149C7A;
  --manteca: #FBC81A;
  --tinta: #1C2340;
  --gris: #6E6A80;
  --linea: #D3E7F0;
  --sombra: 0 2px 0 #CFE3EE;
  --radio: 18px;
  --titulo: "Advercase", "Georgia", serif;
  --texto: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --cuadricula: #DCEBF3;
  --acento: #EF7BB0;
  --acento-suave: #FCE0EC;
  --resaltado: color-mix(in srgb, var(--acento) 45%, transparent);
  color-scheme: light;
}
/* Un color por pestaña, como las letras de la referencia */
body { --resaltado: color-mix(in srgb, var(--acento) 45%, transparent); }
body[data-tab="inicio"] { --acento: #EF7BB0; --acento-suave: #FCE0EC; }
body[data-tab="datos"]  { --acento: #149C7A; --acento-suave: #D7F0E6; }
body[data-tab="salud"]  { --acento: #F0652A; --acento-suave: #FDE1D3; }
body[data-tab="turnos"] { --acento: #A898C8; --acento-suave: #ECE6F6; }
body[data-tab="rutina"] { --acento: #FBC81A; --acento-suave: #FFF0B8; }
body[data-tab="firsts"] { --acento: #5BB5D8; --acento-suave: #DDF0F8; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background-color: var(--crema);
  background-image: linear-gradient(var(--cuadricula) 1px, transparent 1px), linear-gradient(90deg, var(--cuadricula) 1px, transparent 1px);
  background-size: 26px 26px;
  color: var(--tinta);
  font-family: var(--texto);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }

/* ---------- Encabezado ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--crema); border-bottom: 1.5px solid var(--linea); overflow: hidden; padding-top: env(safe-area-inset-top); }
.top .pattern { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.top .bar { position: relative; }
.bar {
  max-width: 560px; margin: 0 auto; padding: 14px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { margin: 0; line-height: 0; }
.logo-btn { border: 0; background: none; padding: 0; display: block; line-height: 0; }
.logo-btn img, .logo-btn svg { width: 72px; height: 72px; display: block; filter: drop-shadow(0 2px 0 #CFE3EE); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.icon-btn {
  border: 0; background: var(--papel); color: var(--azul); width: 42px; height: 42px;
  border-radius: 50%; display: grid; place-items: center; box-shadow: var(--sombra);
}

main { max-width: 560px; margin: 0 auto; padding: 4px 16px 24px; position: relative; }

#aviso { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.banner {
  background: var(--manteca); border-radius: 14px; padding: 10px 14px; font-size: 14px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.banner button { border: 0; background: transparent; text-decoration: underline; font-weight: 600; padding: 0; }

/* ---------- Tipografía ---------- */
h2.titulo { font-family: var(--titulo); color: var(--azul); font-size: 30px; line-height: 1.1; margin: 14px 0 14px; display: inline-block; background: linear-gradient(transparent 58%, var(--resaltado) 58%, var(--resaltado) 94%, transparent 94%); padding: 0 4px; }
h3.sub { font-family: var(--titulo); color: var(--azul); font-size: 20px; margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
h3.sub img { width: 34px; height: 34px; }
.muted { color: var(--gris); font-size: 14px; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--azul-suave); color: var(--azul);
}
.chip.rosa { background: var(--rosa-suave); color: var(--fucsia-osc); }
.chip.verde { background: #DDF1E6; color: #0E6B54; }
.chip.manteca { background: #FFF0B8; color: #7A5A00; }

/* ---------- Hero de inicio ---------- */
.hero {
  position: relative; border-radius: 26px; background: var(--papel); overflow: hidden;
  padding: 22px 20px; min-height: 220px; box-shadow: var(--sombra); margin-top: 6px;
}
.hero .ola { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .contenido { position: relative; max-width: 62%; }
.hero h2 { font-family: var(--titulo); color: var(--azul); font-size: 38px; margin: 0 0 6px; line-height: 1; }
.hero p { margin: 0; }
.hero .edad { font-size: 18px; font-weight: 600; color: var(--fucsia-osc); }
.hero .ilus { position: absolute; right: 10px; bottom: 6px; height: 205px; width: auto; max-width: 42%; object-fit: contain; object-position: bottom right; transform: rotate(3deg); }
.hero .estrella { position: absolute; }

/* ---------- Tarjetas ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.card {
  background: var(--papel); border-radius: var(--radio); padding: 14px 16px; box-shadow: var(--sombra);
  border: 1.5px solid var(--linea); position: relative;
}
.card + .card { margin-top: 10px; }
.grid2 .card + .card { margin-top: 0; }
.stat .num { font-family: var(--titulo); font-size: 28px; color: var(--azul); line-height: 1.1; }
.stat .lbl { font-size: 13px; color: var(--gris); }
.stat img { position: absolute; right: 10px; top: 10px; width: 38px; height: 38px; }
.card.link { width: 100%; text-align: left; font-size: inherit; }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-tit { font-weight: 700; font-size: 16px; }
.item-meta { color: var(--gris); font-size: 13px; margin-top: 2px; }
.item-nota { margin-top: 8px; white-space: pre-wrap; font-size: 15px; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.vacio {
  text-align: center; padding: 22px 16px; color: var(--gris); background: var(--papel);
  border-radius: var(--radio); border: 1.5px dashed var(--acento);
}
.vacio img { width: 76px; height: 76px; margin: 0 auto 8px; }

/* ---------- Botones ---------- */
.btn {
  border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; font-family: var(--titulo);
  letter-spacing: .3px; background: var(--fucsia); color: var(--azul); box-shadow: 0 3px 0 #D2609A;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; text-decoration: none;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #D2609A; }
.btn.azul { background: var(--azul); color: #FFF8EC; box-shadow: 0 3px 0 #142C66; }
.btn.claro { background: var(--rosa-suave); color: var(--fucsia-osc); box-shadow: none; font-family: var(--texto); }
.btn.chico { padding: 7px 12px; font-size: 13px; border-radius: 10px; font-family: var(--texto); box-shadow: none; }
.btn.borde { background: transparent; color: var(--azul); border: 1.5px solid var(--azul); box-shadow: none; font-family: var(--texto); }
.btn.peligro { background: transparent; color: #B4233A; box-shadow: none; font-family: var(--texto); }
.btn.full { width: 100%; }
.fila-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.fila-btns .btn { flex: 1; }
.agregar { margin: 6px 0 4px; }

/* ---------- Segmentado ---------- */
.seg { display: flex; background: var(--acento-suave); border-radius: 14px; padding: 4px; gap: 4px; margin: 4px 0 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 10px; font-weight: 600; color: var(--fucsia-osc); }
.seg button.on { background: var(--papel); color: var(--azul); box-shadow: 0 1px 0 var(--linea); }

/* ---------- Datos personales ---------- */
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.campo .lbl { font-size: 12px; color: var(--gris); text-transform: uppercase; letter-spacing: .5px; }
.campo .val { font-weight: 600; word-break: break-word; }
.campo.ancho { grid-column: 1 / -1; }
.oculto { border: 0; background: var(--azul-suave); color: var(--azul); border-radius: 8px; padding: 2px 8px; font-weight: 600; }

/* ---------- Gráfico de peso ---------- */
.grafico svg { width: 100%; height: auto; display: block; }

/* ---------- Preguntas ---------- */
.pregunta { display: flex; gap: 12px; align-items: flex-start; }
.check {
  flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--fucsia); background: var(--papel);
  display: grid; place-items: center; color: #fff; padding: 0;
}
.check.on { background: var(--fucsia); color: var(--azul); }
.pregunta.hecha .item-tit { text-decoration: line-through; color: var(--gris); font-weight: 500; }
.rapido { display: flex; gap: 8px; margin-bottom: 10px; }
.rapido input { flex: 1; }

/* ---------- Rutina ---------- */
.dia { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.dia .nombre { font-family: var(--titulo); color: var(--azul); font-size: 20px; text-align: center; }
.flecha { border: 0; background: var(--papel); width: 40px; height: 40px; border-radius: 50%; box-shadow: var(--sombra); color: var(--azul); font-size: 20px; }
.flecha:disabled { opacity: .35; }
.linea-tiempo { position: relative; padding-left: 22px; }
.linea-tiempo::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--linea); }
.evento { position: relative; }
.evento::before { content: ""; position: absolute; left: -20px; top: 18px; width: 13px; height: 13px; border-radius: 50%; background: var(--fucsia); border: 3px solid var(--crema); }
.evento.sueno::before { background: var(--azul); }
.evento .hora { font-family: var(--titulo); color: var(--azul); font-size: 18px; }
.durmiendo { background: var(--azul); color: #fff; border: 0; }
.durmiendo .muted { color: #C9D6F2; }
.botones-rutina { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.botones-rutina .btn { padding: 14px 10px; }
.botones-rutina img { width: 28px; height: 28px; }
.botones-rutina .ancho { grid-column: 1 / -1; padding: 11px 10px; }

/* ---------- Barra de pestañas ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--papel); border-top: 2px solid var(--linea); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabs button {
  flex: 1; max-width: 110px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 11px; font-weight: 600; color: var(--gris); padding: 4px 0; border-radius: 14px;
}
.tabs img { width: 34px; height: 34px; object-fit: contain; transition: transform .15s; filter: saturate(.75); opacity: .8; }
.tabs button.on { color: var(--azul); background: var(--acento-suave); }
.tabs button.on img { transform: scale(1.12) rotate(-4deg); filter: none; opacity: 1; }

/* ---------- Hoja (formularios) ---------- */
dialog#hoja {
  border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 24px 24px 0 0;
  background: var(--crema); max-height: 92vh; color: var(--tinta);
}
@media (min-width: 620px) { dialog#hoja { margin: auto; border-radius: 24px; } }
dialog#hoja::backdrop { background: rgba(34, 32, 58, .45); }
#hoja-contenido { padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92vh; }
.hoja-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hoja-top img { width: 48px; height: 48px; }
.hoja-top h2 { font-family: var(--titulo); color: var(--azul); font-size: 24px; margin: 0; flex: 1; }
.cerrar { border: 0; background: var(--papel); border-radius: 50%; width: 36px; height: 36px; font-size: 20px; color: var(--azul); }
form .f { margin-bottom: 12px; }
form label { display: block; font-size: 13px; font-weight: 600; color: var(--gris); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; border: 1.5px solid var(--linea); background: var(--papel); border-radius: 12px; padding: 11px 12px;
  font-size: 16px; outline: none; min-height: 46px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--lila); box-shadow: 0 0 0 3px #E6E1FB; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f2 .f { min-width: 0; }
.ayuda { font-size: 12px; color: var(--gris); margin-top: 4px; }
.pie-form { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.pie-form .btn:first-child { flex: 1; }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--tinta); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0;
  pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100% - 32px);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.deco { position: absolute; pointer-events: none; }
@media (max-width: 360px) { .campos { grid-template-columns: 1fr; } .hero h2 { font-size: 32px; } }

/* ---------- Entrada (Soy Belu / Soy Gon) ---------- */
body.sin-sesion .tabs { display: none; }
body.sin-sesion { padding-bottom: 24px; }
.entrada { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 0 20px; }
.entrada-logo { width: 150px; height: 150px; filter: drop-shadow(0 3px 0 #CFE3EE); }
.entrada-coneja { width: 150px; height: auto; margin: 4px 0 14px; transform: rotate(3deg); }
body.sin-sesion .icon-btn { visibility: hidden; }
.form-entrada { width: 100%; max-width: 360px; background: var(--papel); border: 1.5px solid var(--linea); border-radius: 22px; padding: 18px 16px; box-shadow: var(--sombra); text-align: left; }
.entrada-tit { font-family: var(--titulo); color: var(--azul); font-size: 22px; margin: 0 0 10px; text-align: center; }
.quien { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quien-op input { position: absolute; opacity: 0; pointer-events: none; }
.quien-op span {
  display: block; text-align: center; padding: 14px 8px; border-radius: 14px; border: 2px solid var(--linea);
  font-family: var(--titulo); font-size: 18px; color: var(--azul); background: var(--crema); cursor: pointer;
}
.quien-op input:checked + span { background: var(--fucsia); border-color: var(--fucsia); }
.quien-op input:focus-visible + span { outline: 3px solid #E6E1FB; }
.btn.borrar-registro { background: transparent; color: #B4233A; border: 1.5px solid #E8B4BE; box-shadow: none; font-family: var(--texto); }
.entrada .banner { max-width: 360px; text-align: left; }

/* ---------- Bebés y familia (Ajustes) ---------- */
.fila-bebe { display: flex; align-items: center; gap: 12px; }
.fila-bebe.on { border-color: var(--fucsia); }
.mini-logo { flex: none; line-height: 0; }
.mini-logo img, .mini-logo svg { width: 46px; height: 46px; display: block; }
.fila-miembro { display: flex; align-items: center; gap: 10px; }
.codigo .lbl { font-size: 12px; color: var(--gris); text-transform: uppercase; letter-spacing: .5px; }
.codigo .num { font-family: var(--titulo); font-size: 28px; color: var(--azul); letter-spacing: 2px; margin: 2px 0 4px; }

/* ---------- Lactancia: reloj y banco de leche ---------- */
.card.reloj { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; width: 100%; text-align: left; background: var(--azul); color: #FFF8EC; border-color: var(--azul); }
.card.reloj .reloj-ico { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--fucsia); color: var(--azul); display: grid; place-items: center; }
.card.reloj .lbl, .card.reloj .item-meta { color: #C9D6F2; font-size: 13px; }
.card.reloj .num { font-family: var(--titulo); font-size: 26px; line-height: 1.1; color: #FFF8EC; }
.card.reloj .item-tit { color: #FFF8EC; }
.banco .num { color: var(--verde); }
.evento.extraccion::before { background: var(--verde); }

/* ---------- Suscripción ---------- */
.card.precio { text-align: center; margin-bottom: 14px; }
.card.precio .num { font-family: var(--titulo); color: var(--azul); font-size: 34px; }
.card.precio .num span { font-family: var(--texto); font-size: 15px; color: var(--gris); }

/* Los stickers nunca se deforman (la coneja es más alta que ancha). */
.hoja-top img, h3.sub img, .stat img, .vacio img, .item-top img, .botones-rutina img { object-fit: contain; }

.evento.despierta::before { background: var(--manteca); }

/* ---------- Firsts ---------- */
.hitos .card + .card { margin-top: 0; }
.card.hito { text-align: left; border-style: dashed; border-color: var(--acento); background: transparent; min-height: 132px; }
.card.hito.hecho { border-style: solid; border-color: var(--linea); background: var(--papel); }
.card.hito img { width: 44px; height: 44px; object-fit: contain; margin-bottom: 6px; }
.card.hito:not(.hecho) img { opacity: .55; filter: saturate(.6); }
.card.hito .item-tit { font-size: 15px; line-height: 1.25; }
.tabs button { min-width: 0; }
.tabs span { white-space: nowrap; }

.tabs button[hidden] { display: none; }
.pestanas-op { display: flex; flex-wrap: wrap; gap: 8px; }
.pestanas-op label { display: inline-flex; align-items: center; gap: 6px; background: var(--papel); border: 1.5px solid var(--linea); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; color: var(--azul); cursor: pointer; }
.pestanas-op input { width: 18px; height: 18px; min-height: 0; accent-color: var(--fucsia); margin: 0; }
