/* ============================================================
 * 04-room-item.css  （472 行）
 * style.css 的拆分片段（按顺序加载，与原来完全等价）。
 *
 * 这一片主要管这些类：
 *   · .room-item（14 处）
 *   · .msg（10 处）
 *   · .btn（8 处）
 *   · .head-btn（7 处）
 *   · .composer（4 处）
 *   · .modal（4 处）
 *   · .chat-head（3 处）
 *   · .dm-composer（3 处）
 *   · .album-cell（3 处）
 *   · .global-item（3 处）
 *   · .packet（3 处）
 *   · .packet-mid（3 处）
 *   · .rx-picker（2 处）
 *   · .lightbox（2 处）
 *   · .pinned-bar（2 处）
 *   · .pinned-clear（2 处）
 *   · .pinned-item（2 处）
 *   · .pinned-text（2 处）
 * ============================================================ */
.rx-picker button { border: none; background: none; font-size: 15px; cursor: pointer; padding: 0 2px; border-radius: 50%; }
.rx-picker button:hover { transform: scale(1.25); }
.edited-tag { font-size: 10px; color: var(--muted); margin-left: 4px; }

/* ==================== 图片灯箱 ==================== */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .86);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; cursor: zoom-out;
  animation: lb-in .15s ease-out;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 92vw; max-height: 84vh;
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  cursor: default;
}
.lightbox-tip { color: rgba(255, 255, 255, .7); font-size: 12px; }

/* ============================================================
   关键修复：这些横条绝对不能被 flex 压扁
   .chat 是纵向 flex 容器，子元素默认 flex-shrink:1，
   一旦总高度超出，置顶栏/公告栏会被压缩到十几像素，
   结果就是"看不到置顶内容、也点不到取消按钮"。
   ============================================================ */
.chat-head,
.announce-bar,
.pinned-bar,
.quote-bar,
.system-bar,
.voice-hint,
.composer,
.emoji-panel {
  flex: 0 0 auto;
}
/* 置顶栏本身可以滚动，但至少保证 34px 高 */
.pinned-bar { min-height: 34px; }

/* 置顶项：可点、可读 */
.pinned-head { display: flex; align-items: center; gap: 8px; }
.pinned-clear {
  margin-left: auto; border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 11px; padding: 0 4px;
}
.pinned-clear:hover { color: var(--danger); }
.pinned-item { border-radius: 6px; }
.pinned-item:hover { background: var(--panel-soft); }
.pinned-text { cursor: pointer; }
.pinned-text:hover { color: var(--brand); }
.msg.flash { animation: msg-flash 1.2s ease-out; }
@keyframes msg-flash {
  0% { box-shadow: 0 0 0 3px var(--brand); }
  100% { box-shadow: 0 0 0 0 transparent; }
}


/* ============================================================
   视觉 v3 —— 往微信/QQ 那种干净圆润的方向调
   · 浅灰底 + 白卡片，弱化边框、强调留白
   · 自己的消息用绿色气泡（右），别人的白气泡（左）
   · 顶部标题居中、输入条更轻
   ============================================================ */
:root {
  --bg: #ededed;
  --panel: #ffffff;
  --panel-soft: #f7f7f7;
  --line: #e5e5e5;
  --text: #191919;
  --muted: #9a9a9a;
  --brand: #07c160;             /* 微信绿 */
  --brand-soft: #eafaf1;
  --brand-line: #cdeedb;
  --mine: #95ec69;              /* 自己的气泡 */
  --mine-line: #8ade63;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .10);
}
html[data-theme="dark"] {
  --bg: #111111;
  --panel: #1e1e1e;
  --panel-soft: #272727;
  --line: #333333;
  --text: #ececec;
  --muted: #8d8d8d;
  --brand: #07c160;
  --brand-soft: #16301f;
  --brand-line: #1f4a30;
  --mine: #3a6b3f;
  --mine-line: #417a47;
}

