:root {
  --brand: #3478f6; --brand-2: #7b5cf6; --brand-soft: #eaf1ff; --brand-ink: #1f5fd6;
  --text: #14161a; --text-2: #5c6370; --text-3: #9aa1ad; --text-4: #c5cad3;
  --line: #eceef2; --line-2: #f4f5f7; --bg: #f5f6f8; --panel: #fff;
  --chat-bg: #eef1f6; --me: #3478f6; --other: #fff;
  --ok: #22b357; --danger: #e5484d; --warn: #f5a524;
  --rail: #16181d; --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", "Sarasa Mono SC", "Noto Sans Mono CJK SC", "PingFang SC", "Microsoft YaHei", monospace; color: var(--text); background: var(--bg); font-size: 15px; -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { display: inline-flex; align-items: center; justify-content: center; font-size: 22px; line-height: 0; flex: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.14); border-radius: 3px; }

.app { display: flex; height: 100vh; height: 100dvh; position: relative; overflow: hidden; }

/* ---------- 导航（桌面）---------- */
.rail { width: 68px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 18px 0 14px; gap: 8px; }
.rail-me { width: 40px; height: 40px; padding: 0; border: none; border-radius: 12px; background: none; margin-bottom: 14px; overflow: hidden; }
.rail-me .av { border-radius: 12px; }
.rail-btn { position: relative; width: 46px; height: 46px; border: none; border-radius: 12px; background: transparent; color: #8a909c; display: flex; align-items: center; justify-content: center; }
.rail-btn:hover { background: rgba(255,255,255,.06); color: #d7dbe3; }
.rail-btn.on { background: rgba(52,120,246,.2); color: #fff; }
.rail .grow { flex: 1; }
.badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; display: none; align-items: center; justify-content: center; line-height: 1; border: 2px solid var(--rail); }
.badge.on { display: flex; }
.badge.dot { min-width: 10px; width: 10px; height: 10px; padding: 0; top: 8px; right: 8px; }

/* ---------- 列表栏 ---------- */
.side { width: 340px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.side-h { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 16px) 16px 10px 20px; }
.side-h h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .2px; }
.side-h .ibtn { margin-left: auto; }
.conn { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); animation: pulse 1.2s infinite; }
.conn:empty { display: none; }
@keyframes pulse { 50% { opacity: .35; } }
.search { margin: 2px 16px 10px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--line-2); border-radius: 12px; color: var(--text-3); border: 1.5px solid transparent; }
.search:focus-within { background: #fff; border-color: var(--brand); }
.search .ic { font-size: 16px; }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 15px; color: var(--text); }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 12px; }
.sec { padding: 14px 12px 6px; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .3px; }
.hint-empty { padding: 56px 24px; text-align: center; color: var(--text-3); font-size: 14px; line-height: 1.7; }
.hint-empty .ic { font-size: 40px; color: var(--text-4); margin-bottom: 10px; }
.hint-empty .btn { margin-top: 14px; }

