/* Vendedor con IA de la tienda (26-10-2026, public/js/tienda/vendedorIA.js). Usa los colores de la tienda
   (--t-pri, --t-pri-txt) y se apila arriba del botón de WhatsApp (.t-wa-flotante, 18 px + 56 px). */

.t-chat-boton {
    position: fixed; right: 18px; bottom: 18px; z-index: 41;
    display: inline-flex; align-items: center; gap: .45rem; height: 52px; padding: 0 1.1rem 0 .95rem;
    border: 0; border-radius: 999px; background: var(--t-pri); color: var(--t-pri-txt);
    font-weight: 700; font-size: .95rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); cursor: pointer;
}
.t-chat-boton i { font-size: 1.3rem; }
.t-chat-boton:hover { filter: brightness(1.05); }
.t-chat-boton:focus-visible { outline: 3px solid rgba(0, 0, 0, .35); outline-offset: 2px; }
/* Con WhatsApp en la página, el chat va arriba de ese botón. */
/* ⚠️ Reglas separadas: un navegador que no entiende :has() descarta la regla ENTERA si van juntas. */
.t-wa-flotante ~ .t-chat-boton { bottom: 86px; }
.t-chat-boton.abierto { display: none; }
/* USO-2 y USO-3 de la auditoría del 08-11-2026. Al final de la página el pie deja lugar a los botones, como
   t-footer-con-wa (tienda.css) con el de WhatsApp: con el chat apilado arriba tapaban el Botón de arrepentimiento y
   los links legales (la clase la pone tienda_footer.hbs cuando la página tiene el chat). En el armador del celular la
   pila va arriba de la barra del total (que mide ~61 px; el WhatsApp ya subía a 84 px en armador.css), y el chat ya no
   queda encima del WhatsApp. */
.t-footer.t-footer-con-chat { padding-bottom: 78px; }                       /* 18 + 52 del chat + 8 */
.t-footer.t-footer-con-chat.t-footer-con-wa { padding-bottom: 146px; }      /* 18 + 56 + 12 + 52 + 8 */
@media (max-width: 991.98px) {
    .armador-body .t-chat-boton { bottom: 84px; }
    .armador-body .t-wa-flotante ~ .t-chat-boton { bottom: 152px; }
    .armador-body .t-chat-globo { bottom: 146px; }
    .armador-body .t-wa-flotante ~ .t-chat-globo { bottom: 214px; }
    .armador-body .t-footer.t-footer-con-chat { padding-bottom: 144px; }
    .armador-body .t-footer.t-footer-con-chat.t-footer-con-wa { padding-bottom: 212px; }
}
@media (max-width: 575.98px) {
    .t-chat-boton { width: 52px; padding: 0; justify-content: center; }
    .t-chat-boton-texto { display: none; }
}

