/* ============================================================
   wppcrm — sistema de diseño
   Tema oscuro con acento esmeralda. Sin dependencias externas.
   ============================================================ */

:root {
  /* Superficies */
  --bg-0: #0a0e14;
  --bg-1: #0f141c;
  --bg-2: #141b25;
  --bg-3: #1b2430;
  --bg-hover: #1f2937;

  /* Bordes */
  --line: #1e293b;
  --line-soft: #172032;

  /* Texto */
  --tx-0: #f1f5f9;
  --tx-1: #cbd5e1;
  --tx-2: #94a3b8;
  --tx-3: #64748b;

  /* Acentos */
  --acc: #10b981;
  --acc-dim: #059669;
  --acc-soft: rgba(16, 185, 129, .12);
  --acc-glow: rgba(16, 185, 129, .28);

  --info: #38bdf8;
  --warn: #fbbf24;
  --danger: #f43f5e;
  --purple: #a78bfa;

  /* Formas */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-full: 999px;

  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 8px 24px rgba(0,0,0,.35);
  --sh-3: 0 20px 50px rgba(0,0,0,.5);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --rail: 240px;
  --list: 360px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--tx-0);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--acc); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #23303f; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #33445a; background-clip: content-box; }

/* ---------------- Tipografía utilitaria ---------------- */
.h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.h2 { font-size: 18px; font-weight: 620; letter-spacing: -.01em; }
.h3 { font-size: 15px; font-weight: 600; }
.muted   { color: var(--tx-2); }
.dim     { color: var(--tx-3); }
.small   { font-size: 12.5px; }
.tiny    { font-size: 11.5px; }
.mono    { font-family: var(--mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center  { display: grid; place-items: center; }
.row     { display: flex; align-items: center; gap: 10px; }
.col     { display: flex; flex-direction: column; gap: 10px; }
.spread  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow    { flex: 1; min-width: 0; }
.wrap    { flex-wrap: wrap; }
.hidden  { display: none !important; }

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-3); color: var(--tx-0);
  font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s, opacity .15s;
  white-space: nowrap;
}
.btn:hover  { background: var(--bg-hover); border-color: #2c3a4d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--acc) 0%, var(--acc-dim) 100%);
  border-color: transparent; color: #04160f; font-weight: 650;
  box-shadow: 0 2px 12px var(--acc-glow);
}
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(180deg, var(--acc) 0%, var(--acc-dim) 100%); }

.btn-ghost  { background: transparent; border-color: transparent; color: var(--tx-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--tx-0); }
.btn-danger { background: transparent; border-color: rgba(244,63,94,.35); color: #fb7185; }
.btn-danger:hover { background: rgba(244,63,94,.12); border-color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ---------------- Campos ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; font-weight: 600; color: var(--tx-2); letter-spacing: .02em; }
.hint  { font-size: 11.5px; color: var(--tx-3); line-height: 1.45; }

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: var(--tx-0);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--tx-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--acc-dim);
  box-shadow: 0 0 0 3px var(--acc-soft);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; font-family: inherit; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%2394a3b8' d='M6 8L2 4h8z'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 32px;
}

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 38px; height: 21px; border-radius: 99px;
  background: #263141; position: relative; transition: background .18s;
  flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--tx-2); transition: transform .18s, background .18s;
}
.switch input:checked + .track { background: var(--acc-dim); }
.switch input:checked + .track::after { transform: translateX(17px); background: #fff; }

/* ---------------- Tarjetas y superficies ---------------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card-tight { padding: 14px; }
.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); }

.stat {
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
}
.stat .val { font-size: 28px; font-weight: 680; letter-spacing: -.03em; line-height: 1.1; }
.stat .key { font-size: 11.5px; color: var(--tx-3); text-transform: uppercase; letter-spacing: .07em; margin-top: 4px; }

/* ---------------- Chips y badges ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-full);
  background: var(--bg-3); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--tx-1); white-space: nowrap;
}
.chip-acc    { background: var(--acc-soft); border-color: rgba(16,185,129,.3); color: #6ee7b7; }
.chip-info   { background: rgba(56,189,248,.12); border-color: rgba(56,189,248,.3); color: #7dd3fc; }
.chip-warn   { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.3); color: #fcd34d; }
.chip-danger { background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.3); color: #fda4af; }
.chip-purple { background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.3); color: #c4b5fd; }
.chip button { background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; padding: 0 0 0 2px; }
.chip button:hover { opacity: 1; }

.badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--acc); color: #04160f;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tx-3); flex-shrink: 0; }
.dot-on   { background: var(--acc);   box-shadow: 0 0 0 3px var(--acc-soft); }
.dot-wait { background: var(--warn);  box-shadow: 0 0 0 3px rgba(251,191,36,.15); animation: pulse 1.6s infinite; }
.dot-off  { background: #475569; }
.dot-err  { background: var(--danger); box-shadow: 0 0 0 3px rgba(244,63,94,.15); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* ---------------- Avatar ---------------- */
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-weight: 650; font-size: 15px; color: #06120d;
  background: linear-gradient(135deg, #34d399, #0ea5e9);
}
.avatar-sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

/* ============================================================
   LAYOUT DE LA APLICACIÓN
   ============================================================ */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* --- Rail lateral --- */
.rail {
  width: var(--rail); flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.rail-brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--line-soft); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--acc), #0ea5e9);
  display: grid; place-items: center; font-weight: 800; color: #04160f; font-size: 15px;
}
.brand-name { font-weight: 680; letter-spacing: -.02em; font-size: 15px; }

