/* ==========================================================
   SIPCA Chat — Estilos
   Marca: tokens tomados de la web corporativa de SIPCA
   Sistema: tokens semánticos (claro / oscuro), escala 4/8px,
            accesibilidad WCAG AA y prefers-reduced-motion.
   ========================================================== */

/* ---------- 1. Tokens de marca ---------- */
:root {
  --navy-900: #000a2b;
  --navy: #000f3d;
  --navy-700: #031a5c;
  --navy-600: #1d3270;
  --navy-500: #263a72;
  --blue: #0189de;
  --blue-btn: #0170b8;
  --blue-light: #7fcbff;
  --online: #3ddc84;

  /* Tipografía */
  --f-head: 'Barlow Condensed', Impact, sans-serif;
  --f-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Espaciado (4/8) y radios */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r-sm: 10px; --r: 14px; --r-lg: 22px; --r-pill: 999px;

  /* Movimiento */
  --dur-fast: 150ms;
  --dur: 220ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  /* Capas */
  --z-banner: 90;
  --z-toast: 100;

  /* ---------- 2. Tokens semánticos (modo claro) ---------- */
  color-scheme: light;
  --bg: #f4f7fb;              /* fondo del área de mensajes */
  --surface: #ffffff;         /* tarjetas, cabecera, composer, modal */
  --surface-2: #f4f7fb;       /* campos de texto */
  --surface-hover: #eaf0f7;
  --border: #dde5ef;
  --text: #0b1633;
  --text-soft: #3a4766;
  --text-muted: #5b6888;      /* 5.2:1 sobre --bg */
  --heading: #000f3d;
  --link: #00649f;
  --bubble-in: var(--surface);
  --bubble-out: var(--blue-btn);
  --on-bubble-out: #ffffff;
  --on-bubble-out-soft: #eef7ff; /* 4.7:1 sobre --bubble-out */
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --skeleton: #e3e9f2;
  --shadow-1: 0 6px 24px rgba(0, 15, 61, .08);
  --shadow-2: 0 24px 50px rgba(0, 15, 61, .22);
  --scrim: rgba(0, 10, 43, .6);

  /* Barra lateral (siempre oscura: identidad SIPCA) */
  --side-bg: var(--navy);
  --side-raised: var(--navy-700);
  --side-line: var(--navy-600);
  --side-text: #ffffff;
  --side-soft: #c4d1ee;
  --side-muted: #9fb0d3;      /* 8.4:1 sobre --side-bg */
  --side-skeleton: #12245e;
}

/* ---------- 2b. Modo oscuro ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #020a24;
    --surface: #0a1640;
    --surface-2: #0f1d4d;
    --surface-hover: #142459;
    --border: #1f3170;
    --text: #e8eefc;
    --text-soft: #b8c5e6;
    --text-muted: #94a5cc;
    --heading: #ffffff;
    --link: #7fcbff;
    --danger: #ffb4ab;
    --danger-bg: #3a1012;
    --skeleton: #14245a;
    --shadow-1: 0 6px 24px rgba(0, 0, 0, .35);
    --shadow-2: 0 24px 50px rgba(0, 0, 0, .55);
    --scrim: rgba(0, 0, 0, .7);

    --side-bg: var(--navy-900);
    --side-raised: #0a1a52;
    --side-line: #16275f;
  }
}

/* ---------- 3. Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sr-only {
  position: absolute; top: 0; left: 0;
  width: 1px; height: 1px; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Scrollbars finas y con los colores de la marca */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.sidebar * { scrollbar-color: var(--navy-500) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.sidebar ::-webkit-scrollbar-thumb { background: var(--navy-500); }

/* ---------- 4. Componentes comunes ---------- */
.logo-card {
  background: #fff;                       /* el logo es negro: siempre sobre blanco */
  border-radius: var(--r);
  padding: 10px 14px;
  display: inline-flex;
}
.logo-card img { height: 52px; width: auto; }
.logo-card--sm { border-radius: var(--r-sm); padding: 6px 10px; }
.logo-card--sm img { height: 30px; }

/* Marca en la barra lateral: ícono + nombre */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__logo {
  width: 44px; height: 44px; flex: none; border-radius: 22%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
}
.brand__name {
  font-family: var(--f-head); font-weight: 800; font-size: 24px; line-height: 1;
  letter-spacing: .04em; text-transform: uppercase; color: #fff; white-space: nowrap;
}
.brand__name span { color: var(--blue-light); }

/* Logo de la app (ícono redondeado) */
.app-logo { display: block; height: auto; border-radius: 22%; box-shadow: 0 18px 40px rgba(0, 10, 43, .35); }
.app-logo--lg { width: clamp(96px, 14vw, 140px); }
.app-logo--md { width: 112px; margin-bottom: 8px; }
.page-login .app-logo { box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08); }

