/* Pétalo — estilos. Rosa y blanco, suave y redondeado, con modo oscuro y tema verde. */

@font-face { font-family: "Fraunces"; font-weight: 500; font-display: swap; src: url(../fonts/fraunces-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 600; font-display: swap; src: url(../fonts/fraunces-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url(../fonts/nunito-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url(../fonts/nunito-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url(../fonts/nunito-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url(../fonts/nunito-latin-800-normal.woff2) format("woff2"); }

:root {
  --bg: #FFF7F9; --surface: #FFFFFF; --surface2: #FDEBF0; --line: #F2D2DC;
  --ink: #4A2733; --muted: #85626E; --rose: #E04F7B; --rose-ink: #B8325C; --on-rose: #FFFFFF;
  --mens: #E04F7B; --foli: #F5A98F; --ovu: #C77DD6; --lut: #9A8FD8; --fert: #EBD3F2;
  --ok: #2F8F6B; --warn: #B7791F; --warnbg: #FFF1D6;
  --shadow: 0 6px 24px rgba(184, 50, 92, .10);
  --display: "Fraunces", Georgia, serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1D1217; --surface: #2A1A21; --surface2: #3A2430; --line: #4A2F3B;
    --ink: #FBE9EE; --muted: #C9A5B1; --rose: #F0709A; --rose-ink: #FF9DBB; --on-rose: #2A1019;
    --fert: #4B2F55; --ok: #6CD1A6; --warn: #F0C070; --warnbg: #3A2C14; --shadow: 0 6px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1D1217; --surface: #2A1A21; --surface2: #3A2430; --line: #4A2F3B;
  --ink: #FBE9EE; --muted: #C9A5B1; --rose: #F0709A; --rose-ink: #FF9DBB; --on-rose: #2A1019;
  --fert: #4B2F55; --ok: #6CD1A6; --warn: #F0C070; --warnbg: #3A2C14; --shadow: 0 6px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

/* Tema verde: negro con verde esmeralda/menta. Las ilustraciones rosas (SVG en línea) se giran de tono con un filtro. */
:root[data-theme="green"] {
  --bg: #07120D; --surface: #0F1F17; --surface2: #17301F; --line: #24432F;
  --ink: #E8F7EE; --muted: #9DC2AC; --rose: #3DDC97; --rose-ink: #6FE8B2; --on-rose: #04130B;
  --mens: #FF7A93; --foli: #E3C766; --ovu: #3DDC97; --lut: #7FB4F2; --fert: #1D4A33;
  --ok: #6CD1A6; --warn: #F0C070; --warnbg: #2E2A10; --shadow: 0 6px 24px rgba(0,0,0,.5);
  color-scheme: dark;
}
:root[data-theme="green"] .cal button.regla, :root[data-theme="green"] .cal button.ovulacion { color: #04130B; }
:root[data-theme="green"] .cal button.regla .m, :root[data-theme="green"] .cal button.ovulacion .m { background: #04130B; }
:root[data-theme="green"] .ilus, :root[data-theme="green"] .ilus-fila svg { filter: hue-rotate(175deg) saturate(.85); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--rose-ink); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .7em; }
small, .mut { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; border-radius: 8px; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
main { padding: 0 16px 24px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 16px 12px; }
.top .titulo small { display: block; font-size: .85rem; }
.top .titulo b { font-family: var(--display); font-size: 1.45rem; font-weight: 600; }
.av { width: 42px; height: 42px; border-radius: 50%; background: var(--surface2); display: grid; place-items: center; font-weight: 800; color: var(--rose-ink); border: none; flex: none; }
.icono-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--surface2); display: grid; place-items: center; color: var(--ink); flex: none; }
.icono-btn svg { width: 22px; height: 22px; }

/* Tarjetas */
.c { background: var(--surface); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.c.suave { background: var(--surface2); box-shadow: none; }
.c h3 { margin-bottom: .5em; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row .c { margin-bottom: 0; }
.big { font-family: var(--display); font-size: 1.35rem; font-weight: 600; }
.etq { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface2); font-size: .85rem; font-weight: 700; }
.pill.on { background: var(--rose); color: var(--on-rose); }
.sep { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* Botones */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border-radius: 999px; border: none; background: var(--rose); color: var(--on-rose); font-weight: 800; font-size: 1.02rem; padding: 12px 20px; transition: transform .12s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.sec { background: var(--surface2); color: var(--rose-ink); }
.btn.borde { background: transparent; border: 2px solid var(--line); color: var(--ink); }
.btn.peligro { background: transparent; border: 2px solid var(--mens); color: var(--mens); }
.btn.chico { min-height: 40px; padding: 8px 16px; font-size: .92rem; width: auto; }
.btn[disabled] { opacity: .5; }
.botones { display: flex; gap: 10px; flex-wrap: wrap; }
.botones .btn { flex: 1; }
.link { background: none; border: none; color: var(--rose-ink); font-weight: 700; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }

/* Tarjeta-widget de inicio */
.widget { position: relative; border-radius: 30px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); padding: 18px 18px 20px; text-align: center; margin-bottom: 14px; }
.widget .marco { position: relative; width: min(64vw, 250px); aspect-ratio: 1; margin: 4px auto 10px; }
.widget .anillo { position: absolute; inset: 0; width: 100%; height: 100%; }
.widget .centro { position: absolute; inset: 13%; border-radius: 50%; overflow: hidden; background: var(--surface2); }
.widget .centro .ilus, .widget .centro img { width: 100%; height: 100%; object-fit: cover; display: block; }
.widget .dia { font-family: var(--display); font-size: 2.1rem; font-weight: 600; line-height: 1; margin-bottom: 6px; }
.widget .foto-tag { position: absolute; top: 14px; right: 14px; }
.widget .frase { margin-top: 10px; color: var(--muted); font-size: .95rem; }
.ilus { display: block; }

.riesgo { border-left: 6px solid var(--line); }
.riesgo.alto { border-left-color: var(--mens); background: var(--surface2); }
.riesgo.medio { border-left-color: var(--ovu); }
.riesgo.bajo { border-left-color: var(--ok); }
.riesgo.revisar { border-left-color: var(--warn); background: var(--warnbg); }
.aviso { background: var(--warnbg); border-radius: 16px; padding: 12px 14px; font-size: .92rem; margin-bottom: 14px; }
.aviso b { color: var(--warn); }

/* Barra inferior */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.tabbar .in { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .74rem; font-weight: 700; color: var(--muted); text-decoration: none; padding: 6px 0; min-height: 52px; justify-content: center; position: relative; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.act { color: var(--rose-ink); }
.tabbar a .punto { position: absolute; top: 4px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--mens); }
.tabbar .mas { display: grid; place-items: center; }
.tabbar .mas span { width: 58px; height: 58px; border-radius: 50%; background: var(--rose); color: var(--on-rose); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(224,79,123,.4); margin-top: -22px; }
.tabbar .mas svg { width: 28px; height: 28px; }

/* Hoja inferior (registro y diálogos) */
.velo { position: fixed; inset: 0; background: rgba(42, 16, 25, .45); z-index: 40; opacity: 0; transition: opacity .2s; }
.velo.abierto { opacity: 1; }
.hoja { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow: auto; background: var(--bg); border-radius: 28px 28px 0 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .25s ease; max-width: 560px; margin: 0 auto; }
.hoja.abierta { transform: none; }
.hoja .asa { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 10px; }
.hoja .cab { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -8px; background: var(--bg); padding: 6px 0 10px; z-index: 2; }

/* Registro */
.grupo { margin-bottom: 18px; }
.grupo > .etq { display: block; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 14px; min-height: 44px; font-weight: 700; font-size: .93rem; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
.chip.flujo[aria-pressed="true"] { background: var(--mens); border-color: var(--mens); }
.gotas { display: inline-flex; gap: 1px; }
.escala { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.escala button { min-height: 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; }
.escala button[aria-pressed="true"] { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label, .campo .etq { font-weight: 700; font-size: .92rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="password"], input[type="tel"], select, textarea {
  width: 100%; min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); padding: 10px 14px; font-size: 1rem;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rose); }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.candado { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); font-weight: 700; }

/* Interruptores */
.ajuste { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.ajuste:last-child { border-bottom: none; }
.ajuste .txt { flex: 1; }
.ajuste .txt small { display: block; }
.ajuste.nav { background: none; border: none; border-bottom: 1px solid var(--line); width: 100%; text-align: left; font-weight: 700; color: var(--ink); text-decoration: none; }
.sw { position: relative; width: 52px; height: 32px; flex: none; }
.sw input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 1; cursor: pointer; }
.sw span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.sw span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sw input:checked + span { background: var(--rose); }
.sw input:checked + span::after { transform: translateX(20px); }

/* Calendario */
.cal-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-cab b { font-family: var(--display); font-size: 1.3rem; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .dn { font-size: .75rem; font-weight: 800; color: var(--muted); padding: 4px 0; }
.cal button { position: relative; aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; background: none; font-weight: 700; display: grid; place-items: center; font-size: .95rem; padding: 0; }
.cal button.fuera { visibility: hidden; }
.cal button.regla { background: var(--mens); color: #fff; }
.cal button.prevista { border: 2px dashed var(--mens); color: var(--mens); }
.cal button.fertil { background: var(--fert); }
.cal button.ovulacion { background: var(--ovu); color: #fff; }
.cal button.pasado-fertil { background: color-mix(in srgb, var(--fert) 50%, transparent); }
.cal button.hoy { box-shadow: 0 0 0 2px var(--ink); }
.cal button.sel { outline: 3px solid var(--rose); outline-offset: 1px; }
.cal button .m { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--rose-ink); }
.cal button.regla .m, .cal button.ovulacion .m { background: #fff; }
.cal button .pt { position: absolute; top: 1px; right: 3px; font-size: .55rem; }
.leyenda { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; color: var(--muted); margin-top: 12px; font-weight: 700; }
.leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* Pastilla */
.blister { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 12px 0; }
.blister .p { aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--rose); display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: none; color: var(--ink); padding: 0; }
.blister .p.tomada { background: var(--rose); color: var(--on-rose); }
.blister .p.descanso, .blister .p.placebo { border-style: dashed; border-color: var(--muted); color: var(--muted); }
.blister .p.placebo.tomada { background: var(--muted); color: var(--bg); }
.blister .p.hoy { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.blister .p.olvido { border-color: var(--warn); color: var(--warn); }

/* Pareja */
.codigo { font-family: var(--display); font-size: 2.3rem; letter-spacing: .2em; text-align: center; padding: 10px 0 2px; font-weight: 600; }
.mensajes { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.msg { align-self: flex-start; background: var(--surface2); padding: 8px 12px; border-radius: 16px 16px 16px 4px; max-width: 80%; }
.msg.mio { align-self: flex-end; background: var(--rose); color: var(--on-rose); border-radius: 16px 16px 4px 16px; }
.msg small { display: block; font-size: .7rem; opacity: .75; }

/* Fotos por etapa */
.fotos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fotos button { border: none; background: none; padding: 0; text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); }
.fotos .mini { position: relative; aspect-ratio: 1; border-radius: 20px; overflow: hidden; margin-bottom: 4px; background: var(--surface2); }
.fotos .mini img, .fotos .mini svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotos .mini .mas { position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--rose); color: var(--on-rose); display: grid; place-items: center; font-size: 16px; line-height: 1; }

/* Onboarding y entrada */
.entrada { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
.entrada .hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.entrada .hero .ilus-fila { display: flex; gap: 8px; margin: 18px 0; }
.entrada .hero .ilus-fila svg { width: 64px; height: 64px; }
.progreso { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 10px 0 20px; }
.progreso i { display: block; height: 100%; background: var(--rose); border-radius: 3px; transition: width .25s; }
.opciones { display: flex; flex-direction: column; gap: 10px; }
.opcion { text-align: left; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); padding: 14px 16px; min-height: 56px; }
.opcion b { display: block; }
.opcion small { display: block; }
.opcion[aria-pressed="true"] { border-color: var(--rose); background: var(--surface2); }
.pie { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.check input { width: 22px; height: 22px; accent-color: var(--rose); flex: none; margin-top: 2px; }

/* Banners y avisos flotantes */
.banner { position: sticky; top: 0; z-index: 30; background: var(--ink); color: var(--bg); padding: calc(14px + env(safe-area-inset-top)) 16px 14px; box-shadow: var(--shadow); flex-wrap: wrap; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .92rem; }
.banner .t { flex: 1 1 180px; font-size: 1rem; }
.banner button { border: none; border-radius: 999px; padding: 8px 14px; font-weight: 800; min-height: 40px; }
.banner .si { background: var(--rose); color: var(--on-rose); }
.banner .no { background: transparent; color: var(--bg); }
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 700; z-index: 60; opacity: 0; transition: all .25s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.ver { opacity: 1; transform: translateX(-50%); }

/* Bloqueo con PIN y pantalla de pánico */
.bloqueo { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.puntos { display: flex; gap: 14px; margin: 8px 0 16px; }
.puntos i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rose); }
.puntos i.on { background: var(--rose); }
.teclado { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.teclado button { height: 76px; border-radius: 50%; border: none; background: var(--surface2); font-size: 1.6rem; font-weight: 700; }
.teclado button.vacio { visibility: hidden; }
.panico { position: fixed; inset: 0; z-index: 90; background: #fff; color: #222; padding: calc(30px + env(safe-area-inset-top)) 22px; font-family: system-ui, sans-serif; }
.panico h1 { font-family: system-ui, sans-serif; font-size: 1.6rem; color: #222; }
.panico li { padding: 12px 0; border-bottom: 1px solid #eee; list-style: none; }
.panico ul { padding: 0; }

/* Gráficos */
.grafico svg { width: 100%; height: auto; display: block; }
.barra-h { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: .9rem; }
.barra-h .b { flex: 1; height: 10px; border-radius: 5px; background: var(--surface2); overflow: hidden; }
.barra-h .b i { display: block; height: 100%; background: var(--lut); border-radius: 5px; }

.consejo { display: flex; gap: 12px; align-items: flex-start; }
.consejo .ic { width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 1.3rem; }
.lista-ciclos .item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lista-ciclos .item:last-child { border-bottom: none; }

.vacio-estado { text-align: center; padding: 22px 8px; }
.vacio-estado svg { width: 110px; height: 110px; margin: 0 auto 10px; }

/* Reporte para la médica (se imprime como PDF) */
.reporte { background: #fff; color: #222; padding: 24px; font-family: var(--body); }
.reporte h1 { color: #B8325C; }
.reporte table { width: 100%; border-collapse: collapse; margin: 10px 0 18px; font-size: .9rem; }
.reporte th, .reporte td { border-bottom: 1px solid #eee; padding: 6px 8px; text-align: left; }
@media print {
  body { background: #fff; }
  .tabbar, .top, .banner, .no-print, #vista > :not(.reporte) { display: none !important; }
  #app { padding: 0; max-width: none; }
  main { padding: 0; }
  .reporte { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main > * { animation: aparecer .25s ease both; }
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.latido { animation: latido 1.6s ease-in-out infinite; }
