/* IA Chat Empresarial 2.1.0: botón flotante y panel de conversación */
.ia-chat-container { position: fixed; z-index: 9990; bottom: 22px; right: 22px; font-family: inherit; }
.ia-chat-position-bottom-left { right: auto; left: 22px; }
.ia-chat-position-bottom-center { right: 50%; transform: translateX(50%); }
.ia-chat-trigger { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; border-radius: 999px; padding: 12px 18px 12px 14px; background: #0B5FA8; color: #fff; font: 700 15px/1 inherit; box-shadow: 0 10px 28px rgba(11, 95, 168, .35); transition: transform .15s ease, box-shadow .15s ease; }
.ia-chat-trigger:hover, .ia-chat-trigger:focus-visible { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(11, 95, 168, .42); outline: none; }
.ia-chat-trigger-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; }
.ia-chat-trigger-icon svg { width: 22px; height: 22px; fill: #fff; }
.ia-chat-container.ia-chat-open .ia-chat-trigger { display: none; }
.ia-chat-panel { display: none; position: absolute; bottom: 0; right: 0; width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 40px)); background: #fff; border-radius: 18px; box-shadow: 0 18px 50px rgba(10, 40, 80, .28); overflow: hidden; flex-direction: column; border: 1px solid rgba(11, 95, 168, .14); }
.ia-chat-position-bottom-left .ia-chat-panel { right: auto; left: 0; }
.ia-chat-position-bottom-center .ia-chat-panel { right: 50%; transform: translateX(50%); }
.ia-chat-panel.ia-chat-panel-open { display: flex; }
.ia-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: linear-gradient(135deg, #1470C4, #0A4F8C); color: #fff; }
.ia-chat-header-title { font-weight: 700; font-size: 16px; line-height: 1.2; }
.ia-chat-header-subtitle { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.ia-chat-close { border: 0; background: rgba(255, 255, 255, .16); color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }
.ia-chat-close:hover { background: rgba(255, 255, 255, .28); }
.ia-chat-panel-page .ia-chat-close { display: none; }
.ia-chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #F4F7FB; }
.ia-chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.ia-chat-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; }
.ia-chat-msg-user { align-self: flex-end; background: #0B5FA8; color: #fff; border-bottom-right-radius: 4px; }
.ia-chat-msg-assistant { align-self: flex-start; background: #fff; color: #0B2545; border: 1px solid rgba(11, 95, 168, .12); border-bottom-left-radius: 4px; }
.ia-chat-msg-assistant a { color: #0B5FA8; }
.ia-chat-msg-assistant ul, .ia-chat-msg-assistant ol { margin: 6px 0 6px 18px; padding: 0; white-space: normal; }
.ia-chat-msg-assistant p { margin: 0 0 6px; white-space: pre-wrap; }
.ia-chat-msg-assistant p:last-child { margin-bottom: 0; }
.ia-chat-msg-error { align-self: center; background: #FEF0C7; color: #93370D; border: 1px solid #F9DBAF; font-size: 13px; text-align: center; }
.ia-chat-hint { font-size: 13px; color: #5B6B7C; padding: 2px 4px; }
.ia-chat-sugerencias { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 4px; }
.ia-chat-sugerencia { border: 1px solid rgba(11, 95, 168, .3); background: #fff; color: #0B5FA8; border-radius: 999px; padding: 6px 10px; font-size: 12.5px; cursor: pointer; }
.ia-chat-sugerencia:hover { background: rgba(11, 95, 168, .06); }
.ia-chat-status { min-height: 18px; font-size: 12px; color: #5B6B7C; padding: 0 14px 6px; }
/* 2.1.0: el texto "Escribiendo…" / "Sigue pensando…" lo pone el JavaScript (role="status"), así lo leen los lectores de pantalla. */
.ia-chat-status.is-typing::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #0B5FA8; vertical-align: middle; animation: ia-chat-pulso 1s ease-in-out infinite; }
@keyframes ia-chat-pulso { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .ia-chat-status.is-typing::before { animation: none; } .ia-chat-messages { scroll-behavior: auto; } .ia-chat-trigger { transition: none; } }
.ia-chat-input-area { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: #fff; border-top: 1px solid rgba(11, 95, 168, .12); }
.ia-chat-input-area .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ia-chat-input { flex: 1; resize: none; min-height: 42px; max-height: 120px; box-sizing: border-box; border: 1px solid rgba(11, 95, 168, .25); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14.5px; line-height: 1.35; color: #0B2545; background: #fff; }
.ia-chat-input:focus { outline: none; border-color: #0B5FA8; box-shadow: 0 0 0 3px rgba(11, 95, 168, .12); }
.ia-chat-send-btn { border: 0; background: #0B5FA8; color: #fff; border-radius: 12px; padding: 0 16px; height: 42px; font: 700 14px inherit; cursor: pointer; white-space: nowrap; }
.ia-chat-send-btn:disabled { opacity: .6; cursor: default; }
.ia-chat-send-btn:hover:not(:disabled) { background: #0A4F8C; }
.ia-chat-page-container .ia-chat-panel { position: static; width: 100%; max-width: 820px; height: min(70vh, 640px); margin: 0 auto; transform: none; }
@media (max-width: 640px) {
	.ia-chat-container { bottom: 14px; right: 14px; }
	.ia-chat-position-bottom-left { left: 14px; }
	.ia-chat-panel { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; }
	.ia-chat-position-bottom-center .ia-chat-panel { transform: none; right: 0; }
	.ia-chat-trigger-label { display: none; }
	.ia-chat-trigger { padding: 14px; }
}
/* En la app Finanzas IA (modo app o dominio propio) el asistente comercial no se muestra. */
body.iae-enfocado-app .ia-chat-container, body.iaep-dominio .ia-chat-container { display: none !important; }
@media print { .ia-chat-container { display: none !important; } }
/* 2.0.4 · Convive con el botón flotante de WhatsApp: el WhatsApp va encima del chat (alineados a la derecha) y se oculta mientras el chat está abierto */
body:has(#ia-chat-container.ia-chat-position-bottom-right) .iawfb-button { left: auto !important; right: 22px !important; bottom: 84px !important; }
body:has(#ia-chat-container.ia-chat-open) .iawfb-button { display: none !important; }
@media (max-width: 640px) {
	body:has(#ia-chat-container.ia-chat-position-bottom-right) .iawfb-button { right: 14px !important; bottom: 76px !important; }
}
/* 2.0.5 · Aviso de privacidad de una línea sobre el campo de texto */
.ia-chat-aviso { margin: 0; padding: 6px 12px; font-size: 11.5px; line-height: 1.35; color: #5B6B7C; background: #fff; border-top: 1px solid rgba(11, 95, 168, .08); }
.ia-chat-aviso a { color: #0B5FA8; text-decoration: underline; white-space: nowrap; }
.ia-chat-trigger:focus-visible, .ia-chat-close:focus-visible, .ia-chat-sugerencia:focus-visible, .ia-chat-send-btn:focus-visible { outline: 3px solid #F5B700; outline-offset: 2px; }

/* 2.1.0 · Seguir por WhatsApp, pedir una cotización y formulario con autorización */
.ia-chat-acciones { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px 0; background: #fff; border-top: 1px solid rgba(11, 95, 168, .08); }
.ia-chat-acciones[hidden], .ia-chat-accion[hidden] { display: none; }
.ia-chat-accion { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; border: 1px solid rgba(11, 95, 168, .35); background: #fff; color: #0B5FA8; border-radius: 999px; padding: 5px 12px; font: 600 13px/1.2 inherit; cursor: pointer; }
.ia-chat-accion:hover { background: rgba(11, 95, 168, .06); }
.ia-chat-accion svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ia-chat-accion:focus-visible { outline: 3px solid #F5B700; outline-offset: 2px; }
.ia-chat-oferta { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: #0B2545; }
.ia-chat-oferta span { width: 100%; }
.ia-chat-contacto { align-self: stretch; display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid rgba(11, 95, 168, .2); border-radius: 14px; padding: 12px; font-size: 13.5px; color: #0B2545; }
.ia-chat-contacto-t { margin: 0 0 4px; font-weight: 700; font-size: 15px; color: #0B5FA8; }
.ia-chat-contacto label { font-weight: 600; }
.ia-chat-contacto input:not([type=checkbox]), .ia-chat-contacto textarea { width: 100%; box-sizing: border-box; min-height: 36px; border: 1px solid rgba(11, 95, 168, .3); border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 14px; color: #0B2545; background: #fff; margin-bottom: 4px; }
.ia-chat-contacto textarea { resize: vertical; }
.ia-chat-contacto input:focus, .ia-chat-contacto textarea:focus { outline: none; border-color: #0B5FA8; box-shadow: 0 0 0 3px rgba(11, 95, 168, .15); }
.ia-chat-contacto .ia-chat-consent { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 12.5px; line-height: 1.4; margin: 4px 0; }
.ia-chat-contacto .ia-chat-consent input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }
.ia-chat-contacto .ia-chat-consent a { color: #0B5FA8; }
.ia-chat-contacto-err { margin: 0; min-height: 0; color: #93370D; font-size: 13px; }
.ia-chat-contacto-err:empty { display: none; }
.ia-chat-contacto .ia-chat-send-btn { align-self: flex-start; padding: 0 16px; }
.ia-chat-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ia-chat-msg-assistant a { word-break: break-word; }
.ia-chat-close:focus-visible { outline: 3px solid #F5B700; }

/* 2.1.0 · "Nueva conversación" (borra la conversación de esta pestaña). En pantallas angostas queda solo el ícono; el
   texto sigue disponible para los lectores de pantalla. */
.ia-chat-header-main { flex: 1; min-width: 0; }
.ia-chat-nueva { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 32px; border: 1px solid rgba(255, 255, 255, .6); background: transparent; color: #fff; border-radius: 999px; padding: 4px 12px 4px 9px; font: 600 12.5px/1.2 inherit; cursor: pointer; white-space: nowrap; }
.ia-chat-nueva:hover { background: rgba(255, 255, 255, .16); }
.ia-chat-nueva:focus-visible { outline: 3px solid #F5B700; outline-offset: 2px; }
.ia-chat-nueva svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
/* Solo ícono en la ventana flotante (380 px de ancho) y en celulares; con texto en la página del chat y en pantallas
   de 481 a 640 px, donde la ventana ocupa toda la pantalla. */
.ia-chat-panel:not(.ia-chat-panel-page) .ia-chat-nueva { width: 32px; height: 32px; padding: 0; justify-content: center; }
.ia-chat-panel:not(.ia-chat-panel-page) .ia-chat-nueva-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 481px) and (max-width: 640px) {
	.ia-chat-panel:not(.ia-chat-panel-page) .ia-chat-nueva { width: auto; padding: 4px 12px 4px 9px; }
	.ia-chat-panel:not(.ia-chat-panel-page) .ia-chat-nueva-t { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
@media (max-width: 480px) {
	.ia-chat-panel-page .ia-chat-nueva { width: 32px; height: 32px; padding: 0; justify-content: center; }
	.ia-chat-panel-page .ia-chat-nueva-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
