/* Bandeja de WhatsApp. Aspecto de WhatsApp Web: colores, burbujas con cola, fondo de dibujos propio (SVG de este fichero),
   cabeceras grises, lista de chats con avatar. Sin imágenes ni iconos de nadie: todo es CSS y SVG propios. */
:root {
  --fondo: #f0f2f5;
  --panel: #ffffff;
  --tinta: #111b21;
  --suave: #667781;
  --linea: #e9edef;
  --acento: #00a884;
  --acento-hover: #008f6f;
  --acento-claro: #d9fdd3;
  --verde: #25d366;
  --entrante: #ffffff;
  --saliente: #d9fdd3;
  --fondo-chat: #efeae2;
  --cabecera: #f0f2f5;
  --nota: #fff3c4;
  --check-azul: #53bdeb;
  --mal: #b42318;
  --radio: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: var(--tinta); background: var(--fondo); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--fondo); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
[hidden] { display: none !important; }

.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.ico.mini { width: 16px; height: 16px; vertical-align: -3px; }
.ico.grande { width: 34px; height: 34px; }

.boton { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #d1d7db; background: var(--panel); border-radius: 8px; padding: .45rem .8rem; cursor: pointer; min-height: 36px; }
.boton:hover { border-color: #aab3b8; }
.boton:disabled { opacity: .55; cursor: default; }
.boton.principal { background: var(--acento); border-color: var(--acento); color: #fff; font-weight: 600; }
.boton.principal:hover:not(:disabled) { background: var(--acento-hover); }
.boton.grande { min-height: 46px; padding: .6rem 1.2rem; font-size: 1rem; border-radius: 24px; }
.boton.fantasma { border-color: transparent; background: transparent; }
.boton.fantasma:hover { background: rgba(0,0,0,.05); }
.icono-boton { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: #54656f; cursor: pointer; flex: none; }
.icono-boton:hover { background: rgba(11,20,26,.08); }
.icono-boton.activo { background: rgba(11,20,26,.1); color: var(--acento); }
.icono-boton:disabled { opacity: .4; cursor: default; }

label { display: grid; gap: .3rem; font-size: .9rem; color: var(--suave); }
input, select, textarea { border: 1px solid #d1d7db; border-radius: 8px; padding: .5rem .65rem; background: #fff; color: var(--tinta); min-height: 38px; }
textarea { resize: vertical; }
.casilla { display: flex; align-items: center; gap: .5rem; color: var(--tinta); }
.casilla input { min-height: auto; }
fieldset { border: 1px solid var(--linea); border-radius: 8px; padding: .5rem .8rem; display: grid; gap: .3rem; }
legend { font-size: .9rem; color: var(--suave); padding: 0 .3rem; }
.error { color: var(--mal); margin: 0; min-height: 1.2em; font-size: .9rem; }
.ayuda { color: var(--suave); font-size: .92rem; margin: 0 0 .75rem; }

/* Entrar */
.pantalla-login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: linear-gradient(#00a884 0 30%, var(--fondo) 30%); }
.tarjeta-login { width: min(380px, 100%); background: var(--panel); border-radius: 12px; padding: 1.75rem; display: grid; gap: 1rem; box-shadow: 0 6px 24px rgba(11,20,26,.16); }
.tarjeta-login h1 { margin: 0; }
.marca { display: flex; align-items: center; gap: .6rem; font-weight: 600; }

/* Estructura */
.marco { height: 100%; display: flex; flex-direction: column; }
.barra { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem 1rem; background: var(--acento); color: #fff; min-height: 48px; }
.barra .boton.fantasma { color: #fff; }
.barra .boton.fantasma:hover { background: rgba(255,255,255,.16); }
.barra-derecha { display: flex; align-items: center; gap: .5rem; }
.quien { opacity: .9; font-size: .9rem; }
.cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); background: var(--panel); }

/* Lista de chats */
.lista { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--linea); }
.lista-cabeza { padding: .6rem .75rem .35rem; display: grid; gap: .55rem; background: var(--panel); }
.lista-titulo { display: flex; align-items: center; justify-content: space-between; }
.lista-titulo h1 { margin: 0; font-size: 1.3rem; font-weight: 700; }
.buscar-fila { display: flex; gap: .4rem; align-items: center; }
.buscador { flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; background: var(--fondo); border-radius: 8px; padding: 0 .75rem; color: var(--suave); }
.buscador input { flex: 1; min-width: 0; border: 0; background: transparent; padding: .45rem 0; min-height: 36px; }
.buscador input:focus-visible { outline: none; }
.buscador:focus-within { outline: 2px solid var(--acento); }
.pestanas { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.pestana { border: 0; background: var(--fondo); padding: .3rem .8rem; border-radius: 999px; cursor: pointer; color: var(--suave); white-space: nowrap; font-size: .9rem; }
.pestana:hover { background: #e4e7ea; }
.pestana[aria-selected="true"] { background: var(--acento-claro); color: #025144; font-weight: 600; }
.conversaciones { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.fila { width: 100%; display: flex; gap: .85rem; padding: .6rem .9rem; border: 0; background: transparent; text-align: left; cursor: pointer; align-items: center; }
.fila:hover { background: #f5f6f6; }
.fila.activa { background: var(--fondo); }
.fila-texto { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .1rem; padding-bottom: .55rem; border-bottom: 1px solid var(--linea); margin-top: .55rem; }
.fila-arriba, .fila-abajo { display: flex; justify-content: space-between; gap: .5rem; align-items: center; min-width: 0; }
.nombre { min-width: 0; font-size: 1.04rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hora { color: var(--suave); font-size: .75rem; flex: none; }
.resumen { flex: 1 1 auto; min-width: 0; display: block; color: var(--suave); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resumen .ico, .resumen .estado { vertical-align: -3px; margin-right: .25rem; }
.resumen .estado { display: inline-flex; flex: none; }
.resumen.escribiendo, .escribiendo { color: var(--acento); font-weight: 500; }
.sin-leer .nombre { font-weight: 600; }
.sin-leer .resumen { color: var(--tinta); }
.sin-leer .hora { color: var(--verde); font-weight: 600; }
.globo { flex: none; background: var(--verde); color: #fff; border-radius: 999px; min-width: 20px; padding: 0 6px; font-size: .75rem; font-weight: 700; text-align: center; line-height: 20px; }
.hueco-filtro { display: contents; }
.filtro-etiqueta { max-width: 120px; min-height: 36px; border-radius: 8px; background: var(--fondo); border-color: transparent; }
.fila-meta { display: flex; gap: .3rem; flex-wrap: wrap; }
.fila-meta:empty { display: none; }
.avatar { flex: none; width: 49px; height: 49px; border-radius: 50%; color: #3b4a54; display: grid; place-items: center; font-weight: 600; font-size: 1rem; overflow: hidden; }
.avatar.sin-nombre { background: #dfe5e7; color: #fff; }
.avatar.sin-nombre .ico { width: 70%; height: 70%; margin-top: 18%; }
.chapa { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--acento-claro); color: #025144; }
.chapa.suave { background: #e9edef; color: #54656f; }
.chapa.gris { background: #f1efe9; color: #7a6a3e; }
.chapa.verde { background: #d9fdd3; color: #025144; }
.chapa.ambar { background: #fbf0d6; color: #7a5410; }
.chapa.roja { background: #fbe4e2; color: #9b2820; }
.lista-plantillas { list-style: none; margin: .75rem 0 0; padding: 0; }
.lista-plantillas li { padding: .75rem 0; border-top: 1px solid var(--linea); }
.lista-plantillas li > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .2rem; }
.lista-plantillas .ayuda { margin: 0; }
.idioma-plantilla { margin-top: .6rem; }
.nombre-idioma { font-size: .85rem; font-weight: 600; }
.texto-plantilla { white-space: pre-line; background: #f6f7f5; border-radius: 8px; padding: .5rem .75rem; margin: .4rem 0 0; font-size: .9rem; }
.aviso-texto { background: #fbf0d6; color: #7a5410; border-radius: 8px; padding: .5rem .75rem; }
.lista-vacia { padding: 2rem 1rem; color: var(--suave); text-align: center; }

/* Etiquetas */
.etiqueta { font-size: .72rem; padding: .05rem .5rem; border-radius: 4px; border-left: 3px solid; background: #f3f4f2; color: #2c3530; white-space: nowrap; }
.etq-verde { border-color: #1f8a5b; background: #e4f3ea; }
.etq-azul { border-color: #2563a8; background: #e3edf8; }
.etq-morado { border-color: #6d4bb0; background: #eee8f8; }
.etq-rosa { border-color: #b63f7f; background: #f8e6ef; }
.etq-rojo { border-color: #b42318; background: #fbe6e4; }
.etq-naranja { border-color: #c2620e; background: #fcecdc; }
.etq-amarillo { border-color: #a38200; background: #fbf3cf; }
.etq-gris { border-color: #67736e; background: #eceeec; }
.tira-etiquetas { display: flex; gap: .35rem; flex-wrap: wrap; padding: .4rem .9rem; background: var(--cabecera); border-top: 1px solid var(--linea); }
.fila-telefono { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .6rem; }
.fila-telefono select, .fila-telefono input { width: 100%; min-width: 0; }
@media (max-width: 480px) { .fila-telefono { grid-template-columns: 1fr; } }
.lista-casillas { display: grid; gap: .45rem; max-height: 260px; overflow-y: auto; }
.fila-crear { display: flex; gap: .4rem; flex-wrap: wrap; }
.fila-crear input { flex: 1; min-width: 160px; }
.ayuda-linea { color: var(--suave); font-size: .85rem; }

/* Chat: fondo de dibujos propio (SVG de abajo), cabecera gris, burbujas con cola */
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background-color: var(--fondo-chat); background-image: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22360%22%20height=%22360%22%20viewBox=%220%200%20360%20360%22%20fill=%22none%22%20stroke=%22%23000%22%20stroke-opacity=%22.055%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Ccircle%20cx=%2240%22%20cy=%2244%22%20r=%2212%22/%3E%3Cpath%20d=%22M110%2030l6%2014%2015%201-11%2010%204%2015-14-8-14%208%204-15-11-10%2015-1z%22/%3E%3Cpath%20d=%22M190%2040q10-16%2020%200t20%200%2020%200%22/%3E%3Cpath%20d=%22M290%2028c-14%200-22%2012-10%2022l10%2010%2010-10c12-10%204-22-10-22z%22%20transform=%22translate(0%204)%22/%3E%3Crect%20x=%22320%22%20y=%2290%22%20width=%2226%22%20height=%2220%22%20rx=%225%22/%3E%3Cpath%20d=%22M30%20120q14-18%2028%200t28%200%22/%3E%3Ccircle%20cx=%22130%22%20cy=%22120%22%20r=%225%22/%3E%3Ccircle%20cx=%22130%22%20cy=%22120%22%20r=%2214%22/%3E%3Cpath%20d=%22M200%20110c10-14%2030-14%2040%200%2012%200%2018%2010%2012%2018h-60c-8-8-2-18%208-18z%22/%3E%3Cpath%20d=%22M296%20140l12%2022h-24z%22/%3E%3Ccircle%20cx=%2260%22%20cy=%22210%22%20r=%2216%22/%3E%3Cpath%20d=%22M52%20210h16M60%20202v16%22/%3E%3Cpath%20d=%22M120%20200q18%2020%2036%200%22/%3E%3Cpath%20d=%22M190%20190l20%2020M210%20190l-20%2020%22/%3E%3Cpath%20d=%22M260%20200c14-18%2040-8%2028%2012-6%2010-20%2014-28%204%22/%3E%3Crect%20x=%22316%22%20y=%22200%22%20width=%2222%22%20height=%2222%22%20rx=%2211%22/%3E%3Cpath%20d=%22M34%20290l9%2018%2020%203-14%2014%203%2020-18-10-18%2010%203-20-14-14%2020-3z%22%20transform=%22scale(.7)%20translate(10%20120)%22/%3E%3Cpath%20d=%22M110%20290c0-16%2024-16%2024%200s-24%2016-24%2032%22/%3E%3Ccircle%20cx=%22190%22%20cy=%22300%22%20r=%2210%22/%3E%3Cpath%20d=%22M230%20300q10-14%2020%200t20%200%22/%3E%3Cpath%20d=%22M300%20280l14%2014-14%2014-14-14z%22/%3E%3Ccircle%20cx=%22330%22%20cy=%22340%22%20r=%226%22/%3E%3Cpath%20d=%22M60%20340h40%22/%3E%3C/svg%3E"); background-size: 360px 360px; position: relative; }
.chat-vacio { margin: auto; max-width: 420px; text-align: center; color: var(--suave); padding: 1rem; display: grid; gap: .4rem; justify-items: center; }
.chat-vacio-dibujo { width: 120px; height: 120px; }
.chat-vacio-dibujo svg { width: 100%; height: 100%; }
.chat-vacio .grande { font-size: 1.5rem; font-weight: 300; color: #41525d; margin: .5rem 0 0; }
.chat-cabeza { display: flex; align-items: center; gap: .4rem; padding: .5rem .8rem; background: var(--cabecera); border-bottom: 1px solid var(--linea); min-height: 59px; }
.chat-persona { flex: 1; min-width: 0; display: flex; align-items: center; gap: .8rem; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.chat-persona .avatar { width: 40px; height: 40px; font-size: .9rem; }
.chat-quien { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.nombre-chat { font-size: 1rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tel { color: var(--suave); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-acciones { display: flex; gap: .1rem; flex: none; }
.chat-panel { display: flex; gap: .8rem; flex-wrap: wrap; align-items: end; padding: .6rem .9rem; background: var(--cabecera); border-bottom: 1px solid var(--linea); }
.chat-panel select { min-height: 36px; }
.nota-contacto { margin: 0; padding: .45rem .9rem; background: var(--nota); font-size: .88rem; border-bottom: 1px solid #efdfa8; white-space: pre-wrap; }
.mensajes { list-style: none; margin: 0; padding: 1rem clamp(.75rem, 6vw, 4rem) .5rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.separador-dia { align-self: center; margin: .7rem 0 .5rem; }
.separador-dia span { display: inline-block; background: #fff; color: #54656f; font-size: .75rem; padding: .25rem .7rem; border-radius: 8px; box-shadow: 0 1px .5px rgba(11,20,26,.13); text-transform: uppercase; }

.burbuja { position: relative; max-width: min(560px, 85%); min-width: 76px; padding: .3rem .5rem .25rem .55rem; border-radius: 8px; background: var(--entrante); box-shadow: 0 1px .5px rgba(11,20,26,.13); font-size: .92rem; line-height: 1.35; display: flow-root; }
.burbuja p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.burbuja.entrante { align-self: flex-start; }
.burbuja.saliente { align-self: flex-end; background: var(--saliente); }
.burbuja.cola { margin-top: 6px; }
.burbuja.entrante.cola { border-top-left-radius: 0; }
.burbuja.saliente.cola { border-top-right-radius: 0; }
.burbuja.cola::before { content: ""; position: absolute; top: 0; width: 9px; height: 13px; background: inherit; }
.burbuja.entrante.cola::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.burbuja.saliente.cola::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.burbuja.nota { align-self: center; background: var(--nota); max-width: min(560px, 90%); border: 1px dashed #d8bf6a; margin: 6px 0; }
.autor { display: block; font-size: .75rem; font-weight: 600; color: #067a5f; margin-bottom: 1px; }
.burbuja .pie { float: right; display: inline-flex; align-items: center; gap: .2rem; margin: .45rem 0 -.1rem .7rem; color: rgba(17,27,33,.55); font-size: .69rem; line-height: 1; white-space: nowrap; }
.estado { display: inline-flex; color: #8696a0; }
.estado.leido { color: var(--check-azul); }
.estado.fallido { color: var(--mal); }
.fallo { color: var(--mal); font-size: .82rem; }
.burbuja .responder { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: inherit; color: #667781; display: none; place-items: center; cursor: pointer; box-shadow: 0 0 6px rgba(11,20,26,.15); }
.burbuja .responder .ico { width: 14px; height: 14px; }
.burbuja:hover .responder, .burbuja .responder:focus-visible { display: grid; }
.cita { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; background: rgba(11,20,26,.06); border-left: 4px solid var(--acento); border-radius: 6px; padding: .3rem .5rem; margin-bottom: .3rem; min-width: 0; }
.burbuja.entrante .cita { border-left-color: #53bdeb; }
.cita-autor { font-size: .78rem; font-weight: 600; color: var(--acento); }
.burbuja.entrante .cita-autor { color: #3a8fb7; }
.cita-texto { font-size: .83rem; color: #54656f; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.burbuja .foto { display: block; margin: -.1rem -.25rem .25rem; }
.burbuja .foto img, .burbuja .video { display: block; max-width: 100%; width: 320px; max-height: 340px; object-fit: cover; border-radius: 6px; }
.burbuja .video { background: #000; }
.documento { display: flex; align-items: center; gap: .6rem; background: rgba(11,20,26,.06); border-radius: 6px; padding: .55rem .6rem; margin-bottom: .25rem; color: inherit; text-decoration: none; min-width: 210px; }
.documento-icono { display: grid; place-items: center; width: 36px; height: 40px; border-radius: 4px; background: #fff; color: #d4504a; }
.documento-nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.documento-bajar { color: #54656f; }
.audio { display: flex; align-items: center; gap: .55rem; min-width: 240px; padding: .2rem 0; }
.audio-play { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: #54656f; display: grid; place-items: center; cursor: pointer; }
.audio-play:hover { background: rgba(11,20,26,.08); }
.audio-cuerpo { flex: 1; min-width: 0; display: grid; gap: 2px; }
.audio-barra { width: 100%; min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--acento); height: 18px; }
.audio-tiempo { font-size: .7rem; color: #667781; }

.composer { background: var(--cabecera); padding: .5rem .7rem .6rem; position: relative; }
.composer.nota { background: #fffaf0; }
.composer-fila { display: flex; gap: .3rem; align-items: flex-end; }
.caja-texto { flex: 1; min-width: 0; background: #fff; border-radius: 22px; padding: .1rem .85rem; display: flex; }
.caja-texto textarea { flex: 1; min-height: 40px; max-height: 140px; resize: none; border: 0; background: transparent; padding: .55rem 0; outline: none; line-height: 1.35; }
.caja-texto:focus-within { outline: 2px solid var(--acento); }
.composer.nota .caja-texto { background: #fffdf5; border: 1px dashed #d8bf6a; }
.boton-redondo { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--acento); color: #fff; display: grid; place-items: center; cursor: pointer; }
.boton-redondo:hover:not(:disabled) { background: var(--acento-hover); }
.boton-redondo.mic { background: transparent; color: #54656f; }
.boton-redondo:disabled { cursor: not-allowed; opacity: .55; }
.nota-conmutador { flex: none; align-self: center; border: 1px solid #d1d7db; background: #fff; border-radius: 999px; padding: .25rem .7rem; cursor: pointer; font-size: .82rem; color: #54656f; }
.nota-conmutador.activo { background: var(--nota); border-color: #d8bf6a; color: #6b5200; font-weight: 600; }
.composer.cerrado { background: var(--cabecera); }
.composer.cerrado p { margin: 0 0 .6rem; font-size: .9rem; }
.composer-botones { display: flex; gap: .5rem; flex-wrap: wrap; }
.ventana { margin: .35rem .4rem 0; color: var(--suave); font-size: .75rem; }
.cita-previa { display: flex; align-items: center; gap: .4rem; background: #fff; border-radius: 10px 10px 0 0; padding: .4rem .5rem; margin-bottom: .4rem; }
.cita-previa .cita { flex: 1; margin: 0; }
.sugerencias { position: absolute; bottom: 100%; left: .75rem; right: .75rem; list-style: none; margin: 0; padding: .25rem; background: #fff; border: 1px solid var(--linea); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.1); z-index: 3; }
.sugerencias button { width: 100%; text-align: left; border: 0; background: none; padding: .45rem .5rem; border-radius: 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugerencias button:hover, .sugerencias button:focus-visible { background: var(--acento-claro); }
.emoji-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; background: #fff; border-radius: 10px; padding: .4rem; margin-bottom: .45rem; max-height: 170px; overflow-y: auto; }
.emoji-panel button { border: 0; background: none; font-size: 1.4rem; line-height: 1; padding: .3rem; border-radius: 6px; cursor: pointer; }
.emoji-panel button:hover, .emoji-panel button:focus-visible { background: var(--fondo); }
.adjunto-vista { max-width: 100%; max-height: 300px; border-radius: 8px; justify-self: center; }

/* Diálogos */
.dialogo { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100% - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.dialogo::backdrop { background: rgba(11,20,26,.45); }
.dialogo form { padding: 1.25rem; display: grid; gap: .8rem; }
.dialogo h2 { margin: 0; }
.dialogo-botones { display: flex; justify-content: flex-end; gap: .5rem; }
.variables { display: grid; gap: .6rem; }
.vista-plantilla { margin: 0; padding: .6rem .75rem; background: var(--saliente); border-radius: 8px; white-space: pre-wrap; }

/* Ajustes */
.ajustes { overflow-y: auto; padding: 1.25rem 16px 3rem; width: min(860px, 100%); margin: 0 auto; }
.bloque { background: var(--panel); border: 1px solid var(--linea); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; display: grid; gap: .6rem; justify-items: start; }
.bloque > * { max-width: 100%; }
.tabla { list-style: none; margin: 0; padding: 0; width: 100%; }
.tabla li { padding: .65rem 0; border-top: 1px solid var(--linea); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; }
.tabla li > .datos { flex-basis: 100%; }
.tabla li.inactivo, tr.inactivo { opacity: .55; }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; margin: 0; font-size: .88rem; }
.datos dt { color: var(--suave); }
.datos dd { margin: 0; min-width: 0; }
.acciones { display: flex; gap: .4rem; flex-wrap: wrap; }
.formulario { display: grid; gap: .7rem; width: min(440px, 100%); }
h3 { font-size: 1rem; margin: .5rem 0 .25rem; }
.enlaces { width: 100%; }
.uso { border-collapse: collapse; width: 100%; font-size: .9rem; }
.uso th, .uso td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--linea); }
.uso th { color: var(--suave); font-weight: 500; }

/* Asistente: conectar el número de una tienda */
.asistente { width: min(760px, 100%); }
.requisitos { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; width: 100%; }
.requisitos li { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; }
.requisitos li .ico { margin-top: 2px; }
.requisitos li.ok .ico { color: var(--acento); }
.requisitos li.mal .ico { color: var(--mal); }
.requisitos li.pend .ico { color: #8696a0; }
.resultado { margin: 0; min-height: 1.3em; font-size: .92rem; }
.resultado.ok { color: #067a5f; }
.resultado.mal { color: var(--mal); }
.pasos { display: flex; gap: .4rem; list-style: none; margin: 0 0 1rem; padding: 0; flex-wrap: wrap; }
.pasos li { flex: 1 1 120px; padding: .45rem .7rem; border-radius: 8px; background: var(--fondo); color: var(--suave); font-size: .85rem; text-align: center; }
.pasos li.hecho { background: var(--acento-claro); color: #025144; }
.pasos li.actual { background: var(--acento); color: #fff; font-weight: 600; }
.texto-pasos { margin: 0; padding-left: 1.3rem; display: grid; gap: .4rem; font-size: .95rem; }
.aviso-grande { background: #fff8e1; border: 1px solid #f1d98a; border-radius: 10px; padding: .8rem 1rem; color: #5e4700; }
.aviso-grande p { margin: .35rem 0 0; }
.llamando { display: flex; gap: .9rem; align-items: center; background: var(--acento-claro); border-radius: 10px; padding: .9rem 1rem; color: #025144; width: 100%; }
.llamando p { margin: .2rem 0 0; }
.reintento { font-size: .9rem; color: var(--suave); }
.reintento strong { font-variant-numeric: tabular-nums; color: var(--tinta); font-size: 1.05rem; }
.codigo { font-size: 1.8rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; min-height: 56px; }
.metodo { width: 100%; }
.error-caja { background: #fdecea; color: #7a1d14; border-radius: 8px; padding: .65rem .9rem; margin-bottom: .75rem; }
.error-caja details { margin-top: .4rem; font-size: .85rem; }
.si-pasa { width: 100%; background: var(--panel); border: 1px solid var(--linea); border-radius: 12px; padding: .8rem 1.1rem; margin-top: 1rem; }
.si-pasa > summary { cursor: pointer; font-weight: 600; }
.si-pasa-item { margin-top: .5rem; }
.si-pasa-item summary { cursor: pointer; }
.si-pasa-item ul { margin: .4rem 0 .2rem; padding-left: 1.2rem; display: grid; gap: .3rem; font-size: .92rem; color: #3b4a54; }

#aviso { position: fixed; bottom: 16px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #111b21; color: #fff; padding: .6rem 1rem; border-radius: 8px; max-width: calc(100% - 32px); transition: opacity .2s, transform .2s; z-index: 10; }
#aviso.visible { opacity: 1; transform: translate(-50%, 0); }
#aviso.mal { background: var(--mal); }

.solo-movil { display: none; }
@media (max-width: 760px) {
  /* Móvil: la lista y la conversación son dos pantallas separadas; el chat va a pantalla completa con «volver». */
  html, body, #app { height: 100dvh; }
  .cuerpo { grid-template-columns: 1fr; }
  .cuerpo.con-chat .lista { display: none; }
  .cuerpo:not(.con-chat) .chat { display: none; }
  .marco:has(.cuerpo.con-chat) > .barra { display: none; }
  .solo-movil { display: inline-flex; }
  .quien { display: none; }
  .burbuja { max-width: 88%; }
  .mensajes { padding-inline: .6rem; }
  .composer { padding-bottom: calc(.6rem + env(safe-area-inset-bottom, 0px)); }
  .chat-cabeza { padding-top: calc(.5rem + env(safe-area-inset-top, 0px)); }
  .avatar { width: 46px; height: 46px; }
  .asistente h1 { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { #aviso { transition: none; } }

/* Nota de voz: barra de grabación (papelera, punto rojo, tiempo, onda y enviar) */
.composer.grabando { background: var(--cabecera); }
.grab-barra { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; background: #fff; border-radius: 22px; padding: 0 .9rem; min-height: 42px; overflow: hidden; }
.grab-punto { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #ea0038; animation: grab-parpadeo 1.1s ease-in-out infinite; }
.grab-tiempo { flex: none; font-variant-numeric: tabular-nums; color: #3b4a54; min-width: 2.4rem; }
.grab-onda { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; height: 26px; overflow: hidden; }
.grab-onda i { flex: none; width: 3px; height: 100%; border-radius: 2px; background: #8696a0; transform-origin: center; animation: grab-onda .7s ease-in-out infinite alternate; }
.grab-ayuda { flex: none; font-size: .72rem; color: var(--suave); }
.grab-cancelar { background: transparent; color: #54656f; }
.grab-cancelar:hover:not(:disabled) { background: rgba(11,20,26,.08); color: #ea0038; }
.grab-enviando { margin: .5rem; color: var(--suave); }
.icono-boton.dictar.activo { background: #fde8ec; color: #ea0038; }
@keyframes grab-parpadeo { 50% { opacity: .25; } }
@keyframes grab-onda { from { transform: scaleY(.15); } to { transform: scaleY(.9); } }
@media (max-width: 640px) { .grab-ayuda { display: none; } }
@media (prefers-reduced-motion: reduce) { .grab-punto, .grab-onda i { animation: none; } .grab-onda i { transform: scaleY(.5); } }

/* Transcribir un audio del cliente */
.transcripcion { margin: .15rem 0 .3rem; font-size: .88rem; }
.transcripcion .enlace { background: none; border: 0; padding: .15rem 0; color: #027eb5; cursor: pointer; font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; }
.transcripcion .enlace:hover { text-decoration: underline; }
.transcripcion .enlace:disabled { color: #667781; cursor: progress; text-decoration: none; }
.transcripcion .enlace svg { width: 16px; height: 16px; }
.transcripcion-texto { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.transcripcion-vacia, .transcripcion-aviso { margin: .2rem 0 0; font-size: .74rem; color: #667781; }
.transcripcion-botones { display: flex; gap: .9rem; margin-top: .15rem; }

/* Estilo Telegram (2026-11-01, tras por_tienda): reacciones, borradores, búsqueda y programados */
.burbuja { position: relative; }
.burbuja .reaccionar { position: absolute; top: 2px; right: 30px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: inherit; color: #667781; display: none; place-items: center; cursor: pointer; font-weight: 700; box-shadow: 0 0 6px rgba(11,20,26,.15); }
.burbuja:hover .reaccionar, .burbuja .reaccionar:focus-visible { display: grid; }
.reacciones-fila { position: absolute; z-index: 5; top: -34px; right: 0; display: flex; gap: 2px; padding: 3px 6px; background: #fff; border-radius: 999px; box-shadow: 0 2px 10px rgba(11,20,26,.25); }
.reacciones-fila button { border: 0; background: transparent; font-size: 20px; line-height: 1; padding: 3px; border-radius: 50%; cursor: pointer; }
.reacciones-fila button:hover, .reacciones-fila button.activa { background: #e9edef; }
.reaccion-puesta { display: inline-block; margin-top: 2px; padding: 0 6px; font-size: 14px; background: #fff; border-radius: 999px; box-shadow: 0 1px 3px rgba(11,20,26,.2); }
.resumen .borrador { color: #d93025; font-weight: 600; }
.lista-seccion { padding: .5rem 1rem 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); }
.resumen mark { background: #fde68a; border-radius: 3px; padding: 0 1px; }
.programado { padding: .6rem; border: 1px solid #e9edef; border-radius: 10px; margin-bottom: .5rem; }
.programado.fallido { border-color: #f5b5b0; background: #fdf2f1; }
.programado p { margin: .25rem 0; white-space: pre-wrap; word-break: break-word; }
.programado-botones { display: flex; gap: .4rem; justify-content: flex-end; }

/* Fijados, reenviar, borrar y burbujitas (2026-11-01, tras por_tienda) */
.barra-fijados { display: flex; gap: .5rem; align-items: center; padding: .35rem .8rem; background: #fff; border-bottom: 1px solid #e9edef; }
.barra-fijados .fijado-actual { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
button.mini { border: 0; background: transparent; color: #027b5f; font-weight: 600; font-size: .75rem; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
button.mini:hover { background: #e7f6f2; }
.burbuja .acciones-extra { position: absolute; top: 2px; right: 62px; display: none; gap: 2px; }
.burbuja:hover .acciones-extra, .burbuja .acciones-extra:focus-within { display: flex; }
.burbujitas { position: fixed; right: 16px; bottom: 80px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(300px, calc(100vw - 32px)); }
.burbujita { display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 1px solid #e9edef; border-radius: 14px; background: #fff; padding: 8px 12px; box-shadow: 0 4px 14px rgba(11,20,26,.2); cursor: pointer; }
.burbujita span { color: #667781; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Vista de administración (todas las tiendas) y «Mi WhatsApp» */
.hueco-tienda:empty { display: none; }
.filtro-tienda { width: 100%; min-height: 36px; border-radius: 8px; background: var(--fondo); border-color: transparent; font-weight: 600; }
.sale-por { margin: 0; padding: .35rem .9rem; font-size: .8rem; color: var(--suave); background: var(--panel); border-top: 1px solid var(--linea); display: flex; gap: .35rem; align-items: center; }
.comprueba { width: 100%; border: 1px solid var(--linea); border-radius: 10px; padding: .6rem .9rem; display: grid; gap: .5rem; }
.comprueba legend { font-weight: 600; padding: 0 .3rem; }
.comprueba .casilla { align-items: flex-start; }
.comprueba .casilla input { margin-top: .2rem; flex: none; }
.tarjeta-tienda { width: 100%; }
.tarjeta-tienda h2 { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* «Antes de empezar»: guía previa a configurar el WhatsApp (guiaAntes.js). Tarjeta clara, legible en móvil, foco visible. */
.guia-caja { width: 100%; }
.guia-antes { width: 100%; background: #ecf8f3; border: 1px solid #9fd8c2; border-radius: 12px; padding: 1rem 1.1rem; display: grid; gap: .9rem; color: var(--tinta); }
.guia-cabecera { display: flex; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.guia-ico { flex: none; color: #fff; background: var(--acento-hover); border-radius: 50%; padding: .45rem; box-sizing: content-box; }
.guia-titulo { flex: 1 1 14rem; min-width: 0; }
.guia-titulo h2 { margin: 0 0 .2rem; font-size: 1.15rem; }
.guia-titulo p { margin: .2rem 0 0; font-size: .95rem; line-height: 1.5; }
.guia-cuerpo { display: grid; gap: 1.1rem; font-size: .95rem; line-height: 1.5; }
.guia-cuerpo h3 { margin: 0 0 .3rem; font-size: 1rem; }
.guia-cuerpo p { margin: .2rem 0; }
.guia-lista { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.guia-requisitos { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.guia-requisitos .casilla { align-items: flex-start; cursor: pointer; }
.guia-requisitos input, .comprueba input { width: 1.2rem; height: 1.2rem; flex: none; margin-top: .15rem; accent-color: var(--acento-hover); }
.guia-pasos { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.guia-pasos li { display: flex; gap: .7rem; align-items: flex-start; }
.guia-num { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: #fff; border: 1px solid #9fd8c2; color: #05503f; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.guia-quien { font-size: .85rem; color: #3b4a52; margin-top: .15rem; }
.guia-enlace { margin: 0 0 .6rem; font-size: .85rem; }
.enlace-suave { background: none; border: 0; padding: .2rem 0; color: var(--suave); text-decoration: underline; cursor: pointer; font-size: inherit; min-height: 32px; }
.enlace-suave:hover { color: var(--tinta); }
.guia-cuerpo a { color: #05503f; text-decoration: underline; }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) { .guia-antes { padding: .85rem .8rem; } .guia-cabecera > .boton { width: 100%; min-height: 44px; } }

/* ===== Rediseño del chat (2026-11-06): lista, cabecera, escribir, ventanas y paneles con fondo y sitio propios ===== */
:root { --sombra-suave: 0 1px 2px rgba(11,20,26,.08); --sombra-panel: 0 10px 34px rgba(11,20,26,.22); --radio-panel: 14px; }

/* Lista de chats */
.lista-cabeza { padding: .9rem .9rem .5rem; gap: .7rem; }
.lista-titulo h1 { font-size: 1.3rem; letter-spacing: -.01em; }
.buscador { border-radius: 10px; min-height: 40px; }
.buscador input { min-height: 40px; }
.filtro-etiqueta { min-height: 40px; max-width: 132px; border-radius: 10px; padding-inline: .55rem; }
.pestanas { gap: .4rem; padding-bottom: .35rem; }
.pestana { padding: .32rem .9rem; font-weight: 500; border: 1px solid transparent; }
.pestana[aria-selected="true"] { border-color: #bfe8da; }
.conversaciones { scrollbar-width: thin; }
.fila { position: relative; min-height: 74px; padding: .15rem .9rem 0 .9rem; gap: .8rem; transition: background .12s; }
.fila.activa { background: #eaf6f2; }
.fila.activa::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--acento); }
.fila .avatar { width: 48px; height: 48px; }
.fila-texto { padding: .55rem 0 .6rem; margin-top: 0; gap: .15rem; }
.fila:last-child .fila-texto, .conversaciones li:last-child .fila-texto { border-bottom: 0; }
.fila-arriba { align-items: baseline; }
.nombre { font-weight: 500; }
.hora { font-variant-numeric: tabular-nums; }
.fila-meta { margin-top: .15rem; }
.etiqueta { border-radius: 4px; }

/* Cabecera del chat */
.chat-cabeza { gap: .5rem; padding: .55rem .9rem; min-height: 62px; box-shadow: var(--sombra-suave); position: relative; z-index: 1; }
.chat-persona { padding: .15rem .3rem .15rem 0; border-radius: 10px; }
.chat-persona:hover { background: rgba(11,20,26,.04); }
.nombre-chat { font-weight: 600; font-size: 1.02rem; }
.chat-acciones { align-items: center; gap: .15rem; }
.chat-acciones .mini { border: 1px solid #bfe8da; background: #fff; color: #027b5f; font-size: .8rem; padding: .3rem .7rem; border-radius: 999px; margin-right: .3rem; white-space: nowrap; }
.chat-acciones .mini:hover { background: #e7f6f2; }
.tira-etiquetas { padding: .4rem .9rem; gap: .4rem; background: var(--cabecera); }
.nota-contacto { padding: .5rem .9rem; }

/* Burbujas y fecha */
.mensajes { padding-top: 1.1rem; gap: 3px; }
.burbuja { border-radius: 10px; }
.burbuja.entrante { box-shadow: var(--sombra-suave); }

/* Cuadro de escribir */
.composer { padding: .55rem .8rem .65rem; border-top: 1px solid var(--linea); }
.composer-fila { gap: .35rem; align-items: center; }
.caja-texto { border-radius: 24px; padding-inline: 1rem; border: 1px solid transparent; }
.caja-texto textarea { min-height: 42px; }
.caja-texto:focus-within { outline: 0; border-color: var(--acento); box-shadow: 0 0 0 3px rgba(0,168,132,.18); }
.ventana { margin: .4rem .5rem 0; }
.sale-por { margin: 0; padding: .4rem .9rem; background: #fff; border-top: 1px solid var(--linea); color: var(--suave); font-size: .8rem; }

/* Ventanas (diálogos): fondo, color y sitio explícitos para que se vean igual en cualquier navegador y dentro del TPV */
.dialogo { position: fixed; inset: 0; margin: auto; background: var(--panel); color: var(--tinta); border-radius: var(--radio-panel); box-shadow: var(--sombra-panel); max-height: calc(100dvh - 32px); overflow: auto; }
.dialogo::backdrop { background: rgba(11,20,26,.5); }
.dialogo form { padding: 1.35rem; gap: .9rem; }

/* Panel anclado a un botón (etiquetas) */
.popover { position: fixed; z-index: 60; background: var(--panel); color: var(--tinta); border: 1px solid var(--linea); border-radius: var(--radio-panel); box-shadow: var(--sombra-panel); padding: .7rem .8rem .85rem; display: grid; gap: .65rem; overflow: auto; align-content: start; }
.popover-cabeza { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.popover-cabeza .icono-boton { width: 32px; height: 32px; }
.popover-lista { max-height: 240px; padding: .1rem 0; }
.casilla-etq { padding: .3rem .4rem; border-radius: 8px; cursor: pointer; }
.casilla-etq:hover { background: var(--fondo); }
.casilla-etq input { width: 18px; height: 18px; accent-color: var(--acento); }
.popover-crear { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .4rem; align-items: center; padding-top: .6rem; border-top: 1px solid var(--linea); }
.popover-crear input, .popover-crear select { min-width: 0; min-height: 38px; }

/* Perfil de empresa (Ajustes) */
.bloque-perfil { justify-items: stretch; }
.perfil-numero { max-width: 420px; }
.perfil { display: grid; gap: 1rem; }
.perfil-columnas { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.perfil-lado { display: grid; gap: .6rem; justify-items: start; }
.perfil-foto { width: 128px; height: 128px; border-radius: 50%; background: #dfe5e7; color: #54656f; display: grid; place-items: center; overflow: hidden; font-size: .85rem; }
.perfil-foto img { width: 100%; height: 100%; object-fit: cover; }
.perfil-foto.pequena { width: 56px; height: 56px; }
.perfil-vista { width: 100%; display: grid; gap: .3rem; margin-top: .6rem; }
.perfil-tarjeta { display: grid; gap: .2rem; justify-items: center; text-align: center; background: var(--fondo-chat); border-radius: 12px; padding: 1rem .8rem; overflow-wrap: anywhere; }
.perfil-tarjeta .suave { color: var(--suave); font-size: .85rem; }
.perfil-principal { display: grid; gap: 1.2rem; min-width: 0; }
.perfil-form { display: grid; gap: .8rem; width: 100%; }
.perfil-form label, .perfil-numero { position: relative; }
.perfil-form input, .perfil-form textarea, .perfil-form select, .perfil-nombre input { width: 100%; min-width: 0; padding: .5rem .7rem; border: 1px solid #d1d7db; border-radius: 8px; background: #fff; }
.perfil-form textarea { resize: vertical; }
.perfil-dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.contador { justify-self: end; font-size: .75rem; color: var(--suave); }
.contador.pasado { color: var(--mal); font-weight: 600; }
.perfil-nombre { display: grid; gap: .5rem; padding-top: 1rem; border-top: 1px solid var(--linea); }
.perfil-nombre h3 { margin: 0; }
.perfil-nombre .fila-crear input { flex: 1 1 220px; }
.perfil-nombre .chapa { margin-left: .5rem; }

@media (max-width: 760px) {
  .cuerpo { grid-template-columns: minmax(0, 1fr); }
  .perfil-columnas { grid-template-columns: minmax(0, 1fr); }
  .perfil-lado { grid-template-columns: auto 1fr; align-items: center; }
  .perfil-lado .ayuda, .perfil-vista { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  /* Móvil: la cabecera pasa a dos filas (nombre arriba, acciones debajo) para que el nombre no desaparezca */
  .chat-cabeza { flex-wrap: wrap; row-gap: .1rem; padding-bottom: .35rem; }
  .chat-persona { flex: 1 1 0; min-width: 0; }
  .chat-acciones { flex: 1 0 100%; justify-content: flex-end; padding-bottom: .1rem; }
  /* Escribir: el cuadro de texto ocupa toda la fila y los botones van debajo */
  .composer-fila { flex-wrap: wrap; }
  .caja-texto { order: -1; flex: 1 1 100%; }
  .composer-fila > .nota-conmutador { margin-right: auto; }
  .popover-crear { grid-template-columns: minmax(0, 1fr) auto; }
  .popover-crear .boton { grid-column: 1 / -1; justify-content: center; }
  .perfil-dos { grid-template-columns: minmax(0, 1fr); }
}

/* Móvil: la barra de arriba y la cabecera de la lista no se salen de la pantalla */
.lista-cabeza { grid-template-columns: minmax(0, 1fr); }
.buscar-fila { min-width: 0; }
.filtro-etiqueta { flex: 0 1 132px; min-width: 0; }
@media (max-width: 560px) {
  .barra { flex-wrap: wrap; row-gap: 0; padding: .3rem .6rem; }
  .barra-derecha { margin-left: auto; gap: .1rem; }
  .barra .boton { padding: .3rem .55rem; font-size: .85rem; white-space: nowrap; }
}

/* Estado de la conexión con Meta */
.bloque-estado { justify-items: stretch; }
.estado { display: grid; gap: .8rem; }
.estado-resumen { margin: 0; padding: .55rem .8rem; border-radius: 8px; font-weight: 600; }
.estado-resumen.bien { background: #d9fdd3; color: #025144; }
.estado-resumen.mal { background: #fbe4e2; color: #9b2820; }
.estado-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.estado-lista li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: .6rem; align-items: start; padding: .55rem 0; border-top: 1px solid var(--linea); overflow-wrap: anywhere; }
.estado-marca { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 700; font-size: .85rem; }
.estado-marca.bien { background: #d9fdd3; color: #025144; }
.estado-marca.mal { background: #fbe4e2; color: #9b2820; }
.estado-marca.manual { background: #fbf0d6; color: #7a5410; }
.estado-lista li > div { color: var(--tinta); }

/* ===== Diseño nuevo (2026-11-06, 2.ª vuelta): barra blanca con logo, fotos, insignia de tienda, ficha a la derecha ===== */
.burbuja .pie .estado, .pie .estado { display: inline-flex; }
:root { --verde-oscuro: #0b5d4b; --tarjeta-borde: #e3e8ea; }
body { background: #e9edef; }

/* Barra de arriba: blanca, con el logo de la empresa y botones claros */
.barra { background: #fff; color: var(--tinta); border-bottom: 1px solid var(--tarjeta-borde); min-height: 56px; padding: .4rem 1rem; box-shadow: var(--sombra-suave); position: relative; z-index: 3; }
.barra .boton.fantasma { color: #3b4a54; }
.barra .boton.fantasma:hover { background: #f0f2f5; }
.barra .marca { gap: .7rem; min-width: 0; }
.marca-texto { display: grid; line-height: 1.2; min-width: 0; }
.marca-texto strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marca-texto small { color: var(--suave); font-size: .78rem; font-weight: 400; }
.quien { color: var(--suave); padding: 0 .4rem; }
.barra-menu { display: none; color: #3b4a54; }
.logo-empresa { flex: none; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #e7f6f2; display: grid; place-items: center; border: 1px solid var(--tarjeta-borde); }
.logo-empresa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo-empresa img[src="icono.svg"] { width: 70%; height: 70%; object-fit: contain; }
.foto-num { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Avatar con foto o iniciales y la insignia de la tienda en la esquina */
.avatar-doble { position: relative; flex: none; display: inline-grid; }
.avatar-doble .avatar { width: 52px; height: 52px; font-size: 1.05rem; box-shadow: inset 0 0 0 1px rgba(11,20,26,.06); }
.avatar-doble.mediano .avatar { width: 44px; height: 44px; font-size: .95rem; }
.avatar-doble.grande .avatar { width: 96px; height: 96px; font-size: 2rem; }
.insignia { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; overflow: hidden; font-size: .56rem; font-weight: 700; color: #1f2d36; line-height: 1; }
.insignia img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-doble.mediano .insignia { width: 19px; height: 19px; font-size: .5rem; }
.avatar-doble.grande .insignia { width: 32px; height: 32px; font-size: .75rem; right: 0; bottom: 0; border-width: 3px; }
.fila.activa .insignia { border-color: #eaf6f2; }

/* Lista: filas más amplias y legibles */
.cuerpo { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); background: #fff; }
.cuerpo.con-ficha { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr) minmax(300px, 340px); }
.lista-titulo { padding: .1rem 0 .2rem; }
.lista-titulo h1 { font-size: 1.45rem; font-weight: 700; }
.lista-botones { display: flex; gap: .2rem; }
.icono-boton.nuevo { background: var(--acento); color: #fff; }
.icono-boton.nuevo:hover { background: var(--acento-hover); }
.fila { min-height: 80px; padding-left: 1rem; }
.fila .nombre { font-size: 1rem; }
.fila-arriba .hora { font-size: .74rem; }
.sin-leer .nombre { font-weight: 700; }
.globo { background: var(--acento); }
.lista-seccion { padding: .5rem 1rem; font-size: .75rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; background: #f7f8f8; }

/* Chat: cabecera clara */
.chat-cabeza { background: #fff; border-bottom: 1px solid var(--tarjeta-borde); }
.chat-persona .avatar-doble .avatar { width: 44px; height: 44px; }
.tel { font-size: .8rem; }
.estado-ventana { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; padding: .2rem .65rem; border-radius: 999px; white-space: nowrap; flex: none; }
.estado-ventana.abierta { background: #e7f6f2; color: #027b5f; }
.estado-ventana.cerrada { background: #fbf0d6; color: #7a5410; }
.icono-boton.resolver { color: #027b5f; }
.icono-boton[aria-pressed="true"] { background: #e7f6f2; color: #027b5f; }
.chat-vacio { max-width: 460px; gap: .6rem; }
.chat-vacio-logo { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: #fff; display: grid; place-items: center; box-shadow: 0 4px 18px rgba(11,20,26,.12); }
.chat-vacio-logo .logo-empresa { width: 100%; height: 100%; border: 0; background: #fff; }
.chat-vacio .grande { font-size: 1.6rem; font-weight: 600; color: #1f2d36; }
.chat-vacio-ayuda { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .5rem; text-align: left; background: rgba(255,255,255,.75); border-radius: 12px; padding: .9rem 1rem; font-size: .9rem; color: #3b4a54; }
.chat-vacio-ayuda li { display: flex; gap: .6rem; align-items: flex-start; }
.chat-vacio-ayuda .ico { margin-top: 3px; color: var(--acento); }

/* Burbujas */
.burbuja { font-size: .95rem; padding: .35rem .6rem .3rem .65rem; }
.burbuja.saliente { background: #d9fdd3; }
.mensajes { padding-inline: clamp(.75rem, 7vw, 5rem); }

/* Escribir: pestañas Responder / Nota interna */
.composer { background: #fff; border-top: 1px solid var(--tarjeta-borde); }
.composer.nota { background: #fffaf0; }
.composer-modo { display: flex; gap: .3rem; margin: 0 0 .45rem; }
.composer-modo .modo { border: 0; background: transparent; padding: .25rem .8rem; border-radius: 999px; cursor: pointer; color: var(--suave); font-size: .85rem; font-weight: 500; }
.composer-modo .modo:hover { background: #f0f2f5; }
.composer-modo .modo[aria-selected="true"] { background: #e7f6f2; color: #027b5f; font-weight: 600; }
.composer-modo .modo.nota[aria-selected="true"] { background: var(--nota); color: #6b5200; }
.caja-texto { background: #f0f2f5; }
.composer.nota .caja-texto { background: #fffdf5; }

/* Ficha del contacto */
.ficha { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; background: #fff; border-left: 1px solid var(--tarjeta-borde); }
.ficha-cabeza { display: flex; align-items: center; justify-content: space-between; padding: .6rem .9rem; border-bottom: 1px solid var(--tarjeta-borde); min-height: 62px; }
.ficha-persona { display: grid; justify-items: center; gap: .3rem; padding: 1.3rem 1rem 1rem; text-align: center; border-bottom: 8px solid #f0f2f5; }
.ficha-persona h2 { margin: .5rem 0 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.ficha-tel { margin: 0 0 .5rem; color: var(--suave); }
.ficha-bloque { padding: .9rem 1rem; border-bottom: 8px solid #f0f2f5; display: grid; gap: .55rem; justify-items: stretch; }
.ficha-bloque:last-child { border-bottom: 0; }
.ficha-bloque h3 { margin: 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); }
.ficha-bloque .ayuda { margin: 0; }
.ficha-bloque select { width: 100%; }
.ficha-datos { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem .8rem; margin: 0; font-size: .9rem; }
.ficha-datos dt { color: var(--suave); }
.ficha-datos dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ficha-datos small { display: block; color: var(--suave); }
.ficha-notas { margin: 0; white-space: pre-wrap; background: var(--nota); border-radius: 8px; padding: .55rem .7rem; font-size: .9rem; }
.acciones-ficha .boton { justify-content: center; }
.boton.peligro { color: var(--mal); border-color: #f1c9c5; }
.boton.peligro:hover { background: #fdecea; }

/* Menú de la barra (móvil) */
.menu-lista { display: grid; gap: .1rem; }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; background: transparent; padding: .6rem .7rem; border-radius: 8px; text-align: left; cursor: pointer; }
.menu-item:hover { background: #f0f2f5; }
.menu-quien { padding: .5rem .7rem; color: var(--suave); font-size: .85rem; border-top: 1px solid var(--linea); margin-top: .3rem; }

/* Perfil de la empresa (página propia) */
.ajustes-perfil { width: min(980px, 100%); }
.ajustes-perfil .bloque-perfil { padding: 1.4rem; }
.ajustes-perfil .bloque-perfil > h2 { font-size: 1.15rem; }
.ajustes-perfil .perfil-columnas { grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; }
.ajustes-perfil .perfil-foto { width: 160px; height: 160px; border: 4px solid #fff; box-shadow: 0 2px 12px rgba(11,20,26,.18); }
.perfil-vista .perfil-tarjeta { border: 1px solid var(--tarjeta-borde); }
.perfil-tarjeta .perfil-foto.pequena { width: 64px; height: 64px; box-shadow: none; border: 0; }

/* Móvil */
@media (max-width: 900px) {
  .barra-menu { display: inline-flex; }
  .barra-derecha .boton, .barra-derecha .quien { display: none; }
  .barra-derecha { margin-left: auto; }
  .barra-menu { margin-left: auto; }
  .barra-derecha:has(~ .barra-menu) { display: none; }
}
@media (max-width: 1179px) {
  /* Sin sitio para tres columnas: la ficha se abre a pantalla completa por encima del chat */
  .cuerpo.con-ficha { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
  .ficha:not([hidden]) { position: fixed; inset: 0; z-index: 40; border-left: 0; }
}
@media (max-width: 760px) {
  .cuerpo, .cuerpo.con-ficha { grid-template-columns: minmax(0, 1fr); }
  .fila { min-height: 78px; }
  .chat-cabeza { background: #fff; }
  .estado-ventana { order: 3; }
  .ajustes-perfil .perfil-columnas { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .ajustes-perfil .perfil-foto { width: 120px; height: 120px; }
  .ficha-persona { padding-top: 1rem; }
}

/* Acciones al pasar por un mensaje: una pastilla flotante con fondo, por encima de la burbuja (antes se pisaban con el texto) */
.burbuja .acciones-extra { top: -15px; right: 62px; z-index: 2; background: #fff; border: 1px solid var(--tarjeta-borde); border-radius: 999px; padding: 2px 4px; box-shadow: 0 2px 8px rgba(11,20,26,.16); white-space: nowrap; }
.burbuja .acciones-extra .mini { font-size: .72rem; padding: 2px 8px; }
.burbuja .responder { top: -13px; right: 4px; z-index: 2; background: #fff; border: 1px solid var(--tarjeta-borde); box-shadow: 0 2px 8px rgba(11,20,26,.16); }
.burbuja .reaccionar { z-index: 2; top: -13px; right: 32px; background: #fff; border: 1px solid var(--tarjeta-borde); box-shadow: 0 2px 8px rgba(11,20,26,.16); }
