/* =============================================================================
   Soft Imperio — Plataforma WhatsApp Business (/whatsapp)
   Réplica fiel de WhatsApp Web sobre la API oficial de Meta: riel de iconos,
   lista de chats con filtros y Archivados, burbujas con cola, palomitas,
   chips de fecha, notas de voz, stickers, reacciones y el verde #00a884.
   Tema claro y oscuro con variables.
   ============================================================================= */

.wa, .wa * , .wa *::before, .wa *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* El atributo hidden SIEMPRE gana: sin esto, cualquier display:flex/grid de
   una clase lo anularía y los modales/drawer aparecerían abiertos. */
.wa [hidden], .wa[hidden] { display: none !important; }

.wa {
  /* ---- Paleta WhatsApp (claro) ---- */
  --bg: #eff2f5;            /* fondo de la app */
  --panel: #ffffff;         /* sidebar y chat header */
  --panel-2: #f0f2f5;       /* headers, search, input bar */
  --panel-3: #e9edef;       /* hover, bordes suaves */
  --border: #e9edef;
  --chat-bg: #efeae2;       /* fondo de la conversación */
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --text: #111b21;
  --text-2: #667781;
  --text-3: #8696a0;
  --icon: #54656f;
  --green: #00a884;
  --green-strong: #008069;
  --unread: #25d366;
  --check: #8696a0;
  --check-read: #53bdeb;
  --danger: #ea0038;
  --shadow: 0 1px 3px rgba(11,20,26,.12), 0 8px 24px rgba(11,20,26,.10);
}
.wa[data-wa-theme="dark"] {
  --bg: #0c1317;
  --panel: #111b21;
  --panel-2: #202c33;
  --panel-3: #2a3942;
  --border: #222d34;
  --chat-bg: #0b141a;
  --bubble-in: #202c33;
  --bubble-out: #005c4b;
  --text: #e9edef;
  --text-2: #8696a0;
  --text-3: #8696a0;
  --icon: #aebac1;
  --green: #00a884;
  --green-strong: #00a884;
  --unread: #00a884;
  --check: #8696a0;
  --check-read: #53bdeb;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

/* EL BORDE BLANCO DE LOS COSTADOS (9-ago-2026).
   El "reset" de arriba empieza en `.wa`, así que el <body> se quedaba con el
   margen de 8 px que le pone el navegador por su cuenta: en el iPhone se veía
   una franja blanca a los lados y arriba, y —peor— la app entera bajaba 8 px,
   con lo que por debajo de la barra de escribir asomaba un trozo de la lista de
   chats. Aquí se le quita el margen y se le da el color de la app por si algún
   día algo se saliera. */
html, body { height: 100%; margin: 0; padding: 0; }
body { overflow: hidden; background: #f0f2f5; }
@media (prefers-color-scheme: dark) { body { background: #0c1317; } }

/* "Noto Color Emoji" va PRIMERO a propósito: esa fuente solo trae emojis (lo
   dice su unicode-range en emoji.css), así que las letras siguen saliendo con
   Segoe UI y únicamente las caritas usan la fuente a color, iguales en toda
   computadora y celular. */
.wa,
.wa input, .wa textarea, .wa select, .wa button {
  font-family: "Noto Color Emoji", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.wa {
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  height: 100vh; height: 100dvh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  /* Marco de referencia de la conversación: en el celular `.wa-main` va con
     position:absolute e inset:0, y sin este `relative` se colgaba de la ventana
     entera en vez de la app — de ahí el trozo de lista que asomaba abajo. */
  position: relative;
}

/* ============================================================ RIEL ======== */
.wa-rail {
  width: 64px; height: 100%; flex-shrink: 0;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: .7rem 0 .9rem;
}
.wa-rail__top, .wa-rail__bottom { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.wa-rail__top { flex: 1; }
.wa-railbtn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--icon); position: relative; text-decoration: none;
}
.wa-railbtn:hover { background: rgba(11,20,26,.08); }
.wa[data-wa-theme="dark"] .wa-railbtn:hover { background: rgba(255,255,255,.08); }
.wa-railbtn.is-active { background: rgba(0,168,132,.14); color: var(--text); }
.wa-railbtn i { display: inline-flex; }
.wa-railbtn svg { width: 24px; height: 24px; display: block; }
.wa-rail__badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; border-radius: 999px;
  background: var(--unread); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
/* El globito de Activaciones se pone ROJO cuando hay alguien a quien no se
   pudo desactivar: ese cliente sigue con Adobe abierto y hay que ir a mirarlo,
   que no es lo mismo que «tienes 4 activos». */
.wa-rail__badge--alerta { background: var(--danger); }
.wa-rail__me { width: 36px; height: 36px; font-size: 14px; margin-top: .35rem; }

/* ------------------------------------------------ Activación de usuarios --- */
.wa-actlist { display: grid; gap: .6rem; margin: .4rem 0 .2rem; }
.wa-act {
  border: 1px solid var(--border);
  border-left: 4px solid var(--green-strong);
  border-radius: 12px;
  padding: .75rem .9rem;
  background: var(--panel);
  min-width: 0;
}
.wa-act.is-mal { border-left-color: var(--danger); background: rgba(229,68,59,.07); }
.wa-act__head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: 14px; overflow-wrap: anywhere; }
.wa-act__sub { font-size: 12.5px; color: var(--text-2); margin-top: .2rem; overflow-wrap: anywhere; }
.wa-act__tag {
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: .12rem .5rem; border-radius: 999px;
  background: rgba(0,168,132,.14); color: var(--green-strong);
}
.wa-act__tag--prueba { background: rgba(245,158,11,.16); color: #b45309; }
.wa-act__tag--venta { background: rgba(0,168,132,.16); color: var(--green-strong); }
.wa-act__ok  { color: var(--green-strong); font-weight: 600; }
.wa-act__mal { color: var(--danger); font-weight: 700; }
.wa-act__ojo { color: #b45309; font-weight: 600; }
.wa-act__acts { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.wa[data-wa-theme="dark"] .wa-act__tag--prueba { color: #fbbf24; }
.wa[data-wa-theme="dark"] .wa-act__ojo { color: #fbbf24; }

/* ============================================================= SIDEBAR ==== */
.wa-side {
  width: 30%;
  min-width: 330px;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.wa-side__head {
  display: flex; align-items: center; gap: .8rem;
  padding: .8rem 1.1rem .35rem 1.35rem;
  min-height: 60px;
}
.wa-side__logo { font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
.wa-side__actions { margin-left: auto; display: flex; align-items: center; gap: .15rem; position: relative; }

.wa-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; color: #fff;
  background: #6a7175;
  overflow: hidden;
  font-family: inherit;
}
.wa-avatar--me { background: #fff; }
.wa-avatar--big { width: 88px; height: 88px; font-size: 32px; }
.wa-row .wa-avatar { width: 49px; height: 49px; font-size: 17px; }
/* Foto/logo dentro de un avatar: cubre el círculo por completo. */
.wa-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.wa-iconbtn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--icon); flex-shrink: 0;
}
.wa-iconbtn:hover { background: rgba(11,20,26,.08); }
.wa[data-wa-theme="dark"] .wa-iconbtn:hover { background: rgba(255,255,255,.08); }
.wa-iconbtn svg { width: 22px; height: 22px; display: block; }

/* Menú desplegable */
.wa-menu {
  position: absolute; top: 46px; right: 0; z-index: 60;
  background: var(--panel); border-radius: 12px;
  box-shadow: var(--shadow);
  padding: .45rem 0; min-width: 218px;
  animation: waPop .12s ease;
}
@keyframes waPop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.wa-menu button {
  display: flex; align-items: center; width: 100%; text-align: left;
  padding: .62rem 1.1rem; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--text);
}
.wa-menu button:hover { background: var(--panel-2); }
.wa-menu hr { border: 0; border-top: 1px solid var(--border); margin: .4rem 0; }

/* Menús contextuales: fila de la lista y burbuja de un mensaje.
   La posición (clic derecho o dedo sostenido) la calcula el JS. */
.wa-menu--row,
.wa-menu--msg { position: fixed; top: 0; left: 0; right: auto; }
.wa-menu--msg { min-width: 264px; padding-top: 0; }

/* Barra de reacciones rápidas, arriba del menú del mensaje */
.wa-ctxre {
  display: flex; align-items: center; gap: .1rem;
  padding: .4rem .45rem; margin-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
/* Doble clase a propósito: así gana a la regla general ".wa-menu button"
   (que pone width:100%) y los emojis quedan en fila, no uno por renglón. */
.wa-ctxre .wa-ctxre__b {
  width: 34px; height: 34px; min-width: 0; flex: 0 0 auto;
  padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  font-size: 19px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease, background .12s ease;
}
.wa-ctxre .wa-ctxre__b:hover { background: var(--panel-2); transform: scale(1.18); }
.wa-ctxre .wa-ctxre__b.is-on { background: var(--panel-3); }
.wa-ctxre .wa-ctxre__more {
  font-size: 19px; font-weight: 700; color: var(--text-2);
  background: var(--panel-2);
}

/* Cuadrícula de emojis del modal "Reaccionar" */
.wa-reactgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: .15rem; max-height: 46vh; overflow-y: auto; margin-top: .4rem;
}
.wa-reactgrid button {
  border: 0; background: none; cursor: pointer; font-size: 22px;
  padding: .35rem 0; border-radius: 8px; line-height: 1;
}
.wa-reactgrid button:hover { background: var(--panel-2); }

/* Lista de chats del modal "Reenviar" */
.wa-fwd { max-height: 44vh; overflow-y: auto; margin-top: .5rem; }
.wa-fwd__row {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  border: 0; background: none; cursor: pointer; text-align: left;
  padding: .5rem .4rem; border-radius: 10px; font: inherit; color: var(--text);
}
.wa-fwd__row:hover { background: var(--panel-2); }
.wa-fwd__who { display: flex; flex-direction: column; min-width: 0; }
.wa-fwd__who b { font-size: 14.5px; font-weight: 500; }
.wa-fwd__who i { font-size: 12.5px; color: var(--text-3); font-style: normal; }

/* Búsqueda */
.wa-search { padding: .35rem .75rem .45rem; background: var(--panel); }
.wa-search__box {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel-2);
  border-radius: 10px; padding: 0 .8rem; height: 38px;
}
.wa-search__icon { display: inline-flex; color: var(--text-3); }
.wa-search__icon svg { width: 17px; height: 17px; }
.wa-search__box input {
  border: 0; background: none; outline: none; width: 100%;
  font: inherit; font-size: 14px; color: var(--text);
}
.wa-search__box input::placeholder { color: var(--text-3); }

/* Filtros */
.wa-filters { display: flex; gap: .4rem; padding: .15rem .75rem .6rem; position: relative; background: var(--panel); flex-wrap: wrap; }
.wa-chip {
  border: 0; cursor: pointer; font: inherit; font-size: 13px;
  color: var(--text-2); background: var(--panel-2);
  padding: .32rem .8rem; border-radius: 999px;
}
.wa-chip:hover { background: var(--panel-3); }
.wa-chip.is-active { background: #e7fce3; color: #008069; font-weight: 600; }
.wa[data-wa-theme="dark"] .wa-chip.is-active { background: rgba(0,168,132,.22); color: #00d9a5; }
.wa-chip--labels i { display: inline-block; border: 4px solid transparent; border-top-color: currentColor; margin-left: .25rem; transform: translateY(2px); }
/* Variables que se insertan en la bienvenida/ausencia ({productos}, {nombre}…) */
.wa-vars { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.35rem 0 .9rem; }
.wa-vars .wa-chip { font-size: 12.5px; }
.wa-menu--labels { top: 40px; left: .75rem; right: auto; }
.wa-menu--labels .wa-dot { margin-right: .55rem; }

/* Buscar DENTRO de los mensajes (resultados en vivo, estilo WhatsApp) */
.wa-srlist { flex: 1; overflow-y: auto; background: var(--panel); }
.wa-srlist::-webkit-scrollbar { width: 6px; }
.wa-srlist::-webkit-scrollbar-thumb { background: rgba(134,150,160,.35); border-radius: 3px; }
.wa-sr__label {
  padding: .5rem 1rem .3rem; font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--green); background: var(--panel);
}
.wa-sr__note { padding: 1.1rem 1.1rem 1.4rem; text-align: center; font-size: 13.5px; color: var(--text-3); }
.wa-sr__note--soft { padding: .2rem 1.1rem 1rem; font-size: 12.5px; }
.wa-sr__row { border-bottom: 1px solid var(--border); }
.wa-sr__count {
  flex-shrink: 0; font-size: 11.5px; font-weight: 600; color: var(--green);
  background: rgba(0,168,132,.15); border-radius: 999px; padding: .05rem .45rem;
}
.wa-row__preview mark { background: rgba(0,168,132,.28); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Grilla de stickers del bot por momento (modal de Vendedor IA) */
.wa-stkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: .2rem 0 .5rem; }
.wa-stk {
  display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center;
  padding: .6rem; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2);
}
.wa-stk__prev {
  width: 56px; height: 56px; border-radius: 10px; background: var(--panel-3);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; color: var(--text-3); font-size: 18px; flex: 0 0 auto;
}
.wa-stk__prev img { width: 100%; height: 100%; object-fit: contain; }
.wa-stk__name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.wa-stk__btns { display: flex; gap: .35rem; }
.wa-stk__btns .wa-btn { background: var(--panel-3); color: var(--text); padding: .28rem .55rem; font-size: 12px; }
.wa-stk__out { font-size: 11px; min-height: 14px; color: var(--text-2); }

/* Punto de color de etiqueta */
.wa-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Fila "Archivados" */
.wa-arch {
  display: flex; align-items: center; gap: 1rem; width: 100%;
  border: 0; background: none; cursor: pointer; font: inherit;
  padding: 0 1.05rem; height: 52px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.wa-arch:hover { background: var(--panel-2); }
.wa-arch__icon { display: inline-flex; color: var(--green); width: 24px; justify-content: center; }
.wa-arch__icon svg { width: 20px; height: 20px; }
.wa-arch b { font-size: 15px; font-weight: 500; flex: 1; text-align: left; }
.wa-arch__count { font-size: 12.5px; color: var(--green); font-weight: 600; }

/* Lista de chats */
.wa-chatlist { flex: 1; overflow-y: auto; background: var(--panel); }
.wa-chatlist::-webkit-scrollbar { width: 6px; }
.wa-chatlist::-webkit-scrollbar-thumb { background: rgba(134,150,160,.35); border-radius: 3px; }

.wa-row {
  display: flex; align-items: center; gap: .85rem;
  padding: 0 .8rem 0 1rem; height: 72px; cursor: pointer;
  position: relative;
}
.wa-row:hover { background: var(--panel-2); }
.wa-row.is-active { background: var(--panel-3); }
.wa-row__main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: .15rem; padding-right: .1rem; }
.wa-row__top { display: flex; align-items: baseline; gap: .6rem; }
.wa-row__name { font-size: 15.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.wa-row__time { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.wa-row.has-unread .wa-row__time { color: var(--unread); font-weight: 600; }
.wa-row__bottom { display: flex; align-items: center; gap: .35rem; }
.wa-row__preview { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; display: flex; align-items: center; gap: .3rem; }
.wa-row.has-unread .wa-row__preview { color: var(--text); font-weight: 500; }
/* "Borrador:" en rojo/verde delante del texto a medias, igual que WhatsApp */
.wa-row__draft { color: #f15c6d; flex-shrink: 0; }
.wa[data-wa-theme="dark"] .wa-row__draft { color: #f15c6d; }
.wa-row__check { display: inline-flex; flex-shrink: 0; color: var(--check); }
.wa-row__check svg { width: 16px; height: 16px; }
.wa-row__badge {
  min-width: 20px; height: 20px; border-radius: 999px;
  background: var(--unread); color: #fff;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px; flex-shrink: 0;
}
.wa-row__labels { display: inline-flex; gap: 3px; flex-shrink: 0; }
.wa-row__pin { display: inline-flex; color: var(--text-3); flex-shrink: 0; }
.wa-row__pin svg { width: 14px; height: 14px; }
.wa-row__fav { display: inline-flex; color: #ffbc38; flex-shrink: 0; }
.wa-row__fav svg { width: 13px; height: 13px; }

/* Flecha del menú contextual: aparece al pasar el mouse */
.wa-row__more {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; cursor: pointer; color: var(--text-3);
  background: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .1s ease;
}
.wa-row:hover .wa-row__more { opacity: 1; }
.wa-row__more svg { width: 18px; height: 18px; }
.wa-row.is-active .wa-row__more { background: var(--panel-3); }

.wa-chatlist__empty { padding: 3.2rem 2rem; text-align: center; color: var(--text-2); }
.wa-chatlist__empty b { display: block; margin-bottom: .5rem; color: var(--text); font-size: 15px; }
.wa-chatlist__empty p { font-size: 13.5px; line-height: 1.55; }

/* ============================================================= MAIN ======= */
.wa-main { flex: 1; height: 100%; display: flex; position: relative; min-width: 0; }

/* Pantalla de descanso */
.wa-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .65rem; text-align: center;
  background: var(--panel-2);
  border-bottom: 6px solid var(--green);
  padding: 2rem;
}
.wa-hero h1 { font-size: 30px; font-weight: 300; color: var(--text); margin-top: 1.4rem; }
.wa-hero p { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.wa-hero__lock { margin-top: 2.2rem; font-size: 13px; color: var(--text-3); }
.wa-hero__art {
  width: 300px; height: 190px; border-radius: 24px;
  background:
    radial-gradient(circle at 65% 32%, rgba(0,168,132,.24), transparent 42%),
    radial-gradient(circle at 30% 70%, rgba(0,168,132,.16), transparent 46%),
    var(--panel);
  box-shadow: var(--shadow);
  position: relative;
}
.wa-hero__art::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 92px; height: 92px;
  background: var(--green);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2A10 10 0 0 0 3.34 17L2 22l5.1-1.3A10 10 0 1 0 12 2Zm0 2a8 8 0 1 1-4.07 14.89l-.6-.36-2.51.64.66-2.44-.39-.62A8 8 0 0 1 12 4Zm-3.12 4.2c-.2 0-.52.07-.8.37-.27.3-1.04 1-1.04 2.46s1.07 2.86 1.22 3.06c.15.2 2.11 3.36 5.19 4.58 2.56 1.01 3.08.81 3.64.76.55-.05 1.78-.73 2.03-1.43.25-.7.25-1.31.18-1.43-.08-.13-.28-.2-.58-.35s-1.78-.88-2.06-.98c-.27-.1-.47-.15-.67.15-.2.3-.77.97-.95 1.17-.17.2-.35.22-.65.07a8.2 8.2 0 0 1-2.4-1.49 9 9 0 0 1-1.66-2.07c-.18-.3-.02-.46.13-.61.14-.14.3-.35.45-.52.15-.18.2-.3.3-.5.1-.2.05-.38-.02-.53-.08-.15-.67-1.62-.92-2.22-.24-.58-.49-.5-.67-.51h-.6Z"/></svg>') center / contain no-repeat;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2A10 10 0 0 0 3.34 17L2 22l5.1-1.3A10 10 0 1 0 12 2Zm0 2a8 8 0 1 1-4.07 14.89l-.6-.36-2.51.64.66-2.44-.39-.62A8 8 0 0 1 12 4Zm-3.12 4.2c-.2 0-.52.07-.8.37-.27.3-1.04 1-1.04 2.46s1.07 2.86 1.22 3.06c.15.2 2.11 3.36 5.19 4.58 2.56 1.01 3.08.81 3.64.76.55-.05 1.78-.73 2.03-1.43.25-.7.25-1.31.18-1.43-.08-.13-.28-.2-.58-.35s-1.78-.88-2.06-.98c-.27-.1-.47-.15-.67.15-.2.3-.77.97-.95 1.17-.17.2-.35.22-.65.07a8.2 8.2 0 0 1-2.4-1.49 9 9 0 0 1-1.66-2.07c-.18-.3-.02-.46.13-.61.14-.14.3-.35.45-.52.15-.18.2-.3.3-.5.1-.2.05-.38-.02-.53-.08-.15-.67-1.62-.92-2.22-.24-.58-.49-.5-.67-.51h-.6Z"/></svg>') center / contain no-repeat;
}
.wa-hero__art--small { width: 190px; height: 120px; border-radius: 18px; }
.wa-hero__art--small::after { width: 58px; height: 58px; }

/* Conversación */
.wa-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

.wa-chat__head {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem 1rem; min-height: 59px;
  background: var(--panel-2);
  border-left: 1px solid var(--border);
  z-index: 5;
}
.wa-chat__who { min-width: 0; cursor: pointer; display: flex; flex-direction: column; line-height: 1.25; }
.wa-chat__who b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat__who span { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat__who span.is-open { color: var(--green-strong); }
.wa-chat__labels { display: flex; gap: 4px; margin-left: .35rem; }
.wa-back { display: none; }

/* Búsqueda dentro de la conversación */
.wa-msgsearch {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel-2); border-top: 1px solid var(--border);
  padding: .4rem .9rem;
}
.wa-msgsearch input {
  flex: 1; border: 0; outline: none; font: inherit; font-size: 14px;
  color: var(--text); background: var(--panel);
  border-radius: 8px; padding: .5rem .9rem;
}
.wa-msgsearch .wa-iconbtn { width: 34px; height: 34px; }

/* Fondo de mensajes con la trama típica */
.wa-msgs {
  flex: 1; overflow-y: auto;
  background-color: var(--chat-bg);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140" viewBox="0 0 140 140"><g fill="none" stroke="%23a7998a" stroke-opacity=".28" stroke-width="1.1"><circle cx="22" cy="24" r="6"/><path d="M62 12c4 0 7 3 7 7m-40 96c0 4 3 7 7 7"/><path d="M104 30l7 7m0-7-7 7"/><circle cx="118" cy="92" r="5"/><path d="M30 88c-5 0-8 4-8 8s3 8 8 8"/><path d="M74 64h12m-6-6v12"/><path d="M96 124c3-3 8-3 11 0"/><path d="M12 58c3 3 3 8 0 11"/><circle cx="66" cy="132" r="4"/><path d="M132 12c-4 1-6 4-6 8"/></g></svg>');
  background-size: 340px;
  padding: 1.1rem 6% 1.3rem;
  display: flex; flex-direction: column; gap: 2px;
  scroll-behavior: smooth;
}
.wa[data-wa-theme="dark"] .wa-msgs {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140" viewBox="0 0 140 140"><g fill="none" stroke="%23ffffff" stroke-opacity=".05" stroke-width="1.1"><circle cx="22" cy="24" r="6"/><path d="M62 12c4 0 7 3 7 7m-40 96c0 4 3 7 7 7"/><path d="M104 30l7 7m0-7-7 7"/><circle cx="118" cy="92" r="5"/><path d="M30 88c-5 0-8 4-8 8s3 8 8 8"/><path d="M74 64h12m-6-6v12"/><path d="M96 124c3-3 8-3 11 0"/><path d="M12 58c3 3 3 8 0 11"/><circle cx="66" cy="132" r="4"/><path d="M132 12c-4 1-6 4-6 8"/></g></svg>');
}
.wa-msgs::-webkit-scrollbar { width: 6px; }
.wa-msgs::-webkit-scrollbar-thumb { background: rgba(134,150,160,.35); border-radius: 3px; }

/* Aviso de cifrado (arriba del todo, como en WhatsApp) */
.wa-e2e { align-self: center; max-width: 460px; text-align: center; margin: .3rem 0 .7rem; }
.wa-e2e span {
  display: inline-block; background: #fdf3c8; color: #54656f;
  font-size: 12.5px; line-height: 1.5;
  padding: .45rem .85rem; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(11,20,26,.08);
}
.wa[data-wa-theme="dark"] .wa-e2e span { background: #182229; color: #ffd279; }

/* Chip de fecha y avisos centrados */
.wa-day { align-self: center; margin: .8rem 0 .5rem; }
.wa-day span {
  background: var(--panel); color: var(--text-2);
  font-size: 12px; font-weight: 500; text-transform: uppercase;
  padding: .3rem .75rem; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(11,20,26,.08);
}
.wa-sys { align-self: center; max-width: 84%; margin: .35rem 0; }
.wa-sys span {
  display: inline-block; background: #fdf3c8; color: #54656f;
  font-size: 12.5px; padding: .35rem .8rem; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(11,20,26,.08);
}
.wa[data-wa-theme="dark"] .wa-sys span { background: #182229; color: #ffd279; }

/* Burbujas */
.wa-msg { display: flex; margin: 1px 0; }
.wa-msg--in { justify-content: flex-start; }
.wa-msg--out { justify-content: flex-end; }
.wa-bubble {
  position: relative;
  max-width: min(65%, 480px);
  background: var(--bubble-in);
  border-radius: 8px;
  padding: .38rem .5rem .32rem .6rem;
  box-shadow: 0 1px 1px rgba(11,20,26,.13);
  font-size: 14.2px; line-height: 1.35;
  word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
}
.wa-msg--out .wa-bubble { background: var(--bubble-out); }
.wa-msg--first .wa-bubble { margin-top: .55rem; }
/* Cola de la burbuja (solo en el primer mensaje del grupo) */
.wa-msg--first.wa-msg--in .wa-bubble { border-top-left-radius: 0; }
.wa-msg--first.wa-msg--out .wa-bubble { border-top-right-radius: 0; }
.wa-msg--first .wa-bubble::before {
  content: ""; position: absolute; top: 0; width: 0; height: 0;
  border-top: 9px solid var(--bubble-in);
}
.wa-msg--first.wa-msg--in .wa-bubble::before { left: -8px; border-left: 9px solid transparent; }
.wa-msg--first.wa-msg--out .wa-bubble::before { right: -8px; border-right: 9px solid transparent; border-top-color: var(--bubble-out); }

.wa-bubble a { color: #027eb5; text-decoration: none; }
.wa-bubble a:hover { text-decoration: underline; }
.wa[data-wa-theme="dark"] .wa-bubble a { color: #53bdeb; }

.wa-bubble img.wa-photo {
  display: block; max-width: 100%; width: 320px; border-radius: 6px;
  margin: -0.1rem 0 .25rem; cursor: pointer; background: var(--panel-3);
}
.wa-doc {
  display: flex; align-items: center; gap: .6rem;
  background: rgba(11,20,26,.05); border-radius: 8px;
  padding: .6rem .7rem; margin: .1rem 0 .3rem;
  color: inherit; text-decoration: none;
}
.wa[data-wa-theme="dark"] .wa-doc { background: rgba(255,255,255,.06); }
.wa-doc svg { width: 26px; height: 26px; color: #ea0038; flex-shrink: 0; }
.wa-doc span { font-size: 13.5px; word-break: break-all; }

/* Sticker: sin burbuja, con la hora flotando */
.wa-msg--sticker .wa-bubble {
  background: transparent !important; box-shadow: none; padding: .15rem 0 .8rem;
}
.wa-msg--sticker .wa-bubble::before { display: none; }
.wa-msg--sticker img.wa-sticker {
  display: block; width: 150px; height: 150px; object-fit: contain; cursor: pointer;
}
.wa-msg--sticker .wa-meta {
  position: absolute; right: 0; bottom: -2px; float: none; margin: 0;
  background: rgba(11,20,26,.35); color: #fff;
  border-radius: 999px; padding: 1px 7px; transform: none;
}
.wa-msg--sticker .wa-meta svg { color: #e6e6e6; }
.wa-msg--sticker .wa-meta.is-read svg { color: var(--check-read); }

/* Nota de voz (reproductor propio, estilo WhatsApp) */
.wa-audio { display: flex; align-items: center; gap: .55rem; width: min(72vw, 320px); padding: .3rem .1rem .25rem; }
.wa-audio__play {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--text-3); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.wa-audio__play svg { width: 30px; height: 30px; }
.wa-audio__mid { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wa-audio__track { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 3px; background: rgba(134,150,160,.45); outline: none; cursor: pointer; }
.wa-audio__track::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%; background: var(--green);
  border: 0; cursor: pointer;
}
.wa-msg--out .wa-audio__track::-webkit-slider-thumb { background: var(--green-strong); }
.wa-audio__track::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--green); border: 0; cursor: pointer; }
.wa-audio__time { font-size: 11px; color: var(--text-3); }
.wa-audio__mic { flex-shrink: 0; color: var(--green); display: inline-flex; }
.wa-audio__mic svg { width: 20px; height: 20px; }
.wa-audio__speed {
  flex-shrink: 0; border: 0; cursor: pointer; font: inherit;
  font-size: 11.5px; font-weight: 700; color: var(--text-2);
  background: rgba(134,150,160,.22); border-radius: 999px; padding: .28rem .5rem;
  display: none;
}
.wa-audio.is-playing .wa-audio__speed { display: inline-flex; }
.wa-audio.is-playing .wa-audio__mic { display: none; }

/* Reacción del cliente sobre una burbuja */
.wa-react {
  position: absolute; bottom: -14px; left: 6px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 5px 1px;
  font-size: 13px; line-height: 1.35;
  box-shadow: 0 1px 2px rgba(11,20,26,.18);
  user-select: none;
}
.wa-msg--out .wa-react { left: auto; right: 6px; }
.wa-msg.has-react { margin-bottom: 15px; }

/* Mensaje citado DENTRO de la burbuja (al responder) */
.wa-quote {
  display: flex; align-items: stretch; gap: .5rem;
  background: rgba(11,20,26,.06);
  border-left: 4px solid var(--green);
  border-radius: 5px; overflow: hidden;
  margin: 0 0 .25rem; padding: .28rem .5rem;
  cursor: pointer; white-space: normal;
}
.wa[data-wa-theme="dark"] .wa-quote { background: rgba(255,255,255,.07); }
.wa-quote.is-mine { border-left-color: #53bdeb; }
.wa-quote__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wa-quote__txt b { font-size: 12.8px; color: var(--green); font-weight: 600; }
.wa-quote.is-mine .wa-quote__txt b { color: #53bdeb; }
.wa-quote__txt span {
  font-size: 12.8px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.wa-quote img { width: 42px; height: 42px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

/* Anuncio del que viene el cliente (Click to WhatsApp), pegado sobre su mensaje.
   Se distingue de la cita con el borde naranja: la cita es un mensaje nuestro,
   esto es publicidad pagada. La foto se abre en grande al tocarla. */
.wa-ad {
  display: flex; align-items: stretch; gap: .5rem;
  background: rgba(240,147,43,.10);
  border-left: 4px solid #f0932b;
  border-radius: 5px; overflow: hidden;
  margin: 0 0 .3rem; padding: .3rem .5rem;
  white-space: normal;
}
.wa[data-wa-theme="dark"] .wa-ad { background: rgba(240,147,43,.16); }
.wa-ad__img {
  width: 46px; height: 46px; object-fit: cover; border-radius: 4px;
  flex-shrink: 0; cursor: zoom-in; align-self: center;
}
.wa-ad__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.wa-ad__tag { font-size: 11px; color: #d67d15; font-weight: 600; letter-spacing: .2px; }
.wa[data-wa-theme="dark"] .wa-ad__tag { color: #f0932b; }
.wa-ad__prod { font-size: 13px; color: var(--text-1); font-weight: 700; word-break: break-word; }
.wa-ad__tit {
  font-size: 12px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}

/* Burbuja resaltada un instante al tocar una cita */
.wa-msg.is-highlight .wa-bubble { animation: waFlash 1.4s ease; }
@keyframes waFlash {
  0%, 60% { box-shadow: 0 0 0 3px rgba(0,168,132,.55); }
  100% { box-shadow: 0 1px 1px rgba(11,20,26,.13); }
}

/* Barra de "respondiendo a…" sobre la caja de escribir */
.wa-replybar {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel-2); padding: .5rem .8rem .1rem;
}
.wa-replybar__quote {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 4px solid var(--green);
  border-radius: 6px; padding: .35rem .6rem;
}
.wa-replybar__quote b { font-size: 12.8px; color: var(--green); font-weight: 600; }
.wa-replybar__quote span {
  font-size: 13px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-replybar img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.wa-replybar .wa-iconbtn { width: 32px; height: 32px; }
.wa-replybar .wa-iconbtn svg { width: 18px; height: 18px; }

.wa-tpl {
  font-size: 11.5px; color: var(--text-3); margin-bottom: .15rem;
  display: flex; align-items: center; gap: .3rem;
}

/* Hora + palomitas dentro de la burbuja */
.wa-meta {
  float: right; margin: .45rem 0 0 .55rem;
  display: inline-flex; align-items: center; gap: .22rem;
  font-size: 11px; color: var(--text-3);
  user-select: none; transform: translateY(3px);
}
.wa-meta svg { width: 16px; height: 16px; display: block; color: var(--check); }
.wa-meta.is-read svg { color: var(--check-read); }
.wa-meta.is-pending svg { width: 13px; height: 13px; }

/* Barra "ventana cerrada" */
.wa-closedbar {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: #fff8e0; border-top: 1px solid #f2e3ae;
  color: #54656f; font-size: 13px;
  padding: .6rem 1rem;
}
.wa[data-wa-theme="dark"] .wa-closedbar { background: #1f2c33; border-top-color: #2a3942; color: #ffd279; }
.wa-closedbar span { flex: 1; min-width: 220px; }

/* Barra de escritura */
.wa-input {
  display: flex; align-items: flex-end; gap: .5rem;
  background: var(--panel-2);
  padding: .55rem .8rem;
  position: relative;
}
.wa-pill {
  flex: 1; display: flex; align-items: flex-end; gap: .1rem;
  background: var(--panel); border-radius: 24px;
  padding: .18rem .55rem .18rem .3rem;
  min-width: 0;
}
.wa-pill .wa-iconbtn { width: 38px; height: 38px; }
.wa-input__box { flex: 1; position: relative; min-width: 0; }
.wa-input__box textarea {
  width: 100%; border: 0; outline: none; resize: none;
  background: transparent; color: var(--text);
  font: inherit; font-size: 14.5px; line-height: 1.4;
  padding: .55rem .4rem;
  max-height: 128px;
  display: block;
}
.wa-input__box textarea::placeholder { color: var(--text-3); }
.wa-sendbtn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 0; cursor: pointer; flex-shrink: 0;
  background: var(--green); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .08s ease, background .15s ease;
}
.wa-sendbtn:hover { background: var(--green-strong); }
.wa-sendbtn:active { transform: scale(.92); }
.wa-sendbtn svg { width: 21px; height: 21px; margin-left: 2px; }
.wa-sendbtn--mic svg { margin-left: 0; }
.wa-sendbtn[disabled] { opacity: .55; cursor: default; }

/* Grabadora de notas de voz */
.wa-rec {
  display: flex; align-items: center; gap: .7rem;
  background: var(--panel-2);
  padding: .55rem 1rem;
}
.wa-rec__trash { color: var(--danger); }
.wa-rec__dot {
  width: 11px; height: 11px; border-radius: 50%; background: #ff3b30;
  animation: waBlink 1s ease infinite;
}
@keyframes waBlink { 50% { opacity: .25; } }
.wa-rec__time { font-size: 15px; font-variant-numeric: tabular-nums; }
.wa-rec__hint { flex: 1; color: var(--text-2); font-size: 13.5px; }

/* Menú de adjuntos (botón +) */
.wa-menu--attach { top: auto; bottom: 62px; left: .8rem; right: auto; min-width: 200px; }
.wa-menu--attach button { gap: .75rem; padding: .6rem 1.15rem; font-size: 14.5px; }
.wa-menu--attach i {
  width: 28px; height: 28px; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wa-menu--attach i svg { width: 16px; height: 16px; }
.at-media { background: #007bfc; }
.at-doc { background: #7f66ff; }
.at-sticker { background: #02a698; }

/* Respuestas rápidas (popup sobre el input) */
.wa-quick {
  position: absolute; bottom: calc(100% + 14px); left: -3rem; right: -3rem; z-index: 40;
  background: var(--panel); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 250px; overflow-y: auto; padding: .35rem 0;
}
.wa-quick button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  cursor: pointer; font: inherit; padding: .5rem .9rem;
}
.wa-quick button:hover, .wa-quick button.is-sel { background: var(--panel-2); }
.wa-quick b { color: var(--green-strong); font-size: 13px; display: block; }
.wa-quick span { color: var(--text-2); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-quick__thumb { float: right; width: 36px; height: 36px; border-radius: 6px; object-fit: cover; margin-left: 8px; }

/* Chip de foto adjunta (respuesta rápida con foto), flota sobre el input */
.wa-quickimg {
  position: absolute; bottom: calc(100% + 14px); left: 0; z-index: 39;
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: .4rem .55rem; box-shadow: var(--shadow); max-width: 100%;
}
.wa-quickimg img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.wa-quickimg span { font-size: 12.5px; color: var(--text-2); }
.wa-quickimg button {
  border: 0; background: var(--panel-2); color: var(--text);
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  font-size: 14px; line-height: 1; flex-shrink: 0;
}
.wa-quickimg button:hover { background: var(--danger); color: #fff; }

/* Panel de emojis y stickers */
.wa-emoji {
  position: absolute; bottom: 66px; left: .8rem; z-index: 40;
  width: 396px; max-width: calc(100% - 1.6rem);
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.wa-emoji__tabs { display: flex; gap: .2rem; padding: .5rem .6rem 0; border-bottom: 1px solid var(--border); }
.wa-emoji__tabs button {
  border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  padding: .45rem .8rem .55rem; border-bottom: 3px solid transparent;
}
.wa-emoji__tabs button.is-active { color: var(--green); border-bottom-color: var(--green); }
.wa-emoji__grid {
  padding: .7rem; display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px; max-height: 260px; overflow-y: auto;
}
.wa-emoji__grid button {
  border: 0; background: none; cursor: pointer;
  font-size: 22px; padding: .28rem 0; border-radius: 8px;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}
.wa-emoji__grid button:hover { background: var(--panel-2); }
.wa-sticker__grid {
  padding: .7rem; display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px; max-height: 280px; overflow-y: auto;
}
.wa-sticker__grid button {
  border: 0; background: var(--panel-2); cursor: pointer;
  border-radius: 10px; padding: 6px; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.wa-sticker__grid button:hover { background: var(--panel-3); }
.wa-sticker__grid img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wa-sticker__grid .wa-sticker__add {
  background: none; border: 2px dashed var(--panel-3);
  color: var(--text-3); flex-direction: column; gap: .25rem; font-size: 12px; font-family: inherit;
}
.wa-sticker__grid .wa-sticker__add svg { width: 22px; height: 22px; }
.wa-sticker__empty { grid-column: 1 / -1; color: var(--text-2); font-size: 13px; text-align: center; padding: 1rem .5rem; line-height: 1.5; }

/* ============================================================= DRAWER ===== */
.wa-drawer {
  width: 360px; max-width: 90vw; height: 100%;
  background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  animation: waSlideIn .16s ease;
}
@keyframes waSlideIn { from { transform: translateX(30px); opacity: 0; } }
.wa-drawer header {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel-2); padding: .6rem 1rem; min-height: 59px;
  font-size: 15px;
}
.wa-drawer__body { flex: 1; overflow-y: auto; padding: 1.2rem 1.4rem 2rem; display: flex; flex-direction: column; gap: 1.1rem; }
.wa-drawer__id { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .6rem 0 .4rem; }
.wa-drawer__id b { font-size: 18px; }
.wa-drawer__id span:last-child { color: var(--text-2); font-size: 14px; }

.wa-field { display: flex; flex-direction: column; gap: .4rem; }
.wa-field > span { font-size: 12.5px; color: var(--green-strong); font-weight: 600; }
.wa-field input, .wa-field textarea, .wa-field select {
  border: 0; border-bottom: 2px solid var(--panel-3);
  background: none; outline: none; font: inherit; color: var(--text);
  padding: .45rem .1rem; border-radius: 0;
}
.wa-field input:focus, .wa-field textarea:focus { border-bottom-color: var(--green); }
.wa-field textarea { resize: vertical; }

/* Pedidos del cliente, dentro del panel lateral del chat. Cada uno es una
   tarjeta compacta: producto y monto arriba, estado y fecha debajo. Con
   min-width:0 y el envoltorio scrollable para que un nombre de producto largo
   no ensanche el panel entero en pantallas estrechas. */
.wa-orders { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.wa-orders__empty { color: var(--text-2); font-size: 13px; }
.wa-orders__mail { color: var(--text-2); font-size: 12px; word-break: break-all; }
.wa-order {
  border: 1.5px solid var(--panel-3); border-radius: 12px;
  padding: .5rem .6rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0;
}
.wa-order__top { display: flex; gap: .5rem; align-items: baseline; justify-content: space-between; min-width: 0; }
.wa-order__top b { font-size: 13.5px; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.wa-order__top span { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.wa-order__sub { display: flex; flex-wrap: wrap; gap: .1rem .6rem; font-size: 12px; color: var(--text-2); }
.wa-order__st { font-weight: 700; }
.wa-order__id { font-size: 11px; color: var(--text-2); overflow-wrap: anywhere; }

.wa-labelpick { display: flex; flex-wrap: wrap; gap: .45rem; }
.wa-label {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1.5px solid var(--panel-3); border-radius: 999px;
  background: none; cursor: pointer; font: inherit; font-size: 13px;
  color: var(--text-2); padding: .3rem .75rem;
}
.wa-label.is-on { border-color: currentColor; font-weight: 600; }

.wa-btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  background: var(--green); color: #fff;
  border-radius: 999px; padding: .68rem 1.4rem;
}
.wa-btn:hover { background: var(--green-strong); }
.wa-btn--ghost { background: none; color: var(--danger); border: 1.5px solid var(--panel-3); }
.wa-btn--ghost:hover { background: var(--panel-2); }
.wa-btn--small { padding: .45rem 1rem; font-size: 13px; }
.wa-btn[disabled] { opacity: .6; cursor: default; }
/* Botón neutro (Cancelar) y botón de acción destructiva (Vaciar, Eliminar…) */
.wa-btn--soft { background: var(--panel-2); color: var(--text); }
.wa-btn--soft:hover { background: var(--panel-3); }
.wa-btn--danger { background: var(--danger); }
.wa-btn--danger:hover { background: #c60030; }

/* ================================================== CONFIRMACIÓN (marca) ==
   Reemplaza al confirm() gris del navegador: mismo diálogo, pero con nuestro
   logo y colores, y en rojo cuando la acción borra algo. */
.wa-ask {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(11,20,26,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.wa-ask[hidden] { display: none; }
.wa-ask__card {
  background: var(--panel); color: var(--text);
  width: 420px; max-width: 100%;
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem 1.2rem;
  animation: waPop .14s ease;
}
.wa-ask__brand { display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; }
.wa-ask__brand img { width: 22px; height: 22px; border-radius: 6px; }
/* En oscuro el trazo negro del logo se perdería: va sobre una pastilla clara. */
.wa[data-wa-theme="dark"] .wa-ask__brand img { background: #fff; padding: 2px; }
.wa-ask__brand span { font-size: 13px; font-weight: 700; color: var(--green-strong); letter-spacing: .01em; }
.wa-ask__title { display: block; font-size: 17px; line-height: 1.35; margin-bottom: .55rem; }
.wa-ask__text { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.wa-ask__foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; }
.wa-ask__foot .wa-btn { padding: .6rem 1.25rem; }
@media (max-width: 520px) {
  .wa-ask { align-items: flex-end; padding: 0; }
  .wa-ask__card {
    width: 100%; border-radius: 18px 18px 0 0;
    padding-bottom: calc(1.2rem + env(safe-area-inset-bottom));
    animation: waSheetUp .22s ease;
  }
  .wa-ask__foot .wa-btn { flex: 1; text-align: center; }
}

/* ============================================================= MODALES ==== */
.wa-modalback {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(11,20,26,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.wa-modal {
  background: var(--panel); color: var(--text);
  width: 560px; max-width: 100%; max-height: 88vh;
  border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: waPop .14s ease;
}
.wa-modal header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem .6rem 1.5rem; font-size: 16px;
}
.wa-modal__body { padding: .4rem 1.5rem 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.wa-modal__body p.hint { color: var(--text-2); font-size: 13px; line-height: 1.55; }
.wa-modal__body .wa-row-line { display: flex; gap: .7rem; align-items: center; }
.wa-modal__body .wa-row-line input { flex: 1; }

.wa-switch { display: flex; align-items: center; gap: .7rem; cursor: pointer; user-select: none; }
.wa-switch input { display: none; }
.wa-switch i {
  width: 40px; height: 22px; border-radius: 999px; background: var(--panel-3);
  position: relative; transition: background .15s ease; flex-shrink: 0;
}
.wa-switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: left .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.wa-switch input:checked + i { background: var(--green); }
.wa-switch input:checked + i::after { left: 20px; }

/* Respuestas rápidas — lista + formulario, fiel a WhatsApp Web */
.wa-qr-list { display: flex; flex-direction: column; }
.wa-qr-row {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  text-align: left; border: 0; background: none; cursor: pointer;
  padding: .7rem .4rem; border-radius: 8px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.wa-qr-row:last-child { border-bottom: 0; }
.wa-qr-row:hover { background: var(--panel-2); }
.wa-qr-row__img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.wa-qr-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.wa-qr-row__sc { font-weight: 600; font-size: 14px; color: var(--green-strong); }
.wa-qr-row__tx {
  font-size: 13px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-qr-row__del { width: 34px; height: 34px; flex-shrink: 0; color: var(--icon); opacity: 0; }
.wa-qr-row:hover .wa-qr-row__del, .wa-qr-row:focus-within .wa-qr-row__del { opacity: 1; }
.wa-qr-row__del:hover { color: var(--danger); }

/* Selector de foto del formulario de respuesta rápida */
.wa-qr-photo { display: flex; align-items: center; gap: .7rem; margin: .1rem 0 .3rem; }
.wa-qr-photo__prev {
  width: 64px; height: 64px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  border: 1px dashed var(--border); background: var(--panel-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 20px;
}
.wa-qr-photo__prev img { width: 100%; height: 100%; object-fit: cover; }
.wa-qr-photo__btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.wa-qr-empty { color: var(--text-2); font-size: 13.5px; padding: .8rem .2rem; }

.wa-qr-add {
  align-self: flex-start; display: inline-flex; align-items: center; gap: .4rem;
  background: none; color: var(--green-strong); border: 1.5px solid var(--panel-3);
}
.wa-qr-add:hover { background: var(--panel-2); }
.wa-qr-add svg { width: 18px; height: 18px; }

/* Campo "Acceso directo" con la barra y el contador, como WhatsApp */
.wa-qr-input {
  display: flex; align-items: center; gap: .25rem;
  border-bottom: 2px solid var(--panel-3);
}
.wa-qr-input:focus-within { border-bottom-color: var(--green); }
.wa-qr-slash { color: var(--text-2); font-size: 15px; }
.wa-qr-input input { flex: 1; border: 0 !important; padding: .45rem .1rem; }
.wa-qr-count { color: var(--text-3); font-size: 12px; flex-shrink: 0; }

.wa-qr-foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .4rem; }
.wa-qr-foot .wa-btn--ghost { color: var(--green-strong); border-color: var(--panel-3); }
.wa-qr-foot .wa-btn--ghost:hover { background: var(--panel-2); }

.wa-tplcard {
  border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .4rem;
}
.wa-tplcard b { font-size: 14px; display: flex; align-items: center; gap: .5rem; }
.wa-tplcard pre {
  font: inherit; font-size: 13px; color: var(--text-2);
  white-space: pre-wrap; background: var(--panel-2);
  border-radius: 8px; padding: .6rem .7rem;
}
.wa-pill-tag { font-size: 11px; font-weight: 700; border-radius: 999px; padding: .15rem .55rem; }
.wa-pill-tag--ok { background: #e7fce3; color: #008069; }
.wa-pill-tag--warn { background: #fff3cd; color: #8a6d1a; }
.wa-pill-tag--bad { background: #fde8ec; color: #b42841; }

.wa-conn { font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.wa-conn b { color: var(--text); }
.wa-conn code {
  display: block; background: var(--panel-2); border-radius: 8px;
  padding: .55rem .7rem; font-size: 12px; word-break: break-all;
  font-family: Consolas, Menlo, monospace; margin: .3rem 0 .6rem;
  user-select: all;
}

/* Visor de fotos */
.wa-lightbox {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(11,20,26,.94);
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem;
}
.wa-lightbox img { max-width: 94vw; max-height: 90vh; border-radius: 6px; box-shadow: var(--shadow); }
.wa-lightbox__close { position: absolute; top: 14px; right: 16px; color: #e6e6e6; }
.wa-lightbox__close:hover { background: rgba(255,255,255,.12); }

/* Setup (sin conexión con Meta) */
.wa-setup {
  position: fixed; inset: 0; z-index: 80;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 1.2rem;
}
.wa-setup__card {
  background: var(--panel); border-radius: 20px; box-shadow: var(--shadow);
  max-width: 520px; width: 100%; padding: 2.2rem 2.4rem;
  display: flex; flex-direction: column; align-items: center; gap: .9rem; text-align: center;
}
.wa-setup__card h2 { font-size: 21px; font-weight: 700; }
.wa-setup__card p { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.wa-setup__card ul { list-style: none; width: 100%; text-align: left; display: flex; flex-direction: column; gap: .45rem; margin: .4rem 0; }
.wa-setup__card li { font-size: 14px; display: flex; gap: .6rem; align-items: center; }
.wa-setup__hint { font-size: 12.5px !important; }

/* Toast */
.wa-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #111b21; color: #fff; font-size: 13.5px;
  border-radius: 10px; padding: .7rem 1.2rem; z-index: 120;
  box-shadow: var(--shadow); max-width: 90vw;
  animation: waPop .15s ease;
}

/* ============================================================= MÓVIL ======
   Experiencia fiel a la app de WhatsApp en el celular (Android e iOS):
   · Barra de pestañas abajo (Chats · Estados · Activaciones · Ajustes).
   · Cabeceras, barra de escritura y pestañas respetan el notch y la barra de
     gestos (safe-area) tanto en el navegador como instalada en pantalla inicio.
   · Campos a 16px para que iOS NO haga zoom al tocar el cuadro de texto.
   · Modales que suben desde abajo (bottom sheet) y ficha del cliente a pantalla
     completa, igual que en la app.
   ========================================================================== */
@media (max-width: 900px) {
  .wa {
    --wa-tabbar-h: 58px;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
  }

  /* ---- El riel de iconos se convierte en la barra de pestañas inferior ---- */
  .wa-rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto;
    flex-direction: row; align-items: stretch;
    justify-content: space-around;
    border-right: 0; border-top: 1px solid var(--border);
    background: var(--panel);
    padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom));
    z-index: 45;
  }
  /* Los dos grupos desaparecen como cajas: sus botones se reparten por igual
     a lo ancho de la barra (evita depender de proporciones frágiles). */
  .wa-rail__top, .wa-rail__bottom { display: contents; }
  /* Pestañas visibles: Chats · Estados · Activaciones · Ajustes.
     Canales, "volver al panel", perfil y cambiar tema viven en el menú ⋮
     del header, tal como reparte las opciones la app real. */
  .wa-rail [data-rail="canales"], .wa-railbtn--back, .wa-rail__me { display: none; }

  .wa-railbtn {
    flex: 1 1 0; width: auto; height: auto; max-width: 160px;
    border-radius: 12px; flex-direction: column; gap: 3px;
    padding: .3rem 0 .18rem;
    font-size: 11px; font-weight: 500; color: var(--text-2);
  }
  .wa-railbtn:hover { background: transparent; }
  .wa-railbtn i { padding: 2.5px 15px; border-radius: 999px; transition: background .15s ease; }
  .wa-railbtn svg { width: 25px; height: 25px; }
  .wa-railbtn::after { content: attr(aria-label); letter-spacing: -.1px; }
  .wa-railbtn.is-active { background: transparent; color: var(--green-strong); }
  .wa-railbtn.is-active i { background: rgba(0,168,132,.15); }
  .wa[data-wa-theme="dark"] .wa-railbtn.is-active { color: #00d9a5; }
  .wa[data-wa-theme="dark"] .wa-railbtn.is-active i { background: rgba(0,168,132,.28); }
  .wa-rail__badge { top: -2px; right: 18px; }
  /* Con un chat abierto la barra se oculta, como en WhatsApp */
  .wa.chat-open .wa-rail { display: none; }

  /* ---- Lista de chats a pantalla completa ---- */
  .wa-side { width: 100%; max-width: none; min-width: 0; border-right: 0; }
  .wa-side__head {
    padding-top: calc(.7rem + env(safe-area-inset-top));
    min-height: calc(56px + env(safe-area-inset-top));
  }
  /* Aire abajo para que la última fila no quede tapada por la barra */
  .wa-chatlist {
    padding-bottom: calc(var(--wa-tabbar-h) + env(safe-area-inset-bottom) + 6px);
    overscroll-behavior: contain;
  }
  /* Filtros: se deslizan en horizontal en vez de amontonarse en dos filas */
  .wa-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .wa-filters::-webkit-scrollbar { display: none; }
  .wa-chip { flex-shrink: 0; }
  .wa-menu--labels { top: 42px; }

  /* ---- Conversación ---- */
  .wa-main {
    position: absolute; inset: 0; transform: translateX(100%);
    transition: transform .22s ease; z-index: 30;
    background: var(--chat-bg); will-change: transform;
  }
  .wa.chat-open .wa-main { transform: translateX(0); }
  .wa-hero { display: none; }
  .wa-back { display: inline-flex; margin-right: -.15rem; }

  .wa-chat__head {
    gap: .3rem; border-left: 0;
    padding: .4rem .45rem .4rem .3rem;
    padding-top: calc(.4rem + env(safe-area-inset-top));
    min-height: calc(54px + env(safe-area-inset-top));
    overflow: hidden;
  }
  .wa-chat__who { flex: 1 1 auto; min-width: 0; }
  .wa-chat__who b { font-size: 16px; }
  /* Header limpio como en la app: back · avatar · nombre · Bot · ⋮.
     La búsqueda en el chat y las llamadas/video (que no existen en la API de
     Meta) se quitan del header para que nada se corte; las opciones del chat
     siguen en el menú ⋮. */
  #waMsgSearchBtn, #waVideoBtn, #waCallBtn, .wa-chat__labels { display: none; }
  #waBotBtn { flex-shrink: 0; }
  .wa-chat__head .wa-iconbtn { flex-shrink: 0; }

  .wa-msgs { padding: .8rem 4% 1rem; }
  .wa-bubble { max-width: 84%; font-size: 15px; }
  .wa-bubble img.wa-photo { width: min(66vw, 280px); }

  /* Barra de escritura y grabadora pegadas abajo, sobre la barra de gestos */
  .wa-input, .wa-rec { padding-bottom: calc(.55rem + env(safe-area-inset-bottom)); }
  .wa-closedbar { padding-bottom: calc(.6rem + env(safe-area-inset-bottom)); }
  .wa-closedbar span { min-width: 0; }
  .wa-closedbar .wa-btn { flex-shrink: 0; }

  /* Popups que no se salen de la pantalla */
  .wa-quick { left: 0; right: 0; }
  .wa-emoji {
    left: .8rem; right: .8rem; width: auto; max-width: none;
    bottom: calc(64px + env(safe-area-inset-bottom));
  }

  /* ---- Ficha del cliente a pantalla completa ---- */
  .wa-drawer { position: absolute; right: 0; top: 0; width: 100%; max-width: 100%; z-index: 50; box-shadow: var(--shadow); }
  .wa-drawer header {
    padding-top: calc(.6rem + env(safe-area-inset-top));
    min-height: calc(54px + env(safe-area-inset-top));
  }

  /* LA FLECHITA DE OPCIONES, TAMBIÉN EN EL CELULAR (9-ago-2026).
     Antes estaba escondida y la única forma de archivar, fijar o bloquear era
     mantener el dedo apretado; en el iPhone eso fallaba casi siempre y lo que
     pasaba era que se abría el chat. Ahora se ve siempre, como el ⌄ de WhatsApp
     Web: un toque y sale el menú. Mantener presionado sigue funcionando. */
  .wa-row__more {
    opacity: 1;
    width: 36px; height: 36px;
    right: 2px;
    background: transparent;
    color: var(--text-3);
  }
  .wa-row__more svg { width: 20px; height: 20px; }
  .wa-row.is-active .wa-row__more { background: transparent; }
  /* Sitio para la flechita: sin esto tapaba la hora y el globito de no leídos */
  .wa-row { padding-right: 2.4rem; }

  /* ---- Modales como hoja que sube desde abajo (bottom sheet) ---- */
  .wa-modalback { align-items: flex-end; padding: 0; }
  .wa-modal {
    width: 100%; max-width: 100%;
    max-height: 92vh; max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: waSheetUp .22s ease;
  }

  /* Campos a 16px: evita el zoom automático de iOS al enfocar */
  .wa-search__box input,
  .wa-input__box textarea,
  .wa-msgsearch input,
  .wa-field input, .wa-field textarea, .wa-field select,
  .wa-modal input, .wa-modal textarea, .wa-modal select,
  .wa-qr-input input {
    font-size: 16px;
  }

  /* Toast por encima de la barra de pestañas */
  .wa-toast { bottom: calc(var(--wa-tabbar-h) + env(safe-area-inset-bottom) + 14px); }

  /* Setup / visor de fotos con aire para el notch */
  .wa-setup { padding-top: calc(1.2rem + env(safe-area-inset-top)); }
  .wa-setup__card { padding: 1.8rem 1.5rem; }
  .wa-lightbox { padding: 1rem; }
  .wa-lightbox__close { top: calc(14px + env(safe-area-inset-top)); }
}

@keyframes waSheetUp { from { transform: translateY(100%); } }

/* Teléfonos estrechos (≤ 380 px): un punto más de ajuste */
@media (max-width: 380px) {
  .wa-railbtn { font-size: 10.5px; }
  .wa-railbtn i { padding: 2.5px 12px; }
  .wa-chat__head .wa-iconbtn { width: 38px; height: 38px; }
  .wa-chat__head .wa-iconbtn svg { width: 21px; height: 21px; }
  .wa-chat__who b { font-size: 15px; }
}

/* =============================================================================
   MANTENER PRESIONADO EN EL CELULAR
   Sobre un chat o una burbuja, el dedo sostenido abre NUESTRO menú (Responder,
   Copiar, Reaccionar…). Para eso hay que desactivar la selección de texto y el
   menú propio del sistema, igual que hace WhatsApp. El texto igual se puede
   copiar: con la opción "Copiar" del menú.
   ============================================================================= */
@media (hover: none) {
  .wa-row,
  .wa-msg .wa-bubble {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  /* Los enlaces sí se pueden tocar y mantener presionados con normalidad */
  .wa-bubble a { -webkit-touch-callout: default; -webkit-user-select: text; user-select: text; }

  .wa-menu--row, .wa-menu--msg { min-width: 268px; max-width: 88vw; }
  /* Solo las opciones sueltas del menú, NO los emojis (van dentro de .wa-ctxre) */
  .wa-menu--row > button, .wa-menu--msg > button { padding: .78rem 1.1rem; font-size: 15px; }
  .wa-ctxre { padding: .5rem .35rem; }
  .wa-ctxre .wa-ctxre__b { width: 36px; height: 36px; font-size: 21px; }
}

/* Teléfonos estrechos: la barra de reacciones no debe desbordar */
@media (max-width: 380px) {
  .wa-menu--row, .wa-menu--msg { min-width: 252px; }
  .wa-ctxre .wa-ctxre__b { width: 33px; height: 33px; font-size: 19px; }
}
