/* Wuasalo — hoja de estilos única (sin frameworks, como el guasalo: sobrio) */

/* ---- temas ----
   El oscuro es el de siempre y el de omisión (sin data-tema). Los otros tres
   solo cambian los valores de las variables: --fondo debe coincidir con
   FONDO_TEMA de js/tema.js y con js/tema-inicial.js. */
:root, :root[data-tema="oscuro"] {
  --fondo: #14161a;
  --panel: #1d2026;
  --panel-2: #262a32;
  --borde: #333945;
  --texto: #e8e9ec;
  --texto-suave: #9aa0ac;
  --acento: #2fa376;
  --acento-osc: #25825e;
  --rosa: #e77d9e;
  --peligro: #d05b5b;
  --radio: 14px;
  --sombra: 0 8px 30px rgba(0, 0, 0, 0.35);
  --texto-acento: #ffffff;   /* texto sobre los botones y el contador de no leídos */
  --texto-burbuja: #e8e9ec;  /* texto sobre la burbuja propia */
  --error-texto: #ff9c9c;
  --exito: #59d6a2;          /* precios y estados positivos */
  --toast-fondo: #2c313a;
  --toast-texto: #e8e9ec;
  --borde-suave: rgba(51, 57, 69, 0.5);
  --acento-claro: #35c98d;   /* extremo claro del degradado del anillo de estados */
  --btn-voz: rgba(255, 255, 255, .14); /* botón de play de las notas de voz */
  --oro: #f4b860;            /* estrellas de ventas confirmadas */
  --tarjeta: rgba(0, 0, 0, .18); /* fondo de la tarjeta de un anuncio dentro de la burbuja */
  --estado-entregado: #b3ffcd; /* doble visto: entregado al dispositivo */
  --estado-leido: #b0e7ff;     /* ojo: leído por el destinatario */
  --estado-fallo: #ffc2bd;     /* círculo con signo: error de envío */
}
/* claro: blancos y grises */
:root[data-tema="claro"] {
  --fondo: #f4f6f5;
  --panel: #ffffff;
  --panel-2: #ecefec;
  --borde: #d6dcd9;
  --texto: #1d2026;
  --texto-suave: #566070;
  --acento: #1e7a55;
  --acento-osc: #166244;
  --rosa: #b81f5b;
  --peligro: #c62828;
  --sombra: 0 8px 24px rgba(20, 30, 25, 0.12);
  --texto-acento: #ffffff;
  --texto-burbuja: #ffffff;
  --error-texto: #b3261e;
  --exito: #166244;
  --toast-fondo: #263238;
  --toast-texto: #f4f6f5;
  --borde-suave: rgba(214, 220, 217, 0.9);
  --acento-claro: #3fa77c;
  --btn-voz: rgba(0, 0, 0, 0.08);
  --oro: #7a5200;
  --tarjeta: #ffffff;
  --estado-entregado: #8dffb2;
  --estado-leido: #8ad8ff;
  --estado-fallo: #ffb3ad;
}
/* sky: celeste con azul */
:root[data-tema="sky"] {
  --fondo: #e3f2fd;
  --panel: #ffffff;
  --panel-2: #d8ebfa;
  --borde: #b3d8f3;
  --texto: #0d2a45;
  --texto-suave: #3a5c7a;
  --acento: #1565c0;
  --acento-osc: #0f4f9c;
  --rosa: #b5164f;
  --peligro: #d32f2f;
  --sombra: 0 8px 24px rgba(21, 101, 192, 0.16);
  --texto-acento: #ffffff;
  --texto-burbuja: #ffffff;
  --error-texto: #b3261e;
  --exito: #0f4f9c;
  --toast-fondo: #0d3b66;
  --toast-texto: #e3f2fd;
  --borde-suave: rgba(179, 216, 243, 0.9);
  --acento-claro: #2f86db;
  --btn-voz: rgba(0, 0, 0, 0.08);
  --oro: #7a5200;
  --tarjeta: #ffffff;
  --estado-entregado: #8dffb2;
  --estado-leido: #a5e1ff;
  --estado-fallo: #ffb3ad;
}
/* rosa: rosado con púrpura */
:root[data-tema="rosa"] {
  --fondo: #fdeef5;
  --panel: #ffffff;
  --panel-2: #f9dcea;
  --borde: #efbfd7;
  --texto: #3a1a33;
  --texto-suave: #6e4a63;
  --acento: #7b2cbf;
  --acento-osc: #5e1f97;
  --rosa: #b5164f;
  --peligro: #c62828;
  --sombra: 0 8px 24px rgba(123, 44, 191, 0.16);
  --texto-acento: #ffffff;
  --texto-burbuja: #ffffff;
  --error-texto: #b3261e;
  --exito: #7b2cbf;
  --toast-fondo: #4a148c;
  --toast-texto: #fdeef5;
  --borde-suave: rgba(239, 191, 215, 0.9);
  --acento-claro: #9a5ccc;
  --btn-voz: rgba(0, 0, 0, 0.08);
  --oro: #7a5200;
  --tarjeta: #ffffff;
  --estado-entregado: #7aff9c;
  --estado-leido: #7ad3ff;
  --estado-fallo: #ff9e97;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.45 system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none; /* evita el "tirón" de recarga en móviles */
}
/* Alfabetos con vocales arriba y abajo o trazos altos: más aire entre líneas. */
html:lang(hi) body, html:lang(bn) body, html:lang(th) body, html:lang(ur) body, html:lang(ar) body { line-height: 1.6; }
#app {
  height: 100vh; /* respaldo para navegadores sin dvh */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Las pantallas de formulario se centran cuando caben y se desplazan cuando no */