.t-chat-panel {
    position: fixed; right: 18px; bottom: 18px; z-index: 1070;
    width: 380px; max-width: calc(100vw - 36px); height: min(620px, calc(100vh - 36px));
    display: flex; flex-direction: column; background: #fff; color: var(--t-texto, #1d2129);
    border: 1px solid var(--t-borde, #e6e8ec); border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); overflow: hidden;
}
.t-chat-panel[hidden] { display: none; }
@media (max-width: 575.98px) {
    .t-chat-panel { inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
    body.t-chat-abierto { overflow: hidden; }
}

.t-chat-cab { display: flex; align-items: center; gap: .6rem; padding: .7rem .75rem; background: var(--t-pri); color: var(--t-pri-txt); }
.t-chat-cab-icono { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.t-chat-cab-texto { flex: 1 1 auto; min-width: 0; line-height: 1.15; }
.t-chat-cab-texto strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-chat-cab-texto small { opacity: .85; font-size: .75rem; }
/* 29-10-2026: en el sitio principal una regla general del sitio le pone color oscuro (#2e3a47) al texto del encabezado
   y no se leía sobre el fondo. El color va explícito en el contenedor y lo heredan el nombre y la línea de abajo. */
.t-chat-cab-texto { color: var(--t-pri-txt, #fff); }
.t-chat-cab-texto strong, .t-chat-cab-texto small { color: inherit; }
.t-chat-cab button { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.05rem; }
.t-chat-cab button:hover { background: rgba(255, 255, 255, .18); }

/* "Hablando de: ..." (27-10-2026): el producto de la conversación, y el separador cuando cambia. */
.t-chat-tema { display: flex; align-items: center; gap: .3rem; padding: .4rem .75rem; font-size: .8rem; background: #fff; border-bottom: 1px solid #e6e8eb; color: #5b6570; min-width: 0; }
.t-chat-tema[hidden] { display: none; }
.t-chat-cerrada { align-self: stretch; font-size: .8rem; color: #5b6570; background: #fff; border: 1px dashed #cfd4da; border-radius: 10px; padding: .5rem .65rem; }
/* "Conversación nueva" se puede deshacer mientras la nueva esté vacía (02-12-2026, revisión 17). */
.t-chat-anterior { align-self: stretch; font-size: .8rem; color: #5b6570; background: #fff; border: 1px dashed #cfd4da; border-radius: 10px; padding: .5rem .65rem; }
.t-chat-volver { border: 0; background: none; padding: .15rem 0; min-height: 24px; color: #26323e; font-weight: 700; text-decoration: underline; cursor: pointer; }
.t-chat-tema span { flex: none; }
.t-chat-tema a { font-weight: 600; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* 29-10-2026: el separador es un subtítulo (va antes de la pregunta que cambió de producto). */
.t-chat-separador { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 600; color: #3d4650; margin: .6rem 0 .15rem; }
.t-chat-separador::before, .t-chat-separador::after { content: ""; flex: 1 1 auto; height: 2px; background: var(--t-pri, #c9ced4); opacity: .45; }
.t-chat-separador span { max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.t-chat-separador small { display: block; font-size: .68rem; font-weight: 400; color: #6b7480; text-transform: uppercase; letter-spacing: .04em; }
.t-chat-mensajes { flex: 1 1 auto; overflow-y: auto; padding: .85rem .75rem; background: var(--t-fondo, #f6f7f9); display: flex; flex-direction: column; gap: .5rem; }
.t-chat-msg { max-width: 88%; padding: .55rem .75rem; border-radius: 14px; font-size: .92rem; line-height: 1.4; overflow-wrap: anywhere; }
.t-chat-asistente { align-self: flex-start; background: #fff; border: 1px solid var(--t-borde, #e6e8ec); border-bottom-left-radius: 4px; }
.t-chat-cliente { align-self: flex-end; background: var(--t-pri); color: var(--t-pri-txt); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.t-chat-vineta { display: block; padding-left: .9rem; position: relative; }
.t-chat-vineta::before { content: '•'; position: absolute; left: .15rem; }
.t-chat-sub { padding-left: 1.8rem; }
.t-chat-sub::before { content: '◦'; left: 1.05rem; }

.t-chat-escribiendo { display: inline-flex; gap: 4px; padding: .7rem .8rem; }
.t-chat-escribiendo span { width: 7px; height: 7px; border-radius: 50%; background: #9aa1ab; animation: t-chat-punto 1s infinite ease-in-out; }
.t-chat-escribiendo span:nth-child(2) { animation-delay: .15s; }
.t-chat-escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes t-chat-punto { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .t-chat-escribiendo span { animation: none; opacity: .7; } }

.t-chat-sugeridas { display: flex; flex-wrap: wrap; gap: .35rem; }
.t-chat-sugerida { border: 1px solid var(--t-pri-legible, var(--t-pri)); color: var(--t-pri-legible, var(--t-pri)); background: #fff; border-radius: 999px; padding: .3rem .7rem; font-size: .82rem; }
.t-chat-sugerida:hover { background: var(--t-pri); color: var(--t-pri-txt); }

.t-chat-tarjetas { display: flex; flex-direction: column; gap: .4rem; }
.t-chat-tarjeta { display: flex; gap: .6rem; background: #fff; border: 1px solid var(--t-borde, #e6e8ec); border-radius: 12px; padding: .5rem; }
.t-chat-foto { flex: none; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: #fff; display: flex; align-items: center; justify-content: center; }
.t-chat-foto img { width: 100%; height: 100%; object-fit: contain; }
.t-chat-sinfoto { color: #b4bac3; font-size: 1.5rem; }
.t-chat-datos { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.t-chat-nombre { color: var(--t-texto, #1d2129); font-weight: 600; font-size: .86rem; line-height: 1.25; text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-chat-nombre:hover { color: var(--t-pri-legible, var(--t-pri)); }
.t-chat-marca { font-size: .74rem; color: #6b7280; }
.t-chat-linea { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; }
.t-chat-precio { font-weight: 800; font-variant-numeric: tabular-nums; }
.t-chat-precio small { font-weight: 600; color: #6b7280; }
.t-chat-stock { font-size: .74rem; color: #137333; }
.t-chat-acciones { display: flex; align-items: center; gap: .5rem; margin-top: .15rem; }
.t-chat-agregar { border: 0; border-radius: 8px; background: var(--t-pri); color: var(--t-pri-txt); font-size: .8rem; font-weight: 700; padding: .3rem .6rem; }
.t-chat-agregar.agregado { background: #137333; color: #fff; }
.t-chat-agregar:disabled { opacity: .6; }
/* Ficha del armador de PC (27-10-2026): el botón es un link. */
.t-chat-armador .t-chat-agregar { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; }
.t-chat-armador .t-chat-sinfoto { color: var(--t-pri-legible, var(--t-pri)); font-size: 1.9rem; }
.t-chat-ver { font-size: .8rem; color: var(--t-pri-legible, var(--t-pri)); }

.t-chat-agregado { align-self: flex-start; font-size: .84rem; background: #e7f6ec; color: #137333; border: 1px solid #c6ead2; border-radius: 10px; padding: .4rem .65rem; }
.t-chat-agregado a { color: #137333; font-weight: 700; }
.t-chat-deshacer { border: 0; background: none; padding: 0; color: #137333; font-weight: 700; text-decoration: underline; }
/* Terminar la compra (07-11-2026, CONV 130): el producto que ya está en el carrito y el botón para finalizar. */
.t-chat-en-carrito { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; font-weight: 700; color: #137333; }
.t-chat-finalizar { align-self: flex-start; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; }
.t-chat-finalizar .t-chat-agregar { display: inline-flex; align-items: center; gap: .35rem; box-sizing: border-box; min-height: 40px; padding: .45rem .9rem; font-size: .88rem; text-decoration: none; }
.t-chat-finalizar .t-chat-agregar:hover { color: var(--t-pri-txt); filter: brightness(1.08); }
.t-chat-contacto { display: flex; flex-wrap: wrap; gap: .4rem; }
.t-chat-contacto a { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; font-weight: 700; text-decoration: none; background: #fff; border: 1px solid var(--t-borde, #e6e8ec); color: var(--t-texto, #1d2129); }
.t-chat-contacto a .bi-whatsapp { color: #25d366; }

.t-chat-form { display: flex; align-items: flex-end; gap: .4rem; padding: .55rem .6rem; border-top: 1px solid var(--t-borde, #e6e8ec); background: #fff; }
.t-chat-entrada { flex: 1 1 auto; resize: none; border: 1px solid var(--t-borde, #e6e8ec); border-radius: 12px; padding: .5rem .7rem; font-size: 16px; line-height: 1.3; max-height: 110px; }
.t-chat-entrada:focus { outline: 2px solid var(--t-pri-legible, var(--t-pri)); outline-offset: 0; border-color: transparent; }
.t-chat-enviar { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--t-pri); color: var(--t-pri-txt); }
.t-chat-enviar:disabled { opacity: .5; }
/* Adjuntar un comprobante de pago (28-10-2026). */
.t-chat-adjuntar { flex: none; width: 42px; height: 42px; border: 1px solid var(--t-borde, #e6e8ec); border-radius: 50%; background: #fff; color: var(--t-texto, #1d2129); font-size: 1.15rem; }
.t-chat-adjuntar:hover { border-color: var(--t-pri-legible, var(--t-pri)); color: var(--t-pri-legible, var(--t-pri)); }
.t-chat-entrada::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-chat-factura .t-chat-stock { color: #6b7280; }
/* Tarjeta de factura y resumen del informe de pago (28-10-2026). */
.t-chat-factura .t-chat-sinfoto { color: var(--t-pri-legible, var(--t-pri)); font-size: 1.8rem; }
.t-chat-factura .t-chat-agregar { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; }
.t-chat-pago { background: #fff; border: 1px solid var(--t-borde, #e6e8ec); border-radius: 12px; padding: .65rem .75rem; font-size: .86rem; }
.t-chat-pago > strong { display: flex; align-items: center; gap: .35rem; margin-bottom: .4rem; }
.t-chat-pago dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; margin: 0 0 .55rem; }
.t-chat-pago dt { color: #6b7280; font-weight: 600; }
.t-chat-pago dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.t-chat-confirmar-pago { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; font-size: .86rem; }
.t-chat-pago-nota { margin: .4rem 0 0; font-size: .74rem; color: #6b7280; }
.t-chat-pago-ok { margin: 0; color: #137333; font-weight: 700; }
/* El RMA para confirmar (20-11-2026, sólo supersistemasweb.com): los productos, la entrega, las condiciones y el botón. */
.t-chat-rma-items { list-style: none; margin: 0 0 .55rem; padding: 0; display: grid; gap: .45rem; }
.t-chat-rma-items li { display: grid; gap: .1rem; padding-bottom: .4rem; border-bottom: 1px solid var(--t-borde, #e6e8ec); overflow-wrap: anywhere; }
.t-chat-rma-items li:last-child { border-bottom: 0; padding-bottom: 0; }
.t-chat-rma-sn { color: #6b7280; font-size: .78rem; }
.t-chat-rma-ok { color: #137333; }
.t-chat-rma-revisar { color: #a15c07; }
.t-chat-rma-queda { margin: 0 0 .5rem; font-size: .8rem; line-height: 1.35; }
.t-chat-rma-acepto { display: flex; align-items: flex-start; gap: .4rem; margin: 0 0 .5rem; font-size: .8rem; cursor: pointer; }
.t-chat-rma-acepto input { margin-top: .15rem; width: 1rem; height: 1rem; flex: 0 0 auto; }
.t-chat-confirmar-rma, .t-chat-rma .t-chat-agregar { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; font-size: .86rem; text-decoration: none; }
.t-chat-nota { margin: 0; padding: 0 .75rem .55rem; background: #fff; font-size: .68rem; color: #6b7280; line-height: 1.3; }

/* Aviso proactivo (27-10-2026): globito arriba del botón del chat. Texto fijo, no llama a la IA. */
.t-chat-globo {
    position: fixed; right: 18px; bottom: 80px; z-index: 41;
    display: flex; align-items: flex-start; max-width: min(300px, calc(100vw - 36px));
    background: #fff; color: var(--t-texto, #1d2129); border: 1px solid var(--t-borde, #e6e8ec);
    border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
    animation: t-chat-globo-entra .25s ease-out;
}
.t-chat-globo::after {
    content: ''; position: absolute; right: 26px; bottom: -7px; width: 12px; height: 12px;
    background: #fff; border-right: 1px solid var(--t-borde, #e6e8ec); border-bottom: 1px solid var(--t-borde, #e6e8ec);
    transform: rotate(45deg);
}
.t-wa-flotante ~ .t-chat-globo { bottom: 148px; }
.t-chat-globo-texto {
    flex: 1; display: flex; flex-direction: column; gap: .15rem; text-align: left;
    padding: .7rem .2rem .7rem .9rem; border: 0; background: none; color: inherit; font-size: .9rem; line-height: 1.35; cursor: pointer;
}
.t-chat-globo-texto strong { font-size: .78rem; color: var(--t-pri-legible, var(--t-pri)); }
.t-chat-globo-cerrar {
    flex: 0 0 auto; width: 36px; height: 36px; margin: .2rem; border: 0; border-radius: 999px;
    background: none; color: #6b7280; font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.t-chat-globo-cerrar:hover { background: #f1f3f5; }
@keyframes t-chat-globo-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .t-chat-globo { animation: none; } }

/* Los pedidos del cliente como tarjetas (05-11-2026, vendedorIA/pedidosChat.js): la foto y el nombre son botones que abren
   el detalle; el estado va en una pastilla de color tonal, de tamaño fijo. */
.t-chat-pedido .t-chat-foto { border: 1px solid var(--t-borde, #e6e8ec); padding: 0; cursor: pointer; }
.t-chat-pedido .t-chat-sinfoto { color: var(--t-pri-legible, var(--t-pri)); font-size: 1.7rem; }
.t-chat-pedido .t-chat-nombre { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font-size: .9rem; }
.t-chat-pedido .t-chat-stock { color: #6b7280; }
.t-chat-pedido .t-chat-agregar, .t-chat-pedido .t-chat-ver { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; }
.t-chat-ped-estado { align-self: flex-start; display: inline-block; font-size: .72rem; font-weight: 700; line-height: 1.2;
    padding: .15rem .5rem; border-radius: 999px; border: 1px solid #d6dbe1; background: #f1f3f5; color: #3f4650; }
.t-chat-ped-nuevo { background: #eef3fb; border-color: #cfdcf2; color: #24508f; }
.t-chat-ped-curso { background: #fff6e5; border-color: #f2dcae; color: #8a5a00; }
.t-chat-ped-listo { background: #e7f6ec; border-color: #c6ead2; color: #137333; }
.t-chat-ped-camino { background: #eaf6f7; border-color: #c4e5e8; color: #0f6872; }
.t-chat-ped-entregado { background: #f1f3f5; border-color: #d6dbe1; color: #3f4650; }
.t-chat-ped-cancelado { background: #fdecec; border-color: #f3c9c9; color: #a12626; }

/* La ventana del detalle: encima de la charla, adentro del chat (también en el celular, donde el chat ocupa la pantalla). */
.t-chat-modal { position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(17, 24, 39, .45); }
.t-chat-modal[hidden] { display: none; }
.t-chat-modal-caja { width: 100%; max-height: 92%; display: flex; flex-direction: column; background: #fff;
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); }
.t-chat-modal-cab { display: flex; align-items: center; gap: .5rem; padding: .7rem .75rem; border-bottom: 1px solid var(--t-borde, #e6e8ec); }
.t-chat-modal-titulo { flex: 1 1 auto; font-size: 1rem; }
.t-chat-modal-cerrar { flex: none; width: 36px; height: 36px; border: 0; border-radius: 999px; background: none; color: #6b7280; }
.t-chat-modal-cerrar:hover { background: #f1f3f5; }
.t-chat-modal-cuerpo { flex: 1 1 auto; overflow-y: auto; padding: .6rem .75rem; font-size: .86rem; }
.t-chat-modal-pie { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem .75rem .75rem;
    border-top: 1px solid var(--t-borde, #e6e8ec); }
.t-chat-modal-pie .t-chat-agregar { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; font-size: .84rem; text-decoration: none; }
.t-chat-modal-pie .t-chat-agregar.secundario { background: #fff; color: var(--t-pri-legible, var(--t-pri)); border: 1px solid var(--t-pri-legible, var(--t-pri)); }
.t-chat-modal-pie .t-chat-ver { text-decoration: none; }
.t-chat-modal-pie .t-chat-ped-nota { flex-basis: 100%; margin: 0; }
.t-chat-ped-cabecera { margin: 0 0 .5rem; }
.t-chat-ped-datos { display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; margin: 0 0 .6rem; font-size: .8rem; }
.t-chat-ped-datos dt { color: #6b7280; font-weight: 600; }
.t-chat-ped-datos dd { margin: 0; overflow-wrap: anywhere; }
.t-chat-ped-renglones { list-style: none; margin: 0; padding: 0; }
.t-chat-ped-renglones li { display: flex; gap: .45rem; align-items: baseline; padding: .35rem 0; border-bottom: 1px solid #eef0f3; }
.t-chat-ped-renglones .c { flex: none; min-width: 2.3rem; color: #6b7280; font-variant-numeric: tabular-nums; }
.t-chat-ped-renglones .n { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.t-chat-ped-renglones .s { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-chat-ped-renglones li.cab .n { font-weight: 700; }
.t-chat-ped-renglones li.inc { padding: .15rem 0 .15rem 1.2rem; border-bottom: 0; font-size: .78rem; color: #6b7280; }
.t-chat-ped-renglones li.inc .s { font-weight: 400; }
.t-chat-ped-renglones li.otro .n { color: #3f4650; }
.t-chat-ped-total { display: flex; justify-content: space-between; margin: .55rem 0 .2rem; font-size: .95rem; }
.t-chat-ped-total strong { font-variant-numeric: tabular-nums; }
.t-chat-ped-nota { margin: .3rem 0 0; font-size: .74rem; color: #6b7280; }
.t-chat-ped-error { color: #a12626; }
/* El ícono general del pedido (05-11-2026, pedido del usuario: la foto de UN producto mareaba), con cuántos productos lleva. */
.t-chat-ped-icono { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
    background: #f1f3f5; background: color-mix(in srgb, var(--t-pri, #26323e) 8%, #fff); color: var(--t-pri, #26323e); }
.t-chat-ped-icono .bi { font-size: 1.55rem; line-height: 1; }
.t-chat-ped-icono small { font-size: .6rem; font-weight: 700; line-height: 1.1; color: #3f4650; text-align: center; }
