/* =====================================================================
 *  chat.css — CHAT kiểu Messenger (Alya, 06/12/2026)
 *  ---------------------------------------------------------------------
 *  Chỉ chứa style cho #screenChat: danh sách hội thoại, khung trò chuyện,
 *  bong bóng tin nhắn, cảm xúc, picker, gọi WebRTC, badge tin chưa đọc.
 *  Nạp SAU social.css nên có thể ghi đè; vẫn giữ mọi class cũ để không vỡ
 *  hành vi (chat.js vẫn dùng .chat-row, .chat-bubble, .chat-send-btn…).
 * ===================================================================== */

/* =====================================================================
 *  1. KHUNG CHUNG
 * ===================================================================== */
#screenChat { margin: 0 auto; }

#screenChat #panelChat {
  position: relative;
  display: flex;
  flex-direction: column;
  height: clamp(430px, 76vh, 780px);
  min-height: 0;
  max-height: calc(100dvh - 150px);
  overflow: hidden;
  background: var(--t-panel, #15121d);
  color: var(--t-text, #f5f3ff);
  border-color: var(--t-border, rgba(255, 255, 255, .1));
  box-shadow: 0 18px 44px rgba(0, 0, 0, .35);
}

/* #chatThreadView cũ sót lại trong ngăn kéo (trùng id) — không dùng nữa */
#historyDrawer #chatThreadView { display: none !important; }

#chatListView,
#chatThreadView {
  flex: 1 1 auto;
  min-height: 0;
}

#chatListView { overflow-y: auto; overscroll-behavior: contain; }

/* style.css đặt `#chatListView { display:flex }` (id) nên class .hidden của
   Tailwind bị đè — phải ẩn bằng id + !important, nếu không danh sách vẫn
   hiện phía trên khung trò chuyện. */
#screenChat #chatListView.hidden { display: none !important; }
#screenChat #chatThreadView.hidden { display: none !important; }

#chatThreadView.is-open {
  animation: chatThreadIn .3s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes chatThreadIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------------------------------------------------------------------
   MÀN RỘNG: style.css bật `html { zoom: 1.12 / 1.28 / 1.42 }`, mà vh lại
   không tính zoom — nên <main min-height: 100vh> cao hơn màn hình 12–42%
   và thanh dưới bị đẩy khỏi màn. Trong RIÊNG chế độ Chat, chia lại theo
   đúng hệ số zoom để cả khung chat + thanh dưới nằm gọn một màn.
   --------------------------------------------------------------------- */
@media (min-width: 1000px) {
  html[data-app-mode="chat"] main { min-height: calc(100dvh / 1.12) !important; }
}
@media (min-width: 1400px) {
  html[data-app-mode="chat"] main { min-height: calc(100dvh / 1.28) !important; }
}
@media (min-width: 1800px) {
  html[data-app-mode="chat"] main { min-height: calc(100dvh / 1.42) !important; }
}

/* =====================================================================
 *  2. MÀN DANH SÁCH HỘI THOẠI
 * ===================================================================== */
.chat-head__text { min-width: 0; }
.chat-head__title { letter-spacing: -.015em; }

.chat-empty { animation: chatFadeIn .3s ease both; }
.chat-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.chat-empty__tiny {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--t-muted-dim, #7d7d87);
  max-width: 250px;
  line-height: 1.45;
}

