.chat-modal-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.55); z-index: 1001; display: none;
            align-items: center; justify-content: center; padding: 1rem;
        }
        .chat-modal {
            background: #fff; border-radius: 12px; width: 420px; max-width: 100%;
            height: 600px; max-height: 90vh; display: flex; flex-direction: column;
            overflow: hidden; animation: modalFade 0.3s ease; box-shadow: 0 8px 40px rgba(0,0,0,0.2);
        }
        .chat-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 0.8rem 1rem; background: #2563eb; color: #fff; flex-shrink: 0;
        }
        .chat-header-title { font-size: 1rem; font-weight: 600; }
        .chat-close {
            width: 30px; height: 30px; border-radius: 50%; border: none;
            background: rgba(255,255,255,0.2); color: #fff; font-size: 20px;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            transition: 0.2s;
        }
        .chat-close:hover { background: rgba(255,255,255,0.4); }
        .chat-body {
            flex: 1; overflow-y: auto; padding: 0.8rem; background: #f5f6fa;
            display: flex; flex-direction: column; gap: 0.6rem;
        }
        .chat-empty {
            text-align: center; color: #999; padding: 2rem 0; font-size: 0.85rem;
        }
        .chat-msg { display: flex; flex-direction: column; max-width: 80%; }
        .chat-msg.me { align-self: flex-end; align-items: flex-end; }
        .chat-msg.other { align-self: flex-start; align-items: flex-start; }
        .chat-msg-bubble {
            padding: 0.55rem 0.75rem; border-radius: 12px; font-size: 0.9rem;
            line-height: 1.5; word-break: break-word; position: relative;
        }
        .chat-msg.me .chat-msg-bubble { background: #2563eb; color: #fff; border-bottom-right-radius: 4px; }
        .chat-msg.other .chat-msg-bubble { background: #fff; color: #333; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
        .chat-msg-time { font-size: 0.7rem; color: #aaa; margin-top: 2px; }
        .chat-msg-img {
            max-width: 200px; max-height: 200px; border-radius: 8px; cursor: pointer;
            object-fit: cover; border: 1px solid #eee;
        }
        .chat-msg-video {
            max-width: 200px; max-height: 200px; border-radius: 8px; cursor: pointer;
            border: 1px solid #eee; background: #000;
        }
        .chat-footer { position: relative; flex-shrink: 0; border-top: 1px solid #eee; background: #fff; }
        .chat-toolbar { display: flex; gap: 0.4rem; padding: 0.4rem 0.8rem; }
        .chat-tool-btn {
            width: 32px; height: 32px; border-radius: 6px; border: 1px solid #ddd;
            background: #f9fafb; cursor: pointer; display: flex; align-items: center;
            justify-content: center; font-size: 16px; transition: 0.2s;
        }
        .chat-tool-btn:hover { background: #e5e7eb; }
        .chat-input-row {
            display: flex; gap: 0.3rem; padding: 0 0.8rem 0.8rem; align-items: flex-end;
        }
        .chat-input {
            flex: 1;
            width: 100%; /* 确保在 flex wrapper 中撑满 */
            border: 1px solid #ddd; border-radius: 8px; padding: 0.5rem 0.7rem;
            font-size: 0.9rem; resize: none; outline: none; font-family: inherit;
            max-height: 100px; line-height: 1.4;
            box-sizing: border-box;
        }
        .chat-input:focus { border-color: #2563eb; }
        .msg-chat-input-wrapper {
            flex: 1; min-width: 0; position: relative;
            display: flex;
        }
        .chat-send-btn {
            padding: 0.35rem 0.75rem; background: #2563eb; color: #fff; border: none;
            border-radius: 8px; cursor: pointer; font-size: 0.8rem; white-space: nowrap;
            transition: 0.2s;
        }
        .chat-send-btn:hover { background: #1d4ed8; }
        .chat-send-btn:disabled { background: #93c5fd; cursor: not-allowed; }
        .chat-uploading { color: #2563eb; font-size: 0.8rem; text-align: center; padding: 0.3rem; }
        /* 美化：消息气泡加头像 */
        .chat-msg { display: flex; gap: 0.4rem; max-width: 85%; }
        .chat-msg.me { align-self: flex-end; flex-direction: row-reverse; }
        .chat-msg.other { align-self: flex-start; }
        .chat-msg-avatar {
            width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
            background: #e5e7eb; display: flex; align-items: center; justify-content: center;
            font-size: 14px; overflow: hidden;
        }
        .chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
        .chat-msg-body { display: flex; flex-direction: column; }
        .chat-msg.me .chat-msg-body { align-items: flex-end; }
        .chat-msg.other .chat-msg-body { align-items: flex-start; }
        /* 美化：工具栏图标加大 */
        .chat-tool-btn {
            width: 36px; height: 36px; border-radius: 8px; border: 1px solid #e5e7eb;
            background: #f9fafb; cursor: pointer; display: flex; align-items: center;
            justify-content: center; font-size: 18px; transition: all 0.2s;
            position: relative; overflow: hidden;
        }
        .chat-tool-btn:hover { background: #eff6ff; border-color: #93c5fd; transform: scale(1.05); }
        .chat-tool-btn.recording { background: #fef2f2; border-color: #fca5a5; animation: pulse 1s infinite; }
        @keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
        /* 红点 */
        .chat-unread-dot {
            position: absolute; top: -2px; right: -2px; width: 8px; height: 8px;
            border-radius: 50%; background: #ef4444; display: none;
        }
        .chat-unread-dot.show { display: block; }
    
/* 表情面板 */
.emoji-panel{position:absolute;bottom:100%;left:0;margin-bottom:6px;background:#fff;border:1px solid #e2e8f0;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,0.12);padding:10px;z-index:9999;width:320px;max-height:240px;overflow-y:auto;display:none;grid-template-columns:repeat(8,1fr);gap:4px;}
.emoji-panel.show{display:grid;}
.emoji-panel span{font-size:1.5rem;cursor:pointer;text-align:center;padding:4px;border-radius:6px;transition:background .15s;user-select:none;}
.emoji-panel span:hover{background:#f1f5f9;transform:scale(1.2);}
.emoji-btn{background:none;border:1px solid #e2e8f0;border-radius:8px;cursor:pointer;font-size:1.2rem;padding:4px 8px;transition:all .15s;}
.emoji-btn:hover{background:#f0f9ff;border-color:#93c5fd;}