.eyebrow {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--f-head); font-weight: 600; font-size: 15px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--link);
}
.eyebrow i { display: block; width: 40px; height: 2px; background: var(--blue); }
.eyebrow--light { color: var(--blue-light); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 52px; padding: 12px 32px;
  border: 0; border-radius: var(--r-pill);
  font-family: var(--f-head); font-weight: 700; font-size: 18px;
  letter-spacing: .08em; text-transform: uppercase;
  transition: background var(--dur), box-shadow var(--dur), transform var(--dur-fast), opacity var(--dur);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .6; }
.btn--navy { background: var(--navy); color: #fff; box-shadow: 0 10px 24px rgba(0, 15, 61, .25); }
.btn--navy:hover:not(:disabled) { background: var(--blue-btn); box-shadow: 0 10px 24px rgba(1, 112, 184, .35); }
.btn--block { width: 100%; }
.btn--sm { min-height: 44px; padding: 10px 24px; font-size: 16px; }
@media (prefers-color-scheme: dark) {
  .btn--navy { background: var(--blue-btn); }
  .btn--navy:hover:not(:disabled) { background: #0a84d1; }
}

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--heading);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn:active { background: var(--border); }
.icon-btn--dark { border: 0; background: transparent; color: var(--side-soft); }
.icon-btn--dark:hover { background: var(--side-raised); color: #fff; }

.avatar {
  position: relative; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  font-family: var(--f-head); font-weight: 700;
  background: var(--navy-600); color: #fff;
}
.avatar--34 { width: 34px; height: 34px; font-size: 14px; }
.avatar--40 { width: 40px; height: 40px; font-size: 16px; }
.avatar--46 { width: 46px; height: 46px; font-size: 18px; }
.avatar--accent { background: var(--blue); color: var(--navy-900); font-weight: 800; }
.avatar--light { background: #fff; color: var(--navy); font-weight: 800; }
.avatar--navy { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .avatar--navy { background: var(--navy-600); } }

/* Punto de "en línea": el texto "En línea" en la cabecera evita depender solo del color */
.dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--side-bg);
  display: none;
}
.dot--on { display: block; background: var(--online); }

/* Skeleton (carga) */
.sk { border-radius: var(--r-sm); background: var(--skeleton); animation: pulse 1.4s ease-in-out infinite; }
.sk--dark { background: var(--side-skeleton); }
@keyframes pulse { 50% { opacity: .55; } }
.sk-conv { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); }
.sk-conv .sk:first-child { width: 46px; height: 46px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: var(--sp-2); }
.sk-line { height: 12px; }
.sk-bubble { height: 44px; border-radius: 18px; }

/* Toast y banner de conexión */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex; align-items: center; gap: var(--sp-3);
  max-width: min(480px, calc(100% - 32px));
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r);
  background: var(--navy-900); color: #fff; box-shadow: var(--shadow-2);
  font-size: 15px; line-height: 1.4;
  transform: translateX(-50%);
  animation: toast-in var(--dur) var(--ease-out);
}
.toast--error { background: #5c1410; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

.net-banner {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; z-index: var(--z-banner);
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill);
  background: #fff4d6; color: #5a3d00; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-1); transform: translateX(-50%);
}

/* ==========================================================
   LOGIN
   ========================================================== */
