/* ============================================================
   chat-common.css —— 聊天三视图（首页/群组/私聊）公共样式
   包含：主题变量、reset、body、Toast、输入栏、语音、图片、
   录音浮层、抽屉、长按菜单、弹窗、深色适配等公共部分。
   ============================================================ */
/*@media (max-width: 576px) {
    .modal-dialog {
    padding: 12px;
    }*/
:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --bg: #f0f2f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-2: #666666;
  --text-3: #9aa0a6;
  --border: #ececec;
  --online: #22c55e;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* 聊天气泡公共颜色（群聊/私聊统一） */
  --bubble-mine: #d7e3ff;
  --bubble-mine-dark: #2b5278;
}

[data-theme="dark"] {
  --primary: #8a9bff;
  --primary-dark: #a5b4ff;
  --bg: #0e1621;
  --surface: #17212b;
  --text: #f5f5f5;
  --text-2: #a8b3bf;
  --text-3: #6c7883;
  --border: #2b3a4a;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color: var(--text);
}

/* ===== 未读消息提示 ===== */
.unread-badge {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: .82rem;
  cursor: pointer;
  z-index: 200;
  display: none;
  box-shadow: 0 2px 8px rgba(102,126,234,.35);
  animation: unreadBounce .4s ease;
}
.unread-badge.show { display: block; }
@keyframes unreadBounce {
  0%   { transform: translateX(-50%) scale(.8); opacity: 0; }
  60%  { transform: translateX(-50%) scale(1.08); }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ===== Toast ===== */
.toast-msg {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.2rem;
  border-radius: 24px;
  color: #fff;
  font-size: .85rem;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  transition: opacity .25s, transform .25s;
}
.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-msg .toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.toast-msg.error { background: #dc3545; }
.toast-msg.info { background: var(--primary); }
.toast-msg.success { background: #28a745; }

/* ===== 长按消息菜单 ===== */
.msg-context-menu {
  position: fixed; z-index: 99999;
  background: var(--surface); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.16);
  min-width: 132px; padding: 6px 0; display: none;
  pointer-events: auto;
  -webkit-user-select: none; user-select: none;
}
.msg-context-menu.show { display: block; }
.msg-context-menu .menu-item {
  padding: 10px 20px; font-size: .9rem; cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background .15s; color: var(--text); user-select: none;
}
.msg-context-menu .menu-item:hover { background: rgba(102,126,234,.08); }
.msg-context-menu .menu-item.danger { color: #e74c3c; }
.msg-context-menu .menu-item i { font-size: 1rem; width: 18px; text-align: center; }

/* ===== 转发/提及抽屉（左侧滑出，群组 + 私信多选） ===== */
.mention-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,.3); z-index: 300;
  display: none; opacity: 0; transition: opacity .25s;
}
.mention-overlay.show { display: block; opacity: 1; }

.mention-drawer {
  position: fixed; top: 0; left: 0; width: 75%; max-width: 320px;
  height: calc(100% - 60px);
  background: var(--surface); z-index: 301;
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .25s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,.12);
}
.mention-drawer.show { transform: translateX(0); }
.mention-drawer .md-header {
  padding: .75rem 1rem; background: var(--primary); color: #fff;
  font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: .5rem;
  flex-shrink: 0;
}
.mention-drawer .md-header .md-close {
  margin-left: auto; background: none; border: none; color: #fff;
  font-size: 1.3rem; cursor: pointer; padding: 0 4px;
}
.mention-drawer .md-search {
  padding: .6rem .75rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.mention-drawer .md-search input {
  width: 100%; border: 1px solid #e3e5e8; border-radius: 8px;
  padding: .45rem .6rem; font-size: .85rem; outline: none; background: var(--surface); color: var(--text);
}
.mention-drawer .md-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.mention-drawer .md-list .md-section {
  padding: .5rem .75rem .35rem; font-size: .72rem; font-weight: 600;
  color: var(--text-3); letter-spacing: .02em; position: sticky; top: 0;
  background: var(--surface); z-index: 1;
}
.mention-drawer .md-list .md-item {
  display: flex; align-items: center; padding: .55rem .75rem; gap: .5rem;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s;
}
.mention-drawer .md-list .md-item:active { background: rgba(102,126,234,.06); }
.mention-drawer .md-list .md-item.selected { background: rgba(102,126,234,.1); }
.mention-drawer .md-list .md-item.mentioned { background: rgba(0,0,0,.03); color: var(--text-3); }
.mention-drawer .md-list .md-item .md-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 600; flex-shrink: 0; overflow: hidden;
}
.mention-drawer .md-list .md-item .md-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mention-drawer .md-list .md-item .md-name { flex: 1; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-drawer .md-list .md-item .md-remark { font-size: .72rem; color: var(--text-3); margin-left: .35rem; flex-shrink: 0; }
.mention-drawer .md-list .md-item .md-count { display: flex; align-items: center; gap: 3px; font-size: .68rem; color: var(--text-3); flex-shrink: 0; }
.mention-drawer .md-list .md-item .md-count i { font-size: .68rem; }
.mention-drawer .md-list .md-item .md-check { color: var(--primary); font-size: .9rem; display: none; }
.mention-drawer .md-list .md-item.selected .md-check { display: inline; }
.mention-drawer .md-footer {
  padding: .6rem .75rem; border-top: 1px solid var(--border);
  display: flex; gap: .5rem; flex-shrink: 0;
}
.mention-drawer .md-footer button {
  flex: 1; padding: .45rem; border-radius: 8px; border: none; font-size: .85rem; cursor: pointer;
}
.mention-drawer .md-footer .btn-confirm { background: var(--primary); color: #fff; }
.mention-drawer .md-footer .btn-cancel { background: rgba(0,0,0,.05); color: var(--text-2); }

/* ===== 全屏图片查看器 ===== */
.img-viewer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .92);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.img-viewer-overlay.show { display: flex; }
.img-viewer-overlay .img-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 2002;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.img-viewer-overlay .img-viewer-save {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 24px;
  background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 20px;
  color: #fff;
  font-size: .9rem;
  cursor: pointer;
  z-index: 2002;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.img-viewer-overlay .img-viewer-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.img-viewer-overlay .img-viewer-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* ===== 引用文字完整查看 ===== */
.quote-text-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.quote-text-overlay.show { display: flex; }
.quote-text-overlay .quote-text-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 2002;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quote-text-overlay .quote-text-panel {
  background: rgba(0, 0, 0, .6);
  color: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  max-width: 90vw;
  max-height: 70vh;
  overflow-y: auto;
  font-size: .95rem;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ===== 录音浮层 ===== */
.record-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.record-overlay.show { display: flex; }
.record-panel {
  background: rgba(40, 40, 40, .92);
  border-radius: 20px;
  padding: 30px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 180px;
}
.record-mic-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ef5350;
  animation: pulse-mic 1.2s ease-in-out infinite;
}
@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 83, 80, .5); }
  50% { box-shadow: 0 0 0 14px rgba(239, 83, 80, 0); }
}
.record-live-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 36px;
}
.record-live-wave .bar {
  width: 3px;
  background: #66bb6a;
  border-radius: 2px;
  transition: height .5s ease;
}
.record-time-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.record-hint-text {
  font-size: .75rem;
  color: rgba(255, 255, 255, .5);
}

