        .friends-layout { display: flex; gap: 16px; min-height: 500px; }
        .friends-sidebar { width: 280px; min-width: 280px; }
        .chat-area { flex: 1; display: flex; flex-direction: column; }
        .friend-tabs { display: flex; gap: 0; margin-bottom: 12px; }
        .friend-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; background: #edf2f7; border: none; font-size: 14px; font-weight: 600; color: #718096; transition: all 0.2s; }
        .friend-tab:first-child { border-radius: 8px 0 0 8px; }
        .friend-tab:last-child { border-radius: 0 8px 8px 0; }
        .friend-tab.active { background: #5a67d8; color: white; }
        .friend-item { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; cursor: pointer; transition: background 0.2s; margin-bottom: 4px; position: relative; }
        .friend-item:hover { background: #f0f4ff; }
        .friend-item.active { background: #e6e9ff; border-left: 3px solid #5a67d8; }
        .friend-avatar { width: 40px; height: 40px; border-radius: 50%; background: #5a67d8; color: white; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; cursor: pointer; overflow: hidden; }
        .friend-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
        /* 在线状态明暗（QQ 式）：离线好友头像置灰变暗，friends-call.js 按 CallHub 在线表加/去 offline 类 */
        .friend-avatar.offline { filter: grayscale(1); opacity: .45; }
        .friend-avatar { transition: filter .3s, opacity .3s; }
        .friend-info { flex: 1; min-width: 0; }
        .friend-name { font-weight: 600; font-size: 14px; color: #2d3748; }
        .friend-last-msg { font-size: 12px; color: #a0aec0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .unread-badge { position: absolute; top: 8px; right: 8px; background: #e53e3e; color: white; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
        .pending-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #fffaf0; border-radius: 8px; margin-bottom: 6px; border: 1px solid #feebc8; }
        .pending-msg { font-size: 12px; color: #a0aec0; margin-top: 3px; }
        .pending-actions button { padding: 4px 10px; font-size: 12px; border: none; border-radius: 6px; cursor: pointer; margin-left: 4px; }
        .btn-accept { background: #48bb78; color: white; }
        .btn-reject { background: #fc8181; color: white; }
        .add-friend-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
        .add-friend-bar input { flex: 1 1 160px; min-width: 0; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; }
        .add-friend-bar button { padding: 8px 16px; background: #5a67d8; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; white-space: nowrap; }
        .search-result-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #f7fafc; border-radius: 8px; margin-bottom: 6px; }
        .search-result-item .btn-add { padding: 4px 14px; background: #48bb78; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
        .chat-header { padding: 12px 16px; background: #f7fafc; border-radius: 10px 10px 0 0; border-bottom: 1px solid #e2e8f0; font-weight: 600; font-size: 16px; color: #2d3748; display: flex; align-items: center; gap: 8px; }
        .typing-indicator { font-size: 12px; color: #5a67d8; font-weight: 400; font-style: italic; }
        .chat-messages { flex: 1; overflow-y: auto; padding: 16px; background: #f0f2f5; max-height: 450px; min-height: 300px; }
        .chat-msg { display: flex; margin-bottom: 12px; animation: fadeIn 0.3s; position: relative; }
        .chat-msg.mine { justify-content: flex-end; }
        .chat-msg-bubble { max-width: 65%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-break: break-word; position: relative; }
        .chat-msg:not(.mine) .chat-msg-bubble { background: white; border-radius: 4px 14px 14px 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
        .chat-msg.mine .chat-msg-bubble { background: #5a67d8; color: white; border-radius: 14px 4px 14px 14px; }
        .chat-msg-bubble img { max-width: 200px; border-radius: 8px; margin-top: 6px; cursor: zoom-in; display: block; }
        .chat-msg-meta { font-size: 11px; margin-top: 4px; opacity: 0.7; display: flex; align-items: center; gap: 4px; }
        .chat-msg:not(.mine) .chat-msg-meta { color: #a0aec0; }
        .chat-msg.mine .chat-msg-meta { color: rgba(255,255,255,0.7); justify-content: flex-end; }
        .read-receipt { font-size: 10px; }
        .btn-recall { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: #e53e3e; color: white; border: none; font-size: 10px; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 10; }
        .chat-msg.mine:hover .btn-recall { display: flex; }
        .recalled-msg { font-style: italic; opacity: 0.5; text-decoration: line-through; }
        .chat-input-area { display: flex; gap: 8px; padding: 12px; background: white; border-radius: 0 0 10px 10px; border-top: 1px solid #e2e8f0; }
        .chat-input-area textarea { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; min-height: 44px; max-height: 100px; resize: none; font-family: inherit; }
        .chat-btns { display: flex; flex-direction: column; gap: 4px; }
        .chat-btns button { padding: 6px 12px; font-size: 13px; border: none; border-radius: 6px; cursor: pointer; white-space: nowrap; }
        .btn-chat-send { background: #5a67d8; color: white; }
        .btn-chat-img { background: #ed8936; color: white; }
        .btn-chat-voice { background: #38a169; color: white; }
        .btn-chat-voice.recording { background: #e53e3e; animation: pulse 1s infinite; }
        /* 内联 SVG 简笔画麦克风（与 mindmap 页同一段），文字按钮内垂直对齐 */
        .btn-chat-voice .mic-ico { vertical-align: -2px; }
        @keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
        .chat-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; color: #a0aec0; font-size: 16px; }
        .voice-msg { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 0; }
        .voice-msg .voice-icon { font-size: 20px; }
        .voice-msg .voice-duration { font-size: 12px; opacity: 0.8; }
        @media (max-width: 700px) { .friends-layout { flex-direction: column; } .friends-sidebar { width: 100%; min-width: 100%; } }

        /* 窄屏「返回列表」按钮：桌面端隐藏，≤768px 媒体查询里显示 */
        .chat-back-btn { display: none; border: none; background: transparent; font-size: 22px; color: #4a5568; cursor: pointer; padding: 0 4px; line-height: 1; flex-shrink: 0; }

        /* ===== 移动端适配（≤768px）：好友列表全宽 + 聊天区贴底 ===== */
        @media (max-width: 768px) {
            .friends-layout { flex-direction: column; gap: 12px; min-height: 0; }
            .friends-sidebar { width: 100%; min-width: 100%; }
            /* 好友列表限高滚动，聊天区一屏内可见 */
            #friendsList { max-height: 26dvh; overflow-y: auto; }
            .friend-tab { min-height: 40px; }
            /* 聊天面板：消息区高度按视口（100dvh 减顶部导航/列表），输入区 sticky 固定底部 */
            .chat-messages { max-height: none; min-height: 160px; height: calc(100dvh - 340px); }
            .chat-input-area {
                position: sticky; bottom: 0; z-index: 20; flex-wrap: wrap;
                padding-bottom: calc(12px + env(safe-area-inset-bottom));
            }
            .chat-input-area textarea { flex: 1 1 100%; font-size: 16px; min-height: 40px; }
            .chat-btns { flex-direction: row; width: 100%; }
            .chat-btns button { flex: 1; padding: 8px 12px; min-height: 40px; }
            /* 气泡放宽，图片不溢出 */
            .chat-msg-bubble { max-width: 78%; }
            .chat-msg-bubble img { max-width: 100%; }
            /* 触控目标与输入字号 */
            .add-friend-bar input { font-size: 16px; min-height: 40px; }
            .add-friend-bar button { min-height: 40px; flex: 0 0 auto; }
            .pending-actions button, .search-result-item .btn-add { padding: 8px 12px; min-height: 36px; }

            /* ===== 微信式整页聊天：body.chat-open 时聊天区铺满盖住列表（JS 只管加去 class） ===== */
            .chat-back-btn { display: inline-block; }
            body.chat-open { overflow: hidden; }
            body.chat-open .friends-sidebar { display: none; }
            /* z-index 50：盖住页面普通内容（无 z-index），又低于群管理弹层 100/动作面板 1000/通话 UI 4000/底部导航 9000 */
            body.chat-open .chat-area { position: fixed; inset: 0; z-index: 50; background: #fff; }
            body.chat-open .chat-header { border-radius: 0; padding-top: calc(12px + env(safe-area-inset-top)); }
            body.chat-open .chat-messages { height: auto; flex: 1; }
            body.chat-open .chat-input-area { border-radius: 0; }
            /* 全屏聊天时藏起 PWA 底部导航，避免压住输入栏 */
            body.chat-open #mpAppBottombar { display: none; }
        }
