/* Portal Dra. Torres — estilo moderno y limpio (tipografía del sistema, vidrio, tarjetas suaves). Color principal: petróleo de la doctora. */
:root {
  --p: #355A64; --p-hover: #2E4F58; --p-suave: rgba(53, 90, 100, .10); --p-medio: rgba(53, 90, 100, .18);
  --tinta: #1D1D1F; --gris: #6E7779; --gris2: #A3ABAD; --sep: rgba(60, 70, 72, .12);
  --fondo: #F3F5F5; --tarjeta: #FFFFFF; --oro: #B8965A; --oro-suave: rgba(196, 164, 100, .16); --rojo: #C2483D;
  --r: 22px; --sombra: 0 1px 1px rgba(0,0,0,.03), 0 4px 14px rgba(20,40,45,.06); --sombra-alta: 0 12px 40px rgba(20,40,45,.16);
  --fuente: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body.ep-body { margin: 0; background: var(--fondo); color: var(--tinta); font: 17px/1.47 var(--fuente); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body.ep-bloqueo { overflow: hidden; }
.ep-body h1, .ep-body h2, .ep-body h3, .ep-body h4 { font-family: var(--fuente); margin: 0; color: var(--tinta); letter-spacing: -.022em; }
.ep-body button { font-family: inherit; cursor: pointer; letter-spacing: inherit; }
.i { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.i.lleno { fill: currentColor; }
.i.grande { width: 52px; height: 52px; stroke-width: 1.3; color: var(--gris2); }

/* Entrada sin enlace */
.ep-login { max-width: 400px; margin: 16vh auto; padding: 40px 28px; background: var(--tarjeta); border-radius: 28px; text-align: center; box-shadow: var(--sombra-alta); }
.ep-login h2 { font-size: 26px; font-weight: 700; margin: 16px 0 8px; }
.ep-login p { color: var(--gris); }

.ep-app { max-width: 720px; margin: 0 auto; padding: 0 20px calc(110px + env(safe-area-inset-bottom)); }

/* Título grande */
.ep-cab { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: flex-end; padding: 28px 0 18px; }
.ep-cab img { width: 38px; height: 38px; opacity: .9; }
.ep-cab b { display: block; font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.ep-cab small { display: block; color: var(--gris); font-size: 15px; margin-top: 4px; }

/* Barra flotante de vidrio */
.ep-nav { position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); width: min(460px, calc(100% - 24px)); display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; border-radius: 28px;
  background: rgba(255,255,255,.72); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px); box-shadow: 0 0 0 .5px rgba(0,0,0,.06), 0 10px 30px rgba(20,40,45,.14); }
.ep-nav button { position: relative; border: 0; background: none; padding: 8px 2px 6px; border-radius: 22px; font-size: 11px; font-weight: 600; color: var(--gris); display: flex; flex-direction: column; align-items: center; gap: 3px; transition: background .2s, color .2s; }
.ep-nav .i { width: 24px; height: 24px; }
.ep-nav button[aria-current=true] { color: var(--p); background: var(--p-suave); }
.ep-nav i { position: absolute; top: 3px; left: calc(50% + 6px); font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rojo); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }

/* Inicio */
.ep-intro { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 14px; }
.ep-paso { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; background: var(--tarjeta); border-radius: var(--r); padding: 20px; margin-bottom: 12px; box-shadow: var(--sombra); }
.ep-paso-n { width: 44px; height: 44px; border-radius: 14px; background: var(--fondo); color: var(--gris); display: grid; place-items: center; font-weight: 700; font-size: 18px; grid-row: span 2; align-self: start; }
.ep-paso.alerta .ep-paso-n { background: var(--p); color: #fff; }
.ep-paso.hecho .ep-paso-n { background: var(--p-suave); color: var(--p); }
.ep-paso h3 { font-size: 19px; font-weight: 600; }
.ep-paso p { margin: 2px 0 0; color: var(--gris); font-size: 15px; }
.ep-paso p b { color: var(--tinta); }
.ep-paso .ep-btn { grid-column: 2; justify-self: start; margin-top: 10px; }

/* Temas */
.ep-ayuda { color: var(--gris); font-size: 15px; margin: -4px 0 14px; }
.ep-ayuda b { color: var(--tinta); font-weight: 600; }
.ep-busca { display: flex; align-items: center; gap: 8px; background: rgba(118,118,128,.12); border-radius: 12px; padding: 0 12px; color: var(--gris); }
.ep-busca input { flex: 1; border: 0; background: none; padding: 11px 0; font: 17px var(--fuente); color: var(--tinta); outline: none; -webkit-appearance: none; }
.ep-chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.ep-chips-scroll::-webkit-scrollbar { display: none; }
.ep-chips-scroll button { flex: none; border: 0; background: var(--tarjeta); color: var(--tinta); border-radius: 999px; padding: 8px 16px; font-size: 15px; font-weight: 500; box-shadow: var(--sombra); transition: .2s; }
.ep-chips-scroll button[aria-pressed=true] { background: var(--tinta); color: #fff; }
.ep-cuenta { color: var(--gris2); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 14px 4px 10px; }
.ep-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ep-tarjeta { background: var(--tarjeta); border: 0; border-radius: var(--r); box-shadow: var(--sombra); display: flex; flex-direction: column; overflow: hidden; text-align: left; color: inherit; padding: 0; font: inherit; transition: transform .15s, box-shadow .2s; }
.ep-tarjeta:active { transform: scale(.985); }
.ep-tarjeta.escogido { box-shadow: 0 0 0 2px var(--p), var(--sombra); }
.ep-tarjeta-txt { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 14px; cursor: pointer; flex: 1; }
button.ep-tarjeta.ep-tarjeta-txt { background: var(--tarjeta); border-radius: var(--r); box-shadow: var(--sombra); }
.ep-tarjeta h3 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.ep-tarjeta p { margin: 0; color: var(--gris); font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-etq { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--p); }
.ep-leer { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 500; color: var(--p); margin-top: 4px; }
.ep-leer .i { width: 16px; height: 16px; }
.ep-elegir { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px 14px; }
.ep-elegir button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: var(--p-suave); color: var(--p); border-radius: 14px; padding: 11px 6px; font-weight: 600; font-size: 15px; transition: background .2s, color .2s, transform .1s; }
.ep-elegir button:active { transform: scale(.96); }
.ep-elegir button[aria-pressed=true] { background: var(--p); color: #fff; }
.ep-elegir.grande { padding: 0; } .ep-elegir.grande button { padding: 15px 6px; font-size: 17px; border-radius: 16px; }

/* Mis temas */
.ep-grupo { font-size: 13px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .04em; margin: 22px 4px 10px; }
.ep-grupo small { color: var(--gris2); }
.ep-estado { align-self: flex-start; display: inline-flex; font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--fondo); color: var(--gris); margin-top: 8px; }
.ep-estado.revisar { background: var(--oro-suave); color: #8A6A2E; }
.ep-estado.listo { background: var(--p-suave); color: var(--p); }
button.ep-tarjeta.revisar { box-shadow: 0 0 0 2px var(--oro), var(--sombra); }

/* Diseños */
.ep-grilla.fotos { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.ep-foto { border: 0; background: var(--tarjeta); border-radius: var(--r); padding: 8px 8px 14px; display: flex; flex-direction: column; gap: 4px; text-align: left; box-shadow: var(--sombra); position: relative; color: inherit; }
.ep-foto img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 15px; margin-bottom: 6px; }
.ep-foto .ep-estado { position: absolute; top: 16px; left: 16px; margin: 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); background: rgba(255,255,255,.85); }
.ep-foto b { font-size: 15px; font-weight: 600; line-height: 1.3; padding: 0 6px; }
.ep-foto small { color: var(--gris); font-size: 13px; padding: 0 6px; }
.ep-laminas { display: flex; flex-direction: column; gap: 14px; }
.ep-laminas figure { margin: 0; position: relative; }
.ep-laminas img { width: 100%; border-radius: 18px; display: block; box-shadow: var(--sombra); }
.ep-laminas figcaption { position: absolute; top: 12px; left: 12px; background: rgba(29,29,31,.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; font-weight: 600; font-size: 13px; border-radius: 999px; padding: 3px 11px; }

/* Hoja estilo iOS */
.ep-velo { position: fixed; inset: 0; background: rgba(0,0,0,.28); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 20; animation: ep-fundido .25s; }
.ep-hoja { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; height: 93vh; height: 93dvh; background: var(--fondo); border-radius: 28px 28px 0 0; display: flex; flex-direction: column; animation: ep-sube .38s cubic-bezier(.2,.9,.3,1); box-shadow: var(--sombra-alta); overflow: hidden; }
@media (min-width: 760px) { .ep-hoja { top: 4vh; bottom: 4vh; height: auto; border-radius: 28px; } }
@keyframes ep-sube { from { transform: translateY(100%); } }
@keyframes ep-fundido { from { opacity: 0; } }
.ep-agarre { width: 38px; height: 5px; border-radius: 3px; background: rgba(60,60,67,.25); margin: 8px auto 0; flex: none; }
.ep-hoja-cab { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 6px; }
.ep-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(118,118,128,.14); color: var(--gris); display: grid; place-items: center; }
.ep-x .i { width: 16px; height: 16px; stroke-width: 2.4; }
.ep-hoja-cuerpo { flex: 1; overflow-y: auto; padding: 6px 20px 28px; display: flex; flex-direction: column; gap: 18px; -webkit-overflow-scrolling: touch; }
.ep-hoja-cuerpo > * { flex-shrink: 0; }
.ep-hoja-cuerpo h2 { font-size: 28px; font-weight: 700; line-height: 1.15; }
.ep-hoja-pie { background: rgba(255,255,255,.8); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.ep-hoja-pie p { margin: 0; text-align: center; font-size: 14px; color: var(--gris); }
.ep-hoja-pie p b { color: var(--tinta); }
.ep-hoja-pie.fila { flex-direction: row; } .ep-hoja-pie.fila .ep-btn { flex: 1; }
.ep-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ep-chip { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--tarjeta); color: var(--gris); box-shadow: var(--sombra); }
.ep-chip.fuerte { background: var(--p); color: #fff; }
.ep-dato { background: var(--tarjeta); border-radius: 18px; padding: 16px 18px; box-shadow: var(--sombra); }
.ep-dato b { display: block; font-size: 13px; font-weight: 600; color: var(--gris); margin-bottom: 4px; }
.ep-dato p { margin: 0; font-size: 17px; }
.ep-dato.cita p { font-style: italic; color: #3A4446; }
.ep-dato.validar { background: #FFF8EC; box-shadow: 0 0 0 1px rgba(196,164,100,.35); }
.ep-dato.validar b { color: #8A6A2E; }
.ep-fuentes { margin: 8px 0 0; padding-left: 18px; font-size: 14px; word-break: break-all; }
.ep-fuentes a { color: var(--p); }

/* Revisor de speech */
.ep-pasos { display: flex; gap: 6px; background: rgba(118,118,128,.12); border-radius: 14px; padding: 4px; }
.ep-pasos button { flex: 1; height: 38px; border-radius: 10px; border: 0; background: none; font-weight: 600; font-size: 15px; color: var(--gris); display: grid; place-items: center; transition: .2s; }
.ep-pasos button .i { width: 17px; height: 17px; stroke-width: 2.4; color: var(--p); }
.ep-pasos button[aria-current=true] { background: var(--tarjeta); color: var(--tinta); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.ep-pasos .fin { flex: 1.6; }
.ep-guion { background: var(--tarjeta); border-radius: var(--r); padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--sombra); transition: box-shadow .2s; }
.ep-guion.ok { box-shadow: 0 0 0 2px var(--p), var(--sombra); }
.ep-guion h3 { font-size: 22px; font-weight: 700; }
.ep-parte span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--gris2); margin-bottom: 4px; }
.ep-parte p { margin: 0; font-size: 19px; line-height: 1.55; }
.ep-resumen { background: var(--tarjeta); border-radius: var(--r); padding: 20px; box-shadow: var(--sombra); }
.ep-resumen h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.ep-resumen p { margin: 8px 0; display: flex; align-items: center; gap: 8px; color: var(--gris); }
.ep-resumen p b { color: var(--tinta); }
.ep-resumen .i { color: var(--p); }

/* Controles */
.ep-cambios { background: var(--tarjeta); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--sombra); }
.ep-cambios > b { font-size: 17px; font-weight: 600; }
.ep-body textarea { width: 100%; min-height: 54px; padding: 12px 14px; border: 0; border-radius: 14px; font: 17px/1.5 var(--fuente); background: rgba(118,118,128,.10); resize: none; overflow: hidden; color: var(--tinta); transition: box-shadow .2s, background .2s; }
.ep-body textarea::placeholder, .ep-busca input::placeholder { color: var(--gris2); }
.ep-body textarea:focus { outline: none; background: #fff; box-shadow: 0 0 0 2px var(--p); }
.ep-parte textarea { background: #FFF8EC; }
.ep-acc { display: flex; flex-wrap: wrap; gap: 8px; }
.ep-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: var(--p-suave); color: var(--p); border-radius: 999px; padding: 11px 20px; min-height: 44px; font-weight: 600; font-size: 16px; transition: background .2s, transform .1s; }
.ep-btn:active { transform: scale(.97); }
.ep-btn.primario { background: var(--p); color: #fff; }
.ep-btn.primario:hover { background: var(--p-hover); }
.ep-btn.grande { min-height: 52px; font-size: 17px; border-radius: 16px; }
.ep-btn.ancho { width: 100%; margin-top: 16px; background: var(--tarjeta); box-shadow: var(--sombra); }
.ep-btn.grabando { background: var(--rojo); color: #fff; }
.ep-btn:disabled { opacity: .5; }
.ep-punto { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: ep-pulso 1s infinite; }
@keyframes ep-pulso { 50% { opacity: .3; } }
.ep-link { background: none; border: 0; padding: 10px 0; font-weight: 500; font-size: 16px; color: var(--gris); align-self: center; }
.ep-link.rojo { color: var(--rojo); }
.ep-audios { display: flex; flex-direction: column; gap: 6px; }
.ep-audios audio { width: 100%; height: 40px; }
.ep-audios small { display: flex; align-items: center; gap: 4px; color: var(--p); font-weight: 600; font-size: 14px; }
.ep-audios small .i { width: 16px; height: 16px; }
details.ep-mas { background: var(--tarjeta); border-radius: 18px; padding: 14px 18px; box-shadow: var(--sombra); }
details.ep-mas summary { cursor: pointer; color: var(--p); font-weight: 600; font-size: 16px; list-style: none; }
details.ep-mas summary::after { content: ' ›'; }
details.ep-mas[open] summary::after { content: ' ⌄'; }
.ep-vacio { text-align: center; color: var(--gris); padding: 40px 20px; }
.ep-vacio.grande { background: var(--tarjeta); border-radius: var(--r); box-shadow: var(--sombra); padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ep-vacio.grande h3 { font-size: 21px; font-weight: 700; margin-top: 6px; }
.ep-vacio.grande p { margin: 0 0 10px; }
.ep-suave { color: var(--gris); font-size: 15px; }

/* Aviso tipo iOS (arriba) */
#ep-aviso { position: fixed; z-index: 40; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -24px) scale(.96); background: rgba(29,29,31,.86); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 15px; max-width: 92vw; text-align: center; opacity: 0; pointer-events: none; transition: .35s cubic-bezier(.2,.9,.3,1); box-shadow: 0 10px 30px rgba(0,0,0,.2); }
#ep-aviso.ver { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Bienvenida */
.ep-bienvenida { position: fixed; z-index: 30; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, 92vw); background: var(--tarjeta); border-radius: 30px; padding: 32px 26px 24px; text-align: center; box-shadow: var(--sombra-alta); animation: ep-aparece .4s cubic-bezier(.2,.9,.3,1); }
@keyframes ep-aparece { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
.ep-bienvenida h2 { font-size: 26px; font-weight: 700; margin: 14px 0 6px; }
.ep-bienvenida > p { color: var(--gris); margin: 6px 0; }
.ep-bienvenida ol { text-align: left; padding: 0; margin: 18px 0; list-style: none; counter-reset: n; display: flex; flex-direction: column; gap: 12px; }
.ep-bienvenida li { counter-increment: n; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; font-size: 16px; }
.ep-bienvenida li::before { content: counter(n); width: 32px; height: 32px; border-radius: 10px; background: var(--p-suave); color: var(--p); font-weight: 700; display: grid; place-items: center; }
.ep-bienvenida .ep-btn { width: 100%; margin-top: 10px; }
.ep-bienvenida { max-height: 90vh; overflow-y: auto; }
.ep-bienvenida li span { padding-top: 4px; }
.ep-hoja-pie.fila .ep-btn { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