/* ===== 底部输入栏 ===== */
.chat-footer {
  background: var(--surface);
  padding: .5rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .04);
  padding-bottom: calc(.5rem + var(--safe-bottom));
}
.chat-footer .plus-btn,
.chat-footer .voice-toggle-btn {
  font-size: 1.4rem;
  background: none;
  border: none;
  padding: 4px;
  min-width: 36px;
  color: #888;
  cursor: pointer;
  line-height: 1;
  position: relative;
}
.chat-footer .voice-toggle-btn.active { color: var(--primary); }
.chat-footer .msg-input {
  flex: 1;
  border: 1px solid #e3e5e8;
  border-radius: 22px;
  padding: .55rem 1rem;
  font-size: .95rem;
  outline: none;
  resize: none;
  max-height: 100px;
  min-height: 42px;
  line-height: 1.4;
  overflow-y: auto;
  background: #f7f8fa;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.chat-footer .msg-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}
.chat-footer .msg-input:empty:before {
  content: attr(placeholder);
  color: #aaa;
  pointer-events: none;
}
.chat-footer .msg-input.muted-input {
  background: #eef0f3;
  color: #9aa0a6;
  cursor: not-allowed;
}
.chat-footer .msg-input.muted-input:empty:before {
  content: attr(placeholder);
  color: #bbb;
  pointer-events: none;
}
.chat-footer .send-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(102, 126, 234, .35);
  margin-top: 2px;
}
.chat-footer .send-btn:active { transform: scale(.92); }
.chat-footer .send-btn.sending {
  pointer-events: none;
  opacity: .7;
}
.chat-footer .send-btn .btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* + 号按钮包裹层（群聊/私聊共用，视觉统一） */
.plus-wrap { position: relative; }

