/* ext-chat.css — 资料卡 / 添加好友、会话内搜索、富文本与新消息类型、输入区扩展、动图 / 贴纸面板；手机端（由 features.css 按顺序拆出，层叠顺序不变） */
/* ---------- 资料卡 / 添加好友 ---------- */
.modal.profile { width: min(380px, calc(100vw - 32px)); padding-top: 28px; position: relative; }
.dlg-x { position: absolute; right: 10px; top: 10px; }
.pf-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin-bottom: 16px; }
.pf-head h3 { margin: 10px 0 0; font-size: 20px; }
.pf-status { font-size: 14px; color: var(--text-2); margin: 0 !important; }
.pf-status.online { color: var(--accent); }
.pf-rows { margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.pf-rows div { display: grid; grid-template-columns: max-content 1fr; gap: 12px; font-size: 14px; }
.pf-rows dt { color: var(--text-2); min-width: 64px; }
.pf-rows dd { margin: 0; overflow-wrap: anywhere; }
.qr-box { margin: 0 0 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qr { width: 148px; height: 148px; padding: 8px; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border); color: #111; display: block; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-box figcaption { font-size: 12px; color: var(--text-3); }
.pf-actions { display: flex; gap: 8px; }
.pf-actions .btn { flex: 1; height: 42px; }

.modal.add-friend { width: min(440px, calc(100vw - 32px)); }
.af-tabs { position: static; margin: 0 -20px 14px; }
.af-panel { display: none; flex-direction: column; gap: 10px; }
.af-panel.active { display: flex; }
.af-row { display: flex; gap: 8px; }
.af-row .dd { flex: 0 0 auto; width: 150px; }
.af-row .dd .dd-trigger { height: 48px; border-radius: var(--radius); }
.af-row .field-input { height: 48px; flex: 1; min-width: 0; }
.af-row .prefix-input { flex: 1; }
.af-go { align-self: flex-end; }
.af-result:not(:empty) { margin-top: 14px; }
.af-card { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.af-card .m-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.scan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.scan-grid .qr-box { margin: 0; }
.cam-frame {
  aspect-ratio: 1; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px;
  text-align: center; font-size: 12px; color: var(--text-3);
  background:
    linear-gradient(var(--accent), var(--accent)) top left / 22px 3px no-repeat,
    linear-gradient(var(--accent), var(--accent)) top left / 3px 22px no-repeat,
    linear-gradient(var(--accent), var(--accent)) top right / 22px 3px no-repeat,
    linear-gradient(var(--accent), var(--accent)) top right / 3px 22px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom left / 22px 3px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom left / 3px 22px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom right / 22px 3px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom right / 3px 22px no-repeat,
    var(--bg-soft);
}
.cam-frame .ti { font-size: 34px; }
.cam-frame { position: relative; overflow: hidden; }
.cam-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.cam-idle { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cam-acts { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: auto; }
.cam-acts .btn { font-size: 12px; }
#camMsg { position: relative; z-index: 1; margin: 0; min-height: 1em; }
.qr svg { image-rendering: pixelated; }

/* ==========================================================
   会话内搜索
   ========================================================== */
.chat-search { display: none; flex-shrink: 0; flex-direction: column; gap: 6px; padding: 8px 10px; background: var(--bg); border-bottom: 1px solid var(--border); }
.chat.searching .chat-search { display: flex; }
.cs-row { display: flex; align-items: center; gap: 4px; }
.cs-row .search { flex: 1; min-width: 0; }
.cs-count { font-size: 13px; color: var(--text-2); white-space: nowrap; padding: 0 6px; font-variant-numeric: tabular-nums; }
.cs-filters { display: flex; align-items: center; gap: 6px; }
.cs-filters .dd { flex-shrink: 0; }
.cs-sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.chips { display: flex; gap: 6px; flex-shrink: 0; }
.chip {
  height: 30px; padding: 0 12px 0 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 15px; border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); white-space: nowrap;
}
.chip .ti { font-size: 16px; }
.chip:hover { background: var(--bg-hover); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.msg.search-hit .bubble { box-shadow: 0 0 0 2px color-mix(in srgb, #f0b429 55%, transparent); }
.msg.search-cur .bubble { box-shadow: 0 0 0 3px #f0b429; }

/* ==========================================================
   富文本 / 新消息类型
   ========================================================== */
.bubble code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, currentColor 12%, transparent); }
.spoiler { border-radius: 4px; background: var(--text-2); color: transparent; cursor: pointer; transition: background .2s, color .2s; user-select: none; }
.msg.out .spoiler { background: var(--bubble-out-meta); }
.spoiler.revealed { background: color-mix(in srgb, currentColor 12%, transparent); color: inherit; user-select: auto; }
.mention { color: var(--accent); font-weight: 500; }
.msg.out .mention { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.bubble.loc { padding: 0; overflow: hidden; width: 300px; }
.bubble.loc .sender, .bubble.loc .reply, .bubble.loc .fwd { margin: 6px 12px 0; }
.loc-card { position: relative; aspect-ratio: 400 / 220; overflow: hidden; }
.loc-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.loc-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -90%); font-size: 40px; color: var(--danger); }
.loc-card.big { border-radius: var(--radius-sm); margin-bottom: 10px; }
.loc-text { display: flex; flex-direction: column; padding: 8px 12px 0; font-size: 14px; }
.loc-text span { font-size: 13px; opacity: .75; }
.bubble.loc .meta, .bubble.loc .reactions { margin-left: 12px; margin-right: 10px; }
.bubble.loc .meta { margin-bottom: 6px; }
#locText { padding: 0 0 4px; }

.contact-card { display: flex; align-items: center; gap: 10px; padding: 4px 0 6px; min-width: 200px; }
.cc-body { display: flex; flex-direction: column; min-width: 0; font-size: 14px; }
.cc-body span { font-size: 13px; opacity: .75; }
.cc-btn { display: block; width: 100%; padding: 6px 0; margin-top: 2px; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); color: var(--accent); font-weight: 500; font-size: 14px; }
.msg.out .cc-btn { color: inherit; }

.poll { min-width: 240px; }
.poll-q { font-weight: 600; margin-bottom: 2px; }
.poll-kind { font-size: 12px; opacity: .7; margin-bottom: 8px; }
.poll-opt { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 0; text-align: left; font-size: 14px; position: relative; }
.po-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; opacity: .6; flex-shrink: 0; }
.po-dot.sq { border-radius: 4px; }
.poll-opt.picked .po-dot { background: currentColor; opacity: 1; }
.poll-opt.done { flex-wrap: wrap; gap: 4px 10px; }
.po-pct { width: 44px; white-space: nowrap; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.po-text { flex: 1; min-width: 0; }
.po-text .ti { font-size: 15px; vertical-align: -2px; }
.po-bar { flex-basis: 100%; height: 4px; border-radius: 2px; background: color-mix(in srgb, currentColor 15%, transparent); margin-left: 54px; }
.po-bar i { display: block; height: 100%; border-radius: 2px; background: currentColor; }
.poll-opt.mine .po-bar i { background: var(--accent); }
.msg.out .poll-opt.mine .po-bar i { background: #fff; }
.poll-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; opacity: .85; margin-top: 4px; }
.msg.out .poll .btn { background: rgba(255, 255, 255, .2); border-color: transparent; color: inherit; }
.msg.out .btn-link { color: inherit; }

.video-msg { position: relative; width: 200px; height: 200px; }
.vm-circle {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #7fb6e6, #2f6fa8);
  color: #fff; border: 3px solid var(--bg);
}
.vm-circle .ti { font-size: 44px; }
.vm-dur { position: absolute; left: 10px; bottom: 6px; padding: 1px 7px; border-radius: 9px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 12px; }
.video-msg .meta.overlay { right: 6px; bottom: 6px; }

.sticker-img { width: 128px; height: 128px; display: block; }
.sticker-msg .meta.overlay { right: 0; bottom: 0; }

/* ==========================================================
   输入区：发送 / 麦克风、录音、附件、格式条、@、频道条
   ========================================================== */
.send-btn.mic { display: none; }
.composer-wrap:not(.has-text) #sendBtn { display: none; }
.composer-wrap:not(.has-text) #micBtn { display: inline-flex; }
.chat.is-channel .composer-wrap { display: none; }
.channel-bar { display: none; }
.chat.is-channel .channel-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); text-align: center;
}
.composer-input textarea { overflow-y: hidden; }

.rec-bar {
  flex: 1; min-width: 0; min-height: 48px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 0 16px;
  border-radius: var(--radius); background: var(--bg);
}
.rec-bar[hidden] { display: none; }
.composer-wrap.recording .composer-input, .composer-wrap.recording #attachBtn { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; flex-shrink: 0; }
@keyframes blink { 50% { opacity: .2; } }
.rec-time { font-variant-numeric: tabular-nums; font-size: 15px; min-width: 40px; }
.rec-wave { flex: 1; min-width: 0; height: 24px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-wave i { width: 3px; flex-shrink: 0; height: var(--h); border-radius: 2px; background: var(--accent); }
.rec-hint { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--text-2); white-space: nowrap; transition: transform .05s; }
.rec-hint .ti { font-size: 16px; }
.rec-del { display: none; color: var(--danger); }
.composer-wrap.rec-locked .rec-hint { display: none; }
.composer-wrap.rec-locked .rec-del { display: inline-flex; }
.composer-wrap.recording #micBtn { transform: scale(1.18); background: var(--danger); }
.composer-wrap.rec-locked #micBtn { transform: none; background: var(--accent); }
.composer { position: relative; }
.rec-lock {
  position: absolute; right: 12px; bottom: calc(100% + 4px);
  width: 48px; padding: 8px 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border-radius: 24px; background: var(--bg); box-shadow: var(--shadow);
  color: var(--text-2); font-size: 10px; text-align: center; line-height: 1.2;
  animation: lockup 1.2s ease-in-out infinite;
}
.rec-lock[hidden] { display: none; }
.rec-lock .ti { font-size: 18px; }
@keyframes lockup { 50% { transform: translateY(-6px); } }
.video-finder {
  position: absolute; inset: 0; z-index: 25;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(8, 12, 16, .55); pointer-events: none;
}
.video-finder[hidden] { display: none; }
.vf-circle {
  width: min(260px, 64vw); aspect-ratio: 1; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: #1c2a38; color: rgba(255, 255, 255, .8); font-size: 13px; text-align: center; padding: 24px;
  border: 4px solid var(--danger);
}
.vf-circle .ti { font-size: 44px; }
.vf-time { color: #fff; font-variant-numeric: tabular-nums; background: rgba(0, 0, 0, .5); padding: 2px 10px; border-radius: 10px; }

.fmt-bar {
  position: absolute; left: 50%; bottom: calc(100% - 2px); z-index: 32; transform: translateX(-50%);
  display: flex; gap: 2px; padding: 4px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.fmt-bar[hidden] { display: none; }
.fmt-bar button { width: 36px; height: 36px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.fmt-bar button:hover { background: var(--bg-hover); color: var(--accent); }
.fmt-bar .ti { font-size: 19px; }

.mention-pop {
  position: absolute; left: 60px; right: 60px; bottom: calc(100% - 4px); z-index: 31;
  max-height: 260px; overflow-y: auto; padding: 4px; margin: 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.mention-pop[hidden] { display: none; }
.mp-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.mp-item .m-name { font-weight: 500; }
.mp-item .m-sub { font-size: 13px; }
.mp-item.active, .mp-item:hover { background: var(--accent-soft); }

/* 弹层：投票 / 图片发送 / 定时 */
.modal.poll-dlg { width: min(440px, calc(100vw - 32px)); }
.poll-edit { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: po; }
.poll-edit li { display: flex; gap: 4px; align-items: center; }
.poll-edit .field-input { height: 42px; }
.set-row.plain { padding: 8px 2px; min-height: 44px; }
.set-row.plain + .set-row.plain { border-top: 1px solid var(--border); }
.modal.img-send { width: min(460px, calc(100vw - 32px)); }
.is-preview { margin: 0 -20px 12px; background: var(--bg-soft); display: flex; justify-content: center; max-height: 50vh; overflow: hidden; }
.is-preview img { max-width: 100%; max-height: 50vh; object-fit: contain; }
#scheduleDlg .dd { margin-bottom: 18px; }

/* ==========================================================
   动图 / 贴纸面板
   ========================================================== */
.pk-head { display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.pk-head .pk-search { flex: 1; min-width: 0; }
.gif-grid { grid-template-columns: repeat(3, 1fr); padding-top: 4px; }
.gif-grid button { border-radius: var(--radius-sm); }
.sticker-grid { grid-template-columns: repeat(3, minmax(96px, 1fr)); gap: 6px; }
.sticker-grid button { min-height: 96px; padding: 6px; }
.sticker-grid img { width: 100%; max-width: 104px; aspect-ratio: 1; display: block; margin: 0 auto; }
.sticker-packs button img { width: 30px; height: 30px; }

/* ==========================================================
   手机（< 900px）
   ========================================================== */
@media (width < 900px) {
  /* 下拉：底部抽屉 */
  .dd-layer.sheet {
    left: 0 !important; right: 0; top: auto !important; bottom: 0;
    width: auto; max-width: none; min-width: 0 !important; max-height: 70vh !important;
    border-radius: var(--radius) var(--radius) 0 0;
    border-width: 1px 0 0;
    padding: 4px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .dd-layer.sheet .dd-opt { min-height: 48px; font-size: 15px; }
  .dd-backdrop.open { display: block; position: fixed; inset: 0; z-index: 139; background: var(--overlay); }

  .fab { right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); }
  .side-panel { position: fixed; z-index: 24; padding-bottom: env(safe-area-inset-bottom); }
  .mention-pop { left: 8px; right: 8px; }
  .modal.profile, .modal.add-friend { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; overflow-y: auto; }
  .scan-grid { grid-template-columns: 1fr; }
  .cam-frame { max-width: 260px; width: 100%; margin: 0 auto; }
  .cs-row .search { height: 36px; }
  .bubble.loc { width: 80%; }
  .rec-lock { right: 8px; }
  .gif-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 发送人名颜色补全（c1 / c5 / c7） */
.c1-text { color: var(--c1); } .c5-text { color: var(--c5); } .c7-text { color: var(--c7); }

/* 手机顶栏：保留会话内搜索，收起语音通话（空间有限） */
@media (width < 900px) {
  .head-actions .icon-btn#searchBtn { display: inline-flex; }
  .head-actions #callBtn { display: none; }
}

/* 设置页底部：长语言下允许换行，版本号不被挤成竖排 */
.set-foot { flex-wrap: wrap; }
.set-foot > span { white-space: nowrap; }

/* 自己发出的语音：按钮与波形在蓝底上反色 */
.msg.out .voice-play { background: #fff; color: var(--bubble-out); }
.msg.out .wave i { background: #fff; }
.msg.out .voice-len { color: var(--bubble-out-meta); }
:root[data-layout="list"] .msg.out .voice-play { background: var(--accent); color: var(--on-accent); }
:root[data-layout="list"] .msg.out .wave i { background: var(--accent); }

/* 搜索结果：命中片段最多两行，保证高亮可见 */
.sr-item .m-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 字母索引要压在吸顶的分组标题之上 */
.az-index { z-index: 2; }

/* TG 桥接：检测到的群 */
.bridge-detected { margin-bottom: 12px; }
.bd-list { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bd-item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); text-align: left; cursor: pointer; }
.bd-item:hover { background: var(--bg-hover); }
.bd-item:disabled { opacity: .5; cursor: not-allowed; }
.bd-item .ti { color: #229ed9; font-size: 18px; }
.bd-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bd-id { font-size: 12px; color: var(--text-2); }
.bd-st { font-size: 12px; }
.bd-st.ok { color: var(--success, #2e9e5b); } .bd-st.warn { color: var(--warning, #d48806); }
/* 投票：加载中 / 已结束 / 底部按钮（结束投票） */
.poll.is-loading .poll-kind { opacity: .5; }
.poll.closed .poll-q { opacity: .85; }
.poll-foot .danger-text { color: var(--danger, #e53935); }
.poll-foot { gap: 10px; }
/* 定时发送：输入框上方「已定时 N 条」、列表弹窗 */
.sched-bar { display: flex; align-items: center; gap: 8px; margin: 0 auto 6px; max-width: 832px; width: calc(100% - 32px); padding: 6px 12px; border-radius: 10px; background: var(--surface, #fff); box-shadow: var(--shadow-1, 0 1px 2px rgba(0,0,0,.08)); font-size: 13px; }
.sched-bar .ti { color: var(--accent); font-size: 17px; }
.sched-bar span { flex: 1; min-width: 0; }
#scheduleDlg .field, #scheduleDlg .set-row { margin-bottom: 10px; }
.sched-dlg { width: min(460px, calc(100vw - 32px)); }
.sched-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; }
.sched-item { padding: 12px 0; border-top: 1px solid var(--divider, rgba(0,0,0,.08)); }
.sched-item:first-child { border-top: 0; }
.si-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-2, #707579); }
.si-when { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--text, inherit); }
.si-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--hover, rgba(0,0,0,.05)); }
.si-tag.err { color: var(--danger, #e53935); }
.si-text { margin: 6px 0; white-space: pre-wrap; word-break: break-word; }
.si-edit { display: grid; gap: 6px; margin: 6px 0; }
.si-acts { display: flex; gap: 8px; justify-content: flex-end; }
.sched-empty { padding: 24px 0; text-align: center; color: var(--text-2, #707579); }
/* 自动删除：消息列表上方提示条；消息时间旁的剩余时间 */
.ad-bar { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; font-size: 12.5px; color: var(--text-2, #707579); background: var(--surface, #fff); border-bottom: 1px solid var(--divider, rgba(0,0,0,.06)); }
.ad-bar .ti { color: #f0802e; font-size: 16px; }
.meta .m-exp { display: inline-flex; align-items: center; gap: 1px; margin-right: 4px; opacity: .85; }
.meta .m-exp .ti { font-size: 12px; color: #f0802e; }
.msg.out .meta .m-exp .ti { color: inherit; }
/* 聊天记录导出（app/exports.js） */
.toast-act { margin-left: 8px; padding: 2px 10px; border-radius: 6px; background: rgba(255,255,255,.18); color: inherit; font-weight: 600; }
.export-dlg { width: min(480px, calc(100vw - 32px)); }
.ex-chats { max-height: 240px; overflow-y: auto; margin-top: 6px; border: 1px solid var(--divider, rgba(0,0,0,.08)); border-radius: 10px; padding: 4px; }
.ex-chat { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.ex-chat:hover { background: var(--hover, rgba(0,0,0,.04)); }
.ex-chat span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ex-list { list-style: none; margin: 4px 0 0; padding: 0; }
.ex-item { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--divider, rgba(0,0,0,.06)); }
.ex-item > .ti { font-size: 22px; color: var(--accent); }
.ex-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ex-body small { color: var(--text-2, #707579); }

/* 快捷回复（chat/quick-replies.js）：输入框「/」弹出 + 设置 → 聊天 列表 */
.qr-pop .qr-item { display: flex; align-items: center; gap: 8px; }
.qr-key { font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; color: var(--accent); flex-shrink: 0; }
.qr-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-tag { font-size: 11.5px; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); flex-shrink: 0; }
.qr-empty { padding: 10px 14px; color: var(--text-2, #707579); font-size: 13px; list-style: none; }
.qr-list { list-style: none; margin: 0; padding: 0; }
.qr-row { padding: 8px 4px; border-top: 1px solid var(--divider, rgba(0,0,0,.06)); }
.qr-row:first-child { border-top: 0; }
.qr-view { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qr-view .qr-text { white-space: normal; word-break: break-word; }
.qr-form { display: grid; gap: 6px; }
.qr-acts { display: flex; gap: 8px; justify-content: flex-end; }
.qr-new { padding: 8px 4px; }

/* 群已读名单（chat/read-list.js） */
.reads-dlg { width: min(400px, calc(100vw - 32px)); }
.rl-sub { margin: 0 0 6px; color: var(--text-2, #707579); font-size: 13px; }
.rl-note { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--hover, rgba(0,0,0,.04)); font-size: 12.5px; color: var(--text-2, #707579); }
.rl-list { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.rl-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.rl-item .avatar.xs { width: 32px; height: 32px; font-size: 13px; }
.rl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-time { font-size: 12.5px; color: var(--text-2, #707579); flex-shrink: 0; }
.rl-empty { padding: 20px 0; text-align: center; color: var(--text-2, #707579); }

/* 合并转发（chat/bundles.js）：气泡卡片 + 全屏查看 */
.bundle { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 220px; max-width: 320px; text-align: left; padding: 2px 0; color: inherit; }
.bd-title { font-weight: 600; margin-bottom: 2px; }
.bd-line { font-size: 13px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-foot { display: flex; align-items: center; gap: 4px; margin-top: 4px; padding-top: 6px; border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent); font-size: 12px; opacity: .7; }
.bundle-view { position: fixed; inset: 0; z-index: 110; background: var(--bg, #f4f5f7); display: flex; flex-direction: column; }
.bundle-view[hidden] { display: none; }
.bv-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface, #fff); border-bottom: 1px solid var(--divider, rgba(0,0,0,.08)); }
.bv-titles h2 { margin: 0; font-size: 16px; }
.bv-titles p { margin: 0; font-size: 12.5px; color: var(--text-2, #707579); }
.bv-list { list-style: none; margin: 0 auto; padding: 12px 16px 32px; width: 100%; max-width: 760px; flex: 1; overflow-y: auto; }
.bv-item { background: var(--surface, #fff); border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
.bv-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-2, #707579); }
.bv-head b { color: var(--text, inherit); }
.bv-item p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.bv-img { display: block; margin-top: 6px; }
.bv-img img { max-width: min(320px, 100%); max-height: 320px; border-radius: 8px; display: block; }
.bv-file { margin-top: 6px; }
.fw-mode { margin: 8px 0 0; }

/* 话题分区（chat/topics.js）：PC 左栏 300px + 右边消息流；手机 .topic-list-open 时列表铺满 */
.topic-pane, .topic-bar, .topic-closed-note { display: none; }
.chat.has-topics { padding-left: 300px; }
.chat.has-topics .topic-pane { display: flex; flex-direction: column; position: absolute; left: 0; top: 0; bottom: 0; width: 300px; border-right: 1px solid var(--divider, rgba(0,0,0,.08)); background: var(--surface, #fff); z-index: 3; }
.tp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 10px 16px; font-size: 15px; }
.tp-list { list-style: none; margin: 0; padding: 0 6px 12px; flex: 1; overflow-y: auto; }
.tp-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.tp-item:hover { background: var(--hover, rgba(0,0,0,.04)); }
.tp-item.active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tp-item.closed .tp-title { opacity: .65; }
.tp-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--tc); color: #fff; font-weight: 600; flex-shrink: 0; }
.tp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tp-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-title .ti { font-size: 13px; opacity: .6; }
.tp-last { font-size: 13px; color: var(--text-2, #707579); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.tp-time { font-size: 12px; color: var(--text-2, #707579); }
.tp-more { opacity: 0; }
.tp-item:hover .tp-more, .tp-item:focus-within .tp-more { opacity: 1; }
.chat.has-topics .topic-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-weight: 600; background: var(--surface, #fff); border-bottom: 1px solid var(--divider, rgba(0,0,0,.06)); }
.chat.has-topics .topic-bar #topicBack { display: none; }
.app.topic-closed .chat.has-topics .composer { display: none; }
.app.topic-closed .chat.has-topics .topic-closed-note { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 14px; color: var(--text-2, #707579); }
.tp-colors { display: flex; gap: 8px; margin: 4px 0 12px; }
.tp-swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--tc); border: 2px solid transparent; }
.tp-swatch.on { border-color: var(--text, #000); box-shadow: inset 0 0 0 2px #fff; }
@media (width < 900px) {
  .chat.has-topics { padding-left: 0; }
  .chat.has-topics .topic-pane { display: none; }
  .chat.has-topics.topic-list-open .topic-pane { display: flex; width: auto; right: 0; top: 56px; border-right: 0; z-index: 6; }
  .chat.has-topics .topic-bar #topicBack { display: inline-flex; }
}
.fw-topic { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; }
.fw-topic select { flex: 1; }

/* @提醒（chat/mentions.js） */
.mention.me, .mention.all { background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 4px; padding: 0 2px; }
.msg.in.mention-me .bubble { box-shadow: inset 3px 0 0 var(--accent); }
.badge.at { background: var(--accent); margin-right: 4px; font-weight: 700; }
.jump-btn.mention-btn { bottom: 136px; }
@media (width < 900px) { .jump-btn.mention-btn { bottom: 128px; } }
.jump-btn.mention-btn b { font-size: 18px; color: var(--accent); }
.jump-btn.mention-btn .badge { position: absolute; top: -6px; right: -6px; }
.mp-all { background: var(--accent); color: #fff; display: grid; place-items: center; }

/* 消息星标（chat/stars.js）：气泡时间旁的小星星；星标列表对话框 */
.meta .m-star { color: #f5a524; font-size: 12px; margin-right: 2px; }
.star-dlg { width: min(460px, calc(100vw - 32px)); display: flex; flex-direction: column; max-height: min(640px, calc(100dvh - 48px)); }
.star-dlg:not([open]) { display: none; }
.star-dlg .dlg-head { gap: 8px; }
.star-dlg .fav-count { margin-left: auto; color: var(--text-2, #707579); font-size: 13px; }
.star-dlg .fav-list { padding: 4px 8px 8px; }

/* 语音变速（chat/voice-play.js）：只在播放中显示倍速按钮 */
.voice-rate { display: none; margin-left: auto; min-width: 40px; height: 24px; padding: 0 8px; border: 0; border-radius: 12px;
  background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; font: 600 12px/24px var(--font, system-ui); cursor: pointer; flex: none; }
.voice.playing .voice-rate { display: inline-block; }
.voice-rate:focus-visible { outline: 2px solid var(--accent, #3390ec); outline-offset: 2px; }

/* 每会话聊天背景（chat/wallpaper.js）：覆盖全局背景，只在打开的这个会话上 */
:root { --wp-geo: url("../assets/bg/geo-light.svg"); }
:root[data-theme="dark"] { --wp-geo: url("../assets/bg/geo-dark.svg"); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] { --wp-geo: url("../assets/bg/geo-dark.svg"); } }
.chat-area[data-wp-v="dots"], .wp-p-dots { --wp-pat: url("../assets/bg/dots.svg"); }
.chat-area[data-wp-v="grid"], .wp-p-grid { --wp-pat: url("../assets/bg/grid.svg"); }
.chat-area[data-wp-v="waves"], .wp-p-waves { --wp-pat: url("../assets/bg/waves.svg"); }
.chat-area[data-wp-v="geo"], .wp-p-geo { --wp-pat: var(--wp-geo); }
.chat-area[data-wp-v="sky"], .wp-c-sky { --wp-color: #4fa3e3; }
.chat-area[data-wp-v="mint"], .wp-c-mint { --wp-color: #3fbf8f; }
.chat-area[data-wp-v="sand"], .wp-c-sand { --wp-color: #e0b45c; }
.chat-area[data-wp-v="rose"], .wp-c-rose { --wp-color: #e27a92; }
.chat-area[data-wp-v="lilac"], .wp-c-lilac { --wp-color: #9b7fe0; }
.chat-area[data-wp-v="slate"], .wp-c-slate { --wp-color: #6b7d93; }
.chat-area[data-wp="pattern"] { background-color: var(--chat-bg) !important; background-image: var(--wp-pat) !important; background-size: auto !important; }
.chat-area[data-wp="color"] { background-color: color-mix(in srgb, var(--wp-color) 32%, var(--chat-bg)) !important; background-image: none !important; }
.chat-area[data-wp="image"] { background-color: var(--chat-bg) !important; background-image: var(--wp-img, none) !important; background-size: cover !important; background-position: center !important; }
.bg-tile .sw[class*="wp-p-"] { background-color: var(--chat-bg); background-image: var(--wp-pat); }
.bg-tile .sw[class*="wp-c-"] { background: color-mix(in srgb, var(--wp-color) 32%, var(--chat-bg)); }
.wp-tiles { gap: 10px; }
.wp-tiles .bg-tile { width: 76px; font-size: 12px; text-align: center; }
.wp-tiles .bg-tile .sw { width: 64px; height: 64px; }

/* 备注名（chat/aliases.js）：资料卡标题下的原昵称；设置备注对话框 */
.pf-orig { margin: -2px 0 0; color: var(--text-2, #707579); font-size: 13px; }
.alias-dlg { width: min(380px, calc(100vw - 32px)); }
.alias-dlg form { display: flex; flex-direction: column; gap: 12px; }
.alias-dlg .field input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border, #dfe1e5); border-radius: 10px; background: var(--bg, #fff); color: inherit; font: inherit; }
.alias-dlg .field input:focus { outline: none; border-color: var(--accent, #3390ec); }
.alias-dlg .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.alias-dlg .danger-text { color: var(--danger, #e53935); margin-right: auto; }
