/* CONSERVE · CRM: bandeja de WhatsApp, afiliaciones y configuración. */

/* ---------- Bandeja (al estilo de WhatsApp) ---------- */
.wa {
  --wa-verde: #00a884; --wa-verde-osc: #008069; --wa-fondo-chat: #efeae2; --wa-entrada: #ffffff; --wa-salida: #d9fdd3; --wa-cabeza: #f0f2f5;
  --wa-texto: #111b21; --wa-sutil: #667781; --wa-linea: #e9edef; --wa-azul: #53bdeb; --wa-item-activo: #f0f2f5; --wa-sombra: 0 1px .5px rgba(11, 20, 26, .13);
  --wa-panel: #ffffff; --wa-dia: #ffffff; --wa-automatico: #e7f3ff;
  display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); height: calc(100dvh - 150px); min-height: 480px; position: relative;
  background: var(--wa-panel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; color: var(--wa-texto);
}
:root[data-tema="oscuro"] .wa {
  --wa-fondo-chat: #0b141a; --wa-entrada: #202c33; --wa-salida: #005c4b; --wa-cabeza: #202c33; --wa-texto: #e9edef; --wa-sutil: #8696a0;
  --wa-linea: #222d34; --wa-item-activo: #2a3942; --wa-panel: #111b21; --wa-dia: #182229; --wa-automatico: #1d3442; --wa-sombra: 0 1px .5px rgba(0, 0, 0, .3);
}
.wa.con-info { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) 340px; }
.wa-icono {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--wa-sutil); display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.wa-icono:hover { background: rgba(0, 0, 0, .06); color: var(--wa-texto); }
.wa-icono svg.i { width: 22px; height: 22px; }

