/* WhatsApp del CRM: misma distribución que la app (lista a la izquierda, chat a la derecha). */
:root { --wa-verde: #008069; --wa-verde-2: #00a884; --wa-burbuja: #d9fdd3; --wa-fondo: #efeae2; --wa-gris: #667781; --wa-linea: #e9edef; --wa-azul-palomas: #53bdeb; }
.wa { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - 56px); height: calc(100dvh - 56px); min-height: 480px; background: #fff; border-radius: 14px; box-shadow: var(--sombra); overflow: hidden; }
.wa-rapidas[hidden], .wa-adjuntos[hidden], .wa-ventana[hidden] { display: none !important; }
.wa-lista { background: #fff; color: #111b21; display: flex; flex-direction: column; border-right: 1px solid var(--wa-linea); min-height: 0; }
.wa-titulo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 4px; }
.wa-titulo b { font-size: 21px; font-weight: 700; color: #111b21; }
.wa-titulo select { font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--wa-linea); background: #fff; max-width: 190px; }
.wa-busca { display: flex; align-items: center; gap: 10px; margin: 8px 12px 6px; padding: 0 14px; height: 38px; background: #f0f2f5; border-radius: 10px; color: var(--wa-gris); }
.wa-busca svg { width: 18px; height: 18px; flex: none; }
.wa-busca input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; min-width: 0; }
.wa-filtros { display: flex; gap: 8px; padding: 4px 12px 10px; overflow-x: auto; scrollbar-width: none; }
.wa-filtros button { flex: none; border: 0; border-radius: 999px; padding: 6px 13px; background: #f0f2f5; color: var(--wa-gris); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.wa-filtros button[aria-pressed="true"] { background: #e7fce3; color: #008069; font-weight: 600; }
.wa-num { font-size: 11.5px; opacity: .8; }
.wa-hilos { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.wa-fila { display: flex; align-items: center; gap: 13px; padding: 0 14px; width: 100%; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.wa-fila:hover { background: #f5f6f6; } .wa-fila.activa { background: #f0f2f5; }
.wa-fila-txt { flex: 1; min-width: 0; padding: 11px 0; border-bottom: 1px solid var(--wa-linea); }
.wa-fila-top, .wa-fila-bajo { display: flex; align-items: center; gap: 8px; }
.wa-fila-top b { flex: 1; min-width: 0; font-weight: 500; font-size: 16px; color: #111b21; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-fila-top time { font-size: 12px; color: var(--wa-gris); flex: none; }
.wa-fila-top time.nuevo { color: #1fa855; font-weight: 600; }
.wa-fila-bajo small { flex: 1; min-width: 0; color: var(--wa-gris); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 3px; }
.wa-fila-bajo em { font-style: normal; color: #008069; }
.wa-asesor { display: block; font-size: 11.5px; color: #9a7a2a; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-badge { flex: none; min-width: 20px; height: 20px; border-radius: 999px; background: #25d366; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.wa-pausa { color: #8a5a00; display: inline-flex; } .wa-pausa svg { width: 15px; height: 15px; }
.wa-palomas { display: inline-flex; width: 17px; color: #8696a0; flex: none; } .wa-palomas.azul { color: var(--wa-azul-palomas); } .wa-palomas svg { width: 100%; height: auto; }
.wa-av { width: 49px; height: 49px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 17px; background: #dfe5e7; }
.wa-av svg { width: 26px; height: 26px; }
.wa-nada { padding: 40px 22px; text-align: center; color: var(--wa-gris); line-height: 1.5; }
.wa-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wa-fondo); position: relative; }
.wa-portada { margin: auto; text-align: center; max-width: 380px; padding: 30px; color: var(--wa-gris); }
.wa-portada span { display: inline-grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: #fff; color: var(--wa-verde-2); margin-bottom: 16px; box-shadow: 0 6px 20px -10px rgba(0,0,0,.25); }
.wa-portada span svg { width: 40px; height: 40px; }
.wa-portada b { display: block; font-size: 20px; font-weight: 500; color: #41525d; margin-bottom: 8px; }
.wa-cabeza { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f0f2f5; min-height: 60px; z-index: 2; border-bottom: 1px solid var(--wa-linea); }
.wa-cabeza .wa-av { width: 40px; height: 40px; font-size: 15px; }
.wa-cabeza-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; border: 0; background: none; text-align: left; cursor: pointer; padding: 0; font: inherit; }
.wa-cabeza-txt b { font-weight: 500; font-size: 16px; color: #111b21; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-cabeza-txt small { color: var(--wa-gris); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-atras { display: none; border: 0; background: none; color: inherit; width: 36px; height: 36px; place-items: center; margin-left: -6px; cursor: pointer; }
.wa-atras svg { width: 24px; height: 24px; }
.wa-icono { border: 0; background: none; color: #54656f; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.wa-icono:hover { background: rgba(0,0,0,.05); } .wa-icono svg { width: 22px; height: 22px; }
.wa-bot { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 7px 12px 7px 10px; font-size: 13px; font-weight: 600; cursor: pointer; background: #d9fdd3; color: #008069; flex: none; }
.wa-bot svg { width: 17px; height: 17px; } .wa-bot.pausado { background: #fff3c4; color: #8a5a00; }
.wa-ventana.abierta { background: #e7fce3; color: #146b3b; border-bottom-color: #c9eccd; padding: 6px 14px; font-size: 12.5px; }
.wa-ventana.por-cerrar { background: #fff3c4; color: #6b4a00; }
.wa-ventana.cerrada { background: #ffe9e6; color: #8c2219; border-bottom-color: #f5c6bf; }
.wa-v { flex: none; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.wa-v.por-cerrar { background: #fff3c4; color: #8a5a00; } .wa-v.cerrada { background: #ffe9e6; color: #a8322a; }
.wa-ventana { background: #fff3c4; color: #6b4a00; font-size: 13.5px; padding: 9px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid #f1df9b; }
.wa-fondo { flex: 1; min-height: 0; background-color: var(--wa-fondo); background-image: url("/crm/wa-fondo.svg"); background-size: 300px 300px; position: relative; }
.wa-mensajes { position: absolute; inset: 0; overflow-y: auto; padding: 14px 7% 18px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.wa-dia { display: flex; justify-content: center; margin: 10px 0 8px; position: sticky; top: 4px; z-index: 1; }
.wa-dia span { background: #fff; color: #54656f; font-size: 12.5px; padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px .5px rgba(11,20,26,.13); }
.wa-sistema { align-self: center; background: #fff8c5; color: #54656f; font-size: 12.8px; padding: 6px 12px; border-radius: 8px; margin: 6px 0; box-shadow: 0 1px .5px rgba(11,20,26,.13); text-align: center; }
.wa-sistema.alerta { background: #ffe9e6; color: #a8322a; }
.wa-burbuja { position: relative; max-width: min(75%, 540px); padding: 6px 8px 8px 9px; border-radius: 8px; font-size: 14.6px; line-height: 1.38; color: #111b21; box-shadow: 0 1px .5px rgba(11,20,26,.13); margin-top: 4px; overflow-wrap: anywhere; }
.wa-burbuja.ellos { align-self: flex-start; background: #fff; border-top-left-radius: 0; }
.wa-burbuja.nos { align-self: flex-end; background: var(--wa-burbuja); border-top-right-radius: 0; }
.wa-txt { white-space: pre-wrap; } .wa-txt a { color: #027eb5; text-decoration: underline; word-break: break-all; }
.wa-meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -4px 10px; font-size: 11px; color: var(--wa-gris); position: relative; top: 2px; }
.wa-quien { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: #8a5a00; margin-bottom: 2px; }
.wa-quien.bot { color: #008069; } .wa-quien svg { width: 13px; height: 13px; }
.wa-burbuja.con-medio { padding: 3px 3px 6px; }
.wa-burbuja.con-medio .wa-txt, .wa-burbuja.con-medio .wa-quien { padding: 3px 6px 0; }
.wa-burbuja.con-medio .wa-meta { margin-right: 6px; }
.wa-img { display: block; border: 0; padding: 0; background: #e9edef; border-radius: 6px; overflow: hidden; cursor: zoom-in; max-width: 300px; }
.wa-img img { display: block; width: 100%; min-width: 120px; min-height: 80px; max-height: 340px; object-fit: cover; }
.wa-img.sticker { background: none; max-width: 150px; }
.wa-video { display: block; width: 300px; max-width: 100%; max-height: 340px; border-radius: 6px; background: #000; }
.wa-audio { display: flex; align-items: center; gap: 8px; padding: 4px 4px 0; min-width: 240px; }
.wa-audio-ico { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #00a884; color: #fff; } .wa-audio-ico svg { width: 20px; height: 20px; }
.wa-audio audio { flex: 1; height: 38px; min-width: 0; }
.wa-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; background: rgba(11,20,26,.05); color: #111b21; min-width: 220px; text-decoration: none; }
.wa-doc svg { width: 30px; height: 30px; color: #e5544b; flex: none; } .wa-doc span { display: flex; flex-direction: column; min-width: 0; }
.wa-doc b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .wa-doc small { color: var(--wa-gris); font-size: 12px; }
.wa-rapidas { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px; background: #f0f2f5; border-top: 1px solid var(--wa-linea); scrollbar-width: none; }
.wa-rapidas button { flex: none; width: 190px; text-align: left; border: 0; background: #fff; border-radius: 12px; padding: 9px 12px; cursor: pointer; box-shadow: 0 1px .5px rgba(11,20,26,.13); font: inherit; }
.wa-rapidas b { display: block; font-size: 13.5px; color: #008069; margin-bottom: 2px; }
.wa-rapidas span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; color: var(--wa-gris); }
.wa-adjuntos { display: flex; justify-content: center; flex-wrap: wrap; gap: 22px; padding: 16px 12px 10px; background: #f0f2f5; border-top: 1px solid var(--wa-linea); }
.wa-adjuntos label, .wa-adjuntos > button { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; color: #54656f; cursor: pointer; border: 0; background: none; font: inherit; }
.wa-adj { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; } .wa-adj svg { width: 24px; height: 24px; }
.wa-adj.morado { background: #7f66ff; } .wa-adj.rosa { background: #ff2e74; } .wa-adj.azul { background: #5157ae; } .wa-adj.rojo { background: #d3396d; } .wa-adj.oro { background: #c59b3e; }
.wa-escribir { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: #f0f2f5; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.wa-caja { flex: 1; display: flex; align-items: flex-end; background: #fff; border-radius: 24px; min-height: 46px; padding: 3px 4px; }
.wa-caja textarea { flex: 1; border: 0; outline: none; resize: none; background: none; padding: 10px 4px; font-size: 16px; line-height: 1.35; max-height: 130px; min-width: 0; }
.wa-enviar { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--wa-verde-2); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.wa-enviar:disabled { background: #8696a0; } .wa-enviar svg { width: 22px; height: 22px; margin-left: 2px; }
.wa-previa { display: grid; gap: 8px; place-items: center; background: #f0f2f5; border-radius: 14px; padding: 12px; margin-bottom: 14px; max-height: 50vh; overflow-y: auto; }
.wa-previa img, .wa-previa video { max-width: 100%; max-height: 40vh; border-radius: 8px; }
.wa-visor { position: fixed; inset: 0; z-index: 200; background: rgba(11,20,26,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 60px 16px 24px; }
.wa-visor img { max-width: 100%; max-height: calc(100% - 60px); object-fit: contain; }
.wa-visor > button { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.wa-visor > button svg { width: 24px; height: 24px; }
.wa-opciones { display: grid; gap: 6px; margin-bottom: 12px; }
.wa-opciones button { text-align: left; border: 1px solid var(--linea); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; }
.wa-opciones small { display: block; color: var(--suave); }
main:has(> #vista.wa-main) { padding: 0 !important; }
#vista.wa-main .wa { height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }

/* Tablet y celular: la lista ocupa la pantalla y el chat se abre encima, como la app */
@media (max-width: 860px) {
  .wa { grid-template-columns: 1fr; }
  .wa .wa-chat { display: none; }
  .wa.abierto .wa-chat { display: flex; position: fixed; inset: 0; z-index: 120; height: 100vh; height: 100dvh; }
  .wa.abierto .wa-lista { display: none; }
  .wa-atras { display: grid; }
  .wa-cabeza { background: var(--wa-verde); color: #fff; border: 0; padding-top: max(8px, env(safe-area-inset-top)); }
  .wa-cabeza-txt b, .wa-cabeza-txt small, .wa-cabeza .wa-icono, .wa-atras { color: #fff; }
  .wa-cabeza-txt small { opacity: .85; }
  .wa-bot { background: rgba(255,255,255,.18); color: #fff; padding: 9px; } .wa-bot.pausado { background: #fff3c4; color: #8a5a00; }
  .wa-bot span { display: none; }
  .wa-mensajes { padding: 10px 12px 14px; }
  .wa-burbuja { max-width: 85%; }
  .wa-img, .wa-video { max-width: 240px; }
  body.wa-pantalla { overflow: hidden; }
}
