/* ============================================================
 * 聊天系统 · 设计系统（设计系统 v3 · 美工精修版）
 * 色板：主色 #3b82f6 / 自己气泡 #cfe4ff / 中性灰阶
 * 基于 frontend-dev 设计规范：层次阴影 / 弹簧动画 / 微交互
 * ========================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* 品牌色 */
  --primary: #3b82f6; --primary-d: #2f6fe0; --primary-weak: #e8f0fe;
  /* 结构色 */
  --rail: #2e2e2e; --rail-hover: #3e3e3e;
  --panel: #f7f7f7; --list-hover: #ededed; --border: #e7e7e7; --bg: #f7f7f7;
  --chat-bg: #ffffff; --mine: #cfe4ff; --bubble: #f5f6f7;
  --text: #191919; --muted: #888888; --muted-2: #8a8f99;
  --danger: #fa5151; --rp: #fa9d3b; --sub: #8a8f99;
  /* 几何 */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  /* 多层阴影系统 */
  --shadow-1: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --shadow-2: 0 2px 8px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.08);
  --shadow-3: 0 4px 12px rgba(0,0,0,.08), 0 8px 30px rgba(0,0,0,.12);
  /* 弹簧缓动 */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--chat-bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
button { font-family: inherit; cursor: pointer; transition: transform .06s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease; }
button:active { transform: scale(.94); }
input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }

/* SVG 图标通用 */
.rail-svg, .tb-svg, .hd-svg, .bn-svg, .dis-svg, .send-svg { width: 100%; height: 100%; fill: currentColor; }