/* + 号弹出菜单 */
.plus-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  padding: 8px;
  margin-bottom: 8px;
  z-index: 100;
  min-width: 150px;
}
.plus-menu.show { display: block; }
.plus-menu .plus-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text);
  white-space: nowrap;
}
.plus-menu .plus-menu-item:active { background: rgba(102, 126, 234, .08); }
.plus-menu .plus-menu-item .plus-icon { font-size: 1.3rem; width: 24px; text-align: center; }

/* ===== 语音录音区 ===== */
.voice-record-area {
  display: none;
  flex: 1;
  align-items: center;
  gap: 1px;
}
.voice-record-area.show { display: flex; }
.voice-record-btn {
  flex: 1;
  height: 42px;
  border: 1px solid #e3e5e8;
  border-radius: 22px;
  background: #f7f8fa;
  font-size: .95rem;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.voice-record-btn.recording {
  background: #ffebee;
  border-color: #ef5350;
  color: #ef5350;
  animation: pulse-record 1.5s infinite;
}
@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 83, 80, .4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 83, 80, 0); }
}
.voice-record-btn.has-record {
  background: #e8f5e9;
  border-color: #66bb6a;
  color: #333;
  gap: 4px;
  cursor: pointer;
}
.voice-record-btn .mini-wave {
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 18px;
}
.voice-record-btn .mini-wave .bar {
  width: 2px;
  background: #66bb6a;
  border-radius: 2px;
  transition: height .1s;
}
.voice-record-btn .mini-wave.animating .bar {
  animation: wave-bounce .6s ease-in-out infinite;
}
.voice-record-btn .mini-wave.animating .bar:nth-child(odd) { animation-delay: .2s; }
.voice-record-btn .preview-timer {
  font-size: .75rem;
  color: #999;
  flex-shrink: 0;
}
.chat-footer .voice-cancel-btn {
  font-size: 1.8rem;
  background: none;
  border: none;
  height: 42px;
  min-width: 45px;
  color: #ef5350;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.chat-footer .voice-cancel-btn.show { display: inline-flex; }

/* ===== 语音消息气泡 ===== */
.voice-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 70px;
  max-width: 200px;
  padding: 2px 0;
  cursor: pointer;
  height: 20px;
}
.voice-bubble .voice-wave {
  flex: 1;
  height: 18px;
  display: flex;
  align-items: center;
  gap: 1.5px;
}
.voice-bubble .voice-wave .bar {
  width: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: height .1s;
}
.voice-bubble .voice-wave.animating .bar {
  animation: wave-bounce .6s ease-in-out infinite;
}
.voice-bubble .voice-wave.animating .bar:nth-child(odd) { animation-delay: .2s; }
@keyframes wave-bounce {
  0%, 100% { transform: scaleY(.4); }
  50% { transform: scaleY(1); }
}
.voice-bubble .voice-duration {
  font-size: .75rem;
  color: #999;
  flex-shrink: 0;
}
.voice-bubble .voice-label {
  font-size: .75rem;
  color: #999;
  flex-shrink: 0;
}

/* ===== 上传进度条 ===== */
.upload-progress {
  display: none;
  height: 3px;
  background: #e0e0e0;
  flex-shrink: 0;
}
.upload-progress.show { display: block; }
.upload-progress .bar {
  height: 100%;
  background: var(--primary);
  width: 0;
  transition: width .2s;
}

