/* 02-mention-item.css（style.css 拆分片段，按顺序加载）
 * 主要类：emoji-grid、mention-hint、mention-item、mention-role、mention-empty、msg、msg-act、day-divider
 */

.emoji-grid button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text);
  font-size: 21px;
  line-height: 1;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, transform .12s;
}
.emoji-grid button:hover { background: var(--panel-soft); transform: scale(1.12); }
.emoji-grid button:active { transform: scale(.96); }

/* @候选列表：同样是悬浮弹层 */
.mention-hint {
  position: absolute;
  bottom: 62px;
  left: 14px;
  width: 260px;
  max-width: calc(100vw - 28px);
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 5px;
  z-index: 31;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  font-size: 13px;
  padding: 7px 9px;
  border: none;
  background: none;
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
}
.mention-item b { color: var(--brand); }
.mention-item.active,
.mention-item:hover { background: var(--brand-soft); }
.mention-role {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}
.mention-empty { padding: 9px 10px; font-size: 12px; color: var(--muted); }

/* 消息操作按钮（引用 / 撤回） */
.msg .msg-actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions { opacity: 1; }
.msg-act {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0 3px;
}
.msg-act:hover { color: var(--brand); }
.msg-act.revoke:hover { color: var(--danger); }

/* @ 提及候选列表 */
.mention-hint { max-height: 190px; gap: 0; }
.mention-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
}
.mention-item b { color: var(--brand); }
.mention-item.active { background: var(--brand-soft); }
.mention-role {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}
.mention-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

/* 日期分隔线 */
.day-divider {
  align-self: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-soft);
  padding: 2px 10px;
  border-radius: 999px;
  margin: 4px 0;
}

input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--panel);
  color: var(--text);
  min-width: 0;
}
input:focus { border-color: var(--brand); }
input:disabled { background: var(--panel-soft); color: var(--muted); }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  background: var(--panel);
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  padding: 18px;
  box-shadow: var(--shadow);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 17px; }
.x {
  border: none; background: none; font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}

.tabs { display: flex; gap: 6px; margin: 14px 0 12px; }
.tab {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 7px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.tab.active { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); font-weight: 600; }

.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form .row { display: flex; gap: 6px; }
.form .row input { flex: 1; }
.toggle-pw { padding: 6px 9px; line-height: 1; font-size: 14px; flex: 0 0 auto; }
.form-link { margin: 0; font-size: 12px; text-align: center; }
.form-link a { color: var(--brand); text-decoration: none; }
.form-link a:hover { text-decoration: underline; }
.form-msg { margin: 0; font-size: 12px; min-height: 18px; color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.desc { font-size: 12px; color: var(--muted); margin: 10px 0 14px; line-height: 1.6; }

/* ---------------- 轻提示 ---------------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 80;
  pointer-events: none;
}
.toast {
  background: rgba(28, 32, 40, .94);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  max-width: 88vw;
  animation: pop .18s ease-out;
}
.toast.warn { background: rgba(178, 106, 0, .95); }
.toast.err { background: rgba(200, 40, 30, .95); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- 手机端 ---------------- */
@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 38vh;
  }
  .msg { max-width: 88%; }
  .brand span { display: none; }
  .status span { display: none; }        /* 手机上门只留状态灯 */
  .member-list { display: flex; flex-wrap: wrap; gap: 2px; }
  .member { padding: 3px 8px; }
}

/* "回到最新"浮标 */
.jump-btn {
  position: absolute;
  right: 20px;
  bottom: 76px;
  z-index: 20;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--brand-line);
  background: var(--panel);
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.jump-btn:hover { background: var(--brand-soft); }

/* ============================================================
   图片消息
   ============================================================ */
.msg-image-link { display: block; margin-top: 6px; }
.msg-image {
  max-width: min(320px, 62vw);
  max-height: 320px;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  cursor: zoom-in;
  background: var(--panel-soft);
}
.msg-image:hover { opacity: .94; }

/* 手机端菜单按钮与遮罩：桌面隐藏 */
.menu-btn { display: none; }
.sidebar-mask { display: none; }

/* ============================================================
   响应式：手机 / 小平板
   ============================================================ */
