/* Entrada */
.entrada { width: 100%; height: 100%; overflow: auto; display: grid; place-items: center; padding: 20px; background: var(--fondo); }
.entrada-caja { width: min(100%, 380px); background: var(--superficie); border-radius: 18px; padding: 28px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 2px 14px rgba(0, 0, 0, .08); }
.logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 4px; }
.logo-icono { width: 48px; height: 48px; border-radius: 14px; background: var(--marca); color: #fff; display: grid; place-items: center; }
.logo-nombre { font-size: 26px; font-weight: 700; color: var(--marca-texto); }
.entrada h1 { font-size: 20px; text-align: center; }
.campo-telefono { display: flex; flex-wrap: wrap; gap: 8px; }
.campo-telefono > .campo:not(.pais-btn) { flex: 1; min-width: 0; }
.pais-btn { display: flex; align-items: center; gap: 6px; width: auto; flex: none; padding-left: 10px; padding-right: 8px; cursor: pointer; }
.pais-btn .flecha { color: var(--texto2); font-size: 12px; }
.bandera { font-size: 22px; line-height: 1; }
.msg-campo { flex-basis: 100%; font-size: 13px; color: var(--texto2); }
.msg-campo:empty { display: none; }
.msg-campo.error { color: var(--error, #c0392b); }
.lista-paises { max-height: 52vh; overflow: auto; margin: 8px -14px 0; }
.lista-paises .fila-chat:disabled { opacity: .55; cursor: default; }
.etiqueta { font-size: 12px; color: var(--texto2); border: 1px solid var(--borde, #ccc); border-radius: 10px; padding: 1px 8px; }
.campo.codigo { text-align: center; font-size: 28px; letter-spacing: .4em; font-variant-numeric: tabular-nums; }
.fila-atras { display: flex; align-items: center; gap: 6px; margin: -8px 0 -4px -8px; }

/* Lista */
.vista-lista { display: flex; flex-direction: column; min-height: 0; flex: 1; position: relative; }
.buscador-caja { display: flex; align-items: center; gap: 8px; margin: 8px 12px 4px; padding: 0 12px; background: var(--superficie2); border-radius: 10px; color: var(--texto2); }
.buscador { border: 0 !important; background: transparent !important; padding-left: 0; }
.pestanas { display: flex; padding: 4px 4px 0; border-bottom: 1px solid var(--borde); overflow-x: auto; flex: none; }
.pestana { flex: 1; justify-content: center; border: 0; background: transparent; padding: 10px 4px; font-size: 14px; font-weight: 600; color: var(--texto2); border-bottom: 3px solid transparent; display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.pestana.activa { color: var(--marca-texto); border-color: var(--marca); }
.lista-chats { flex: 1; overflow-y: auto; min-height: 0; }
.fila-chat { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; background: transparent; text-align: left; color: inherit; }
.fila-chat:hover, .fila-chat.activa { background: var(--marca-suave); }
.fila-chat.estatica { cursor: default; }
.fila-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fila-1, .fila-2 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.fila-nombre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-hora { font-size: 12px; color: var(--texto2); flex: none; }
.fila-hora.nuevo { color: var(--marca-texto); font-weight: 600; }
.fila-ultimo { color: var(--texto2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; min-width: 0; }
.fila-ultimo.escr { color: var(--marca-texto); font-style: italic; }
.ic-circulo { width: 44px; height: 44px; border-radius: 50%; background: var(--marca-suave); color: var(--marca); display: grid; place-items: center; flex: none; }
.fab { position: absolute; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--marca); color: #fff; display: grid; place-items: center; box-shadow: var(--sombra); }

/* Conversación */
.vista-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cabecera.chat { padding-left: 4px; }
.cab-quien { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 4px 6px; border-radius: 10px; }
.cab-textos { display: flex; flex-direction: column; min-width: 0; }
.cab-nombre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cab-sub { font-size: 12.5px; color: var(--texto2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cab-sub.escr { color: var(--marca-texto); }
.mensajes { flex: 1; overflow-y: auto; min-height: 0; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.mensajes > .burbuja + .burbuja { margin-top: 0; }
.dia { align-self: center; font-size: 12px; color: var(--texto2); background: var(--superficie); padding: 3px 12px; border-radius: 999px; margin: 8px 0; }
.pie-chat { flex: none; background: var(--superficie); border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom); }
.compositor { display: flex; align-items: flex-end; gap: 4px; padding: 8px; }
.campo-msg { flex: 1; resize: none; border: 1px solid var(--borde); border-radius: 20px; padding: 9px 14px; font: inherit; background: var(--superficie2); color: var(--texto); max-height: 140px; min-height: 40px; line-height: 1.35; }
.campo-msg:focus { outline: 2px solid var(--marca); outline-offset: -1px; border-color: transparent; }
.ib.enviar { background: var(--marca); color: #fff; }
.ib.enviar:hover:not(:disabled) { background: var(--marca); filter: brightness(1.1); }
.previa { display: flex; align-items: center; gap: 10px; padding: 8px 8px 0 14px; }
.previa-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; border-left: 3px solid var(--marca); padding-left: 8px; }
.previa-texto span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texto2); }
.previa.adj img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.previa progress { width: 100%; accent-color: var(--marca); }
.barra-aviso { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; color: var(--texto2); font-size: 14px; }
.panel-vacio { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--texto2); }
.panel-vacio p { font-size: 22px; font-weight: 700; color: var(--marca); }
@media (max-width: 819px) { .panel-vacio { display: none; } }

/* Pantallas secundarias */
.vista-capa { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.capa-cuerpo { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.capa-cuerpo.sin-pad { padding: 0; gap: 0; }
.capa-cuerpo .fila-chat, .capa-cuerpo .fila-accion { margin: 0 -16px; width: calc(100% + 32px); }
.capa-cuerpo.sin-pad .fila-chat { margin: 0; width: 100%; }
.pad { padding: 12px 16px; }
.capa-pie { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); }
.subtitulo { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--texto2); margin-top: 8px; }
.etiq { font-size: 13px; color: var(--texto2); margin-bottom: -6px; }
.fila-busca { display: flex; gap: 8px; align-items: stretch; }
.fila-busca .campo-telefono { flex: 1; min-width: 0; }
.ficha { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 12px; text-align: center; }
.foto-perfil { align-self: center; position: relative; }
.foto-btn { position: absolute; right: -6px; bottom: -6px; background: var(--marca) !important; color: #fff; border: 3px solid var(--superficie) !important; }
.lista-sel { display: flex; flex-direction: column; }
.fila-sel { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--borde); }
.fila-sel .fila-nombre { flex: 1; }
.fila-sel input { accent-color: var(--marca); width: 20px; height: 20px; }
.selector { display: flex; flex-direction: column; gap: 10px; }

/* Perfil ampliado */
.seccion { display: flex; flex-direction: column; gap: 10px; }
.foto-bloque { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fila-botones.centrada { justify-content: center; }
.grupo-campo { display: flex; flex-direction: column; gap: 6px; }
.campo.invalido { border-color: var(--error); }
.msg-campo { color: var(--error); font-size: 13px; }
.quien { display: flex; align-items: center; gap: 8px; color: var(--texto2); }
.quien .campo { width: auto; min-height: 36px; padding: 6px 10px; margin-left: auto; }
.tarjetas-uso { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tarjeta-uso { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border: 2px solid var(--borde); border-radius: 14px; background: var(--superficie2); color: var(--texto2); text-align: center; }
.tarjeta-uso strong { color: var(--texto); }
.tarjeta-uso.activa { border-color: var(--marca); background: var(--marca-suave); color: var(--marca-texto); }
.tarjeta-neg { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px; border: 1px solid var(--borde); border-radius: 12px; background: var(--superficie2); }
.ins-neg { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.ins-neg.ok { background: var(--ok-fondo); color: var(--marca-texto); }
.ins-neg.rev { background: var(--superficie); border: 1px solid var(--borde); color: var(--texto2); }
.fila-ins { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--borde); background: var(--superficie2); color: var(--texto); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pasos { display: flex; gap: 6px; }
.paso { flex: 1; height: 4px; border-radius: 2px; background: var(--borde); }
.paso.hecho { background: var(--marca); }
.pasos-pie { justify-content: space-between; }
.resumen { display: flex; flex-direction: column; border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; }
.fila-res { display: flex; flex-direction: column; padding: 8px 12px; border-bottom: 1px solid var(--borde); word-break: break-word; }
.fila-res:last-child { border-bottom: 0; }
.ficha-nombre { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ficha-neg { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.desc-neg { white-space: pre-wrap; word-break: break-word; }
.dato { display: flex; align-items: flex-start; gap: 10px; color: var(--texto); word-break: break-word; }
.dato svg { flex: none; margin-top: 2px; color: var(--texto2); }
.dato a { color: var(--marca-texto); }
.dato-tel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dato-tel a.btn { color: #fff; text-decoration: none; }
.previa-foto { width: 240px; height: 240px; max-width: 100%; object-fit: cover; border-radius: 16px; align-self: center; }
.franja-perfil { display: flex; align-items: center; background: var(--marca-suave); border-bottom: 1px solid var(--borde); padding-right: 4px; }
.franja-btn { flex: 1; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--marca-texto); font-weight: 600; padding: 8px 14px; text-align: left; }
.franja-btn span { flex: 1; }
.franja-btn .adelante { transform: rotate(180deg); }
.filtros-dir { display: flex; flex-direction: column; gap: 8px; }
.fila-filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fila-chat.dir { cursor: default; }
.ib-avatar, .fila-btn { border: 0; background: transparent; padding: 0; color: inherit; text-align: left; }
.fila-btn { align-items: flex-start; }
.aviso-prueba { font-weight: 600; }
.pasos-pie { justify-content: flex-end; }
.pasos-pie .btn:last-child { margin-left: auto; }
.btn.sec.txt-peligro { color: var(--error); }
.btn-aparte { align-self: flex-start; }

/* Reingreso */
.bienvenida { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.bienvenida h1 { font-size: 20px; }
.lista-disp { display: flex; flex-direction: column; gap: 8px; }
.fila-disp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 12px; background: var(--superficie2); }
.ayuda-btn { width: 24px; height: 24px; border: 1px solid var(--borde); font-size: 13px; font-weight: 700; color: var(--texto2); vertical-align: middle; }

/* ===== Navegación inferior ===== */
.barra-nav { display: flex; flex: none; background: var(--superficie); border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom); }
.nav-item { flex: 1; min-width: 0; border: 0; background: transparent; padding: 7px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--texto2); }
.nav-item.activa { color: var(--marca-texto); }
.nav-ic { position: relative; display: grid; place-items: center; width: 52px; height: 28px; border-radius: 14px; }
.nav-item.activa .nav-ic { background: var(--marca-suave); }
.nav-ic .insignia { position: absolute; top: -4px; right: 2px; min-width: 17px; height: 17px; font-size: 11px; padding: 0 4px; }
.nav-txt { font-size: 11.5px; font-weight: 600; }
.vista-lista .fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
.fila-1 { justify-content: flex-start; }
.fila-1 .fila-hora { margin-left: auto; }
.fila-1 .fila-nombre { flex: 0 1 auto; }
.ins-mini { display: inline-flex; align-items: center; gap: 2px; color: var(--marca-texto); flex: none; }

/* ===== Conversación ===== */
:root { --patron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180' fill='none' stroke='%2300756E' stroke-opacity='0.14' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='rotate(-10 27 27)'%3E%3Crect x='14' y='17' width='28' height='20' rx='3'/%3E%3Cpath d='M14 20l14 10 14-10'/%3E%3C/g%3E%3Cg transform='rotate(8 112 32)'%3E%3Cpath d='M98 18h28a5 5 0 0 1 5 5v14a5 5 0 0 1-5 5h-15l-8 7v-7h-5a5 5 0 0 1-5-5V23a5 5 0 0 1 5-5z'/%3E%3Cpath d='M104 27h20M104 33h12'/%3E%3C/g%3E%3Cg transform='rotate(25 40 118)'%3E%3Cpath d='M58 100L40 118a6 6 0 0 0 8.5 8.5L68 107a9 9 0 0 0-12.7-12.7L36 113'/%3E%3C/g%3E%3Cg transform='rotate(-6 124 120)'%3E%3Cpath d='M104 112a24 24 0 0 1 40 0M111 119a14 14 0 0 1 26 0'/%3E%3Ccircle cx='124' cy='127' r='1.6'/%3E%3C/g%3E%3Cg transform='rotate(12 160 80)'%3E%3Cpath d='M160 66v26M152 74a10 10 0 0 1 16 0M148 70a16 16 0 0 1 24 0'/%3E%3C/g%3E%3Ccircle cx='76' cy='60' r='1.6'/%3E%3Ccircle cx='16' cy='84' r='1.6'/%3E%3Ccircle cx='88' cy='160' r='1.6'/%3E%3Cpath d='M150 150l6 6M156 150l-6 6'/%3E%3C/svg%3E"); }
:root[data-tema="oscuro"] { --patron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180' fill='none' stroke='%237fd6cc' stroke-opacity='0.10' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='rotate(-10 27 27)'%3E%3Crect x='14' y='17' width='28' height='20' rx='3'/%3E%3Cpath d='M14 20l14 10 14-10'/%3E%3C/g%3E%3Cg transform='rotate(8 112 32)'%3E%3Cpath d='M98 18h28a5 5 0 0 1 5 5v14a5 5 0 0 1-5 5h-15l-8 7v-7h-5a5 5 0 0 1-5-5V23a5 5 0 0 1 5-5z'/%3E%3Cpath d='M104 27h20M104 33h12'/%3E%3C/g%3E%3Cg transform='rotate(25 40 118)'%3E%3Cpath d='M58 100L40 118a6 6 0 0 0 8.5 8.5L68 107a9 9 0 0 0-12.7-12.7L36 113'/%3E%3C/g%3E%3Cg transform='rotate(-6 124 120)'%3E%3Cpath d='M104 112a24 24 0 0 1 40 0M111 119a14 14 0 0 1 26 0'/%3E%3Ccircle cx='124' cy='127' r='1.6'/%3E%3C/g%3E%3Cg transform='rotate(12 160 80)'%3E%3Cpath d='M160 66v26M152 74a10 10 0 0 1 16 0M148 70a16 16 0 0 1 24 0'/%3E%3C/g%3E%3Ccircle cx='76' cy='60' r='1.6'/%3E%3Ccircle cx='16' cy='84' r='1.6'/%3E%3Ccircle cx='88' cy='160' r='1.6'/%3E%3Cpath d='M150 150l6 6M156 150l-6 6'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) { --patron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180' fill='none' stroke='%237fd6cc' stroke-opacity='0.10' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='rotate(-10 27 27)'%3E%3Crect x='14' y='17' width='28' height='20' rx='3'/%3E%3Cpath d='M14 20l14 10 14-10'/%3E%3C/g%3E%3Cg transform='rotate(8 112 32)'%3E%3Cpath d='M98 18h28a5 5 0 0 1 5 5v14a5 5 0 0 1-5 5h-15l-8 7v-7h-5a5 5 0 0 1-5-5V23a5 5 0 0 1 5-5z'/%3E%3Cpath d='M104 27h20M104 33h12'/%3E%3C/g%3E%3Cg transform='rotate(25 40 118)'%3E%3Cpath d='M58 100L40 118a6 6 0 0 0 8.5 8.5L68 107a9 9 0 0 0-12.7-12.7L36 113'/%3E%3C/g%3E%3Cg transform='rotate(-6 124 120)'%3E%3Cpath d='M104 112a24 24 0 0 1 40 0M111 119a14 14 0 0 1 26 0'/%3E%3Ccircle cx='124' cy='127' r='1.6'/%3E%3C/g%3E%3Cg transform='rotate(12 160 80)'%3E%3Cpath d='M160 66v26M152 74a10 10 0 0 1 16 0M148 70a16 16 0 0 1 24 0'/%3E%3C/g%3E%3Ccircle cx='76' cy='60' r='1.6'/%3E%3Ccircle cx='16' cy='84' r='1.6'/%3E%3Ccircle cx='88' cy='160' r='1.6'/%3E%3Cpath d='M150 150l6 6M156 150l-6 6'/%3E%3C/svg%3E"); } }
.mensajes { background: var(--fondo-chat) var(--patron); background-size: 180px 180px; gap: 0; padding: 10px 10px 8px; }
.vista-chat .cabecera.chat { min-height: 48px; padding-top: 3px; padding-bottom: 3px; }
.cab-nombre { display: flex; align-items: center; gap: 4px; }
.cab-sub { font-size: 12px; line-height: 1.2; }
.burbuja { display: block; width: fit-content; max-width: min(80%, 520px); padding: 4px 9px 4px; margin-top: 6px; border-radius: 12px; line-height: 1.32; }
.mensajes > .burbuja { align-self: flex-start; }
.mensajes > .burbuja.mia { align-self: flex-end; }
.burbuja.seguida { margin-top: 1.5px; }
.burbuja.otra.seguida { border-top-left-radius: 12px; }
.burbuja.mia.seguida { border-top-right-radius: 12px; }
.burbuja > * + * { margin-top: 2px; }
.burbuja .texto-msg { display: inline; }
.burbuja .texto-msg::after { content: ''; display: inline-block; width: 46px; }
.burbuja.mia .texto-msg::after { width: 64px; }
.burbuja .pie-msg { position: absolute; right: 8px; bottom: 3px; margin: 0; font-size: 10.5px; line-height: 1; }
.burbuja.sin-texto .pie-msg { position: static; display: flex; justify-content: flex-end; margin-top: 2px; }
.burbuja.sin-texto { padding-bottom: 3px; }
.burbuja .cita, .burbuja .adj-img, .burbuja .adj-arch { display: flex; }
.burbuja .adj-img { min-width: 0; min-height: 0; width: fit-content; max-width: 100%; margin-top: 2px; }
.adj-img img { width: auto; height: auto; max-width: min(240px, 100%); max-height: 260px; object-fit: contain; }
.burbuja .adj-arch { min-width: 180px; }
.campo-msg { max-height: 122px; overflow-y: auto; }
.compositor { padding: 6px 8px; }
.cab-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
