/* ==========================================================================
   Moshi — mensajería privada con su gatito cartero
   Tema claro y plano: riel de iconos · columna de chats · conversación.
   Identidad: naranja (estructura y acento) sobre blanco, rojo collar para
   contadores y PING. Burbujas propias en naranja suave, ajenas en blanco.
   (Las variables conservan sus nombres antiguos: --marino, --oro, --vino.)
   ========================================================================== */
:root, [data-bs-theme="light"] {
  /* paleta "Moshi", sacada del logo del gatito */
  --marino: #ee8a4f;          /* naranja suave y cálido: estructura y botones */
  --marino-2: #df7638;
  --marino-rgb: 238, 138, 79;
  --oro: #f5a46a;             /* melocotón: acento */
  --oro-claro: #fde3cc;
  --oro-rgb: 245, 164, 106;
  --vino: #e8452c;            /* rojo collar: contadores y PING */
  --vino-rgb: 232, 69, 44;
  --miel: #ffc23d;            /* cascabel */
  --verde: #2fa36b;
  --peligro: #c0392b;

  --fondo: #fff6ee;           /* detrás de todo */
  --panel: #ffffff;
  --panel-2: #fffaf6;
  --panel-3: #fff0e2;
  --chat-fondo: #ffffff;      /* zona de mensajes */
  --mio: #fde6d3;             /* mis burbujas: naranja suave */
  --suyo: #ffffff;
  --borde: #f8e6d6;
  --borde-fuerte: #f1d2b6;
  --texto: #3a2415;
  --tenue: #96705a;
  --sombra: 0 1px 2px rgba(180, 80, 10, .06), 0 1px 3px rgba(180, 80, 10, .08);
  --sombra-alta: 0 12px 32px -8px rgba(180, 80, 10, .22);
  --tarjeta-sombra: 0 1px 2px rgba(180, 80, 10, .05), 0 8px 24px -10px rgba(180, 80, 10, .18);
  /* tonos por zona */
  --tono-cabecera: #fff3e6;
  --tono-buscador: #fff8f0;
  --tono-lista: #ffffff;
  --tono-lista-hover: #fff3e7;
  --tono-lista-activa: #ffe6cf;
  --tono-lista-linea: #f9ebdd;
  --tono-pie: #fff0e0;
  --tono-redactor: #fff9f3;
  --linea-zona: #f6dfc8;
  /* detalles que también cambian con el tema */
  --grad-a: #f8b47c; --grad-b: #ee8a4f;    /* avatares */
  --grupo-b: #e69a2e;                      /* avatar de grupo (con --miel) */
  --suyo-2: #fff3e8;                       /* burbujas ajenas en escritorio */
  --recibo-fondo: #ffe2c4; --recibo-texto: #b85e2a;
  --apagado: #ecd3bf; --placeholder: #b59d91; --scroll: #f5c9a3;
  --alto-barra: 60px;
  --alto-tabs: 62px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --bs-body-bg: var(--fondo);
  --bs-body-color: var(--texto);
  --bs-secondary-color: var(--tenue);
  --bs-border-color: var(--borde);
  --bs-link-color-rgb: 196, 98, 42;
  --bs-link-hover-color-rgb: 238, 138, 79;
  --fuente-ping: "Bungee", "Arial Black", Impact, sans-serif;
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body { min-height: 100%; }
body { -webkit-font-smoothing: antialiased; font-size: .95rem; }
body.con-sesion { background: var(--fondo); }
::selection { background: rgba(var(--oro-rgb), .3); }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.015em; color: var(--marino); }
.titulo-marca { color: var(--marino); }
.text-secondary { color: var(--tenue) !important; }
.min-w-0 { min-width: 0; }
.etiqueta { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tenue); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
*::-webkit-scrollbar { width: 7px; }
*::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 7px; }
.marca { font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; color: var(--marino); text-decoration: none; }
.marca:hover { color: var(--marino); }

/* ==========================================================================
   Estructura
   ========================================================================== */
.app { min-height: 100dvh; }
.contenedor { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 1.5rem; }
.solo-escritorio { display: none; }
.riel, .lateral { display: none; }

/* --- móvil (por defecto) --- */
.principal { background: var(--panel-2); min-height: 100dvh; }
.barra {
  position: sticky; top: 0; z-index: 1030; height: var(--alto-barra); display: flex; align-items: center; gap: .5rem;
  padding: 0 1rem; background: var(--marino); color: #fff;
}
.barra .marca { color: #fff; }
.barra .btn-redondo { color: #fff; }
.barra .btn-redondo:hover { background: rgba(255, 255, 255, .12); }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; display: flex;
  background: var(--panel); border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem .25rem .55rem;
  color: var(--tenue); text-decoration: none; font-weight: 600; font-size: .7rem; position: relative;
}
.tab i { font-size: 1.3rem; }
.tab.activa { color: var(--marino); }
.tab.activa i { color: var(--oro); }
.tab .pastilla { position: absolute; top: .3rem; left: calc(50% + .5rem); }
body.con-sesion .contenedor { padding-bottom: calc(var(--alto-tabs) + 1.25rem + env(safe-area-inset-bottom)); }
body.en-inicio .contenedor { padding: 0 0 calc(var(--alto-tabs) + env(safe-area-inset-bottom)); max-width: none; }
/* en una conversación el móvil se usa a pantalla completa */
body.en-chat .tabs, body.en-chat .principal .barra { display: none; }
body.en-chat .contenedor { padding: 0; max-width: none; }

/* --- escritorio: riel + columna de chats + panel --- */
@media (min-width: 900px) {
  body.con-sesion { padding: 0; }
  .app { display: grid; grid-template-columns: 64px minmax(320px, 400px) 1fr; height: 100dvh; overflow: hidden; }
  .riel {
    display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .8rem 0 1rem;
    background: var(--marino); color: #c8d0e0;
  }
  .lateral { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--borde); }
  .principal { min-height: 0; height: 100dvh; overflow-y: auto; background: var(--panel-2); }
  .principal .barra, .tabs { display: none; }
  .solo-movil { display: none; }
  .solo-escritorio { display: block; }
  .contenedor { max-width: 800px; padding: 1.75rem 2rem; }
  body.con-sesion .contenedor { padding-bottom: 1.75rem; }
  body.en-chat .principal { overflow: hidden; }
  body.en-chat .contenedor, body.en-inicio .contenedor { padding: 0; max-width: none; height: 100%; }

  /* cada sección es una tarjeta separada sobre el fondo */
  body.con-sesion {
    background:
      radial-gradient(900px 420px at 0% 0%, rgba(var(--marino-rgb), .07), transparent 70%),
      radial-gradient(700px 380px at 100% 100%, rgba(var(--oro-rgb), .1), transparent 70%),
      var(--fondo);
  }
  .app { padding: 14px; gap: 14px; }
  .riel, .lateral, .principal { border-radius: 18px; box-shadow: var(--tarjeta-sombra); }
  .riel { background: linear-gradient(180deg, var(--marino-2), var(--marino)); }
  .riel-boton.activo::before { left: -10px; }
  .lateral { border: 1px solid var(--borde); overflow: hidden; }
  .principal { height: auto; border: 1px solid var(--borde); }
  body.en-chat .principal, body.en-inicio .principal { overflow: hidden; }
  .lateral-cabecera { border-bottom: 0; }
}
@media (min-width: 1400px) { .app { padding: 18px; gap: 18px; } }

