/* AGENTE_ — estilos del widget y de la página. https://agente.live/ */
.agente { --agente-color: #1d4ed8; --agente-fondo: #ffffff; --agente-texto: #1f2937; --agente-suave: #f3f4f6; --agente-borde: #e5e7eb; --agente-usuario: var(--agente-color); --agente-radio: 18px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 15px; line-height: 1.5; color: var(--agente-texto); box-sizing: border-box; }
.agente *, .agente *::before, .agente *::after { box-sizing: inherit; }
/* Aislamiento del tema: los botones, campos y enlaces del asistente no heredan estilos del sitio. */
.agente.agente button, .agente.agente textarea, .agente.agente a { all: unset; box-sizing: border-box; font: inherit; line-height: inherit; }
.agente.agente button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.agente.agente a { cursor: pointer; color: var(--agente-color); }
.agente.agente textarea { display: block; width: 100%; white-space: pre-wrap; cursor: text; }
.agente.agente img { max-width: none; box-shadow: none; border: 0; }
.agente.agente .agente-panel[hidden] { display: none; }
/* Plantillas: claro (por defecto), oscuro, o automático según el sistema del visitante. */
.agente.agente[data-tema="oscuro"] { --agente-fondo: #111827; --agente-texto: #e5e7eb; --agente-suave: #1f2937; --agente-borde: #374151; }
@media (prefers-color-scheme: dark) { .agente.agente[data-tema="auto"] { --agente-fondo: #111827; --agente-texto: #e5e7eb; --agente-suave: #1f2937; --agente-borde: #374151; } }

/* ---- Widget flotante ---- */
.agente.agente--widget { position: fixed; right: 20px; bottom: 20px; z-index: 2147483000; }
.agente.agente .agente-btn { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--agente-color); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; transition: transform .2s; padding: 0; }
.agente.agente .agente-btn:hover { transform: scale(1.06); }
.agente.agente .agente-btn img { width: 44px; height: 44px; transition: opacity .2s, transform .2s; }
.agente.agente .agente-btn__cerrar { position: absolute; font-size: 32px; line-height: 1; opacity: 0; transform: rotate(-90deg); transition: opacity .2s, transform .2s; }
.agente.agente--abierto .agente-btn img { opacity: 0; transform: rotate(90deg); }
.agente.agente--abierto .agente-btn__cerrar { opacity: 1; transform: rotate(0); }
.agente.agente .agente-invitacion { position: absolute; right: 0; bottom: 74px; display: none; align-items: center; gap: 6px; background: var(--agente-fondo); color: var(--agente-texto); border: 1px solid var(--agente-borde); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px 6px 6px 14px; width: max-content; max-width: min(300px, calc(100vw - 40px)); animation: agente-sube .35s ease-out; }
.agente.agente .agente-invitacion--visible { display: flex; }
.agente.agente .agente-invitacion__texto { display: block; background: none; border: 0; color: inherit; text-align: left; padding: 6px 0; font-weight: 500; white-space: normal; }
.agente.agente .agente-invitacion__cerrar { background: var(--agente-suave); border: 0; border-radius: 50%; width: 28px; height: 28px; color: inherit; font-size: 18px; line-height: 1; flex: none; }
.agente.agente .agente-invitacion::after { content: ""; position: absolute; right: 22px; bottom: -7px; width: 12px; height: 12px; background: var(--agente-fondo); border-right: 1px solid var(--agente-borde); border-bottom: 1px solid var(--agente-borde); transform: rotate(45deg); }
.agente.agente--widget .agente-panel { position: absolute; right: 0; bottom: 76px; width: min(390px, calc(100vw - 40px)); height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--agente-fondo); border-radius: var(--agente-radio); box-shadow: 0 20px 60px rgba(0,0,0,.28); overflow: hidden; animation: agente-sube .25s ease-out; }
@media (max-width: 480px) { .agente.agente.agente--widget.agente--abierto { inset: 0; } .agente.agente.agente--widget.agente--abierto .agente-btn { display: none; } .agente.agente.agente--widget .agente-panel { position: fixed; inset: 0; width: 100%; height: 100dvh; border-radius: 0; bottom: 0; } }
@keyframes agente-sube { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---- Página completa ---- */
body.agente-pagina { margin: 0; min-height: 100dvh; background: #eef2ff; background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 60%, #ecfeff 100%); }
body.agente-pagina[data-tema="oscuro"] { background: #0b1120; }
@media (prefers-color-scheme: dark) { body.agente-pagina[data-tema="auto"] { background: #0b1120; } }
.agente.agente--pagina { display: flex; justify-content: center; min-height: 100dvh; padding: 0; }
.agente.agente--pagina .agente-panel { width: 100%; max-width: 860px; height: 100dvh; display: flex; flex-direction: column; background: var(--agente-fondo); box-shadow: 0 0 60px rgba(0,0,0,.08); }
@media (min-width: 900px) { .agente--pagina { padding: 24px; } .agente--pagina .agente-panel { height: calc(100dvh - 48px); border-radius: var(--agente-radio); } }
.agente.agente .agente-noscript { font-family: sans-serif; text-align: center; padding: 40px; }

/* ---- Panel ---- */
.agente.agente .agente-cab { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--agente-color); color: #fff; }
.agente.agente .agente-cab__icono { width: 40px; height: 40px; }
.agente.agente .agente-cab__titulos { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.agente.agente .agente-cab__nombre { font-size: 17px; letter-spacing: .02em; }
.agente.agente .agente-cab__sub { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agente.agente .agente-cab__cerrar { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; }
.agente.agente .agente-cab__volver { color: #fff; font-size: 14px; text-decoration: none; background: rgba(255,255,255,.18); padding: 8px 14px; border-radius: 999px; }
.agente.agente .agente-cab__volver:hover, .agente.agente .agente-cab__cerrar:hover { background: rgba(255,255,255,.3); }
.agente.agente .agente-aviso { background: #fef3c7; color: #78350f; font-size: 13px; padding: 8px 16px; }
.agente.agente .agente-mensajes { flex: 1; overflow-y: auto; padding: 18px 16px 6px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.agente.agente .agente-msg { display: flex; flex-direction: column; max-width: 88%; }
.agente.agente .agente-msg--usuario { align-self: flex-end; align-items: flex-end; }
.agente.agente .agente-msg--asistente { align-self: flex-start; }
.agente.agente .agente-msg--nuevo { animation: agente-sube .25s ease-out; }
.agente.agente .agente-msg__burbuja { padding: 10px 14px; border-radius: var(--agente-radio); background: var(--agente-suave); word-wrap: break-word; overflow-wrap: anywhere; }
.agente.agente .agente-msg--usuario .agente-msg__burbuja { background: var(--agente-usuario); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.agente.agente .agente-msg--asistente .agente-msg__burbuja { border-bottom-left-radius: 6px; }
.agente.agente .agente-msg__burbuja p { margin: 0 0 8px; } .agente-msg__burbuja p:last-child { margin-bottom: 0; }
.agente.agente .agente-msg__burbuja ul, .agente.agente .agente-msg__burbuja ol { margin: 4px 0 8px; padding-left: 20px; } .agente-msg__burbuja li { margin: 2px 0; }
.agente.agente .agente-fuentes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 4px 0; font-size: 13px; }
.agente.agente .agente-fuentes__etq { opacity: .7; }
.agente.agente .agente-fuente { display: inline-flex; align-items: center; gap: 4px; background: var(--agente-fondo); border: 1px solid var(--agente-borde); border-radius: 999px; padding: 3px 10px; text-decoration: none; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agente.agente .agente-fuente::after { content: "↗"; font-size: 11px; opacity: .7; }
.agente.agente .agente-fuente:hover { border-color: var(--agente-color); }
.agente.agente .agente-voto { display: flex; gap: 6px; align-items: center; margin: 6px 4px 0; font-size: 12px; opacity: .75; }
.agente.agente .agente-voto__btn { background: none; border: 1px solid var(--agente-borde); border-radius: 999px; color: inherit; padding: 1px 10px; font-size: 12px; }
.agente.agente .agente-voto__btn:hover { border-color: var(--agente-color); color: var(--agente-color); }
.agente.agente .agente-escribiendo .agente-msg__burbuja { display: flex; gap: 5px; padding: 14px 16px; }
.agente.agente .agente-escribiendo span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .4; animation: agente-punto 1.2s infinite; }
.agente.agente .agente-escribiendo span:nth-child(2) { animation-delay: .2s; } .agente-escribiendo span:nth-child(3) { animation-delay: .4s; }
@keyframes agente-punto { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
.agente.agente .agente-sugeridas { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 16px 4px; }
.agente.agente .agente-chip { background: var(--agente-fondo); border: 1px solid var(--agente-color); color: var(--agente-color); border-radius: 999px; padding: 6px 12px; font-size: 13px; text-align: left; }
.agente.agente .agente-chip:hover { background: var(--agente-color); color: #fff; }
.agente.agente .agente-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--agente-borde); position: relative; }
.agente.agente .agente-campo { flex: 1; resize: none; border: 1px solid var(--agente-borde); border-radius: 14px; padding: 10px 14px; font: inherit; color: inherit; background: var(--agente-fondo); max-height: 140px; outline: none; }
.agente.agente .agente-campo:focus { border-color: var(--agente-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--agente-color) 20%, transparent); }
.agente.agente .agente-enviar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--agente-color); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.agente.agente .agente-enviar:disabled { opacity: .5; cursor: default; }
.agente.agente .agente-contador { position: absolute; right: 64px; top: -16px; font-size: 11px; opacity: .6; }
.agente.agente .agente-pie { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 12px 10px; font-size: 12px; opacity: .8; }
.agente.agente .agente-pie__fila { display: flex; justify-content: center; gap: 14px; }
.agente.agente .agente-pie__aviso { margin: 0; font-size: 11px; opacity: .75; text-align: center; }
.agente.agente .agente-pie a { color: inherit; text-decoration: none; } .agente-pie a:hover { text-decoration: underline; }
.agente.agente .agente-pie__credito strong { color: var(--agente-color); letter-spacing: .04em; }