/* Lista */
.wa-lista { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--wa-linea); background: var(--wa-panel); }
.wa-lista-cabeza { display: flex; align-items: center; padding: 10px 12px 4px 18px; }
.wa-lista-cabeza h2 { font-size: 21px; font-weight: 700; flex: 1; }
.wa-buscar { display: flex; align-items: center; gap: 10px; margin: 6px 12px; padding: 0 12px; height: 38px; border-radius: 9px; background: var(--wa-cabeza); color: var(--wa-sutil); }
.wa-buscar input { border: 0 !important; background: transparent !important; box-shadow: none !important; flex: 1; padding: 0 !important; height: 36px; color: var(--wa-texto); }
.wa-filtros { display: flex; gap: 6px; padding: 4px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.wa-filtros button { border: 0; background: var(--wa-cabeza); color: var(--wa-sutil); border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.wa-filtros button.activo { background: #d9fdd3; color: #008069; font-weight: 600; }
:root[data-tema="oscuro"] .wa-filtros button.activo { background: #0a332c; color: #25d366; }
.wa-chats { overflow-y: auto; flex: 1; }
.wa-item { display: flex; gap: 13px; align-items: center; padding: 0 0 0 13px; cursor: pointer; text-decoration: none; color: inherit; }
.wa-item:hover { background: var(--wa-item-activo); }
.wa-item.activo { background: var(--wa-item-activo); }
.wa-item-texto { flex: 1; min-width: 0; border-bottom: 1px solid var(--wa-linea); padding: 11px 14px 11px 0; }
.wa-item .arriba, .wa-item .abajo { display: flex; align-items: center; gap: 6px; }
.wa-item .arriba b { flex: 1; font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item .arriba time { font-size: 12px; color: var(--wa-sutil); flex: none; }
.wa-item.sin-leer .arriba time { color: #25d366; font-weight: 600; }
.wa-item .previa { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; color: var(--wa-sutil); font-size: 14px; }
.wa-item .previa > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-num { background: #25d366; color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
:root[data-tema="oscuro"] .wa-num { color: #111b21; }
.wa-bot-mini { color: var(--wa-sutil); display: inline-flex; }
.wa-bot-mini svg.i { width: 14px; height: 14px; }
.wa-escribiendo { color: #25d366 !important; font-weight: 500; }
.wa-vacio { text-align: center; color: var(--wa-sutil); padding: 40px 20px; }

/* Avatares (foto de WhatsApp o iniciales) */
.wa-avatar { width: 49px; height: 49px; border-radius: 50%; flex: none; position: relative; overflow: hidden; background: #dfe5e7; color: #fff; display: grid; place-items: center; }
.wa-avatar > span { font-weight: 600; font-size: 17px; color: #54656f; }
:root[data-tema="oscuro"] .wa-avatar { background: #6a7175; }
:root[data-tema="oscuro"] .wa-avatar > span { color: #e9edef; }
.wa-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wa-avatar.mini { width: 40px; height: 40px; }
.wa-avatar.mini > span { font-size: 14px; }
.wa-avatar.grande { width: 180px; height: 180px; }
.wa-avatar.grande > span { font-size: 56px; }

/* Chat */
.wa-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background-color: var(--wa-fondo-chat);
  background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px); background-size: 18px 18px; }
:root[data-tema="oscuro"] .wa-chat { background-image: radial-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px); }
.wa-chat.soltando::after { content: 'Suelta los archivos para enviarlos'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 168, 132, .18); color: var(--wa-verde-osc); font-weight: 700; font-size: 18px; z-index: 5; }
.wa-sin-chat { margin: auto; text-align: center; color: var(--wa-sutil); padding: 30px; }
.wa-sin-chat svg.i { width: 64px; height: 64px; opacity: .5; }
.wa-sin-chat h3 { margin: 12px 0 6px; color: var(--wa-texto); font-weight: 400; font-size: 26px; }
.wa-chat-cabeza { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--wa-cabeza); min-height: 58px; z-index: 2; }
.wa-volver { display: none; }
.wa-quien { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; cursor: pointer; padding: 2px 6px; color: inherit; font: inherit; }
.wa-quien > span:last-child { min-width: 0; display: grid; }
.wa-quien b { font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-quien small { color: var(--wa-sutil); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat-cabeza .wa-avatar { width: 40px; height: 40px; }
.wa-chat-cabeza .acciones { display: flex; }
.wa-modo { display: flex; align-items: center; gap: 8px; padding: 5px 14px; font-size: 12.5px; background: var(--wa-automatico); color: var(--wa-sutil); z-index: 1; }
.wa-modo.humano { background: var(--aviso-50); color: var(--aviso); }
.wa-modo span { flex: 1; }
.wa-modo button { border: 0; background: transparent; color: var(--wa-verde-osc); font: inherit; font-weight: 700; cursor: pointer; padding: 2px 4px; }
:root[data-tema="oscuro"] .wa-modo button { color: #25d366; }
.wa-mensajes { flex: 1; overflow-y: auto; padding: 10px 5% 8px; overscroll-behavior: contain; }
.wa-dia { display: flex; justify-content: center; margin: 10px 0; position: sticky; top: 4px; z-index: 1; }
.wa-dia span, .wa-no-leidos span { background: var(--wa-dia); color: var(--wa-sutil); font-size: 12.5px; padding: 5px 12px; border-radius: 8px; box-shadow: var(--wa-sombra); }
.wa-no-leidos { display: flex; justify-content: center; margin: 10px -6%; padding: 4px 0; background: rgba(255, 255, 255, .25); }
.wa-cargando { display: flex; justify-content: center; padding: 10px; }
.wa-bajar { position: absolute; right: 18px; bottom: 76px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--wa-entrada); color: var(--wa-sutil); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer; display: grid; place-items: center; z-index: 3; }
.wa-bajar span:not(:empty) { position: absolute; top: -6px; right: -4px; background: #25d366; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 6px; }

/* Mensajes */
.crm-fila { display: flex; margin-top: 2px; transition: transform .15s; }
.crm-fila.colita { margin-top: 10px; }
.crm-fila.salida { justify-content: flex-end; }
.crm-msg { position: relative; max-width: min(65%, 560px); padding: 6px 7px 8px 9px; border-radius: 7.5px; background: var(--wa-entrada); box-shadow: var(--wa-sombra); font-size: 14.2px; line-height: 19px; word-wrap: break-word; overflow-wrap: anywhere; }
.crm-fila.salida .crm-msg { background: var(--wa-salida); }
.crm-fila.automatico .crm-msg { background: var(--wa-automatico); }
.crm-fila.colita.entrada .crm-msg { border-top-left-radius: 0; }
.crm-fila.colita.salida .crm-msg { border-top-right-radius: 0; }
.crm-fila.colita.entrada .crm-msg::before, .crm-fila.colita.salida .crm-msg::before {
  content: ''; position: absolute; top: 0; width: 8px; height: 13px; background: inherit;
}
.crm-fila.colita.entrada .crm-msg::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.crm-fila.colita.salida .crm-msg::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.crm-fila.sin-burbuja .crm-msg { background: transparent !important; box-shadow: none; padding: 0; }
.crm-fila.sin-burbuja .crm-msg::before { display: none; }
.crm-fila.sin-burbuja .crm-pie { background: rgba(0, 0, 0, .35); color: #fff; border-radius: 8px; padding: 0 6px; float: right; }
.crm-fila.seleccionada .crm-msg { filter: brightness(.93); }
.crm-fila.resaltado .crm-msg { animation: wa-resaltar 1.6s ease; }
@keyframes wa-resaltar { 0%, 60% { box-shadow: 0 0 0 4px rgba(0, 168, 132, .45); } 100% { box-shadow: var(--wa-sombra); } }
.crm-texto { white-space: pre-wrap; }
.crm-texto.emojis { font-size: 42px; line-height: 50px; }
.crm-texto a { color: #027eb5; }
.crm-texto code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.crm-pie { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 8px 0 -5px 10px; font-size: 11px; color: var(--wa-sutil); line-height: 15px; position: relative; }
.crm-pie .editado { font-style: italic; margin-right: 2px; }
.crm-chip { font-size: 9.5px; font-weight: 700; padding: 0 4px; border-radius: 3px; background: rgba(0, 0, 0, .08); letter-spacing: .02em; }
.crm-tick { display: inline-flex; color: var(--wa-sutil); }
.crm-tick svg.i { width: 16px; height: 16px; }
.crm-tick.leido { color: var(--wa-azul); }
.crm-tick.error { color: var(--peligro); }
.crm-autor { font-size: 12px; font-weight: 600; color: #1f7aec; display: flex; gap: 4px; align-items: center; margin-bottom: 2px; }
.crm-autor svg.i { width: 13px; height: 13px; }
.crm-falla { color: var(--peligro); font-size: 12px; margin-top: 3px; }
.crm-eliminado { color: var(--wa-sutil); font-style: italic; display: inline-flex; align-items: center; gap: 5px; }
.crm-msg-menu { position: absolute; top: 3px; right: 3px; width: 24px; height: 22px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; opacity: 0; z-index: 2;
  background: radial-gradient(circle at 60% 40%, var(--wa-entrada) 45%, transparent 75%); color: var(--wa-sutil); transition: opacity .12s; }
.crm-fila.salida .crm-msg-menu { background: radial-gradient(circle at 60% 40%, var(--wa-salida) 45%, transparent 75%); }
.crm-fila:hover .crm-msg-menu { opacity: 1; }
@media (pointer: coarse) { .crm-msg-menu { display: none; } }

/* Fotos, videos, stickers y documentos */
.crm-foto-msg, .crm-video-msg { display: block; border: 0; padding: 0; margin: -3px -4px 4px -6px; border-radius: 6px; overflow: hidden; cursor: pointer; position: relative; background: rgba(0, 0, 0, .06); }
.crm-foto-msg img, .crm-video-msg video { display: block; width: 330px; max-width: 100%; max-height: 340px; object-fit: cover; }
.crm-fila.solo-foto .crm-msg { padding: 3px; }
.crm-fila.solo-foto .crm-foto-msg, .crm-fila.solo-foto .crm-video-msg { margin: 0; }
.crm-fila.solo-foto .crm-pie { position: absolute; right: 8px; bottom: 7px; margin: 0; color: #fff; text-shadow: 0 0 4px rgba(0, 0, 0, .6); }
.crm-fila.solo-foto .crm-pie .crm-tick, .crm-fila.solo-foto .crm-pie .crm-tick.leido { color: #fff; }
.crm-video-msg .play { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; display: grid; place-items: center; }
.crm-sticker { width: 150px; height: 150px; object-fit: contain; display: block; }
.crm-doc-msg { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: -2px -3px 4px -5px; border-radius: 6px; background: rgba(0, 0, 0, .05); color: inherit; text-decoration: none; min-width: 230px; }
.crm-doc-msg .ext { width: 34px; height: 40px; border-radius: 4px; background: #8696a0; color: #fff; font-size: 9px; font-weight: 800; display: grid; place-items: end center; padding-bottom: 5px; flex: none; }
.crm-doc-msg .ext.pdf { background: #e2403d; }
.crm-doc-msg .nombre { flex: 1; min-width: 0; display: grid; font-size: 14px; }
.crm-doc-msg .nombre small { color: var(--wa-sutil); font-size: 11.5px; }
.crm-doc-msg .bajar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--wa-sutil); display: grid; place-items: center; color: var(--wa-sutil); }
.crm-pendiente { display: flex; align-items: center; gap: 10px; border: 0; background: rgba(0, 0, 0, .05); border-radius: 6px; padding: 10px 12px; margin: -2px -3px 4px -5px; cursor: pointer; color: inherit; font: inherit; text-align: left; min-width: 220px; }
.crm-pendiente .circulo { width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, .35); color: #fff; display: grid; place-items: center; flex: none; }
.crm-pendiente small { display: block; color: var(--wa-sutil); font-size: 12px; }
.crm-pendiente > span:last-child { display: grid; }
.crm-pendiente.bajando .circulo { animation: wa-girar 1s linear infinite; }
@keyframes wa-girar { to { transform: rotate(360deg); } }

/* Nota de voz */
.crm-voz { display: flex; align-items: center; gap: 8px; min-width: 250px; padding: 2px 0 6px; }
.crm-voz-foto { position: relative; flex: none; }
.crm-voz-foto .mic { position: absolute; right: -4px; bottom: -2px; color: #25d366; display: flex; }
.crm-voz-play { width: 34px; height: 34px; border: 0; background: transparent; color: var(--wa-sutil); cursor: pointer; display: grid; place-items: center; flex: none; }
.crm-voz-play svg.i { width: 26px; height: 26px; fill: currentColor; }
.crm-voz-barra { flex: 1; display: grid; gap: 2px; }
.crm-voz-barra input[type=range] { width: 100%; height: 4px; accent-color: #25d366; padding: 0; margin: 8px 0 0; border: 0; background: transparent; }
.crm-voz-tiempo { font-size: 11px; color: var(--wa-sutil); }
.crm-voz-vel { border: 0; border-radius: 999px; background: rgba(0, 0, 0, .25); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 7px; cursor: pointer; }

/* Citas y reacciones */
.crm-cita { display: flex; gap: 8px; width: 100%; margin: -2px -3px 5px -5px; padding: 6px 8px; border: 0; border-left: 4px solid #06cf9c; border-radius: 6px; background: rgba(0, 0, 0, .05); text-align: left; cursor: pointer; color: inherit; font: inherit; font-size: 13px; }
.crm-cita.propia { border-left-color: #53bdeb; }
.crm-cita .texto { flex: 1; min-width: 0; display: grid; }
.crm-cita b { font-size: 12.5px; color: #06a17f; }
.crm-cita.propia b { color: #1f7aec; }
.crm-cita .texto > span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--wa-sutil); }
.crm-cita img { width: 46px; height: 46px; object-fit: cover; border-radius: 4px; }
.crm-reaccion { position: absolute; bottom: -16px; right: 8px; background: var(--wa-entrada); border-radius: 999px; padding: 1px 5px; font-size: 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.crm-fila.entrada .crm-reaccion { right: auto; left: 8px; }
.crm-fila.con-reaccion { margin-bottom: 16px; }

/* Barra de responder / editar y redactar */
.wa-respondiendo { display: flex; align-items: center; gap: 6px; background: var(--wa-cabeza); padding: 8px 10px 0 16px; }
.wa-cita-redactar { flex: 1; min-width: 0; border-left: 4px solid #06cf9c; border-radius: 6px; background: rgba(0, 0, 0, .05); padding: 6px 10px; display: grid; font-size: 13px; }
.wa-cita-redactar.propia { border-left-color: #53bdeb; }
.wa-cita-redactar b { color: #06a17f; font-size: 12.5px; }
.wa-cita-redactar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--wa-sutil); }
.wa-redactar { display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px 8px; background: var(--wa-cabeza); }
.wa-campo { flex: 1; display: flex; align-items: flex-end; background: var(--wa-entrada); border-radius: 22px; padding: 0 4px 0 14px; min-height: 44px; }
.wa-campo textarea { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; resize: none; padding: 12px 0 !important; min-height: 44px; max-height: 140px; font-size: 15px; line-height: 20px; color: var(--wa-texto); outline: none; }
.wa-campo .wa-icono { width: 38px; height: 42px; }
.wa-enviar { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--wa-verde); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.wa-enviar svg.i { width: 22px; height: 22px; }
.wa-redactar.grabando { align-items: center; }
.wa-grabando { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px; background: var(--wa-entrada); border-radius: 22px; font-variant-numeric: tabular-nums; }
.wa-grabando .punto { width: 10px; height: 10px; border-radius: 50%; background: #f15c6d; animation: wa-latir 1s infinite; }
.wa-grabando .ayuda { color: var(--wa-sutil); font-size: 13px; }
@keyframes wa-latir { 50% { opacity: .25; } }

/* Emojis */
.wa-emojis-cont { background: var(--wa-cabeza); border-top: 1px solid var(--wa-linea); }
.crm-emojis { height: 300px; display: flex; flex-direction: column; }
.crm-emojis-cabeza { padding: 8px 10px 0; display: grid; gap: 6px; }
.crm-emojis-cabeza input { height: 34px; border-radius: 8px; }
.crm-emojis-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.crm-emojis-tabs button { border: 0; background: transparent; font-size: 20px; padding: 4px 8px; cursor: pointer; border-bottom: 3px solid transparent; opacity: .6; }
.crm-emojis-tabs button.activa { border-bottom-color: var(--wa-verde); opacity: 1; }
.crm-emojis-cuerpo { overflow-y: auto; flex: 1; padding: 0 8px 8px; }
.crm-emojis-cuerpo h5 { margin: 8px 4px 4px; font-size: 12px; color: var(--wa-sutil); font-weight: 600; }
.crm-emojis-rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.crm-emojis-rejilla button { border: 0; background: transparent; font-size: 26px; height: 42px; cursor: pointer; border-radius: 8px; }
.crm-emojis-rejilla button:hover { background: rgba(0, 0, 0, .07); }
.crm-emojis-nada { color: var(--wa-sutil); text-align: center; padding: 20px; }

/* Menús flotantes */
.wa-menu { position: fixed; z-index: 2000; min-width: 210px; background: var(--tarjeta); color: var(--tinta); border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); padding: 6px 0; animation: wa-aparecer .12s ease; }
@keyframes wa-aparecer { from { opacity: 0; transform: scale(.96); } }
.wa-menu-reacciones { display: flex; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid var(--linea); margin-bottom: 4px; }
.wa-menu-reacciones button { border: 0; background: transparent; font-size: 26px; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; }
.wa-menu-reacciones button.activa, .wa-menu-reacciones button:hover { background: var(--marca-50); }
.wa-menu-op { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: transparent; padding: 10px 18px; font: inherit; font-size: 14.5px; color: inherit; cursor: pointer; text-align: left; }
.wa-menu-op:hover { background: var(--marca-50); }
.wa-menu-op.peligro { color: var(--peligro); }
.wa-menu-adjuntar .circ { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.circ.morado { background: #7f66ff; } .circ.rosa { background: #ff2e74; } .circ.azul { background: #5157ae; } .circ.naranja { background: #ff8c00; }

/* Panel de información del contacto */
.wa-info { display: flex; flex-direction: column; min-height: 0; background: var(--wa-fondo-chat); border-left: 1px solid var(--wa-linea); }
.wa-info[hidden] { display: none; }
.wa-info-cabeza { display: flex; align-items: center; gap: 14px; padding: 8px 10px; background: var(--wa-cabeza); min-height: 58px; }
.wa-info-cuerpo { overflow-y: auto; flex: 1; }
.wa-info-perfil { background: var(--wa-panel); text-align: center; padding: 24px 16px; margin-bottom: 8px; display: grid; justify-items: center; gap: 2px; }
.wa-info-perfil h3 { font-size: 22px; font-weight: 400; margin-top: 12px; }
.wa-info-perfil p { margin: 0; color: var(--wa-sutil); font-size: 15px; }
.wa-info-seccion { background: var(--wa-panel); padding: 14px 18px; margin-bottom: 8px; display: grid; gap: 8px; }
.wa-info-seccion h4 { font-size: 14px; font-weight: 500; color: var(--wa-sutil); }
.wa-info-seccion h4 small { display: block; font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.wa-info-medios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.wa-info-medios button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 6px; overflow: hidden; cursor: pointer; background: rgba(0, 0, 0, .08); display: grid; place-items: center; }
.wa-info-medios img { width: 100%; height: 100%; object-fit: cover; }
.wa-asociado { border: 1px solid var(--wa-linea); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.wa-asociado .fila { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.wa-asociado small { color: var(--wa-sutil); }
.wa-asociado dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 4px 0; font-size: 13px; }
.wa-asociado dt { color: var(--wa-sutil); }
.wa-asociado dd { margin: 0; }
.wa-asociado .btn { justify-self: start; margin-top: 4px; }
.wa-info-enlace { display: flex; gap: 8px; align-items: center; color: inherit; text-decoration: none; padding: 4px 0; }
.wa-info .sutil, .wa-info-seccion .sutil { color: var(--wa-sutil); margin: 0; }
.wa-reenviar { max-height: 50vh; overflow-y: auto; display: grid; }
.wa-reenviar-item { display: flex; align-items: center; gap: 12px; padding: 6px 4px; cursor: pointer; }
.wa-reenviar-item .wa-avatar { width: 38px; height: 38px; }
.wa-info-msg p { margin: 4px 0; }

/* Visor de fotos y vista previa (pantalla completa) */
body.crm-sin-scroll { overflow: hidden; }
.crm-visor { position: fixed; inset: 0; z-index: 3000; background: rgba(11, 20, 26, .97); color: #e9edef; display: flex; flex-direction: column; }
.crm-visor header { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.crm-visor header .quien { flex: 1; display: grid; min-width: 0; }
.crm-visor header small { color: #8696a0; }
.crm-visor-boton { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: #e9edef; display: grid; place-items: center; cursor: pointer; }
.crm-visor-boton:hover { background: rgba(255, 255, 255, .1); }
.crm-visor-medio { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; padding: 0 56px; }
.crm-visor-medio img, .crm-visor-medio video { max-width: 100%; max-height: 100%; object-fit: contain; }
.crm-visor-flecha { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.crm-visor-flecha.izq { left: 8px; } .crm-visor-flecha.der { right: 8px; }
.crm-visor footer { padding: 12px 20px 20px; text-align: center; }
.crm-previa-doc { display: grid; justify-items: center; gap: 8px; text-align: center; }
.crm-previa-doc svg.i { width: 80px; height: 80px; }
.crm-previa-miniaturas { display: flex; gap: 6px; justify-content: center; padding: 8px; overflow-x: auto; }
.crm-previa-miniaturas button { width: 52px; height: 52px; border-radius: 6px; border: 2px solid transparent; overflow: hidden; padding: 0; background: #202c33; color: #fff; cursor: pointer; display: grid; place-items: center; }
.crm-previa-miniaturas button.activa { border-color: #00a884; }
.crm-previa-miniaturas img { width: 100%; height: 100%; object-fit: cover; }
.crm-previa-pie { display: flex; gap: 10px; align-items: center; padding: 10px 14px 18px; }
.crm-previa-pie input { flex: 1; height: 46px; border-radius: 23px; background: #2a3942 !important; color: #e9edef; border: 0 !important; padding: 0 18px !important; }
.crm-enviar { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #00a884; color: #fff; display: grid; place-items: center; cursor: pointer; }

/* Celular: la lista ocupa todo y el chat se abre a pantalla completa, como en WhatsApp. */
@media (max-width: 860px) {
  .wa, .wa.con-info { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 140px); border-radius: 12px; }
  .wa .wa-chat { display: none; }
  .wa.con-chat .wa-chat { display: flex; position: fixed; inset: 0; z-index: 1500; }
  .wa.con-info .wa-info { position: fixed; inset: 0; z-index: 1600; }
  .wa-volver { display: inline-grid; }
  .wa-mensajes { padding: 8px 3% 6px; }
  .crm-msg { max-width: 85%; }
  .wa-chat-cabeza { padding: 4px 4px 4px 0; }
  .wa-quien { padding: 2px 0; gap: 8px; }
  body.wa-chat-abierto { overflow: hidden; }
  .crm-visor-medio { padding: 0; }
  .crm-visor-flecha { display: none; }
}

/* ---------- Afiliaciones ---------- */
.crm-avance { display: flex; gap: 4px; flex-wrap: wrap; }
.crm-ent {
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--linea); color: var(--tinta-suave);
}
.crm-ent.afiliado { background: var(--exito-50); color: var(--exito); border-color: transparent; }
.crm-ent.enviada { background: var(--info-50); color: var(--info); border-color: transparent; }
.crm-ent.rechazada { background: var(--peligro-50); color: var(--peligro); border-color: transparent; }
.crm-entidades { display: grid; gap: 10px; }
.crm-entidad {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--linea); border-radius: var(--radio-sm);
}
.crm-entidad .tipo { font-weight: 800; font-size: 13px; text-align: center; padding: 8px 0; border-radius: 8px; background: var(--marca-50); color: var(--marca-700); }
.crm-entidad.afiliado .tipo { background: var(--exito-50); color: var(--exito); }
.crm-entidad .detalle small { display: block; color: var(--tinta-suave); }
.crm-entidad .acciones { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.crm-docs { display: flex; gap: 10px; flex-wrap: wrap; }
.crm-doc { width: 128px; border: 1px solid var(--linea); border-radius: var(--radio-sm); overflow: hidden; font-size: 11.5px; background: var(--tarjeta); }
.crm-doc a { color: inherit; text-decoration: none; display: block; }
.crm-doc .vista { height: 92px; display: grid; place-items: center; background: var(--fondo); }
.crm-doc .vista img { width: 100%; height: 92px; object-fit: cover; }
.crm-doc .pie { padding: 5px 7px; display: flex; justify-content: space-between; gap: 4px; align-items: center; }
.crm-doc .pie span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-falta { margin: 0; padding-left: 18px; }

@media (max-width: 700px) {
  .crm-entidad { grid-template-columns: 48px 1fr; }
  .crm-entidad .acciones { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- Configuración ---------- */
.crm-canales { display: grid; gap: 12px; }
.crm-canal { border: 1px solid var(--linea); border-radius: var(--radio-sm); padding: 14px; display: grid; gap: 10px; }
.crm-canal .cabeza { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.crm-canal .cabeza b { font-size: 14.5px; }
.crm-canal .cabeza .acciones { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.crm-qr { display: grid; justify-items: center; gap: 8px; padding: 10px; text-align: center; }
.crm-qr img { width: 260px; height: 260px; background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--linea); }
.crm-codigo { font-size: 30px; font-weight: 800; letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.crm-copiar { display: flex; gap: 6px; }
.crm-copiar input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.crm-correos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px 16px; }
.crm-correos .campo { grid-column: auto; }

/* Ventana de 24 horas cerrada por la API oficial: en vez de escribir, se envía la plantilla. */
.wa-ventana { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; color: var(--wa-texto); font-size: 13.5px; }
.wa-ventana p { margin: 0; line-height: 1.4; }
.wa-ventana .btn { flex: none; }