/* ---------- botones ---------- */
.btn { border-radius: 10px; font-weight: 600; }
.btn-acento { background: var(--marino); color: #fff; border: 0; }
.btn-acento:hover, .btn-acento:focus { background: var(--marino-2); color: #fff; }
.btn-acento:disabled { opacity: .55; color: #fff; background: var(--marino); }
.btn-fantasma { background: var(--panel); border: 1px solid var(--borde-fuerte); color: var(--texto); }
.btn-fantasma:hover { background: var(--panel-2); border-color: var(--borde-fuerte); color: var(--texto); }
.btn-icono { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; flex-shrink: 0; }
.btn-sm.btn-icono { width: 36px; height: 36px; }
.btn-redondo {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; color: var(--tenue);
  display: inline-grid; place-items: center; font-size: 1.15rem; text-decoration: none; flex-shrink: 0; transition: .15s;
}
.btn-redondo:hover { background: var(--panel-3); color: var(--marino); }
.btn-nuevo { background: var(--marino); color: #fff; }
.btn-nuevo:hover { background: var(--marino-2); color: #fff; }
.btn-ping {
  font-family: var(--fuente-ping); font-weight: 400; letter-spacing: .05em; font-size: .75rem; padding: .35rem .75rem; border-radius: 999px;
  color: var(--vino); background: rgba(var(--vino-rgb), .08); border: 1px solid rgba(var(--vino-rgb), .3);
}
.btn-ping:hover { color: #fff; background: var(--vino); border-color: var(--vino); }

.campana .contador {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--vino); color: #fff; font-size: .62rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--marino);
}
.campana.sonando i { animation: campana .8s ease; }
@keyframes campana { 0%,100% { transform: rotate(0) } 20% { transform: rotate(18deg) } 40% { transform: rotate(-14deg) } 60% { transform: rotate(8deg) } 80% { transform: rotate(-4deg) } }

/* ---------- formularios ---------- */
.form-control, .form-select { background: var(--panel); border: 1px solid var(--borde-fuerte); color: var(--texto); border-radius: 10px; padding: .6rem .85rem; }
.form-control::placeholder { color: var(--placeholder); }
.form-control:focus, .form-select:focus { border-color: var(--marino-2); box-shadow: 0 0 0 3px rgba(var(--marino-rgb), .12); }
.form-check-input:checked { background-color: var(--marino); border-color: var(--marino); }
.form-label { color: var(--tenue); font-weight: 500; }
.campo-icono { position: relative; }
.campo-icono > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--tenue); pointer-events: none; z-index: 1; }
.campo-icono > .form-control { padding-left: 2.5rem; }

/* ---------- tarjetas, acceso y avisos ---------- */
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: 16px; box-shadow: var(--sombra-alta); }
body.sin-sesion { background: linear-gradient(180deg, var(--marino) 0, var(--marino) 230px, var(--fondo) 230px); min-height: 100dvh; }
.acceso { max-width: 410px; margin: 9vh auto 0; }
.emblema {
  width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 1rem; display: grid; place-items: center; font-size: 1.6rem;
  background: var(--marino); color: var(--oro-claro);
}
.acceso h1 { font-size: 1.6rem; }
.alerta { border-radius: 10px; border: 1px solid; padding: .6rem .85rem; font-size: .88rem; margin-bottom: 1rem; }
.alerta-error { background: #fdf0f2; border-color: #f5c2cc; color: #9b1c36; }
.alerta-ok { background: #effaf3; border-color: #bfe8cf; color: #17663d; }
/* login: separador "o" antes de "Entrar con huella o cara" (se oculta si el navegador no admite passkeys) */
.o-bien { display: flex; align-items: center; gap: .75rem; margin: 1rem 0; color: var(--bs-secondary-color); font-size: .8rem; }
.o-bien::before, .o-bien::after { content: ""; flex: 1; border-top: 1px solid rgba(90, 42, 32, .15); }
.o-bien:has(+ [hidden]) { display: none; }
.icono-app { border-radius: 10px; box-shadow: 0 1px 3px rgba(90, 42, 32, .25); flex-shrink: 0; }
#app-estado { color: #17663d; }
#entrar-passkey .bi-fingerprint, .passkey-icono { color: var(--oro); font-size: 1.15rem; vertical-align: -2px; }
.contenedor > .alerta { box-shadow: var(--sombra); }
.bienvenida {
  height: 100%; display: flex !important; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 2rem; background: var(--panel-2); border-bottom: 6px solid var(--oro); position: relative;
}
.redactor-zona .panel { margin: -.55rem -.9rem .55rem; }
.bienvenida h1 { font-size: 1.9rem; font-weight: 300; color: var(--texto); margin-bottom: .6rem; }
.cifrado { position: absolute; bottom: 2rem; font-size: .8rem; color: var(--tenue); }
@media (max-width: 899px) { .bienvenida { display: none !important; } }

/* ---------- avatares y presencia ---------- */
.avatar {
  --tam: 48px; width: var(--tam); height: var(--tam); border-radius: 50%; flex-shrink: 0; position: relative;
  display: inline-grid; place-items: center; font-weight: 700; font-size: calc(var(--tam) * .38); color: #fff;
  background: linear-gradient(135deg, var(--marino-2), var(--marino));
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.chico { --tam: 36px; }
.avatar.grande { --tam: 128px; box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--oro), var(--sombra-alta); }
.avatar.apagado { background: var(--apagado); color: #fff; }
.avatar::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; border-radius: 50%;
  background: var(--verde); border: 2.5px solid var(--panel); transform: scale(0); transition: transform .25s;
}
.avatar.en-linea::after { transform: scale(1); }
.estado { font-size: .8rem; color: var(--tenue); }
.estado.en-linea { color: var(--verde); font-weight: 600; }
.frase { font-size: .82rem; color: var(--tenue); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- listas ---------- */
.seccion { display: flex; align-items: center; justify-content: space-between; margin: 1.6rem .2rem .55rem; }
.seccion:first-child { margin-top: .2rem; }
.lista { background: var(--panel); border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; box-shadow: var(--sombra); }
.fila {
  display: flex; align-items: center; gap: .9rem; padding: .7rem 1rem; color: var(--texto); text-decoration: none;
  background: none; border: 0; width: 100%; text-align: left; transition: background .12s; position: relative;
}
.fila > .flex-grow-1 { padding: .1rem 0; }
.lista > .fila:not([hidden]) ~ .fila:not([hidden]) > .flex-grow-1,
.lista > form:not([hidden]) ~ form:not([hidden]) .fila > .flex-grow-1,
.lista > div.fila ~ div.fila > .flex-grow-1 { box-shadow: 0 -1px 0 var(--borde); }
a.fila:hover, button.fila:hover { background: var(--panel-2); color: var(--texto); }
.fila.activa { background: var(--panel-3); }
.fila .nombre { font-weight: 600; color: var(--texto); }
.fila .meta { font-size: .74rem; color: var(--tenue); white-space: nowrap; }
.fila .vista { font-size: .86rem; color: var(--tenue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila.sin-leer .vista { color: var(--texto); font-weight: 600; }
.fila.sin-leer .meta { color: var(--vino); font-weight: 700; }
.fila .flecha { color: var(--tenue); opacity: 0; transition: .15s; }
.fila:hover .flecha { opacity: 1; color: var(--marino); }
.pastilla {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: .7rem; font-weight: 700; line-height: 1;
  background: var(--vino); color: #fff; display: inline-grid; place-items: center;
}
.personas { max-height: 480px; overflow-y: auto; }
.solicitudes .fila { background: var(--tono-buscador); }
.vacio { padding: 2.4rem 1.2rem; text-align: center; color: var(--tenue); font-size: .9rem; }
.vacio i { font-size: 1.9rem; display: block; margin-bottom: .5rem; color: var(--oro); }
.vacio > .gatito-cara { display: block; margin: 0 auto .6rem; }
.vacio > .gatitos-fila { margin-bottom: .8rem; }

/* gatitos (etiqueta {% gatito %}): fila que salta por turnos, y uno que flota */
.gatitos-fila { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.gatitos-fila .gatito-cara { flex-shrink: 1; min-width: 0; height: auto; animation: gatito-salta 3.4s ease-in-out infinite; }
.gatitos-fila .gatito-cara:nth-child(2) { animation-delay: .4s; }
.gatitos-fila .gatito-cara:nth-child(3) { animation-delay: .8s; }
.gatitos-fila .gatito-cara:nth-child(4) { animation-delay: 1.2s; }
.gatitos-fila .gatito-cara:nth-child(5) { animation-delay: 1.6s; }
@keyframes gatito-salta { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-8px); } 90% { transform: translateY(0); } }
.gatito-cara.flota { animation: gatito-flota 3.2s ease-in-out infinite; }
@keyframes gatito-flota { 50% { transform: translateY(-6px) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .gatitos-fila .gatito-cara, .gatito-cara.flota { animation: none; } }
/* login y registro: los gatitos se sientan en el borde de la tarjeta */
.acceso-gatos { max-width: 410px; margin: 7vh auto -14px; position: relative; z-index: 1; padding: 0 1rem; }
.acceso.con-gatos { margin-top: 0; }
.bienvenida-gatos { margin: 1.6rem 0 .4rem; }
.pagina-error { text-align: center; padding: 10vh 1rem 4rem; }
.pagina-error h1 { font-size: 1.6rem; margin: 1rem 0 .4rem; }
.pagina-error p { color: var(--tenue); margin-bottom: 1.4rem; }

/* ---------- PIN ---------- */
.pin-codigo { font-family: var(--mono); font-size: 2rem; font-weight: 800; letter-spacing: .16em; line-height: 1.15; color: var(--marino); }
.pin-campo { font-family: var(--mono); font-size: 1.1rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.pin-campo::placeholder { letter-spacing: .02em; font-family: var(--bs-font-sans-serif); font-weight: 400; text-transform: none; }
.agregar-pin { position: relative; padding: 1.15rem; border-radius: 12px; background: var(--panel); border: 1px solid var(--borde); border-top: 3px solid var(--oro); box-shadow: var(--sombra); }

/* ---------- perfil ---------- */
.perfil-cabecera {
  position: relative; overflow: hidden; text-align: center; padding: 2.2rem 1.2rem 1.6rem; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--borde); box-shadow: var(--sombra);
}
.perfil-cabecera::before { content: ""; position: absolute; inset: 0 0 auto; height: 96px; background: linear-gradient(120deg, var(--marino), var(--marino-2)); }
.perfil-cabecera > * { position: relative; }
.perfil-foto { position: relative; display: inline-block; }
.perfil-foto .cambiar {
  position: absolute; right: 4px; bottom: 4px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--oro); color: #fff; border: 3px solid var(--panel); cursor: pointer; transition: transform .15s;
}
.perfil-foto .cambiar:hover { transform: scale(1.08); }
.perfil-nombre { font-size: 1.5rem; font-weight: 700; color: var(--marino); margin-top: 1rem; }
.bloque { background: var(--panel); border: 1px solid var(--borde); border-radius: 12px; padding: 1.1rem; box-shadow: var(--sombra); }

/* ==========================================================================
   Conversación: barra de cabecera · mensajes · barra de escribir
   ========================================================================== */
.chat { display: flex; flex-direction: column; height: 100dvh; background: var(--chat-fondo); position: relative; }
@media (min-width: 900px) { .chat { height: 100%; } }
.chat-cabecera {
  height: var(--alto-barra); flex-shrink: 0; display: flex; align-items: center; gap: .75rem; padding: 0 .9rem;
  background: var(--panel-2); border-bottom: 1px solid var(--borde); z-index: 2;
}
.chat-cabecera .nombre { font-weight: 600; font-size: 1rem; line-height: 1.2; color: var(--texto); }
.chat-cabecera .avatar { --tam: 40px; }
.chat-cabecera .btn-fantasma { border: 0; background: none; }
.chat-cabecera .btn-fantasma:hover, .menu[open] > summary { background: var(--panel-3); }
@media (min-width: 900px) { .chat-cabecera .volver { display: none; } }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-opciones {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 1040; min-width: 240px; padding: .4rem 0;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; box-shadow: var(--sombra-alta); animation: entra .12s ease-out;
}
.menu-opciones button {
  width: 100%; display: flex; align-items: center; gap: .7rem; padding: .6rem 1.1rem; border: 0;
  background: none; color: var(--texto); font-size: .9rem; text-align: left;
}
.menu-opciones button:hover { background: var(--panel-2); }
.menu-opciones button i { color: var(--tenue); width: 1.1rem; }
.menu-opciones button.peligro, .menu-opciones button.peligro i { color: var(--peligro); }

.mensajes {
  flex: 1; overflow-y: auto; padding: 1.2rem 6%; display: flex; flex-direction: column; gap: .2rem;
  background-color: var(--chat-fondo);
  /* trama propia muy sutil: rombos */
  background-image:
    linear-gradient(45deg, rgba(var(--marino-rgb), .025) 25%, transparent 25%, transparent 75%, rgba(var(--marino-rgb), .025) 75%),
    linear-gradient(45deg, rgba(var(--marino-rgb), .025) 25%, transparent 25%, transparent 75%, rgba(var(--marino-rgb), .025) 75%);
  background-size: 28px 28px; background-position: 0 0, 14px 14px;
}
@media (max-width: 576px) { .mensajes { padding: .9rem .7rem; } }
.burbuja {
  max-width: min(68%, 560px); padding: .38rem .55rem .25rem .65rem; border-radius: 8px; position: relative;
  overflow-wrap: anywhere; line-height: 1.38; box-shadow: 0 1px .5px rgba(16, 24, 40, .13); animation: entra .15s ease-out;
  font-size: .93rem; margin-top: .25rem;
}
@keyframes entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.burbuja.mio { align-self: flex-end; background: var(--mio); color: var(--texto); border-top-right-radius: 2px; }
.burbuja.suyo { align-self: flex-start; background: var(--suyo); color: var(--texto); border-top-left-radius: 2px; }
.burbuja .texto-msg { white-space: pre-wrap; }
.burbuja .hora { font-size: .68rem; color: var(--tenue); margin-top: .1rem; display: flex; justify-content: flex-end; align-items: center; gap: .3rem; }
.recibo { font-size: .58rem; font-weight: 800; line-height: 1; padding: .12rem .26rem; border-radius: 3px; background: var(--recibo-fondo); color: var(--recibo-texto); }
.recibo.r { background: var(--marino); color: #fff; }
.burbuja .borrar { border: 0; background: none; color: var(--tenue); opacity: 0; font-size: .72rem; padding: 0 0 0 .1rem; transition: opacity .15s; }
.burbuja:hover .borrar, .burbuja .borrar:focus { opacity: 1; }
@media (hover: none) { .burbuja .borrar { opacity: .7; } }
.burbuja.ping { background: linear-gradient(135deg, var(--vino), var(--marino)); color: #fff; padding: .45rem .8rem .3rem; }
.burbuja.ping > div:not(.hora):not(.autor) { font-family: var(--fuente-ping); font-weight: 400; font-size: 1.05rem; letter-spacing: .06em; text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.burbuja.ping .hora { color: rgba(255, 255, 255, .8); }
.burbuja.ping .recibo { background: rgba(255, 255, 255, .25); color: #fff; }
.burbuja.ping .recibo.r { background: #fff; color: var(--vino); }
.sacudir { animation: sacudir .55s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes sacudir {
  10%, 90% { transform: translate3d(-2px, 0, 0); } 20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 0, 0); } 40%, 60% { transform: translate3d(7px, 0, 0); }
}
.foto { position: relative; cursor: pointer; overflow: hidden; border-radius: 6px; margin: .1rem 0 .25rem; }
.foto img, .foto video { max-width: 100%; max-height: 360px; display: block; transition: filter .25s; }
.foto.oculta img, .foto.oculta video { filter: blur(28px) brightness(.7); }
.foto.oculta::after { content: "Toca para ver"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: .88rem; }
.burbuja .audio { width: 280px; max-width: 100%; display: block; margin: .15rem 0 .2rem; height: 40px; }

.redactor-zona { flex-shrink: 0; background: var(--panel-2); border-top: 1px solid var(--borde); padding: .55rem .9rem calc(.55rem + env(safe-area-inset-bottom)); }
.redactor { display: flex; align-items: flex-end; gap: .2rem; }
.redactor .form-control { background: var(--panel); border: 0; border-radius: 10px; padding: .62rem .9rem; box-shadow: none; margin: 0 .3rem; }
/* caja de texto grande: crece con lo que escribes (hasta ~6 líneas) y luego hace scroll */
.redactor .caja-texto {
  resize: none; min-height: 48px; max-height: 168px; overflow-y: hidden; display: block;
  font-size: 1rem; line-height: 1.45; padding: .72rem 1rem; border-radius: 14px;
}
.redactor .caja-texto.desborda { overflow-y: auto; }
.redactor > .adjuntar, .redactor > .btn-acento, .redactor > label.adjuntar { margin-bottom: 4px; flex-shrink: 0; }
.redactor > .contador-texto { margin-bottom: 15px; }
.redactor .adjuntar { color: var(--tenue); border: 0; background: none; border-radius: 50%; width: 40px; height: 40px; font-size: 1.2rem; display: inline-grid; place-items: center; cursor: pointer; }
.redactor .adjuntar:hover { color: var(--marino); background: var(--panel-3); }
.redactor .adjuntar.activo { color: var(--marino); background: var(--panel-3); }
.redactor .btn-acento { border-radius: 50%; width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0; }
.gif-boton { font-size: .7rem !important; font-weight: 800; letter-spacing: .03em; }
@media (max-width: 420px) { .redactor .solo-ancho { display: none; } }
.adjunto { font-size: .76rem; color: var(--tenue); padding: .15rem .5rem 0; }
.adjunto { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.adjunto-item { position: relative; display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .35rem; border-radius: 8px; background: var(--panel-3); }
.adjunto-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; display: block; }
.adjunto-quitar { border: 0; background: var(--vino); color: #fff; width: 20px; height: 20px; border-radius: 50%; font-size: .65rem; line-height: 1; padding: 0; flex-shrink: 0; }
.adjunto-item:has(img) .adjunto-quitar { position: absolute; top: -6px; right: -6px; }
.adjunto-pista { font-weight: 600; color: var(--marino); }
/* contador de caracteres (límite 500) */
.contador-texto { font-size: .72rem; font-weight: 600; color: var(--tenue); min-width: 1.8rem; text-align: right; flex-shrink: 0; }
.contador-texto.lleno { color: var(--vino); }
/* nota de voz */
#btn-grabar.grabando { color: #fff !important; background: var(--vino) !important; animation: latido 1s ease-in-out infinite; }
@keyframes latido { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--vino-rgb), .45); } 50% { box-shadow: 0 0 0 7px rgba(var(--vino-rgb), 0); } }
.grabando-punto { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--vino); vertical-align: middle; animation: parpadeo 1s steps(2, jump-none) infinite; }
@keyframes parpadeo { from { opacity: 1; } to { opacity: .2; } }
.grabando-cancelar { border: 0; background: none; padding: 0; color: var(--vino); font-weight: 600; text-decoration: underline; font-size: inherit; }
.adjunto:empty { display: none; }
.aviso-bloqueo { text-align: center; color: var(--tenue); font-size: .85rem; padding: 1rem; background: var(--panel-2); border-top: 1px solid var(--borde); }

.panel { padding: .7rem .9rem; background: var(--panel); border-top: 1px solid var(--borde); animation: entra .15s ease-out; }
.panel-pestanas { display: flex; gap: .25rem; padding-bottom: .45rem; margin-bottom: .45rem; border-bottom: 1px solid var(--borde); }
.panel-pestanas button { border: 0; background: none; font-size: 1.15rem; padding: .25rem .55rem; border-radius: 8px; opacity: .5; }
.panel-pestanas button:hover { opacity: .9; background: var(--panel-2); }
.panel-pestanas button.activo { opacity: 1; box-shadow: inset 0 -3px 0 var(--oro); border-radius: 0; }
.emoji-rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); max-height: 220px; overflow-y: auto; }
.emoji-rejilla button { border: 0; background: none; font-size: 1.5rem; line-height: 1; padding: .35rem 0; border-radius: 8px; transition: transform .1s, background .1s; }
.emoji-rejilla button:hover { background: var(--panel-2); transform: scale(1.15); }

/* ---------- avisos emergentes ---------- */
.avisos { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 1080; display: flex; flex-direction: column; gap: .5rem; width: min(360px, calc(100vw - 2rem)); }
@media (max-width: 899px) { .avisos { top: calc(var(--alto-barra) + .5rem); bottom: auto; right: .75rem; } }
.aviso {
  display: flex; gap: .8rem; align-items: center; padding: .75rem .9rem; text-decoration: none; color: var(--texto);
  background: var(--panel); border: 1px solid var(--borde); border-left: 4px solid var(--oro); border-radius: 10px;
  box-shadow: var(--sombra-alta); animation: aviso-entra .25s ease-out;
}
.aviso:hover { color: var(--texto); background: var(--panel-2); }
.aviso.sale { animation: aviso-sale .25s ease-in forwards; }
.aviso .cuerpo { min-width: 0; flex: 1; }
.aviso .de { font-weight: 700; font-size: .88rem; color: var(--marino); }
.aviso .txt { font-size: .82rem; color: var(--tenue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes aviso-entra { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes aviso-sale { to { opacity: 0; transform: translateX(30px); } }

@media (max-width: 576px) { .burbuja { max-width: 85%; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.riel-logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: .8rem;
  background: linear-gradient(135deg, #fbc89a, var(--oro)); color: var(--marino); font-size: 1.15rem; text-decoration: none;
}
.riel-boton {
  position: relative; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: rgba(255, 255, 255, .78); font-size: 1.25rem; text-decoration: none; border: 0; background: none; transition: .15s;
}
.riel-boton:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.riel-boton.activo { background: rgba(255, 255, 255, .24); color: #fff; }
.riel-boton.activo::before { content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #fff; }
.riel-boton .pastilla { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: .62rem; border: 2px solid var(--marino); }
.riel-yo { margin-top: .4rem; border-radius: 50%; }
.riel-yo .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.riel-yo.activo .avatar, .riel-yo:hover .avatar { box-shadow: 0 0 0 2px var(--oro); }

.lateral-cabecera { height: var(--alto-barra); flex-shrink: 0; display: flex; align-items: center; gap: .5rem; padding: 0 1rem 0 1.1rem; }
.lateral .bloque-chats { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lateral .lista-chats { flex: 1; overflow-y: auto; border: 0; border-radius: 0; box-shadow: none; }
.lateral-pin {
  flex-shrink: 0; display: flex; align-items: center; gap: .55rem; padding: .8rem 1.1rem; font-size: .85rem;
  border-top: 1px solid var(--borde); background: var(--panel-2); color: var(--tenue); text-decoration: none;
}
.lateral-pin:hover { color: var(--marino); background: var(--panel-3); }
.lateral-pin i { color: var(--oro); }
.pin-chico { font-family: var(--mono); letter-spacing: .1em; color: var(--marino); }

/* buscador + filtros */
.buscador-chats { padding: .1rem 1rem .6rem; background: var(--panel); flex-shrink: 0; }
.buscar-chat { background: var(--panel) !important; box-shadow: inset 0 0 0 1px var(--linea-zona); border: 0 !important; border-radius: 10px !important; padding-top: .55rem !important; padding-bottom: .55rem !important; }
.buscar-chat:focus { box-shadow: 0 0 0 2px rgba(var(--marino-rgb), .3) !important; background: var(--panel) !important; }
.chips { display: flex; gap: .4rem; margin-top: .6rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--borde-fuerte); background: var(--panel); color: var(--tenue); border-radius: 999px;
  padding: .28rem .8rem; font-size: .8rem; font-weight: 600; transition: .15s;
}
.chip:hover { background: var(--panel-2); color: var(--texto); }
.chip.activo { background: rgba(var(--marino-rgb), .08); border-color: rgba(var(--marino-rgb), .25); color: var(--marino); }
/* móvil: buscador y lista como dos tarjetas */
.solo-movil .bloque-chats { padding: .8rem .8rem 0; }
.solo-movil .buscador-chats { padding: .8rem; border-radius: 14px; border: 1px solid var(--borde); box-shadow: var(--tarjeta-sombra); margin-bottom: .7rem; }
.solo-movil .lista-chats { border-radius: 14px; box-shadow: var(--tarjeta-sombra); }

/* ---------- tonos por zona ---------- */
.lateral { background: var(--tono-lista); }
.lateral-cabecera { background: var(--tono-cabecera); border-bottom: 1px solid var(--linea-zona); }
.lateral .buscador-chats { background: var(--tono-buscador); border-bottom: 1px solid var(--linea-zona); padding-top: .75rem; }
.lateral .buscar-chat { background: var(--panel) !important; box-shadow: inset 0 0 0 1px var(--linea-zona); }
.lateral .chip { background: var(--panel); }
.lateral .chip.activo { background: var(--marino); border-color: var(--marino); color: #fff; }
.lateral .lista-chats { background: var(--tono-lista); }
.lateral-pin { background: var(--tono-pie); border-top: 1px solid var(--borde); color: var(--tenue); }
.lateral-pin:hover { background: var(--panel-3); color: var(--marino); }
.chat-cabecera { background: var(--tono-cabecera); border-bottom: 1px solid var(--linea-zona); }
.chat-cabecera .btn-fantasma:hover, .menu[open] > summary { background: rgba(var(--marino-rgb), .08); }
.redactor-zona { background: var(--tono-redactor); border-top: 1px solid var(--linea-zona); }
.redactor .form-control { box-shadow: inset 0 0 0 1px var(--linea-zona); }
.redactor .adjuntar:hover, .redactor .adjuntar.activo { background: rgba(var(--marino-rgb), .08); }
.aviso-bloqueo { background: var(--tono-redactor); border-top-color: var(--linea-zona); }
.redactor-zona .panel { background: var(--panel); border-bottom: 1px solid var(--linea-zona); }
/* móvil */
.solo-movil .buscador-chats { background: var(--tono-buscador); border-color: var(--linea-zona); }
.solo-movil .buscador-chats .buscar-chat { background: var(--panel) !important; box-shadow: inset 0 0 0 1px var(--linea-zona); }
.solo-movil .chip { background: var(--panel); }
.solo-movil .chip.activo { background: var(--marino); border-color: var(--marino); color: #fff; }

/* lista de chats en marfil (escritorio y móvil) */
.lista-chats { background: var(--tono-lista) !important; }
.lista-chats a.fila:hover { background: var(--tono-lista-hover); }
.lista-chats .fila.activa { background: var(--tono-lista-activa); box-shadow: inset 3px 0 0 var(--oro); }
.lista-chats > .fila:not([hidden]) ~ .fila:not([hidden]) > .flex-grow-1 { box-shadow: 0 -1px 0 var(--tono-lista-linea); }
.lista-chats .avatar::after { border-color: var(--tono-lista); }
.lateral { background: var(--tono-lista); }
.solo-movil .lista-chats { border-color: var(--tono-lista-linea); }

/* ==========================================================================
   Escritorio estilo "espacio de trabajo": barra superior oscura de lado a lado,
   columna de chats en azul noche con texto claro y panel de trabajo blanco.
   ========================================================================== */
.superior { display: none; }
@media (min-width: 900px) {
  :root {
    --noche: #ee8a4f; --noche-2: #ffffff; --noche-3: #ffe6cf;
    --noche-texto: #fff3e8; --noche-tenue: #ffd9bb; --noche-linea: rgba(255, 255, 255, .18);
  }
  body.con-sesion { background: linear-gradient(90deg, var(--marino), var(--oro)); }
  .app { grid-template-columns: 68px 310px 1fr; grid-template-rows: 54px minmax(0, 1fr); padding: 0; gap: 0; }
  .riel, .lateral, .principal { border-radius: 0; box-shadow: none; border: 0; }
  .principal { height: auto; background: var(--panel); }

  /* barra superior */
  .superior {
    display: flex; grid-column: 1 / -1; align-items: center; gap: .6rem; padding: 0 1rem 0 .85rem;
    background: var(--noche); color: #fff; border-bottom: 1px solid var(--noche-linea);
  }
  .superior-marca { display: flex; align-items: center; gap: .65rem; width: 362px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
  .superior-marca:hover { color: #fff; }
  .superior-logo {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem;
    background: linear-gradient(135deg, #fbc89a, var(--oro)); color: var(--noche);
  }
  .superior-buscar { position: relative; flex: 0 1 620px; margin: 0 auto 0 0; }
  .superior-buscar i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--tenue); pointer-events: none; z-index: 1; }
  .buscar-global {
    width: 100%; height: 36px; padding: 0 .9rem 0 2.3rem; border-radius: 8px; outline: 0;
    background: var(--panel); border: 1px solid var(--panel); color: var(--texto); font-size: .9rem; box-shadow: 0 1px 3px rgba(150, 70, 20, .12);
  }
  .buscar-global::placeholder { color: var(--placeholder); }
  .buscar-global:focus { background: var(--panel); border-color: var(--panel); box-shadow: 0 0 0 3px rgba(255, 255, 255, .45); }
  .superior .btn-redondo { width: 36px; height: 36px; color: var(--noche-texto); font-size: 1.1rem; }
  .superior .btn-redondo:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .superior .campana .contador { border-color: var(--noche); }
  .superior-yo { margin-left: .3rem; border-radius: 50%; }
  .superior-yo .avatar { --tam: 34px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .2); }
  .superior-yo .avatar::after { border-color: var(--noche); }
  .superior-yo:hover .avatar, .superior-yo.activo .avatar { box-shadow: 0 0 0 2px var(--oro); }

  /* riel: solo secciones (el logo, la campana y el perfil están arriba) */
  .riel { background: var(--noche); padding-top: .9rem; border-right: 1px solid var(--noche-linea); }
  .riel-logo, .riel .campana, .riel-yo { display: none; }
  .riel-boton.activo::before { left: -12px; }
  .riel-boton .pastilla { border-color: var(--noche); }

  /* columna de chats en blanco con acentos naranja */
  .lateral { background: var(--noche-2); color: var(--texto); border-right: 1px solid var(--borde); }
  .lateral-cabecera { background: transparent; border-bottom: 1px solid var(--borde); height: 56px; }
  .lateral-titulo { font-weight: 700; font-size: 1.05rem; color: var(--marino); }
  .lateral .btn-nuevo { width: 34px; height: 34px; font-size: 1rem; background: var(--panel-3); color: var(--marino); }
  .lateral .btn-nuevo:hover { background: var(--oro); color: #fff; }
  .lateral .buscador-chats { background: transparent; border-bottom: 0; padding: .75rem 1rem .35rem; }
  .lateral .buscador-chats .campo-icono { display: none; }   /* se busca desde la barra superior */
  .lateral .chips { margin-top: 0; }
  .lateral .chip { background: var(--panel); border-color: var(--borde-fuerte); color: var(--tenue); }
  .lateral .chip:hover { background: var(--panel-3); color: var(--marino); }
  .lateral .chip.activo { background: var(--oro); border-color: var(--oro); color: #fff; }
  .lateral .lista-chats { background: transparent !important; padding-bottom: .5rem; }
  .lateral .lista-chats::before {
    content: "Chats y grupos"; display: block; padding: .9rem 1.1rem .4rem;
    font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--tenue);
  }
  .lateral .lista-chats .fila { padding: .5rem 1rem .5rem 1.1rem; gap: .75rem; }
  .lateral .lista-chats .fila > .flex-grow-1 { box-shadow: none !important; }
  .lateral .lista-chats a.fila:hover { background: var(--tono-lista-hover); }
  .lateral .lista-chats .fila.activa { background: var(--noche-3); box-shadow: inset 3px 0 0 var(--marino); }
  .lateral .fila .nombre { color: var(--texto); font-weight: 500; }
  .lateral .fila .meta { color: var(--tenue); }
  .lateral .fila .vista { color: var(--tenue); font-size: .82rem; }
  .lateral .fila.sin-leer .nombre, .lateral .fila.activa .nombre { color: var(--texto); font-weight: 700; }
  .lateral .fila.sin-leer .vista { color: var(--texto); }
  .lateral .fila.sin-leer .meta { color: var(--marino); }
  .lateral .avatar { --tam: 38px; background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); }
  .lateral .avatar.apagado { background: var(--apagado); }
  .lateral .lista-chats .avatar::after { border-color: var(--noche-2); }
  .lateral .lista-chats .fila.activa .avatar::after { border-color: var(--noche-3); }
  .lateral .vacio { color: var(--tenue); }
  .lateral .vacio a { color: var(--marino); }
  .lateral-pin { background: var(--tono-pie); border-top: 1px solid var(--borde); color: var(--tenue); }
  .lateral-pin:hover { background: var(--panel-3); color: var(--marino); }
  .lateral-pin .pin-chico { color: var(--marino); }

  /* panel de trabajo blanco */
  .chat, .mensajes { background: var(--chat-fondo); background-image: none; }
  .chat-cabecera { background: var(--panel); border-bottom: 1px solid var(--borde); height: 62px; padding: 0 1.2rem; }
  .chat-cabecera .btn-fantasma:hover, .menu[open] > summary { background: var(--panel-3); }
  .burbuja.suyo { background: var(--suyo-2); box-shadow: none; }
  .burbuja.mio { box-shadow: none; }
  .redactor-zona { background: var(--panel); border-top: 0; padding: .3rem 1.2rem 1rem; }
  .redactor { border: 1px solid var(--borde-fuerte); border-radius: 10px; padding: .25rem .3rem; background: var(--panel); transition: border-color .15s, box-shadow .15s; }
  .redactor:focus-within { border-color: var(--marino-2); box-shadow: 0 0 0 3px rgba(var(--marino-rgb), .1); }
  .redactor .form-control { box-shadow: none !important; background: transparent; }
  .redactor .adjuntar:hover, .redactor .adjuntar.activo { background: var(--panel-3); }
  .redactor-zona .panel { margin: 0 0 .5rem; border: 1px solid var(--borde); border-radius: 10px; }
  .aviso-bloqueo { background: var(--panel); border-top: 1px solid var(--borde); }
  .bienvenida { background: var(--panel); }
}

/* ---------- mascota: el gatito cartero cruza la pantalla con cada mensaje nuevo ---------- */
.gatito {
  position: fixed; left: 0; bottom: 18px; z-index: 1090; width: 150px; pointer-events: none;
  animation: gatito-cruza 3.4s cubic-bezier(.45, .05, .55, .95) forwards;
}
@media (max-width: 899px) { .gatito { width: 112px; bottom: calc(var(--alto-tabs) + 10px); } body.en-chat .gatito { bottom: 78px; } }
.gatito svg { display: block; width: 100%; height: auto; overflow: visible; }
.gatito-salto { animation: gatito-bote .32s ease-in-out infinite alternate; }
.gatito .gt-pata { transform-box: fill-box; transform-origin: 50% 15%; }
.gatito .gt-a { animation: gatito-pata .32s ease-in-out infinite alternate; }
.gatito .gt-b { animation: gatito-pata .32s ease-in-out infinite alternate-reverse; }
.gatito .gt-cola { transform-box: view-box; transform-origin: 64px 120px; animation: gatito-cola .45s ease-in-out infinite alternate; }
.gatito .gt-carta { transform-box: view-box; transform-origin: 146px 118px; animation: gatito-carta .64s ease-in-out infinite alternate; }
.gatito .gt-rayas { animation: gatito-rayas .5s steps(2, jump-none) infinite; }
.gatito .gt-sombra { transform-box: fill-box; transform-origin: center; animation: gatito-sombra .32s ease-in-out infinite alternate; }
/* entra por la izquierda, se detiene un momento en el centro a enseñar la carta y sale por la derecha */
@keyframes gatito-cruza {
  0%   { transform: translateX(-180px); }
  38%  { transform: translateX(calc(50vw - 75px)); }
  62%  { transform: translateX(calc(50vw - 60px)); }
  100% { transform: translateX(calc(100vw + 40px)); }
}
@keyframes gatito-bote  { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-9px) rotate(2deg); } }
@keyframes gatito-pata  { from { transform: rotate(-28deg); } to { transform: rotate(28deg); } }
@keyframes gatito-cola  { from { transform: rotate(-10deg); } to { transform: rotate(12deg); } }
@keyframes gatito-carta { from { transform: rotate(-5deg); } to { transform: rotate(6deg) translateY(-3px); } }
@keyframes gatito-rayas { from { opacity: 1; } to { opacity: .15; } }
@keyframes gatito-sombra { from { transform: scaleX(1); } to { transform: scaleX(.82); opacity: .08; } }

/* ---------- logo de la mascota en el acceso ---------- */
.logo-acceso { background: #ffffff; border-radius: 14px; margin: -.5rem -.5rem 1rem; overflow: hidden; }
.logo-acceso img { display: block; width: 100%; height: auto; animation: logo-flota 3.2s ease-in-out infinite; }
@keyframes logo-flota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- marca Moshi: carita del gatito como logo ---------- */
.superior-logo { background: #ffffff; padding: 3px; }
.superior-logo img, .riel-logo img,
.superior-logo .gatito-cara, .riel-logo .gatito-cara, .marca-icono .gatito-cara { width: 100%; height: 100%; object-fit: contain; display: block; }
.riel-logo { background: #ffffff; padding: 4px; }
.superior-marca { font-size: 1.3rem; letter-spacing: -.01em; }
.marca-logo { display: inline-flex; align-items: center; gap: .5rem; letter-spacing: -.01em; }
.marca-icono { display: inline-grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; padding: 2px; border-radius: 10px; background: #ffffff; }
.marca-icono img { width: 100%; height: 100%; display: block; }.bienvenida-logo { width: min(320px, 70%); height: auto; border-radius: 18px; margin-bottom: 1.4rem; box-shadow: var(--tarjeta-sombra); }

/* ---------- toques finales de la paleta Moshi ---------- */
.avatar { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); }
.avatar.apagado { background: var(--apagado); }
.chip.activo, .solo-movil .chip.activo { background: var(--oro); border-color: var(--oro); color: #fff; }
.tab.activa { color: var(--marino); }
.tab.activa i { color: var(--oro); }
.btn-acento { background: var(--oro); }
.btn-acento:hover, .btn-acento:focus { background: var(--marino-2); }
.btn-acento:disabled { background: var(--oro); }
.btn-nuevo:hover, .lateral .btn-nuevo:hover { background: var(--oro); color: #fff; }
.recibo.r { background: var(--oro); }

.lista-chats .fila.activa { box-shadow: inset 3px 0 0 var(--oro); }
.aviso { border-left-color: var(--oro); }
.solicitudes .fila { background: var(--tono-buscador); }
/* botón de enviar: huella de gato */
.btn-huella .huella { width: 22px; height: 22px; display: block; transform: rotate(-12deg); transition: transform .2s; }
.btn-huella:hover .huella { transform: rotate(0) scale(1.1); }
.btn-huella:active .huella { transform: rotate(8deg) scale(.9); }
/* ---------- grupos, contactos suspendidos y selección de miembros ---------- */
.avatar-grupo { background: linear-gradient(135deg, var(--miel), var(--grupo-b)) !important; color: #fff; font-size: calc(var(--tam) * .42); }
.avatar-grupo.grande { --tam: 104px; }
.avatar-grupo::after { display: none; }
.chat-cabecera .avatar-grupo { --tam: 40px; }
.icono-grupo { color: var(--oro); font-size: .85em; }
.lateral .icono-grupo { color: var(--miel); }
.burbuja .autor { font-size: .74rem; font-weight: 700; color: var(--oro); margin-bottom: .1rem; }
.insignia-admin { font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: .1rem .4rem; border-radius: 6px; background: var(--oro-claro); color: var(--recibo-texto); vertical-align: middle; }
label.fila.elegible { cursor: pointer; margin: 0; }
.fila.elegible .elegir { width: 1.35rem; height: 1.35rem; margin: 0; flex-shrink: 0; cursor: pointer; }
.fila.elegible .elegir:checked { background-color: var(--oro); border-color: var(--oro); }
.fila.elegida { background: var(--tono-lista-hover); }
.fila.suspendida .nombre, .fila.suspendida .vista { opacity: .65; }
.chat.suspendido .mensajes { filter: saturate(.6); }
.aviso-bloqueo form { vertical-align: middle; }

/* ==========================================================================
   Selector de tema (Mi perfil)
   ========================================================================== */
.temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: .7rem; }
.tema-opcion {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center;
  padding: .95rem .7rem .85rem; border-radius: 16px; border: 2px solid var(--borde); background: var(--panel);
  color: var(--texto); box-shadow: var(--sombra); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tema-opcion:hover { border-color: var(--borde-fuerte); transform: translateY(-2px); }
.tema-opcion:hover .gatito-cara { animation: gatito-flota 1.6s ease-in-out infinite; }
.tema-opcion.elegido { border-color: var(--marino); box-shadow: 0 0 0 4px rgba(var(--marino-rgb), .16); }
.tema-nombre { font-weight: 800; font-size: 1rem; }
.tema-nombre small { font-size: .58rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tenue); vertical-align: 2px; }
.tema-lema { font-size: .74rem; line-height: 1.3; color: var(--tenue); }
.tema-muestras { display: flex; gap: 4px; margin-top: .15rem; }
.tema-muestras i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.tema-check { position: absolute; top: .5rem; right: .6rem; color: var(--marino); font-size: 1.05rem; }

/* ==========================================================================
   Temas: cada uno lleva el nombre de un gatito de la pandilla.
   "moshi" (naranja) es el de :root; aquí solo se cambian las variables.
   ========================================================================== */

/* Tango: el atigrado naranja. Miel y ámbar. */
html[data-tema="tango"] {
  --marino: #e0931f; --marino-2: #c97c10; --marino-rgb: 224, 147, 31;
  --oro: #f2b544; --oro-claro: #fdecc4; --oro-rgb: 242, 181, 68;
  --fondo: #fff8e8; --panel-2: #fffbf0; --panel-3: #fff1d1; --mio: #fdeab8;
  --borde: #f5e6c4; --borde-fuerte: #ecd39c; --texto: #3b2a10; --tenue: #8d7346;
  --tono-cabecera: #fff4dc; --tono-buscador: #fff9ea; --tono-lista-hover: #fff3d9; --tono-lista-activa: #ffe7b3;
  --tono-lista-linea: #f7ecd2; --tono-pie: #fff1d6; --tono-redactor: #fffaee; --linea-zona: #f2e0b8;
  --grad-a: #f7c66e; --grad-b: #e0931f; --grupo-b: #d98a1c; --suyo-2: #fff6e2;
  --recibo-fondo: #ffecc0; --recibo-texto: #9a6510; --apagado: #e8d6b0; --placeholder: #b8a07a; --scroll: #efd093;
  --noche: #e0931f; --noche-3: #ffe7b3; --noche-texto: #fff8e8; --noche-tenue: #ffe3a8;
  --bs-link-color-rgb: 168, 108, 14; --bs-link-hover-color-rgb: 224, 147, 31;
  --sombra: 0 1px 2px rgba(150, 100, 10, .06), 0 1px 3px rgba(150, 100, 10, .08);
  --sombra-alta: 0 12px 32px -8px rgba(150, 100, 10, .22);
  --tarjeta-sombra: 0 1px 2px rgba(150, 100, 10, .05), 0 8px 24px -10px rgba(150, 100, 10, .18);
}

/* Bruma: el gris. Niebla y lavanda. */
html[data-tema="bruma"] {
  --marino: #8b86c9; --marino-2: #736ebb; --marino-rgb: 139, 134, 201;
  --oro: #a9a4dc; --oro-claro: #e6e4f7; --oro-rgb: 169, 164, 220;
  --fondo: #f5f4fa; --panel-2: #faf9fd; --panel-3: #efeef9; --mio: #e5e3f6;
  --borde: #e7e5f2; --borde-fuerte: #d3d0e8; --texto: #2a2838; --tenue: #77748f;
  --tono-cabecera: #f1f0fa; --tono-buscador: #f8f7fc; --tono-lista-hover: #f1f0fa; --tono-lista-activa: #e3e1f5;
  --tono-lista-linea: #ecebf5; --tono-pie: #efeef8; --tono-redactor: #f9f8fd; --linea-zona: #e0deef;
  --grad-a: #b9b5e6; --grad-b: #8b86c9; --miel: #c3bff0; --grupo-b: #8b86c9; --suyo-2: #f3f2fb;
  --recibo-fondo: #e6e4f7; --recibo-texto: #5c57a3; --apagado: #d6d4e3; --placeholder: #a5a2b8; --scroll: #cfcce6;
  --noche: #8b86c9; --noche-3: #e3e1f5; --noche-texto: #f5f4ff; --noche-tenue: #dcdaf5;
  --bs-link-color-rgb: 98, 92, 170; --bs-link-hover-color-rgb: 139, 134, 201;
  --sombra: 0 1px 2px rgba(60, 50, 120, .06), 0 1px 3px rgba(60, 50, 120, .08);
  --sombra-alta: 0 12px 32px -8px rgba(60, 50, 120, .2);
  --tarjeta-sombra: 0 1px 2px rgba(60, 50, 120, .05), 0 8px 24px -10px rgba(60, 50, 120, .16);
}

/* Pipa: la calicó. Rosa coral. */
html[data-tema="pipa"] {
  --marino: #e97a9a; --marino-2: #d9607f; --marino-rgb: 233, 122, 154;
  --oro: #f39bb3; --oro-claro: #fde0e8; --oro-rgb: 243, 155, 179;
  --fondo: #fff4f6; --panel-2: #fff9fa; --panel-3: #ffeaf0; --mio: #fde0e8;
  --borde: #f8e3e9; --borde-fuerte: #f0c9d4; --texto: #3a1822; --tenue: #966473;
  --tono-cabecera: #fff0f4; --tono-buscador: #fff7f9; --tono-lista-hover: #fff0f4; --tono-lista-activa: #ffdfe8;
  --tono-lista-linea: #f9e9ee; --tono-pie: #ffedf2; --tono-redactor: #fff8fa; --linea-zona: #f5d9e1;
  --grad-a: #f6b0c3; --grad-b: #e97a9a; --grupo-b: #e6864f; --suyo-2: #fff1f5;
  --recibo-fondo: #ffdbe5; --recibo-texto: #b0476a; --apagado: #ead0d7; --placeholder: #b89aa3; --scroll: #f2bfcd;
  --noche: #e97a9a; --noche-3: #ffdfe8; --noche-texto: #fff2f6; --noche-tenue: #ffd3df;
  --bs-link-color-rgb: 190, 70, 105; --bs-link-hover-color-rgb: 233, 122, 154;
  --sombra: 0 1px 2px rgba(160, 40, 80, .06), 0 1px 3px rgba(160, 40, 80, .08);
  --sombra-alta: 0 12px 32px -8px rgba(160, 40, 80, .2);
  --tarjeta-sombra: 0 1px 2px rgba(160, 40, 80, .05), 0 8px 24px -10px rgba(160, 40, 80, .16);
}

/* Luna: la gatita siamesa del lazo azul. Cielo. */
html[data-tema="luna"] {
  --marino: #4a90c9; --marino-2: #3678b0; --marino-rgb: 74, 144, 201;
  --oro: #6fb0dd; --oro-claro: #dcecf8; --oro-rgb: 111, 176, 221;
  --fondo: #f2f8fd; --panel-2: #f8fbfe; --panel-3: #e8f2fb; --mio: #dcecf8;
  --borde: #e0ecf6; --borde-fuerte: #c5dbee; --texto: #172a3a; --tenue: #5f7a90;
  --tono-cabecera: #ecf4fb; --tono-buscador: #f6fafe; --tono-lista-hover: #edf5fc; --tono-lista-activa: #d8e9f7;
  --tono-lista-linea: #e6f0f8; --tono-pie: #eaf3fb; --tono-redactor: #f7fbfe; --linea-zona: #d5e5f2;
  --grad-a: #8fc3e8; --grad-b: #4a90c9; --suyo-2: #eef5fc;
  --recibo-fondo: #dcecf8; --recibo-texto: #2f6a9c; --apagado: #ccd9e4; --placeholder: #94a8b8; --scroll: #bcd6eb;
  --noche: #4a90c9; --noche-3: #d8e9f7; --noche-texto: #f2f8fd; --noche-tenue: #cfe3f4;
  --bs-link-color-rgb: 47, 106, 156; --bs-link-hover-color-rgb: 74, 144, 201;
  --sombra: 0 1px 2px rgba(20, 70, 120, .06), 0 1px 3px rgba(20, 70, 120, .08);
  --sombra-alta: 0 12px 32px -8px rgba(20, 70, 120, .2);
  --tarjeta-sombra: 0 1px 2px rgba(20, 70, 120, .05), 0 8px 24px -10px rgba(20, 70, 120, .16);
}

/* Menta: la gatita crema del lazo verde. Fresca. */
html[data-tema="menta"] {
  --marino: #3fae8c; --marino-2: #2e9677; --marino-rgb: 63, 174, 140;
  --oro: #6cc7a8; --oro-claro: #d9f3ea; --oro-rgb: 108, 199, 168;
  --fondo: #f1faf6; --panel-2: #f7fcfa; --panel-3: #e6f6ef; --mio: #d9f3ea;
  --borde: #def0e8; --borde-fuerte: #c1e3d5; --texto: #16302a; --tenue: #5d8277;
  --tono-cabecera: #eaf7f1; --tono-buscador: #f5fbf8; --tono-lista-hover: #ebf7f2; --tono-lista-activa: #d3efe3;
  --tono-lista-linea: #e4f3ec; --tono-pie: #e8f6ef; --tono-redactor: #f6fcf9; --linea-zona: #d0eadf;
  --grad-a: #8ed8be; --grad-b: #3fae8c; --suyo-2: #ecf8f3;
  --recibo-fondo: #d9f3ea; --recibo-texto: #24785e; --apagado: #cddfd8; --placeholder: #93b0a6; --scroll: #b5e0cf;
  --noche: #3fae8c; --noche-3: #d3efe3; --noche-texto: #f1faf6; --noche-tenue: #c9eedf;
  --bs-link-color-rgb: 36, 120, 94; --bs-link-hover-color-rgb: 63, 174, 140;
  --sombra: 0 1px 2px rgba(20, 100, 70, .06), 0 1px 3px rgba(20, 100, 70, .08);
  --sombra-alta: 0 12px 32px -8px rgba(20, 100, 70, .2);
  --tarjeta-sombra: 0 1px 2px rgba(20, 100, 70, .05), 0 8px 24px -10px rgba(20, 100, 70, .16);
}

/* Ónix: el gato negro de ojos dorados. Modo oscuro. */
html[data-tema="onix"] {
  color-scheme: dark;
  --marino: #d4972a; --marino-2: #b97f1c; --marino-rgb: 212, 151, 42;
  --oro: #e0a93a; --oro-claro: #3d311f; --oro-rgb: 224, 169, 58;
  --fondo: #14110f; --panel: #1e1a17; --panel-2: #191512; --panel-3: #2a2420; --chat-fondo: #1a1613;
  --mio: #3a2e1c; --suyo: #26211d; --borde: #2f2823; --borde-fuerte: #3d342d; --texto: #f3ebe2; --tenue: #a8998a;
  --tono-cabecera: #221d19; --tono-buscador: #1e1a17; --tono-lista: #1e1a17; --tono-lista-hover: #27211d;
  --tono-lista-activa: #332a20; --tono-lista-linea: #2a241f; --tono-pie: #221d19; --tono-redactor: #1c1815; --linea-zona: #342c26;
  --grad-a: #e8b85a; --grad-b: #a8721a; --grupo-b: #c98a1a; --suyo-2: #26211d;
  --recibo-fondo: #3a2e1c; --recibo-texto: #f0c060; --apagado: #4a4039; --placeholder: #7d7064; --scroll: #4a3f35;
  --noche: #15110f; --noche-2: #1e1a17; --noche-3: #332a20; --noche-texto: #f3ebe2; --noche-tenue: #a8998a;
  --noche-linea: rgba(255, 255, 255, .08);
  --bs-link-color-rgb: 230, 180, 80; --bs-link-hover-color-rgb: 245, 200, 110;
  --sombra: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .3);
  --sombra-alta: 0 12px 32px -8px rgba(0, 0, 0, .6);
  --tarjeta-sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
}
html[data-tema="onix"] .barra { background: var(--noche); border-bottom: 1px solid var(--borde); }
html[data-tema="onix"] .marca, html[data-tema="onix"] .barra .marca { color: var(--oro); }
html[data-tema="onix"] .campana .contador { border-color: var(--noche); }
html[data-tema="onix"] .alerta-error { background: #3a1a1f; border-color: #6b2a35; color: #ffb3c0; }
html[data-tema="onix"] .alerta-ok { background: #15301f; border-color: #275c3b; color: #a6e8c0; }
html[data-tema="onix"] #app-estado { color: #6fd39b; }
html[data-tema="onix"] .burbuja { box-shadow: 0 1px .5px rgba(0, 0, 0, .4); }
html[data-tema="onix"] .riel-logo, html[data-tema="onix"] .superior-logo { box-shadow: 0 0 0 1px rgba(255, 255, 255, .1); }
html[data-tema="onix"] .mensajes { background-image: none; }
