:root { --navy: #14347d; --navy2: #0e2763; --azul: #2563eb; --mag: #e21771; --mag2: #ff4fa3; --amarillo: #facc15; --fondo: #f3f4f6;
  --tinta: #111827; --gris: #4b5563; --gris2: #9ca3af; --linea: #e5e7eb; --cielo: #eef4ff; --verde: #16a34a; --rosa: #fdf2f8; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font: 16px/1.45 'DM Sans', -apple-system, 'Segoe UI', Roboto, system-ui, sans-serif; background: var(--fondo); color: var(--tinta); min-height: 100vh; }
h1, h2, h3, .poppins { font-family: 'Poppins', 'DM Sans', system-ui, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.envase { max-width: 560px; margin: 0 auto; }

.barra { background: var(--navy); color: #fff; padding: 14px 16px 16px; position: sticky; top: 0; z-index: 5; }
.barra .fila { display: flex; align-items: center; gap: 10px; }
.barra .volver { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 18px; flex: none; text-decoration: none; }
.barra h1 { font-size: 19px; font-weight: 800; line-height: 1.15; }
.barra h1 span { color: var(--amarillo); }
.barra small { display: block; font-size: 12.5px; font-weight: 600; opacity: .8; margin-top: 2px; }
main { padding: 14px 16px 40px; }

.paso { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; color: var(--navy); text-transform: uppercase; letter-spacing: .6px; margin: 18px 2px 10px; }
.paso i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--mag); color: #fff; display: grid; place-items: center; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 13px; border-radius: 99px; background: #fff; border: 1.5px solid var(--linea); font-size: 14px; font-weight: 600; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.lesiones { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lesion { background: #fff; border: 2px solid transparent; border-radius: 14px; overflow: hidden; text-align: left; box-shadow: 0 1px 4px rgba(20,52,125,.08); }
.lesion img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--cielo); }
.lesion b { display: block; padding: 8px 10px 10px; font-size: 13.5px; line-height: 1.25; }
.lesion.on { border-color: var(--mag); }
.lesion.on b { color: var(--mag); }