.ibtn { position: relative; width: 38px; height: 38px; border: none; background: transparent; border-radius: 10px; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ibtn:hover { background: var(--line-2); color: var(--text); }
.ibtn .ic { font-size: 21px; }

/* 会话项 */
.ci { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; cursor: pointer; position: relative; user-select: none; -webkit-touch-callout: none; }
.ci:hover { background: var(--line-2); }
.ci.on { background: var(--brand-soft); }
.ci.pinned { background: #f7f8fa; }
.ci.pinned:hover { background: var(--line-2); }
.ci.pinned.on, .ci.on { background: var(--brand-soft); }
.ci-b { flex: 1; min-width: 0; }
.ci-r1, .ci-r2 { display: flex; align-items: center; gap: 6px; }
.ci-n { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-t { font-size: 12px; color: var(--text-3); flex: none; }
.ci-r2 { margin-top: 3px; }
.ci-p { flex: 1; min-width: 0; font-size: 14px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-p em { font-style: normal; color: var(--danger); }
.ci-p .typing { color: var(--brand); }
.ci-p .tk { display: inline-flex; vertical-align: -1px; margin-right: 3px; color: var(--text-4); }
.ci-p .tk.read { color: var(--brand); }
.ci-r2 > .ic { font-size: 15px; color: var(--text-4); }
.ub { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ub.muted { background: var(--text-4); }
.ci.unread .ci-t { color: var(--brand); }

/* 用户行 */
.ur { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 14px; cursor: pointer; }
.ur:hover { background: var(--line-2); }
.ur-b { flex: 1; min-width: 0; }
.ur-n { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ur-s { font-size: 13px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ur-s.on { color: var(--ok); }
.ur .ub { background: var(--danger); }
.ur .chev { color: var(--text-4); font-size: 18px; }
.entry-ic { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.entry-ic .ic { font-size: 22px; }

/* 头像 */
.av { position: relative; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; overflow: visible; user-select: none; }
.av img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.av .dot { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 10px; min-height: 10px; max-width: 14px; max-height: 14px; border-radius: 50%; background: var(--ok); border: 2px solid #fff; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); gap: 6px; }
.empty-ic { width: 84px; height: 84px; border-radius: 26px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--text-4); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.empty-ic .ic { font-size: 38px; }
.empty p { margin: 12px 0 0; font-size: 14px; }

.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat-h, .page-h { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 10px) 12px 10px 16px; min-height: 64px; background: #fff; border-bottom: 1px solid var(--line); z-index: 2; }
.back { display: none; margin-left: -6px; color: var(--brand); }
.back .badge { position: absolute; top: 2px; right: -8px; border-color: #fff; }
.chat-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: none; background: none; padding: 2px 4px; border-radius: 10px; text-align: left; }
.chat-t { display: flex; flex-direction: column; min-width: 0; }
.chat-t .name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.chat-t .name .ic { font-size: 14px; color: var(--text-3); }
.chat-t .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-t .sub.on { color: var(--ok); }
.chat-t .sub.typing { color: var(--brand); }
.page-h h2 { margin: 0; font-size: 17px; font-weight: 600; }

.msgs { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; contain: strict; will-change: scroll-position; }
/* 滚动位置由脚本统一按锚点消息校正（各浏览器表现一致），关闭浏览器自带的滚动锚定避免重复校正 */
.msgs, .msgs-in { overflow-anchor: none; }
.mr, .sys, .tsep { contain: layout style; }
.msgs-in { max-width: 860px; margin: 0 auto; padding: 14px 18px 10px; display: flex; flex-direction: column; min-height: 100%; justify-content: flex-end; }
.loading { overflow-anchor: none; align-self: center; margin: 8px 0 14px; height: 20px; font-size: 12px; line-height: 20px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-4); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tsep { align-self: center; margin: 14px 0 8px; font-size: 12px; color: var(--text-3); padding: 2px 10px; }
.sys { align-self: center; margin: 8px 0; max-width: 80%; text-align: center; font-size: 12px; color: var(--text-2); background: rgba(255,255,255,.7); padding: 4px 12px; border-radius: 10px; line-height: 1.5; }

.mr { display: flex; align-items: flex-end; gap: 8px; margin-top: 3px; }
.mr.first { margin-top: 10px; }
.mr.me { flex-direction: row-reverse; }
.mr-av { width: 34px; flex: none; align-self: flex-end; cursor: pointer; }
.mr:not(.last) .mr-av { visibility: hidden; }
.mr.me .mr-av { display: none; }
.bub { position: relative; max-width: min(560px, 74%); padding: 8px 12px 7px; border-radius: 18px; background: var(--other); color: var(--text); font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(16,24,40,.06); user-select: text; -webkit-touch-callout: none; }
.mr.me .bub { background: var(--me); color: #fff; box-shadow: none; }
.mr.last:not(.me) .bub { border-bottom-left-radius: 6px; }
.mr.last.me .bub { border-bottom-right-radius: 6px; }
.bub a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.mr:not(.me) .bub a { color: var(--brand-ink); }
.meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 7px -2px -3px 10px; font-size: 11px; line-height: 1; color: var(--text-3); user-select: none; white-space: nowrap; }
.mr.me .meta { color: rgba(255,255,255,.75); }
.meta .st { display: inline-flex; }
.meta .st .ic { font-size: 12px; }
.meta .st.fail { color: #ffd2d3; cursor: pointer; }
.bub.big-emoji { background: transparent !important; box-shadow: none; font-size: 40px; line-height: 1.15; padding: 2px 4px; }
.bub.big-emoji .meta { color: var(--text-3) !important; font-size: 11px; }

.bub.media { padding: 3px; overflow: hidden; background: #fff; }
.mr.me .bub.media { background: var(--me); }
.bub.media img { display: block; border-radius: 15px; background: var(--line-2); cursor: zoom-in; max-width: 100%; object-fit: cover; }
.mr.last:not(.me) .bub.media img { border-bottom-left-radius: 4px; }
.mr.last.me .bub.media img { border-bottom-right-radius: 4px; }
.bub.media .meta { position: absolute; right: 10px; bottom: 9px; margin: 0; padding: 3px 7px; border-radius: 10px; background: rgba(0,0,0,.45); color: #fff !important; }
.bub.file { display: flex; align-items: center; gap: 12px; min-width: 230px; cursor: pointer; padding: 10px 12px 9px; }
.fi-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: none; text-transform: uppercase; position: relative; overflow: hidden; }
.mr.me .fi-ic { background: rgba(255,255,255,.2); color: #fff; }
.fi-b { flex: 1; min-width: 0; }
.fi-n { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-s { font-size: 12px; opacity: .7; margin-top: 2px; }
.bub.file .meta { align-self: flex-end; }
.prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--brand); transition: width .2s; }
.mr.me .prog { background: #fff; }
.uploading { position: absolute; inset: 3px; border-radius: 15px; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; }

.jump { position: absolute; right: 20px; bottom: calc(var(--comp-h, 72px) + 14px); width: 42px; height: 42px; border-radius: 50%; border: none; background: #fff; color: var(--text-2); box-shadow: 0 4px 16px rgba(16,24,40,.14); display: flex; align-items: center; justify-content: center; z-index: 3; }
.jump b { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.jump b:empty { display: none; }

/* 输入区 */
.composer { flex: none; padding: 10px 14px calc(var(--safe-b) + 10px); background: #fff; border-top: 1px solid var(--line); position: relative; }
.comp { max-width: 860px; margin: 0 auto; display: flex; align-items: flex-end; gap: 4px; }
.comp .field { flex: 1; min-width: 0; background: var(--line-2); border-radius: 22px; display: flex; padding: 0 14px; border: 1.5px solid transparent; transition: border-color .15s, background .15s; }
.comp .field:focus-within { background: #fff; border-color: #cfe0ff; }
.comp textarea { flex: 1; min-width: 0; border: none; outline: none; resize: none; background: transparent; font-size: 16px; line-height: 22px; padding: 9px 0; max-height: 140px; color: var(--text); }
.comp .ibtn { width: 42px; height: 42px; border-radius: 50%; color: var(--text-3); }
.send { width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; margin-left: 2px; transition: transform .12s, background .15s, opacity .15s; }
.send .ic { font-size: 19px; transform: translateX(1px); }
.send:active { transform: scale(.92); }
.send:disabled { background: var(--text-4); cursor: default; }
.emoji { max-width: 860px; margin: 0 auto 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; max-height: 210px; overflow-y: auto; padding: 4px; background: #fff; border-radius: 14px; }
.emoji button { height: 42px; border: none; background: none; font-size: 26px; border-radius: 10px; line-height: 1; }
.emoji button:hover { background: var(--line-2); }
.locked { flex: none; padding: 14px 16px calc(var(--safe-b) + 14px); text-align: center; background: #fff; border-top: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
.locked .btn { margin-left: 10px; }
.drop { position: absolute; inset: 0; z-index: 5; background: rgba(52,120,246,.08); border: 2px dashed var(--brand); border-radius: 18px; margin: 10px; display: flex; align-items: center; justify-content: center; color: var(--brand); pointer-events: none; }
.drop div { text-align: center; } .drop .ic { font-size: 40px; } .drop p { margin: 8px 0 0; font-weight: 600; }

/* 页面 */
.page { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.page-b { flex: 1; overflow-y: auto; padding: 18px; }
.page-in { max-width: 560px; margin: 0 auto; }
.card { background: #fff; border-radius: 18px; padding: 6px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.prof { padding: 26px 20px 20px; text-align: center; }
.prof .av { margin: 0 auto; }
.prof .nm { margin-top: 14px; font-size: 21px; font-weight: 700; }
.prof .un { margin-top: 4px; font-size: 14px; color: var(--text-3); }
.prof .st { margin-top: 6px; font-size: 13px; color: var(--text-3); }
.prof .st.on { color: var(--ok); }
.prof .bio { margin: 12px auto 0; max-width: 380px; font-size: 14px; color: var(--text-2); line-height: 1.6; white-space: pre-wrap; }
.prof .acts { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 12px; cursor: pointer; min-height: 52px; }
.row:hover { background: var(--line-2); }
.row.static { cursor: default; } .row.static:hover { background: none; }
.row .ic { font-size: 20px; color: var(--text-2); }
.row .rl { flex: 1; min-width: 0; font-size: 15px; }
.row .rv { color: var(--text-3); font-size: 14px; max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { color: var(--text-4); font-size: 18px; }
.row.danger, .row.danger .ic { color: var(--danger); }
.row + .row { border-top: 1px solid var(--line-2); border-radius: 0; }
.card .row:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.card .row:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.me-card { display: flex; align-items: center; gap: 16px; padding: 18px 16px; cursor: pointer; }
.me-card .av { cursor: pointer; }
.me-card .b { flex: 1; min-width: 0; }
.me-card .nm { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .un { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.me-card .bio { font-size: 13px; color: var(--text-2); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--text-2); display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.cam .ic { font-size: 13px; }
.req { display: flex; gap: 12px; align-items: center; padding: 12px; }
.req .b { flex: 1; min-width: 0; }
.req .m { font-size: 13px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req .s { font-size: 13px; color: var(--text-3); flex: none; }
.req .acts { display: flex; gap: 6px; flex: none; }

/* 开关 */
.sw { position: relative; width: 44px; height: 26px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; background: #d5d9e0; border-radius: 13px; transition: .18s; cursor: pointer; }
.sw span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sw input:checked + span { background: var(--brand); }
.sw input:checked + span::before { transform: translateX(18px); }

/* 按钮 */
.btn { height: 38px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--line-2); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: var(--brand-ink); }
.btn.danger { color: var(--danger); }
.btn.lg { height: 46px; padding: 0 26px; border-radius: 14px; font-size: 15px; }
.btn.sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn .ic { font-size: 18px; }

/* 抽屉 */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 360px; max-width: 100%; background: var(--bg); z-index: 20; display: flex; flex-direction: column; box-shadow: -16px 0 40px rgba(16,24,40,.12); transform: translateX(100%); transition: transform .22s ease; }
.app.drawer-on .drawer { transform: none; }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 14px) 12px 10px 20px; }
.drawer-h h3 { margin: 0; font-size: 17px; }
.drawer-b { flex: 1; overflow-y: auto; padding: 4px 14px 20px; }
.scrim { position: absolute; inset: 0; background: rgba(16,24,40,.25); z-index: 15; opacity: 0; transition: opacity .2s; }
.app.drawer-on .scrim { opacity: 1; }

/* ---------- 浮层 ---------- */
.mask { position: fixed; inset: 0; z-index: 100; background: rgba(16,24,40,.42); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dlg { width: 420px; max-width: 100%; max-height: calc(100dvh - 40px); overflow-y: auto; background: #fff; border-radius: 22px; box-shadow: 0 24px 60px rgba(16,24,40,.22); animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 4px 24px; }
.dlg-h h3 { margin: 0; font-size: 18px; font-weight: 700; }
.dlg-b { padding: 8px 24px 6px; }
.dlg-b p { margin: 6px 0 12px; color: var(--text-2); line-height: 1.6; }
.dlg-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 24px 22px; }
.inp { width: 100%; height: 46px; border: 1.5px solid transparent; background: var(--line-2); border-radius: 12px; padding: 0 14px; font-size: 16px; outline: none; margin: 4px 0 10px; }
textarea.inp { height: auto; min-height: 84px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
.inp:focus { background: #fff; border-color: var(--brand); }
.lbl { font-size: 13px; color: var(--text-2); font-weight: 600; margin-top: 6px; display: block; }
.ferr { color: var(--danger); font-size: 13px; min-height: 18px; }

.menu { position: fixed; z-index: 110; min-width: 170px; padding: 6px; background: rgba(255,255,255,.98); border-radius: 14px; box-shadow: 0 12px 36px rgba(16,24,40,.2), 0 0 0 1px rgba(16,24,40,.04); animation: pop .12s ease; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: none; border-radius: 10px; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--line-2); }
.menu button .ic { font-size: 18px; color: var(--text-2); }
.menu button.danger, .menu button.danger .ic { color: var(--danger); }
.sheet-mask { position: fixed; inset: 0; z-index: 110; background: rgba(16,24,40,.35); animation: fade .15s; }
.sheet { position: fixed; left: 8px; right: 8px; bottom: calc(var(--safe-b) + 8px); z-index: 111; animation: up .2s ease; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet .grp { background: #fff; border-radius: 16px; overflow: hidden; margin-top: 8px; }
.sheet button { width: 100%; height: 54px; border: none; background: none; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.sheet button + button { border-top: 1px solid var(--line); }
.sheet button.danger { color: var(--danger); }
.sheet .cancel { font-weight: 600; }

.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 18px); transform: translate(-50%, -16px); z-index: 120; max-width: calc(100vw - 40px); background: rgba(20,22,26,.92); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.lb { position: fixed; inset: 0; z-index: 105; background: rgba(8,10,14,.92); display: flex; align-items: center; justify-content: center; animation: fade .15s; }
.lb img { max-width: 94vw; max-height: 86dvh; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lb-bar { position: fixed; top: calc(var(--safe-t) + 14px); right: 14px; display: flex; gap: 8px; }
.lb-bar a, .lb-bar button { width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255,255,255,.14); color: #fff; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.lb-bar .ic { font-size: 20px; }
.pick { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.pick .it { width: 84px; text-align: center; font-size: 12px; color: var(--text-2); word-break: break-all; }
.pick img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; background: var(--line-2); }
.pick .fi-ic { width: 84px; height: 84px; margin-bottom: 4px; }

/* ---------- 骨架（首屏）---------- */
.sk { display: flex; gap: 12px; align-items: center; padding: 12px; }
.sk i { display: block; background: linear-gradient(90deg, #eef0f3 0%, #f6f7f9 50%, #eef0f3 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.tabbar { display: none; }

/* ============ 手机 ============ */
@media (max-width: 760px) {
  body { background: #fff; }
  .rail { display: none; }
  .side { width: 100%; border-right: none; padding-bottom: calc(var(--safe-b) + 58px); }
  .main { position: absolute; inset: 0; z-index: 10; transform: translateX(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1), box-shadow .26s; }
  .app.in-main .main { transform: none; box-shadow: -10px 0 30px rgba(0,0,0,.06); }
  .app.in-main .side { transform: translateX(-22%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
  .side { transition: transform .26s cubic-bezier(.2,.8,.2,1); }
  .back { display: inline-flex; }
  .empty { display: none; }
  .msgs-in { padding: 10px 10px 8px; }
  .bub { max-width: 80%; }
  .composer { padding-left: 8px; padding-right: 8px; }
  .comp .ibtn { width: 40px; }
  .drawer { width: 100%; box-shadow: none; z-index: 30; }
  .scrim { display: none; }
  .tabbar { display: flex; position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding-bottom: var(--safe-b); background: #fff; border-top: 1px solid var(--line); }
  .tabbar button { position: relative; flex: 1; height: 56px; border: none; background: none; color: var(--text-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; }
  .tabbar button .ic { font-size: 24px; }
  .tabbar button.on { color: var(--brand); }
  .tabbar .badge { top: 4px; right: calc(50% - 22px); border-color: #fff; }
  .tabbar .badge.dot { right: calc(50% - 16px); top: 6px; }
  .page-b { padding: 14px; }
  .mask { align-items: flex-end; padding: 0; }
  .dlg { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: var(--safe-b); max-height: 92dvh; }
  .jump { right: 12px; }
}
@media (hover: none) { .ci:hover, .ur:hover, .row:hover, .ibtn:hover { background: inherit; } .ci.on { background: transparent; } .ci:active, .ur:active, .row:active { background: var(--line-2); } }

/* ---------- 语音 ---------- */
.send.mic { background: var(--line-2); color: var(--text-2); }
.send.mic:hover { background: #e8ebf0; }
.send.mic.hold { background: var(--brand); color: #fff; transform: scale(1.08); }
.rec { max-width: 860px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 4px 0 14px; background: #fff4f4; border-radius: 23px; }
.rec.cancel { background: #ffe4e4; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; flex: none; }
.rec-t { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 38px; }
.rec-lv { flex: 1; display: flex; align-items: center; gap: 3px; height: 24px; overflow: hidden; }
.rec-lv i { width: 3px; height: 4px; border-radius: 2px; background: var(--danger); opacity: .75; transition: height .08s; }
.rec-hint { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.rec.cancel .rec-hint { color: var(--danger); font-weight: 600; }
.rec .send { width: 38px; height: 38px; }
.rec.touch .btn, .rec.touch .send { display: none; }
.bub.voice { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 12px 7px 8px; min-width: 120px; user-select: none; }
.vplay { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; }
.mr.me .vplay { background: rgba(255,255,255,.22); }
.vplay .ic { font-size: 15px; }
.vbars { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; position: relative; }
.vbars i { flex: 1; min-width: 2px; max-width: 3px; border-radius: 2px; background: currentColor; opacity: .3; }
.vbars i.on { opacity: .9; }
.vdur { font-size: 13px; font-variant-numeric: tabular-nums; opacity: .85; }
.vdot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; margin-left: -4px; }
.bub.voice .meta { align-self: flex-end; margin: 0 0 -2px 2px; }

/* ---------- 视频 ---------- */
.bub.media.vid { position: relative; cursor: pointer; }
.bub.media.vid video { display: block; border-radius: 15px; background: #111; object-fit: cover; max-width: 100%; pointer-events: none; }
.mr.last:not(.me) .bub.media.vid video { border-bottom-left-radius: 4px; }
.mr.last.me .bub.media.vid video { border-bottom-right-radius: 4px; }
.vov { position: absolute; inset: 3px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.vov span { width: 52px; height: 52px; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.vov .ic { font-size: 24px; transform: translateX(2px); }
.vlen { position: absolute; left: 10px; bottom: 9px; padding: 3px 7px; border-radius: 10px; background: rgba(0,0,0,.45); color: #fff; font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.vlen .ic { font-size: 12px; }
.lb video { max-width: 96vw; max-height: 86dvh; border-radius: 6px; background: #000; }

/* ---------- 群聊 ---------- */
.av.grp { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; padding: 1px; background: #e4e7ec; border-radius: 30%; overflow: hidden; align-content: center; justify-items: center; }
.av.grp .av { border-radius: 25%; font-size: 9px !important; }
.av.grp .av img { border-radius: 25%; }
.mr-nm { display: none; font-size: 12px; font-weight: 600; margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.mr.show-name .mr-nm { display: block; }
.bub.media .mr-nm, .bub.voice .mr-nm { position: absolute; top: -18px; left: 4px; color: var(--text-3) !important; font-weight: 500; }
.mr.show-name .bub.media, .mr.show-name .bub.voice { margin-top: 18px; }
.bub.voice { position: relative; }
.pk-list { max-height: 46dvh; overflow-y: auto; margin: 0 -8px; }
.pk { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; cursor: pointer; }
.pk:hover { background: var(--line-2); }
.pk input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin: 0; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 4px; padding: 0 6px 8px; }
.mg { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; position: relative; min-width: 0; }
.mg-n { font-size: 12px; color: var(--text-2); max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-own { position: absolute; top: 34px; font-style: normal; font-size: 10px; background: var(--warn); color: #fff; padding: 0 5px; border-radius: 6px; line-height: 15px; }
.mg-plus { width: 46px; height: 46px; border-radius: 50%; border: 1.5px dashed var(--text-4); color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.mg.add:hover .mg-plus { border-color: var(--brand); color: var(--brand); }
