:root {
--papel: #f4f6f9;
--tinta: #141820;
--suave: #5b6372;
--borde: #dde2ea;
--azul: #0b6e4f;
--azul-claro: #e3f3ec;
--ok: #17845a;
--error: #b3261e;
--duda: #8a5a00;
--aviso: #fff4d6;
--radio: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--papel); color: var(--tinta); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
#app { min-height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; position: relative; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -0.5px; color: var(--tinta); text-decoration: none; }
.logo svg { display: block; flex: none; }
.chip { white-space: nowrap; flex: none; }
.chip { border: 1px solid var(--borde); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; color: var(--tinta); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background-color .15s; }
.chip:hover { background: #f1f3f4; }
main { flex: 1; padding: 8px 16px 24px; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--suave); font-size: 14px; }
.chat { display: flex; flex-direction: column; padding-bottom: 8px; }
.msgs { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px; word-wrap: break-word; }
.bubble.bot { background: #fff; border: 1px solid var(--borde); border-bottom-left-radius: 6px; align-self: flex-start; }
.bubble.me { background: var(--azul); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.bubble.ancho { max-width: 100%; width: 100%; }
.bubble a { color: var(--azul); font-weight: 600; }
.typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.typing span { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--suave); opacity: .4; animation: blink 1s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
.typing small { line-height: 1.3; margin-left: 8px; color: var(--suave); font-size: 13px; animation: none; }
@keyframes blink { 50% { opacity: 1; } }
.options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.opt { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--azul); background: #fff; color: var(--azul); font: inherit; font-weight: 600; cursor: pointer; max-width: 100%; text-align: left; }
.opt.primary { background: var(--azul); color: #fff; }
.opt.ghost { border-color: var(--borde); color: var(--suave); }
.opt { transition: background-color .15s; }
.opt:hover:not(:disabled) { background: #f1f3f4; }
.opt.primary:hover:not(:disabled) { background: #095c42; }
.dock { position: sticky; bottom: 0; background: var(--papel); padding: 8px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; min-height: 50px; border: 1px solid var(--borde); border-radius: 999px; padding: 0 16px; font: inherit; background: #fff; color: var(--tinta); }
.composer input:focus { outline: 2px solid var(--azul); outline-offset: -1px; }
.send { width: 50px; min-width: 50px; border-radius: 50%; border: 0; background: var(--azul); color: #fff; font-size: 18px; cursor: pointer; }
.resumen dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 8px 0 0; font-size: 14px; }
.resumen dt { color: var(--suave); }
.resumen dd { margin: 0; text-align: right; word-break: break-word; }
.resumen h4 { margin: 12px 0 0; font-size: 14px; }
.puntos { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 10px; }
.puntos li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.puntos .ic { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #fff; margin-top: 1px; }
.puntos .ok .ic { background: var(--ok); }
.puntos .mal .ic { background: var(--error); }
.puntos .duda .ic { background: #c98a00; }
.puntos b { display: block; }
.puntos small { display: block; color: var(--suave); font-size: 13px; margin-top: 2px; }
.puntos small a { font-weight: 500; }
.links { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.links a, .btnlink { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--borde); border-radius: 12px; background: var(--papel); color: var(--tinta) !important; text-decoration: none; font-weight: 600; }
.links a small { display: block; font-weight: 400; color: var(--suave); font-size: 13px; }
.links a::after { content: "↗"; color: var(--suave); }
.copia { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--azul); background: var(--azul-claro); color: var(--azul); border-radius: 8px; padding: 2px 8px; font: inherit; font-weight: 700; cursor: pointer; }
.descargo { white-space: pre-wrap; font-family: Georgia, "Times New Roman", serif; font-size: 14px; line-height: 1.5; background: #fffdf7; border: 1px solid var(--borde); border-radius: 10px; padding: 14px; max-height: 360px; overflow: auto; margin-top: 8px; }
.aviso { background: var(--aviso); color: #6b4e00; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); z-index: 20; text-align: center; }
.pie { padding: 12px 16px 4px; text-align: center; font-size: 12px; color: var(--suave); }
.pie a { color: var(--suave); }
.legal { padding: 8px 16px 32px; }
.legal h1 { font-size: 24px; }
.legal h2 { font-size: 18px; margin: 24px 0 8px; }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; opacity: .7; } }
.resumen dd { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.lapiz { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -6px -6px -6px 0; border: 0; border-radius: 14px; background: transparent; color: var(--suave); cursor: pointer; }
.lapiz:hover { background: var(--borde); color: var(--tinta); }
.editar { display: flex; gap: 6px; width: 100%; margin: -4px 0; }
.editar input, .editar select { flex: 1; min-width: 0; min-height: 36px; border: 1px solid var(--azul); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 14px; background: #fff; color: var(--tinta); }
.editar .ok { flex: none; width: 36px; border: 0; border-radius: 8px; background: var(--azul); color: #fff; font-weight: 800; cursor: pointer; }

/* Modal de salida */
.salida { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.salida-caja { position: relative; background: #fff; border-radius: 16px; padding: 24px 20px 18px; width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.salida-caja h2 { margin: 0 28px 14px 0; font-size: 1.15rem; color: var(--tinta); }
.salida-caja ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.salida-caja li a { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; text-decoration: none; color: var(--tinta); }
.salida-caja li a:hover { background: #f1f3f4; }
.salida-caja img { border-radius: 10px; flex: none; object-fit: cover; }
.salida-caja b { display: block; }
.salida-caja small { color: var(--suave); }
.salida-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; color: var(--suave); cursor: pointer; }
.salida-x:hover { background: #f1f3f4; }
.salida-mas { display: block; margin-top: 12px; text-align: center; color: var(--azul); font-weight: 600; text-decoration: none; }

/* Compartir */
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.compartir { position: absolute; z-index: 90; min-width: 200px; background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.15); display: grid; }
.compartir p { margin: 4px 10px 6px; font-size: 13px; color: var(--suave); }
.compartir a, .compartir button { display: block; text-align: left; padding: 10px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 15px; color: var(--tinta); text-decoration: none; cursor: pointer; }
.compartir a:hover, .compartir button:hover, .compartir a:focus-visible, .compartir button:focus-visible { background: #f1f3f4; outline: none; }
.compartir-btn { padding: 7px 9px; }