@media (max-width: 780px) {
  .menu-btn { display: inline-flex; }

  /* 侧栏变成从左侧滑出的抽屉 */
  .sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: 78vw;
    max-width: 300px;
    z-index: 60;
    background: var(--panel);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform .22s ease-out;
    box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.28); }

  .sidebar-mask {
    display: block;
    position: fixed;
    inset: 52px 0 0 0;
    background: rgba(0, 0, 0, .35);
    z-index: 55;
  }

  /* 聊天区占满宽度 */
  .chat { width: 100%; }
  .messages { padding: 10px; }
  .msg { max-width: 86%; }
  .topbar { padding: 0 10px; gap: 6px; }
  .brand span { display: none; }
  .search-input { width: 92px; }

  /* 输入区更紧凑、按钮更好点 */
  .composer { padding: 8px 10px 10px; gap: 6px; }
  .composer input { font-size: 16px; }        /* ≥16px 可避免 iOS 自动放大 */
  .btn.icon { min-width: 38px; height: 38px; }

  /* 表情面板：手机上占屏幕下半部分，格子稍大 */
  .emoji-panel { height: 42vh; }
  .emoji-grid {
    grid-template-columns: repeat(auto-fill, 40px);
    grid-auto-rows: 40px;
    justify-content: space-around;
  }
  .emoji-grid button { font-size: 24px; }

  /* 弹窗铺满 */
  .modal { width: calc(100vw - 24px); max-width: 420px; }

  .msg-image { max-width: 78vw; }
}

/* 超小屏：进一步压缩 */
@media (max-width: 420px) {
  .topbar .badge { display: none; }
  .msg { max-width: 92%; }
  .emoji-grid { grid-template-columns: repeat(auto-fill, 38px); grid-auto-rows: 38px; }
}

/* ==================== 语音 / 置顶 / 投票 / 批量管理 ==================== */
.msg-audio { width: min(260px, 60vw); height: 34px; margin-top: 6px; display: block; }

.voice-hint {
  padding: 6px 16px;
  font-size: 12px;
  color: var(--danger);
  background: var(--brand-soft);
  border-top: 1px solid var(--line);
}
.btn.icon.recording {
  background: var(--danger);
  color: #fff;
  animation: rec-pulse 1s infinite;
}
@keyframes rec-pulse { 50% { opacity: .55; } }

.pinned-bar {
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  padding: 6px 12px;
  font-size: 12px;
  max-height: 132px;
  overflow-y: auto;
}
.pinned-head { color: var(--brand); font-weight: 600; margin-bottom: 2px; }
.pinned-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.pinned-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pinned-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.pinned-x:hover { color: var(--danger); }

.poll-card {
  align-self: center;
  width: min(420px, 92%);
  margin: 6px 0;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.poll-q { font-weight: 600; margin-bottom: 8px; }
.poll-opt {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 4px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  font-size: 13px;
}
.poll-opt:hover { border-color: var(--brand); }
.poll-opt.mine { border-color: var(--brand); background: var(--brand-soft); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-soft); transition: width .25s; }
.poll-label { position: relative; flex: 1; text-align: left; }
.poll-num { position: relative; color: var(--muted); font-size: 11px; }
.poll-foot { margin-top: 6px; font-size: 11px; color: var(--muted); }

.bulk-cb { margin-right: 6px; }
.room-item.bulk-off { opacity: .4; }

.btn.danger { background: var(--danger); color: #fff; }


/* ============================================================
 * 视觉层 v2（覆盖在上面所有规则之后）
 *   —— 只调整外观：配色、间距、圆角、阴影、滚动条、动效
 *   —— 不动任何类名和布局结构，所以手机端的响应式规则照旧生效
 * ============================================================ */
:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-soft: #f4f6fa;
  --line: #e4e8f0;
  --text: #171a21;
  --muted: #8a93a5;
  --brand: #3b6ff5;
  --brand-soft: #eef3ff;
  --brand-line: #d9e4ff;
  --warn: #b26a00;
  --danger: #e5484d;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(18, 24, 40, .10), 0 2px 6px rgba(18, 24, 40, .04);
  --mask: rgba(16, 20, 30, .42);
  --mine: #eef3ff;
  --mine-line: #dbe6ff;
}
html[data-theme="dark"] {
  --bg: #0f1218;
  --panel: #171b23;
  --panel-soft: #1e232d;
  --line: #272d39;
  --text: #e9ecf2;
  --muted: #8790a2;
  --brand: #6b95ff;
  --brand-soft: #1b2740;
  --brand-line: #26355160;
  --ok: #3ecf8e;
  --danger: #ff6b6b;
  --shadow: 0 14px 34px rgba(0, 0, 0, .45);
}

/* 细滚动条，不再抢视觉 */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
*::-webkit-scrollbar-track { background: transparent; }

body { letter-spacing: .1px; }

/* 顶栏 */
.topbar {
  padding: 0 18px;
  height: 56px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(18, 24, 40, .02);
}
.brand { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.brand span { color: var(--brand); font-weight: 600; }
.status { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel-soft); }
.dot { width: 7px; height: 7px; }
.badge {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  border: 1px solid transparent;
}

/* 侧栏 */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  width: 232px;
}
.sidebar-head, .members-head {
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 16px 8px;
  font-weight: 600;
}
.room-list { padding: 0 8px; }
.room-item {
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  cursor: pointer;
}