/* ============ h5chat · 仿TG深色主题 ============ */
:root {
  --bg-page: #0e1621;
  --bg-panel: #17212b;
  --bg-elev: #1e2c3a;
  --bg-hover: #202b36;
  --bg-input: #242f3d;
  --bubble-me: #2b5278;
  --bubble-other: #182533;
  --text: #f1f5f7;
  --text-dim: #7d8b99;
  --accent: #5eb5f7;
  --accent-green: #46d160;
  --danger: #e5666e;
  --warn: #f5a623;
  --border: #101921;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { overscroll-behavior-x: none; touch-action: pan-y; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-page); color: var(--text); overflow: hidden; font-size: 15px;
  overscroll-behavior: none; touch-action: pan-y;
}
button, .row, .tab-btn, .switch, .member-item, .chat-row, .icon-btn { touch-action: manipulation; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ============ 通用屏幕 ============ */
.screen { position: fixed; inset: 0; }
.app { height: 100%; height: 100dvh; }

/* ============ 认证页 ============ */
.auth-screen { display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, #1c2f45 0%, var(--bg-page) 55%); overflow-y: auto; }
.auth-box { width: min(92vw, 380px); padding: 28px 0 40px; text-align: center; }
.auth-logo { font-size: 52px; }
.auth-box h1 { font-size: 30px; margin: 6px 0 2px; letter-spacing: 2px; }
.auth-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 26px; }
.tabs { display: flex; background: var(--bg-input); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab-btn { flex: 1; padding: 9px 0; border-radius: 9px; color: var(--text-dim); font-size: 14px; transition: .15s; }
.tab-btn.active { background: var(--bg-panel); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-form input, .search-bar input, .chat-search-bar input, .msg-input, #msg-input, .sheet input, .sheet select {
  background: var(--bg-input); border: 1px solid transparent; border-radius: 11px;
  padding: 12px 14px; color: var(--text); font-size: 15px; outline: none; width: 100%;
}
.auth-form input:focus, #msg-input:focus, .sheet input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent); color: #0e1621; font-weight: 700; border-radius: 11px;
  padding: 12px; font-size: 15px; transition: .15s;
}
.btn-primary:active { transform: scale(.98); opacity: .9; }
.btn-ghost { background: var(--bg-input); color: var(--text); border-radius: 11px; padding: 10px 14px; font-size: 14px; }
.btn-danger { background: var(--danger); color: #fff; border-radius: 11px; padding: 10px 14px; font-size: 14px; }
.btn-green { background: var(--accent-green); color: #0e1621; font-weight: 600; border-radius: 11px; padding: 10px 14px; font-size: 14px; }
.auth-error { background: rgba(229,102,110,.15); color: var(--danger); border-radius: 10px; padding: 10px; margin-top: 12px; font-size: 13px; }
.auth-hint { color: var(--text-dim); font-size: 12px; margin-top: 22px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; flex-shrink: 0; }

/* ============ 应用锁 ============ */
.lock-screen { display: flex; align-items: center; justify-content: center; background: var(--bg-page); }
.lock-box { text-align: center; width: min(92vw, 340px); }
.lock-icon { font-size: 44px; }
.lock-box h2 { margin: 10px 0 4px; font-size: 22px; }
.lock-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.lock-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 26px; }
.lock-dots i { width: 13px; height: 13px; border-radius: 50%; background: var(--bg-input); transition: .12s; }
.lock-dots i.on { background: var(--accent); }
.lock-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.lock-pad button {
  aspect-ratio: 1; font-size: 24px; font-weight: 600; color: var(--text);
  background: var(--bg-input); border-radius: 50%; transition: .1s;
}
.lock-pad button:active { background: var(--accent); color: #0e1621; }

/* ============ 主界面布局 ============ */
.main-screen { background: var(--bg-page); }
.main-wrap { display: flex; height: 100%; max-width: 1080px; margin: 0 auto; }
.sidebar { width: 100%; max-width: 380px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--bg-panel); border-right: 1px solid var(--border); }
.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 14px; }
.side-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.side-avatar, .avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff; flex-shrink: 0; position: relative; user-select: none;
}
.side-title { flex: 1; min-width: 0; }
.side-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-status { display: block; color: var(--text-dim); font-size: 12px; }
.side-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-dim); transition: .15s; background: transparent;
}
.icon-btn:hover, .icon-btn.active { background: var(--bg-hover); color: var(--text); }
/* 语音按钮（发送栏） */
.voice-mic {
  background: linear-gradient(135deg, #3e9bff 0%, #7c5cff 100%);
  color: #fff !important;
  box-shadow: 0 3px 12px rgba(84, 110, 255, .35);
  animation: mic-pulse 2.4s ease-in-out infinite;
}
.voice-mic:hover, .voice-mic.active {
  background: linear-gradient(135deg, #54a9ff 0%, #8f74ff 100%);
  color: #fff !important;
  transform: scale(1.1);
}
.voice-mic.active { animation: mic-beat .8s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 3px 10px rgba(84, 110, 255, .25); } 50% { box-shadow: 0 3px 20px rgba(84, 110, 255, .55); } }
@keyframes mic-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
/* 消息内语音播放按钮 */
.voice-play {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #3e9bff, #7c5cff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; box-shadow: 0 2px 8px rgba(84, 110, 255, .3); transition: .15s; flex: none;
}
.voice-play:hover { transform: scale(1.1); }
/* 置顶 / 焚毁标记 */
.pin-tag { font-size: 12px; }
.burn-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 8px;
  background: rgba(255, 111, 66, .16); color: var(--warn); font-size: 10px; vertical-align: 1px;
}
.bubble.burn-bubble { border: 1px dashed rgba(255, 111, 66, .45); }
.search-bar { padding: 0 12px 10px; }
.search-bar input { padding: 10px 14px; font-size: 14px; }
.chat-tabs { padding: 0 12px 8px; }
.badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #0e1621; font-size: 11px; font-weight: 700; line-height: 18px; vertical-align: top;
}
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.list::-webkit-scrollbar, .messages::-webkit-scrollbar { width: 4px; }
.list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb { background: #2c3c4c; border-radius: 2px; }
.empty-hint { padding: 40px 20px; text-align: center; color: var(--text-dim); font-size: 13px; }

/* 会话项 */
.chat-item { display: flex; align-items: center; gap: 11px; padding: 10px 14px; cursor: pointer; position: relative; }
.chat-item:hover, .chat-item.active { background: var(--bg-hover); }
.chat-item .avatar { width: 50px; height: 50px; font-size: 20px; }
.dot-online { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--accent-green); border: 2.5px solid var(--bg-panel); }
.chat-item .ci-main { flex: 1; min-width: 0; }
.ci-top { display: flex; justify-content: space-between; align-items: baseline; }
.ci-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { color: var(--text-dim); font-size: 11.5px; flex-shrink: 0; }
.ci-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 3px; }
.ci-preview { color: var(--text-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 78%; }
.ci-unread { background: var(--accent); color: #0e1621; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.ci-preview .mine { color: var(--text-dim); }
.ci-fire { color: var(--warn); }

/* 联系人项 */
.contact-item { display: flex; align-items: center; gap: 11px; padding: 10px 14px; cursor: pointer; }
.contact-item:hover { background: var(--bg-hover); }
.contact-main { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; }
.contact-sub { color: var(--text-dim); font-size: 12px; }
.sep { padding: 8px 14px 4px; color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }

/* ============ 聊天窗口 ============ */
.chat-header { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.chat-header .avatar { width: 40px; height: 40px; }
.ch-head-main { flex: 1; min-width: 0; cursor: pointer; }
.ch-head-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-head-status { color: var(--text-dim); font-size: 12px; }
.ch-head-actions { display: flex; gap: 4px; }
.chat-search-bar { display: flex; gap: 8px; padding: 8px 12px; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.chat-search-bar input { padding: 8px 12px; font-size: 14px; }

.messages { flex: 1; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 5px; background: linear-gradient(180deg, #0f1a26 0%, #0e1621 100%); }
.msg-row { display: flex; width: 100%; }
.msg-row.me { justify-content: flex-end; }
.msg-row.other { justify-content: flex-start; }
.bubble {
  max-width: min(78%, 520px); padding: 8px 11px 7px; border-radius: var(--radius); position: relative;
  font-size: 15px; line-height: 1.42; word-break: break-word; white-space: pre-wrap;
}
.msg-row.me .bubble { background: var(--bubble-me); border-top-right-radius: 4px; }
.msg-row.other .bubble { background: var(--bubble-other); border-top-left-radius: 4px; }
.bubble.sys { background: transparent; color: var(--text-dim); font-size: 12.5px; text-align: center; max-width: 100%; padding: 6px 30px; }
.bubble.recalled { background: transparent; color: var(--text-dim); font-size: 13px; font-style: italic; text-align: center; max-width: 100%; }
.bubble img.msg-image { max-width: 100%; max-height: 340px; border-radius: 8px; display: block; margin: 2px 0; cursor: zoom-in; }
.bubble .msg-sender { color: var(--accent); font-size: 13px; font-weight: 600; margin-bottom: 2px; display: block; }
.msg-meta { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 3px; font-size: 11px; color: var(--text-dim); }
.msg-meta .tick { color: var(--text-dim); font-size: 12px; }
.msg-meta .tick.read { color: var(--accent); }
.msg-meta .fire { color: var(--warn); }
.bubble a.file-link { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; min-width: 200px; padding: 4px 2px; }
.file-ico { font-size: 26px; }
.file-info { min-width: 0; }
.file-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { color: var(--text-dim); font-size: 12px; }
.voice-wrap { display: flex; align-items: center; gap: 8px; min-width: 200px; }
.voice-wave { height: 28px; display: flex; align-items: center; gap: 2px; }
.voice-wave i { width: 3px; background: var(--text-dim); border-radius: 2px; }
.voice-wave i.played { background: var(--accent); }
.voice-dur { font-size: 12px; color: var(--text-dim); }
.msg-tools { display: flex; gap: 2px; margin-top: 2px; }
.msg-tools button { font-size: 11px; color: var(--text-dim); padding: 3px 7px; border-radius: 6px; }
.msg-tools button:hover { background: var(--bg-hover); color: var(--text); }
.msg-row.me .msg-tools { justify-content: flex-end; }

.typing-indicator { padding: 4px 16px; color: var(--text-dim); font-size: 12.5px; }
.typing-indicator::before { content: "✍ "; }

/* 输入区 */
.composer { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--bg-panel); border-top: 1px solid var(--border); position: relative; }
#msg-input { flex: 1; border-radius: 22px; padding: 11px 16px; }
.btn-send {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #3e9bff 0%, #7c5cff 100%);
  color: #fff; font-size: 17px;
  box-shadow: 0 3px 12px rgba(84, 110, 255, .35);
  transition: transform .15s, box-shadow .15s, opacity .2s;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: .55;
}
.btn-send .send-ico { display: block; line-height: 1; transform: translateX(1px); }
.btn-send.has-text { opacity: 1; }
.btn-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(84, 110, 255, .5); }
.btn-send:active { transform: scale(.95); }
.attach-menu {
  position: absolute; bottom: 58px; left: 12px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; display: flex; flex-direction: column; box-shadow: 0 6px 24px rgba(0,0,0,.5); z-index: 20;
}
.attach-menu button { text-align: left; padding: 10px 16px; border-radius: 8px; font-size: 14px; }
.attach-menu button:hover { background: var(--bg-hover); }

/* ============ 弹层 ============ */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  position: relative; background: var(--bg-panel); width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 8px 18px 26px; animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet h3 { padding: 12px 4px 10px; font-size: 18px; }
.sheet-close {
  position: absolute; top: 12px; right: 14px; z-index: 2; width: 30px; height: 30px; border: none; border-radius: 50%;
  background: var(--bg-hover); color: var(--text); font-size: 15px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.sheet-close:hover { background: rgba(229,102,110,.2); color: var(--danger); }
.sheet .row { display: flex; align-items: center; gap: 11px; padding: 11px 8px; border-bottom: 1px solid var(--border); cursor: pointer; }
.sheet .row:last-child { border-bottom: none; }
.sheet .row:hover { background: var(--bg-hover); border-radius: 10px; }
.sheet .row .r-ico { font-size: 20px; width: 30px; text-align: center; }
.sheet .row .r-main { flex: 1; }
.sheet .row .r-title { font-size: 15px; }
.sheet .row .r-sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.sheet .row .r-val { color: var(--text-dim); font-size: 13px; }
.sheet .form-group { padding: 8px 4px; }
.sheet .form-group label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.sheet .form-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet .form-actions button { flex: 1; }
.member-item { display: flex; align-items: center; gap: 11px; padding: 9px 8px; }
.member-item .role-tag { font-size: 11px; background: var(--bg-input); padding: 2px 8px; border-radius: 8px; color: var(--text-dim); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px; border-bottom: 1px solid var(--border); }
.toggle-row .t-title { font-size: 15px; }
.toggle-row .t-sub { font-size: 12px; color: var(--text-dim); }
.switch { position: relative; width: 46px; height: 27px; background: var(--bg-input); border-radius: 14px; transition: .15s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 22px; }
.sheet .section-title { padding: 16px 6px 8px; color: var(--text-dim); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.sheet .danger-text { color: var(--danger); }

/* ============ 图片预览 ============ */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 60; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 14px; right: 18px; font-size: 22px; color: #fff; padding: 8px; }

/* ============ 录音 ============ */
.recorder { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 55; display: flex; align-items: center; justify-content: center; }
.rec-inner { background: var(--bg-panel); border-radius: 16px; padding: 26px 30px; text-align: center; }
.rec-timer { font-size: 30px; font-weight: 700; margin-bottom: 18px; font-variant-numeric: tabular-nums; }
.rec-inner .btn-ghost, .rec-inner .btn-primary { margin: 0 5px; min-width: 90px; }

/* ============ toast / 断线 ============ */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); background: var(--bg-elev);
  color: var(--text); padding: 11px 20px; border-radius: 12px; font-size: 14px; z-index: 80;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); max-width: 86vw; text-align: center; animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90; text-align: center; font-size: 13px;
  background: var(--warn); color: #0e1621; padding: 7px; font-weight: 600;
}

/* ============ 时间分组 ============ */
.date-sep { text-align: center; color: var(--text-dim); font-size: 12px; padding: 12px 0 4px; }

/* 头像配色 */
.av-0{background:#3a6ea5}.av-1{background:#3a9e6e}.av-2{background:#a5723a}.av-3{background:#8e5ba5}.av-4{background:#a5485b}
.av-5{background:#4d8fa5}.av-6{background:#6e8f3a}.av-7{background:#a53a3a}.av-8{background:#3a7ba5}.av-9{background:#7b5ba5}

/* ============ 二维码 / 扫码 ============ */
.qr-box { display: flex; justify-content: center; padding: 14px 0 4px; }
.qr-box img { width: 220px; height: 220px; border-radius: 14px; background: #fff; padding: 10px; }
.scan-box { position: relative; width: 100%; max-width: 420px; margin: 6px auto; aspect-ratio: 4 / 3; background: #000; border-radius: 14px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: rgba(255,255,255,.85); font-size: 13px; text-align: center; padding: 12px; }
.scan-loading::before { content: ''; width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-box.cam-on video { display: block; }
.scan-box.cam-on .scan-loading { display: none; }
.scan-err { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-align: center; padding: 16px; }
.scan-err p { margin: 0; font-size: 13px; }
.scan-err-sub { opacity: .75; font-size: 12px; }
.scan-confirm { display: flex; align-items: center; gap: 12px; padding: 12px 8px; }

/* ============ 定位 ============ */
.loc-spin { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; border-radius: 50%; border: 2px solid rgba(94,181,247,.25); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.loc-retry { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ============ 桌面端 ============ */
@media (min-width: 720px) {
  .sidebar { width: 360px; }
  .sheet { border-radius: 18px; margin: 24px auto; align-items: center; }
  .overlay { align-items: center; }
}

/* 移动端聊天全屏 */
@media (max-width: 719px) {
  .sidebar { max-width: none; }
  .chat-pane { position: fixed; inset: 0; z-index: 30; background: var(--bg-page); }
}

/* ============ 手机自适应（iOS / Android） ============ */
@media (max-width: 719px) {
  /* 输入字号 ≥16px，避免 iOS 聚焦自动放大 */
  input, select, textarea, #msg-input { font-size: 16px !important; }
  /* 安全区适配（刘海屏 / 底部横条） */
  .side-header { padding-top: max(12px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .chat-header { padding-top: max(9px, env(safe-area-inset-top)); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .search-bar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .composer { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .messages { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .sheet { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .auth-box { padding: 48px 0 max(48px, env(safe-area-inset-bottom)); }
  .lock-box { padding-bottom: max(30px, env(safe-area-inset-bottom)); }
  .conn-banner { padding-top: max(7px, env(safe-area-inset-top)); }
  .recorder { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  /* 触控目标 ≥44px */
  .icon-btn { width: 44px; height: 44px; font-size: 20px; }
  .composer { gap: 8px; }
  .btn-send { width: 46px; height: 46px; font-size: 19px; }  #msg-input { min-height: 46px; border-radius: 24px; padding: 12px 16px; }
  .composer .attach-menu { bottom: 62px; left: 10px; }
  .lock-pad { gap: 14px; max-width: 340px; margin: 0 auto 24px; }
  .lock-pad button { height: 66px; font-size: 26px; border-radius: 20px; }
  .auth-form input, .sheet input, .sheet select { padding: 13px 15px; }
  .btn-primary, .btn-ghost, .btn-danger, .btn-green { padding: 13px 16px; }
  .btn-primary { font-size: 16px; }
  /* 弹层改为底部抽屉，全宽 */
  .overlay { align-items: flex-end; }
  .sheet { width: 100%; max-height: 88vh; max-height: 88dvh; border-radius: 18px 18px 0 0; margin: 0; }
  .sheet .row, .member-item { padding: 13px 10px; }
  .sheet h3 { font-size: 17px; }
  .chat-row { padding: 12px 12px; }
  .side-avatar { width: 46px; height: 46px; font-size: 20px; }
  /* iOS 惯性滚动 */
  .list, .messages, .sheet { -webkit-overflow-scrolling: touch; }
  /* 消息气泡留出左右边距 */
  .messages { padding-left: 10px; padding-right: 10px; }
  #chat-empty { padding-bottom: 90px; }
}

/* ===== 第五轮新增样式 ===== */
/* 会话列表 群/私 标识 */
.chat-tag {
  display: inline-block; margin-right: 5px; padding: 0 5px; border-radius: 4px;
  font-size: 10px; line-height: 16px; font-weight: 600; vertical-align: 2px; letter-spacing: 1px;
}
.chat-tag.g { background: rgba(124, 92, 255, .15); color: #8f74ff; }
.chat-tag.s { background: rgba(62, 155, 255, .12); color: #54a9ff; }
/* 头像图片 */
.avatar.av-img { overflow: hidden; }
.avatar.av-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 资料弹层大头像 */
.avatar-lg {
  width: 84px; height: 84px; border-radius: 50%; font-size: 34px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--bg-hover); color: var(--text);
}
.avatar-lg.av-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 位置卡片 */
.loc-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px;
  background: rgba(62, 155, 255, .1); border: 1px solid rgba(62, 155, 255, .25);
  min-width: 190px; text-decoration: none; color: var(--text);
}
.loc-pin { font-size: 22px; }
.loc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.loc-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-map { font-size: 11px; color: var(--text-dim); }
/* 进群申请审批横幅 */
.invite-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  background: linear-gradient(135deg, #3e9bff, #7c5cff); color: #fff;
  padding: 12px 16px; font-size: 13px; text-align: center; cursor: pointer;
  box-shadow: 0 3px 14px rgba(84, 110, 255, .4);
  animation: banner-in .25s ease-out;
}
.invite-banner:hover { filter: brightness(1.08); }
@keyframes banner-in { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ===== 实时语音通话 ===== */
.call-bar {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1300;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #1f9d55, #17a05e); color: #fff;
  padding: 10px 16px; border-radius: 24px; box-shadow: 0 4px 20px rgba(31, 157, 85, .45);
  min-width: 240px; max-width: 92vw; animation: banner-in .25s ease-out;
}
.call-ico { font-size: 20px; }
.call-info { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.call-info b { font-size: 14px; }
.call-info em { font-size: 12px; opacity: .9; font-style: normal; }
.call-hangup {
  background: #fff; color: #d93025; border: none; border-radius: 16px;
  padding: 6px 14px; font-weight: 600; font-size: 13px; cursor: pointer;
}
.call-incoming {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1400;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 26px 30px; width: min(320px, 88vw); text-align: center;
  box-shadow: 0 12px 44px rgba(0,0,0,.5); animation: banner-in .25s ease-out;
}
.call-inc-ring { font-size: 46px; animation: call-pulse 1.2s ease-in-out infinite; }
@keyframes call-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.call-inc-title { font-size: 15px; color: var(--text-dim); margin-top: 8px; }
.call-inc-name { font-size: 17px; font-weight: 600; margin: 4px 0 18px; }
.call-inc-actions { display: flex; gap: 12px; justify-content: center; }
.call-inc-actions .btn-danger, .call-inc-actions .btn-primary { min-width: 96px; }

/* 聊天头部签名 */
.ch-bio { font-size: 12px; font-weight: 400; color: var(--text-dim); margin-left: 6px; }

/* 登录页-上次登录账号提示 */
.login-last {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg2, #1e2733);
  border: 1px dashed var(--border, #33404f);
  border-radius: 8px;
  color: var(--text-dim, #8b98ab);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  display: block;
}
.login-last:hover { border-color: #4c6ef5; color: #aab6c8; }