#app:has(> .caja-form) { overflow-y: auto; }
a { color: var(--acento); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---- arranque ---- */
.arranque { margin: auto; text-align: center; color: var(--texto-suave); }

/* ---- formularios ---- */
.caja-form {
  width: min(400px, 92vw);
  margin: auto;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 28px;
}
.caja-form .logo { display: block; margin: 0 auto 8px; }
.caja-form h1 { text-align: center; font-size: 26px; margin: 0 0 2px; }
.caja-form .eslogan { text-align: center; color: var(--texto-suave); margin: 0 0 18px; font-size: 13px; }
label { display: block; margin: 12px 0 4px; color: var(--texto-suave); font-size: 13px; }
input[type="text"], input[type="password"], input[type="datetime-local"], input[type="number"], input[type="date"], input[type="url"], textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--borde);
  color: var(--texto);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--acento); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--acento); color: var(--texto-acento); border: 0; border-radius: 10px;
  padding: 11px 16px; font-weight: 600; width: 100%; margin-top: 16px;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secundario { background: var(--panel-2); color: var(--texto); border: 1px solid var(--borde); }
.btn.peligro { background: var(--peligro); }
.btn.mini { width: auto; margin: 0; padding: 7px 12px; font-size: 13px; }
.form-pie { text-align: center; margin-top: 14px; font-size: 14px; color: var(--texto-suave); }
.nota { color: var(--texto-suave); font-size: 12.5px; margin: 8px 0 0; }
.error-msg { color: var(--error-texto); background: color-mix(in srgb, var(--peligro) 12%, transparent); border: 1px solid color-mix(in srgb, var(--peligro) 40%, transparent);
  border-radius: 8px; padding: 8px 10px; margin-top: 10px; font-size: 13.5px; display: none; }
.error-msg.visible { display: block; }
/* ---- contraseña con ojo ---- */
.campo-clave { position: relative; }
.campo-clave input { display: block; padding-inline-end: 48px; }
.ojo-clave {
  position: absolute; top: 1px; bottom: 1px; inset-inline-end: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; padding: 0; border: 0; border-start-end-radius: 9px; border-end-end-radius: 9px;
  background: none; color: var(--texto-suave);
}
.ojo-clave svg { display: block; width: 22px; height: 22px; overflow: visible; }
.ojo-clave:hover, .ojo-clave:focus-visible { color: var(--acento); }
/* ---- bandera del país en los perfiles ---- */
.avatar { position: relative; }
/* dentro de un avatar la foto llena el círculo; la bandera es una esquinita */
img.bandera {
  display: inline-block; width: 21px; height: 16px; object-fit: cover; flex: none;
  border-radius: 3px; vertical-align: -3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3);
}
.avatar img.bandera.esquina {
  position: absolute; inset-inline-end: -3px; bottom: -2px; width: 18px; height: 13.5px;
  border-radius: 3px; box-shadow: 0 0 0 2px var(--panel);
}
/* Edge pone su propio ojo en este mismo sitio (y una × cuando el texto se ve): se apartan */
.campo-clave input::-ms-reveal, .campo-clave input::-ms-clear { display: none; }

/* ---- barra superior ---- */
.barra {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border-bottom: 1px solid var(--borde);
  padding: 10px 14px; min-height: 56px; flex-shrink: 0;
}
.barra img { width: 34px; height: 34px; }
.barra .titulo { font-weight: 700; font-size: 17px; }
.barra .sub { color: var(--texto-suave); font-size: 12px; }
.barra .espacio { flex: 1; }
.barra button.icono {
  background: none; border: 0; color: var(--texto); font-size: 20px; padding: 6px 8px; border-radius: 8px;
}
.barra button.icono:hover { background: var(--panel-2); }

/* ---- lista de chats ---- */
.lista-scroll { flex: 1; overflow-y: auto; }
/* Red de seguridad: una sección puesta directamente bajo la barra (sin el
   contenedor que se desplaza) también rueda cuando no cabe. */
