/* Nido · estilos
   Papel crema, terracota, salvia y azul cielo. Modo noche cálido sin blancos. */

:root {
  --papel: #f6efe3;
  --papel-2: #efe5d4;
  --tarjeta: #fffaf2;
  --tinta: #3a2e28;
  --tinta-2: #6d5d52;
  --tinta-3: #9a897b;
  --linea: #e3d5c0;
  --terracota: #c4623f;
  --terracota-2: #e9a184;
  --terracota-suave: #f5dccf;
  --salvia: #5f7d5a;
  --salvia-2: #9db898;
  --salvia-suave: #e1ebdc;
  --cielo: #4f86ad;
  --cielo-2: #9cc3df;
  --cielo-suave: #dcebf5;
  --miel: #b07d1c;
  --miel-suave: #f6e7c4;
  --rojo: #b33a2c;
  --rojo-suave: #f7d9d3;
  --sombra: 0 1px 0 rgba(90, 60, 40, .06), 0 6px 18px -10px rgba(90, 60, 40, .35);
  --radio: 18px;
  --radio-s: 12px;
  --f-titulo: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-texto: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --seg-arriba: env(safe-area-inset-top, 0px);
  --seg-abajo: env(safe-area-inset-bottom, 0px);
  --alto-nav: 64px;
  color-scheme: light;
}

:root[data-tema="noche"] {
  --papel: #1d1713;
  --papel-2: #261e18;
  --tarjeta: #2a211b;
  --tinta: #ead2b4;
  --tinta-2: #c3a888;
  --tinta-3: #8d765f;
  --linea: #3d3027;
  --terracota: #e08a63;
  --terracota-2: #9c5a3e;
  --terracota-suave: #43291e;
  --salvia: #a9c09d;
  --salvia-2: #6c8a66;
  --salvia-suave: #29301f;
  --cielo: #9dbfd6;
  --cielo-2: #5d7f97;
  --cielo-suave: #1f2a30;
  --miel: #e0b25a;
  --miel-suave: #3a2d17;
  --rojo: #f08f7c;
  --rojo-suave: #45221c;
  --sombra: 0 1px 0 rgba(0, 0, 0, .25), 0 8px 20px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 16px/1.5 var(--f-texto);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}
body::before { /* grano de papel */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: radial-gradient(rgba(120, 90, 60, .07) 1px, transparent 1px);
  background-size: 5px 5px;
}
:root[data-tema="noche"] body::before { opacity: .25; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
a { color: var(--terracota); }
h1, h2, h3, h4 { font-family: var(--f-titulo); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .6em; }
ul { margin: 0 0 .6em; padding-left: 1.15em; }
li { margin: .2em 0; }
li::marker { color: var(--terracota-2); }
small, .suave { color: var(--tinta-2); }
.muy-suave { color: var(--tinta-3); font-size: .85rem; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--cielo); outline-offset: 2px; border-radius: 6px; }

/* ---------- Arranque ---------- */
.arranque { min-height: 100dvh; display: grid; place-content: center; text-align: center; color: var(--tinta-2); font-family: var(--f-titulo); }
.arranque-nido { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, var(--tarjeta) 38%, var(--terracota-2) 40%); animation: latido 1.6s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(.92); } }

/* ---------- Estructura ---------- */
#app { position: relative; z-index: 1; }
.cabecera {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--seg-arriba) + 10px) 12px 10px 16px;
  background: color-mix(in srgb, var(--papel) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--linea);
}
.cabecera .marca { font-family: var(--f-titulo); font-weight: 700; font-size: 1.25rem; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; text-decoration: none; color: var(--tinta); }
.cabecera .marca img { width: 28px; height: 28px; }
.cabecera .marca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icono {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--tinta-2); flex: none; text-decoration: none;
}
.btn-icono:active { background: var(--papel-2); }
.btn-icono svg { width: 24px; height: 24px; }
.estado-sync { font-size: .75rem; padding: 5px 10px; border-radius: 99px; background: var(--papel-2); color: var(--tinta-2); white-space: nowrap; border: 0; display: flex; align-items: center; gap: 6px; min-height: 30px; text-decoration: none; }
.estado-sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tinta-3); }
.estado-sync[data-e="ok"]::before { background: var(--salvia); }
.estado-sync[data-e="pend"]::before, .estado-sync[data-e="sync"]::before { background: var(--miel); }
.estado-sync[data-e="sync"]::before { animation: latido 1s infinite; }
.estado-sync[data-e="error"]::before { background: var(--rojo); }

