/* ============================================================
   企业实时通讯 · 样式表
   大厅浅色（企业工具风格） / 通话页深色（视频场景最佳实践）
   ============================================================ */
:root {
  --brand: #3355ff;
  --brand-dark: #2543d8;
  --brand-soft: #eef1ff;
  --ink: #12141a;
  --ink-2: #4a5061;
  --ink-3: #8a90a2;
  --line: #e8eaf0;
  --bg: #f6f7fb;
  --white: #fff;
  --danger: #e5484d;
  --ok: #12a06a;
  --radius: 14px;
  --shadow: 0 2px 8px rgba(18, 20, 26, .06), 0 12px 32px rgba(18, 20, 26, .05);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 重要：作者样式里的 display:flex 会覆盖 UA 的 [hidden]{display:none}，
   导致 el.hidden = true 视觉上不生效（登录后不切大厅、弹窗关不掉）。
   统一在此兜底，优先级最高。 */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }

/* ---------------- 通用组件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 20px; border-radius: 11px;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 600;
  transition: transform .12s ease, background .16s ease, box-shadow .16s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #fafbff; border-color: #d6daea; }
.btn.danger { background: var(--danger); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 9px; }
.btn.block { width: 100%; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--white); font-size: 15px;
  color: var(--ink); outline: none; transition: border-color .16s, box-shadow .16s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(51, 85, 255, .12); }
.input::placeholder { color: #b3b8c7; }

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.badge.gray { background: #f1f2f6; color: var(--ink-2); }
.badge.green { background: #e8f8f1; color: var(--ok); }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6f86ff, #3355ff); color: #fff;
  font-size: 14px; font-weight: 600; letter-spacing: .5px;
}
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }

.rtc-toast {
  position: fixed; left: 50%; bottom: 12%; transform: translate(-50%, 12px);
  background: rgba(18, 20, 26, .9); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .22s ease; z-index: 9999;
  max-width: 80vw; text-align: center;
}
.rtc-toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { padding: 36px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(12, 14, 20, .5);
  display: flex; align-items: center; justify-content: center; z-index: 900;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 360px; background: #fff; border-radius: 18px;
  padding: 26px 22px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
  animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% -10%, #dfe6ff 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 110%, #d9f5ef 0%, transparent 55%),
    var(--bg);
}
.login-card { width: 100%; max-width: 380px; padding: 34px 28px 28px; }
.login-card h1 { margin: 0 0 6px; font-size: 25px; letter-spacing: -.4px; }
.login-card .sub { margin: 0 0 26px; color: var(--ink-3); font-size: 14px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 18px;
  background: linear-gradient(135deg, #6f86ff, #3355ff);
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 8px 20px rgba(51, 85, 255, .3);
}
.hint { margin: 18px 0 0; font-size: 12.5px; color: var(--ink-3); text-align: center; line-height: 1.7; }

/* ---------------- 大厅 ---------------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  height: 60px; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line);
}
.app-header .title { font-size: 16px; font-weight: 650; flex: 1; letter-spacing: -.2px; }
.app-header .me { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.app-header .logout { font-size: 13px; color: var(--ink-3); }

.lobby { max-width: 720px; margin: 0 auto; padding: 18px 16px 90px; }
.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.section-head h2 { margin: 0; font-size: 14px; font-weight: 650; color: var(--ink-2); letter-spacing: .2px; }
.section-head .action { font-size: 13.5px; color: var(--brand); font-weight: 500; cursor: pointer; user-select: none; transition: color .15s; }
.section-head .action:hover { color: var(--brand-dark); }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-card {
  display: flex; align-items: center; gap: 12px; padding: 18px 16px;
  border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow);
  border: 1px solid transparent; transition: .16s ease; text-align: left;
}
.action-card:hover { border-color: #dfe4ff; transform: translateY(-1px); }
.action-card .ico {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.action-card .ico.blue { background: var(--brand-soft); color: var(--brand); }
.action-card .ico.green { background: #e8f8f1; color: var(--ok); }
.action-card .txt strong { display: block; font-size: 15px; font-weight: 600; }
.action-card .txt small { color: var(--ink-3); font-size: 12.5px; }

.list { overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid #f2f3f7; background: #fff;
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-size: 15px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.list-item .meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.list-item .ops { display: flex; gap: 8px; flex: none; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); transition: .15s;
}
.icon-btn:hover { background: #e2e8ff; }
.icon-btn.gray { background: #f2f3f7; color: var(--ink-2); }

.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row .input { height: 42px; }

.tabs { display: flex; gap: 6px; background: #eef0f6; padding: 3px; border-radius: 10px; }
.tabs button { flex: 1; height: 34px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* ---------------- 通话页 ---------------- */
body.meeting-body { background: #0d0f14; color: #eef0f6; overflow: hidden; }
.meeting { height: 100dvh; display: flex; flex-direction: column; }

.mt-header {
  height: 56px; flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; background: rgba(13, 15, 20, .82); border-bottom: 1px solid rgba(255, 255, 255, .07);
  backdrop-filter: blur(12px);
}
.mt-header .subj { flex: 1; min-width: 0; }
.mt-header .subj strong { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-header .subj span { font-size: 12px; color: #8f96a8; }
.mt-header .stat { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #9ba2b4; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 160, 106, .18); }
.dot.warn { background: #f5a524; box-shadow: 0 0 0 3px rgba(245, 165, 36, .18); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(229, 72, 77, .18); }

.video-grid {
  flex: 1; min-height: 0; padding: 12px; gap: 10px;
  display: grid; grid-template-columns: 1fr; align-content: center;
  grid-auto-rows: 1fr; overflow-y: auto;
}
.video-grid.count-2 { grid-template-columns: 1fr 1fr; }
.video-grid.count-3, .video-grid.count-4 { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(0, 1fr); }
.video-grid.count-5, .video-grid.count-6, .video-grid.count-7, .video-grid.count-8, .video-grid.count-9 {
  grid-template-columns: 1fr 1fr 1fr;
}

.tile {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #191d26; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
/* TRTC SDK 会把 <video> 挂进这个槽位，绝对定位覆盖占位层 */
.tile .video-slot { position: absolute; inset: 0; z-index: 1; }
.tile .video-slot video { width: 100%; height: 100%; object-fit: cover; display: block; background: #191d26; }
.tile.no-video .video-slot { display: none; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #191d26; }
.tile .ph { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tile .ph .avatar { width: 56px; height: 56px; font-size: 18px; }
.tile .ph small { color: #8f96a8; font-size: 12px; }
/* z-index 必须高于 .video-slot(1)：否则视频一渲染就把昵称和静音图标整块盖住 */
.tile .tag {
  position: absolute; left: 9px; bottom: 9px; max-width: calc(100% - 18px); z-index: 3;
  padding: 3px 9px; border-radius: 7px; background: rgba(0, 0, 0, .62);
  font-size: 12px; color: #e8ebf2; display: flex; align-items: center; gap: 5px;
  backdrop-filter: blur(6px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .tag > span:first-child { overflow: hidden; text-overflow: ellipsis; }
/* 静音喇叭图标：用 SVG 而不是 emoji，Android 部分 WebView 的 🔇 会渲染成灰方块 */
.tile .tag .muted { color: #ff8a8d; display: inline-flex; flex: none; align-items: center; }
.tile .tag .muted svg { display: block; }
.tile.speaking { outline: 2px solid rgba(51, 85, 255, .8); outline-offset: -2px; }
.tile .role {
  position: absolute; right: 9px; top: 9px; padding: 2px 7px; border-radius: 6px; z-index: 3;
  background: rgba(51, 85, 255, .85); font-size: 11px; font-weight: 600;
}

.mt-controls {
  flex: none; height: 84px; display: flex; align-items: center; justify-content: center; gap: 18px;
  padding-bottom: env(safe-area-inset-bottom); background: rgba(13, 15, 20, .9);
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.ctrl {
  width: 52px; height: 52px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  background: rgba(255, 255, 255, .08); color: #d4d9e4; transition: .15s;
}
.ctrl:hover { background: rgba(255, 255, 255, .14); }
/* 媒体开关按钮的视觉语义必须与用户直觉一致：
   「亮 = 开启中」（白底高亮）、「暗 = 已关闭」（深灰 + 图标带斜杠）。
   此前 off 用红色发光背景，看起来像「点亮/开启中」，用户全程觉得显示反了。 */
.ctrl.on { background: #f2f4f8; color: #12141a; }
.ctrl.off { background: rgba(0, 0, 0, .42); color: #78808f; }
.ctrl.hangup { background: var(--danger); color: #fff; width: 60px; height: 52px; border-radius: 26px; }
.ctrl.hangup:hover { background: #c93c41; }
.ctrl.active { background: var(--brand); color: #fff; }
.ctrl span { font-size: 10.5px; }

.side-panel {
  position: absolute; right: 0; top: 56px; bottom: 84px; width: min(340px, 88vw);
  background: #12151d; border-left: 1px solid rgba(255, 255, 255, .08);
  display: flex; flex-direction: column; z-index: 30; transform: translateX(100%);
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
  border-bottom-left-radius: 14px;
}
.side-panel.open { transform: translateX(0); }
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-close {
  flex: none; width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .07);
  color: #b6bdcc; font-size: 19px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.side-close:hover { background: rgba(255, 255, 255, .14); }
.side-head .tabs { flex: 1; background: rgba(255, 255, 255, .07); }
.side-head .tabs button { color: #9ba2b4; }
.side-head .tabs button.active { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }
.side-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
.side-foot { padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; gap: 8px; }

.member-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 10px; }
.member-row:hover { background: rgba(255, 255, 255, .05); }
.member-row .grow { flex: 1; min-width: 0; }
.member-row .nm { font-size: 14px; color: #e8ebf2; display: flex; align-items: center; gap: 6px; }
.member-row .st { font-size: 11.5px; color: #7f8798; }
.member-row .mini { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .07); color: #b6bdcc; }
.member-row .mini:hover { background: rgba(255, 255, 255, .13); }

.chat-list { display: flex; flex-direction: column; gap: 10px; }
.chat-item .who { font-size: 11.5px; color: #7f8798; margin-bottom: 3px; }
.chat-item .bubble {
  display: inline-block; padding: 8px 12px; border-radius: 12px; max-width: 100%;
  background: rgba(255, 255, 255, .08); font-size: 14px; word-break: break-word; color: #e8ebf2;
}
.chat-item.mine { align-items: flex-end; display: flex; flex-direction: column; }
.chat-item.mine .bubble { background: var(--brand); }

.call-overlay {
  position: absolute; inset: 0; z-index: 40; background: #0d0f14;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  text-align: center; padding: 30px;
}
.call-overlay h2 { margin: 0; font-size: 20px; font-weight: 600; }
.call-overlay p { margin: 0; color: #8f96a8; font-size: 14px; }
.pulse {
  width: 108px; height: 108px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6f86ff, #3355ff); color: #fff; font-size: 30px; font-weight: 600;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(51, 85, 255, .45); }
  70% { box-shadow: 0 0 0 26px rgba(51, 85, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(51, 85, 255, 0); }
}
.overlay-ops { display: flex; gap: 28px; margin-top: 18px; }
.round-btn {
  width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .1); color: #fff;
}
.round-btn.accept { background: var(--ok); }
.round-btn.reject { background: var(--danger); }

@media (max-width: 560px) {
  .quick-actions { grid-template-columns: 1fr; }
  .video-grid.count-2 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .mt-controls { gap: 12px; }
  .ctrl { width: 48px; height: 48px; }
}

/* ---------------- 真机调试浮层：连点左上角网络指示 5 次唤起 ---------------- */
.debug-console {
  position: absolute; left: 0; right: 0; top: 56px; z-index: 90;
  max-height: 52%; display: flex; flex-direction: column;
  background: rgba(8, 9, 13, .96); border-bottom: 1px solid rgba(255, 255, 255, .12);
  font: 11px/1.6 ui-monospace, Menlo, Consolas, monospace; color: #c9d1e0;
}
.debug-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, .1); color: #8f96a8;
}
.debug-clear { color: #8f96a8; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .08); }
.debug-body { overflow-y: auto; padding: 8px 12px; white-space: pre-wrap; word-break: break-all; }
.debug-body .lg-err { color: #ff8a8d; }
.debug-body .lg-warn { color: #ffce6b; }
.debug-body .lg-ok { color: #7be0ae; }

/* ================================================================ IM 聊天 */
#chat-view {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  background: var(--bg, #f4f6fa);
}
.chat-header {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--card, #fff);
  border-bottom: 1px solid var(--line, rgba(18, 24, 40, .08));
  padding-top: calc(8px + env(safe-area-inset-top));
}
.chat-back { flex: none; width: 36px; height: 36px; border-radius: 9px; display: flex;
  align-items: center; justify-content: center; background: none; color: var(--ink, #1c2333); }
.chat-back:active { background: rgba(18, 24, 40, .06); }
.chat-peer { display: flex; flex-direction: column; min-width: 0; }
.chat-peer strong { font-size: 15px; color: var(--ink, #1c2333); }

.chat-msgs {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 14px;
}
.chat-more { flex: none; text-align: center; margin-bottom: 4px; }
.chat-more-btn {
  font-size: 12px; color: var(--brand); background: none; padding: 4px 12px;
  border-radius: 12px; border: 1px solid currentColor; opacity: .8;
}

.msg-row { display: flex; gap: 8px; align-items: flex-start; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-row .avatar { flex: none; }
.msg-body { max-width: 72%; display: flex; flex-direction: column; gap: 3px; }
.msg-row.mine .msg-body { align-items: flex-end; }
.msg-bubble {
  position: relative; padding: 8px 12px; border-radius: 12px; font-size: 15px;
  line-height: 1.45; word-break: break-word; white-space: pre-wrap;
  background: var(--card, #fff); color: var(--ink, #1c2333);
  box-shadow: 0 1px 2px rgba(18, 24, 40, .05);
}
.msg-row.mine .msg-bubble { background: var(--brand); color: #fff; }
.msg-row.mine .msg-bubble::after,
.msg-row:not(.mine) .msg-bubble::before {
  content: ''; position: absolute; top: 12px; border: 6px solid transparent;
}
.msg-row:not(.mine) .msg-bubble::before { left: -11px; border-right-color: var(--card, #fff); }
.msg-row.mine .msg-bubble::after { right: -11px; border-left-color: var(--brand); }
.msg-time { font-size: 11px; color: var(--ink-3, #9aa1b2); padding: 0 3px; }
/* 说话人：自己一律「我」，对方是昵称（.msg-name 被会话列表占用，这里另起名） */
.msg-author {
  font-size: 11.5px; line-height: 1.2; color: var(--ink-3, #9aa1b2); font-weight: 400;
  padding: 0 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 语音气泡 */
.msg-bubble.voice { display: flex; align-items: center; gap: 8px; min-width: 84px; cursor: pointer; user-select: none; }
.msg-bubble.voice .v-ico { flex: none; display: inline-flex; }
.msg-bubble.voice .v-dur { font-variant-numeric: tabular-nums; }
.msg-bubble.voice.playing .v-ico { color: #7be0ae; }

/* 图片气泡：图片本体即气泡，去掉底色 / 内边距 / 小尾巴 */
.msg-bubble.img {
  padding: 0; background: none; box-shadow: none; cursor: pointer;
  position: relative; min-width: 72px; min-height: 40px; overflow: hidden; border-radius: 12px;
}
.msg-bubble.img::before, .msg-bubble.img::after { display: none; }
.msg-bubble.img img {
  display: block; max-width: 200px; max-height: 268px; width: auto; height: auto;
  border-radius: 12px; box-shadow: 0 1px 3px rgba(18, 24, 40, .12); background: #eef1f6;
}
/* 发送中：本地预览 + 右下角角标 */
.msg-bubble.img.sending img { opacity: .78; }
.msg-bubble.img.sending .img-pending { display: inline-block; }
/* 远端图片下载中：占位文案；失败可点击重试 */
.msg-bubble.img.waiting, .msg-bubble.img.fail {
  background: var(--card, #fff); box-shadow: 0 1px 2px rgba(18, 24, 40, .05);
}
.msg-bubble.img.waiting img, .msg-bubble.img.fail img { display: none; }
.msg-bubble.img .img-fail {
  display: none; padding: 11px 13px; font-size: 12.5px; color: var(--ink-3, #9aa1b2);
}
.msg-bubble.img.waiting .img-fail, .msg-bubble.img.fail .img-fail { display: inline-block; }
.msg-bubble.img .img-pending {
  display: none; position: absolute; right: 7px; bottom: 6px; padding: 2px 7px;
  border-radius: 8px; background: rgba(12, 14, 20, .55); color: #fff; font-size: 11px;
}

/* 聊天拍照页底部：相册 / 快门 / 占位，快门居中 */
.shot-bar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px calc(26px + env(safe-area-inset-bottom));
}
.shot-side {
  min-width: 56px; height: 40px; border: none; background: none; color: rgba(255, 255, 255, .88);
  font-size: 14.5px;
}
.shot-btn {
  width: 68px; height: 68px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .9);
  background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18);
  flex: none;
}
.shot-btn:active { transform: scale(.94); background: #e9edf6; }

/* 大图预览 */
.chat-lightbox {
  position: fixed; inset: 0; z-index: 900; display: flex; align-items: center;
  justify-content: center; background: rgba(6, 8, 12, .92); padding: 16px;
}
.chat-lightbox[hidden] { display: none; }
.chat-lightbox img {
  max-width: 100%; max-height: 100%; border-radius: 6px; object-fit: contain;
}

.chat-input-bar, .chat-record {
  flex: none; display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--card, #fff); border-top: 1px solid var(--line, rgba(18, 24, 40, .08));
}
.chat-record { align-items: center; }
.chat-tool {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; color: var(--ink-2, #5a6478); background: none;
}
.chat-tool.on { color: var(--brand); }
.chat-tool:active { background: rgba(18, 24, 40, .06); }
#chat-input {
  flex: 1; min-height: 38px; max-height: 108px; resize: none; border: none; outline: none;
  background: var(--bg, #f4f6fa); border-radius: 10px; padding: 9px 12px;
  font: 15px/1.4 var(--font); color: var(--ink, #1c2333);
}
.chat-send {
  flex: none; height: 38px; padding: 0 16px; border-radius: 10px; border: none;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
}
.chat-send:disabled { opacity: .5; }

.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger, #e5484d);
  animation: rec-blink 1s infinite; flex: none; }
@keyframes rec-blink { 50% { opacity: .25; } }
#rec-timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--ink, #1c2333); min-width: 44px; }
.rec-hint { font-size: 13px; color: var(--ink-3, #9aa1b2); }

.chat-emoji {
  flex: none; max-height: 216px; overflow-y: auto; display: grid;
  grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px;
  background: var(--card, #fff); border-top: 1px solid var(--line, rgba(18, 24, 40, .08));
}
.chat-emoji button {
  border: none; background: none; font-size: 22px; padding: 4px 0; border-radius: 8px; line-height: 1.4;
}
.chat-emoji button:active { background: rgba(18, 24, 40, .08); }

/* 通讯录上的未读角标与消息预览 */
.list-item { position: relative; }
/* 角标挂在头像右上角（微信式）：原来绝对定位在行右侧会压住「发消息」按钮 */
.chat-badge {
  position: absolute; right: -3px; top: -3px; z-index: 2; min-width: 17px; height: 17px;
  border-radius: 9px; background: var(--danger, #e5484d); color: #fff; font-size: 10.5px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid #fff; box-sizing: content-box;
}
.list-item .meta.chat-meta { color: var(--ink-2, #5a6478); }

/* 通讯录在线状态点：头像右下角绿点（微信式），USER_PRESENCE 推送只挪这个点 */
.avatar-wrap { position: relative; flex: none; }
.presence-dot {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid #fff; background: #c3c9d6;
}
.presence-dot.on { background: #22c55e; }

/* 手机号登录：验证码行 + 模式切换链接 + 外部用户标识 */
.sms-row { display: flex; gap: 8px; }
.sms-row .input { flex: 1; min-width: 0; }
.sms-row .btn { flex: none; height: 46px; min-width: 108px; font-size: 14px; }
.btn.link {
  width: 100%; margin-top: 4px; background: none; color: var(--brand);
  font-size: 14px; font-weight: 500; height: auto; padding: 8px 0;
}
.badge.orange { background: #fff3e6; color: #d97a1a; }

/* ================================================================ 大厅 v2（微信式） */
/* 结构：固定头 + 可滚动面板 + 底部导航。
   用 100dvh 而不是让 body 滚动，避免手机浏览器地址栏收缩时底栏跳动。 */
#lobby-view {
  height: 100dvh; display: flex; flex-direction: column;
  background: #f4f5f7;
}

.app-header.wx {
  flex: none; height: 52px; display: flex; align-items: center;
  padding: 0 10px; background: rgba(247, 247, 247, .94);
  border-bottom: 1px solid rgba(18, 20, 26, .06);
  backdrop-filter: saturate(180%) blur(14px);
  padding-top: env(safe-area-inset-top);
  height: calc(52px + env(safe-area-inset-top));
}
.app-header.wx .title {
  flex: 1; text-align: center; font-size: 16.5px; font-weight: 600; letter-spacing: -.2px;
}
.app-header.wx .hdr-side { width: 60px; display: flex; align-items: center; }
.app-header.wx .hdr-side.right { justify-content: flex-end; }
.hdr-btn {
  width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; color: var(--ink); background: none;
}
.hdr-btn:active { background: rgba(18, 20, 26, .06); }
.hdr-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16); margin-left: 8px;
}
.hdr-dot.off { background: #c9ceda; box-shadow: 0 0 0 3px rgba(18, 20, 26, .05); }

.panels { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panel { padding-bottom: 12px; }
.panel-hint {
  margin: 10px 18px 0; font-size: 12px; color: #a2a8b6; line-height: 1.6;
}

.list-plain { background: #fff; }
/* 列表头（通讯录 / 通话）：浅灰底、与列表同色系分隔 */
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 8px;
}
.list-head .lh-title { font-size: 13px; color: #8a90a2; font-weight: 600; letter-spacing: .3px; }
.list-head .action { font-size: 13.5px; color: var(--brand); font-weight: 500; }
.list-head.end { justify-content: flex-end; }

/* 通讯录里的消息预览 / 部门行统一单行省略，避免长文本把行撑成两行 */
.list-item .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 消息（会话列表） ---------------- */
.msg-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  background: #fff; border-bottom: 1px solid #f3f4f7; cursor: pointer;
}
.msg-item:last-child { border-bottom: none; }
.msg-item:active { background: #f6f7f9; }
.msg-item .avatar { width: 46px; height: 46px; font-size: 15px; }
.msg-main { flex: 1; min-width: 0; }
.msg-name {
  font-size: 15.5px; font-weight: 550; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-preview {
  margin-top: 3px; font-size: 13px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-preview .v { color: var(--brand); }
.msg-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-time { font-size: 11.5px; color: #a8aebc; }
.msg-unread {
  min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* ---------------- 通讯录 ---------------- */
.search-block {
  position: sticky; top: 0; z-index: 5; background: #f4f5f7;
  padding: 10px 14px;
}
.search-box {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px;
  background: #fff; border-radius: 10px;
}
.search-box .s-ico { color: #b0b6c4; flex: none; }
.search-box input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font-size: 14.5px; color: var(--ink);
}
.search-box input::placeholder { color: #b3b8c7; }

/* ---------------- 通话（去重行） ---------------- */
.call-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.call-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-times {
  flex: none; font-size: 11px; color: var(--ink-3); background: #f1f2f6;
  border-radius: 6px; padding: 1px 6px; font-variant-numeric: tabular-nums;
}
.call-meta.missed { color: #e5645f; }
.call-act {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.call-act.video { background: #eef7f2; color: var(--ok); }
.call-act:active { transform: scale(.94); }
.call-side { display: flex; align-items: center; gap: 8px; flex: none; }
.call-time { font-size: 11.5px; color: #a8aebc; margin-top: 2px; }

/* ---------------- 我 ---------------- */
.me-head {
  display: flex; align-items: center; gap: 14px; padding: 24px 20px 22px; background: #fff;
}
.me-head .avatar.lg { width: 64px; height: 64px; font-size: 20px; border-radius: 16px; }
.me-nick { font-size: 19px; font-weight: 650; letter-spacing: -.3px; }
.me-tags { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.me-id { font-size: 12px; color: #a2a8b6; }

.me-group { margin-top: 10px; background: #fff; }
.me-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 15px 18px; background: #fff; border: none; text-align: left;
  border-bottom: 1px solid #f3f4f7; font-size: 15px; color: var(--ink);
}
.me-group .me-row:last-child { border-bottom: none; }
.me-row:not(.static):active { background: #f6f7f9; }
.me-row .mr-label { flex: none; font-weight: 500; }
.me-row .mr-value {
  flex: 1; text-align: right; font-size: 13.5px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-row .chev { flex: none; color: #c4c9d4; }
.me-row.danger { justify-content: center; color: var(--danger); }
.me-row.danger .mr-label { font-weight: 500; }
.me-version {
  margin: 26px 0 0; text-align: center; font-size: 11.5px; color: #b3b8c7; line-height: 1.8;
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
  flex: none; display: flex; background: rgba(255, 255, 255, .96);
  border-top: 1px solid rgba(18, 20, 26, .07);
  backdrop-filter: saturate(180%) blur(14px);
  padding-bottom: env(safe-area-inset-bottom); z-index: 30;
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; color: #9aa1b2; font-size: 10.5px; position: relative;
  transition: color .15s;
}
.tabbar .tab.active { color: var(--brand); }
.tabbar .tab svg { display: block; }
.tabbar .tab-badge {
  position: absolute; top: 3px; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 1.5px solid #fff; box-sizing: content-box;
}

/* ---------------- 「+」动作面板 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(12, 14, 20, .42); z-index: 800;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 720px; background: #f4f5f7;
  border-radius: 16px 16px 0 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  animation: sheet-up .22s ease;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .sheet-title {
  text-align: center; font-size: 12.5px; color: #9aa1b2; padding: 6px 0 10px;
}
.sheet .sheet-group {
  background: #fff; border-radius: 12px; overflow: hidden;
}
.sheet button.sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 15px 16px; background: #fff; font-size: 15.5px; color: var(--ink);
  border-bottom: 1px solid #f3f4f7; text-align: left;
}
.sheet .sheet-group .sheet-item:last-child { border-bottom: none; }
.sheet .sheet-item:active { background: #f6f7f9; }
.sheet .sheet-item .si-ico {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; background: var(--brand-soft); color: var(--brand); flex: none;
}
.sheet .sheet-item .si-ico.green { background: #e8f8f1; color: var(--ok); }
.sheet .sheet-item small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.sheet .sheet-cancel {
  width: 100%; margin-top: 8px; height: 50px; border-radius: 12px; background: #fff;
  font-size: 16px; color: var(--ink); font-weight: 500;
}

/* 通讯录一行要塞「头像 + 昵称 + 在线胶囊 + 4 个操作按钮」，
   390 这种主流手机宽度下必须收紧按钮，否则昵称与手机号会被挤到只剩省略号 */
@media (max-width: 430px) {
  .list-item .ops { gap: 6px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 9px; }
  .list-item { gap: 10px; }
}

@media (max-width: 360px) {
  .list-item .ops { gap: 6px; }
  .icon-btn { width: 32px; height: 32px; border-radius: 9px; }
}

/* ================================================================ 好友体系 / 个人中心（v3） */

/* ---------------- 头像图片 ---------------- */
.avatar.img {
  display: block; width: 46px; height: 46px; object-fit: cover;
  border-radius: 50%;
}
/* 头像容器里塞 <img>：保持圆形尺寸，图片铺满，不留渐变底 */
.avatar.has-img { padding: 0; overflow: hidden; background: none; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 消息行头像与 .avatar 主体同尺寸（.avatar.img 默认 46px 偏大） */
.msg-row .avatar.has-img { width: 42px; height: 42px; }
.avatar.sm.has-img { width: 32px; height: 32px; }
#me-avatar .avatar.img { width: 64px; height: 64px; border-radius: 16px; }

/* ---------------- 通讯录：新的朋友入口 ---------------- */
.nf-entry {
  display: inline-flex; align-items: center; gap: 5px; position: relative;
  border: none; background: none; padding: 5px 10px; border-radius: 9px;
  font-size: 13.5px; color: var(--brand); font-weight: 500;
}
.nf-entry:active { background: rgba(59, 91, 219, .08); }
.nf-badge {
  position: absolute; top: -3px; right: -7px;
  min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 1.5px solid #fff; box-sizing: content-box;
}

/* ---------------- 子页面（新的朋友等全屏覆盖） ---------------- */
.subpage {
  position: fixed; inset: 0; z-index: 700; background: #f4f5f7;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.subpage-header {
  flex: none; height: 52px; display: flex; align-items: center;
  padding: 0 6px 0 4px; background: rgba(247, 247, 247, .94);
  border-bottom: 1px solid rgba(18, 20, 26, .06);
  backdrop-filter: saturate(180%) blur(14px);
}
.subpage-header .title {
  flex: 1; text-align: center; font-size: 16.5px; font-weight: 600; letter-spacing: -.2px;
}
.subpage-header .hdr-side { width: 44px; }
.subpage-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 14px; }
.subpage .search-block { background: transparent; }
.subpage .empty.small { padding: 18px 16px; font-size: 13px; }

/* 搜索输入条（新的朋友页里的整行输入框） */
.nf-search { height: 38px; border-radius: 10px; width: 100%; }

/* ---------------- 小按钮 / 灰徽标 ---------------- */
.btn.tiny {
  height: 30px; padding: 0 14px; font-size: 13px; border-radius: 8px; font-weight: 500;
}
.badge.gray {
  background: #eef0f5; color: var(--ink-3); font-size: 11px;
  border-radius: 6px; padding: 2px 8px;
}
/* 删除好友：红色系按钮，和聊天 / 语音 / 视频三个蓝色按钮区分开，避免误点 */
.icon-btn.danger { color: #c24a4a; background: #fdeeee; }
.icon-btn.danger:hover { background: #fbe0e0; }

/* ---------------- 我：头像 / 昵称编辑 ---------------- */
.me-avatar-btn {
  position: relative; border: none; background: none; padding: 0; flex: none;
  border-radius: 16px; cursor: pointer;
}
.me-avatar-edit {
  position: absolute; right: -4px; bottom: -4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.me-nick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; padding: 2px 4px; margin-left: -4px;
  border-radius: 8px; cursor: pointer;
}
.me-nick-btn:active { background: rgba(18, 20, 26, .06); }
.nick-edit { color: #b8bdc9; }

/* ---------------- 我的二维码 ---------------- */
.modal-mask.center { z-index: 950; }
.qr-card {
  width: 300px; background: #fff; border-radius: 20px; padding: 22px 22px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: pop .2s ease;
}
.qr-head { display: flex; align-items: center; gap: 12px; }
.qr-name { font-size: 18px; font-weight: 650; letter-spacing: -.3px; }
.qr-mobile { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.qr-box {
  margin-top: 18px; padding: 14px; border: 1px solid #eef0f5; border-radius: 14px;
  display: flex; justify-content: center; background: #fff;
}
.qr-img { width: 232px; height: 232px; display: block; }
.qr-tip { margin: 14px 0 0; text-align: center; font-size: 12.5px; color: #9aa1b2; }
.qr-close {
  display: block; margin: 18px auto 0; min-width: 120px; height: 40px;
  border-radius: 20px; border: none; background: rgba(255, 255, 255, .9);
  color: var(--ink); font-size: 15px; font-weight: 500;
}

/* 二维码关闭按钮：固定在底部中间，压在遮罩之上 */
.qr-close {
  position: fixed; left: 50%; bottom: calc(34px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 960; margin: 0;
}

/* ---------------- 扫码添加好友 ---------------- */

/* 搜索行：输入框 + 扫码按钮 */
.nf-search-row { display: flex; align-items: center; gap: 8px; }
.nf-search-row .search-box { flex: 1; min-width: 0; }
.nf-scan {
  flex: none; width: 38px; height: 38px; border: none; border-radius: 10px;
  background: #fff; color: var(--brand); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(18, 20, 26, .06);
}
.nf-scan:active { background: var(--brand-soft); }
.nf-scan svg { display: block; }

/* 扫码全屏页：相机画面是深色的，这里沿用通话页的深色基调 */
.scan-page {
  position: fixed; inset: 0; z-index: 900;
  display: flex; flex-direction: column;
  background: #0b0d12; color: #fff;
}
.scan-header {
  flex: none; height: 52px; display: flex; align-items: center;
  padding: 0 8px 0 4px; position: relative; z-index: 2;
}
.scan-header .title { flex: 1; text-align: center; font-size: 16.5px; font-weight: 600; }
.scan-header .hdr-side { width: 44px; }
.scan-close {
  width: 44px; height: 44px; border: none; background: none; color: #fff;
  display: flex; align-items: center; justify-content: center; border-radius: 10px;
}
.scan-close:active { background: rgba(255, 255, 255, .12); }

.scan-stage {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: #000;
}
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* 取景框：中心正方形，四周用超大阴影压暗（无需额外遮罩层） */
.scan-frame {
  position: relative; width: min(68vw, 300px); aspect-ratio: 1 / 1;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .52);
  border-radius: 14px;
}
.scan-frame .c { position: absolute; width: 28px; height: 28px; border: 3px solid #fff; }
.scan-frame .c.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.scan-frame .c.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; border-radius: 0 10px 0 0; }
.scan-frame .c.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; border-radius: 0 0 0 10px; }
.scan-frame .c.br { bottom: -2px; right: -2px; border-left: none; border-top: none; border-radius: 0 0 10px 0; }
.scan-line {
  position: absolute; left: 8%; right: 8%; top: 6%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(91, 124, 255, 0), #7d97ff, rgba(91, 124, 255, 0));
  box-shadow: 0 0 12px rgba(91, 124, 255, .9);
  animation: scanMove 2.2s ease-in-out infinite;
}
@keyframes scanMove {
  0% { top: 6%; opacity: .25; }
  50% { top: 92%; opacity: 1; }
  100% { top: 6%; opacity: .25; }
}

.scan-footer {
  flex: none; padding: 16px 22px calc(22px + env(safe-area-inset-bottom)); text-align: center;
}
.scan-tip { margin: 0; font-size: 13.5px; line-height: 1.6; color: rgba(255, 255, 255, .82); }
.scan-tip.warn { color: #ffb3b3; }

/* 识别结果卡片：贴在页面底部，盖在取景层之上 */
.scan-result {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
}
.scan-card {
  background: #fff; color: var(--ink); border-radius: 16px; padding: 16px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .3);
}
.scan-card-head { display: flex; align-items: center; gap: 12px; }
.scan-card-name { display: flex; align-items: center; gap: 8px; font-size: 16.5px; font-weight: 650; }
.scan-card-meta { margin-top: 5px; font-size: 12.5px; color: var(--ink-3); }
.scan-card-msg { margin: 12px 0 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.scan-card-ops { display: flex; gap: 10px; margin-top: 14px; }
.scan-card-ops .btn { flex: 1; height: 40px; padding: 0; border-radius: 10px; font-size: 14.5px; }
.scan-loading { font-size: 14.5px; font-weight: 600; }
.scan-raw { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); word-break: break-all; }

/* 结果卡片里的头像用 64px（.avatar.img 默认 46px） */
.scan-card .avatar.lg { width: 56px; height: 56px; font-size: 18px; border-radius: 50%; }
.scan-card .avatar.lg.img { width: 56px; height: 56px; }

/* 识别成功后保留的最后一帧：轻微压暗，作为结果卡片的背景 */
.scan-video.scan-shot { filter: brightness(.62) saturate(.9); }

/* ================================================================ 在线状态（v4）
   在线状态用「颜色 + 文字」双编码：只靠一个 12px 绿点在小屏上很容易被忽略。
   绿点（头像右下）负责扫视，名字旁的胶囊负责确认，顶部统计条负责概览。 */

/* ---------------- 通讯录顶部：在线 / 离线统计 ---------------- */
.presence-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 18px; margin-top: 8px; background: #fff;
  border-bottom: 1px solid #f3f4f7;
}
.presence-bar .grow { flex: 1; }
.presence-bar .pb-item {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.presence-bar .pb-item b { font-weight: 650; }
.presence-bar .pb-item.on b { color: var(--ok); }
.presence-bar .pb-item.off b { color: var(--ink-3); }
.pb-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.presence-bar .pb-item.on .pb-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .14); }
.presence-bar .pb-item.off .pb-dot { background: #c3c9d6; }
.presence-bar .pb-note { font-size: 11.5px; color: #a8aebc; }

/* ---------------- 名字旁的在线 / 离线胶囊 ---------------- */
.presence-badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 18px; padding: 0 7px; border-radius: 9px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
}
.presence-badge .pb-dot { width: 5px; height: 5px; }
.presence-badge.on { background: #e8f8f1; color: var(--ok); }
.presence-badge.on .pb-dot { background: #22c55e; }
.presence-badge.off { background: #f1f2f6; color: var(--ink-3); }
.presence-badge.off .pb-dot { background: #b9bfcc; }

/* 昵称过长时省略，不能把胶囊挤出可视区域 */
.list-item .name { min-width: 0; }
.list-item .name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 离线行：淡化 + 呼叫按钮置灰 ---------------- */
.list-item.is-offline .name .nm { color: var(--ink-3); }
.list-item.is-offline .avatar,
.msg-item.is-offline .avatar { filter: grayscale(1); opacity: .78; }
/* 呼叫按钮的「不可用」外观：.is-locked 是软禁用（仍可点击，点了给原因），
   :disabled 是兜底，两者视觉保持一致 */
.icon-btn:disabled,
.icon-btn.is-locked {
  background: #f4f5f8; color: #c2c7d3; cursor: not-allowed;
}
.icon-btn:disabled:hover,
.icon-btn.is-locked:hover { background: #f4f5f8; }
.call-act:disabled,
.call-act.is-locked { background: #f4f5f8; color: #c2c7d3; cursor: not-allowed; }
.call-act:disabled:active,
.call-act.is-locked:active { transform: none; }

/* 在线绿点：在线时带一圈柔光，离线保持灰点 */
.avatar-wrap .presence-dot.on { box-shadow: 0 0 0 2px rgba(34, 197, 94, .18); }

/* ---------------- 聊天页头部：对方在线状态 ---------------- */
.chat-peer .chat-peer-status {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 1px; font-size: 11.5px; color: var(--ink-3);
}
.chat-peer .chat-peer-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: #c3c9d6; flex: none;
}
.chat-peer .chat-peer-status.on { color: var(--ok); }
.chat-peer .chat-peer-status.on::before { background: #22c55e; }