#app > .seccion { flex: 1; min-height: 0; overflow-y: auto; }
.chat-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--borde-suave);
  cursor: pointer; user-select: none;
}
.chat-item:hover { background: var(--panel); }
.chat-item .avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: var(--acento); flex-shrink: 0;
}
.chat-item .cuerpo { flex: 1; min-width: 0; }
.chat-item .fila1 { display: flex; justify-content: space-between; gap: 8px; }
.chat-item .nombre { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .hora { color: var(--texto-suave); font-size: 12px; flex-shrink: 0; }
.chat-item .vista { color: var(--texto-suave); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .badge {
  background: var(--acento); color: var(--texto-acento); border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 1px 8px; margin-inline-start: 6px;
}
.chat-item .muerto { font-size: 12px; color: var(--rosa); }
.lista-vacia { text-align: center; color: var(--texto-suave); padding: 48px 20px; }
.lista-vacia img { opacity: 0.7; margin-bottom: 8px; }

/* ---- vista de chat ---- */
.vista-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mensajes { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 2px; }
.burbuja {
  max-width: min(72%, 560px); padding: 8px 12px; border-radius: 16px;
  margin-top: 2px; position: relative; word-wrap: break-word; white-space: pre-wrap;
  animation: pop-burbuja 0.18s ease-out;
}
@keyframes pop-burbuja { from { opacity: 0; transform: translateY(6px) scale(0.96); } }
/* Las esquinas "cola" de las burbujas y su lado se escriben en lógico: así se
   espejan solos en los idiomas de derecha a izquierda. */
.burbuja.in { background: var(--panel-2); align-self: flex-start; border-end-start-radius: 4px; }
.burbuja.out { background: var(--acento-osc); color: var(--texto-burbuja); align-self: flex-end; border-end-end-radius: 4px; }
.burbuja .meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 11px; color: rgba(255,255,255,0.65); margin-top: 2px; }
.burbuja.in .meta { color: var(--texto-suave); }
/* etiqueta de lo que llegó como copia de otro chat */
.burbuja .reenviado { font-size: 12px; font-weight: 600; opacity: 0.85; margin-bottom: 2px; }
/* conversaciones a las que se puede reenviar un mensaje (rueda si son muchas) */
.lista-reenviar { margin: 8px 0 12px; max-height: 46dvh; overflow-y: auto; }
.lista-reenviar:empty { display: none; }
/* Estado de un mensaje propio, junto a la hora: enviándose (círculo punteado que
   gira), enviado al servidor (círculo con visto), entregado al dispositivo (doble
   visto), leído (ojo) y error de envío (círculo con signo). */
.estado-msg { display: inline-flex; flex: none; width: 15px; height: 15px; }
.estado-msg svg { display: block; width: 100%; height: 100%; overflow: visible; }
.estado-msg.enviando { color: rgba(255,255,255,0.7); animation: estado-girar 1.8s linear infinite; }
.estado-msg.enviado { color: rgba(255,255,255,0.82); }
.estado-msg.entregado { width: 18px; height: 12.4px; color: var(--estado-entregado); }
.estado-msg.leido { color: var(--estado-leido); }
.estado-msg.fallo { color: var(--estado-fallo); }
/* en los idiomas de derecha a izquierda los vistos apuntan hacia donde se lee */
[dir="rtl"] .estado-msg.entregado svg { transform: scaleX(-1); }
@keyframes estado-girar { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .estado-msg.enviando { animation: none; } }
.burbuja .de-quien { font-size: 12px; font-weight: 700; color: var(--rosa); margin-bottom: 2px; }
.burbuja img.foto { max-width: 100%; border-radius: 10px; display: block; cursor: zoom-in; }
.burbuja.sistema { align-self: center; background: none; color: var(--texto-suave); font-size: 12.5px; text-align: center; }
.burbuja.programada { outline: 1px dashed var(--rosa); }
.hora-chivo { text-align: center; color: var(--texto-suave); font-size: 12px; margin: 10px 0 4px; }

.compositor {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--borde); flex-shrink: 0;
}
.compositor textarea {
  flex: 1; resize: none; max-height: 132px; min-height: 44px; border-radius: 16px;
  padding: 11px 14px; background: var(--panel-2);
}
.compositor button.enviar {
  background: var(--acento); border: 0; color: #fff; font-size: 18px;
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
}
.compositor button.adj { background: var(--panel-2); border: 1px solid var(--borde); color: var(--texto);
  width: 44px; height: 44px; border-radius: 50%; font-size: 17px; flex-shrink: 0; }
.entrada-oculta { display: none; }
/* Pantalla angosta con muchas herramientas (grupos, amigo): el campo de
   escritura va arriba y ancho; las herramientas, debajo. El ::after es un salto
   de línea entre el botón de enviar y las herramientas. */
.compositor.dos-filas { flex-wrap: wrap; }
.compositor.dos-filas textarea { order: 1; flex: 1 1 50%; }
.compositor.dos-filas button.enviar { order: 2; }
.compositor.dos-filas::after { content: ''; order: 3; flex-basis: 100%; height: 0; }
.compositor.dos-filas button.adj { order: 4; }
/* Un título de conversación lleva su propia dirección (un nombre en árabe se lee
   bien en una app en español, y al revés), pero en una interfaz de derecha a
   izquierda se acomoda junto a su avatar, a la derecha. */
