/* Chat de la web (visitantes y clientes): panel/chat_web.php. Etapa V4.
   Usa los tokens y los estilos del chat de panel.css; acá solo lo propio. */

html, body { height: 100%; }
body.chat-web { background: var(--fondo); overflow: hidden; }
body.chat-web.en-iframe { background: transparent; }

/* Suelta (sin iframe): una tarjeta centrada. En un iframe: ocupa todo. */
.cw { position: relative; z-index: 1; height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.cw .chat { width: 100%; max-width: 440px; height: min(720px, 100%); box-shadow: var(--sombra-f); }
.en-iframe .cw { padding: 0; }
.en-iframe .cw .chat { max-width: none; height: 100%; border-radius: 0; border: 0; box-shadow: none; }
.en-iframe .solo-suelto { display: none !important; }
body:not(.en-iframe) .solo-iframe { display: none !important; }
@media (max-width: 640px) {
  .cw { padding: 0; }
  .cw .chat { max-width: none; height: 100%; border-radius: 0; border: 0; }
}

.chat-cab { padding: 12px 12px 12px 16px; }
.chat-cab .tit { flex: 1; min-width: 0; }
.chat-cab h1 { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; }
.chat-cab .sub a, .chat-cab .sub button { color: var(--celeste-o); font-weight: 600; margin-left: 4px; font-size: 12.5px; }

/* Pantallas del formulario */
.pantalla { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.pantalla > * { flex-shrink: 0; }
form.pantalla { gap: 10px; }
.pantalla.centro { align-items: center; justify-content: center; text-align: center; }
.pantalla h2 { font-size: 19px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.pantalla p.sub2 { font-size: 13.5px; color: var(--t3); margin-top: -6px; }
.pantalla.centro p.sub2 { margin-top: 0; max-width: 320px; }
.opcion { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; padding: 14px; border: 1px solid var(--borde); border-radius: 16px; background: #fff; transition: border-color .15s, transform .15s; }
.opcion:hover { border-color: var(--tinta); transform: translateY(-1px); }
.opcion .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.opcion .ic.verde { background: var(--verde-s); color: var(--verde-o); }
.opcion .ic.celeste { background: var(--celeste-s); color: var(--celeste-o); }
.opcion b { display: block; font-size: 14.5px; }
.opcion small { display: block; font-size: 12.5px; color: var(--t3); }

.cw .campo { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.cw .campo label { font-size: 12.5px; font-weight: 600; color: var(--t2); }
.cw .campo .opc { font-weight: 400; color: var(--t4); }
.cw .campo input { height: 42px; padding: 0 13px; border-radius: 12px; border: 1px solid var(--borde-f); font: inherit; font-size: 15px; outline: 0; }
.cw .campo textarea { min-height: 72px; resize: none; padding: 9px 13px; border-radius: 12px; border: 1px solid var(--borde-f); font: inherit; font-size: 15px; line-height: 1.45; outline: 0; }
.cw .campo input:focus, .cw .campo textarea:focus { border-color: var(--celeste); box-shadow: 0 0 0 4px rgba(63,160,218,.12); }
.temas { display: flex; flex-wrap: wrap; gap: 6px; }
.tema { font-size: 12.5px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--borde-f); background: #fff; }
.tema.on { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.legal { font-size: 11.5px; color: var(--t4); line-height: 1.45; }
.legal a { text-decoration: underline; }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.enlace { font-size: 13px; color: var(--t3); text-align: center; }
.enlace button, .enlace a { color: var(--celeste-o); font-weight: 600; font-size: 13px; }
.aviso-cuenta { background: var(--celeste-s); border: 1px solid #cfe6f6; border-radius: 14px; padding: 12px 14px; font-size: 13.5px; color: #1e5677; display: flex; gap: 10px; }
.aviso-cuenta svg { color: var(--celeste-o); margin-top: 1px; }
.codigo { display: flex; gap: 8px; }
.codigo input { width: 100%; min-width: 0; height: 52px; text-align: center; font-family: var(--mono); font-size: 22px; border: 1px solid var(--borde-f); border-radius: 12px; outline: 0; }
.codigo input:focus { border-color: var(--celeste); box-shadow: 0 0 0 4px rgba(63,160,218,.12); }
.ayuda-cod { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; color: var(--t3); border-top: 1px solid var(--borde); padding-top: 14px; }
.ayuda-cod b { color: var(--t2); }
.ayuda-cod button { color: var(--celeste-o); font-weight: 600; font-size: 13px; }
.ayuda-cod button:disabled { color: var(--t4); opacity: 1; }
.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }

/* Conversación */
.pantalla-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.pantalla-chat[hidden] { display: none !important; }
.cw .horario { margin: 10px 12px; }
.cw .mensajes { margin-top: 0; }
.cw .msj { max-width: 84%; }.pie-mail { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 8px 16px; background: #fff; border-top: 1px solid var(--borde); font-size: 12px; color: var(--t3); }
.pie-mail svg { width: 15px; height: 15px; flex: none; }
.pie-mail .txt { flex: 1; min-width: 0; }
.pie-mail b { color: var(--t2); font-weight: 600; overflow-wrap: anywhere; }
.pie-mail a, .pie-mail button { color: var(--celeste-o); font-weight: 600; font-size: 12px; white-space: nowrap; }
.cw .redactor { padding: 10px; }
.bloqueado { padding: 10px 16px; background: var(--rojo-s); color: #8f2424; font-size: 13px; border-top: 1px solid #f6caca; }
.cw .chat.arrastrando .soltar { display: grid; }