.chat-btn-ghost {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--t-border, rgba(255, 255, 255, .18));
  background: transparent;
  color: var(--t-text, #f5f3ff);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.chat-btn-ghost:hover { background: var(--t-soft, rgba(255, 255, 255, .08)); }
.chat-btn-ghost:active { transform: scale(.96); }

.chat-btn-primary { transition: filter .15s ease, transform .1s ease; }
.chat-btn-primary:hover { filter: brightness(1.08); }

/* dòng hội thoại */
.chat-row {
  position: relative;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 14px;
  transition: background .16s ease, transform .12s ease;
}
.chat-row + .chat-row { margin-top: 2px; }
.chat-row:hover { background: var(--t-soft, rgba(255, 255, 255, .06)); }
.chat-row:active { transform: scale(.995); }
.chat-row.is-unread { background: rgba(0, 132, 255, .1); }
.chat-row.is-unread:hover { background: rgba(0, 132, 255, .16); }
.chat-row:focus-visible { outline: 2px solid rgba(0, 132, 255, .7); outline-offset: -2px; }

.chat-row__av { position: relative; }
.chat-row__main { gap: 1px; }
.chat-row__last {
  font-size: 12.5px;
  line-height: 1.35;
}
.chat-row__count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #0084ff;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 132, 255, .45);
}
.chat-row.is-unread .chat-row__time { color: #6fb6ff; font-weight: 700; }

/* Gợi ý bạn bè: .social-person/.social-chip trong social.css chỉ style cho
   #forumRoot nên phải khai báo lại cho khung Chat. */
#chatFriendList .social-person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--t-soft, rgba(255, 255, 255, .04));
  border: 1px solid var(--t-border, rgba(255, 255, 255, .08));
  transition: background .15s ease, border-color .15s ease;
}
#chatFriendList .social-person + .social-person { margin-top: 4px; }
#chatFriendList .social-person:hover {
  background: var(--t-soft-2, rgba(255, 255, 255, .08));
  border-color: rgba(0, 132, 255, .35);
}
#chatFriendList .social-person-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--t-text, #f5f3ff);
  line-height: 1.25;
}
#chatFriendList .social-person-sub {
  font-size: 10.5px;
  color: var(--t-muted, #8b8b93);
  margin-top: 1px;
}
#chatFriendList .social-chip {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(0, 132, 255, .16);
  color: #7fc0ff;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background .14s ease, transform .1s ease;
}
#chatFriendList .social-chip:hover { background: rgba(0, 132, 255, .32); }
#chatFriendList .social-chip:active { transform: scale(.94); }

/* =====================================================================
 *  3. CHẤM ONLINE
 * ===================================================================== */
