/* ==========================================
   峰仔OICQ - 仿OICQ经典界面样式
   ========================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --primary-light: #e8f8f0;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --warning: #f39c12;
    --info: #3498db;
    --bg: #f5f6fa;
    --bg-white: #ffffff;
    --border: #e0e0e0;
    --text: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 8px;
    --transition: all 0.2s ease;
    --title-bar-height: 48px;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #e8ecf1;
    height: 100vh;
    overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 20px; border: none; border-radius: 4px;
    font-size: 14px; cursor: pointer; transition: var(--transition);
    outline: none; text-decoration: none; gap: 5px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary { background: #eee; color: #666; border: 1px solid #ddd; }
.btn-secondary:hover { background: #ddd; color: #333; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e67e22; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-group input, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 4px; font-size: 14px; outline: none; transition: var(--transition);
    font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(7,193,96,0.1); }
.form-group textarea { resize: vertical; min-height: 60px; }

/* ========== 登录/注册 ========== */
.auth-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-box {
    background: #fff; border-radius: 12px; padding: 40px;
    width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-logo { width: 64px; height: 64px; margin-bottom: 10px; }
.auth-header h1 { font-size: 24px; color: var(--primary); margin-bottom: 5px; }
.auth-header p { color: var(--text-light); font-size: 13px; }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h2 { font-size: 18px; margin-bottom: 20px; text-align: center; color: var(--text); }
.form-switch { text-align: center; margin-top: 15px; font-size: 13px; color: var(--text-light); }

/* ========== 主界面布局 ========== */
.main-container {
    display: flex; flex-direction: column; height: 100vh; background: var(--bg);
}

/* 标题栏 */
.title-bar {
    height: var(--title-bar-height); background: linear-gradient(180deg, #0a8cd2 0%, #0973b0 100%);
    color: #fff; display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px; flex-shrink: 0;
    -webkit-app-region: no-drag;
}
.title-bar-left { display: flex; align-items: center; gap: 8px; }
.title-logo { width: 24px; height: 24px; }
.title-text { font-size: 14px; font-weight: bold; letter-spacing: 1px; }
.title-bar-right { display: flex; align-items: center; gap: 10px; }
.user-info-bar { display: flex; align-items: center; gap: 6px; }
/* 管理员昵称：点击可在新窗口进入后台 */
.nickname-admin { cursor: pointer; }
.nickname-admin:hover { text-decoration: underline; }
.avatar-small { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); object-fit: cover; }
.oicq-badge { background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 10px; font-size: 11px; }

/* 主体区域 */
.main-body {
    display: flex; flex: 1; overflow: hidden;
}

/* 左侧面板 */
.left-panel {
    width: 280px; min-width: 280px; background: #e9ecf0;
    display: flex; flex-direction: column; border-right: 1px solid #d5d8dc;
}

.search-bar {
    padding: 10px; position: relative;
}
.search-bar input {
    width: 100%; padding: 8px 12px; border: 1px solid #c8ccd0; border-radius: 4px;
    font-size: 13px; outline: none; background: #fff;
}
.search-bar input:focus { border-color: var(--primary); }
.search-results {
    position: absolute; top: 45px; left: 10px; right: 10px;
    background: #fff; border-radius: 4px; box-shadow: var(--shadow);
    max-height: 300px; overflow-y: auto; z-index: 100;
}

.tab-bar {
    display: flex; border-bottom: 1px solid #d5d8dc;
}
.tab-item {
    flex: 1; text-align: center; padding: 10px 5px; cursor: pointer;
    font-size: 13px; color: var(--text-secondary); transition: var(--transition);
    position: relative; border-bottom: 2px solid transparent;
}
.tab-item:hover { color: var(--text); background: rgba(255,255,255,0.5); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab-icon { font-size: 16px; }
.tab-item.has-unread-msg { background: rgba(7,193,96,.12); color: var(--primary); font-weight: 600; }
.tab-msg-count { display: inline-block; margin-left: 4px; vertical-align: middle; min-width: 16px; padding: 0 4px; height: 16px; line-height: 16px; font-size: 10px; font-weight: 600; text-align: center; color: #fff; background: var(--primary); border-radius: 9px; }
.badge {
    position: absolute; top: 4px; right: 8px; background: var(--danger);
    color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 10px; min-width: 18px;
}

.tab-content { display: none; flex: 1; overflow-y: auto; }
.tab-content.active { display: flex; flex-direction: column; }

.list-header {
    padding: 8px 12px; font-size: 12px; color: var(--text-light); font-weight: 500;
    border-bottom: 1px solid #e0e0e0; background: #f0f2f5;
}

.contact-list { flex: 1; overflow-y: auto; }

.contact-item {
    display: flex; align-items: center; padding: 10px 12px; cursor: pointer;
    transition: var(--transition); gap: 10px; border-bottom: 1px solid #f0f0f0;
}
.contact-item:hover { background: #dce8f5; }
.contact-item.active { background: #c5d9f0; }
.contact-item .avatar { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.contact-item .contact-info { flex: 1; min-width: 0; }
.contact-item .contact-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-item .contact-detail { font-size: 11px; color: var(--text-light); }
.contact-item .contact-status {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.contact-item .contact-status.online { background: var(--primary); }
.contact-item .contact-status.offline { background: #ccc; }
.contact-item .unread-badge {
    display: inline-block;
    background: #ff4d4f;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 16px;
    margin-left: 6px;
    vertical-align: middle;
    animation: badgePopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badgePopIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
/* 有未读消息的联系人整行加轻微背景 */
.contact-item.has-unread {
    background: rgba(255, 77, 79, 0.06);
}
.contact-item.has-unread .contact-name {
    font-weight: 600;
}

/* 右侧聊天面板 */
.right-panel { flex: 1; display: flex; flex-direction: column; background: #f5f7fa; }

.chat-placeholder {
    flex: 1; display: flex; align-items: center; justify-content: center;
}
.placeholder-content { text-align: center; color: var(--text-light); }
.placeholder-icon { font-size: 64px; margin-bottom: 15px; opacity: 0.5; }
.placeholder-content h2 { font-size: 20px; margin-bottom: 8px; color: var(--text-secondary); }

.chat-area { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.chat-header {
    height: 56px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px; background: #fff; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-avatar { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; }
.chat-header-text { display: flex; flex-direction: column; align-items: flex-start; }
.chat-header-name { font-size: 15px; font-weight: 500; }
.chat-header-status { font-size: 12px; color: var(--text-light); }
.chat-header-actions { display: flex; gap: 8px; }

.chat-messages {
    flex: 1; overflow-y: auto; padding: 15px;
    display: flex; flex-direction: column; gap: 15px;
    min-height: 0;
}
.messages-loading { text-align: center; color: var(--text-light); padding: 40px; }

.message-row { display: flex; gap: 10px; max-width: 75%; align-self: flex-start; }
.message-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.message-row.system { align-self: center; max-width: 90%; }

/* @提及高亮 */
.message-row.mentioned .message-bubble {
    background: linear-gradient(135deg, #fff7e6, #fffbe6) !important;
    border-color: #faad14 !important;
    box-shadow: 0 0 0 2px rgba(250, 173, 20, 0.2);
}
.message-row.mentioned .message-sender {
    color: #d48806;
    font-weight: 600;
}
/* 暗色/私密模式下@高亮适配 */
.secret-chat-mode .message-row.mentioned .message-bubble {
    background: linear-gradient(135deg, rgba(250, 173, 20, 0.18), rgba(250, 200, 20, 0.12)) !important;
    border-color: rgba(250, 173, 20, 0.5) !important;
    color: #ffe8a0 !important;
}

.message-avatar { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }

/* @提及 - 群聊中可点击头像 */
.mention-avatar {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mention-avatar:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.4);
    border: 2px solid #1890ff;
    border-radius: 50%;
}
.mention-avatar:active {
    transform: scale(1.05);
}

/* @输入自动补全下拉 */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
    z-index: 100;
    margin-bottom: 4px;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
}
.mention-item:hover,
.mention-item.active {
    background: #e6f7ff;
}
.mention-item:first-child { border-radius: 8px 8px 0 0; }
.mention-avatar {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.mention-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}
.mention-oicq {
    font-size: 11px;
    color: #999;
    margin-left: auto;
}

.message-body { display: flex; flex-direction: column; gap: 2px; }
.message-sender { font-size: 11px; color: var(--text-light); padding: 0 4px; }
.message-row.mine .message-sender { text-align: right; }

.message-bubble {
    padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1.5;
    word-break: break-word; position: relative;
}
.message-row:not(.mine) .message-bubble {
    background: #fff; border: 1px solid #e8e8e8;
}
.message-row.mine .message-bubble {
    background: #d2f0e0; border: 1px solid #b7e4cc;
}
.message-row.system .message-bubble {
    background: transparent; border: none; color: var(--text-light);
    font-size: 12px; text-align: center; padding: 4px 10px;
}

.message-time { font-size: 11px; color: var(--text-light); padding: 0 4px; }
.message-row.mine .message-time { text-align: right; }
.message-recalled { font-style: italic; color: var(--text-light); }

.chat-input-area {
    background: #fff; border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input-toolbar {
    display: flex; align-items: center; padding: 5px 10px; border-bottom: 1px solid #f0f0f0;
}
.toolbar-btn {
    background: none; border: none; font-size: 18px; cursor: pointer;
    padding: 4px 8px; border-radius: 4px; transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center;
    color: #6b7280;
}
.toolbar-btn:hover { background: #f0f2f5; }
/* 统一等宽等高 SVG 图标（各功能专属配色，彩色显眼） */
.toolbar-btn .tb-ico { width: 20px; height: 20px; display: block; }
.toolbar-btn .tb-emoji { color: #F5A623; }
.toolbar-btn .tb-image { color: #22B573; }
.toolbar-btn .tb-file  { color: #2D8CF0; }
.toolbar-btn .tb-star  { color: #FFB400; }
.toolbar-btn .tb-mic   { color: #F2544B; }
.toolbar-btn .tb-video { color: #8A5CF6; }
.toolbar-btn.voice-active { background: #e74c3c; transform: scale(1.1); }
.toolbar-btn.voice-active .tb-ico { color: #fff; }
.toolbar-btn.voice-active:hover { background: #e74c3c; }

/* ========== 表情选择器 ========== */
.emoji-picker {
    position: absolute; bottom: 100%; left: 0;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 10px; z-index: 100; width: 340px;
    margin-bottom: 6px; overflow: visible; /* 外层不滚动，滚动交给内层 emoji-panel，去掉外围下拉条 */
}
.emoji-item {
    display: inline-block; font-size: 24px; cursor: pointer;
    padding: 4px; border-radius: 4px; text-align: center;
    width: 30px; height: 30px; line-height: 30px;
    transition: background 0.15s;
}
.emoji-item:hover { background: #f0f0f0; transform: scale(1.2); }

/* ========== 自定义表情贴图 ========== */
.sticker-section-title { font-size: 12px; color: var(--text-light); margin: 2px 0 6px; font-weight: 600; }
.sticker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.sticker-item {
    aspect-ratio: 1; border-radius: 6px; overflow: hidden; cursor: pointer;
    background: #f5f5f5; display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
}
.sticker-item:hover { transform: scale(1.05); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.sticker-item img { width: 100%; height: 100%; object-fit: cover; }
.sticker-add { border: 2px dashed #ccc; color: #999; font-size: 28px; font-weight: 300; }
.sticker-add:hover { border-color: #1aad19; color: #1aad19; }
.sticker-item[draggable="true"] { cursor: grab; }
.sticker-dragging { opacity: 0.4; }
.sticker-item.sticker-drag-over { outline: 2px solid #1aad19; outline-offset: -2px; }
[data-theme="dark"] .sticker-item { background: #2a2a45; }
[data-theme="dark"] .sticker-add { border-color: #3a3a55; color: #889; }

.chat-input-box { padding: 8px 12px; }

/* ========== 加载更多历史消息 ========== */
.load-more-msg { text-align: center; color: #1aad19; font-size: 12px; padding: 8px; cursor: pointer; border-radius: 6px; }
.load-more-msg:hover { background: #f5f5f5; }

/* ========== 正在输入提示（消息流底部气泡） ========== */
.typing-bubble {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 14px;
}
/* 实心主题绿 + 白字白点：对比度最高，且与"在线状态/我的气泡"同色系 */
#typing-row .typing-bubble {
    background: #1aad19 !important;
    border-color: #1aad19 !important;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(26,173,25,.25);
}
#typing-row .typing-text { font-size: 13px; color: #fff !important; font-weight: 600; text-shadow: none !important; }
#typing-row .typing-name { color: #ffd666 !important; font-weight: 700; }
/* ========== 输入框高度拖拽手柄 ========== */
.chat-resizer {
    height: 6px; cursor: ns-resize; background: transparent;
    transition: background .15s; flex-shrink: 0;
}
.chat-resizer:hover, .chat-resizer.dragging { background: rgba(7,193,96,.3); }
[data-theme="dark"] .chat-resizer:hover,
[data-theme="dark"] .chat-resizer.dragging { background: rgba(74,222,128,.25); }
#typing-row .tdot {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,255,255,.95) !important;
    animation: tdotPulse 1.2s infinite ease-in-out both;
}
.typing-bubble .tdots { display: inline-flex; align-items: center; gap: 4px; }
.typing-bubble .tdots .tdot:nth-child(2) { animation-delay: .2s; }
.typing-bubble .tdots .tdot:nth-child(3) { animation-delay: .4s; }
@keyframes tdotPulse {
    0% { transform: scale(0.6); opacity: .35; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.6); opacity: .35; }
}
@keyframes typingFade { from { opacity: 0.55; } to { opacity: 1; } }

/* ========== 云端 / 全站消息搜索 ========== */
.chat-search-cloud {
    background: #f0f7ff; color: #1989fa; border: 1px solid #cfe3ff;
    border-radius: 4px; font-size: 11px; padding: 2px 6px; cursor: pointer; margin-left: 4px;
}
.chat-search-cloud:hover { background: #e0efff; }
.chat-search-cloud-results {
    background: #fff; border: 1px solid #eee; border-radius: 6px; margin: 6px 4px;
    max-height: 50vh; overflow-y: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
[data-theme="dark"] .chat-search-cloud { background: #1f2a44; color: #6cb6ff; border-color: #2a3a5a; }
[data-theme="dark"] .chat-search-cloud-results { background: #1e1e34; border-color: #2a2a45; }
.cloud-search-head { font-size: 12px; color: #666; padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
.cloud-search-list { padding: 4px 0; }
.cloud-search-item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f5f5f5; }
.cloud-search-item:hover { background: #f7faff; }
.cloud-search-item .csi-meta { font-size: 11px; color: #999; margin-bottom: 2px; }
.cloud-search-item .csi-content { font-size: 13px; color: #333; word-break: break-all; }
[data-theme="dark"] .cloud-search-item .csi-content { color: #ddd; }
[data-theme="dark"] .cloud-search-item:hover { background: #23233f; }
.cloud-search-pager { text-align: center; padding: 8px 0; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
[data-theme="dark"] .load-more-msg:hover { background: #2a2a45; }
.chat-input-box textarea {
    width: 100%; border: none; outline: none; resize: none;
    font-size: 14px; font-family: inherit; line-height: 1.6;
}
/* 输入框占位提示（叠加层）：文本随输入为空时显示，末尾高亮快捷键 */
.chat-input-wrap { position: relative; }
.chat-input-hint {
    position: absolute; top: 0; left: 0; right: 0;
    display: none;
    pointer-events: none;
    font-size: 14px; font-family: inherit; line-height: 1.6;
    color: var(--text-light);
}
.chat-input-wrap textarea:placeholder-shown ~ .chat-input-hint {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.chat-input-hint-text { white-space: nowrap; }
.chat-input-hint-kbd {
    display: inline-flex; align-items: center;
    padding: 1px 7px; border-radius: 5px;
    font-size: 12px; font-weight: 600; line-height: 1.5;
    color: var(--primary);
    background: rgba(7,193,96,0.12);
    border: 1px solid rgba(7,193,96,0.35);
    white-space: nowrap;
}
@media (max-width: 768px) {
    /* 与移动端 textarea 的内边距/字号保持一致 */
    .chat-input-hint { padding: 8px 10px; font-size: 16px; }
    .chat-input-hint-kbd { display: none; }   /* 移动端无物理键盘，不展示快捷键 */
}
[data-theme="dark"] .chat-input-hint-kbd {
    color: #4ade80; background: rgba(7,193,96,0.16); border-color: rgba(74,222,128,0.4);
}
.chat-input-footer {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 5px 12px 10px; gap: 10px;
}
.char-count { font-size: 12px; color: var(--text-light); }

/* ========== 右侧信息面板（嵌入分栏） ========== */
.chat-area { flex-direction: row !important; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.chat-info-panel {
    width: 260px; flex-shrink: 0;
    background: #fff; border-left: 1px solid var(--border);
    display: flex; flex-direction: column; overflow-y: auto;
    transition: width 0.25s ease, opacity 0.2s ease;
    position: relative;
}
.chat-info-panel.collapsed { width: 0; min-width: 0; overflow: hidden; border-left: none; opacity: 0; }
.info-panel-collapse {
    position: absolute; top: 50%; left: -18px; transform: translateY(-50%);
    width: 18px; height: 48px; background: #e8e8e8; border-radius: 4px 0 0 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 10px; color: #999; z-index: 10;
    transition: background 0.15s;
}
.info-panel-collapse:hover { background: #d0d0d0; color: #333; }
.chat-info-panel.collapsed .info-panel-collapse { left: -18px; border-radius: 4px; }
.chat-info-panel.collapsed .info-panel-collapse { content: '▶'; }
.info-panel-header {
    padding: 20px 16px 12px; text-align: center;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
}
.info-panel-avatar { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #e8f0fe; object-fit: cover; }
.info-panel-name { font-size: 15px; font-weight: 600; margin: 8px 0 2px; color: #333; }
.info-panel-oicq { font-size: 11px; color: #999; }
.info-panel-status { font-size: 12px; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.info-panel-status .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.info-panel-status.online { color: #27ae60; }
.info-panel-status.online .status-dot { background: #27ae60; }
.info-panel-status.offline { color: #999; }
.info-panel-status.offline .status-dot { background: #999; }
.info-panel-section { padding: 12px 16px; border-bottom: 1px solid #f5f5f5; }
.info-panel-section h5 { font-size: 11px; color: #999; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.info-panel-section .info-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 12px; }
.info-panel-section .info-row .info-label { color: #888; }
.info-panel-section .info-row .info-value { color: #333; font-weight: 500; }
.info-panel-signature { font-size: 12px; color: #666; line-height: 1.5; word-break: break-all; }
.info-panel-members { display: flex; flex-wrap: wrap; gap: 5px; }
.info-panel-member { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid #f0f0f0; cursor: pointer; position: relative; }
.info-panel-member:hover { border-color: #3498db; }
.info-panel-member .mem-tip { display: none; position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 3px; white-space: nowrap; z-index: 10; }
.info-panel-member:hover .mem-tip { display: block; }
.info-panel-actions { padding: 12px 16px; }
.info-panel-actions .action-btn { display: block; width: 100%; padding: 7px 0; margin-bottom: 5px; border-radius: 6px; border: 1px solid #e0e0e0; background: #fff; color: #333; font-size: 12px; cursor: pointer; transition: all 0.15s; text-align: center; }
.info-panel-actions .action-btn:hover { background: #f5f7fa; border-color: #3498db; color: #3498db; }
.info-panel-actions .action-btn.danger:hover { border-color: #e74c3c; color: #e74c3c; background: #fef2f2; }
@media (max-width: 768px) {
    .chat-info-panel { position: absolute; right: 0; top: 0; bottom: 0; width: 280px; z-index: 60; display: none; }
    .chat-info-panel.open { display: flex; }
}
[data-theme="dark"] .chat-info-panel { background: #1a1a30; border-color: #2a2a45; }
[data-theme="dark"] .info-panel-collapse { background: #2a2a45; color: #888; }
[data-theme="dark"] .info-panel-collapse:hover { background: #3a3a55; }
[data-theme="dark"] .info-panel-header { background: linear-gradient(180deg, #1e1e38, #1a1a30); border-color: #2a2a45; }
[data-theme="dark"] .info-panel-section { border-color: #1e1e36; }
[data-theme="dark"] .info-panel-section h5 { color: #666; }
[data-theme="dark"] .info-panel-name { color: #e0e0e0; }
[data-theme="dark"] .info-panel-signature { color: #aaa; }
[data-theme="dark"] .info-panel-actions .action-btn { background: #1e1e32; color: #ccc; border-color: #2a2a45; }
[data-theme="dark"] .info-panel-actions .action-btn:hover { background: #2a2a45; }

/* ========== 图片预览栏（输入框内部） ========== */
.image-preview-bar {
    padding: 6px 8px 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.image-preview-inner {
    position: relative;
    display: inline-block;
}
.image-preview-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    display: block;
}
.image-preview-close {
    position: absolute;
    top: -6px;
    right: -6px;
    background: rgba(0,0,0,0.55);
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.image-preview-close:hover {
    background: #ff4d4f;
}

/* ========== 图片消息 ========== */
.message-image-bubble {
    padding: 4px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    max-width: 240px;
    overflow: hidden;
    border-radius: 8px;
}
.chat-image-thumb {
    width: 100%;
    max-width: 240px;
    max-height: 240px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    transition: transform 0.15s;
}
.chat-image-thumb:hover {
    transform: scale(1.02);
}

/* ========== 图片灯箱 ========== */
.image-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
    /* 滚轮缩放平滑过渡（transform 由 app.media.js 驱动） */
    transition: transform 0.18s ease-out;
    will-change: transform;
}

/* 头像放大（静态模拟框）：圆形裁切展示 */
.avatar-small, .chat-avatar, .info-panel-avatar { cursor: zoom-in; transition: opacity 0.15s ease; }
.avatar-small:hover, .chat-avatar:hover, .info-panel-avatar:hover { opacity: 0.85; }
.image-lightbox img.lightbox-avatar {
    box-sizing: border-box;
    width: min(70vw, 70vh, 460px);
    height: min(70vw, 70vh, 460px);
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
    /* 居中裁切填充圆框：与列表头像显示效果一致，而不是完整原图 */
    object-fit: cover;
    object-position: center;
    cursor: default;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* ========== 录音浮层 ========== */
.voice-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9998; display: flex; align-items: center; justify-content: center;
}
.voice-overlay-bg {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
}
.voice-overlay-content {
    position: relative; z-index: 1; text-align: center; color: #fff;
}
.voice-cancel-zone {
    font-size: 13px; color: rgba(255,255,255,0.5);
    padding: 8px 20px; margin-bottom: 30px;
    border: 2px dashed rgba(255,255,255,0.2); border-radius: 8px;
    transition: all 0.2s;
}
.voice-overlay.cancelling .voice-cancel-zone {
    color: #ff4d4f; border-color: #ff4d4f; background: rgba(255,77,79,0.15);
}
.voice-wave { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 50px; margin: 20px 0; }
.voice-wave span {
    width: 6px; border-radius: 3px; background: #1890ff;
    transition: height 0.2s;
}
.voice-wave span.animating {
    animation: waveAnim 0.6s ease-in-out infinite alternate;
}
.voice-wave span:nth-child(1) { height: 12px; animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 24px; animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { height: 36px; animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { height: 48px; animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { height: 36px; animation-delay: 0.2s; }
.voice-wave span:nth-child(6) { height: 24px; animation-delay: 0.1s; }
.voice-wave span:nth-child(7) { height: 12px; animation-delay: 0s; }
@keyframes waveAnim {
    0% { height: 10px; }
    100% { height: 50px; }
}
.voice-timer { font-size: 32px; font-weight: 300; letter-spacing: 2px; margin: 10px 0; }
.voice-hint { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 15px; }
.voice-overlay.cancelling .voice-hint { color: #ff4d4f; }
.voice-btn-hold {
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(255,255,255,0.15); margin: 20px auto 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: rgba(255,255,255,0.6);
}

/* ========== 语音消息气泡 ========== */
.message-voice-bubble {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px !important; cursor: pointer;
    min-width: 130px; user-select: none;
}
.message-voice-bubble.playing { background: #e6f7ff !important; }
.voice-icon { font-size: 20px; }
.voice-wave-bar {
    font-size: 18px; letter-spacing: 2px; color: #1890ff;
    transition: color 0.2s;
}
.message-voice-bubble.playing .voice-wave-bar { color: #ff4d4f; }
.voice-dur { font-size: 12px; color: #999; margin-left: auto; white-space: nowrap; }

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ========== 聊天搜索栏 ========== */
.chat-search-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--border);
}
.chat-search-bar input {
    flex: 1; padding: 6px 10px; border: 1px solid #3498db; border-radius: 4px;
    font-size: 13px; outline: none; box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}
.chat-search-count { font-size: 11px; color: #999; white-space: nowrap; }
.chat-search-close { background: none; border: none; cursor: pointer; font-size: 14px; color: #999; }
.search-highlight { background: #fff3a8 !important; border-radius: 2px; }
.search-active { background: #ffd700 !important; border-radius: 2px; }
[data-theme="dark"] .chat-search-bar { background: #1a1a30; border-color: #2a2a45; }
[data-theme="dark"] .chat-search-bar input { background: #1e1e32; color: #e0e0e0; border-color: #3498db; }
[data-theme="dark"] .mobile-dropdown { background: #1e1e32; }
[data-theme="dark"] .mobile-dropdown-item { color: #e0e0e0; border-color: #2a2a45; }
[data-theme="dark"] .mobile-dropdown-item:hover { background: #2a2a45; }
[data-theme="dark"] .mobile-dropdown-item.danger { color: #ff6b6b; }

/* ========== 弹窗（美化版） ========== */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; }
.modal.active { display: flex; align-items: center; justify-content: center; animation: modalFadeIn 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(2px);
}
.modal-box {
    position: relative; background: #fff; border-radius: 12px; width: 420px;
    max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    z-index: 1; animation: modalSlideUp 0.25s ease;
}
@keyframes modalSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px; border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: #333; }
.modal-close {
    background: #f5f5f5; border: none; font-size: 14px; cursor: pointer;
    color: #999; padding: 6px 10px; border-radius: 6px; transition: all 0.15s;
}
.modal-close:hover { background: #fee; color: #e74c3c; }
.modal-body { padding: 24px; }
.modal-body label { display: block; margin-bottom: 5px; font-size: 13px; color: #666; font-weight: 500; }
.modal-body input, .modal-body select, .modal-body textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid #e0e0e0; border-radius: 8px;
    font-size: 14px; margin-bottom: 14px; outline: none; font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
    border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.modal-body textarea { resize: vertical; min-height: 60px; }
[data-theme="dark"] .modal-box { background: #1e1e32; }
[data-theme="dark"] .modal-header { background: linear-gradient(180deg, #1e1e3a, #1e1e32); border-color: #2a2a45; }
[data-theme="dark"] .modal-header h3 { color: #e0e0e0; }
[data-theme="dark"] .modal-close { background: #2a2a45; color: #888; }
[data-theme="dark"] .modal-body label { color: #aaa; }
[data-theme="dark"] .modal-body input, [data-theme="dark"] .modal-body select, [data-theme="dark"] .modal-body textarea {
    background: #1a1a30; color: #e0e0e0; border-color: #2a2a45;
}
[data-theme="dark"] .modal-body input:focus, [data-theme="dark"] .modal-body select:focus { border-color: #667eea; }

/* 个人资料弹窗 - 紧凑型（旧样式已移除，使用inline样式） */

/* 头像fallback - img加载失败时CSS背景显示人物剪影 */
.avatar, .chat-avatar, .avatar-small, .message-avatar, .avatar-sm {
    background: #e8e8e8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='35' r='20' fill='%23c0c0c0'/%3E%3Cellipse cx='50' cy='80' rx='35' ry='25' fill='%23c0c0c0'/%3E%3C/svg%3E") center/cover no-repeat;
}

/* ========== 创建群 - 成员选择 ========== */
.member-search-box { position: relative; }
.member-search-box input { width: 100%; box-sizing: border-box; }

.search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    max-height: 200px; overflow-y: auto;
    background: #fff; border: 1px solid var(--border);
    border-radius: 4px; z-index: 10; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.search-item {
    display: flex; align-items: center; padding: 8px 12px; cursor: pointer;
    border-bottom: 1px solid #f0f0f0; gap: 10px;
}
.search-item:hover { background: #f5f5f5; }
.search-item:last-child { border-bottom: none; }
.avatar-sm { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.search-item-info { flex: 1; min-width: 0; }
.search-item-name { font-size: 13px; font-weight: 500; color: var(--text); }
.search-item-detail { font-size: 11px; color: var(--text-light); }

.create-group-avatar-section img {
    display: block; margin: 0 auto; border: 2px solid #eee;
    transition: border-color 0.2s;
}
.create-group-avatar-section img:hover {
    border-color: var(--primary);
}

.selected-members { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.member-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: #e8f0fe; color: #1a73e8;
    padding: 3px 8px; border-radius: 12px; font-size: 12px;
}
.member-tag-remove {
    background: none; border: none; cursor: pointer;
    color: #1a73e8; font-size: 12px; padding: 0 2px;
    line-height: 1;
}
.member-tag-remove:hover { color: #d93025; }

/* ========== Toast ========== */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 6px; color: #fff; font-size: 14px;
    z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-width: 400px; text-align: center;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.warning { background: var(--warning); }

/* ========== 好友上下线提示条 ========== */
/* 下移到「标题栏(48px)+聊天头部(56px)」下方，避免遮挡顶部标题/昵称/操作按钮 */
#presence-toasts {
    position: fixed; top: calc(var(--title-bar-height) + 64px); right: 16px; z-index: 10000;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
    align-items: flex-end;
}
.presence-toast {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px 11px 12px; border-radius: 10px; color: #fff;
    font-size: 14px; font-weight: 600; letter-spacing: .2px;
    border-left: 4px solid rgba(255,255,255,.9);
    animation: presenceIn .28s ease; max-width: 340px;
}
/* 上线：鲜明绿色 + 绿色光晕 */
.presence-toast.online {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    box-shadow: 0 8px 22px rgba(22,163,74,.55), inset 0 0 0 1px rgba(255,255,255,.18);
}
/* 下线：鲜明暖橙，与顶栏蓝色、上线绿色明显区分 */
.presence-toast.offline {
    background: linear-gradient(135deg, #f59e0b 0%, #c2410c 100%);
    box-shadow: 0 8px 22px rgba(194,65,12,.55), inset 0 0 0 1px rgba(255,255,255,.18);
}
.presence-toast .p-avatar {
    width: 30px; height: 30px; border-radius: 6px; object-fit: cover;
    border: 1.5px solid rgba(255,255,255,.85);
}
.presence-toast .p-icon { font-size: 15px; filter: drop-shadow(0 0 2px rgba(255,255,255,.9)) drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.presence-toast .p-text { line-height: 1.3; text-shadow: 0 1px 2px rgba(0,0,0,.28); }
@keyframes presenceIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (max-width: 768px) {
    #presence-toasts { top: auto; bottom: 70px; right: auto; left: 50%; transform: translateX(-50%); align-items: center; }
    .presence-toast { font-size: 13px; max-width: 86vw; }
}

/* ========== 好友上/下线列表行高亮动效 ========== */
.contact-item.presence-flash-online { animation: presenceFlashOn 1.6s ease-out; }
.contact-item.presence-flash-offline { animation: presenceFlashOff 1.6s ease-out; }
@keyframes presenceFlashOn {
    0%   { background: rgba(76,217,100,0); }
    12%  { background: rgba(76,217,100,.34); box-shadow: inset 3px 0 0 var(--success); }
    100% { background: transparent; box-shadow: none; }
}
@keyframes presenceFlashOff {
    0%   { background: rgba(142,142,147,0); }
    12%  { background: rgba(142,142,147,.28); box-shadow: inset 3px 0 0 var(--info); }
    100% { background: transparent; box-shadow: none; }
}

/* ========== 搜索下拉 ========== */
.search-result-item {
    display: flex; align-items: center; padding: 10px 12px; cursor: pointer;
    gap: 10px; border-bottom: 1px solid #f5f5f5; transition: var(--transition);
}
.search-result-item:hover { background: #f0f7ff; }
.search-result-item img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; }

/* ========== 群信息弹窗 ========== */
.group-info-section { margin-bottom: 10px; }
.group-info-section h4 { font-size: 13px; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #f5f5f5; }
.group-member-item {
    display: flex; align-items: center; padding: 4px 0; gap: 6px;
    font-size: 12px; border-bottom: 1px solid #fafafa;
}
.group-member-item img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.member-role-badge {
    font-size: 10px; padding: 1px 5px; border-radius: 6px;
    background: #f0f0f0; color: var(--text-light);
}
.member-role-badge.owner { background: #fff3cd; color: #856404; }
.member-role-badge.admin { background: #d4edda; color: #155724; }

/* ========== 私密聊天模式 ========== */
.secret-chat-mode .chat-messages {
    background: #fff0f5;
}
.secret-chat-mode .message-bubble {
    background: #fff !important;
    border: 1px solid #f0c0d0 !important;
    color: #333 !important;
}
.secret-chat-mode .message-row.mine .message-bubble {
    background: #ffe0ea !important;
    border-color: #f5b0c5 !important;
    color: #444 !important;
}
.secret-chat-mode .chat-header {
    background: linear-gradient(135deg, #f2a5b9, #e8879e);
    color: #fff;
    border-color: #d9728b;
}
.secret-chat-mode .chat-header .btn,
.secret-chat-mode .chat-header .btn-outline {
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}
.secret-chat-mode .chat-input-area {
    background: #fef0f4;
    border-color: #f0c0d0;
}
.secret-chat-mode .chat-input-box textarea {
    background: #fff;
    color: #333;
    border-color: #f0c0d0;
}
.secret-chat-mode .message-time {
    color: #b0808a;
}
.secret-chat-mode .message-sender {
    color: #c06078;
}

/* 私密消息锁定状态卡片 */
.secret-locked-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #fdf0f5, #fde8ef);
    border: 1px dashed rgba(220, 120, 150, 0.3);
    border-radius: 10px;
    max-width: 220px;
    min-width: 170px;
    text-align: center;
    transition: all 0.3s ease;
}
.secret-locked-body {
    display: flex;
    align-items: center;
    gap: 6px;
}
.secret-locked-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(220, 120, 150, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.secret-locked-label {
    font-size: 12px;
    color: #b07080;
    line-height: 1.4;
}
.secret-locked-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    background: linear-gradient(135deg, #e8879e, #d06080);
    color: #fff;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(220, 120, 150, 0.3);
}
.secret-locked-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(220, 120, 150, 0.45);
}
.secret-locked-action:active {
    transform: translateY(0);
}

/* 私密模式下的锁定卡片适配 */
.secret-chat-mode .secret-locked-bubble {
    background: linear-gradient(135deg, rgba(230, 140, 160, 0.1), rgba(210, 100, 130, 0.1));
    border-color: rgba(210, 110, 140, 0.22);
}
.secret-chat-mode .secret-locked-label {
    color: #a06878;
}

/* 私密模式确认弹窗 */
.secret-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(230, 120, 150, 0.12), rgba(200, 90, 120, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    border: 2px solid rgba(220, 130, 155, 0.2);
}
.secret-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: #fef4f7;
    border-radius: 8px;
    text-align: left;
}
.secret-feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}
.secret-feature-item .feature-icon {
    font-size: 15px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.watermark-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; z-index: 9998; opacity: 0.03;
    font-size: 14px; color: #000; overflow: hidden;
    user-select: none; -webkit-user-select: none;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* ========== 响应式 ========== */
.mobile-back-btn { display: none; }
.mobile-nav { display: none; }
.mobile-menu-btn { display: none; }
.mobile-dropdown { display: none; }
.mobile-tab-bar { display: none; }

/* ===== 平板 (≤1024px) ===== */
@media (max-width: 1024px) {
    .left-panel { width: 240px; min-width: 240px; }
    .contact-item { padding: 9px 10px; }
    .contact-item .avatar { width: 36px; height: 36px; }
    .contact-item .contact-name { font-size: 13px; }
    .chat-header { height: 50px; padding: 0 12px; }
    .chat-messages { padding: 12px; gap: 12px; }
    .message-row { max-width: 82%; }
    .modal-box { width: 90% !important; max-width: 480px; }
    .emoji-picker { width: 280px; }
    .search-bar input { font-size: 14px; }
}

/* ===== 手机端 (≤768px) - 单列模式 ===== */
@media (max-width: 768px) {
    html, body { height: 100%; overflow: hidden; -webkit-tap-highlight-color: transparent; }
    
    .main-container { height: 100%; }
    .main-body { position: relative; flex: 1; min-height: 0; }
    
    /* 左侧面板 - 全屏覆盖 */
    .left-panel {
        width: 100%; min-width: auto; position: absolute;
        top: 0; left: 0; right: 0; bottom: 0; z-index: 20;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: none; box-shadow: 2px 0 20px rgba(0,0,0,0.1);
    }
    .left-panel.hidden-mobile {
        transform: translateX(-105%);
    }
    .right-panel {
        width: 100%; min-width: auto;
    }

    /* 标题栏 - 移动端精简 */
    .title-bar { 
        padding: 0 10px; height: 48px; 
        background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    .title-bar .title-bar-left { gap: 6px; }
    .title-text { font-size: 15px; font-weight: 600; }
    /* 站点名：手机端点击即锁屏，加锁图标提示 + 按压反馈 */
    .title-text {
        cursor: pointer; touch-action: manipulation; border-radius: 4px;
        padding: 2px 4px; -webkit-user-select: none; user-select: none;
    }
    .title-text::after { content: ' 🔒'; font-size: 11px; opacity: 0.7; }
    .title-text:active { background: rgba(255, 255, 255, 0.18); }
    .title-logo { width: 24px; height: 24px; }
    .title-bar-right { gap: 6px; }
    .title-bar-right .btn { padding: 4px 8px; font-size: 10px; }
    .title-bar-right .user-info-bar { display: flex !important; gap: 4px; }
    .title-bar-right .btn-outline { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); color: #fff; }
    .title-bar-right .btn-outline:hover { background: rgba(255,255,255,0.25); }
    .title-bar-right .btn-danger { background: rgba(231,76,60,0.3); border: none; padding: 4px 6px !important; font-size: 10px !important; }
    .theme-toggle { display: flex !important; width: 26px; height: 26px; font-size: 14px; }
    .avatar-small { width: 24px; height: 24px; }
    .oicq-badge { display: none !important; }
    .user-info-bar span { font-size: 11px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
    
    /* 移动端深色模式标题栏 - 深紫色渐变 */
    [data-theme="dark"] .title-bar {
        background: linear-gradient(135deg, #3d3057, #2d1f4a);
    }
    /* 移动端深色模式标题栏按钮 - 保持半透明效果 */
    [data-theme="dark"] .title-bar-right .btn-outline {
        background: rgba(255,255,255,0.12);
        border-color: rgba(255,255,255,0.25);
        color: #ddd;
    }
    [data-theme="dark"] .title-bar-right .btn-outline:hover {
        background: rgba(255,255,255,0.22);
    }
    [data-theme="dark"] .title-bar-right .btn-danger {
        background: rgba(231,76,60,0.4);
        border: none;
        color: #fdd;
    }
    [data-theme="dark"] .theme-toggle {
        background: rgba(255,255,255,0.12);
    }
    
    /* 移动端菜单按钮 */
    .mobile-menu-btn {
        display: flex; align-items: center; justify-content: center;
        width: 32px; height: 32px; border: none; background: rgba(255,255,255,0.15);
        color: #fff; font-size: 18px; border-radius: 6px; cursor: pointer;
        margin-right: 2px;
    }
    .mobile-menu-btn:hover { background: rgba(255,255,255,0.25); }
    
    /* 移动端下拉菜单 */
    .mobile-dropdown {
        display: none; position: fixed; top: 48px; left: 0; right: 0;
        background: #fff; z-index: 100; border-radius: 0 0 12px 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.16); overflow: hidden;
        animation: dropdownSlide 0.2s ease;
    }
    .mobile-dropdown.active { display: block; }
    @keyframes dropdownSlide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
    .mobile-dropdown-item {
        padding: 14px 20px; border-bottom: 1px solid #f5f5f5;
        font-size: 14px; color: #333; cursor: pointer; transition: background 0.15s;
    }
    .mobile-dropdown-item:hover { background: #f5f7fa; }
    .mobile-dropdown-item:last-child { border-bottom: none; }
    .mobile-dropdown-item.danger { color: #e74c3c; }
    
    /* 左侧面板内的tab栏 - 移动端隐藏 */
    .left-panel .tab-bar { display: none !important; }
    /* 移动端确保tab-content正确显示 */
    .left-panel .tab-content.active { display: flex !important; flex-direction: column; }
    
    /* 移动端固定Tab栏 - 标题栏下方，放大醒目 */
    .mobile-tab-bar {
        display: flex !important; background: #fff;
        border-bottom: 2px solid #e8e8e8; z-index: 25;
    }
    .mobile-tab-item {
        flex: 1; text-align: center; padding: 14px 0;
        font-size: 16px; color: #666; cursor: pointer;
        border-bottom: 3px solid transparent; transition: all 0.2s;
        position: relative;
    }
    .mobile-tab-item.active { 
        color: #667eea; border-bottom-color: #667eea; 
        font-weight: 600; background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
    }
    .mobile-tab-item.has-unread-msg { background: rgba(7,193,96,.14); color: var(--primary); font-weight: 600; }
    .mobile-tab-badge {
        display: inline-block; position: relative; top: -10px;
        background: #e74c3c; color: #fff; font-size: 10px;
        padding: 1px 6px; border-radius: 10px; min-width: 18px;
        text-align: center; margin-left: 2px; line-height: 16px;
        font-weight: 600; animation: badgePopIn 0.3s ease;
    }
    .main-body { margin-top: 0; }
    .left-panel { top: 0 !important; }
    
    /* 隐藏底部导航 */
    .mobile-nav { display: none !important; }
    .main-body { padding-bottom: 0 !important; }
    
    /* 列表头部 */
    .list-header { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
    
    /* 联系人列表 */
    .contact-item { padding: 10px 12px; }
    .contact-item .avatar { width: 42px; height: 42px; border-radius: 6px; }
    .contact-item .contact-name { font-size: 15px; }
    .contact-item .contact-detail { font-size: 12px; margin-top: 2px; }
    
    /* 聊天区 */
    .chat-header { height: 50px; padding: 0 10px; }
    .chat-header-name { font-size: 15px; }
    .chat-avatar { width: 34px; height: 34px; }
    .chat-messages { padding: 12px 10px; gap: 12px; }
    .chat-input-box { padding: 6px 8px; }
    .chat-input-box textarea { font-size: 16px; padding: 8px 10px; border-radius: 8px; background: #f5f5f5; }
    .chat-input-footer { padding: 4px 10px 10px; }
    .char-count { font-size: 11px; }
    .chat-input-area { padding-bottom: env(safe-area-inset-bottom, 8px); }
    
    /* 消息气泡 */
    .message-row { max-width: 88%; }
    .message-bubble { font-size: 15px; padding: 10px 13px; border-radius: 10px; }
    .message-avatar { width: 32px; height: 32px; }
    .message-sender { font-size: 11px; }
    .message-time { font-size: 10px; }
    /* 移动端已发送/已读状态 - 放大字体 */
    .read-status { font-size: 11px !important; margin-left: 6px; }
    .read-status .check { font-size: 13px; }
    
    /* 工具按钮 - 放大触控区域 */
    .chat-input-toolbar { padding: 8px 10px; position: relative; }
    .toolbar-btn { font-size: 20px; padding: 6px 10px; min-width: 36px; min-height: 36px; }
    .chat-header-actions { flex-wrap: wrap; gap: 4px; }
    .chat-header-actions .btn { font-size: 10px; padding: 3px 6px; border-radius: 4px; white-space: nowrap; }
    
    /* 搜索 */
    .search-bar { padding: 8px 10px; }
    .search-bar input { padding: 10px 12px; border-radius: 8px; font-size: 15px; }
    .search-results { top: 42px; left: 8px; right: 8px; border-radius: 8px; }
    
    /* 弹窗 */
    .modal-box { width: 92% !important; max-width: none; border-radius: 12px; }
    .modal-body { padding: 16px; }
    .auth-box { width: 92%; padding: 25px 18px; border-radius: 12px; }
    .form-group input, .form-group textarea { font-size: 16px; padding: 10px 12px; border-radius: 8px; }
    
    /* 表情 - 移动端在工具栏上方弹出 */
    .chat-input-toolbar > div {
        position: static !important; /* 解除内层div的限制，让emoji-picker相对toolbar定位 */
    }
    .emoji-picker { 
        width: auto; left: 0 !important; right: 0 !important;
        bottom: 100% !important; position: absolute !important;
        border-radius: 12px 12px 0 0; padding: 8px 6px 4px;
        max-height: 45vh; margin: 0 0 4px 0 !important; z-index: 200;
        overflow-y: auto; /* 移动端外层滚动（内层面板不限高） */
    }
    .emoji-tabs { margin-bottom: 4px; font-size: 12px; display: flex; }
    .emoji-tab { padding: 6px 4px; font-size: 12px; flex: 1; }
    .emoji-panel { max-height: none; }
    .emoji-item { font-size: 24px; width: 30px; height: 30px; line-height: 30px; padding: 3px; }
    
    /* 表单全局 */
    input, textarea, select { font-size: 16px !important; }
    .btn { padding: 10px 20px; font-size: 15px; border-radius: 8px; }
    .btn-xs { padding: 5px 10px; font-size: 12px !important; border-radius: 4px; }
    
    /* 群信息 */
    .group-member-item { padding: 8px 10px; }
    .group-member-item img { width: 34px; height: 34px; border-radius: 6px; }
}

/* ===== 小屏 (≤480px) ===== */
@media (max-width: 480px) {
    .contact-item { padding: 8px 10px; }
    .contact-item .avatar { width: 38px; height: 38px; }
    .contact-item .contact-name { font-size: 14px; }
    .message-row { max-width: 92%; }
    .message-bubble { font-size: 14px; padding: 8px 11px; }
    .message-avatar { width: 28px; height: 28px; }
    .chat-header-name { font-size: 14px; }
    .chat-avatar { width: 30px; height: 30px; }
    .tab-item { font-size: 11px; padding: 8px 0; }
    .tab-icon { font-size: 15px; }
    .emoji-picker { max-height: 60vh; padding: 6px 4px 3px; }
    .emoji-item { font-size: 20px; width: 24px; height: 24px; line-height: 24px; padding: 2px; }
    .emoji-tab { font-size: 10px; padding: 5px 2px; }
    .chat-header-actions .btn { font-size: 10px; padding: 3px 5px; }
}

/* ============================================
   深色模式
   ============================================ */
[data-theme="dark"] {
    --bg: #1a1a2e;
    --bg-white: #1e1e32;
    --border: #2a2a45;
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-light: #777777;
}
[data-theme="dark"] body { background: #0f0f1a; color: var(--text); }
[data-theme="dark"] .main-container { background: #0f0f1a; }
[data-theme="dark"] .left-panel { background: #12122a; border-right-color: #1e1e3a; }
[data-theme="dark"] .right-panel { background: #16162e; }
[data-theme="dark"] .chat-header { background: #1a1a30; border-bottom-color: #2a2a45; }
[data-theme="dark"] .chat-input-area { background: #1a1a30; border-top-color: #2a2a45; }
[data-theme="dark"] .chat-input-toolbar { border-bottom-color: #1e1e36; }
[data-theme="dark"] .chat-input-box textarea { background: #1a1a30; color: #e0e0e0; }
[data-theme="dark"] .toolbar-btn:hover { background: #2a2a45; }
[data-theme="dark"] .contact-item { border-bottom-color: #1e1e36; }
[data-theme="dark"] .contact-item:hover { background: #1e1e38; }
[data-theme="dark"] .contact-item.active { background: #252545; }
[data-theme="dark"] .contact-item.has-unread { background: rgba(255,77,79,0.08); }
[data-theme="dark"] .search-bar input { background: #1e1e32; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .search-results { background: #1e1e32; }
[data-theme="dark"] .search-result-item { border-bottom-color: #1e1e36; }
[data-theme="dark"] .search-result-item:hover { background: #252545; }
[data-theme="dark"] .tab-bar { border-bottom-color: #1e1e3a; }
[data-theme="dark"] .tab-item:hover { color: #4ade80; background: rgba(7,193,96,0.12); }
[data-theme="dark"] .tab-item.active { color: #4ade80; background: linear-gradient(180deg, rgba(7,193,96,0.08) 0%, rgba(7,193,96,0.2) 100%); }
[data-theme="dark"] .tab-item.has-unread-msg { background: rgba(7,193,96,.18); color: #4ade80; }
[data-theme="dark"] .tab-msg-count { background: #4ade80; color: #06281a; }
[data-theme="dark"] .tab-item::after { background: #4ade80; }
[data-theme="dark"] .mobile-tab-bar { background: #15152a; border-bottom-color: #1e1e3a; }
[data-theme="dark"] .mobile-tab-item { color: #888; }
[data-theme="dark"] .mobile-tab-item.active { color: #8599ff; border-bottom-color: #667eea; background: linear-gradient(180deg, #1a1a35 0%, #15152a 100%); }
[data-theme="dark"] .mobile-tab-item.has-unread-msg { background: rgba(7,193,96,.2); color: #4ade80; }
[data-theme="dark"] .list-header { background: #15152a; border-bottom-color: #1e1e3a; }
[data-theme="dark"] .message-row:not(.mine) .message-bubble { background: #1e1e36; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .message-row.mine .message-bubble { background: #0d3320; border-color: #1a4a30; color: #c0e8d0; }
[data-theme="dark"] .message-row.system .message-bubble { color: #556; }
[data-theme="dark"] .message-row.mentioned .message-bubble { background: linear-gradient(135deg, #3d2e0a, #332a08) !important; border-color: #8a6d14 !important; }
[data-theme="dark"] .message-row.mentioned .message-sender { color: #e8b730; }
[data-theme="dark"] .message-time { color: #556; }
[data-theme="dark"] .read-status.sent { color: #889; }
[data-theme="dark"] .read-status.read { color: #5baeff; }
[data-theme="dark"] .message-sender { color: #778; }
[data-theme="dark"] .emoji-picker { background: #1e1e32; border-color: #2a2a45; }
[data-theme="dark"] .emoji-item:hover { background: #2a2a45; }
[data-theme="dark"] .mention-dropdown { background: #1e1e32; border-color: #2a2a45; }
[data-theme="dark"] .mention-item:hover, [data-theme="dark"] .mention-item.active { background: #252545; }
[data-theme="dark"] .mention-name { color: #e0e0e0; }
[data-theme="dark"] .mention-oicq { color: #777; }
[data-theme="dark"] .btn-outline { border-color: #2a2a45; color: #e0e0e0; background: #1e1e32; }
[data-theme="dark"] .btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #1a2e1a; }
/* 桌面端深色模式标题栏 */
@media (min-width: 769px) {
    [data-theme="dark"] .title-bar { background: linear-gradient(180deg, #1a3a5c 0%, #152d4a 100%); }
}
[data-theme="dark"] .modal-box { background: #1e1e32; }
[data-theme="dark"] .modal-header { border-bottom-color: #2a2a45; }
[data-theme="dark"] .modal-body label { color: #a0a0a0; }
[data-theme="dark"] .modal-body input, [data-theme="dark"] .modal-body select, [data-theme="dark"] .modal-body textarea { background: #16162e; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .image-preview-thumb { border-color: #2a2a45; }
[data-theme="dark"] .auth-container { background: linear-gradient(135deg, #1a1a3e, #2a1a4e); }
[data-theme="dark"] .auth-box { background: #1e1e32; }
[data-theme="dark"] .stat-card { background: #1a1a30; }
[data-theme="dark"] table { background: #1a1a30; }
[data-theme="dark"] th { background: #15152a; color: #a0a0a0; }
[data-theme="dark"] td { border-bottom-color: #1e1e36; color: #e0e0e0; }
[data-theme="dark"] tr:hover { background: #1e1e38; }
[data-theme="dark"] .toast { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .presence-toast.online { box-shadow: 0 8px 24px rgba(34,197,94,.55); }
[data-theme="dark"] .presence-toast.offline { box-shadow: 0 8px 24px rgba(245,158,11,.55); }
[data-theme="dark"] .char-count { color: #555; }
[data-theme="dark"] .contact-item .contact-status.offline { background: #444; }
[data-theme="dark"] .messages-loading { color: #555; }
[data-theme="dark"] .image-lightbox { background: rgba(0,0,0,0.92); }
[data-theme="dark"] .form-group input, [data-theme="dark"] .form-group textarea { background: #16162e; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .image-preview-close { background: rgba(255,255,255,0.25); }

/* 深色模式开关按钮 */
.theme-toggle {
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    cursor: pointer; font-size: 18px; width: 32px; height: 32px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,0.25); transform: rotate(20deg); }

/* 消息右键菜单 */
.context-menu {
    position: fixed; z-index: 9999;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 120px; padding: 4px 0; display: none;
}
.context-menu .menu-item {
    padding: 8px 16px; cursor: pointer; font-size: 13px; color: var(--text);
    transition: background 0.1s; white-space: nowrap;
}
.context-menu .menu-item:hover { background: var(--primary-light); color: var(--primary); }
[data-theme="dark"] .context-menu { background: #1e1e32; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
[data-theme="dark"] .context-menu .menu-item:hover { background: #252545; }

/* ==================== 视频通话（浮动小窗，可拖拽/放大） ==================== */
.video-call-overlay {
    position: fixed; right: 20px; bottom: 20px;
    width: 300px; height: 400px;
    z-index: 99990;
    background: #1a1a2e;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
}
.video-call-overlay.expanded { right: 0; bottom: 0; top: 0; left: 0; width: auto; height: auto; border-radius: 0; border: none; }
.video-call-header {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; cursor: move;
    background: rgba(0,0,0,0.35); user-select: none;
}
.video-call-header .video-call-title {
    flex: 1; margin: 0; text-align: left; font-size: 13px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-win-btn {
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1;
}
.video-win-btn:hover { background: rgba(255,255,255,0.3); }
.video-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #000; }
.video-remote { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-local-wrap { position: absolute; right: 8px; bottom: 8px; width: 88px; height: 118px; border-radius: 8px; overflow: hidden; border: 2px solid rgba(255,255,255,0.6); box-shadow: 0 4px 16px rgba(0,0,0,0.5); background: #222; }
.video-local { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.video-call-bar { padding: 8px; text-align: center; background: rgba(0,0,0,0.35); }
.video-call-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.vc-btn { border: none; border-radius: 24px; padding: 10px 22px; font-size: 14px; cursor: pointer; color: #fff; }
.vc-accept { background: #27ae60; }
.vc-cancel { background: #e74c3c; }
.vc-hangup { background: #e74c3c; }
.vc-toggle { background: #3498db; }

/* ========== 消息悬浮操作条 ========== */
.message-row { position: relative; }
.msg-actions {
    position: absolute; top: 50%; transform: translateY(-50%);
    display: none; gap: 2px; padding: 2px; z-index: 6;
    white-space: nowrap;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.14);
}
.message-row:hover .msg-actions { display: flex; }
/* 我的消息：条在行左侧空区；对方消息：行右侧空区，均不遮挡气泡 */
.message-row.mine .msg-actions { right: calc(100% + 8px); }
.message-row:not(.mine) .msg-actions { left: calc(100% + 8px); }
/* 透明桥接：补齐悬浮条与消息行之间的 8px 空隙。
   否则鼠标移向悬浮条时先离开消息行，:hover 断开、悬浮条消失，导致看得见点不中 */
.msg-actions::before {
    content: ''; position: absolute; top: -6px; bottom: -6px; width: 9px;
}
.message-row.mine .msg-actions::before { left: 100%; }
.message-row:not(.mine) .msg-actions::before { right: 100%; }
.msg-actions .act {
    width: 28px; height: 28px; border: none; background: transparent;
    border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center; color: var(--text);
}
.msg-actions .act:hover { background: var(--primary-light); }
[data-theme="dark"] .msg-actions { background: #1e1e32; }
/* 触屏/小屏隐藏悬浮条：长按上下文菜单已覆盖同等功能 */
@media (max-width: 768px) {
    .msg-actions { display: none !important; }
}

/* ========== 表情回应 ========== */
.reaction-palette {
    position: fixed; z-index: 10000; display: none; gap: 2px; padding: 6px 8px;
    background: var(--bg-white); border: 1px solid var(--border); border-radius: 22px;
    box-shadow: 0 4px 18px rgba(0,0,0,.2);
}
.reaction-palette .react {
    border: none; background: transparent; font-size: 19px; cursor: pointer;
    padding: 2px 5px; border-radius: 10px; line-height: 1;
}
.reaction-palette .react:hover { background: var(--primary-light); }
[data-theme="dark"] .reaction-palette { background: #1e1e32; }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; padding: 0 4px; }
.message-row.mine .msg-reactions { justify-content: flex-end; }
.reaction-chip {
    display: inline-flex; align-items: center; gap: 3px; font-size: 16px;
    background: var(--primary-light); border: 1px solid var(--border);
    border-radius: 13px; padding: 2px 9px; cursor: pointer; color: var(--text);
    user-select: none;
}
.reaction-chip:hover { border-color: var(--primary); }
[data-theme="dark"] .reaction-chip { background: #252545; }

/* ========== 转发选择弹窗 ========== */
.forward-modal-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10001;
    display: flex; align-items: center; justify-content: center;
}
.forward-modal {
    width: 320px; max-height: 70vh; background: var(--bg-white);
    border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.forward-modal-head {
    padding: 14px 16px; font-weight: 600; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.forward-modal-close {
    border: none; background: none; cursor: pointer;
    font-size: 15px; line-height: 1; color: var(--text-light);
    padding: 4px 6px; border-radius: 6px; transition: all 0.15s;
}
.forward-modal-close:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }
.forward-modal-list { overflow-y: auto; padding: 6px; }
.forward-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 8px; cursor: pointer;
}
.forward-item:hover { background: var(--primary-light); }
.forward-item img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.forward-item .fi-name { font-size: 14px; }
.forward-item .fi-sub { font-size: 11px; color: var(--text-light); }
.forward-modal-empty { padding: 24px; text-align: center; color: var(--text-light); }

/* ==================== 编辑栏 / 多选 / 收藏夹 ==================== */
.edit-bar {
    margin: 0 12px 8px; padding: 8px 12px;
    background: rgba(255,159,67,0.12); border-left: 3px solid #e67e22;
    border-radius: 4px; display: flex; align-items: center; gap: 8px; font-size: 12px;
}
.edit-bar-label { color: #e67e22; font-weight: 500; white-space: nowrap; }
.edit-bar-text { color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.edit-bar-hint { color: var(--text-light); opacity: 0.7; white-space: nowrap; }
.edited-tag { color: #999; font-size: 10px; margin-left: 4px; opacity: 0.8; }
[data-theme="dark"] .edited-tag { color: #888; }
.multi-bar {
    margin: 0 12px 8px; padding: 8px 12px;
    background: #f0f2f5; border-left: 3px solid var(--primary);
    border-radius: 4px; display: flex; align-items: center; gap: 10px; font-size: 13px;
}
[data-theme="dark"] .multi-bar { background: #1e1e36; }
.multi-bar button {
    border: 1px solid rgba(128,128,128,0.35); background: transparent; color: inherit;
    border-radius: 6px; padding: 4px 12px; cursor: pointer; font-size: 12px;
}
.multi-bar button:disabled { opacity: 0.4; cursor: default; }
.multi-bar button:hover:not(:disabled) { background: rgba(128,128,128,0.15); }
#multi-count { font-weight: 500; }
#chat-messages.multi-select .msg-check { display: flex; }
#chat-messages.multi-select .msg-actions { display: none; }
#chat-messages.multi-select .message-row { cursor: pointer; }
.msg-check {
    display: none; width: 20px; height: 20px; flex-shrink: 0; align-self: center;
    border: 2px solid #aaa; border-radius: 50%; margin-right: 8px;
    align-items: center; justify-content: center; font-size: 12px; color: #fff; cursor: pointer;
}
.message-row.selected .msg-check { background: #27ae60; border-color: #27ae60; }
.message-row.selected .msg-check::after { content: '✓'; }
.fav-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(128,128,128,0.15); align-items: flex-start; }
.fav-item img.fav-img { max-width: 120px; max-height: 120px; border-radius: 8px; cursor: pointer; }
.fav-item-body { flex: 1; min-width: 0; }
.fav-item-text { font-size: 13px; word-break: break-word; white-space: pre-wrap; }
.fav-item-meta { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.fav-item-acts { display: flex; gap: 8px; margin-top: 6px; }
.fav-item-acts button { border: 1px solid rgba(128,128,128,0.35); background: transparent; color: inherit; border-radius: 6px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.fav-item-acts button:hover { background: rgba(128,128,128,0.12); }

/* 引用栏（输入区上方） */
.quote-bar {
    margin: 0 12px 8px; padding: 8px 12px;
    background: #f0f2f5; border-left: 3px solid var(--primary);
    border-radius: 4px; display: flex; align-items: center; gap: 8px;
    font-size: 12px;
}
[data-theme="dark"] .quote-bar { background: #1e1e36; }
.quote-bar-content { flex: 1; min-width: 0; overflow: hidden; }
.quote-bar-sender { color: var(--primary); font-weight: 500; }
.quote-bar-text { color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote-bar-close {
    background: none; border: none; color: var(--text-light);
    cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px;
}

/* 消息中的引用气泡 */
.message-quote-bubble {
    margin-bottom: 6px; padding: 6px 10px;
    background: rgba(0,0,0,0.04); border-left: 3px solid var(--primary);
    border-radius: 4px; font-size: 12px; cursor: pointer;
}
[data-theme="dark"] .message-quote-bubble { background: rgba(255,255,255,0.05); }
.message-quote-bubble .quote-sender { color: var(--primary); font-weight: 500; margin-bottom: 2px; }
.message-quote-bubble .quote-text { color: var(--text-light); }

/* 聊天置顶 */
.pin-btn {
    display: none; background: none; border: none; cursor: pointer;
    font-size: 14px; color: var(--text-light); padding: 2px 4px;
    border-radius: 3px; transition: all 0.15s; line-height: 1;
}
.contact-item:hover .pin-btn { display: inline-block; }
.pin-btn:hover { background: var(--primary-light); color: var(--primary); }
.pin-btn.pinned { display: inline-block; color: var(--primary); }
.pinned-separator {
    padding: 4px 12px; font-size: 11px; color: var(--primary);
    background: var(--primary-light); font-weight: 500;
}

/* ========== 个人资料弹窗（紧凑型 · 行内标签） ========== */
#profile-modal .modal-header { padding: 8px 15px; }
#profile-modal .modal-box { width: 380px; }
.profile-body { padding: 10px 12px 10px; max-height: 90vh; overflow-y: auto; }
.profile-head {
    display: flex; align-items: center; gap: 10px;
    padding: 1px 1px 7px; margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.profile-avatar {
    width: 44px; height: 44px; border-radius: 10px; object-fit: cover;
    cursor: pointer; border: 2px solid #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,.12); transition: transform .15s;
}
.profile-avatar:hover { transform: scale(1.04); }
.profile-head-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.profile-head-name { font-size: 15px; font-weight: 600; color: var(--text); }
.profile-head-oicq {
    align-self: flex-start; font-size: 11px; color: #fff; font-weight: 500;
    background: var(--primary); padding: 1px 8px; border-radius: 10px;
}
.profile-section {
    background: #fafbfc; border: 1px solid #eef0f2; border-radius: 10px;
    padding: 8px 10px 3px; margin-bottom: 8px;
}
.profile-section-title {
    font-size: 12.5px; font-weight: 600; color: #333; margin-bottom: 6px;
    display: flex; align-items: center; gap: 5px;
}
.profile-hint { font-size: 10.5px; font-weight: 400; color: #aaa; }
/* 行内标签：标签在左、控件在右，每行仅一行高 */
.profile-field {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px; min-width: 0;
}
.profile-field > label {
    flex: 0 0 66px; width: 66px; margin: 0;
    font-size: 11.5px; color: #888; font-weight: 500;
    text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-field input, .profile-field select {
    flex: 1; width: 100%; min-width: 0;
    padding: 5px 8px; border: 1px solid #e3e6ea; border-radius: 8px;
    font-size: 12.5px; background: #fff; color: #333;
    transition: border-color .15s, box-shadow .15s; box-sizing: border-box;
}
.profile-field input:focus, .profile-field select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(7,193,96,.12); outline: none;
}
.profile-field input[readonly] { background: #f5f5f5; color: #999; cursor: default; }
.profile-field-row { display: flex; gap: 8px; }
.profile-field-row > .profile-field { flex: 1; min-width: 0; }
.profile-field-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.profile-field-switch > label {
    flex: 1; width: auto; margin: 0; text-align: left; white-space: normal;
}
.profile-field-switch input { width: 16px; height: 16px; flex: 0 0 auto; }
.profile-save { margin-top: 2px; padding: 8px 0; font-size: 13px; }
[data-theme="dark"] .profile-section { background: #1a1a30; border-color: #2a2a45; }
[data-theme="dark"] .profile-section-title { color: #e0e0e0; }
[data-theme="dark"] .profile-head-name { color: #e0e0e0; }
[data-theme="dark"] .profile-field input, [data-theme="dark"] .profile-field select {
    background: #16162e; border-color: #2a2a45; color: #e0e0e0;
}
[data-theme="dark"] .profile-field input[readonly] { background: #12122a; color: #777; }
[data-theme="dark"] .profile-field input:focus, [data-theme="dark"] .profile-field select:focus {
    border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}
[data-theme="dark"] .pinned-separator { background: rgba(7,193,96,0.1); }

/* ============================================
   文件传输
   ============================================ */
.file-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: rgba(0,0,0,0.04); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; transition: all 0.15s;
    min-width: 200px; max-width: 280px;
}
.file-card:hover { background: rgba(7,193,96,0.06); border-color: var(--primary); }
[data-theme="dark"] .file-card { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .file-card:hover { background: rgba(7,193,96,0.1); }
.file-card-icon { font-size: 32px; flex-shrink: 0; }
.file-card-info { flex: 1; min-width: 0; }
.file-card-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card-meta { font-size: 11px; color: var(--text-light); }
.file-card-hint { font-size: 10px; color: var(--primary); margin-top: 2px; }

/* 文件预览栏 */
.file-preview-bar {
    margin: 0 12px; padding: 6px 10px; display: flex;
    align-items: center; gap: 8px; background: #f8f9fa;
    border-radius: 6px; border: 1px solid var(--border);
}
[data-theme="dark"] .file-preview-bar { background: #1e1e36; }
.file-preview-icon { font-size: 24px; }
.file-preview-info { flex: 1; min-width: 0; font-size: 12px; }
.file-preview-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview-size { color: var(--text-light); }

/* ============================================
   已读回执
   ============================================ */
.message-row.mine .read-status {
    font-size: 10px; margin-left: 4px;
}
.read-status.sent { color: var(--text-light); }
.read-status.read { color: var(--info); font-weight: 500; }
.read-status .check { font-size: 12px; }

/* ============================================
   聊天背景
   ============================================ */
.chat-bg-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover; background-position: center;
    opacity: 0.12; pointer-events: none; z-index: 0;
}
[data-theme="dark"] .chat-bg-overlay { opacity: 0.06; }
.chat-area { position: relative; }
.chat-area > *:not(.chat-bg-overlay) { position: relative; z-index: 1; }

/* 背景选择器 */
.bg-picker-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-bottom: 15px;
}
.bg-picker-item {
    width: 100%; aspect-ratio: 16/10; border-radius: 8px;
    cursor: pointer; border: 2px solid transparent;
    transition: all 0.2s; position: relative; overflow: hidden;
}
.bg-picker-item:hover { border-color: var(--primary); transform: scale(1.03); }
.bg-picker-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(7,193,96,0.2); }
.bg-picker-item.active::after {
    content: '✓'; position: absolute; top: 4px; right: 6px;
    color: #fff; font-size: 14px; font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.bg-reset-btn {
    width: 100%; aspect-ratio: 16/10; border-radius: 8px;
    cursor: pointer; border: 2px dashed var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--text-light); transition: all 0.2s;
}
.bg-reset-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ============================================
   表情包 Tab
   ============================================ */
.emoji-tabs {
    display: flex; border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.emoji-tab {
    flex: 1; text-align: center; padding: 6px 0; cursor: pointer;
    font-size: 12px; color: var(--text-light); border-bottom: 2px solid transparent;
    transition: all 0.15s; white-space: nowrap;
}
.emoji-tab:hover { color: var(--text); }
.emoji-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.emoji-panel { max-height: 200px; overflow-y: auto; }
.emoji-panel .emoji-item { display: inline-flex; align-items: center; justify-content: center; position: relative; }
[data-theme="dark"] .emoji-tabs { border-bottom-color: #2a2a45; }
[data-theme="dark"] .emoji-tab { color: #888; }
[data-theme="dark"] .emoji-tab:hover { color: #ccc; }
[data-theme="dark"] .emoji-tab.active { color: var(--primary); }
.emoji-fav-star {
    position: absolute; top: 1px; right: 2px;
    font-size: 8px; opacity: 0; transition: opacity 0.15s;
}
.emoji-item:hover .emoji-fav-star { opacity: 1; }

/* ============================================
   闲置锁屏
   ============================================ */
#idle-lock-screen.active { display: flex !important; }
.idle-timeout-select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; width: 100%; background: var(--bg-white); color: var(--text);
}

/* ============================================
   群公告
   ============================================ */
.group-notice-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; margin: 0 0 2px 0;
    background: linear-gradient(135deg, #fff5f5, #fff0f0);
    border-bottom: 2px solid #e74c3c;
    font-size: 13px; color: #c0392b;
    animation: noticeSlideIn 0.3s ease;
}
@keyframes noticeSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.group-notice-icon { font-size: 16px; flex-shrink: 0; }
.group-notice-text { flex: 1; line-height: 1.5; }
.group-notice-close {
    background: none; border: none; font-size: 16px;
    cursor: pointer; color: #c0392b; opacity: 0.6;
    padding: 0 4px; flex-shrink: 0;
}
.group-notice-close:hover { opacity: 1; }
[data-theme="dark"] .group-notice-bar {
    background: linear-gradient(135deg, #2a1515, #201010);
    border-bottom-color: #c0392b;
    color: #e74c3c;
}
[data-theme="dark"] .group-notice-close { color: #e74c3c; }