/* ===== 图片预览面板（多图） ===== */
.image-preview-panel {
  display: none;
  align-items: center;
  background: var(--surface);
  padding: .55rem .75rem;
  border-top: 1px solid var(--border);
  gap: .5rem;
  flex-shrink: 0;
}
.image-preview-panel.show { display: flex; }
.image-preview-panel .ipp-list {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.image-preview-panel .ipp-item {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  /* 透明底图片显示棋盘格，避免透明区域和背景混成纯色 */
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.image-preview-panel .ipp-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-preview-panel .ipp-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  border: none;
  font-size: .7rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.image-preview-panel .ipp-add {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px dashed var(--text-3);
  color: var(--text-3);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
.image-preview-panel .ipp-send {
  background: var(--primary);
  border: none;
  color: #fff;
  border-radius: 16px;
  padding: .3rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.image-preview-panel .ipp-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

/* ===== 表情面板 ===== */
.emoji-panel {
  display: none;
  background: var(--surface);
  padding: .5rem;
  border-top: 1px solid var(--border);
  max-height: 50%;
  overflow-y: auto;
  flex-shrink: 0;
}
.emoji-panel.show {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.emoji-panel .emo {
  font-size: 1.5rem;
  text-align: center;
  padding: 6px 0;
  cursor: pointer;
  border-radius: 8px;
  transition: background .1s;
}
.emoji-panel .emo:active {
  background: rgba(102, 126, 234, .08);
}

/* ===== 回复引用条 ===== */
.reply-bar {
  display: none;
  align-items: center;
  background: var(--surface);
  padding: .55rem .75rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  gap: .5rem;
  flex-shrink: 0;
}
.reply-bar.show { display: flex; }
.reply-bar .reply-icon { color: var(--primary); font-size: .9rem; flex-shrink: 0; }
.reply-bar .reply-body { flex: 1; min-width: 0; overflow: hidden; }
.reply-bar .reply-nick { font-weight: 600; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar .reply-text { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar .reply-close { color: var(--text-3); cursor: pointer; font-size: 1.1rem; padding: 0 4px; background: none; border: none; flex-shrink: 0; }
.reply-bar .reply-thumb { background-color: #fff; background-image: linear-gradient(45deg, #d0d0d0 25%, transparent 25%), linear-gradient(-45deg, #d0d0d0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d0d0d0 75%), linear-gradient(-45deg, transparent 75%, #d0d0d0 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }

/* ===== 气泡内引用条（公共部分） ===== */
.quote-bar {
  background: rgba(0, 0, 0, .05);
  border-left: 3px solid var(--primary);
  padding: .35rem .5rem;
  margin-bottom: .4rem;
  border-radius: 4px;
  font-size: .78rem;
  max-width: 100%;
  overflow: hidden;
}
.quote-bar .quote-nick { color: var(--primary); font-weight: 600; font-size: .72rem; margin-bottom: 1px; }
.quote-bar .quote-text { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.quote-bar .quote-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; margin: 2px 0; display: block; cursor: pointer; background-color: #fff; background-image: linear-gradient(45deg, #d0d0d0 25%, transparent 25%), linear-gradient(-45deg, #d0d0d0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d0d0d0 75%), linear-gradient(-45deg, transparent 75%, #d0d0d0 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.quote-bar .voice-bubble { cursor: pointer; margin: 2px 0; }
.quote-bar.revoked { border-left-color: var(--text-3); opacity: .7; }
.quote-bar.revoked .quote-text { color: var(--text-3); font-style: italic; }
.quote-bar.revoked .quote-thumb { opacity: .4; }

/* ===== 自己气泡（蓝底）内的引用条（群聊/私聊共用，视觉统一） ===== */
.chat-msg.mine .quote-bar {
  background: rgba(102, 126, 234, .16);
  border-left-color: #5568d3;
}
.chat-msg.mine .quote-bar .quote-nick { color: #4a56c0; }
.chat-msg.mine .quote-bar .quote-text { color: #4a5580; }
[data-theme="dark"] .chat-msg.mine .quote-bar {
  background: rgba(255, 255, 255, .12);
  border-left-color: #8a9bff;
}
[data-theme="dark"] .chat-msg.mine .quote-bar .quote-nick { color: #c9d7ff; }
[data-theme="dark"] .chat-msg.mine .quote-bar .quote-text { color: #b8c4e0; }

/* ===== 时间分隔符 ===== */
.time-separator {
  text-align: center;
  padding: .6rem 0 .3rem;
  margin-bottom: 6px;
  font-size: .7rem;
  color: var(--text-3);
}

/* ===== 系统提示消息 ===== */
.sys-msg {
  text-align: center;
  padding: .3rem 0;
  margin-bottom: 6px;
  font-size: .72rem;
  color: var(--text-3);
}
.sys-msg span {
  display: inline-block;
  background: rgba(0, 0, 0, .05);
  border-radius: 10px;
  padding: 3px 12px;
  max-width: 90%;
  word-break: break-all;
}

/* ===== 通用棋盘格底（透明头像/图片） ===== */
.checker-bg {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

/* ===== 聊天顶栏（群聊/私聊共用，视觉统一） ===== */
.chat-header {
  background: var(--surface);
  padding: .68rem .9rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header .back-btn {
  font-size: 1.3rem;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 4px;
  min-width: 36px;
  cursor: pointer;
}

/* ===== 聊天气泡（群聊/私聊共用，视觉统一） ===== */
.bubble {
  background: var(--surface);
  border-radius: 12px 16px 16px 2px;
  padding: .55rem .85rem;
  font-size: .9rem;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.bubble .text {
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* ===== 图片消息（群聊/私聊共用，视觉统一，180px） ===== */
.bubble .msg-img {
  display: block;
  max-width: 180px;
  max-height: 180px;
  border-radius: 10px;
  cursor: pointer;
  object-fit: cover;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  pointer-events: auto;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.bubble .msg-img.img-loading {
  min-width: 120px;
  min-height: 80px;
}
.chat-msg.mine .bubble {
  background: var(--bubble-mine);
  border-radius: 16px 16px 2px 16px;
}
[data-theme="dark"] .chat-msg.mine .bubble {
  background: var(--bubble-mine-dark);
}

/* ===== 聊天头像（群聊/私聊共用，视觉统一） ===== */
.chat-msg .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-msg .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==================== 按钮颜色统一 ==================== */
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-secondary {
  background-color: #eef0f4;
  border-color: #eef0f4;
  color: #4a4f57;
}
.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
  background-color: #e2e5ea;
  border-color: #e2e5ea;
  color: #4a4f57;
}
[data-theme="dark"] .btn-secondary {
  background-color: #2b3a4a;
  border-color: #2b3a4a;
  color: #a8b3bf;
}
[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-secondary:focus,
[data-theme="dark"] .btn-secondary:active {
  background-color: #33465a;
  border-color: #33465a;
  color: #f5f5f5;
}
[data-theme="dark"] .btn-danger {
  background-color: #ff6b6b;
  border-color: #ff6b6b;
}
[data-theme="dark"] .btn-danger:hover,
[data-theme="dark"] .btn-danger:focus,
[data-theme="dark"] .btn-danger:active {
  background-color: #ff8585;
  border-color: #ff8585;
}

/* ==================== 弹窗圆角 + 深色适配 ==================== */
.modal-content {
  border-radius: 14px;
  overflow: hidden;
}
[data-theme="dark"] .modal-content {
  background: #17212b;
  color: #f5f5f5;
  border-color: #2b3a4a;
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: #2b3a4a;
}
[data-theme="dark"] .modal-title {
  color: #f5f5f5;
}
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
[data-theme="dark"] .form-control {
  background: #232e3c;
  border-color: #2b3a4a;
  color: #f5f5f5;
}
[data-theme="dark"] .form-control:focus {
  background: #232e3c;
  border-color: #8a9bff;
  color: #f5f5f5;
  box-shadow: 0 0 0 3px rgba(138, 155, 255, .15);
}
[data-theme="dark"] .form-control::placeholder {
  color: #6c7883;
}
[data-theme="dark"] .modal .text-muted {
  color: #a8b3bf !important;
}

/* ==================== 输入框/语音 深色适配 ==================== */
[data-theme="dark"] .chat-footer .msg-input {
  background: #232e3c;
  border-color: #2b3a4a;
  color: #f5f5f5;
}
[data-theme="dark"] .chat-footer .msg-input:focus {
  background: #232e3c;
  border-color: #8a9bff;
  box-shadow: 0 0 0 3px rgba(138, 155, 255, .15);
}
[data-theme="dark"] .chat-footer .msg-input:empty:before {
  color: #6c7883;
}
[data-theme="dark"] .chat-footer .msg-input.muted-input {
  background: #1c2733;
  color: #6c7883;
}
[data-theme="dark"] .voice-record-btn {
  background: #232e3c;
  border-color: #2b3a4a;
  color: #a8b3bf;
}
[data-theme="dark"] .voice-record-btn.has-record {
  background: #1e3a2a;
  border-color: #2f6b3c;
  color: #d4e8da;
}
[data-theme="dark"] .mention-drawer .md-search input {
  background: #232e3c;
  border-color: #2b3a4a;
  color: #f5f5f5;
}