.chat-av {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.chat-presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #70707c;
  border: 2px solid var(--t-panel, #15121d);
  transition: background .25s ease;
  z-index: 2;
}
.chat-av.is-online .chat-presence {
  background: #31d158;
  animation: chatOnlinePulse 2.6s ease-out infinite;
}
.chat-av.is-offline .chat-presence { background: #70707c; }

@keyframes chatOnlinePulse {
  0% { box-shadow: 0 0 0 0 rgba(49, 209, 88, .55); }
  70% { box-shadow: 0 0 0 7px rgba(49, 209, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(49, 209, 88, 0); }
}

/* =====================================================================
 *  4. ĐẦU KHUNG TRÒ CHUYỆN
 * ===================================================================== */
.chat-thread-head {
  position: relative;
  z-index: 4;
  gap: 9px;
  padding: 9px 10px;
  background: var(--t-panel, #15121d);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--t-border, rgba(255, 255, 255, .09));
}
.chat-icon-btn--ghost { background: transparent; }
.chat-icon-btn--ghost:hover { background: var(--t-soft, rgba(255, 255, 255, .08)); }
.chat-thread-name { font-size: 14.5px; }
.chat-thread-sub {
  font-size: 10.5px;
  color: var(--t-muted, #8b8b93);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 14px;
  transition: color .2s ease;
}
.chat-thread-sub.is-typing { color: #6fb6ff; font-weight: 600; }
.chat-typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.chat-typing-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: chatTyping 1.2s ease-in-out infinite;
}
.chat-typing-dots i:nth-child(2) { animation-delay: .18s; }
.chat-typing-dots i:nth-child(3) { animation-delay: .36s; }

@keyframes chatTyping {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.chat-thread-actions .chat-icon-btn:active .ic { transform: scale(.9); }
.chat-thread-actions .chat-icon-btn { transition: background .16s ease, transform .12s ease; }

/* =====================================================================
 *  5. VÙNG TIN NHẮN
 * ===================================================================== */
.chat-thread-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

#chatMessageList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
#chatMessageList::-webkit-scrollbar { width: 7px; }
#chatMessageList::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .16);
  border-radius: 999px;
}
#chatMessageList::-webkit-scrollbar-track { background: transparent; }

.chat-thread-empty {
  margin: auto;
  text-align: center;
  color: var(--t-muted, #8b8b93);
  font-size: 12.5px;
  max-width: 260px;
  line-height: 1.55;
}
.chat-thread-empty__ic {
  display: inline-flex;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--t-soft, rgba(255, 255, 255, .07));
  margin-bottom: 8px;
}
.chat-thread-empty__ic .ic { width: 24px; height: 24px; }

/* nút xuống cuối */
.chat-scroll-bottom {
  position: absolute;
  right: 14px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--t-border, rgba(255, 255, 255, .14));
  background: var(--t-card-1, #201c2b);
  color: var(--t-text, #f5f3ff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  transform: rotate(-90deg);
  animation: chatFadeIn .2s ease both;
  z-index: 5;
}
.chat-scroll-bottom:hover { background: var(--t-soft-2, rgba(255, 255, 255, .16)); }
.chat-scroll-bottom .ic { width: 18px; height: 18px; }

/* dải ngày */
.chat-datesep {
  display: flex;
  justify-content: center;
  margin: 12px 0 8px;
  animation: chatFadeIn .24s ease both;
}
.chat-datesep span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--t-muted, #8b8b93);
  background: var(--t-soft, rgba(255, 255, 255, .07));
  border-radius: 999px;
  padding: 3px 10px;
}

/* =====================================================================
 *  6. TIN NHẮN
 * ===================================================================== */
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 1px 0;
  position: relative;
  max-width: 100%;
  animation: chatMsgIn .26s cubic-bezier(.2, .8, .2, 1) both;
}
.chat-msg.is-me { flex-direction: row-reverse; }
.chat-msg.is-enter { animation: chatMsgIn .3s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg__avatar {
  width: 28px;
  flex: 0 0 28px;
  opacity: 0;
  transition: opacity .18s ease;
  align-self: flex-end;
  padding-bottom: 2px;
}
.chat-msg.is-them .chat-msg__avatar { opacity: 1; }
.chat-msg.is-cont .chat-msg__avatar { opacity: 0; }

.chat-msg__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: min(78%, 560px);
  min-width: 0;
}
.chat-msg.is-me .chat-msg__body { align-items: flex-end; }

.chat-msg .chat-sender {
  font-size: 10.5px;
  font-weight: 800;
  color: #7db8ff;
  padding-left: 4px;
  margin-bottom: 1px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-msg.is-cont .chat-sender { display: none; }

/* --- bong bóng --- */
#panelChat .chat-msg .chat-bubble {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 17px;
  border-bottom-left-radius: 6px;
  font-size: 13.5px;
  line-height: 1.46;
  background: var(--chat-bubble-them, #2a2735);
  color: var(--t-text, #f5f3ff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .28);
  transition: transform .12s ease, box-shadow .12s ease;
  word-break: break-word;
  white-space: normal;
}
#panelChat .chat-msg.is-me .chat-bubble {
  background: linear-gradient(135deg, #0084ff, #0069d9);
  color: #fff;
  border-bottom-left-radius: 17px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 110, 219, .3);
}
#panelChat .chat-msg.is-cont.is-them .chat-bubble { border-top-left-radius: 6px; }
#panelChat .chat-msg.is-cont.is-me .chat-bubble { border-top-right-radius: 6px; }
#panelChat .chat-msg.is-me:not(.is-cont) .chat-bubble { border-top-right-radius: 17px; }
#panelChat .chat-msg.is-them:not(.is-cont) .chat-bubble { border-top-left-radius: 17px; }

.chat-text { white-space: pre-wrap; }
.chat-text--empty { opacity: .5; font-style: italic; }
.chat-link {
  color: #9ed0ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.chat-msg.is-me .chat-link { color: #d8ecff; }

/* tin đã thu hồi */
#panelChat .chat-bubble--recalled {
  background: transparent;
  border: 1px dashed var(--t-border, rgba(255, 255, 255, .22));
  color: var(--t-muted, #8b8b93);
  font-style: italic;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: none;
}
.chat-msg.is-me .chat-bubble--recalled {
  background: transparent;
  color: var(--t-muted, #8b8b93);
  border-color: var(--t-border, rgba(255, 255, 255, .22));
}
.chat-recalled-ic { font-style: normal; opacity: .8; }

/* thời gian + công cụ */
.chat-msg__meta {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 4px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .18s ease;
  height: 13px;
}
.chat-msg.is-tail .chat-msg__meta,
.chat-msg:hover .chat-msg__meta { opacity: .75; }
.chat-msg__time { font-size: 9.5px; color: var(--t-muted, #8b8b93); }

.chat-msg__tools {
  position: absolute;
  top: -6px;
  right: 44px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 3;
  background: var(--t-card-1, #201c2b);
  border: 1px solid var(--t-border, rgba(255, 255, 255, .12));
  border-radius: 999px;
  padding: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.chat-msg.is-me .chat-msg__tools { right: auto; left: 44px; }
.chat-msg:hover .chat-msg__tools,
.chat-msg:focus-within .chat-msg__tools {
  opacity: 1;
  transform: translateY(0);
}
.chat-msg__tool {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--t-text, #f5f3ff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s ease;
}
.chat-msg__tool:hover { background: var(--t-soft-2, rgba(255, 255, 255, .16)); }
.chat-msg__tool .ic { width: 13px; height: 13px; }

.chat-msg.is-swiping .chat-bubble { transform: translateX(14px); }

/* nháy sáng khi cuộn tới tin gốc */
.chat-msg.is-flash .chat-bubble {
  animation: chatFlash 1.5s ease;
}
@keyframes chatFlash {
  0%, 100% { box-shadow: 0 1px 2px rgba(0, 0, 0, .28); }
  18%, 62% { box-shadow: 0 0 0 3px rgba(0, 132, 255, .55); }
}

/* --- trích dẫn tin gốc --- */
.chat-quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 3px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .1);
  border-radius: 9px;
  padding: 5px 9px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: background .14s ease;
  overflow: hidden;
}
.chat-msg.is-me .chat-quote {
  border-left-color: rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .18);
}
.chat-quote:hover { background: rgba(255, 255, 255, .24); }
.chat-quote__name {
  font-size: 10.5px;
  font-weight: 800;
  color: #a8d2ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-msg.is-me .chat-quote__name { color: #eaf4ff; }
.chat-quote__text {
  font-size: 11.5px;
  opacity: .82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- ảnh --- */
.chat-img-grid {
  display: grid;
  gap: 3px;
  border-radius: 13px;
  overflow: hidden;
  margin: 3px 0 5px;
  max-width: 320px;
}
.chat-img-grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.chat-img-grid[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.chat-img-grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.chat-img-grid[data-count="5"],
.chat-img-grid[data-count="6"],
.chat-img-grid[data-count="7"],
.chat-img-grid[data-count="8"],
.chat-img-grid[data-count="9"] { grid-template-columns: repeat(3, 1fr); }
.chat-img {
  border: 0;
  padding: 0;
  margin: 0;
  background: #0b0b10;
  display: block;
  overflow: hidden;
  cursor: zoom-in;
  line-height: 0;
  min-height: 0;
}
.chat-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-height: 200px;
  margin: 0;
  border-radius: 0;
  transition: transform .25s ease, filter .2s ease;
}
.chat-img:hover img { transform: scale(1.04); filter: brightness(1.05); }
.chat-img--single {
  border-radius: 14px;
  overflow: hidden;
  max-width: 300px;
  margin: 2px 0 4px;
}
.chat-img--single img { max-height: 280px; }

/* --- sticker --- */
.chat-msg.is-sticker .chat-bubble {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.chat-sticker {
  font-size: 56px;
  line-height: 1;
  padding: 2px 4px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35));
  animation: chatStickerIn .34s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes chatStickerIn {
  from { transform: scale(.6) rotate(-8deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

/* --- tin nhắn thoại --- */
.chat-audio {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 0 1px;
  min-width: 190px;
}
.chat-audio__play {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .18);
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.chat-msg.is-me .chat-audio__play { background: rgba(255, 255, 255, .26); }
.chat-audio__play:hover { background: rgba(255, 255, 255, .32); }
.chat-audio__play:active { transform: scale(.92); }
.chat-audio__play-ic { font-size: 11px; line-height: 1; }
.chat-audio.is-playing .chat-audio__play-ic::before { content: "❚❚"; font-size: 9px; }
.chat-audio.is-playing .chat-audio__play-ic { font-size: 0; }
.chat-audio.is-playing .chat-audio__play-ic::before { font-size: 9px; }

.chat-audio__wave {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  flex: 1 1 auto;
}
.chat-audio__wave i {
  width: 2.5px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
  opacity: .55;
}
.chat-audio__wave i:nth-child(2n) { height: 12px; }
.chat-audio__wave i:nth-child(3n) { height: 16px; }
.chat-audio__wave i:nth-child(5n) { height: 9px; }
.chat-audio.is-playing .chat-audio__wave i {
  animation: chatWave .9s ease-in-out infinite;
}
.chat-audio.is-playing .chat-audio__wave i:nth-child(2n) { animation-delay: .12s; }
.chat-audio.is-playing .chat-audio__wave i:nth-child(3n) { animation-delay: .24s; }
.chat-audio.is-playing .chat-audio__wave i:nth-child(4n) { animation-delay: .36s; }
@keyframes chatWave {
  0%, 100% { transform: scaleY(.55); opacity: .5; }
  50% { transform: scaleY(1.35); opacity: 1; }
}
.chat-audio__time {
  font-size: 10px;
  opacity: .8;
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- cảm xúc --- */
.chat-reacts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}
.chat-react {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--t-border, rgba(255, 255, 255, .14));
  background: var(--t-card-1, #201c2b);
  border-radius: 999px;
  padding: 1px 7px 1px 5px;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  animation: chatReactIn .2s cubic-bezier(.2, 1.5, .4, 1) both;
}
.chat-react:hover { transform: translateY(-1px) scale(1.04); }
.chat-react.is-mine {
  background: rgba(0, 132, 255, .22);
  border-color: rgba(0, 132, 255, .7);
}
.chat-react__em { font-size: 12px; line-height: 1; }
.chat-react__n {
  font-size: 10px;
  font-weight: 800;
  color: var(--t-text, #f5f3ff);
  font-variant-numeric: tabular-nums;
}
@keyframes chatReactIn {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: scale(1); }
}

/* --- bong bóng "đang nhập" --- */
#panelChat .chat-typing-bubble {
  display: inline-flex;
  align-items: center;
  padding: 11px 14px;
  min-height: 34px;
}
.chat-typing { display: inline-flex; gap: 4px; align-items: center; height: 6px; }
.chat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--t-muted, #9d9daa);
  display: block;
  animation: chatTypingBounce 1.25s ease-in-out infinite;
}
.chat-typing i:nth-child(2) { animation-delay: .16s; }
.chat-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes chatTypingBounce {
  0%, 70%, 100% { transform: translateY(0); opacity: .45; }
  35% { transform: translateY(-4px); opacity: 1; }
}
.chat-msg--typing { animation: chatMsgIn .24s ease both; pointer-events: none; }

@keyframes chatFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =====================================================================
 *  7. KHUNG SOẠN TIN
 * ===================================================================== */
.chat-composer-wrap {
  position: relative;
  z-index: 6;
  background: var(--t-panel, #15121d);
  border-top: 1px solid var(--t-border, rgba(255, 255, 255, .09));
  padding-top: 2px;
}

/* thanh trả lời */
.chat-replybar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 10px 0;
  padding: 7px 10px 7px 8px;
  border-radius: 12px;
  background: var(--t-soft, rgba(255, 255, 255, .07));
  animation: chatSlideUp .2s cubic-bezier(.2, .8, .2, 1) both;
}
.chat-replybar__line {
  width: 3px;
  align-self: stretch;
  border-radius: 3px;
  background: #0084ff;
  flex: 0 0 3px;
}
.chat-replybar__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
.chat-replybar__name {
  font-size: 10.5px;
  font-weight: 800;
  color: #6fb6ff;
}
.chat-replybar__text {
  font-size: 11.5px;
  color: var(--t-muted, #8b8b93);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-replybar__x {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--t-muted, #8b8b93);
  cursor: pointer;
  font-size: 13px;
  flex: 0 0 24px;
  transition: background .14s ease, color .14s ease;
}
.chat-replybar__x:hover { background: var(--t-soft-2, rgba(255, 255, 255, .14)); color: var(--t-text, #fff); }

/* thanh tải lên / ghi âm */
.chat-uploadbar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 10px 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0, 132, 255, .12);
  border: 1px solid rgba(0, 132, 255, .3);
  font-size: 11.5px;
  color: #b9dcff;
  animation: chatSlideUp .2s ease both;
}
.chat-uploadbar__spin {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25);
  border-top-color: #4aa8ff;
  animation: chatSpin .8s linear infinite;
  flex: 0 0 13px;
}
.chat-uploadbar__text { flex: 0 0 auto; }
.chat-uploadbar__track {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  overflow: hidden;
}
.chat-uploadbar__track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0084ff, #4fc3ff);
  transition: width .25s ease;
}

@keyframes chatSpin { to { transform: rotate(360deg); } }
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ghi âm */
.chat-recording {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.chat-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff2d55;
  animation: chatRecPulse 1.1s ease-in-out infinite;
  flex: 0 0 9px;
}
@keyframes chatRecPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.8); }
}
.chat-rec-time {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #ffd4dd;
  flex: 0 0 auto;
}
.chat-rec-hint { flex: 1 1 auto; opacity: .85; }
.chat-rec-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .14s ease;
}
.chat-rec-btn:hover { background: rgba(255, 255, 255, .2); }
.chat-rec-btn--send { background: #0084ff; border-color: #0084ff; }
.chat-rec-btn--send:hover { filter: brightness(1.1); }

/* hàng soạn tin */
.chat-composer {
  align-items: flex-end;
  gap: 6px;
  padding: 9px 10px 11px;
  border-top: 0;
}
.chat-plus-btn { transition: transform .18s cubic-bezier(.2, 1.4, .4, 1), background .14s ease; }
.chat-plus-btn:hover { transform: rotate(90deg); }

.chat-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 2px 4px 2px 13px;
  border-radius: 21px;
  background: var(--t-soft, rgba(255, 255, 255, .08));
  border: 1px solid transparent;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.chat-input-wrap:focus-within {
  border-color: rgba(0, 132, 255, .55);
  background: var(--t-soft-2, rgba(255, 255, 255, .11));
  box-shadow: 0 0 0 3px rgba(0, 132, 255, .12);
}
.chat-input-wrap textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 34px;
  max-height: 132px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--t-text, #f5f3ff);
  font-size: 13.5px;
  line-height: 1.45;
  padding: 8px 0;
  margin: 0;
  font-family: inherit;
  overflow-y: auto;
}
.chat-input-wrap textarea::placeholder { color: var(--t-muted, #8b8b93); }
.chat-emoji-btn {
  width: 30px;
  height: 30px;
  margin-bottom: 3px;
  background: transparent;
  font-size: 16px;
  line-height: 1;
  flex: 0 0 30px;
}
.chat-emoji-btn:hover { background: var(--t-soft-2, rgba(255, 255, 255, .12)); }

.chat-send-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  transition: transform .16s cubic-bezier(.2, 1.4, .4, 1), filter .16s ease, opacity .16s ease;
  opacity: .55;
  filter: saturate(.8);
}
.chat-send-btn.is-ready {
  opacity: 1;
  filter: none;
  transform: scale(1.02);
}
.chat-send-btn.is-ready:hover { filter: brightness(1.1); }
.chat-send-btn.is-ready:active { transform: scale(.92); }

/* =====================================================================
 *  8. EMOJI / STICKER PICKER
 * ===================================================================== */
.chat-emoji-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 6px);
  z-index: 40;
  max-height: 268px;
  display: flex;
  flex-direction: column;
  background: var(--t-card-1, #1b1725);
  border: 1px solid var(--t-border, rgba(255, 255, 255, .13));
  border-radius: 16px;
  padding: 8px 6px 6px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  animation: chatPopIn .18s cubic-bezier(.2, 1.3, .4, 1) both;
  transform-origin: bottom center;
}
.chat-emoji__tabs {
  display: flex;
  gap: 4px;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--t-border, rgba(255, 255, 255, .08));
  overflow-x: auto;
  scrollbar-width: none;
}
.chat-emoji__tabs::-webkit-scrollbar { display: none; }
.chat-emoji__tab {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--t-muted, #8b8b93);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.chat-emoji__tab:hover { background: var(--t-soft, rgba(255, 255, 255, .08)); color: var(--t-text, #fff); }
.chat-emoji__tab.is-active {
  background: rgba(0, 132, 255, .18);
  color: #8ecbff;
}
.chat-emoji__grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  overflow-y: auto;
  padding: 5px 2px 2px;
  scrollbar-width: thin;
}
.chat-emoji__item {
  border: 0;
  background: transparent;
  font-size: 19px;
  line-height: 1;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .12s ease, background .14s ease;
}
.chat-emoji__item:hover { background: var(--t-soft-2, rgba(255, 255, 255, .12)); transform: scale(1.18); }
.chat-emoji__item:active { transform: scale(.94); }

/* =====================================================================
 *  9. BẢNG ĐÍNH KÈM
 * ===================================================================== */
.chat-attach-sheet {
  position: absolute;
  left: 10px;
  bottom: calc(100% + 6px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  background: var(--t-card-1, #1b1725);
  border: 1px solid var(--t-border, rgba(255, 255, 255, .13));
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  animation: chatPopIn .18s cubic-bezier(.2, 1.3, .4, 1) both;
  transform-origin: bottom left;
}
.chat-attach__item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--t-text, #f5f3ff);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  padding: 9px 10px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .14s ease;
}
.chat-attach__item:hover { background: var(--t-soft, rgba(255, 255, 255, .09)); }
.chat-attach__ic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--t-soft-2, rgba(255, 255, 255, .12));
  font-size: 14px;
  flex: 0 0 28px;
}
.chat-attach__ic .ic { width: 15px; height: 15px; }

@keyframes chatPopIn {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ẩn chắc chắn (không phụ thuộc Tailwind) */
.chat-emoji-panel.hidden,
.chat-attach-sheet.hidden,
.chat-replybar.hidden,
.chat-uploadbar.hidden,
.chat-scroll-bottom.hidden,
#chatCallIncomingActions.hidden,
.chat-empty__actions.hidden,
.chat-msg__tools.hidden { display: none !important; }
#chatImageInput.hidden,
#chatVoiceBtn.hidden { display: none !important; }

/* =====================================================================
 *  10. POPOVER CẢM XÚC + MENU TIN NHẮN
 * ===================================================================== */
.chat-popover {
  position: fixed;
  z-index: 320;
  width: 268px;
  border-radius: 18px;
  background: var(--t-card-1, #1e1a29);
  border: 1px solid var(--t-border, rgba(255, 255, 255, .13));
  box-shadow: 0 20px 48px rgba(0, 0, 0, .55);
  padding: 6px;
  opacity: 0;
  transform: translateY(6px) scale(.96);
  transition: opacity .16s ease, transform .16s cubic-bezier(.2, 1.3, .4, 1);
}
.chat-popover.is-open { opacity: 1; transform: translateY(0) scale(1); }

.chat-popover__reacts {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  padding: 3px 3px 7px;
  border-bottom: 1px solid var(--t-border, rgba(255, 255, 255, .08));
}
.chat-popover__emoji {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: transform .14s cubic-bezier(.2, 1.6, .4, 1), background .14s ease;
}
.chat-popover__emoji:hover { transform: scale(1.28) translateY(-2px); background: var(--t-soft, rgba(255, 255, 255, .1)); }
.chat-popover__emoji:active { transform: scale(.92); }

.chat-popover__menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-top: 5px;
}
.chat-popover__item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  color: var(--t-text, #f5f3ff);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .13s ease;
}
.chat-popover__item:hover { background: var(--t-soft, rgba(255, 255, 255, .09)); }
.chat-popover__item.is-danger { color: #ff9db0; }
.chat-popover__item.is-danger:hover { background: rgba(225, 29, 72, .14); }
.chat-popover__item.is-disabled,
.chat-popover__item:disabled { opacity: .42; cursor: not-allowed; }
.chat-popover__item.is-disabled:hover,
.chat-popover__item:disabled:hover { background: transparent; }

/* =====================================================================
 *  11. LIGHTBOX
 * ===================================================================== */
.chat-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(4, 5, 10, .92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: chatFadeIn .18s ease both;
}
.chat-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  animation: chatLightboxIn .24s cubic-bezier(.2, .8, .2, 1) both;
}
.chat-lightbox.is-closing { opacity: 0; transition: opacity .16s ease; }
.chat-lightbox__x {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background .14s ease;
}
.chat-lightbox__x:hover { background: rgba(255, 255, 255, .24); }
@keyframes chatLightboxIn {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: scale(1); }
}

/* =====================================================================
 *  12. KHUNG GỌI (WebRTC)
 * ===================================================================== */
.chat-call { z-index: 300; }
.chat-call__card {
  position: relative;
  max-width: 380px;
  padding: 26px 22px 20px;
  border-radius: 26px;
  background: linear-gradient(175deg, #1b1726, #131019);
  border: 1px solid var(--t-border, rgba(255, 255, 255, .12));
  box-shadow: 0 26px 70px rgba(0, 0, 0, .6);
  animation: chatPopIn .24s cubic-bezier(.2, 1.2, .4, 1) both;
  overflow: hidden;
}
.chat-call.is-video .chat-call__card { max-width: 460px; }

.chat-call__head { position: relative; z-index: 2; text-align: center; }
.chat-call__ring {
  width: 92px;
  height: 92px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .06);
}
.chat-call__name { font-size: 17px; font-weight: 800; }
.chat-call__state { font-size: 12.5px; color: var(--t-muted, #8b8b93); margin-top: 4px; }
.chat-call__duration {
  display: none;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, .55);
  margin-top: 4px;
}
.chat-call__duration.is-live { display: block; color: #5ee08b; }
.chat-call__note {
  font-size: 11px;
  line-height: 1.5;
  color: #ffcca8;
  margin-top: 10px;
  padding: 0 6px;
  min-height: 0;
}
.chat-call__note.is-visible {
  background: rgba(255, 176, 102, .1);
  border: 1px solid rgba(255, 176, 102, .28);
  border-radius: 10px;
  padding: 7px 10px;
}

.chat-call__video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  background: #07070c;
  object-fit: cover;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
}
.chat-call__video.hidden { display: none !important; }
.chat-call__local {
  position: absolute;
  right: 14px;
  bottom: 92px;
  width: 96px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: #07070c;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
  z-index: 4;
  transform: scaleX(-1);
}
.chat-call__local.hidden { display: none !important; }
.chat-call__local.is-cam-off { filter: brightness(.15); }

.chat-call__people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 14px 0 0;
}
.chat-call__person {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .09);
  transition: border-color .2s ease, background .2s ease;
}
.chat-call__person.is-connected {
  background: rgba(49, 209, 88, .12);
  border-color: rgba(49, 209, 88, .45);
}
.chat-call__person em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-call__person-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b6b76;
  flex: 0 0 7px;
}
.chat-call__person.is-connected .chat-call__person-dot {
  background: #31d158;
  animation: chatOnlinePulse 2.4s ease-out infinite;
}

.chat-call__actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  transition: opacity .2s ease;
}
.chat-call__actions--incoming { gap: 42px; margin-top: 22px; }
.chat-call__actions.is-disabled { opacity: .35; pointer-events: none; }
.chat-call__btn--accept { background: #22c55e !important; color: #fff; }
.chat-call__btn--end { transform: rotate(135deg); }
.chat-call__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .5);
  cursor: pointer;
  font-size: 13px;
  transition: background .14s ease, color .14s ease;
  z-index: 5;
}
.chat-call__close:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.chat-call.is-incoming .chat-call__ring {
  animation: chatCallIncomingPulse 1.7s ease-out infinite;
}
.chat-call.is-connected .chat-call__ring { animation: none; }
.chat-call.is-connected .chat-call__state { color: #5ee08b; }
@keyframes chatCallIncomingPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); }
  100% { box-shadow: 0 0 0 26px rgba(34, 197, 94, 0); }
}