/* 细滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.30); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录页（双栏 · 品牌左 / 表单右） ---------- */
.login-mask { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a5f, #3b82f6 55%, #5b9bf9); z-index: 50; padding: 16px; }
.login-box { background: #fff; border-radius: 16px; width: 720px; max-width: 96vw; display: flex; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.15); animation: modalIn .3s var(--ease-spring); }
.login-brand { flex: 1; background: linear-gradient(160deg, #0ad47a, #07a955); color: #fff; padding: 40px 34px; display: flex; flex-direction: column; justify-content: center; }
.login-brand .wx-logo { width: 64px; height: 64px; margin: 0 0 16px; border-radius: 16px; background: rgba(255,255,255,.18); color: #fff; font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.login-brand h1 { font-size: 26px; margin-bottom: 8px; font-weight: 800; letter-spacing: 1px; }
.login-brand .sub { color: rgba(255,255,255,.85); font-size: 13px; margin-bottom: 24px; }
.login-feats { list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: rgba(255,255,255,.92); }
.login-feats li { background: rgba(255,255,255,.12); padding: 10px 14px; border-radius: 10px; }
.login-form { flex: 1; padding: 40px 36px; display: flex; flex-direction: column; }
.login-form .login-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.login-form .lt { border: none; background: none; font-size: 16px; color: var(--muted-2); cursor: pointer; padding: 6px 18px; border-bottom: 2px solid transparent; transition: color .15s; }
.login-form .lt.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.login-form .lt-form { flex: 1; }
.login-form input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 14px; margin-bottom: 14px; outline: none; transition: border-color .15s, box-shadow .15s; background: #fafafa; }
.login-form input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.login-form button#loginBtn { width: 100%; padding: 12px; border: none; border-radius: var(--r-sm); background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 4px; box-shadow: 0 3px 10px rgba(7,193,96,.25); }
.login-form button#loginBtn:hover { background: var(--primary-d); }
.login-status { min-height: 20px; font-size: 12px; margin: 8px 0 2px; color: var(--danger); text-align: center; }
.login-links { display: flex; justify-content: space-between; margin-top: 12px; }
.link-btn { border: none; background: none; color: var(--primary); font-size: 13px; cursor: pointer; padding: 4px 6px; }
.link-btn:hover { text-decoration: underline; }
#regSecurity select, #regSecurity input { margin-bottom: 10px; }

/* ---------- 三栏布局 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

/* 左栏：SVG图标导航 */
.rail { width: 60px; background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 16px 0 12px; flex: 0 0 auto; }
.rail-icons, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-icons { margin-top: 18px; flex: 1; }
.rail-bottom { gap: 4px; }
.rail-btn { width: 42px; height: 42px; border: none; background: transparent; border-radius: 10px; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s, transform .12s var(--ease-spring); padding: 10px; }
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--rail-hover); color: #fff; transform: scale(1.08); }
.rail-btn.active { background: var(--primary); color: #fff; box-shadow: 0 3px 12px rgba(7,193,96,.45); }
.rail-btn.active svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,.15)); }
/* 通知开关态 */
.rail-btn[data-on="1"] { color: var(--primary); }
.rail-btn[data-on="1"] svg { filter: drop-shadow(0 0 4px rgba(7,193,96,.4)); }
/* 深色开关态 */
.rail-btn[data-dark="1"] { color: #5b9bf5; }
.rail-me { width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(145deg, #0ad47a, #07a955); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: transform .12s var(--ease-spring); }
.rail-me:hover { transform: scale(1.06); }

/* 中栏：会话面板 */
.panel { width: 300px; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0; }
.panel-head { display: flex; gap: 8px; padding: 12px 12px 6px; position: relative; align-items: center; }
.search-icon { position: absolute; left: 22px; width: 16px; height: 16px; fill: var(--muted-2); pointer-events: none; z-index: 2; }
.panel-head input { flex: 1; height: 32px; border: none; background: #e3e3e3; border-radius: 16px; padding: 0 14px 0 36px; font-size: 13px; outline: none; transition: background .15s, box-shadow .15s; }
.panel-head input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(7,193,96,.35); }
.panel-head input:focus + .search-icon, .panel-head input:focus ~ .search-icon { fill: var(--primary); }
.panel-head select { border: none; background: #e6e6e6; border-radius: 16px; font-size: 12px; padding: 0 6px; color: var(--text); outline: none; }
.tabs { display: flex; padding: 4px 12px 0; gap: 4px; }
.tab { flex: 1; padding: 8px 0 10px; border: none; background: none; cursor: pointer; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; transition: color .15s; }
.tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; border-radius: 8px; margin-bottom: 1px; transition: background .12s var(--ease-smooth); position: relative; }
.list-item:hover { background: var(--list-hover); }
.list-item.active { background: #e7f8ef; }
.list-item.active::after { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--primary); }
.avatar { width: 40px; height: 40px; border-radius: 8px; background: linear-gradient(145deg, #0ad47a, #07a955); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.04); transition: box-shadow .15s; }
/* 头像多色系（按名字hash自动分配） */
.avatar.c0 { background: linear-gradient(145deg, #0ad47a, #07a955); }
.avatar.c1 { background: linear-gradient(145deg, #5b9bf5, #3674d4); }
.avatar.c2 { background: linear-gradient(145deg, #f59a23, #d97e0a); box-shadow: inset 0 0 0 999px rgba(0,0,0,.16); }
.avatar.c3 { background: linear-gradient(145deg, #e8556e, #c93a52); }
.avatar.c4 { background: linear-gradient(145deg, #9b6dd4, #7a4eb0); }
.avatar.c5 { background: linear-gradient(145deg, #2cc7c0, #19a39c); }
.avatar.c6 { background: linear-gradient(145deg, #f5644a, #d9462f); }
.avatar.c7 { background: linear-gradient(145deg, #4a9be8, #2e7bd0); }
.avatar.c8 { background: linear-gradient(145deg, #e8a83a, #c98a1e); box-shadow: inset 0 0 0 999px rgba(0,0,0,.16); }
.avatar.c9 { background: linear-gradient(145deg, #6dbf6d, #4a9b4a); }
.li-main { flex: 1; min-width: 0; }
.li-name { font-size: 14px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.li-time { font-size: 11px; color: var(--muted-2); font-weight: 400; }
.li-last { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.li-badge { background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(250,81,81,.35); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: auto; flex: 0 0 auto; }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: #c8ccd1; margin-left: auto; flex: 0 0 auto; }
.side-actions { padding: 10px 12px; border-top: 1px solid var(--border); }
.side-actions button { width: 100%; padding: 9px; border: none; background: #fff; border-radius: var(--r-sm); cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-1); }
.side-actions button:hover { background: var(--primary-weak); }

/* ---------- 右栏：聊天区 ---------- */
.chat-area { flex: 1; display: flex; flex-direction: column; background: var(--chat-bg); min-width: 0; position: relative; }
.chat-header { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; position: relative; z-index: 5; }
#chatTitle { cursor: pointer; }
.chat-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.header-actions { margin-left: auto; display: flex; gap: 4px; }
.header-actions button { border: none; background: none; border-radius: 8px; padding: 8px; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.header-actions button svg { width: 20px; height: 20px; }
.header-actions button:hover { background: var(--primary-weak); color: var(--primary); }

.messages { flex: 1; overflow-y: auto; padding: 16px 20px; scroll-behavior: smooth; background-image: radial-gradient(rgba(0,0,0,.022) 1px, transparent 1px); background-size: 16px 16px; }
.empty-tip { color: var(--muted-2); text-align: center; margin-top: 40px; font-size: 13px; }
.msg { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; animation: msgIn .22s var(--ease-smooth); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg .avatar { width: 38px; height: 38px; font-size: 14px; border-radius: 6px; }
.msg-body { max-width: 66%; }
.msg-name { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.bubble { position: relative; display: inline-block; padding: 9px 13px; border-radius: 8px; background: var(--bubble); font-size: 14px; line-height: 1.55; word-break: break-word; white-space: pre-wrap; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: box-shadow .15s; }
/* 微信式气泡尾巴 */
.bubble::before { content: ''; position: absolute; top: 13px; width: 0; height: 0; border: 5px solid transparent; }
.msg:not(.mine) .bubble::before { left: -8px; border-right-color: var(--bubble); }
.msg.mine .bubble::before { right: -8px; border-left-color: var(--mine); }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .msg-body { text-align: right; }
.msg.mine .bubble { background: var(--mine); text-align: left; }
.msg.system { justify-content: center; animation: none; }
.msg.system .sys-text { background: rgba(0,0,0,.06); color: #666; font-size: 12px; padding: 3px 12px; border-radius: 4px; }
.msg .img-msg { max-width: 220px; border-radius: 6px; cursor: pointer; display: block; }
.msg .file-msg { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #fff; border: 1px solid var(--border); border-radius: 6px; max-width: 240px; text-decoration: none; color: var(--text); }
.msg .file-msg .fi { font-size: 24px; }
.recalled .bubble { color: var(--muted); font-style: italic; background: rgba(0,0,0,.05); }
.recalled .bubble::before { display: none; }
.read-tip { font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.read-tip.read { color: var(--primary); }
.mention { color: var(--primary); font-weight: 600; }
.bubble .emoji-big { font-size: 40px; line-height: 1; }

/* 时间分隔（微信灰色胶囊） */
.time-divider { text-align: center; font-size: 11px; color: var(--muted-2); margin: 16px 0; }
.time-divider::before, .time-divider::after { content: ''; display: inline-block; width: 24px; height: 1px; background: rgba(0,0,0,.08); vertical-align: middle; margin: 0 8px; }

/* 红包 */
.bubble.rp { background: linear-gradient(135deg, #fa9d3b, #f97c2b); color: #fff; border: none; min-width: 180px; cursor: pointer; box-shadow: 0 3px 10px rgba(249,124,43,.35); }
.bubble.rp::before { display: none; }
.bubble.rp .rp-top { font-size: 14px; font-weight: 600; }
.bubble.rp .rp-bot { font-size: 11px; opacity: .92; margin-top: 6px; }
.bubble.rp.opened { background: #fff; color: var(--muted); border: 1px solid var(--border); box-shadow: none; }
.bubble.rp.opened::before { display: block; border-right-color: #fff; }

/* 名片 */
.bubble.card { background: #fff; cursor: pointer; min-width: 180px; }
.bubble.card .card-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.bubble.card .card-sub { font-size: 11px; color: var(--muted); }

/* 引用 */
.bubble .quote-box { border-left: 3px solid var(--primary); background: rgba(0,0,0,.04); padding: 5px 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; border-radius: 0 4px 4px 0; }

/* 合并转发 */
.bubble.forward { background: #fff; min-width: 220px; max-width: 300px; cursor: pointer; }
.bubble.forward .fw-title { font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 6px; }
.bubble.forward .fw-line { font-size: 12px; color: var(--text); padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 转账 */
.bubble.transfer { background: #fff; min-width: 180px; }
.bubble.transfer .tf-top { font-size: 14px; font-weight: 600; color: var(--primary); }
.bubble.transfer .tf-bot { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* 语音 */
.bubble.voice { cursor: pointer; display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bubble.voice .v-play { font-size: 16px; }
.bubble.voice .v-dur { font-size: 12px; color: #666; }

/* ---------- @我横幅 / 回到底部 ---------- */
.at-banner { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 20; animation: msgIn .18s ease-out; }
.at-banner button { border: none; background: linear-gradient(135deg, #ffcf4d, #ffb400); color: #5c4700; font-size: 12px; font-weight: 600; padding: 6px 16px; border-radius: 16px; box-shadow: 0 3px 10px rgba(255,180,0,.4); }
.scroll-down { position: absolute; right: 22px; bottom: 96px; z-index: 20; border: none; background: rgba(255,255,255,.95); color: var(--primary); font-size: 12px; padding: 7px 14px; border-radius: 16px; box-shadow: var(--shadow-2); animation: msgIn .18s ease-out; }
.scroll-down:hover { background: #fff; }

/* ---------- 输入区 ---------- */
.composer { background: #fff; border-top: 1px solid var(--border); padding: 8px 16px 12px; }
.toolbar { display: flex; gap: 2px; margin-bottom: 6px; flex-wrap: wrap; }
.toolbar > button { width: 34px; height: 34px; padding: 0; border: none; background: none; border-radius: 8px; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s, transform .1s; }
.toolbar > button svg { width: 22px; height: 22px; }
.toolbar > button:hover { background: var(--primary-weak); color: var(--primary); transform: scale(1.06); }
.plus-menu { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 6px; background: #fff; box-shadow: var(--shadow-1); animation: msgIn .15s ease-out; }
.plus-menu button { padding: 6px 14px; border: 1px solid var(--border); background: #fff; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.plus-menu button:hover { background: var(--primary-weak); border-color: var(--primary); color: var(--primary); }
.emoji-panel { display: flex; flex-wrap: wrap; gap: 4px; max-height: 150px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 6px; background: #fff; box-shadow: var(--shadow-1); }
.emoji-panel span, .emoji-panel img { font-size: 22px; cursor: pointer; padding: 4px; border-radius: 4px; transition: background .1s; }
.emoji-panel span:hover, .emoji-panel img:hover { background: var(--primary-weak); }
.emoji-panel img { width: 32px; height: 32px; object-fit: contain; }
.input-row { display: flex; gap: 10px; align-items: flex-end; }
#input { flex: 1; resize: none; height: 64px; padding: 10px 14px; border: none; background: #f5f5f5; border-radius: var(--r-md); font-size: 14px; outline: none; font-family: inherit; transition: box-shadow .15s, background .15s; }
#input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(7,193,96,.3); }
#sendBtn { padding: 0 22px; height: 64px; border: none; border-radius: var(--r-md); background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; box-shadow: 0 2px 8px rgba(7,193,96,.25); display: flex; align-items: center; justify-content: center; transition: background .15s, box-shadow .15s, transform .1s var(--ease-spring); }
#sendBtn svg { width: 22px; height: 22px; }
#sendBtn:hover { background: var(--primary-d); box-shadow: 0 4px 14px rgba(7,193,96,.35); }
#sendBtn:active { transform: scale(.95); }
.quote-bar { display: flex; align-items: center; gap: 8px; background: #f7f8fa; border-left: 3px solid var(--primary); padding: 6px 10px; border-radius: 4px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.quote-bar button { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 12px; margin-left: auto; }
.multi-bar { display: flex; align-items: center; gap: 8px; background: #fffbea; border: 1px solid #ffe58f; padding: 6px 10px; border-radius: 4px; margin-bottom: 6px; font-size: 13px; }
.multi-bar button { border: none; background: var(--primary); color: #fff; border-radius: 4px; padding: 4px 12px; cursor: pointer; font-size: 12px; }
.voice-bar { display: flex; align-items: center; gap: 10px; background: #f7f8fa; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 6px; font-size: 13px; }
.voice-bar button { border: none; border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer; font-size: 13px; }
#voiceStop { background: var(--primary); color: #fff; }
#voiceCancel { background: #f2f3f5; }

/* ---------- 弹窗（动效） ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 40; animation: fadeIn .15s ease-out; backdrop-filter: blur(2px); }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; width: 380px; max-height: 88vh; overflow-y: auto; animation: modalIn .24s var(--ease-spring); box-shadow: var(--shadow-3); }
.modal-box h3 { margin-bottom: 18px; font-size: 16px; font-weight: 600; }
.modal-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.modal-box input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 14px; outline: none; background: #fafafa; transition: border-color .15s, box-shadow .15s, background .15s; }
.modal-box input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.modal-box select { width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 14px; outline: none; background: #fafafa; }
.member-pick { max-height: 180px; overflow-y: auto; margin-bottom: 16px; }
.member-pick label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.member-pick input { width: auto; margin: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions button { flex: 1; padding: 10px; border: none; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; font-weight: 500; }
#groupCancel, #rpCancel, #tfCancel, #scanClose, #appsClose, #favClose, #confClose, #walletClose, #gsClose, #incomingReject { background: #f2f3f5; color: var(--text); }
#groupCancel:hover, #rpCancel:hover, #tfCancel:hover, #scanClose:hover, #appsClose:hover, #favClose:hover, #confClose:hover, #walletClose:hover, #gsClose:hover, #incomingReject:hover { background: #e6e7ea; }
#groupCreate, #rpSend, #tfSend, #scanStart, #scanSim, #incomingAccept { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(7,193,96,.25); }
#groupCreate:hover, #rpSend:hover, #tfSend:hover, #scanStart:hover, #scanSim:hover, #incomingAccept:hover { background: var(--primary-d); }

/* 群设置 */
.gs-section { display: grid; gap: 8px; }
.gs-section button { padding: 10px; border: 1px solid var(--border); background: #fff; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; }
.gs-section button:hover { background: var(--primary-weak); border-color: var(--primary); }

/* 钱包 */
.wallet-bal { font-size: 24px; text-align: center; padding: 24px 0; color: var(--primary); }
.wallet-bal b { font-size: 34px; font-weight: 700; }
.tx-list { max-height: 160px; overflow-y: auto; margin-bottom: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.tx-item { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 2px; border-bottom: 1px solid #f5f5f5; }
.tx-item .tx-out { color: #e64340; }
.tx-item .tx-in { color: var(--primary); }

/* 群公告置顶（粘性） */
.announce-sticky { position: sticky; top: 0; z-index: 10; background: #fffbea; border: 1px solid #ffe58f; border-radius: var(--r-sm); padding: 8px 12px; font-size: 13px; color: #996b00; margin-bottom: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.06); }

/* 扫码 */
.scan-box { width: 420px; }
#scanVideoWrap { display: flex; justify-content: center; padding: 8px 0; }
#scanVideo { width: 100%; max-width: 260px; border-radius: var(--r-md); background: #000; }
#myQrWrap { display: flex; flex-direction: column; align-items: center; padding: 12px 0; }
#myQr { padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); }
.qr-tip { font-size: 12px; color: var(--muted); margin-top: 8px; }
.scan-result { text-align: center; font-size: 13px; color: var(--primary); min-height: 20px; padding: 6px 0; }

/* 应用中心 */
.apps-box { width: 420px; }
.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 8px 0 16px; }
.app-card { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 8px; text-align: center; cursor: pointer; font-size: 14px; background: #fff; transition: transform .12s, box-shadow .15s, border-color .15s; }
.app-card:hover { background: var(--primary-weak); border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.app-stage { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 6px; text-align: center; min-height: 120px; }
.app-stage .dice-big { font-size: 64px; margin: 10px 0; }
.app-stage button { margin: 6px; padding: 8px 16px; border: none; border-radius: var(--r-sm); background: var(--primary); color: #fff; cursor: pointer; font-size: 14px; }
.app-stage .calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 240px; margin: 0 auto; }
.app-stage .calc-grid button { margin: 0; padding: 12px; font-size: 16px; }

/* 朋友圈 */
.moments-box { width: 460px; max-height: 86vh; }
.moment-composer { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px; margin-bottom: 12px; }
.moment-composer textarea { width: 100%; border: none; outline: none; resize: none; font-size: 14px; font-family: inherit; min-height: 50px; }
.moment-tools { display: flex; gap: 8px; align-items: center; }
.moment-tools button { border: 1px solid var(--border); background: #fff; border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer; font-size: 13px; }
.moment-tools button:hover { background: var(--primary-weak); }
.moment-item { border-bottom: 1px solid #f2f2f2; padding: 12px 4px; }
.moment-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.moment-text { font-size: 14px; margin-bottom: 8px; white-space: pre-wrap; }
.moment-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.moment-imgs img { width: 90px; height: 90px; object-fit: cover; border-radius: 4px; cursor: pointer; transition: transform .1s; }
.moment-imgs img:hover { transform: scale(1.03); }
.moment-meta { font-size: 11px; color: var(--muted); display: flex; gap: 12px; }
.moment-meta button { border: none; background: none; cursor: pointer; font-size: 12px; color: var(--muted); }
.moment-meta button.liked { color: var(--primary); }
.moment-comments { margin-top: 6px; background: #f7f8fa; border-radius: 4px; padding: 6px 8px; font-size: 12px; }
.moment-comments .cmt { padding: 2px 0; }
.moment-comments input { border: none; background: transparent; width: 100%; outline: none; font-size: 12px; }

/* 收藏 */
.fav-box { width: 420px; }
.fav-list { max-height: 60vh; overflow-y: auto; }
.fav-item { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; margin-bottom: 8px; font-size: 13px; }

/* 通话浮层 */
.call-overlay { position: fixed; inset: 0; background: rgba(20,24,28,.96); z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; animation: fadeIn .2s; }
.call-info { color: #fff; font-size: 18px; margin-bottom: 16px; }
.call-videos { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 90vw; }
.call-videos video { width: 280px; max-width: 40vw; height: 200px; background: #000; border-radius: 10px; object-fit: cover; }
.call-videos .local-video { width: 140px; height: 100px; position: fixed; right: 24px; bottom: 110px; z-index: 61; border: 2px solid #07c160; }
.call-controls { position: fixed; bottom: 30px; display: flex; gap: 16px; }
.call-controls button { padding: 12px 22px; border: none; border-radius: 24px; cursor: pointer; font-size: 14px; background: #3a3f45; color: #fff; }
.call-controls button:hover { background: #4a4f55; }

/* 朋友圈预览 */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 80; display: flex; align-items: center; justify-content: center; cursor: zoom-out; animation: fadeIn .15s; }
.lightbox img { max-width: 90vw; max-height: 88vh; border-radius: var(--r-md); }

/* ---------- 消息右键菜单 ---------- */
.msg-menu { position: fixed; z-index: 90; background: #fff; border-radius: 10px; box-shadow: var(--shadow-3); padding: 6px; min-width: 136px; animation: modalIn .14s var(--ease-spring); }
.msg-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 14px; border: none; background: none; font-size: 13px; border-radius: 6px; color: var(--text); transition: background .1s, color .1s; }
.msg-menu button:hover { background: var(--primary-weak); color: var(--primary); }
.msg-menu button.danger { color: var(--danger); }
.msg-menu button.danger:hover { background: #fdeaea; }

/* ---------- 个人资料卡 ---------- */
.profile-box { width: 320px; }
.profile-head { display: flex; gap: 16px; align-items: center; padding: 6px 0 18px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 10px; background: linear-gradient(145deg, #0ad47a, #07a955); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; flex: 0 0 auto; box-shadow: 0 4px 12px rgba(7,193,96,.3); }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.profile-meta { background: #f7f7f7; border-radius: var(--r-md); padding: 10px 14px; font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.8; }

/* ---------- 深色模式 ---------- */
body[data-theme="dark"] {
  --bg: #191919; --panel: #262626; --border: #3a3a3a; --text: #e8e8e8; --muted: #9a9a9a; --muted-2: #7a7f88; --sub: #9a9fa8;
  --mine: #2f7d47; --bubble: #2f2f2f; --list-hover: #2e2e2e; --primary-weak: #143323;
}
body[data-theme="dark"] .login-mask { background: linear-gradient(160deg, #1c1e22, #14161a); }
body[data-theme="dark"] .login-box { background: #262626; color: #e8e8e8; }
body[data-theme="dark"] .login-box input { background: #333; color: #e8e8e8; border-color: #444; }
body[data-theme="dark"] .chat-area { background: #1f1f1f; }
body[data-theme="dark"] .chat-header { background: #262626; border-color: #3a3a3a; }
body[data-theme="dark"] #input { background: #333; color: #e8e8e8; }
body[data-theme="dark"] #input:focus { background: #3a3a3a; box-shadow: 0 0 0 2px rgba(7,193,96,.35); }
body[data-theme="dark"] .bubble, body[data-theme="dark"] .bubble.card, body[data-theme="dark"] .bubble.forward, body[data-theme="dark"] .bubble.transfer { background: #2f2f2f; border-color: #444; color: #e8e8e8; }
body[data-theme="dark"] .msg:not(.mine) .bubble::before { border-right-color: #2f2f2f; }
body[data-theme="dark"] .msg.mine .bubble::before { border-left-color: #2f7d47; }
body[data-theme="dark"] .msg .file-msg { background: #2f2f2f; color: #e8e8e8; }
body[data-theme="dark"] .msg.system .sys-text { background: rgba(255,255,255,.1); color: #bbb; }
body[data-theme="dark"] .modal-box { background: #262626; color: #e8e8e8; }
body[data-theme="dark"] .modal-box input, body[data-theme="dark"] .modal-box select { background: #333; color: #e8e8e8; border-color: #444; }
body[data-theme="dark"] .emoji-panel { background: #2f2f2f; border-color: #444; }
body[data-theme="dark"] .plus-menu { background: #2f2f2f; border-color: #444; }
body[data-theme="dark"] .plus-menu button { background: #333; color: #e8e8e8; border-color: #444; }
body[data-theme="dark"] .list-item:hover { background: #2e2e2e; }
body[data-theme="dark"] .list-item.active { background: rgba(7,193,96,.18); box-shadow: inset 3px 0 0 var(--primary); }
body[data-theme="dark"] .messages { background-image: radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px); }
body[data-theme="dark"] .empty-tip::before { background: rgba(7,193,96,.15); }
body[data-theme="dark"] .panel-head input, body[data-theme="dark"] .panel-head select { background: #333; color: #e8e8e8; }
body[data-theme="dark"] .panel-head input:focus { background: #3a3a3a; }
body[data-theme="dark"] .search-icon { fill: #6f6f6f; }
body[data-theme="dark"] .side-actions button { background: #2f2f2f; color: var(--primary); }
body[data-theme="dark"] .moment-comments { background: #2e2e2e; }
body[data-theme="dark"] .announce-sticky { background: #3a3208; border-color: #5c5010; color: #e6c34c; }
body[data-theme="dark"] .header-actions button { background: none; color: #9a9a9a; }
body[data-theme="dark"] .header-actions button:hover { background: rgba(7,193,96,.18); color: var(--primary); }
body[data-theme="dark"] .composer { background: #262626; border-color: #3a3a3a; }
body[data-theme="dark"] .msg-menu { background: #2b2b2b; }
body[data-theme="dark"] .msg-menu button { color: #e8e8e8; }
body[data-theme="dark"] .msg-menu button:hover { background: #3a3a3a; color: var(--primary); }
body[data-theme="dark"] .profile-meta { background: #2e2e2e; }
body[data-theme="dark"] .scroll-down { background: rgba(50,50,50,.95); color: var(--primary); }
body[data-theme="dark"] .time-divider::before, body[data-theme="dark"] .time-divider::after { background: rgba(255,255,255,.15); }

/* 深色模式补全（v3 美工精修：消除残留白块） */
body[data-theme="dark"] .contact-sys,
body[data-theme="dark"] .contact-search,
body[data-theme="dark"] .gs-section button,
body[data-theme="dark"] .moment-tools button,
body[data-theme="dark"] .ep-emoji,
body[data-theme="dark"] .ep-upload,
body[data-theme="dark"] .chat-search #searchClose,
body[data-theme="dark"] .plus-menu #cancelMulti,
body[data-theme="dark"] .app-card,
body[data-theme="dark"] .fav-item,
body[data-theme="dark"] .moment-composer,
body[data-theme="dark"] .momentsClose { background: #262626; border-color: #444; color: #e8e8e8; }
body[data-theme="dark"] .contact-sys { border-bottom-color: #1f1f1f; }
body[data-theme="dark"] .cs-row { border-bottom-color: #333; }
body[data-theme="dark"] .chat-search button { background: #333; color: #9a9a9a; }
body[data-theme="dark"] .chat-search #searchClose { background: #2f2f2f; }
body[data-theme="dark"] .bottom-nav { background: #1f1f1f; border-top-color: #3a3a3a; }
body[data-theme="dark"] .bubble.rp.opened { background: #2f2f2f; color: #9a9a9a; }
body[data-theme="dark"] .msg:not(.mine) .bubble.rp.opened::before { border-right-color: #2f2f2f; }
body[data-theme="dark"] .msg.mine .bubble.rp.opened::before { border-left-color: #2f2f2f; }
body[data-theme="dark"] .moment-composer textarea { background: #262626; color: #e8e8e8; }
body[data-theme="dark"] .ep-upload { background: #2a2a2a; }
body[data-theme="dark"] .moment-item { border-bottom-color: #2e2e2e; }
body[data-theme="dark"] .sk-line { background: #2f2f2f; }

/* 头像放大浮层（双击头像查看大图） */
.avatar-zoom { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 85; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; animation: fadeIn .15s; cursor: zoom-out; }
.az-circle { width: 120px; height: 120px; border-radius: 20px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 52px; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.4); animation: modalIn .2s var(--ease-spring); }
.az-circle img { width: 100%; height: 100%; object-fit: cover; border-radius: 20px; }
.az-name { color: #fff; font-size: 16px; text-shadow: 0 1px 4px rgba(0,0,0,.4); }

/* 弹窗按钮统一（替代内联 style） */
.btn-ghost, .btn-primary, .btn-danger { border: none; border-radius: var(--r-sm); padding: 10px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background .15s, box-shadow .15s, transform .06s ease; }
.btn-ghost { background: #f2f3f5; color: var(--text); }
.btn-ghost:hover { background: #e6e7ea; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(7,193,96,.25); }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { background: #ffe4e3; color: #e64340; }
.btn-danger:hover { background: #fbd4d3; }
body[data-theme="dark"] .btn-ghost { background: #333; color: #e8e8e8; }
body[data-theme="dark"] .btn-ghost:hover { background: #3a3a3a; }
body[data-theme="dark"] .btn-danger { background: rgba(250,81,81,.15); color: #ff8a8a; }

/* 防截图水印（IP+账号，平铺旋转） */
.watermark-layer { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; z-index: 1; overflow: hidden; }
/* 防截图水印：加深对比度（浅色 13% / 深色 11%），字号 13px，加粗微调保证截图可溯源 */
.watermark-item { position: absolute; font-size: 13px; font-weight: 500; color: rgba(0,0,0,.13); white-space: nowrap; transform: rotate(-30deg); user-select: none; font-family: Consolas, Menlo, monospace; letter-spacing: .5px; }
.watermark-item::before { content: '🛡 '; opacity: .85; }
body[data-theme="dark"] .watermark-item { color: rgba(255,255,255,.11); }
@media (max-width: 1023px) { .watermark-item { font-size: 12px; } }

/* 微信风格：连续同人消息合并显示 */
.msg.same-sender { margin-top: -10px; }
.msg.same-sender .avatar { visibility: hidden; }
.msg.same-sender .msg-name { display: none; }
.msg.same-sender .bubble::before { display: none; }

/* 对方消息操作菜单：桌面 hover 显示（微信 PC 同款），移动端常驻 */
.msg-ops { display: none; }
.msg:hover .msg-ops { display: flex; }
@media (hover: none) {
  .msg-ops { display: flex; }
}

/* 键盘可达性：focus-visible 焦点环 */
.rail-btn:focus-visible, .tab:focus-visible, .toolbar > button:focus-visible, .bn:focus-visible,
.hd-btn:focus-visible, .me-row:focus-visible, .list-item:focus-visible, .avatar:focus-visible,
.chat-back:focus-visible, .send-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ============================================================
 * 移动端返回按钮 + 底部导航（默认桌面端隐藏）
 * ========================================================== */
.chat-back { display: none; border: none; background: none; font-size: 15px; color: var(--text); cursor: pointer; padding: 0 8px 0 0; font-weight: 500; }
.bottom-nav { display: none; }

/* ============================================================
 * 我的（个人中心）
 * ========================================================== */
.me-box { width: 360px; }
.me-head { display: flex; gap: 16px; align-items: center; padding: 8px 4px 18px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.me-avatar { width: 64px; height: 64px; border-radius: 12px; background: linear-gradient(145deg, #0ad47a, #07a955); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; flex: 0 0 auto; box-shadow: 0 4px 12px rgba(7,193,96,.3); overflow: hidden; }
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-info { min-width: 0; }
.me-name { font-size: 19px; font-weight: 700; }
.me-sign { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-wxid { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.me-list { display: flex; flex-direction: column; }
.me-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 6px; border: none; background: none; cursor: pointer; font-size: 14px; color: var(--text); border-bottom: 1px solid #f2f2f2; }
.me-row:hover { background: #f7f8fa; }
.me-arrow { color: var(--muted-2); font-size: 18px; }
.me-row.me-danger { color: var(--danger); }

/* ============================================================
 * 编辑资料
 * ========================================================== */
.edit-avatar { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.edit-avatar-prev { width: 60px; height: 60px; border-radius: 12px; background: linear-gradient(145deg, #0ad47a, #07a955); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; flex: 0 0 auto; overflow: hidden; box-shadow: 0 3px 10px rgba(7,193,96,.3); }
.edit-avatar-prev img { width: 100%; height: 100%; object-fit: cover; }
.edit-avatar-opts { flex: 1; }
.ep-emojis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ep-emoji { width: 38px; height: 38px; font-size: 20px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; transition: border-color .12s, background .12s; }
.ep-emoji:hover { border-color: var(--primary); }
.ep-emoji.sel { border-color: var(--primary); background: var(--primary-weak); box-shadow: 0 0 0 2px rgba(7,193,96,.25); }
.ep-upload { border: 1px dashed var(--border); background: #fafafa; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--muted); }
.ep-upload:hover { border-color: var(--primary); color: var(--primary); }

/* 空会话区更好看的引导 */
.empty-tip { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted-2); margin-top: 80px; font-size: 14px; }
.empty-tip::before { content: ''; width: 72px; height: 72px; border-radius: 50%; background: var(--primary-weak); display: flex; align-items: center; justify-content: center; }
.messages .empty-tip::after { content: '选择联系人开始聊天'; font-size: 13px; color: var(--muted); }

/* ============================================================
 * 响应式：手机 H5（≤820px）→ 单栏 + 底部导航 + 聊天全屏
 * ========================================================== */
@media (max-width: 1023px) {
  .rail { display: none; }
  .app { height: 100vh; height: 100dvh; overflow: hidden; }
  .panel { width: 100%; border-right: none; }
  .side-actions { margin-bottom: 56px; }
  .chat-area {
    position: fixed; inset: 0; z-index: 25;
    transform: translateX(100%); transition: transform .22s ease;
    border-left: none;
  }
  .app.app--chat .panel { display: none; }
  .app.app--chat .chat-area { transform: translateX(0); }
  .app.app--chat .bottom-nav { display: none; }
  .chat-back { display: none; align-items: center; min-height: 44px; }
  .app.app--chat .chat-back { display: inline-flex; }
  .chat-header { padding: 0 12px; height: 48px; padding-top: env(safe-area-inset-top); }
  .chat-sub { display: none; }
  .header-actions { gap: 2px; }
  .header-actions button { padding: 6px 7px; }
  .header-actions button svg { width: 18px; height: 18px; }
  .messages { padding: 14px 12px; }
  .composer { padding: 8px 10px 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .input-row { gap: 6px; }
  #input { height: 52px; }
  #sendBtn { height: 52px; padding: 0 16px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 56px;
    background: #f7f7f7; border-top: 1px solid var(--border); z-index: 30;
    justify-content: space-around; align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bn { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: #888; cursor: pointer; padding: 6px 0; transition: color .15s; }
  .bn.active { color: var(--primary); }
  .bn-svg { width: 24px; height: 24px; fill: currentColor; transition: transform .15s var(--ease-spring); }
  .bn.active .bn-svg { transform: scale(1.1); }
  .bn-tx { font-size: 10px; }
  .modal-box { width: 92vw; max-height: 90vh; padding: 20px; }
  .login-box { width: 92vw; max-width: 420px; flex-direction: column; }
  .login-brand { padding: 28px 24px; }
  .login-feats { display: none; }
  .login-form { padding: 28px 24px; }
  .moments-box, .scan-box, .apps-box, .fav-box, .wallet-bal { width: 92vw; }
}

/* 超小屏微调 */
@media (max-width: 380px) {
  .bn-tx { font-size: 10px; }
  .header-actions button { padding: 4px 7px; }
}

/* ---------------- 微信对标新增样式 ---------------- */
/* 列表分隔线（置顶聊天 / 聊天 / 群聊 / 我的好友） */
.list-divider { font-size: 12px; color: var(--muted); background: var(--bg); padding: 8px 12px 4px; letter-spacing: .5px; }
/* 列表项右侧（免打扰 + 未读角标） */
.li-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.li-tag { font-size: 10px; color: var(--sub); border: 1px solid #e0e0e0; border-radius: 4px; padding: 0 4px; margin-left: 6px; }
.li-mute { font-size: 10px; color: var(--muted); border: 1px solid #d5d5d5; border-radius: 4px; padding: 1px 5px; }
.list-item.pinned { background: linear-gradient(90deg, rgba(7,193,96,.06), transparent 40%); }
.list-item.pinned::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--primary); }
.list-item { position: relative; }

/* 通讯录搜索框 */
.contact-search { width: calc(100% - 24px); margin: 8px 12px 4px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 16px; font-size: 13px; outline: none; background: #f3f4f6; }
.contact-search:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(7,193,96,.1); }
/* 通讯录顶部系统入口（新的朋友 / 群聊） */
.contact-sys { display: flex; flex-direction: column; background: #fff; border-bottom: 8px solid var(--bg); }
.cs-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,.04); }
.cs-row:hover { background: var(--list-hover); }
.cs-ic { width: 34px; height: 34px; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cs-tx { flex: 1; font-size: 14px; color: var(--text); }
.cs-count { font-size: 12px; color: var(--muted); }

/* 群 @ 成员选择面板 */
.at-picker { position: absolute; left: 12px; right: 12px; bottom: 8px; max-height: 240px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-3); padding: 6px; z-index: 40; animation: modalIn .14s ease-out; }
body[data-theme="dark"] .at-picker { background: #2b2b2b; border-color: #444; }
.at-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: none; background: none; cursor: pointer; border-radius: var(--r-sm); font-size: 13px; color: var(--text); text-align: left; }
.at-item:hover { background: var(--primary-weak); }
.at-empty { padding: 14px; text-align: center; font-size: 12px; color: var(--muted); }

/* 撤回后「重新编辑」条 */
.re-edit-bar { position: absolute; left: 12px; right: 12px; bottom: 8px; background: #fff7e6; border: 1px solid #ffe1a8; border-radius: var(--r-md); padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #8a6d3b; box-shadow: var(--shadow-2); z-index: 41; }
body[data-theme="dark"] .re-edit-bar { background: #3a3320; border-color: #5a4d2a; color: #d8c79a; }
.re-edit-bar button { border: none; background: var(--primary); color: #fff; font-size: 12px; padding: 4px 12px; border-radius: 12px; cursor: pointer; }

/* 引用跳转高亮 */
.msg.flash { animation: flashBg 1.2s ease-out; }
@keyframes flashBg { 0% { background: rgba(7,193,96,.18); } 100% { background: transparent; } }

/* 移动端：@ 面板 / 重新编辑条 占满宽度 */
@media (max-width: 1023px) {
  .at-picker, .re-edit-bar { left: 8px; right: 8px; }
  .contact-search { width: calc(100% - 16px); margin: 8px 8px 4px; }
}

/* ---------------- 聊天内搜索栏 ---------------- */
.chat-search { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--border); }
.chat-search input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 16px; padding: 6px 12px; font-size: 13px; background: var(--panel); color: var(--text); outline: none; }
.chat-search input:focus { border-color: var(--primary); }
.search-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.chat-search button { border: none; background: var(--primary-weak); color: var(--primary); border-radius: 14px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; flex-shrink: 0; }
.chat-search #searchClose { background: #f2f3f5; color: var(--muted); }
body[data-theme="dark"] .chat-search { background: #1f1f1f; border-color: #333; }

/* 搜索命中高亮 */
mark.hl { background: #ffe58f; color: inherit; border-radius: 2px; padding: 0 1px; }
body[data-theme="dark"] mark.hl { background: #8a6d00; color: #fff; }

/* 草稿标识 */
.li-last.li-draft { color: #fa5151; }
.li-last.li-draft b { font-weight: 600; }

/* ---------------- 群成员列表 ---------------- */
.profile-members { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 4px 4px; border-top: 1px solid var(--border); margin-top: 10px; max-height: 220px; overflow-y: auto; }
.member-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; cursor: pointer; }
.member-chip:hover .avatar { box-shadow: 0 0 0 2px var(--primary); }
.member-chip span:last-child { font-size: 11px; color: var(--text); max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 聊天背景色板 ---------------- */
.bg-swatches { display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 0 14px; }
.bg-swatch { width: 72px; height: 72px; border-radius: var(--r-md); border: 2px solid var(--border); cursor: pointer; position: relative; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; box-shadow: var(--shadow-1); transition: transform .1s; }
.bg-swatch:hover { transform: scale(1.04); }
.bg-swatch span { font-size: 11px; color: #333; background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 8px; }
.bg-swatch.sel { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-weak); }

@media (max-width: 1023px) {
  .chat-search { padding: 6px 8px; }
  .bg-swatch { width: 64px; height: 64px; }
}

/* ---------- P0：全局搜索下拉 ---------- */
.panel-head { position: relative; }
.search-drop { position: absolute; top: 48px; left: 12px; right: 12px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-2); z-index: 60; max-height: 320px; overflow-y: auto; padding: 6px 0; }
.sd-group { font-size: 11px; color: var(--sub); padding: 8px 14px 4px; }
.sd-list { }
.sd-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; }
.sd-item:hover, .sd-item.hl { background: var(--primary-weak); }
.sd-item .avatar { width: 32px; height: 32px; font-size: 13px; border-radius: 5px; }
.sd-item .sd-main { flex: 1; min-width: 0; }
.sd-item .sd-name { font-size: 13px; font-weight: 500; }
.sd-item .sd-sub { font-size: 11px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-item .sd-badge { font-size: 10px; color: var(--primary); background: var(--primary-weak); padding: 1px 6px; border-radius: 8px; flex: 0 0 auto; }
.sd-empty { padding: 20px; text-align: center; color: var(--sub); font-size: 12px; }
body[data-theme="dark"] .search-drop { background: #2b2b2b; border-color: #444; }
body[data-theme="dark"] .sd-item:hover, body[data-theme="dark"] .sd-item.hl { background: #3a3a3a; }

/* ---------- P0：截图发送 ---------- */
.shot-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; cursor: crosshair; }
.shot-rect { position: fixed; border: 2px solid var(--primary); background: rgba(59,130,246,.12); z-index: 201; pointer-events: none; }
.shot-tip { position: fixed; z-index: 202; background: rgba(0,0,0,.75); color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 4px; pointer-events: none; }
.shot-actions { position: fixed; z-index: 203; display: flex; gap: 6px; }
.shot-actions button { padding: 5px 14px; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; }
.shot-actions .ok { background: var(--primary); color: #fff; }
.shot-actions .cancel { background: #f2f3f5; color: #333; }

/* ---------- P0：语音转文字 ---------- */
.v-to-text { display: inline-block; margin-top: 4px; font-size: 11px; color: var(--primary); background: var(--primary-weak); border: none; border-radius: 4px; padding: 2px 8px; cursor: pointer; }
.v-tt-text { font-size: 12px; color: #888; background: rgba(0,0,0,.04); border-radius: 4px; padding: 3px 8px; margin-top: 4px; display: block; }
body[data-theme="dark"] .v-tt-text { background: rgba(255,255,255,.06); color: #bbb; }

/* ---------- P0：已读列表弹层 ---------- */
.read-pop { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-2); z-index: 70; padding: 8px 0; min-width: 150px; }
.read-pop .rp-title { font-size: 11px; color: var(--sub); padding: 4px 14px; }
.read-pop .rp-item { display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 13px; cursor: default; }
body[data-theme="dark"] .read-pop { background: #2b2b2b; border-color: #444; }

/* ---------- 截图/拖拽 通用 ---------- */
.composer.drag-over { outline: 2px dashed var(--primary); outline-offset: -4px; }
.drag-hint { text-align: center; color: var(--primary); font-size: 12px; padding: 4px 0; display: none; }
.composer.drag-over .drag-hint { display: block; }

/* ---------- P1：通讯录字母索引 ---------- */
.alpha-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 12px; }
.alpha-bar button { border: none; background: none; font-size: 11px; color: var(--muted); cursor: pointer; padding: 2px 5px; border-radius: 4px; }
.alpha-bar button:hover { background: var(--primary-weak); color: var(--primary); }
.alpha-label { font-size: 11px; color: var(--sub); padding: 6px 14px 2px; background: #f0f1f2; margin-top: 6px; }
body[data-theme="dark"] .alpha-label { background: #2a2a2a; }

/* ---------- P1：黑名单 ---------- */
.black-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.black-item .avatar { width: 32px; height: 32px; font-size: 13px; }
.black-item button { margin-left: auto; }

/* ---------- P1：朋友圈评论回复 ---------- */
.cmt { font-size: 12px; }
.cmt .cmt-reply { color: var(--primary); cursor: pointer; font-size: 11px; margin-left: 6px; }

/* ---------- P1：导出按钮 ---------- */
.export-btn { margin-left: auto; }

/* ---------- 移动端发现页 ---------- */
.discover-page { position: fixed; inset: 0; z-index: 26; background: #f2f2f2; display: flex; flex-direction: column; }
.discover-head { height: 52px; display: flex; align-items: center; padding: 0 16px; font-size: 17px; font-weight: 600; background: #fff; border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top); }
.discover-list { background: #fff; margin-top: 10px; }
.dis-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.dis-row:active { background: #f5f5f5; }
.dis-ic { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 auto; padding: 6px; }
.dis-ic .dis-svg { width: 22px; height: 22px; fill: #fff; }
.dis-tx { flex: 1; font-size: 15px; }
.dis-ar { color: #c8c8c8; font-size: 16px; }
body[data-theme="dark"] .discover-page { background: #1f1f1f; }
body[data-theme="dark"] .discover-head, body[data-theme="dark"] .discover-list { background: #262626; border-color: #3a3a3a; }
body[data-theme="dark"] .dis-row { border-color: #333; }
@media (min-width: 1024px) { .discover-page { display: none !important; } }

/* ============================================================
 * v3 美工精修：微交互动效系统
 * ========================================================== */

/* 1. 按钮波纹效果 */
.ripple { position: relative; overflow: hidden; }
.ripple-wave { position: absolute; border-radius: 50%; background: rgba(255,255,255,.35); transform: scale(0); animation: rippleAnim .5s ease-out; pointer-events: none; }
@keyframes rippleAnim { to { transform: scale(2.5); opacity: 0; } }

/* 2. 骨架屏加载 */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%); background-size: 400% 100%; animation: skeletonShimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes skeletonShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-item { display: flex; gap: 10px; padding: 10px 12px; margin-bottom: 1px; }
.sk-avatar { width: 40px; height: 40px; border-radius: 8px; }
.sk-main { flex: 1; }
.sk-line { height: 12px; border-radius: 6px; margin-bottom: 6px; }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }
body[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #2a2a2a 25%, #333 37%, #2a2a2a 63%); background-size: 400% 100%; }

/* 3. 列表项淡入动画 */
.list-item { animation: listFadeIn .2s var(--ease-smooth) backwards; }
@keyframes listFadeIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* 4. 输入框聚焦动效 */
#input { transition: background .15s, box-shadow .2s var(--ease-smooth), border-color .15s; }
#input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(7,193,96,.25), 0 1px 3px rgba(0,0,0,.04); }

/* 5. 消息出现动画增强 */
.msg { will-change: opacity, transform; }

/* 6. 头像悬停微动效 */
.list-item:hover .avatar { transform: scale(1.05); transition: transform .15s var(--ease-spring); }
.avatar { transition: transform .15s var(--ease-spring), box-shadow .15s; }

/* 7. tab 下划线滑入 */
.tab { position: relative; }
.tab::after { content: ''; position: absolute; bottom: 0; left: 50%; width: 0; height: 2px; background: var(--primary); border-radius: 1px; transition: width .2s var(--ease-smooth), left .2s var(--ease-smooth); }
.tab.active::after { width: 24px; left: calc(50% - 12px); }

/* 8. 弹窗内输入框聚焦光晕 */
.modal-box input:focus, .modal-box select:focus { box-shadow: 0 0 0 3px rgba(59,130,246,.12), 0 1px 2px rgba(0,0,0,.04); }

/* 9. 列表项 active 左条动画 */
.list-item.active::after { animation: barSlideIn .2s var(--ease-smooth); }
@keyframes barSlideIn { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* 10. 角标脉冲动效（低频，避免视觉疲劳） */
.li-badge { animation: badgePulse 3.5s ease-in-out 2; }
@keyframes badgePulse { 0%, 100% { box-shadow: 0 1px 3px rgba(250,81,81,.35); } 50% { box-shadow: 0 1px 6px rgba(250,81,81,.5); } }

/* 11. 在线状态点（静态，不呼吸，微信风格） */
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: auto; flex: 0 0 auto; }

/* 12. 骨架屏列表 */
.sk-list { padding: 4px 8px; }

/* 13. 深色模式波纹适配 */
body[data-theme="dark"] .ripple-wave { background: rgba(255,255,255,.08); }

/* 14. 搜索框聚焦时光标颜色 */
#searchInput:focus { caret-color: var(--primary); }
#input:focus { caret-color: var(--primary); }

/* 置顶"顶"角标（微信 PC 同款） */
.pin-tag { background: var(--primary); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 3px; margin-left: 4px; line-height: 14px; }

/* 好友验证附言 + 设备管理 */
.modal-note { font-size: 12px; color: var(--muted); margin: 8px 0 4px; line-height: 1.5; }
.dev-item { display: flex; align-items: center; gap: 8px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.dev-item .dev-info { flex: 1; }
.dev-item .dev-name { font-weight: 500; font-size: 14px; }
.dev-item .dev-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dev-item .dev-cur { font-size: 11px; color: var(--primary); border: 1px solid var(--primary); border-radius: 4px; padding: 0 5px; }
.dev-item button { font-size: 12px; color: var(--danger); background: none; border: none; cursor: pointer; }

/* 语音未读红点（微信同款） */
.v-unread { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fa5151; margin-left: 6px; vertical-align: middle; box-shadow: 0 0 0 2px var(--bubble); }

/* 朋友圈评论删除 */
.cmt-del { margin-left: 8px; font-size: 11px; color: #8a9099; cursor: pointer; opacity: .6; }
.cmt-del:hover { opacity: 1; color: var(--danger); }

/* 群接龙卡片 */
.jielong { min-width: 260px; max-width: 340px; }
.jl-head { font-size: 13px; margin-bottom: 6px; }
.jl-note { font-size: 12px; color: var(--muted); margin-bottom: 6px; white-space: pre-wrap; }
.jl-list { max-height: 200px; overflow-y: auto; border-top: 1px dashed var(--border); padding: 6px 0; }
.jl-item { font-size: 13px; padding: 2px 0; }
.jl-me { color: var(--primary); font-size: 11px; }
.jl-empty { font-size: 12px; color: var(--muted); }
.jl-count { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.jl-join { display: block; width: 100%; padding: 7px; border: none; border-radius: 6px; background: var(--primary); color: #fff; font-size: 13px; cursor: pointer; }
.jl-join:disabled { background: #c8e6d0; color: #666; cursor: default; }

/* 表情商店 */
.store-pack { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.store-emojis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; font-size: 20px; min-width: 130px; }
.store-info { flex: 1; }
.store-info b { display: block; font-size: 14px; }
.store-info span { font-size: 12px; color: var(--muted); }
.store-btn { padding: 6px 14px; border: none; border-radius: 6px; background: var(--primary); color: #fff; font-size: 13px; cursor: pointer; }
.store-btn.owned { background: #e8f7ee; color: var(--primary); }

/* 通讯录标签 */
.tag-row { display: flex; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--border); cursor: pointer; }
.tag-row:hover { background: var(--list-hover); }
.tag-name { flex: 1; font-size: 14px; }
.tag-count { font-size: 12px; color: var(--muted); margin-right: 10px; }
.tag-del { font-size: 12px; color: var(--danger); background: none; border: none; cursor: pointer; }
.tag-badge { background: #fa9d3b; color: #fff; font-size: 10px; padding: 0 4px; border-radius: 3px; margin-left: 4px; }
#tagMembers label { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* 全员公告横幅 */
.broadcast-bar { position: absolute; top: 0; left: 60px; right: 0; z-index: 100; background: #fff8e6; border-bottom: 1px solid #f0c36d; color: #8a6d1a; padding: 7px 16px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.broadcast-bar:hover { background: #fff3d4; }
body[data-theme="dark"] .broadcast-bar { background: #3a3320; border-bottom: 1px solid #5a4d2a; color: #e8c87a; }

/* 快捷回复面板 */
.quick-wrap { position: relative; }
.quick-panel { position: absolute; bottom: 52px; left: 0; width: 260px; max-height: 260px; overflow-y: auto; background: var(--chat-bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-2); padding: 8px; z-index: 60; }
.qr-item { display: flex; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.qr-item:hover { background: var(--list-hover); }
.qr-txt { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-del { border: none; background: none; color: var(--danger); font-size: 15px; cursor: pointer; opacity: .5; }
.qr-del:hover { opacity: 1; }
.qr-add { display: flex; gap: 6px; padding: 6px 8px; }
.qr-add input { flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.qr-add button { border: none; background: var(--primary); color: #fff; border-radius: 6px; padding: 0 10px; cursor: pointer; font-size: 15px; }

/* 待办 */
.todo-item { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.todo-item input { width: 16px; height: 16px; }
.todo-text { flex: 1; font-size: 14px; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-del { border: none; background: none; color: var(--danger); font-size: 16px; cursor: pointer; opacity: .5; }
.todo-del:hover { opacity: 1; }
.todo-done-h { font-size: 12px; color: var(--muted); padding: 8px 4px 4px; }
.rail-badge { position: absolute; top: 4px; right: 6px; min-width: 14px; height: 14px; border-radius: 7px; background: var(--danger); color: #fff; font-size: 10px; line-height: 14px; text-align: center; padding: 0 3px; }

/* 注册协议勾选 */
.agree-row { display: block; margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.agree-row a { color: var(--primary); text-decoration: none; }
.agree-row input { margin-right: 4px; vertical-align: middle; }

/* 帮助中心 */
.help-item { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.help-item b { font-size: 14px; }
.help-item div { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.6; }
