/* WhatsApp-style chat shell — list, thread, bubbles */
.mes-chat {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 168px);
  min-height: 420px;
  background: #fffefb !important;
  color: #1c1917 !important;
  border: 1px solid rgba(28, 25, 23, 0.08);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
}
.mes-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  background: rgba(15, 23, 42, 0.35);
}
.mes-chat-overlay .mes-chat {
  width: min(440px, 100%);
  height: 100%;
  min-height: 0;
  margin-left: auto;
  border-radius: 0;
  border: 0;
}
.mes-chat-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fff !important;
  color: #1c1917 !important;
  border-bottom: 1px solid rgba(28, 25, 23, 0.08);
}
.mes-chat-top strong { font-size: 16px; letter-spacing: -0.02em; }
.mes-chat-top em { display: block; font-style: normal; font-size: 11px; font-weight: 700; color: #78716c; }
.mes-chat-back, .mes-chat-x {
  width: 36px; height: 36px; border: 0; border-radius: 12px;
  background: rgba(15, 23, 42, 0.05); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mes-chat-search {
  margin: 8px 12px 0;
  border: 0; border-radius: 14px; padding: 10px 12px;
  background: #f4f1ec;
  color: #1c1917;
  font: inherit; font-size: 14px; font-weight: 600;
}
.mes-chat-scroll { flex: 1; overflow: auto; padding: 8px 10px 12px; }
.mes-chat-scroll::-webkit-scrollbar { width: 0; height: 0; }
.mes-chat-label {
  margin: 12px 6px 6px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: #a8a29e;
}
.mes-chat-row {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; text-align: left;
  padding: 8px 6px; border-radius: 16px; cursor: pointer; font: inherit; color: inherit;
}
.mes-chat-row:hover { background: rgba(15, 23, 42, 0.04); }
.mes-chat-av {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 48px;
  display: grid; place-items: center; overflow: hidden;
  background: #e7e5e4; color: #fff; font-weight: 800;
}
.mes-chat-av img { width: 100%; height: 100%; object-fit: cover; }
.mes-chat-av .material-symbols-rounded { font-size: 24px; }
.mes-chat-row b { display: block; font-size: 14px; }
.mes-chat-row small { display: block; color: #78716c; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.mes-chat-row .when { margin-left: auto; font-size: 11px; color: #a8a29e; font-weight: 700; }
.mes-chat-mid { min-width: 0; flex: 1; }
.mes-chat-thread {
  flex: 1; overflow: auto; padding: 12px;
  background: #f7f4ef !important;
  display: flex; flex-direction: column; gap: 6px;
}
.mes-chat-bubble {
  max-width: 82%;
  padding: 8px 10px 6px;
  border-radius: 16px 16px 16px 6px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  align-self: flex-start;
}
.mes-chat-bubble.mine {
  align-self: flex-end;
  background: #dcf8c6;
  border-radius: 16px 16px 6px 16px;
}
.mes-chat-bubble .who { font-size: 12px; font-weight: 800; }
.mes-chat-bubble .cap { font-size: 10px; font-weight: 700; color: #78716c; margin-top: 1px; }
.mes-chat-bubble .txt { font-size: 14px; line-height: 1.35; margin-top: 3px; white-space: pre-wrap; }
.mes-chat-bubble .tm { display: block; text-align: right; font-size: 10px; color: #a8a29e; font-weight: 700; margin-top: 2px; }
.mes-chat-compose {
  display: flex; gap: 8px; padding: 10px;
  background: #fff !important;
  border-top: 1px solid rgba(28, 25, 23, 0.08);
}
.mes-chat-compose textarea {
  flex: 1; resize: none; border: 0; border-radius: 16px;
  background: rgba(15, 23, 42, 0.05);
  padding: 10px 12px; font: inherit; font-size: 14px; min-height: 42px; max-height: 96px;
}
.mes-chat-compose button {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: #25d366; color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.mes-chat-empty { padding: 18px 8px; color: #78716c; font-size: 13px; font-weight: 600; }
.mes-chat-fab {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 520;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #1c1917;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mes-chat-fab .material-symbols-rounded { font-size: 28px; color: #e11d48; }
.mes-chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
  display: grid;
  place-items: center;
}
.mes-chat-toast {
  position: fixed;
  right: 18px;
  bottom: 164px;
  z-index: 530;
  width: min(320px, calc(100vw - 36px));
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: #1c1917;
  text-align: left;
  padding: 12px 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
  cursor: pointer;
  animation: mes-chat-in 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mes-chat-toast b { display: block; font-size: 13px; }
.mes-chat-toast span {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  color: #57534e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes mes-chat-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.mes-chat-walls {
  display: flex;
  gap: 6px;
  padding: 8px 12px 4px;
  background: #fff;
  overflow: hidden;
}
.mes-chat-wall {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(28, 25, 23, 0.15);
  padding: 0;
  cursor: pointer;
}
.mes-chat-wall.on { box-shadow: 0 0 0 2px #e11d48; }
.mes-chat-wall.w-paper { background: #fffefb; }
.mes-chat-wall.w-rose { background: #fb7185; }
.mes-chat-wall.w-mint { background: #2dd4bf; }
.mes-chat-wall.w-sky { background: #38bdf8; }
.mes-chat-wall.w-sand { background: #f59e0b; }
.mes-chat-wall.w-lilac { background: #a78bfa; }
.mes-chat-wall.w-grid { background: #1d4ed8; }
.mes-chat-wall.w-note { background: #fde68a; }
.mes-chat-wall.w-night { background: #1e1b4b; }
.mes-chat.wall-paper .mes-chat-scroll,
.mes-chat.wall-paper .mes-chat-thread { background: #fffefb !important; }
.mes-chat.wall-rose .mes-chat-scroll,
.mes-chat.wall-rose .mes-chat-thread {
  background:
    radial-gradient(circle at 12px 12px, rgba(251, 113, 133, 0.45) 2px, transparent 2.5px) 0 0 / 22px 22px,
    linear-gradient(160deg, #fff1f2, #ffe4e6) !important;
}
.mes-chat.wall-mint .mes-chat-scroll,
.mes-chat.wall-mint .mes-chat-thread {
  background:
    radial-gradient(ellipse 80% 50% at 0% 100%, rgba(45, 212, 191, 0.45), transparent 60%),
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(52, 211, 153, 0.35), transparent 55%),
    #ecfdf5 !important;
}
.mes-chat.wall-sky .mes-chat-scroll,
.mes-chat.wall-sky .mes-chat-thread {
  background:
    radial-gradient(circle at 20% 30%, #fff 0 8px, transparent 9px),
    radial-gradient(circle at 70% 60%, #fff 0 14px, transparent 15px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.8) 0 6px, transparent 7px),
    linear-gradient(180deg, #7dd3fc, #e0f2fe) !important;
}
.mes-chat.wall-sand .mes-chat-scroll,
.mes-chat.wall-sand .mes-chat-thread {
  background:
    repeating-linear-gradient(115deg, rgba(180, 83, 9, 0.08) 0 12px, transparent 12px 28px),
    linear-gradient(160deg, #ffedd5, #fdba74) !important;
}
.mes-chat.wall-lilac .mes-chat-scroll,
.mes-chat.wall-lilac .mes-chat-thread {
  background:
    linear-gradient(135deg, rgba(167, 139, 250, 0.35) 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(225deg, rgba(244, 114, 182, 0.28) 25%, transparent 25%) 0 0 / 28px 28px,
    #f5f3ff !important;
}
.mes-chat.wall-grid .mes-chat-scroll,
.mes-chat.wall-grid .mes-chat-thread {
  background:
    linear-gradient(rgba(37, 99, 235, 0.18) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(90deg, rgba(37, 99, 235, 0.18) 1px, transparent 1px) 0 0 / 18px 18px,
    #eff6ff !important;
}
.mes-chat.wall-note .mes-chat-scroll,
.mes-chat.wall-note .mes-chat-thread {
  background:
    linear-gradient(#fecaca 1px, transparent 1px) 0 28px / 100% 28px,
    linear-gradient(90deg, transparent 28px, #fca5a5 28px, #fca5a5 29px, transparent 29px),
    #fffbeb !important;
}
.mes-chat.wall-night .mes-chat-scroll,
.mes-chat.wall-night .mes-chat-thread {
  background:
    radial-gradient(circle at 15% 20%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 40% 70%, #fff 0 1.2px, transparent 1.6px),
    radial-gradient(circle at 75% 30%, #fff 0 1px, transparent 1.4px),
    radial-gradient(circle at 60% 80%, rgba(255,255,255,0.8) 0 1px, transparent 1.5px),
    linear-gradient(180deg, #1e1b4b, #312e81) !important;
}