/* chọn người cho cuộc gọi nhóm */
.chat-call--picker .chat-call__card { max-width: 360px; }
.chat-call__picklist {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 14px 0 4px;
  max-height: 236px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-call__pick {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .14s ease;
  font-size: 12.5px;
  font-weight: 600;
}
.chat-call__pick:hover { background: rgba(255, 255, 255, .07); }
.chat-call__pick input { accent-color: #0084ff; width: 15px; height: 15px; }
.chat-call__pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-call__pickactions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.chat-call__btn--text {
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, .1);
  color: #f5f3ff;
  cursor: pointer;
  transition: filter .14s ease, background .14s ease;
}
.chat-call__btn--text:hover { background: rgba(255, 255, 255, .18); }
.chat-call__btn--text.is-primary { background: #0084ff; color: #fff; }
.chat-call__btn--text.is-primary:hover { filter: brightness(1.1); }

/* =====================================================================
 *  13. BADGE TIN CHƯA ĐỌC TRÊN NÚT CHAT
 * ===================================================================== */
#chatOpenBtn { position: relative; }
#chatOpenBtn.has-unread .ic { animation: chatBellSwing 2.2s ease-in-out infinite; }
.chat-open-badge {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff2d55;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--t-bg, #0d0b12), 0 2px 8px rgba(255, 45, 85, .5);
  pointer-events: none;
  z-index: 3;
}
.chat-open-badge.is-pulse { animation: chatBadgePulse 1.8s ease-in-out infinite; }

@keyframes chatBadgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px var(--t-bg, #0d0b12), 0 2px 8px rgba(255, 45, 85, .45); }
  50% { transform: scale(1.12); box-shadow: 0 0 0 2px var(--t-bg, #0d0b12), 0 0 0 6px rgba(255, 45, 85, .18); }
}
@keyframes chatBellSwing {
  0%, 84%, 100% { transform: rotate(0); }
  88% { transform: rotate(-9deg); }
  92% { transform: rotate(8deg); }
  96% { transform: rotate(-5deg); }
}

/* =====================================================================
 *  14. MÀN HẸP
 * ===================================================================== */
@media (max-width: 720px) {
  #screenChat #panelChat { height: auto; max-height: calc(100dvh - 120px); min-height: 380px; }
  .chat-msg__body { max-width: 84%; }
  .chat-emoji__grid { grid-template-columns: repeat(8, 1fr); }
  .chat-composer { padding: 7px 8px 9px; gap: 4px; }
  .chat-emoji-panel { max-height: 230px; }
  .chat-img-grid { max-width: 260px; }
  .chat-call__card { max-width: 100%; }
  .chat-call__local { width: 82px; height: 62px; bottom: 88px; }
}

@media (max-width: 380px) {
  .chat-emoji__grid { grid-template-columns: repeat(7, 1fr); }
  .chat-thread-name { font-size: 13.5px; }
  .chat-msg__body { max-width: 88%; }
}

/* =====================================================================
 *  15. TÔN TRỌNG prefers-reduced-motion
 * ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  #screenChat *,
  #screenChat *::before,
  #screenChat *::after,
  #chatCallOverlay *,
  #chatCallOverlay *::before,
  #chatCallOverlay *::after,
  .chat-popover,
  .chat-lightbox,
  .chat-open-badge {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .chat-msg,
  .chat-msg.is-enter,
  .chat-msg--typing,
  #chatThreadView.is-open { animation: none !important; }
}