.fases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fase { background: #fff; border: 1.5px solid var(--linea); border-radius: 12px; padding: 8px 3px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--gris); line-height: 1.2; }
.fase b { display: block; font-size: 20px; color: var(--tinta); font-family: 'Poppins', sans-serif; }
.fase.on { border-color: var(--mag); background: var(--rosa); color: var(--mag); }
.fase.on b { color: var(--mag); }
.ayuda { font-size: 13.5px; color: var(--gris); margin-top: 8px; }

label.campo { display: block; font-size: 13px; font-weight: 700; color: var(--gris); margin: 10px 2px 5px; }
input[type=text], textarea { width: 100%; font: inherit; padding: 12px 13px; border: 1.5px solid var(--linea); border-radius: 12px; background: #fff; color: var(--tinta); }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--azul); }

.boton { display: block; width: 100%; margin-top: 16px; background: var(--mag); color: #fff; font-weight: 800; padding: 15px; border-radius: 14px; text-align: center; text-decoration: none; font-size: 16px; box-shadow: 0 4px 0 #a80f54; }
.boton:active { transform: translateY(2px); box-shadow: 0 2px 0 #a80f54; }
.boton[disabled] { opacity: .45; }
.boton.wa { background: var(--verde); box-shadow: 0 4px 0 #0f7a35; margin-top: 12px; }
.boton.sec { background: #fff; color: var(--navy); border: 2px solid var(--navy); box-shadow: none; margin-top: 10px; }

/* hoja del paciente */
.hoja { background: #fff; border-radius: 18px; padding: 18px 16px; box-shadow: 0 2px 12px rgba(20,52,125,.09); }
.hoja .cabeza { border-bottom: 1.5px solid var(--linea); padding-bottom: 12px; margin-bottom: 14px; }
.hoja h2 { font-size: 21px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.hoja .sub { color: var(--gris); font-size: 14px; margin-top: 3px; }
.linea { display: flex; align-items: flex-start; margin: 4px 0 14px; }
.linea .p { flex: 1; text-align: center; font-size: 10.5px; font-weight: 700; color: var(--gris2); position: relative; line-height: 1.15; padding: 0 2px; }
.linea .p i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; margin: 0 auto 5px; background: #fff; border: 3px solid var(--linea); position: relative; z-index: 1; font-style: normal; font-size: 12px; color: var(--gris2); }
.linea .p.ok i { background: var(--azul); border-color: var(--azul); color: #fff; }
.linea .p.ok { color: var(--azul); }
.linea .p.aca i { background: var(--mag); border-color: #fbcfe8; color: #fff; width: 32px; height: 32px; margin-top: -2px; }
.linea .p.aca { color: var(--mag); }
.linea .p::before { content: ''; position: absolute; top: 13px; left: -50%; width: 100%; height: 3px; background: var(--linea); }
.linea .p:first-child::before { display: none; }
.linea .p.ok::before, .linea .p.aca::before { background: var(--azul); }
.objetivo { background: var(--cielo); border-radius: 12px; padding: 10px 12px; font-size: 14.5px; }
.objetivo b { color: var(--navy); }
.titulo-sec { font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 800; color: var(--navy); margin: 18px 0 8px; }
.ej { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--linea); align-items: flex-start; position: relative; }
.ej:first-of-type { border-top: 0; }
.ej img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; flex: none; background: var(--cielo); }
.ej .n { position: absolute; left: -4px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--mag); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 12.5px; z-index: 1; border: 2px solid #fff; }
.ej b { display: block; font-size: 15.5px; line-height: 1.25; }
.ej .dosis { display: inline-block; margin: 4px 0; background: var(--rosa); color: var(--mag); font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 8px; }
.ej small { display: block; color: var(--gris); font-size: 13.5px; line-height: 1.35; }
.ej .quitar { position: absolute; right: 0; top: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--fondo); color: var(--gris); font-size: 15px; }
.semaforo { display: grid; gap: 6px; }
.semaforo div { border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.semaforo .v { background: #ecfdf5; } .semaforo .a { background: #fefce8; } .semaforo .r { background: #fef2f2; }
.meta { background: var(--navy); color: #fff; border-radius: 12px; padding: 11px 13px; margin-top: 14px; font-size: 14.5px; }
.meta b { color: var(--amarillo); }
.cinta { display: flex; gap: 12px; align-items: center; background: var(--rosa); border-radius: 12px; padding: 10px; margin-top: 12px; font-size: 13.5px; }
.cinta img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; }
.firma { margin-top: 14px; font-size: 13.5px; color: var(--gris); text-align: right; }
.firma b { color: var(--tinta); }
.legal { font-size: 11.5px; color: var(--gris2); margin-top: 14px; text-align: center; }
.check { display: flex; gap: 10px; align-items: center; background: #fff; border: 1.5px solid var(--linea); border-radius: 12px; padding: 11px 12px; margin-top: 10px; font-size: 14.5px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--mag); }
.aviso { background: #fff; border-left: 4px solid var(--amarillo); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; color: var(--gris); margin-top: 12px; }

/* asistente */
.chat { display: flex; flex-direction: column; gap: 12px; padding-bottom: 110px; }
.msg { max-width: 90%; padding: 11px 14px; border-radius: 18px; font-size: 15px; }
.yo { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.ia { align-self: flex-start; background: #fff; border: 1px solid var(--linea); border-bottom-left-radius: 6px; width: 92%; max-width: 92%; }
.ia > * + * { margin-top: 9px; }
.ia .etq { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--azul); margin-bottom: -5px; }
.ia h3 { font-size: 17px; color: var(--navy); line-height: 1.25; }
.ia .porque { font-size: 12.5px; color: var(--gris); }
.ia .mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ia .mini figure { font-size: 11.5px; line-height: 1.2; font-weight: 600; }
.ia .mini img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; margin-bottom: 4px; background: var(--cielo); }
.ia .mini em { display: block; font-style: normal; color: var(--mag); font-weight: 800; }
.ia .alerta { background: #fef2f2; border: 1.5px solid #fecaca; color: #991b1b; border-radius: 12px; padding: 9px 11px; font-size: 13.5px; }
.ia .descartar { background: #fffbeb; border-radius: 12px; padding: 9px 11px; font-size: 13px; color: #78350f; }
.ia .nota { font-size: 12px; color: var(--gris2); }
.ia .otra { font-size: 13px; }
.ia .otra button { color: var(--azul); font-weight: 700; text-decoration: underline; }
.ia .boton { margin-top: 12px; padding: 12px; font-size: 15px; }
.escribir { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--linea); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); z-index: 6; }
.escribir .envase { display: flex; gap: 8px; align-items: flex-end; }
.escribir textarea { flex: 1; resize: none; height: 48px; max-height: 140px; }
.escribir button { width: 48px; height: 48px; border-radius: 14px; background: var(--mag); color: #fff; font-weight: 800; font-size: 22px; flex: none; }
.ejemplos { display: flex; flex-direction: column; gap: 8px; }
.ejemplos button { text-align: left; background: #fff; border: 1.5px dashed var(--linea); border-radius: 14px; padding: 10px 12px; font-size: 14px; color: var(--gris); }

/* portada */
.portada { background: var(--navy); color: #fff; padding: 34px 20px 70px; text-align: center; }
.portada .pill { display: inline-block; background: var(--mag); padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 800; letter-spacing: .8px; }
.portada h1 { font-size: 30px; font-weight: 800; margin-top: 12px; line-height: 1.1; }
.portada h1 span { color: var(--amarillo); }
.portada p { opacity: .85; margin-top: 8px; font-size: 15px; }
.apps { display: grid; gap: 14px; margin-top: -50px; padding: 0 16px 30px; }
.app-card { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: 18px; padding: 12px; text-decoration: none; box-shadow: 0 4px 18px rgba(20,52,125,.14); }
.app-card img { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; flex: none; }
.app-card b { display: block; font-family: 'Poppins', sans-serif; font-size: 18px; color: var(--navy); }
.app-card small { display: block; color: var(--gris); font-size: 13.5px; line-height: 1.35; margin-top: 2px; }
.app-card .ir { margin-left: auto; color: var(--mag); font-size: 26px; font-weight: 800; }
.instalar { font-size: 13px; color: var(--gris); text-align: center; padding: 0 20px 30px; }

@media print {
  .barra, .no-imprimir, .escribir { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .hoja { box-shadow: none; padding: 0; }
  .ej { break-inside: avoid; }
  .ej img { width: 80px; height: 80px; }
}
.msg { scroll-margin-top: 90px; }