main.vista { padding: 12px 16px calc(var(--alto-nav) + var(--seg-abajo) + 28px); max-width: 640px; margin: 0 auto; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + var(--seg-abajo));
  background: color-mix(in srgb, var(--tarjeta) 94%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--linea);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0 4px; min-height: 52px; border-radius: 14px;
  color: var(--tinta-3); text-decoration: none; font-size: .72rem; font-weight: 600;
}
.nav a svg { width: 26px; height: 26px; }
.nav a[aria-current="page"] { color: var(--terracota); background: var(--terracota-suave); }

/* ---------- Tarjetas y bloques ---------- */
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); margin-bottom: 14px; position: relative; }
.tarjeta.plana { box-shadow: none; border: 1px solid var(--linea); }
.tarjeta.salvia { background: var(--salvia-suave); }
.tarjeta.cielo { background: var(--cielo-suave); }
.tarjeta.terra { background: var(--terracota-suave); }
.tarjeta.miel { background: var(--miel-suave); }
.tarjeta h2, .tarjeta h3 { margin-bottom: .3em; }
.tarjeta-tit { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tarjeta-tit h2, .tarjeta-tit h3 { margin: 0; }
.etiqueta { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--tinta-3); display: block; margin-bottom: 4px; }
.seccion-tit { font-family: var(--f-titulo); font-size: 1.2rem; margin: 24px 2px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.seccion-tit a, .seccion-tit button { font-family: var(--f-texto); font-size: .85rem; font-weight: 600; text-decoration: none; background: none; border: 0; color: var(--terracota); padding: 6px 0; }

.saludo { padding: 6px 2px 14px; }
.saludo h1 { font-size: 2.2rem; margin-bottom: 2px; }
.saludo .edad { font-family: var(--f-titulo); font-style: italic; font-size: 1.15rem; color: var(--terracota); }
.saludo .corregida { font-size: .85rem; color: var(--tinta-2); }

/* ---------- Botones ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 12px 18px; min-height: 48px;
  background: var(--papel-2); color: var(--tinta); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn.primario { background: var(--terracota); color: #fffaf2; }
:root[data-tema="noche"] .btn.primario { color: #1d1713; }
.btn.salvia { background: var(--salvia); color: #fffaf2; }
:root[data-tema="noche"] .btn.salvia { color: #1d1713; }
.btn.borde { background: transparent; border: 1.5px solid var(--linea); }
.btn.peligro { background: var(--rojo-suave); color: var(--rojo); }
.btn.ancho { width: 100%; }
.btn.peq { min-height: 40px; padding: 7px 13px; font-size: .9rem; border-radius: 11px; }
.btn[disabled] { opacity: .45; }
.fila-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.fila-btns > .btn { flex: 1; }

.acciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.accion {
  border: 0; border-radius: 20px; min-height: 96px; padding: 12px 6px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: var(--tarjeta); box-shadow: var(--sombra); font-weight: 700; font-size: .98rem; color: var(--tinta);
  position: relative;
}
.accion:active { transform: scale(.97); }
.accion .ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; }
.accion .ico svg { width: 26px; height: 26px; }
.accion small { font-weight: 500; font-size: .72rem; color: var(--tinta-2); line-height: 1.1; }
.accion.toma .ico { background: var(--terracota-suave); color: var(--terracota); }
.accion.panal .ico { background: var(--cielo-suave); color: var(--cielo); }
.accion.dormir .ico { background: var(--salvia-suave); color: var(--salvia); }
.accion.medicina .ico { background: var(--miel-suave); color: var(--miel); }
.accion.fiebre .ico { background: var(--rojo-suave); color: var(--rojo); }
.accion.mas .ico { background: var(--papel-2); color: var(--tinta-2); }
.accion.activa { box-shadow: 0 0 0 3px var(--salvia), var(--sombra); }
.accion.activa.toma { box-shadow: 0 0 0 3px var(--terracota), var(--sombra); }

/* ---------- Pastillas / chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px 6px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1.5px solid var(--linea); background: var(--tarjeta); border-radius: 99px;
  padding: 8px 14px; min-height: 42px; font-weight: 600; font-size: .9rem; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; color: var(--tinta-2); text-decoration: none;
}
.chip[aria-pressed="true"], .chip.on { background: var(--tinta); color: var(--papel); border-color: var(--tinta); }
.pildora { display: inline-block; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--papel-2); color: var(--tinta-2); white-space: nowrap; }
.pildora.salvia { background: var(--salvia-suave); color: var(--salvia); }
.pildora.cielo { background: var(--cielo-suave); color: var(--cielo); }
.pildora.terra { background: var(--terracota-suave); color: var(--terracota); }
.pildora.miel { background: var(--miel-suave); color: var(--miel); }
.pildora.rojo { background: var(--rojo-suave); color: var(--rojo); }

/* ---------- Resumen y datos ---------- */
.ultimos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ultimos .tarjeta { margin: 0; padding: 13px 14px; }
.ultimos .dato { font-family: var(--f-titulo); font-size: 1.2rem; font-weight: 600; line-height: 1.2; }
.ultimos .extra { font-size: .82rem; color: var(--tinta-2); margin-top: 3px; }
.panal-rapido { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 5px; margin-top: 8px; }
.panal-rapido .chip { min-height: 40px; padding: 0; justify-content: center; font-size: .85rem; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cifra { background: var(--papel); border-radius: 12px; padding: 9px 10px; }
.cifra b { display: block; font-family: var(--f-titulo); font-size: 1.3rem; font-weight: 600; line-height: 1.15; }
.cifra span { font-size: .75rem; color: var(--tinta-2); }

.medidor { height: 12px; background: var(--papel-2); border-radius: 99px; position: relative; margin: 10px 0 4px; overflow: hidden; }
.medidor .rango { position: absolute; top: 0; bottom: 0; background: var(--salvia-2); opacity: .45; }
.medidor .valor { position: absolute; top: 3px; height: 6px; left: 0; background: var(--salvia); border-radius: 99px; }

/* ---------- Línea de tiempo ---------- */
.nav-dia { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.nav-dia b { font-family: var(--f-titulo); font-size: 1.05rem; }
.linea-tiempo { list-style: none; margin: 0; padding: 0; }
.linea-tiempo li { margin: 0; }
.evento {
  width: 100%; border: 0; background: transparent; text-align: left;
  display: grid; grid-template-columns: 48px 34px 1fr auto; align-items: center; gap: 8px;
  padding: 9px 2px; border-bottom: 1px dashed var(--linea); min-height: 54px;
}
.evento:active { background: var(--papel-2); }
.evento .h { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--tinta-2); font-size: .9rem; }
.evento .bola { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 1rem; }
.evento .bola svg { width: 18px; height: 18px; }
.evento .que { font-weight: 600; min-width: 0; }
.evento .que small { display: block; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.evento .quien { font-size: .72rem; color: var(--tinta-3); text-align: right; }
.t-toma .bola { background: var(--terracota-suave); color: var(--terracota); }
.t-panal .bola { background: var(--cielo-suave); color: var(--cielo); }
.t-sueno .bola { background: var(--salvia-suave); color: var(--salvia); }
.t-medicina .bola, .t-alimento .bola { background: var(--miel-suave); color: var(--miel); }
.t-fiebre .bola { background: var(--rojo-suave); color: var(--rojo); }
.t-otro .bola { background: var(--papel-2); color: var(--tinta-2); }
.vacio { text-align: center; color: var(--tinta-3); padding: 18px 10px; font-style: italic; font-family: var(--f-titulo); }

/* ---------- Gráficas ---------- */
.grafica { width: 100%; height: auto; display: block; overflow: visible; }
.grafica text { font-family: var(--f-texto); font-size: 10px; fill: var(--tinta-3); }
.grafica .eje { stroke: var(--linea); stroke-width: 1; }
.leyenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--tinta-2); margin-top: 6px; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- Hojas inferiores ---------- */
#capa-hojas { position: relative; z-index: 50; }
.fondo-hoja { position: fixed; inset: 0; background: rgba(40, 25, 15, .4); animation: aparece .18s ease-out; }
.hoja {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--tarjeta); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(18px + var(--seg-abajo));
  animation: sube .24s cubic-bezier(.2, .9, .3, 1);
  max-width: 640px; margin: 0 auto;
}
.hoja::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 99px; background: var(--linea); margin: 0 auto 12px; }
.hoja h2 { margin-bottom: 12px; }
.hoja-tit { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.hoja-tit h2 { margin: 0; }
.hoja-pie { display: flex; gap: 10px; margin: 18px -18px calc(-18px - var(--seg-abajo)); position: sticky; bottom: calc(-18px - var(--seg-abajo)); background: var(--tarjeta); padding: 12px 18px calc(14px + var(--seg-abajo)); border-top: 1px solid var(--linea); }
.hoja-pie .btn { flex: 1; }
@keyframes sube { from { transform: translateY(100%); } }
@keyframes aparece { from { opacity: 0; } }
.saliendo .hoja { transform: translateY(100%); transition: transform .18s ease-in; }
.saliendo .fondo-hoja { opacity: 0; transition: opacity .18s; }

/* ---------- Formularios ---------- */
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: var(--tinta-2); }
input[type="text"], input[type="number"], input[type="password"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 13px; border-radius: 12px;
  border: 1.5px solid var(--linea); background: var(--papel); font-size: 16px; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--tinta-3) 50%), linear-gradient(135deg, var(--tinta-3) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--terracota-2); }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tres-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmentado { display: flex; background: var(--papel-2); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.segmentado button { flex: 1; border: 0; background: transparent; border-radius: 10px; min-height: 44px; font-weight: 600; color: var(--tinta-2); padding: 4px 6px; }
.segmentado button[aria-pressed="true"] { background: var(--tarjeta); color: var(--tinta); box-shadow: var(--sombra); }
.paso { display: flex; align-items: center; gap: 8px; }
.paso input { text-align: center; font-weight: 700; font-size: 1.2rem; }
.paso .btn { min-width: 50px; font-size: 1.3rem; padding: 0; }

/* Cronómetro de pecho */
.pechos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.pecho {
  border: 2px solid var(--linea); background: var(--papel); border-radius: 22px; padding: 14px 8px; min-height: 132px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.pecho b { font-size: 1.05rem; }
.pecho .reloj { font-family: var(--f-titulo); font-size: 2rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.pecho small { font-size: .76rem; }
.pecho.activo { border-color: var(--terracota); background: var(--terracota-suave); }
.pecho.toca:not(.activo) { border-style: dashed; border-color: var(--terracota-2); }
.ml-rapidos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
.ml-rapidos button { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--linea); background: var(--papel); font-weight: 700; font-size: .88rem; padding: 0; }
.ml-rapidos button[aria-pressed="true"] { background: var(--terracota); border-color: var(--terracota); color: #fffaf2; }

/* Pañal en un toque */
.panal-opciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.panal-opciones button { min-height: 116px; border-radius: 22px; border: 0; background: var(--cielo-suave); font-weight: 700; font-size: 1.05rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.panal-opciones button:nth-child(2) { background: var(--miel-suave); }
.panal-opciones button:nth-child(3) { background: var(--salvia-suave); }
.panal-opciones .emo { font-size: 2rem; line-height: 1; }

.lista-mas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lista-mas button { min-height: 86px; border: 0; border-radius: 16px; background: var(--papel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-weight: 600; font-size: .84rem; padding: 6px; line-height: 1.15; }
.lista-mas .emo { font-size: 1.6rem; line-height: 1; }

/* ---------- Avisos ---------- */
#capa-avisos { position: fixed; left: 12px; right: 12px; bottom: calc(var(--alto-nav) + var(--seg-abajo) + 14px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.aviso { pointer-events: auto; background: var(--tinta); color: var(--papel); border-radius: 14px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); max-width: 520px; width: 100%; animation: sube .2s ease-out; font-weight: 500; min-height: 52px; }
.aviso span { flex: 1; }
.aviso button { background: transparent; border: 0; color: var(--terracota-2); font-weight: 700; padding: 8px 12px; min-height: 42px; }
:root[data-tema="noche"] .aviso button { color: var(--terracota); }

/* ---------- Alertas de salud ---------- */
.alerta { border-radius: var(--radio); padding: 14px 16px; margin-bottom: 14px; display: flex; gap: 12px; align-items: flex-start; }
.alerta.urgente { background: var(--rojo); color: #fff6ee; }
:root[data-tema="noche"] .alerta.urgente { background: #8a2f22; color: #fbe6d8; }
.alerta.urgente a { color: inherit; font-weight: 700; }
.alerta.suave { background: var(--miel-suave); }
.alerta.info { background: var(--cielo-suave); }
.alerta.calma { background: var(--salvia-suave); }
.alerta .ico { font-size: 1.4rem; line-height: 1.1; }
.alerta p:last-child, .alerta ul:last-child { margin-bottom: 0; }

/* Semáforo del manual */
.semaforo { display: grid; gap: 10px; margin-top: 10px; }
.semaforo > div { border-radius: 16px; padding: 13px 15px 8px; border-left: 6px solid; }
.semaforo h4 { font-family: var(--f-texto); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.sem-normal { background: var(--cielo-suave); border-color: var(--cielo) !important; }
.sem-casa { background: var(--salvia-suave); border-color: var(--salvia) !important; }
.sem-pediatra { background: var(--miel-suave); border-color: var(--miel) !important; }
.sem-urgencias { background: var(--rojo-suave); border-color: var(--rojo) !important; }

/* ---------- Guía ---------- */
.ficha-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ficha-nav .centro { flex: 1; text-align: center; }
.ficha-nav .centro b { font-family: var(--f-titulo); font-size: 1.35rem; display: block; line-height: 1.2; }
.ficha-bloque h3 { display: flex; align-items: center; gap: 8px; }
.ficha-bloque h3 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--terracota-2); flex: none; }
.desplegable { border-radius: var(--radio); background: var(--tarjeta); box-shadow: var(--sombra); margin-bottom: 10px; overflow: hidden; }
.desplegable summary { list-style: none; padding: 14px 16px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; min-height: 54px; }
.desplegable summary::-webkit-details-marker { display: none; }
.desplegable summary::after { content: "+"; font-size: 1.4rem; color: var(--terracota); font-weight: 400; line-height: 1; }
.desplegable[open] summary::after { content: "–"; }
.desplegable .cuerpo { padding: 0 16px 14px; }

.lista-enlaces { list-style: none; padding: 0; margin: 0; }
.lista-enlaces li { margin: 0; }
.lista-enlaces a, .lista-enlaces button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 13px 4px; min-height: 52px; border: 0; border-bottom: 1px solid var(--linea); background: transparent;
  text-decoration: none; color: var(--tinta); text-align: left; font-weight: 600;
}
.lista-enlaces li:last-child a, .lista-enlaces li:last-child button { border-bottom: 0; }
.lista-enlaces small { display: block; font-weight: 400; color: var(--tinta-2); }
.lista-enlaces a::after { content: "›"; color: var(--tinta-3); font-size: 1.4rem; }
.letra { font-family: var(--f-titulo); color: var(--terracota); font-size: 1.3rem; margin: 18px 4px 2px; }

.mosaico { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mosaico a { text-decoration: none; color: var(--tinta); background: var(--tarjeta); border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); min-height: 112px; display: flex; flex-direction: column; gap: 4px; }
.mosaico a b { font-family: var(--f-titulo); font-size: 1.1rem; }
.mosaico a small { color: var(--tinta-2); line-height: 1.3; }
.mosaico .emo { font-size: 1.6rem; }

/* Hitos */
.hito { padding: 14px 0; border-bottom: 1px solid var(--linea); }
.hito:last-child { border-bottom: 0; }
.hito-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hito-cab b { font-weight: 700; }
.barra-hito { position: relative; height: 26px; margin: 12px 0 2px; }
.barra-hito .pista { position: absolute; top: 9px; left: 0; right: 0; height: 8px; border-radius: 99px; background: var(--papel-2); }
.barra-hito .alg { position: absolute; top: 9px; height: 8px; background: var(--cielo-2); }
.barra-hito .hab { position: absolute; top: 9px; height: 8px; background: var(--salvia); }
.barra-hito .com { position: absolute; top: 3px; width: 3px; height: 20px; margin-left: -1px; background: var(--miel); border-radius: 2px; }
.barra-hito .tu { position: absolute; top: 0; width: 3px; height: 26px; margin-left: -1px; background: var(--terracota); border-radius: 3px; }
.barra-hito .tu::after { content: ""; position: absolute; top: -6px; left: -5px; width: 13px; height: 13px; border-radius: 50%; background: var(--terracota); border: 2px solid var(--tarjeta); }
.escala-hito { display: flex; justify-content: space-between; font-size: .7rem; color: var(--tinta-3); }
.logrado { color: var(--salvia); font-weight: 700; font-size: .85rem; }

/* Sueño: código de barras */
.barras-sueno .fila { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 6px; margin-bottom: 3px; }
.barras-sueno .fila span { font-size: .72rem; color: var(--tinta-3); text-align: right; }
.barras-sueno svg { width: 100%; height: 16px; display: block; border-radius: 4px; background: var(--papel-2); }
.barras-sueno .horas { display: grid; grid-template-columns: 44px 1fr; gap: 6px; font-size: .68rem; color: var(--tinta-3); }
.barras-sueno .horas div { display: flex; justify-content: space-between; }

/* Boca (dientes) */
.boca { max-width: 340px; width: 100%; margin: 0 auto; display: block; }
.boca .diente { cursor: pointer; }
.boca .diente ellipse { fill: var(--papel); stroke: var(--tinta-3); stroke-width: 1.4; }
.boca .diente.salido ellipse { fill: var(--salvia-2); stroke: var(--salvia); }
.boca text { font-size: 8px; fill: var(--tinta-3); font-family: var(--f-texto); pointer-events: none; }

/* Libro */
.capitulo { background: var(--tarjeta); border-radius: 6px 22px 22px 6px; box-shadow: var(--sombra); padding: 22px 18px 18px 22px; margin-bottom: 18px; position: relative; border-left: 6px solid var(--terracota-2); }
.capitulo .num { font-family: var(--f-titulo); font-style: italic; color: var(--terracota); font-size: .95rem; }
.capitulo h2 { font-size: 1.6rem; }
.recuerdo { margin: 14px 0; }
.recuerdo img { width: 100%; border-radius: 14px; display: block; margin-bottom: 8px; background: var(--papel-2); aspect-ratio: 4/3; object-fit: cover; }
.recuerdo .cuando { font-size: .78rem; color: var(--tinta-3); }
.recuerdo b { font-family: var(--f-titulo); font-size: 1.1rem; }
.cifras-mes { font-family: var(--f-titulo); font-style: italic; color: var(--tinta-2); border-top: 1px dashed var(--linea); padding-top: 10px; margin-top: 12px; }

/* Bienvenida / bloqueo */
.portada { min-height: 100dvh; padding: calc(var(--seg-arriba) + 40px) 22px calc(var(--seg-abajo) + 30px); max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; }
.portada .logo { width: 84px; height: 84px; margin-bottom: 18px; }
.portada h1 { font-size: 2.6rem; }
.portada .lema { font-family: var(--f-titulo); font-style: italic; font-size: 1.2rem; color: var(--tinta-2); margin-bottom: 26px; }
.portada .pie { margin-top: auto; padding-top: 20px; }
.teclado-pin { display: grid; grid-template-columns: repeat(3, 72px); justify-content: center; gap: 14px 22px; margin: 18px auto; }
.teclado-pin button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--tarjeta); box-shadow: var(--sombra); font-size: 1.5rem; font-weight: 600; }
.teclado-pin button.sin-fondo { background: transparent; box-shadow: none; font-size: 1rem; }
.puntos-pin { display: flex; gap: 14px; justify-content: center; margin: 10px 0; min-height: 18px; }
.puntos-pin i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--tinta-3); }
.puntos-pin i.on { background: var(--terracota); border-color: var(--terracota); }
.puntos-pin.error { animation: tiembla .35s; }
@keyframes tiembla { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.casilla { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-weight: 500; min-height: 48px; }
.casilla input { width: 24px; height: 24px; accent-color: var(--terracota); flex: none; }

/* Buscador */
.buscador { position: sticky; top: calc(var(--seg-arriba) + 65px); z-index: 10; background: var(--papel); padding: 4px 0 10px; }
.resultado { display: block; text-decoration: none; color: var(--tinta); padding: 12px 4px; border-bottom: 1px solid var(--linea); }
.resultado b { display: block; }
.resultado small { color: var(--tinta-2); }
mark { background: var(--miel-suave); color: inherit; border-radius: 3px; padding: 0 2px; }

/* Lista de comprobación */
.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--linea); width: 100%; background: transparent; text-align: left; min-height: 52px; }
.check:last-child { border-bottom: 0; }
.check .caja { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--tinta-3); flex: none; display: grid; place-items: center; margin-top: 1px; color: #fffaf2; }
.check.hecho .caja { background: var(--salvia); border-color: var(--salvia); }
.check.hecho .caja::after { content: "✓"; font-weight: 800; }
.check .txt { flex: 1; min-width: 0; }
.check .txt small { display: block; color: var(--tinta-2); }

/* Fotos */
.foto-previa { width: 100%; max-height: 300px; object-fit: cover; border-radius: 14px; margin-top: 8px; display: block; }
.subir-foto { display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--linea); border-radius: 14px; min-height: 64px; color: var(--tinta-2); font-weight: 600; cursor: pointer; }
.subir-foto input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.solo-imprimir { display: none; }

/* Impresión del libro */
@media print {
  .solo-imprimir { display: block; }
  @page { margin: 16mm; }
  :root { --papel: #fff; --tarjeta: #fff; --tinta: #222; }
  body::before, .cabecera, .nav, #capa-avisos, .no-imprimir { display: none !important; }
  main.vista { padding: 0; max-width: none; }
  .capitulo { box-shadow: none; break-inside: avoid-page; border-left-color: #c4623f; }
  .recuerdo { break-inside: avoid; }
  .recuerdo img { max-height: 90mm; width: auto; max-width: 100%; }
}

@media (min-width: 700px) {
  .acciones { grid-template-columns: repeat(6, 1fr); }
  .lista-mas { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