.rail-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.rail-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--tx-3); padding: 14px 10px 6px; font-weight: 650; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--tx-2); cursor: pointer; font-weight: 500;
  border: 1px solid transparent; transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--bg-2); color: var(--tx-0); }
.nav-item.active { background: var(--acc-soft); color: #6ee7b7; border-color: rgba(16,185,129,.22); }
.nav-item .ico { width: 17px; text-align: center; flex-shrink: 0; }
.nav-item .count { margin-left: auto; }

.rail-foot { padding: 12px; border-top: 1px solid var(--line-soft); }

/* --- Área principal --- */
.main { flex: 1; display: flex; min-width: 0; }
.view { flex: 1; display: flex; min-width: 0; overflow: hidden; }
.view-scroll { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }
.view-head { margin-bottom: 22px; }

/* --- Columna de chats --- */
.chatlist {
  width: var(--list); flex-shrink: 0;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  background: var(--bg-1);
}
.chatlist-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.chatlist-filters { display: flex; gap: 7px; }
.chatlist-filters .select { padding: 6px 28px 6px 9px; font-size: 12px; background-color: var(--bg-2); }
.chatlist-body { flex: 1; overflow-y: auto; }

.chat-item {
  display: flex; gap: 11px; padding: 11px 14px;
  cursor: pointer; border-bottom: 1px solid var(--line-soft);
  transition: background .12s; position: relative;
}
.chat-item:hover { background: var(--bg-2); }
.chat-item.active { background: var(--bg-2); }
.chat-item.active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--acc);
}
.chat-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-item .nm { font-weight: 600; font-size: 13.5px; }
.chat-item .tm { font-size: 11px; color: var(--tx-3); flex-shrink: 0; }
.chat-item .pv { font-size: 12.5px; color: var(--tx-2); margin-top: 2px; }
.chat-item .meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; }

/* Anclar desde la lista, sin abrir el chat */
.btn-pin {
  background: none; border: 0; cursor: pointer; padding: 0 2px;
  font-size: 11px; line-height: 1; transition: opacity .15s, transform .1s;
}
.btn-pin:hover { opacity: 1 !important; transform: scale(1.2); }

.chat-item .meta .chip.tiny { font-size: 10px; padding: 1px 6px; }

.zone-tag {
  font-size: 10.5px; padding: 1.5px 7px; border-radius: var(--r-full);
  background: rgba(56,189,248,.1); color: #7dd3fc; border: 1px solid rgba(56,189,248,.2);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}

/* --- Conversación --- */
.conv { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-0); }
.conv-head {
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; background: var(--bg-1);
  flex-shrink: 0;
}
.conv-body {
  flex: 1; overflow-y: auto; padding: 22px 24px;
  display: flex; flex-direction: column; gap: 3px;
  background:
    radial-gradient(circle at 20% 10%, rgba(16,185,129,.04), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(56,189,248,.035), transparent 45%),
    var(--bg-0);
}
.conv-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line); background: var(--bg-1); flex-shrink: 0; }