.page-login { background: var(--navy); }
.login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-wrap: wrap;
}
.login__hero {
  flex: 1 1 420px;
  padding: clamp(40px, 8vw, 96px) clamp(24px, 6vw, 80px);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 22px;
  color: #fff;
}
.login__hero h1 {
  font-family: var(--f-head); font-weight: 800; text-transform: uppercase;
  font-size: clamp(2.8rem, 6vw, 4.8rem); line-height: .95; text-wrap: balance;
}
.login__lead { font-size: 18px; color: var(--side-soft); max-width: 30ch; }
.login__form {
  flex: 1 1 420px;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: clamp(32px, 6vw, 72px) clamp(24px, 6vw, 80px);
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
}
.login__form > * { width: 100%; max-width: 440px; }
@media (min-width: 900px) {
  .login__form { border-radius: var(--r-lg) 0 0 var(--r-lg); }
}
.login__title {
  font-family: var(--f-head); font-weight: 700; font-size: 30px;
  text-transform: uppercase; color: var(--heading);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 14px; font-weight: 600; color: var(--text-soft); }
.input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--surface-2); font-size: 16px; outline: none;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.input:focus { border-color: var(--blue); background: var(--surface); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap { position: relative; display: flex; }
.input-wrap .input { padding-right: 56px; }
.input-wrap .icon-btn {
  position: absolute; right: 4px; top: 4px;
  border: 0; background: transparent; color: var(--text-soft);
}
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text-soft); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue-btn); }
.alert {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  padding: 12px 16px; border-radius: var(--r);
  background: var(--danger-bg); color: var(--danger); font-weight: 600;
}
.alert svg { flex: none; margin-top: 2px; }
.tip {
  display: flex; align-items: center; gap: 12px;
  margin-top: 8px; padding: 14px;
  border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border);
  font-size: 14px; line-height: 1.4; color: var(--text-soft);
}
.tip strong { color: var(--heading); }
.tip--button {
  width: 100%; text-align: left; cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.tip--button:hover { border-color: var(--blue); background: var(--surface-hover); }
.tip--button:active { transform: scale(.99); }
.tip__text { flex: 1; }
.tip__chevron { flex: none; color: var(--text-muted); }
.install-msg {
  padding: 12px 14px; border-radius: var(--r);
  background: #e3f1fb; color: #00476f; font-size: 14px; line-height: 1.45;
}
@media (prefers-color-scheme: dark) { .install-msg { background: #0b2b4a; color: #cfe9ff; } }
.tip__icon {
  flex: none; width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--blue); color: var(--navy-900);
}

/* ==========================================================
   CHAT
   ========================================================== */
/* La página nunca hace scroll: solo la lista y los mensajes */
.page-chat { height: 100%; overflow: hidden; }

.app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  overflow: hidden;
}

/* ---------- Barra lateral ---------- */
.sidebar {
  background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar__top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 16px 14px 20px;
  padding-top: max(18px, env(safe-area-inset-top));
}
.sidebar__search { padding: 0 20px 12px; }

.search {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--side-raised); color: var(--side-muted);
  transition: box-shadow var(--dur-fast);
}
.search:focus-within { box-shadow: 0 0 0 2px var(--blue); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  color: #fff; font-size: 15px;
}
.search input::placeholder { color: var(--side-muted); }
.search--light { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.search--light input { color: var(--text); }
.search--light input::placeholder { color: var(--text-muted); }

.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 0 20px 12px; }
.chip {
  min-height: 36px; padding: 0 16px;
  border-radius: var(--r-pill); border: 1px solid var(--navy-500);
  background: transparent; color: var(--side-soft);
  font-family: var(--f-head); font-weight: 700; font-size: 15px;
  letter-spacing: .08em; text-transform: uppercase;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.chip:hover { border-color: var(--side-soft); color: #fff; }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--navy-900); }

.conv-list {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 4px 10px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overscroll-behavior: contain;
}
.list-empty { padding: 24px 12px; color: var(--side-muted); text-align: center; }
.list-empty--light { color: var(--text-muted); }

.conv {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px;
  border: 0; border-radius: var(--r);
  background: transparent; color: var(--side-text); text-align: left;
  transition: background var(--dur-fast);
}
.conv:hover { background: rgba(255, 255, 255, .06); }
.conv:active { background: rgba(255, 255, 255, .1); }
.conv[aria-current="true"] { background: var(--side-raised); }
.conv__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv__row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv__time { flex: none; font-size: 13px; color: var(--side-muted); font-variant-numeric: tabular-nums; }
.conv__last { font-size: 14px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.has-unread .conv__name { font-weight: 700; }
.conv.has-unread .conv__last { color: #fff; }
.conv.has-unread .conv__time { color: var(--blue-light); }
.badge {
  flex: none; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--blue); color: var(--navy-900);
  font-size: 12px; font-weight: 700; display: grid; place-items: center;
  font-variant-numeric: tabular-nums;
}

.sidebar__me {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px 12px;
  padding: 14px 16px 14px 20px; border-top: 1px solid var(--side-line);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.me__info { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.me__info strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__info span { font-size: 13px; color: var(--side-muted); }
.me__actions { display: flex; gap: 2px; }
.me__tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pill-btn {
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--navy-500); border-radius: var(--r-pill);
  background: transparent; color: var(--side-soft); font-size: 13px; font-weight: 600;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.pill-btn:hover { background: var(--side-raised); color: #fff; }
.pill-btn[aria-pressed="true"] { border-color: var(--blue); color: var(--blue-light); }
.pill-btn--accent { border-color: var(--blue); background: var(--blue); color: var(--navy-900); }
.pill-btn--accent:hover { background: var(--blue-light); color: var(--navy-900); }

/* ---------- Panel del chat ---------- */
.chat { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); position: relative; }

.chat__empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 32px; text-align: center; color: var(--text-soft);
}
.chat__empty .logo-card { border: 1px solid var(--border); margin-bottom: 8px; }
.chat__empty h2 {
  font-family: var(--f-head); font-weight: 700; font-size: 34px; line-height: 1.1;
  text-transform: uppercase; color: var(--heading); text-wrap: balance;
}

.chat__panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat__header {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.chat__header .dot { border-color: var(--surface); }
.chat__back { display: none; }
.chat__title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat__title strong {
  font-family: var(--f-head); font-weight: 700; font-size: 22px; line-height: 1.1;
  letter-spacing: .02em; text-transform: uppercase; color: var(--heading);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat__title span { font-size: 14px; color: var(--text-soft); }

.messages {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 24px; display: flex; flex-direction: column; gap: 6px;
  overscroll-behavior: contain;
}
.messages__skeleton { display: flex; flex-direction: column; gap: var(--sp-3); }
.messages__skeleton .sk-bubble:nth-child(odd) { width: 46%; }
.messages__skeleton .sk-bubble:nth-child(even) { width: 34%; align-self: flex-end; }
.load-more {
  align-self: center; margin-bottom: 8px;
  min-height: 40px; padding: 8px 18px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--link); font-weight: 600;
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.load-more:hover { background: var(--surface-hover); }
.day {
  align-self: center; display: flex; align-items: center; gap: 12px; margin: 14px 0 8px;
  font-family: var(--f-head); font-weight: 600; font-size: 14px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--link);
}
.day::before, .day::after { content: ""; width: 32px; height: 2px; background: var(--blue); }

.msg { display: flex; gap: 10px; align-items: flex-end; max-width: min(72%, 640px); }
.msg--in { align-self: flex-start; }
.msg--out { align-self: flex-end; flex-direction: column; align-items: flex-end; gap: 4px; }
.msg--grouped { margin-top: -2px; }
.msg--enter { animation: msg-in var(--dur) var(--ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }
.msg__spacer { width: 34px; flex: none; }
.bubble {
  min-width: 0; padding: 8px 14px 6px;
  border-radius: 18px; font-size: 16px; line-height: 1.45;
}
.msg--in .bubble {
  background: var(--bubble-in); border: 1px solid var(--border);
  border-bottom-left-radius: 6px; box-shadow: var(--shadow-1);
}
.msg--out .bubble {
  background: var(--bubble-out); color: var(--on-bubble-out);
  border-bottom-right-radius: 6px; box-shadow: 0 10px 24px rgba(1, 112, 184, .2);
  transition: opacity var(--dur);
}
.msg.is-pending .bubble { opacity: .75; }
.msg.is-failed .bubble { background: var(--danger-bg); color: var(--text); border: 1px solid var(--danger); box-shadow: none; }
.msg.is-failed .bubble__meta { color: var(--danger); }
.bubble__author { font-size: 13px; font-weight: 700; color: var(--link); }
.bubble__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble__text a { color: inherit; text-underline-offset: 2px; }
.bubble__meta {
  display: flex; justify-content: flex-end; align-items: center; gap: 4px;
  margin-top: 2px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.msg--out .bubble__meta { color: var(--on-bubble-out-soft); }
.ticks { display: inline-flex; }
.ticks.is-read { color: #b3e5ff; } /* 3.9:1 sobre la burbuja; además ✓✓ se distingue por forma */
.retry {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 4px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--danger); background: var(--surface); color: var(--danger);
  font-size: 13px; font-weight: 700;
}
.retry:hover { background: var(--danger-bg); }

.composer {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 24px 16px; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.composer__field { flex: 1; min-width: 0; display: flex; }
.composer textarea {
  flex: 1; min-width: 0; resize: none;
  min-height: 48px; max-height: 160px;
  padding: 12px 18px; border-radius: 24px;
  border: 1.5px solid var(--border); background: var(--surface-2);
  font-size: 16px; line-height: 1.4; outline: none;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.composer textarea::placeholder { color: var(--text-muted); }
.composer textarea:focus { border-color: var(--blue); background: var(--surface); }
.send-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--navy); color: #fff; box-shadow: 0 10px 24px rgba(0, 15, 61, .25);
  transition: background var(--dur-fast), transform var(--dur-fast), opacity var(--dur-fast);
}
.send-btn:hover:not(:disabled) { background: var(--blue-btn); }
.send-btn:active:not(:disabled) { transform: scale(.94); }
.send-btn:disabled { opacity: .45; box-shadow: none; }
@media (prefers-color-scheme: dark) {
  .send-btn { background: var(--blue-btn); }
  .send-btn:hover:not(:disabled) { background: #0a84d1; }
}

/* ---------- Modal nuevo chat ---------- */
.modal {
  margin: auto; width: min(440px, calc(100% - 32px)); max-height: min(640px, 86vh);
  border: 0; border-radius: var(--r-lg); padding: 20px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-2);
}
.modal[open] { display: flex; flex-direction: column; gap: 14px; animation: modal-in var(--dur) var(--ease-out); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal::backdrop { background: var(--scrim); }
.modal__head { display: flex; align-items: center; justify-content: space-between; }
.modal__head h2 { font-family: var(--f-head); font-weight: 700; font-size: 26px; text-transform: uppercase; color: var(--heading); }
.user-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.user {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px;
  padding: 8px 10px; border: 0; border-radius: var(--r); background: transparent; text-align: left;
  transition: background var(--dur-fast);
}
.user:hover { background: var(--surface-hover); }
.user:active { background: var(--border); }
.user__info { display: flex; flex-direction: column; line-height: 1.3; }
.user__info span { font-size: 14px; color: var(--text-soft); }
.user .dot { border-color: var(--surface); }

/* ==========================================================
   MENÚ DESPLEGABLE (⋮) — compartido por el chat y el panel
   ========================================================== */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--surface-hover); color: var(--heading); }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 220px; padding: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-2); text-align: left;
  animation: menu-in var(--dur-fast) var(--ease-out);
}
.menu--up .menu__panel { top: auto; bottom: calc(100% + 4px); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu__panel form { display: block; }
.menu__label { padding: 6px 12px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text); font-weight: 500; font-size: 15px; text-decoration: none; text-align: left;
}
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-hover); outline: none; }
.menu__item svg { color: var(--text-soft); flex: none; }
.menu__item[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--link); font-weight: 700; }
.menu__item--danger, .menu__item--danger svg { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-bg); }
.menu__item--ok, .menu__item--ok svg { color: #1b6e2d; }
@media (prefers-color-scheme: dark) { .menu__item--ok, .menu__item--ok svg { color: #7ee2a0; } }
.menu__sep { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }

/* Botones secundarios (compartidos) */
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  background: var(--surface); color: var(--heading); font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.btn-ghost:hover { background: var(--surface-hover); }
.btn-ghost--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-ghost--danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-ghost--danger:hover { background: var(--danger-bg); }
.btn--danger { background: #b3261e; color: #fff; }
.btn--danger:hover:not(:disabled) { background: #8c1d18; }
.icon-btn--plain { border-color: transparent; background: transparent; color: var(--text-soft); }
.icon-btn--plain:hover { background: var(--surface-hover); color: var(--heading); }

/* Diálogo de confirmación (compartido) */
.confirm { width: min(420px, calc(100% - 32px)); gap: var(--sp-3); }
.confirm h2 { font-family: var(--f-head); font-weight: 700; font-size: 24px; text-transform: uppercase; color: var(--heading); }
.confirm p { color: var(--text-soft); }
.confirm__actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-2); flex-wrap: wrap; }

/* Menú flotante de un mensaje */
.msg-menu { position: fixed; z-index: 60; right: auto; top: auto; min-width: 200px; }

/* ==========================================================
   FASE 2: archivos, respuestas, edición, silenciar
   ========================================================== */

/* Cabecera del chat: menú y silenciado */
.chat__menu-btn { border-color: transparent; background: transparent; }
.chat__menu-btn:hover { background: var(--surface-hover); }
.muted-icon { display: inline-flex; color: var(--text-muted); }
@media (max-width: 820px) {
  .chat__menu-btn { color: #fff; }
  .chat__menu-btn:hover, .menu[open] > .chat__menu-btn { background: var(--side-raised); color: #fff; }
  .muted-icon { color: var(--side-soft); }
}

/* Lista: chat silenciado */
.conv__muted { display: inline-flex; color: var(--side-muted); margin-left: 4px; vertical-align: -2px; }
.badge--muted { background: var(--navy-500); color: var(--side-soft); }

/* Área de mensajes con botón "ir al final" y zona para soltar archivos */
.messages-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.jump {
  position: absolute; right: 20px; bottom: 16px; z-index: 5;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--heading);
  box-shadow: var(--shadow-2);
  animation: msg-in var(--dur) var(--ease-out);
}
.jump:hover { background: var(--surface-hover); }
.jump__count {
  position: absolute; top: -6px; right: -6px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--blue); color: var(--navy-900); font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.drop-zone {
  position: absolute; inset: 12px; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  border: 3px dashed var(--blue); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  color: var(--link); font-family: var(--f-head); font-weight: 700; font-size: 22px;
  letter-spacing: .04em; text-transform: uppercase; pointer-events: none;
}

/* Separador "Mensajes nuevos" */
.new-divider {
  align-self: stretch; display: flex; align-items: center; gap: 12px; margin: 10px 0;
  font-size: 13px; font-weight: 700; color: var(--link); text-transform: uppercase; letter-spacing: .1em;
}
.new-divider::before, .new-divider::after { content: ""; flex: 1; height: 1px; background: var(--blue); opacity: .5; }

/* Acciones de un mensaje */
.msg { position: relative; }
.msg__actions {
  position: absolute; top: 2px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  box-shadow: var(--shadow-1);
  opacity: 0; transition: opacity var(--dur-fast);
}
.msg--in .msg__actions { right: -40px; }
.msg--out .msg__actions { left: -40px; }
.msg:hover .msg__actions, .msg:focus-within .msg__actions, .msg__actions[aria-expanded="true"] { opacity: 1; }
.msg__actions:hover { color: var(--heading); background: var(--surface-hover); }
@media (pointer: coarse) {
  /* En pantallas táctiles: mantener pulsado el mensaje abre el menú */
  .msg__actions { display: none; }
}
.msg.is-highlight .bubble { animation: highlight 1.6s var(--ease-out); }
@keyframes highlight { 0%, 40% { box-shadow: 0 0 0 4px var(--blue); } }

/* Cita (mensaje al que se responde) */
.quote {
  display: flex; flex-direction: column; gap: 1px; width: 100%;
  margin: 2px 0 6px; padding: 6px 10px;
  border: 0; border-left: 3px solid var(--blue); border-radius: 8px;
  background: var(--surface-2); color: var(--text); text-align: left; font-size: 14px; line-height: 1.35;
}
.quote:hover { filter: brightness(.97); }
.quote strong { color: var(--link); font-size: 13px; }
.quote span { color: var(--text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg--out .quote { background: rgba(255, 255, 255, .16); border-left-color: #fff; color: #fff; }
.msg--out .quote strong { color: #fff; }
.msg--out .quote span { color: var(--on-bubble-out-soft); }

/* Mensaje eliminado y editado */
.bubble--deleted { font-style: italic; }
.msg--in .bubble--deleted { color: var(--text-muted); box-shadow: none; }
.msg--out .bubble.bubble--deleted { background: transparent; color: var(--text-muted); border: 1px dashed var(--border); box-shadow: none; }
.msg--out .bubble--deleted .bubble__meta { color: var(--text-muted); }
.bubble__deleted { display: inline-flex; align-items: center; gap: 6px; }
.edited { font-style: italic; }

/* Imagen dentro del mensaje */
.bubble--media { padding: 4px; }
.bubble--media .bubble__author, .bubble--media .quote { margin: 4px 8px 6px; width: auto; }
.bubble--media .bubble__text, .bubble--media .bubble__meta { padding: 0 10px; }
.bubble--media .bubble__meta { padding-bottom: 4px; }
.media {
  display: block; position: relative; padding: 0; border: 0; cursor: zoom-in;
  border-radius: 14px; overflow: hidden; background: var(--surface-2);
  max-width: min(320px, 100%);
}
.media img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: cover; }
.media__progress {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 10, 43, .45); color: #fff; font-weight: 700; font-size: 15px;
}

/* Archivo dentro del mensaje */
.file-card {
  display: flex; align-items: center; gap: 12px; min-width: 220px; max-width: 320px;
  margin: 2px 0 4px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
a.file-card:hover { border-color: var(--blue); }
.msg--out .file-card { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); color: #fff; }
.file-card__icon {
  flex: none; width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--navy); color: #fff;
  font-family: var(--f-head); font-weight: 700; font-size: 13px; letter-spacing: .04em;
}
.file-card__icon--pdf { background: #b3261e; }
.file-card__icon--doc { background: #1f5bb5; }
.file-card__icon--xls { background: #1b6e2d; }
.file-card__icon--ppt { background: #b4501f; }
.file-card__info { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.file-card__info strong { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.file-card__info span { font-size: 13px; color: var(--text-muted); }
.msg--out .file-card__info span { color: var(--on-bubble-out-soft); }
.file-card__dl { flex: none; margin-left: auto; color: inherit; opacity: .8; }

/* Zona de escritura: respuesta/edición y vista previa del archivo */
.composer-wrap { background: var(--surface); border-top: 1px solid var(--border); }
.composer-wrap .composer { border-top: 0; }
.composer-context, .attach-preview {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 24px 0; padding: 8px 8px 8px 12px;
  border-radius: var(--r); background: var(--surface-2);
  animation: msg-in var(--dur) var(--ease-out);
}
.composer-context { border-left: 3px solid var(--blue); }
.composer-context__icon { flex: none; color: var(--link); display: inline-flex; }
.composer-context__text, .attach-preview__info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.composer-context__text strong, .attach-preview__info strong { font-size: 14px; color: var(--link); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-preview__info strong { color: var(--heading); }
.composer-context__text span, .attach-preview__info span { font-size: 14px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-preview__thumb { flex: none; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.attach-preview__thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-preview__thumb .file-card__icon { width: 52px; height: 52px; }
.attach-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  color: var(--text-soft); transition: background var(--dur-fast), color var(--dur-fast);
}
.attach-btn:hover { background: var(--surface-hover); color: var(--heading); }
.attach-btn:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (max-width: 820px) {
  .composer-context, .attach-preview { margin: 8px 12px 0; }
  .msg--in .msg__actions { right: -36px; }
  .msg--out .msg__actions { left: -36px; }
}

/* Visor de imágenes */
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0;
  border: 0; padding: 0; background: rgba(0, 6, 26, .94); color: #fff;
}
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: rgba(0, 6, 26, .94); }
.lightbox__bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.lightbox__info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.lightbox__info span { font-size: 13px; color: var(--side-soft); }
.lightbox img { flex: 1; min-height: 0; width: 100%; object-fit: contain; padding: 0 16px; }
.lightbox__caption { padding: 12px 24px; padding-bottom: max(16px, env(safe-area-inset-bottom)); text-align: center; color: var(--side-soft); white-space: pre-wrap; }
.lightbox__caption:empty { display: none; }

/* ==========================================================
   PANTALLAS TÁCTILES: objetivos de 44px
   ========================================================== */
@media (pointer: coarse) {
  .chip, .pill-btn, .load-more { min-height: 44px; }
  .retry { min-height: 40px; }
}

/* ==========================================================
   MÓVIL: se ve la lista O el chat
   ========================================================== */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .chat { display: none; }
  .app.is-chat-open .sidebar { display: none; }
  .app.is-chat-open .chat { display: flex; }

  .chat__header {
    padding: 10px 12px; gap: 10px; background: var(--side-bg); border-bottom: 0;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .chat__header .chat__back { display: grid; border: 0; background: transparent; color: #fff; }
  .chat__header .chat__back:hover { background: var(--side-raised); }
  .chat__title strong { color: #fff; font-size: 20px; }
  .chat__title span { color: var(--side-soft); }
  .chat__header .dot { border-color: var(--side-bg); }

  .messages { padding: 16px 12px; }
  .msg { max-width: 86%; }
  .composer { padding: 10px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* ==========================================================
   MOVIMIENTO REDUCIDO
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================
   STICKERS Y SELECTOR DE EMOJIS (WhatsApp / Telegram style)
   ========================================================== */
.composer-wrap {
  position: relative;
}

/* Stickers flotantes en el chat */
.bubble--sticker {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.msg--out .bubble.bubble--sticker, .msg--in .bubble.bubble--sticker {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.sticker-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.msg--in .sticker-container {
  align-items: flex-start;
}
.sticker-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  display: block;
  user-select: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.12));
  transition: transform 0.18s ease;
}
.sticker-img:hover {
  transform: scale(1.06);
}
.bubble--sticker .bubble__meta {
  background: rgba(0, 15, 61, 0.55);
  color: #fff !important;
  padding: 2px 7px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  margin-top: 4px;
  font-size: 11px;
}
.bubble--sticker .bubble__meta .ticks {
  color: #7fcbff !important;
}

/* Panel flotante de Emojis y Stickers */
.media-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  right: 12px;
  max-width: 480px;
  height: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 15, 61, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 80;
  animation: pickerSlideUp 0.2s var(--ease-out);
}

@keyframes pickerSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.media-picker[hidden] {
  display: none !important;
}

.media-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.media-picker__tabs {
  display: flex;
  gap: 6px;
}

.media-picker__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.media-picker__tab:hover {
  background: var(--border);
  color: var(--text);
}

.media-picker__tab.is-active {
  background: var(--surface);
  color: var(--blue-btn);
  border-color: var(--border);
  box-shadow: var(--shadow-1);
}

.media-picker__search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.media-picker__search input {
  width: 100%;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.media-picker__search input:focus {
  border-color: var(--blue);
  background: var(--surface);
}

.media-picker__pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.media-picker__pane[hidden] {
  display: none !important;
}

/* Categorías de Emojis */
.emoji-cats {
  display: flex;
  gap: 2px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  overflow-x: auto;
}
.emoji-cat-btn {
  border: 0;
  background: transparent;
  font-size: 19px;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.emoji-cat-btn:hover {
  background: var(--border);
}
.emoji-cat-btn.is-active {
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

/* Cuadrícula de Emojis */
.emoji-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 4px;
}
.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  font-size: 24px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease;
}
.emoji-item:hover {
  background: var(--surface-2);
  transform: scale(1.22);
}

/* Categorías de Stickers / Packs */
.sticker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.sticker-packs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.sticker-pack-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.sticker-pack-btn:hover {
  color: var(--text);
  border-color: var(--blue-light);
}
.sticker-pack-btn.is-active {
  background: var(--blue-btn);
  color: #fff;
  border-color: var(--blue-btn);
}
.sticker-upload-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--blue-light);
  color: var(--navy-900);
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}
.sticker-upload-btn:hover {
  opacity: 0.85;
}

/* Cuadrícula de Stickers */
.sticker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 10px;
}
.sticker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.sticker-item:hover {
  background: var(--surface-2);
  border-color: var(--border);
  transform: scale(1.1);
}
.sticker-item img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
}