[dir="rtl"] .barra .titulo[dir="auto"], [dir="rtl"] .chat-item .nombre[dir="auto"],
[dir="rtl"] .caja-form .eslogan[dir="auto"], [dir="rtl"] .tarjeta .nota[dir="auto"] { text-align: right; }

/* ---- panel de acciones / modales ---- */
.panel {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 40;
}
@media (min-width: 600px) { .panel { align-items: center; } }
.panel .contenido {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio) var(--radio) 0 0;
  width: min(480px, 100vw); padding: 18px; max-height: 82dvh; overflow-y: auto;
}
@media (min-width: 600px) { .panel .contenido { border-radius: var(--radio); } }
.panel h3 { margin: 4px 0 12px; }
.panel .fila-opciones { display: flex; flex-direction: column; gap: 8px; }
.panel .opciones-ttl { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chip {
  background: var(--panel-2); border: 1px solid var(--borde); color: var(--texto);
  border-radius: 999px; padding: 7px 14px; font-size: 13px;
}
.chip.activo { background: var(--acento); border-color: var(--acento); color: #fff; }

/* ---- ajustes y varios ---- */
.seccion { padding: 16px; max-width: 640px; margin: 0 auto; width: 100%; }
.seccion h2 { font-size: 18px; margin: 22px 0 8px; }
.tarjeta {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 14px 16px; margin-bottom: 10px;
}
.tarjeta .fila { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; align-items: center; padding: 6px 0; }
.codigo {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all;
  background: var(--panel-2); border-radius: 8px; padding: 10px;
}
.tabla-priv { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-priv th, .tabla-priv td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla-priv th { color: var(--texto-suave); font-weight: 600; white-space: nowrap; }

/* ---- toasts ---- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px;
  width: max-content; max-width: calc(100vw - 24px); align-items: center; }
.toast {
  background: var(--toast-fondo); color: var(--toast-texto); border: 1px solid var(--borde);
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--sombra); font-size: 14px;
  max-width: 100%; text-align: center;
  animation: aparecer 0.18s ease-out;
}
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }

/* aviso de versión nueva (web/js/actualizacion.js): fijo arriba, para no tapar el campo de escritura */
.aviso-version {
  position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 65;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px;
  width: max-content; max-width: calc(100vw - 24px);
  background: var(--toast-fondo); color: var(--toast-texto); border: 1px solid var(--borde);
  padding-block: 8px; padding-inline: 16px 8px; border-radius: 18px; box-shadow: var(--sombra); font-size: 13.5px;
  animation: aparecer 0.18s ease-out;
}
.aviso-version .btn { padding-block: 5px; }
.aviso-version-cerrar { background: none; border: 0; color: inherit; opacity: 0.7; font-size: 20px; line-height: 1; padding: 4px 8px; cursor: pointer; }
.aviso-version-cerrar:hover { opacity: 1; }

/* visor de imagen */
.visor-foto { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 70;
  display: flex; align-items: center; justify-content: center; }
.visor-foto img { max-width: 94vw; max-height: 92dvh; }
.spin { display: inline-block; animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ==================== MÓVIL (iPhone / Android) ==================== */
@media (max-width: 480px) {
  .caja-form { width: 100%; max-width: 100%; border-radius: 0; border-inline: 0; padding: 22px 18px; }
  .burbuja { max-width: 86%; }
  .barra { padding: 8px 10px; }
  .seccion { padding: 12px; }
  .compositor { gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .compositor button.adj, .compositor button.enviar { width: 42px; height: 42px; }
  .mensajes { padding: 10px 10px 4px; }
}
/* El logo de bienvenida saluda */
.caja-form .logo { animation: guasalo-saluda 2.6s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes guasalo-saluda { 0%, 100% { transform: rotate(0deg); } 8% { transform: rotate(-6deg); } 16% { transform: rotate(5deg); } 24% { transform: rotate(-3deg); } 30% { transform: rotate(0deg); } }

/* ==================== AVATARES CON FOTO ==================== */
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.grande { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; color: var(--acento); }
/* ajuste de la foto de perfil antes de guardarla (web/js/views/foto-perfil.js):
   se ve en un círculo, como en el perfil, y se arrastra y se acerca */
.ajuste-foto { width: min(260px, 70vw); aspect-ratio: 1; margin: 4px auto 14px; overflow: hidden; border-radius: 50%;
  background: var(--panel-2); border: 2px solid var(--borde); cursor: grab; touch-action: none; }
.ajuste-foto:active { cursor: grabbing; }
.ajuste-foto-imagen { display: block; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.ajuste-foto-zoom { width: 100%; margin: 0 0 14px; accent-color: var(--acento); }

/* ==================== PANEL DE EMOJIS ==================== */
.emoji-panel { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 38dvh; overflow-y: auto; }
.emoji-panel button { background: none; border: 0; font-size: 26px; padding: 6px 0; border-radius: 8px; }
.emoji-panel button:active, .emoji-panel button:hover { background: var(--panel-2); transform: scale(1.18); transition: transform 0.08s; }
.emoji-titulo { color: var(--texto-suave); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin: 8px 0 4px; grid-column: 1 / -1; }

/* ==================== LOGROS ==================== */
.toast-logro {
  background: linear-gradient(135deg, #245f46, #2fa376);
  color: #fff; border: 1px solid #35c98d;
  padding: 12px 20px; border-radius: 14px; box-shadow: var(--sombra);
  font-size: 14.5px; display: flex; gap: 10px; align-items: center;
  animation: logro-entra 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.toast-logro .icono-logro { font-size: 26px; animation: logro-brinca 0.6s ease 0.15s; }
.toast-logro b { display: block; font-size: 15px; }
.toast-logro small { opacity: 0.85; }
@keyframes logro-entra { from { opacity: 0; transform: translateY(18px) scale(0.85); } }
@keyframes logro-brinca { 0%, 100% { transform: none; } 40% { transform: scale(1.35) rotate(-8deg); } 70% { transform: scale(0.95) rotate(4deg); } }

/* Botón enviar con vida */
.compositor button.enviar:active { transform: scale(0.88); }
.compositor button.enviar { transition: transform 0.1s; }

/* ==================== LLAMADAS Y VIDEOLLAMADAS ==================== */
.llamada-fondo { position:fixed; inset:0; background:#0c0e11; color:#e8e9ec; z-index:80; display:flex; flex-direction:column; }
.llamada-fondo.timbrando { animation: timbre-fondo 1.6s ease-in-out infinite; }
@keyframes timbre-fondo { 0%, 100% { background:#0c0e11; } 50% { background:#17211b; } }
.llamada-centro { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; z-index:1; }
.llamada-avatar { width:120px; height:120px; border-radius:50%; background:var(--panel-2); color:var(--acento);
  font-size:52px; font-weight:700; display:flex; align-items:center; justify-content:center;
  animation: logro-brinca 1.8s ease infinite; }
.llamada-fondo:not(.timbrando) .llamada-avatar { animation: none; }
.llamada-nombre { font-size:24px; font-weight:700; }
.llamada-estado { color:var(--texto-suave); font-size:15px; display:flex; gap:10px; }
#llamada-duracion:empty { display:none; }
.llamada-controles { display:flex; gap:22px; justify-content:center; padding:26px 0 calc(34px + env(safe-area-inset-bottom)); }
.btn-llamada { width:64px; height:64px; border-radius:50%; border:0; font-size:26px; cursor:pointer;
  background:var(--panel-2); color:var(--texto); box-shadow:var(--sombra); transition:transform 0.1s; }
.btn-llamada:active { transform: scale(0.9); }
.btn-llamada.colgar { background:#d64b4b; color:#fff; }
.btn-llamada.aceptar { background:var(--acento); color:#fff; animation: logro-brinca 1.4s ease infinite; }

/* ==================== TIRAS DE EFECTOS EN LLAMADA ==================== */
.efectos-tira { position:absolute; inset-inline:0; bottom:118px; z-index:5;
  background:rgba(20,22,26,.92); border-top:1px solid var(--borde);
  padding:12px 16px; display:flex; flex-direction:column; gap:8px;
  animation: aparecer 0.15s ease-out; }
/* la tira de efectos siempre es oscura (va sobre la pantalla de llamada) */
.efectos-titulo { color:#9aa0ac; font-size:12.5px; text-transform:uppercase; letter-spacing:.05em; }
.efectos-tira .opciones-ttl { gap:8px; }
.efectos-tira .chip { font-size:14px; padding:8px 14px; }

/* ==================== NOTAS DE VOZ ==================== */
.btn-voz { width:40px; height:40px; border-radius:50%; border:0; background:var(--btn-voz);
  font-size:18px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.compositor button.enviar.grabando { background:#d64b4b; animation: logro-brinca 1s ease infinite; }

/* ==================== RESPONDER + REACCIONES ==================== */
.respuesta-preview { display:flex; justify-content:space-between; align-items:center; gap:10px;
  background:var(--panel); border-top:1px solid var(--borde); border-inline-start:3px solid var(--acento);
  padding:8px 14px; font-size:13px; }
.cita { border-inline-start:3px solid var(--acento); background:color-mix(in srgb, var(--acento) 8%, transparent); border-radius:6px;
  padding:4px 8px; font-size:12.5px; margin-bottom:4px; color:var(--texto-suave); overflow:hidden; }
.reacciones { display:flex; gap:4px; flex-wrap:wrap; margin-top:3px; }
.chip-reaccion { background:var(--panel); border:1px solid var(--borde); border-radius:999px;
  padding:1px 8px; font-size:13px; }
.ventas-pill { color:var(--oro); font-size:11px; }

/* ==================== MODO MERCADO ==================== */
.tarjeta-anuncio { background:var(--tarjeta); border:1px solid var(--borde); border-radius:12px;
  padding:10px; min-width:200px; display:flex; flex-direction:column; gap:4px; }
.tarjeta-anuncio .pill { align-self:flex-start; }
.tarjeta-anuncio .pill.ok { background:color-mix(in srgb, var(--acento) 18%, transparent); color:var(--exito); padding:1px 10px; border-radius:999px; font-size:12px; }
.tarjeta-anuncio .pill.bad { background:color-mix(in srgb, var(--peligro) 18%, transparent); color:var(--error-texto); padding:1px 10px; border-radius:999px; font-size:12px; text-decoration:line-through; }
.anuncio-precio { color:var(--exito); font-weight:700; }

/* ==================== ESTADOS (24 h) ==================== */
.fila-estados { display:flex; gap:14px; padding:14px 16px 6px; overflow-x:auto; border-bottom:1px solid var(--borde); }
.estado-item { display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer; min-width:56px; user-select:none; }
.estado-item small { color:var(--texto-suave); font-size:11px; max-width:88px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.estado-ring { position:relative; border-radius:50%; padding:2.5px; background:var(--borde); }
.estado-item.tiene .estado-ring { background:linear-gradient(135deg,var(--acento),var(--acento-claro)); }
.estado-mas { position:absolute; inset-inline-end:-2px; bottom:-2px; width:20px; height:20px; border-radius:50%;
  background:var(--acento); color:var(--texto-acento); font-weight:700; font-size:15px; line-height:19px; text-align:center; border:2px solid var(--fondo); }
.estado-barra { position:absolute; top:16px; left:16px; right:16px; height:4px; background:rgba(255,255,255,.25); border-radius:99px; overflow:hidden; }
@keyframes estado-vida { from { width:100%; } to { width:0%; } }
.estado-cab { position:absolute; top:30px; left:18px; right:18px; display:flex; gap:10px; align-items:center; color:#fff; }
.estado-centro { flex:1; display:flex; align-items:center; justify-content:center; padding:80px 16px 40px; }
.estado-texto { font-size:26px; font-weight:600; text-align:center; max-width:640px; white-space:pre-wrap; }

/* Pantalla previa a la llamada (estilo Meet) */
.nivel-medidor { display:flex; align-items:flex-end; gap:3px; height:38px; }
.nivel-barra { width:6px; height:3px; border-radius:3px; background:var(--acento); transition: height .08s ease-out; }
.sel-dispositivo { background:var(--panel-2); border:1px solid var(--borde); color:var(--texto);
  border-radius:10px; padding:8px 10px; font:13px inherit; max-width:240px; }

/* ---- 🔒 Bloqueo de la app (estilo iPhone) ---- */
.bloqueo-fondo {
  position: fixed; inset: 0; z-index: 30000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: max(20px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #0b0d10 0%, #141821 55%, #10131a 100%);
  color: #fff; text-align: center;
  animation: bloqueo-entra .35s ease;
  overflow-y: auto;
}
.bloqueo-fondo.saliendo { animation: bloqueo-sale .25s ease forwards; }
@keyframes bloqueo-entra { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@keyframes bloqueo-sale { to { opacity: 0; } }
.bloqueo-reloj { font-size: clamp(52px, 14vw, 76px); font-weight: 200; letter-spacing: 2px; line-height: 1; }
/* la pantalla de bloqueo es oscura en todos los temas: sus textos suaves van fijos */
/* (la fecha lleva la mayúscula solo al principio, puesta desde el código: en
   varios idiomas el mes va en minúscula y el nombre del día ya viene formateado) */
.bloqueo-fecha { color: #9aa0ac; font-size: 14px; margin-bottom: 6px; }
.bloqueo-titulo { font-size: 16px; color: #e7ebf0; margin: 4px 0 2px; }
.bloqueo-zona { display: flex; flex-direction: column; align-items: center; }
.bloqueo-puntos { display: flex; gap: 15px; height: 15px; margin: 10px 0 6px; }
.bloqueo-punto { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid #98a0ab; transition: background .12s, transform .12s; }
.bloqueo-punto.lleno { background: var(--acento); border-color: var(--acento); transform: scale(1.12); }
.teclado { display: grid; grid-template-columns: repeat(3, minmax(64px, 78px)); gap: 13px; justify-content: center; margin-top: 10px; }
.tecla {
  width: min(78px, 19vw); height: min(78px, 19vw); border-radius: 50%;
  background: rgba(255, 255, 255, .07); border: none; color: #fff;
  font-size: 25px; font-family: inherit; cursor: pointer;
  transition: transform .07s, background .18s; -webkit-tap-highlight-color: transparent;
}
.tecla:active { transform: scale(1.14); background: rgba(255, 255, 255, .25); }
.tecla.simbolo { background: transparent; font-size: 22px; }
.bloqueo-input {
  width: min(300px, 78vw); padding: 13px 16px; border-radius: 12px; font-size: 17px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; outline: none; text-align: center;
}
.bloqueo-input:focus { border-color: var(--acento); }
.bloqueo-fila-clave { display: flex; gap: 8px; align-items: center; justify-content: center; }
.bloqueo-error { color: #ff9d9d; font-size: 13.5px; min-height: 20px; margin-top: 8px; }
.sacudir { animation: sacudir .45s; }
@keyframes sacudir { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-11px); } 40%, 80% { transform: translateX(11px); } }
.bloqueo-bio {
  width: 74px; height: 74px; border-radius: 50%; font-size: 34px; cursor: pointer;
  background: rgba(255, 255, 255, .07); border: 1.5px solid var(--acento); color: #fff;
  transition: transform .08s, background .2s;
}
.bloqueo-bio:active { transform: scale(1.1); background: rgba(255, 255, 255, .2); }
.bloqueo-nota { color: #9aa0ac; font-size: 12.5px; margin-top: 4px; }
.bloqueo-extras { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 12px; }
.bloqueo-olvide { background: none; border: none; color: #9aa0ac; font-size: 13.5px; text-decoration: underline; cursor: pointer; padding: 4px; }
.medidor { display: flex; gap: 6px; width: 100%; }

/* ==================== IDIOMAS ==================== */
/* Flechas que apuntan a un lado (volver, enviar, continuar): en los idiomas de
   derecha a izquierda se espejan. */
[dir="rtl"] .flecha { display: inline-block; transform: scaleX(-1); }
/* El árabe y el urdu unen sus letras: las mayúsculas forzadas y el espaciado
   extra las despegan. */
[dir="rtl"] .emoji-titulo, [dir="rtl"] .efectos-titulo { text-transform: none; letter-spacing: 0; }
[dir="rtl"] .bloqueo-reloj { letter-spacing: 0; }
[dir="rtl"] .bloqueo-fecha { text-transform: none; }

/* ==================== AJUSTES: TEMA, IDIOMA Y MONEDA ==================== */
.temas { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px; }
.tema-opcion {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--panel-2); border: 2px solid var(--borde); border-radius: 12px;
  padding: 8px 10px; min-width: 76px; color: var(--texto); font-size: 12.5px; cursor: pointer;
}
.tema-opcion.activo { border-color: var(--acento); }
.tema-muestra { display: flex; gap: 4px; width: 56px; height: 34px; border-radius: 8px; border: 2px solid; padding: 5px; }
.tema-muestra i { display: block; flex: 1; border-radius: 4px; }
.sel-ajustes { margin-top: 8px; }

/* ==================== TRADUCCIÓN DE MENSAJES ==================== */
/* El texto traducido va debajo del original, separado por una línea fina y
   con su etiqueta. El original se lee más pequeño mientras se muestra. */
.burbuja .texto-original { font-size: 12.5px; opacity: 0.72; }
.burbuja .traduccion {
  margin-top: 6px; padding-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere;
  border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.burbuja .traduccion-etiqueta { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; opacity: 0.85; }
.burbuja .traduccion.pendiente, .burbuja .traduccion.fallo { font-size: 12.5px; opacity: 0.7; font-style: italic; }
/* con la traducción automática apagada: se dice debajo del mensaje, y «Traducir»
   y «Encenderla» son enlaces dentro del propio mensaje */
.burbuja .traduccion.apagada { font-size: 12.5px; opacity: 0.9; }
.burbuja .traduccion.apagada .enlace {
  background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 700;
  color: var(--acento); text-decoration: underline; cursor: pointer;
}

/* ==================== VIDEOS CIFRADOS ==================== */
/* El video de una burbuja: los propios se ven al momento; los recibidos se
   descifran al tocar y el reproductor toma su lugar. */
.video-caja { max-width: min(260px, 100%); }
.video-msg { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px; background: #000; }
.btn-video {
  display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 14px; border: 0; border-radius: 10px;
  background: rgba(0, 0, 0, 0.28); color: inherit; font: inherit; cursor: pointer;
}
.btn-video:disabled { opacity: 0.6; }
.btn-video-icono { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); font-size: 14px; }
.btn-video-duracion { font-size: 13px; font-variant-numeric: tabular-nums; opacity: 0.85; }
/* la hoja de «Adjuntar»: una opción por renglón */
.lista-adjuntar { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.lista-adjuntar .btn { margin: 0; }

/* ---- pantalla de grabación ---- */
.grabador { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; display: flex; flex-direction: column; }
.grabador .icono { color: #fff; }
.grabador-barra { display: flex; justify-content: space-between; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); }
.grabador-zona { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.grabador-vista { width: 100%; max-height: 100%; object-fit: contain; background: #000; }
.grabador-reloj {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-size: 15px; font-variant-numeric: tabular-nums; background: rgba(0, 0, 0, 0.55); padding: 4px 14px; border-radius: 999px;
}
.grabador-acciones { display: flex; gap: 12px; justify-content: center; align-items: center; padding: 10px; }
.grabador-acciones:last-child { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.grabador .nota { color: rgba(255, 255, 255, 0.75); }
.grabador-boton {
  width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.grabador-boton span { display: block; width: 56px; height: 56px; border-radius: 50%; background: var(--peligro); transition: all 0.2s; }
.grabador-boton.grabando span { width: 28px; height: 28px; border-radius: 6px; }
.grabador .btn.secundario { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ==================== TARJETAS EJECUTABLES ==================== */
/* Una tarjeta (cita, pedido, cotización, tarea o pago) necesita más sitio que
   un texto: la burbuja se ensancha en lo que dé el teléfono. */
.burbuja.con-tarjeta { max-width: min(92%, 420px); }
.tarjeta-ejec {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px;
  padding: 10px 12px; margin: 4px 0 2px; min-width: 210px; white-space: normal;
}
.tarjeta-ejec-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.tarjeta-ejec-tipo { font-weight: 700; opacity: 0.8; }
.tarjeta-estado { padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tarjeta-estado.ok { background: color-mix(in srgb, var(--exito) 20%, transparent); color: var(--exito); }
.tarjeta-estado.info { background: color-mix(in srgb, var(--oro) 22%, transparent); color: var(--oro); }
.tarjeta-estado.pendiente { background: color-mix(in srgb, var(--texto) 14%, transparent); color: inherit; }
.tarjeta-estado.malo { background: color-mix(in srgb, var(--peligro) 26%, transparent); color: var(--error-texto); }
.tarjeta-ejec-titulo { font-size: 15px; font-weight: 700; margin: 4px 0 6px; overflow-wrap: anywhere; }
.tarjeta-ejec.vencida .tarjeta-ejec-titulo { text-decoration: line-through; opacity: 0.8; }
.tarjeta-fila { display: flex; gap: 8px; font-size: 13.5px; margin-top: 3px; }
.tarjeta-fila-etiqueta { flex: none; opacity: 0.65; }
.tarjeta-partidas { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 4px 0 2px; }
.tarjeta-partidas td { padding: 2px 0; vertical-align: top; }
.tarjeta-cantidad { text-align: center; opacity: 0.7; white-space: nowrap; padding-inline: 8px; }
.tarjeta-importe { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tarjeta-total {
  display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-top: 4px;
  padding-top: 5px; border-top: 1px solid var(--borde); font-variant-numeric: tabular-nums;
}
.tarjeta-monto { color: var(--exito); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* dentro de la burbuja las notas siguen el color de la burbuja, más suave */
.tarjeta-ejec .nota { color: inherit; opacity: 0.82; overflow-wrap: anywhere; }
.tarjeta-aviso { font-style: italic; }
.tarjeta-aviso.fallo { color: var(--error-texto); opacity: 1; }
.tarjeta-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
/* el botón se distingue también sobre la burbuja propia (verde sobre verde) */
.tarjeta-acciones .btn { border: 1px solid color-mix(in srgb, var(--texto) 30%, transparent); }
.tarjeta-ejec > .btn { margin-top: 6px; }

/* formulario de la tarjeta nueva */
.tarjeta-form { display: grid; gap: 2px; }
.tarjeta-form label { margin: 10px 0 0; }
.tarjeta-etiqueta { color: var(--texto-suave); font-size: 13px; margin: 12px 0 2px; }
.tarjeta-form .opciones-ttl { margin: 6px 0; }
.tarjeta-partidas-form { display: grid; gap: 6px; }
.tarjeta-partida { display: grid; grid-template-columns: minmax(0, 1fr) 58px 96px 28px; gap: 6px; align-items: center; }
.tarjeta-partida .icono {
  background: none; border: 0; color: var(--texto-suave); font-size: 15px;
  padding: 4px 0; cursor: pointer;
}
.tarjeta-form .btn.secundario.mini { margin-top: 8px; }
.tarjeta-form .tarjeta-total { margin-top: 10px; }
.tarjeta-form > .btn { margin-top: 16px; }
.panel textarea { margin-top: 6px; min-height: 70px; resize: vertical; }
/* el círculo de «Mi estado» en la lista de chats: mismo aspecto que los avatares */
.estado-ring .avatar {
  border-radius: 50%; background: var(--panel-2); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: var(--acento);
}

/* ==================== MINIAPLICACIONES ==================== */
/* Una miniapp ocupa toda la pantalla bajo la barra; lo de dentro es suyo. */
.vista-miniapp { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.marco-miniapp { flex: 1; width: 100%; border: 0; background: var(--fondo); }
.barra .avatar-miniapp {
  width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--acento);
}
.lista-miniapps { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.miniapp-item {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: start;
  background: none; border: 0; border-radius: 12px; padding: 8px 10px; cursor: pointer;
  color: var(--texto); font: inherit;
}
.miniapp-item:hover { background: var(--panel-2); }
.miniapp-item .avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--panel-2); flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--acento);
}
.miniapp-item .cuerpo { flex: 1; min-width: 0; }
.miniapp-item .nombre { font-weight: 600; }
.miniapp-item .vista { color: var(--texto-suave); font-size: 13px; }
.tarjeta-miniapp {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px;
  padding: 10px 12px; margin: 4px 0 2px; min-width: 200px; white-space: normal;
}
.tarjeta-miniapp-cab { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; opacity: 0.85; }
.tarjeta-miniapp .nota { color: inherit; opacity: 0.82; overflow-wrap: anywhere; }
.tarjeta-miniapp > .btn { margin-top: 6px; border: 1px solid color-mix(in srgb, var(--texto) 30%, transparent); }