.day-sep { align-self: center; margin: 14px 0 8px; }

.bubble {
  max-width: min(600px, 74%); padding: 9px 13px 7px;
  border-radius: 14px; font-size: 13.8px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; position: relative;
  box-shadow: var(--sh-1);
}
.bubble.in  { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.out { align-self: flex-end; background: linear-gradient(160deg, #0f5c45, #0b4a37); border: 1px solid #146b50; border-bottom-right-radius: 5px; }
.bubble + .bubble { margin-top: 3px; }
.bubble .stamp { font-size: 10.5px; color: var(--tx-3); margin-top: 3px; text-align: right; display: flex; gap: 5px; justify-content: flex-end; align-items: center; }
.bubble.out .stamp { color: rgba(209,250,229,.55); }
.bubble .author { font-size: 10.5px; color: var(--acc); margin-bottom: 3px; font-weight: 600; }

.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; min-height: 44px; max-height: 170px; resize: none;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; outline: none; line-height: 1.5;
}
.composer textarea:focus { border-color: var(--acc-dim); box-shadow: 0 0 0 3px var(--acc-soft); }
.send-btn {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  border: 0; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--acc), var(--acc-dim));
  color: #04160f; font-size: 17px; box-shadow: 0 3px 14px var(--acc-glow);
}
.send-btn:disabled { opacity: .4; box-shadow: none; cursor: not-allowed; }

/* --- Estados vacíos --- */
.empty { flex: 1; display: grid; place-items: center; padding: 40px; text-align: center; }
.empty .ico { font-size: 44px; opacity: .35; margin-bottom: 14px; }

/* ---------------- Tablas ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 14px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--tx-3);
  border-bottom: 1px solid var(--line); font-weight: 650; white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: var(--bg-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-1); }

/* ---------------- Modal ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 7, 12, .72); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-3);
}
.modal-lg { max-width: 820px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- Notificaciones ---------------- */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 400px; padding: 13px 16px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--acc);
  border-radius: var(--r-sm); box-shadow: var(--sh-2);
  animation: slideIn .22s ease;
  font-size: 13px;
}
.toast.err  { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px) } to { opacity: 1; transform: none } }

/* ---------------- Barra de progreso ---------------- */
.bar { height: 7px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc-dim), var(--acc)); transition: width .4s ease; }

/* ---------------- QR ---------------- */
.qr-box {
  width: 268px; height: 268px; border-radius: var(--r-lg);
  background: #fff; padding: 12px; display: grid; place-items: center;
  box-shadow: var(--sh-2); margin: 0 auto;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-skeleton {
  width: 268px; height: 268px; border-radius: var(--r-lg); margin: 0 auto;
  background: linear-gradient(100deg, var(--bg-2) 30%, var(--bg-3) 50%, var(--bg-2) 70%);
  background-size: 220% 100%; animation: shimmer 1.4s infinite;
  display: grid; place-items: center; color: var(--tx-3);
}
@keyframes shimmer { to { background-position: -120% 0 } }

/* ---------------- Login ---------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(16,185,129,.13), transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(56,189,248,.10), transparent 55%),
    var(--bg-0);
}
.login-card { width: 100%; max-width: 400px; }

/* ---------------- Vista previa de variantes ---------------- */
.variant {
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--purple);
  border-radius: var(--r-sm); padding: 11px 13px;
  font-size: 13px; white-space: pre-wrap; line-height: 1.55;
}

/* ---------------- Selección múltiple ---------------- */
.barra-seleccion {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--acc-soft); border: 1px solid rgba(16,185,129,.25);
}
.chat-item.sel { background: var(--acc-soft); }
.chat-item.sel::after {
  content: "✓"; position: absolute; top: 9px; right: 10px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--acc); color: #04160f;
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}
/* Sin esto, Ctrl+click y Shift+click pintan de azul media lista */
.chatlist-body.seleccionando { user-select: none; }