/* 顶栏：更轻、标题居中感 */
.topbar {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.brand { font-weight: 700; letter-spacing: -.3px; }
.status { background: var(--panel-soft); }

/* 聊天区头部 */
.chat-head { background: var(--panel); height: 52px; }
.chat-head strong { font-size: 15.5px; font-weight: 600; }
.head-btn {
  border: 1px solid var(--line); background: var(--panel-soft);
  color: var(--muted); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.head-btn:hover { border-color: var(--brand); color: var(--brand); }

/* 消息区：更干净的底 */
.messages {
  background: var(--bg);
  padding: 16px;
  gap: 8px;
}
.msg {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  background: var(--panel);
  max-width: min(600px, 72%);
}
.msg:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.msg .name {
  /* 这里不要写带 !important 的 color：会盖掉前端给每个人上的内联名字色 */
  font-weight: 600;
  font-size: 12.5px;
}
.msg .text { font-size: 15px; line-height: 1.6; }

/* 自己的消息：微信绿气泡，深色字 */
.msg.mine {
  background: var(--mine);
  border: none;
  border-radius: 8px;
  color: #12300f;
}
html[data-theme="dark"] .msg.mine { color: #eafce2; }
.msg.mine .name { color: rgba(0, 0, 0, .45) !important; }
html[data-theme="dark"] .msg.mine .name { color: rgba(255, 255, 255, .6) !important; }
.msg.mine .quote-block { background: rgba(255, 255, 255, .5); border-left-color: rgba(0, 0, 0, .15); }
html[data-theme="dark"] .msg.mine .quote-block { background: rgba(0, 0, 0, .2); }

/* 被 @ 的消息 */
.msg.mentioned { box-shadow: 0 0 0 2px var(--brand); }

/* 系统提示更像微信 */
.msg.system {
  background: rgba(0, 0, 0, .04);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11.5px;
  color: var(--muted);
}
html[data-theme="dark"] .msg.system { background: rgba(255, 255, 255, .06); }

/* 输入区：白条 + 圆角输入框 */
.composer {
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 10px 14px;
}
.composer input {
  background: var(--panel-soft);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
}
.composer input:focus { border-color: var(--brand); background: var(--panel); box-shadow: none; }
.btn.primary { background: var(--brand); box-shadow: none; border-radius: 8px; }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn.ghost { border-radius: 8px; }
.btn.icon { background: transparent; border-radius: 8px; width: 36px; height: 36px; }

/* 侧栏：微信的会话列表感 */
.sidebar { background: var(--panel); border-right: 1px solid var(--line); }
.sidebar-head, .members-head {
  text-transform: none; letter-spacing: 0;
  font-size: 12px; color: var(--muted); padding: 12px 14px 6px;
}
.room-item { border-radius: 6px; padding: 8px 10px; }
.room-item:hover { background: var(--panel-soft); }
.room-item.active {
  background: var(--panel-soft);
  color: var(--brand);
  font-weight: 600;
  box-shadow: none;
}
.room-item.active .rname::before {
  content: '';
  display: inline-block;
  width: 3px; height: 12px; border-radius: 2px;
  background: var(--brand); margin-right: 6px; vertical-align: -1px;
}

/* 表态用的绿色高亮统一 */
.rx-chip.mine, .poll-opt.mine, .member.me { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.announce-tag { background: var(--brand); }
.poll-opt .poll-bar, .poll-opt.mine .poll-bar { background: var(--brand-soft); }
.poll-key { border-radius: 4px; }

/* ==================== 置顶消息面板 ==================== */
.modal.pins-modal { width: 480px; max-width: calc(100vw - 24px); }
.muted-title { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 6px; }
.pins-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pin-item {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.pin-item-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.pin-item-head b { font-size: 13px; color: var(--brand); }
.pin-item-time { font-size: 11px; color: var(--muted); margin-left: auto; }
.pin-item-text { font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.pin-item-img { max-width: 160px; max-height: 160px; border-radius: 8px; cursor: zoom-in; display: block; }
.pin-item-acts { display: flex; gap: 6px; margin-top: 8px; }

/* ==================== 线条图标 ==================== */
.ico { display: block; }
.btn.icon .ico { margin: 0 auto; }
button:not(.btn) .ico { display: inline-block; vertical-align: -2px; }
.head-btn { display: inline-flex; align-items: center; gap: 4px; }
.head-btn .ico { width: 14px; height: 14px; }
#btn-jump { display: inline-flex; align-items: center; gap: 4px; }
.bulk-btn { display: inline-flex; align-items: center; gap: 4px; }
/* 按钮里的图标不要被字体撑开 */
.btn.icon { font-size: 0; }
.btn.icon .ico { font-size: initial; }

/* 带文字的按钮：图标与文字水平排列 */
.btn.block { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.bulk-btn .btn-label, .btn.block .btn-label { font-size: 14px; }

/* ==================== 房间列表：微信式会话行 ==================== */
.room-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  padding: 9px 10px;
}
.room-item .rname { grid-column: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-item .rright { grid-column: 2; display: flex; align-items: center; gap: 4px; }
.room-item .rtime { font-size: 11px; color: var(--muted); }
.room-item .rbadge {
  background: #fa5151; color: #fff; font-size: 10.5px;
  min-width: 17px; height: 17px; line-height: 17px; text-align: center;
  border-radius: 999px; padding: 0 5px; font-weight: 600;
}
.room-item .rpreview {
  grid-column: 1 / -1;
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room-item.active .rpreview { color: var(--brand); opacity: .75; }

/* 在线状态点 */
.member-dot.idle { background: #f0b429; }

/* 头像可点 */
.avatar.clickable { cursor: pointer; }
.avatar.clickable:hover { transform: scale(1.08); }

/* 用户名片 */
.modal.card-modal { width: 340px; max-width: calc(100vw - 24px); }
.card-top { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.card-avatar { width: 68px; height: 68px; flex: 0 0 auto; }
.card-info h3 { margin: 0 0 4px; font-size: 17px; }
.card-account, .card-meta { margin: 0; font-size: 12px; color: var(--muted); }

/* 全局公告条 */
.notice-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(90deg, var(--brand-soft), transparent);
  border-bottom: 1px solid var(--brand-line);
  font-size: 13px; color: var(--text);
}
.notice-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: 0 0 auto;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.notice-text { flex: 1; word-break: break-word; }
.notice-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.notice-x:hover { color: var(--text); }

/* ==================== 头像上的在线状态点 ==================== */
.avatar-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.status-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--panel);
  background: #07c160;
}
.status-dot.idle { background: #f0b429; }

/* ==================== 顶栏入口 ==================== */
.head-btn { position: relative; }
.head-btn.has-new { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.head-btn .rbadge { position: absolute; top: -6px; right: -6px; }
.ico-holder { font-size: 13px; line-height: 1; }

/* ==================== @我的消息 ==================== */
.mention-item-card {
  background: var(--panel-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.mention-item-card.unread { border-color: var(--brand-line); background: var(--brand-soft); }
.mention-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.mention-head b { color: var(--brand); font-size: 13px; }
.mention-where { font-size: 11.5px; color: var(--muted); }
.mention-text { font-size: 13.5px; margin-top: 4px; word-break: break-word; }

/* ==================== 私聊 ==================== */
.modal.dm-modal { width: 460px; max-width: calc(100vw - 24px); height: 560px; max-height: 84vh; display: flex; flex-direction: column; }
.dm-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.dm-conv {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
}
.dm-conv:hover { background: var(--panel-soft); }
.dm-conv-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-conv-mid b { font-size: 14px; }
.dm-conv-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#dm-view-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dm-head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.small-back { width: 30px; height: 30px; font-size: 18px; padding: 0; }
.dm-head-avatar { width: 34px; height: 34px; }
.dm-head-info { flex: 1; display: flex; flex-direction: column; }
.dm-head-info b { font-size: 15px; }
.dm-status { font-size: 11px; color: var(--muted); }
.dm-messages { flex: 1; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 8px; }
.dm-msg {
  align-self: flex-start; max-width: 78%;
  background: var(--panel-soft); border-radius: 10px;
  padding: 7px 11px; font-size: 14px; line-height: 1.5; word-break: break-word;
}
.dm-msg.mine { align-self: flex-end; background: var(--mine); color: #12300f; }
html[data-theme="dark"] .dm-msg.mine { color: #eafce2; }
.dm-img { max-width: 160px; border-radius: 8px; display: block; cursor: zoom-in; }
.dm-composer { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.dm-composer input { flex: 1; border-radius: 8px; padding: 9px 12px; border: 1px solid var(--line); background: var(--panel-soft); font-size: 14.5px; }
.dm-composer input:focus { outline: none; border-color: var(--brand); background: var(--panel); }

/* ==================== 私聊分页 / 群相册 ==================== */
.dm-tabs { display: flex; gap: 4px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.dm-tabs .emoji-tab { border-radius: 8px 8px 0 0; }

.album-modal { width: 560px; max-width: calc(100vw - 24px); }
.album-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 100px);
  gap: 8px; justify-content: center;
  max-height: 58vh; overflow-y: auto; margin-bottom: 14px;
}
.album-cell { position: relative; border-radius: 10px; overflow: hidden; background: var(--panel-soft); }
.album-cell img { width: 100px; height: 100px; object-fit: cover; display: block; cursor: zoom-in; transition: transform .15s; }
.album-cell img:hover { transform: scale(1.04); }
.album-who {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 10.5px; color: #fff; padding: 2px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ==================== 转发 / 好友 / 已读 ==================== */
.fwd-preview {
  background: var(--panel-soft); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; color: var(--muted);
  margin-bottom: 10px; word-break: break-word; max-height: 72px; overflow: hidden;
}
.announce-read { font-size: 11.5px; color: var(--muted); margin-left: 8px; white-space: nowrap; }

/* ==================== 免打扰 / 输入提示 ==================== */
.room-item.muted-room .rbadge { display: none; }
.room-item.muted-room::after {
  content: ''; position: absolute; right: 8px; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); opacity: .45;
}
.room-item { position: relative; }
#typing-hint { font-size: 12px; color: var(--brand); }

/* ==================== 成员面板 / 背景 / 支持链接 ==================== */
.members-head { cursor: pointer; }
.members-head:hover { color: var(--brand); }
.friend-search {
  width: 100%; border-radius: 8px; padding: 9px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); background: var(--panel-soft); font-size: 14px;
}
.friend-search:focus { outline: none; border-color: var(--brand); background: var(--panel); }
.friend-result { max-height: 180px; margin-bottom: 8px; }
.dm-section-title { font-size: 12px; color: var(--brand); margin: 6px 0 4px; font-weight: 600; }

.bg-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bg-cell {
  height: 56px; border-radius: 10px; border: 2px solid var(--line);
  cursor: pointer; font-size: 12px; color: var(--text);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px;
}
.bg-cell.active { border-color: var(--brand); }

/* 爱发电支持入口 */
.support-link {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 8px 10px 4px; padding: 7px 10px;
  border-radius: 10px; text-decoration: none;
  font-size: 12.5px; color: #e0507a;
  background: linear-gradient(90deg, rgba(224,80,122,.10), rgba(224,80,122,.04));
  border: 1px solid rgba(224,80,122,.22);
  transition: transform .12s, background .15s;
}
.support-link:hover { transform: translateY(-1px); background: rgba(224,80,122,.14); }
.support-heart { color: #e0507a; }

/* ==================== 资料扩充 ==================== */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.profile-grid select {
  width: 100%; border-radius: 10px; padding: 10px 12px;
  border: 1px solid var(--line); background: var(--panel-soft); font-size: 14px; color: var(--text);
}
.card-bio {
  margin: 6px 0 0; font-size: 12.5px; color: var(--text);
  background: var(--panel-soft); border-radius: 8px; padding: 6px 10px;
  line-height: 1.5; word-break: break-word;
}

/* ==================== 全站搜索结果 ==================== */
.global-result {
  max-height: 260px; overflow-y: auto;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}
.global-head { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.global-item {
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.global-item:hover { background: var(--panel-soft); }
.global-item b { color: var(--brand); font-weight: 600; margin-right: 6px; }
.global-from { color: var(--muted); }

/* ==================== 红包 ==================== */
.packet {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px; padding: 10px 14px;
  min-width: 190px;
  border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, #ff6b4a, #ff3f34);
  color: #fff; text-align: left;
  transition: transform .12s;
}
.packet:hover { transform: translateY(-1px); }
.packet.empty { background: linear-gradient(135deg, #b9b9b9, #9a9a9a); cursor: default; }
.packet-icon { font-size: 24px; }
.packet-mid { display: flex; flex-direction: column; }
.packet-mid b { font-size: 14px; }
.packet-mid span { font-size: 11.5px; opacity: .9; }

/* ==================== 统一关闭按钮 ==================== */
.modal { position: relative; }
.modal-x {
  position: absolute; top: 10px; right: 12px;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}