/* ---------------- Menú contextual ---------------- */
.menu-flotante {
  position: fixed; z-index: 80; min-width: 190px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-3);
  padding: 6px; animation: aparecer .12s ease;
}
@keyframes aparecer { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: none } }
.menu-flotante button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 11px; border: 0; background: none; color: var(--tx-1);
  border-radius: var(--r-sm); cursor: pointer; font-size: 13px; text-align: left;
}
.menu-flotante button:hover { background: var(--bg-3); color: var(--tx-0); }
.menu-flotante button.peligro { color: #fb7185; }
.menu-flotante button.peligro:hover { background: rgba(244,63,94,.12); }
.menu-flotante hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu-flotante .titulo {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--tx-3); padding: 7px 11px 4px; font-weight: 650;
}

/* ---------------- Composer ampliado ---------------- */
.reply-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 9px;
  background: var(--bg-2); border-left: 3px solid var(--acc);
  border-radius: var(--r-sm);
}

.quick-list {
  max-height: 220px; overflow-y: auto; margin-bottom: 9px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--sh-2);
}
.quick-list .item { padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.quick-list .item:last-child { border-bottom: 0; }
.quick-list .item:hover, .quick-list .item.activo { background: var(--bg-3); }
.quick-list .atajo { color: var(--acc); font-weight: 650; font-size: 12.5px; }
.quick-list .cuerpo { font-size: 12.5px; color: var(--tx-2); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.drop-zona {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(10,14,20,.9); backdrop-filter: blur(3px);
  border: 2px dashed var(--acc); border-radius: var(--r-lg);
  display: grid; place-items: center; text-align: center; color: var(--acc);
  pointer-events: none;
}
.conv { position: relative; }

/* ---------------- Burbujas con archivos ---------------- */
.bubble .media img, .bubble .media video {
  max-width: 100%; max-height: 320px; border-radius: 9px; display: block; cursor: pointer;
}
.bubble .media audio { width: 260px; max-width: 100%; }
.bubble .media { margin-bottom: 5px; }

.bubble .doc {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; background: rgba(255,255,255,.05);
  border-radius: 9px; margin-bottom: 5px; text-decoration: none; color: inherit;
}
.bubble .doc:hover { background: rgba(255,255,255,.09); }
.bubble .doc .ico { font-size: 22px; }

.bubble .citado {
  border-left: 3px solid var(--acc); padding: 4px 9px; margin-bottom: 5px;
  background: rgba(255,255,255,.05); border-radius: 5px;
  font-size: 12px; color: var(--tx-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bubble .reaccion {
  position: absolute; bottom: -11px; right: 9px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 99px; padding: 1px 6px; font-size: 12px;
}
.bubble.borrado { opacity: .5; font-style: italic; }

.bubble .acciones {
  position: absolute; top: 3px; right: 5px; opacity: 0;
  background: none; border: 0; color: var(--tx-2); cursor: pointer;
  font-size: 15px; padding: 0 3px; transition: opacity .12s;
}
.bubble:hover .acciones { opacity: .8; }
.bubble .acciones:hover { opacity: 1; color: var(--tx-0); }

/* ---------------- Estados ---------------- */
.color-chip {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform .12s, border-color .12s;
}
.color-chip:hover { transform: scale(1.12); }
.color-chip.activo { border-color: var(--tx-0); }

.estado-preview {
  border-radius: var(--r); padding: 26px 20px; min-height: 130px;
  display: grid; place-items: center; text-align: center;
  font-size: 20px; color: #fff; word-break: break-word; line-height: 1.4;
}

/* ---------------- Selector de zonas geográficas ---------------- */
.zona-lista {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-0); padding: 6px;
}
.zona-grupo + .zona-grupo { margin-top: 4px; border-top: 1px solid var(--line-soft); padding-top: 4px; }

.zona-prov {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px;
}
.zona-prov:hover { background: var(--bg-2); }

.zona-ciudades { padding-left: 14px; }

.zona-ciudad {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 9px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 12.5px; color: var(--tx-1);
  transition: background .12s, opacity .12s;
}
.zona-ciudad:hover { background: var(--bg-2); }
.zona-lista input[type="checkbox"] { accent-color: var(--acc); cursor: pointer; flex-shrink: 0; }
.zona-lista input[type="checkbox"]:disabled { cursor: not-allowed; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  :root { --list: 310px; --rail: 210px; }
}
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; height: 100%; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; box-shadow: var(--sh-3); }
  .chatlist { width: 100%; }
  .chatlist.hide-mobile { display: none; }
  .conv.hide-mobile { display: none; }
}
