/* 文件名: style.css (最终完整版：时间与内容间距修复，回复框无蓝色竖线，正文左对齐 + 自绘标题栏) */
:root {
  --accent: #4a9cfe;
  --bg: #f0f2f5;
  --sb: #f5f6fa;
  --bubble: #fff;
  --text: #333;
  --text2: #666;
  --mention-highlight: #ff4d4f;
  --mention-border: #ff4d4f;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, sans-serif; }
body{display:flex;justify-content:center;align-items:center;height:100vh;height:100dvh;background:#1a1a2e;overflow:hidden}
#app{width:100%;max-width:1200px;height:94vh;height:94dvh;background:#f0f2f5;border-radius:16px;display:flex;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,.5);color:var(--text)}
#authPanel{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:#f8f9fa}
#authPanel>div{background:#fff;padding:36px;border-radius:16px;width:360px;text-align:center;box-shadow:0 10px 40px rgba(0,0,0,.1)}
#authPanel input{width:100%;padding:12px;margin-bottom:10px;border:2px solid #e0e0e0;border-radius:10px;font-size:15px}
.btn{width:100%;padding:12px;border:none;border-radius:10px;font-size:15px;cursor:pointer;font-weight:600;margin-bottom:6px}
.btn-login{background:var(--accent);color:#fff}
.btn-test{background:#f0f0f0;color:#333;font-size:13px!important;padding:8px!important}
#authPanel .toggle{color:var(--accent);cursor:pointer;margin-top:8px;font-size:13px}
#authPanel .err{color:#e74c3c;font-size:13px;margin-bottom:8px}
#mainPanel{display:flex;width:100%;height:100%}
#sidebar{width:320px;min-width:320px;background:var(--sb);border-right:1px solid rgba(0,0,0,.08);display:flex;flex-direction:column}
#sidebar .head{padding:14px;background:#fff;display:flex;align-items:center;gap:10px;cursor:pointer}
#sidebar .av{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;background:var(--accent)}
.srch{padding:8px 10px;position:relative}
.srch input{width:100%;padding:8px 12px;border:none;border-radius:16px;background:#fff;outline:none;font-size:15px;color:var(--text)}
#srchWrap{position:relative}
.search-results{position:absolute;top:45px;left:10px;right:10px;background:#fff;border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,.2);z-index:50;max-height:300px;overflow-y:auto;display:none}
.search-results .r-item{padding:10px 16px;cursor:pointer;display:flex;align-items:center;gap:10px;font-size:14px}
.search-results .r-item:hover{background:#f5f5f5}
.chat-tabs{display:flex;gap:8px;padding:8px 16px 4px;border-bottom:1px solid rgba(0,0,0,.04);margin-bottom:2px}
.tab{flex:1;text-align:center;padding:8px 0;border-radius:20px;font-size:14px;font-weight:600;color:var(--text2);cursor:pointer;transition:all 0.2s}
.tab:hover{background:rgba(0,0,0,.04)}
.tab.active{background:var(--accent);color:#fff}

#contacts { flex: 1; overflow-y: auto; padding: 0; background: var(--sb); }
.c-item { display: flex; align-items: center; padding: 12px 16px; height: 70px; min-height: 70px; cursor: pointer; transition: background 0.15s ease; gap: 12px; text-decoration: none; position: relative; }
.c-item:hover { background: rgba(0, 0, 0, 0.04); }
.c-item.active { background: var(--accent); }
.c-item.active .name, .c-item.active .last-msg, .c-item.active .meta .time, .c-item.active .unread-badge, .c-item.active .mention-badge { color: #ffffff !important; }

.c-item .avatar-box { width: 52px; height: 52px; min-width: 52px; min-height: 52px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; background: #7c8b9c; color: #fff; position: relative; overflow: visible !important; }
.c-item .avatar-box .av-content { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; line-height: 1; }
.c-item .avatar-box img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; overflow: hidden; }
.c-item .avatar-box .status-dot { position: absolute; bottom: 0; right: 0; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #fff; background: #ccc; z-index: 12; transition: all 0.1s ease; }
.c-item.active .avatar-box .status-dot { border-color: var(--accent); }
.c-item .avatar-box .status-dot.online { background: #31c48d; display: block; }
.c-item .avatar-box .status-dot.offline { display: none !important; }

.c-item .info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; overflow: hidden; }
.c-item .info .row-top { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.c-item .info .name { font-size: 15px; font-weight: 500; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.c-item .info .last-msg { font-size: 13px; color: #8e9398; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; line-height: 1.2; }

.c-item .meta { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-start; flex-shrink: 0; margin-left: 8px; position: relative; min-height: 24px; z-index: 20; }
.c-item .meta .time { font-size: 10px; color: #8e9398; white-space: nowrap; line-height: 1.2; margin-bottom: 2px; }
.c-item .meta .unread-badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 0 6px; height: 18px; line-height: 18px; border-radius: 9px; text-align: center; min-width: 18px; display: none !important; box-shadow: 0 1px 3px rgba(0,0,0,0.15); position: relative !important; top: auto !important; right: auto !important; margin-top: 2px !important; }
.c-item .meta .unread-badge.show { display: inline-block !important; }
.c-item.active .meta .unread-badge.show { display: none !important; }

.c-item .meta .mention-badge { background: #ff3b30; color: #fff; font-size: 11px; font-weight: 600; padding: 0 6px; height: 18px; line-height: 18px; border-radius: 9px; text-align: center; min-width: 18px; display: none !important; box-shadow: 0 1px 4px rgba(255, 59, 48, 0.4); position: relative !important; top: auto !important; right: auto !important; margin-top: 2px !important; }
.c-item .meta .mention-badge.show { display: inline-block !important; }
.c-item.active .meta .mention-badge.show { display: none !important; }

.c-item[data-id="official_system"] .name {
    color: #e67e22;
    font-weight: bold;
}

#chatArea{flex:1;display:flex;flex-direction:column;background:#f0f2f5;position:relative;overflow:hidden;min-height:0;}

#chatArea {
    background-image: linear-gradient(135deg, #40cdde 0%, #ac86ed 25%, #e984d8 50%, #efd359 100%);
    background-size: cover;
    background-position: center;
    background-repeat: repeat;
}

#chatHeader { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 8px 16px; 
    background: #fff; 
    border-bottom: 1px solid rgba(0,0,0,.06); 
    min-height: 60px; 
    flex-shrink: 0; 
    z-index: 10; 
}
.chat-header-wrap { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    cursor: pointer; 
    flex: 1; 
    overflow: hidden; 
}
.chat-header-actions { 
    flex-shrink: 0; 
    margin-left: 8px; 
    display: flex; 
    align-items: center; 
}
.header-menu-btn { 
    font-size: 20px; 
    padding: 4px 8px; 
    color: #666; 
    border-radius: 4px; 
    cursor: pointer; 
    background: transparent; 
    border: none; 
    transition: background 0.1s; 
}
.header-menu-btn:hover { 
    background: #f0f0f0; 
    color: #333; 
}

.chat-header-avatar-box { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #7c8b9c; color: #fff; font-weight: bold; font-size: 16px; flex-shrink: 0; }
.chat-header-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-header-info { display: flex; flex-direction: column; justify-content: center; overflow: hidden; flex: 1; }

.chat-header-name { font-size: 18px; font-weight: 700; color: #ff3b30; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-status { font-size: 13px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#msgs {
    flex: 1;
    padding: 16px 28px 16px 28px;
    padding-top: 75px;
    overflow-y: auto !important;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-anchor: auto;
    contain: none;
    overscroll-behavior: contain;
    min-height: 200px;
    scrollbar-gutter: stable;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0,0,0,0.25) transparent;
}

#msgs::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
#msgs::-webkit-scrollbar-track { background: transparent; }
#msgs::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; transition: background 0.2s; }
#msgs:hover::-webkit-scrollbar-thumb,
#msgs::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.45); }

@media (max-width: 768px) {
    #msgs::-webkit-scrollbar { display: none; }
    #msgs { scrollbar-width: none; }
}

#jumpToNew { position: absolute; bottom: 135px; right: 20px; }

.icon-btn{background:none;border:none;font-size:22px;cursor:pointer;padding:6px;border-radius:50%;color:#707579}
.btn-sm{padding:7px 14px;border:none;border-radius:8px;cursor:pointer;font-size:12px}
.btn-primary{background:var(--accent);color:#fff}
.btn-outline{background:#fff;color:var(--accent);border:1px solid var(--accent)}
.btn-danger{background:#ffebee;color:#e74c3c}
.w-full{width:100%}
.hidden{display:none!important}
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.4);display:flex;align-items:center;justify-content:center;z-index:10002 !important;}
.modal{background:#fff;border-radius:16px;width:360px;max-height:80vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.2);padding:0 0 12px}
.modal-header{padding:16px 20px 0;display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;z-index:10;background:#fff;border-radius:16px 16px 0 0}
.modal-header h3{font-size:16px;font-weight:500;margin:0}
.modal-close{background:none;border:none;font-size:22px;cursor:pointer;color:#999;padding:2px 6px;border-radius:50%}
.modal-close:hover{background:#f0f0f0}
.profile-top{text-align:center;padding:16px 20px 12px}
.profile-avatar-wrap{position:relative;display:inline-block;cursor:pointer; width: 100px; height: 100px; margin: 0 auto;}
.profile-avatar-wrap img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.profile-avatar-wrap .avatar-placeholder { width: 100%; height: 100%; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; background: var(--accent); color: #fff; }
.avatar-edit-badge{position:absolute;bottom:-2px;right:-2px;background:var(--accent);color:#fff;width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;border:2px solid #fff}
.profile-name{font-size:17px;font-weight:500;margin-top:8px}
.profile-username{font-size:12px;color:#999}
.profile-bio{margin-top:4px;font-size:12px;color:#888;max-width:250px;margin:4px auto 0;word-break:break-all}
.profile-section{padding:0 20px 8px}
.profile-section h4{font-size:11px;color:#aaa;margin-bottom:4px;text-transform:uppercase}
.profile-row{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;background:#f8f9fa;border-radius:8px;margin-bottom:2px;font-size:13px;}

.context-menu { position: fixed; background: #fff; border-radius: 10px; padding: 4px 0; width: fit-content !important; min-width: 0 !important; max-width: calc(100vw - 20px) !important; box-shadow: 0 4px 16px rgba(0,0,0,0.12); border: 1px solid rgba(0,0,0,0.04); overflow: hidden; font-size: 14px !important; z-index: 9999; }
.context-menu div.menu-item { display: flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; color: #222; font-size: 14px !important; transition: background 0.1s; line-height: 1.3; text-align: left; white-space: nowrap; }
.context-menu .menu-icon { width: 15px; text-align: center; flex-shrink: 0; font-size: 15px; }
.context-menu .menu-item-danger { color: #e74c3c; }
.context-menu .menu-item-danger:hover { background: #ffebee; }
.context-menu .menu-divider { height: 1px; background: #eee; margin: 4px 0; padding: 0; pointer-events: none; }
.context-menu.sidebar-menu { width: fit-content !important; min-width: 0 !important; }
.context-menu.sidebar-menu .menu-item { padding: 6px 10px; }

.profile-row .label{color:#666}
.profile-row select{font-size:12px;padding:3px 6px;border-radius:6px;border:1px solid #ddd}
.toggle-sw{width:40px;height:22px;background:#ddd;border-radius:11px;cursor:pointer;position:relative;transition:.2s}
.toggle-sw.on{background:var(--accent)}
.toggle-sw::after{content:'';position:absolute;width:18px;height:18px;background:#fff;border-radius:50%;top:2px;left:2px;transition:.2s}
.toggle-sw.on::after{left:20px}

.msg-date-divider{text-align:center;padding:16px 0 8px;font-size:13px;color:#999;font-weight:500}
.msg-system-row{text-align:center;padding:6px 0;display:flex;justify-content:center;width:100%;}
.msg-system-content{background:rgba(0,0,0,0.04);padding:4px 16px;border-radius:12px;display:inline-block;font-size:13px;color:#999;box-shadow:none;display:flex;align-items:center;gap:6px;}
.msg-system-time{font-size:11px;color:#bbb;white-space:nowrap;}

.msg-row{display:flex;flex-direction:column;margin-bottom:10px;padding:2px 0;}

.msg-private-wrap{display:flex;width:100%;max-width:80%;padding:2px 0;margin:0;}
.msg-private-wrap.mine{flex-direction:row-reverse;align-self:flex-end}
.msg-private-wrap.other{flex-direction:row;align-self:flex-start}

.msg-group-wrap.mine { display: flex; justify-content: flex-end; align-self: flex-end; width: 100%; max-width: 80%; padding: 2px 0; margin-bottom: 8px; }
.msg-group-wrap.other { display: flex; align-items: flex-end; align-self: flex-start; width: 100%; max-width: 80%; padding: 2px 0; margin-bottom: 8px; gap: 0; }
.msg-group-wrap.other .g-av { 
    width: 50px;
    height: 50px; 
    border-radius: 50%; 
    flex-shrink: 0; 
    background: #4a9cfe; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #fff; 
    font-weight: 700; 
    font-size: 19px;
    margin-bottom: 1px;
    margin-right: 11px;
    overflow: hidden; 
    cursor: pointer; 
}
.msg-group-wrap.other .bubble-wrap { display: flex; flex-direction: column; width: fit-content; max-width: 100%; }
.msg-group-wrap.other .bubble-name { display: block; width: 100%; font-size: 12px; font-weight: 600; color: #333; margin-bottom: 2px; line-height: 1.3; cursor: pointer; text-align: left; text-shadow: 0 1px 2px rgba(255,255,255,0.9); }
.role-tag { font-size: 10px; padding: 1px 5px; border-radius: 4px; margin-left: 5px; vertical-align: middle; font-weight: 600; color: #fff; text-shadow: none; }
.role-creator { background: #ff4d4f; }
.role-admin { background: #52c41a; }
.role-bot { background: #4dabf7; }
.msg-group-wrap.other .bubble-name .role-tag { margin-right: 5px; margin-left: 0; }
.msg-group-wrap.other .bubble-name .role-bot { background: #4dabf7; color: #fff; font-weight: bold; border-radius: 4px; padding: 1px 5px; font-size: 10px; }
.chat-header-avatar-box .chat-header-avatar-placeholder { font-weight: bold; }
.msg-row[data-from="🤖 机器人"] .bubble.other { background: #e3f2fd; border: 1px solid #b3e5fc; }

#groupTopBar {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    width: 100%;
    padding: 0 12px;
    background: #fffbe6;
    border-bottom: 1px solid #ffd54f;
    display: none;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 30;
}
#groupTopBar .top-bar-announcement, #groupTopBar .top-bar-requests { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 6px; width: 100%; overflow: hidden; flex-shrink: 0; }
#groupTopBar .top-bar-announcement .tb-label, #groupTopBar .top-bar-requests .tb-label { flex-shrink: 0; white-space: nowrap; font-weight: bold; color: #e74c3c; }
#groupTopBar .top-bar-announcement .tb-content, #groupTopBar .top-bar-requests .tb-content { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #333; }
#groupTopBar .top-bar-announcement .tb-content a, #groupTopBar .top-bar-requests .tb-content a { color: #1890ff; text-decoration: none; }
#groupTopBar .top-bar-announcement .clear-btn, #groupTopBar .top-bar-requests .clear-btn { margin-left: auto; flex-shrink: 0; cursor: pointer; font-weight: bold; font-size: 22px; color: #999; line-height: 1; padding: 0 4px; transition: all 0.2s ease; }
#groupTopBar .top-bar-announcement .clear-btn:hover, #groupTopBar .top-bar-requests .clear-btn:hover { color: #d32f2f; transform: scale(1.1); }

.bubble {
    position: relative;
    isolation: isolate;
    overflow: visible;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    padding: 0;
    max-width: 100%;
}

.bubble.other {
    background-color: #fff;
    color: #000;
    border-radius: 12px 12px 12px 0;
}
.bubble.other::after {
    display: none;
}

.bubble.mine {
    background-color: #EFFDDE;
    color: #000;
    border-radius: 12px 12px 0 12px;
}
.bubble.mine::after {
    display: none;
}

.tail {
    position: absolute;
    bottom: 0;
    width: 28px;
    height: 28px;
    z-index: -1;
}
.tail-left { left: -24px; }
.tail-right { right: -24px; }

.bubble.text-only {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    width: fit-content;
    max-width: 100%;
    padding: 8px 12px;
    font-size: 15px;
    line-height: 1.4;
    white-space: pre-wrap !important;
}
.bubble.text-only .meta {
    margin-left: auto !important;
    padding-left: 12px;
    margin-bottom: 0;
    font-size: 12px;
    white-space: nowrap;
    color: #4fcd65;
}
.bubble.other.text-only .meta { color: #8e9aad; }

.msg-reply-preview {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    background: #e3f2fd;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-all;
}
.msg-reply-preview .reply-from {
    display: block;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 2px;
    font-size: 12px;
}
.msg-reply-preview .reply-content {
    display: block;
    color: #666;
    white-space: normal;
    word-break: break-all;
    font-size: 12px;
    line-height: 1.4;
}

.msg-row.mention-highlight .bubble {
    background-color: #ff4d4f !important;
    color: #ffffff !important;
    border-left: none !important;
}
.msg-row.mention-highlight .bubble.other {
    background-color: #ff4d4f !important;
}
.msg-row.mention-highlight .bubble.mine {
    background-color: #ff4d4f !important;
}
.msg-row.mention-highlight .bubble svg.tail path,
.msg-row.mention-highlight .bubble svg.tail {
    fill: #ff4d4f !important;
}
.msg-row.mention-highlight .meta {
    color: rgba(255,255,255,0.8) !important;
}

.msg-row.reply-highlight .bubble {
    background-color: #ff4d4f !important;
    color: #ffffff !important;
    border-left: none !important;
}
.msg-row.reply-highlight .bubble.other {
    background-color: #ff4d4f !important;
}
.msg-row.reply-highlight .bubble.mine {
    background-color: #ff4d4f !important;
}
.msg-row.reply-highlight .bubble svg.tail path,
.msg-row.reply-highlight .bubble svg.tail {
    fill: #ff4d4f !important;
}
.msg-row.reply-highlight .meta {
    color: rgba(255,255,255,0.8) !important;
}

.bubble.img-text {
    width: 300px;
    max-width: 100%;
}
.bubble.img-text .text-content { display: block; width: 100%; white-space: pre-wrap !important; }
.bubble.img-text img, .bubble.img-text video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 11px 11px 0 0;
    background: transparent;
}
.bubble.img-text .msg-image-caption {
    padding: 8px 70px 8px 12px;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap !important;
}
.bubble.img-text .meta {
    position: absolute;
    right: 12px;
    bottom: 7px;
    font-size: 12px;
    white-space: nowrap;
    color: #4fcd65;
}
.bubble.other.img-text .msg-image-caption { border-radius: 0 0 11px 0; }
.bubble.mine.img-text .msg-image-caption { border-radius: 0 0 0 11px; }

.bubble.single-image {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 300px;
    max-width: 100%;
}
.bubble.single-image::after { display: none !important; }
.bubble.single-image .tail { display: none !important; }
.bubble.single-image img, .bubble.single-image video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: transparent;
}
.bubble.single-image .meta {
    position: absolute;
    right: 8px;
    bottom: 8px;
    color: #ffffff;
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    white-space: nowrap;
}

.bubble.single-image,
.bubble.img-text {
    transition: none !important;
}

.bubble.single-image img,
.bubble.img-text img,
.bubble.single-image video,
.bubble.img-text video {
    display: block;
    width: 100%;
    height: 270px;
    max-height: 270px;
    object-fit: cover;
    border-radius: 8px;
    background: rgba(0,0,0,0.05);
    transition: none !important;
}

#msgs, .msg-row, .bubble {
    transition: none !important;
}

#inputBar {
    height: 170px;
    min-height: 170px;
    max-height: 170px;
    background: #fff;
    padding: 10px 18px 12px 18px;
    display: flex;
    flex-direction: column;
    position: relative;
    border-top: 1px solid #e0e0e0;
    overflow: hidden;
}
.qq-input-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.qq-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; flex-shrink: 0; }
.qq-toolbar-left, .qq-toolbar-right { display: flex; align-items: center; gap: 12px; }
.qq-toolbar .icon-btn { background: transparent; border: none; color: #666; font-size: 18px; cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: 0.1s; line-height: 1; }
.qq-toolbar .icon-btn:hover { background: #f0f0f0; color: #333; }
#gifBtn { font-size: 12px; font-weight: 600; color: #888; padding: 2px 6px; border: 1px solid transparent; }
#gifBtn:hover { color: #333; }
#mediaPreviewBar {
    max-height: 80px;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0 0 4px 0;
    background: transparent;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}
#mediaPreviewBar.hidden { display: none !important; }
.preview-item {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    background: #f0f0f0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #f0f0f0;
}
.preview-item .file-placeholder {
    font-size: 10px;
    color: #888;
    text-align: center;
    word-break: break-all;
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preview-item .remove-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4d4f;
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 10;
}
.qq-input-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#msgInp { width: 100%; border: none; outline: none; background: transparent !important; border-radius: 0 !important; resize: none; font-size: 15px; line-height: 1.6; color: #333; min-height: 48px; max-height: 150px; padding: 0; margin: 0; flex: 1; overflow-y: auto; }
.qq-action-bar { display: flex; justify-content: flex-end; align-items: center; margin-top: 2px; flex-shrink: 0; }
.btn-send { background: #00a8d6; color: #fff; border: none; border-radius: 4px; padding: 6px 20px; font-size: 13px; font-weight: 500; cursor: pointer; transition: 0.15s; }
.btn-send:hover { background: #008bb4; }
.btn-send.disabled, .btn-send:disabled { background: #e8e8e8; color: #999; cursor: not-allowed; }

.emoji-panel { position: absolute; bottom: 55px; left: 18px; right: 18px; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); border: 1px solid #eee; z-index: 999; max-height: 320px; display: flex; flex-direction: column; padding: 8px; }
.emoji-panel.hidden { display: none !important; }
.emoji-categories { display: flex; gap: 4px; border-bottom: 1px solid #f0f0f0; padding-bottom: 4px; margin-bottom: 4px; flex-shrink: 0; }
.emoji-cat { padding: 4px 10px; font-size: 12px; cursor: pointer; border-radius: 6px; color: #999; transition: all 0.1s; }
.emoji-cat:hover { background: #f5f5f5; color: #333; }
.emoji-cat.active { background: var(--accent); color: #fff; }
.emoji-list { flex: 1; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; align-content: flex-start; min-height: 180px; }
.emoji-list .emoji-item { font-size: 24px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 4px; cursor: pointer; transition: 0.1s; }
.emoji-list .emoji-item:hover { background: #f0f0f0; transform: scale(1.1); }
.emoji-list .favorite-btn { font-size: 12px; color: #999; margin-left: 4px; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.emoji-list .favorite-btn:hover { background: #eee; color: #e6b800; }
.emoji-section-title { width: 100%; font-size: 12px; color: #999; padding: 6px 0 2px 0; font-weight: 500; }
.custom-emoji-panel { position: absolute; bottom: 55px; left: 18px; width: 300px; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); border: 1px solid #eee; z-index: 999; max-height: 340px; display: flex; flex-direction: column; overflow: hidden; }
.custom-emoji-panel.hidden { display: none !important; }
.custom-emoji-item { position: relative; transition: transform 0.1s; }
.custom-emoji-item:hover { transform: scale(1.05); }
.custom-emoji-delete { opacity: 0; transition: opacity 0.2s; }
.custom-emoji-item:hover .custom-emoji-delete { opacity: 1; }

.action-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 16px 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.04); align-items: center; justify-content: center; }
.action-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 3px 12px; height: 26px; border: none; border-radius: 20px; background: linear-gradient(135deg, #5a9cfe, #4a9cfe); color: #fff; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s ease; width: auto !important; min-width: 40px; box-shadow: 0 2px 5px rgba(74, 156, 254, 0.2); }
.action-btn .icon { font-size: 13px; line-height: 1; margin-top: 0; }
.action-btn:hover { background: linear-gradient(135deg, #4a9cfe, #3a8cee); opacity: 1; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(74, 156, 254, 0.3); }
.action-btn:active { transform: translateY(0px); box-shadow: none; }
.action-btn.outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); box-shadow: none; }
.action-btn.outline:hover { background: rgba(74, 156, 254, 0.05); transform: translateY(-1px); box-shadow: none; }

.stat-header-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 15px; color: #333; cursor: default; border-bottom: 1px solid rgba(0,0,0,0.04); background: #f5f6fa; }
.stat-header-row .stat-num { background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 12px; }

.archive-item { display: flex; align-items: center; padding: 12px 16px; min-height: 70px; cursor: pointer; transition: background 0.15s ease; gap: 12px; background: var(--sb); border-bottom: 1px solid rgba(0,0,0,0.04); position: relative; overflow: visible; }
.archive-item:hover { background: rgba(0, 0, 0, 0.04); }
.archive-item.active { background: var(--accent); }
.archive-item.active .name, .archive-item.active .last-msg, .archive-item.active .meta .unread-badge { color: #fff !important; }
.archive-item .avatar-box { width: 48px; height: 48px; border-radius: 50%; background: #b0b8c0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; position: relative; }
.archive-item .avatar-box svg { width: 24px; height: 24px; fill: #fff; }
.archive-item .info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; overflow: hidden; }
.archive-item .info .row-top { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.archive-item .info .name { font-size: 15px; font-weight: 500; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-item .info .last-msg { font-size: 13px; color: #8e9398; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; line-height: 1.4; }
.archive-item .meta { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; margin-left: 8px; position: relative; min-height: 24px; justify-content: flex-start; overflow: visible !important; }
.archive-item .meta .unread-badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 500; padding: 0 8px; height: 18px; line-height: 18px; border-radius: 18px; text-align: center; min-width: 18px; display: none !important; }
.archive-item .meta .unread-badge.show { display: inline-block !important; }
.archive-item.active .meta .unread-badge { background: #fff; color: var(--accent); }

.jump-to-new { position: absolute; bottom: 90px; right: 20px; width: 46px; height: 46px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.15); display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 100; transition: all 0.25s ease; }
.jump-to-new:active { transform: scale(0.9); }
.jump-to-new .jump-icon { font-size: 20px; color: #555; }
.jump-to-new .jump-count { position: absolute; top: -6px; right: -6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: bold; min-width: 18px; height: 18px; line-height: 18px; border-radius: 18px; text-align: center; padding: 0 6px; display: none; }
.jump-to-new .jump-count.show { display: block; }
#inputBar { position: relative; }
#msgs { position: relative; }

#selectionBar { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; height: 48px; background: var(--accent); border-bottom: 1px solid rgba(0,0,0,0.05); color: #fff; position: relative; z-index: 15; }
#selectionBar.hidden { display: none !important; }
.selection-bar-left { font-size: 14px; font-weight: 500; }
.selection-bar-right { display: flex; gap: 8px; align-items: center; }
.selection-bar-right .btn-sm { background: rgba(255,255,255,0.2); color: #fff; border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; cursor: pointer; transition: 0.1s; }
.selection-bar-right .btn-sm:hover { background: rgba(255,255,255,0.3); }
.selection-bar-right .btn-sm.btn-outline { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.6); }
.selection-bar-right .btn-sm.btn-outline:hover { background: rgba(255,255,255,0.1); }

.msg-checkbox { position: absolute; top: 50%; left: -32px; transform: translateY(-50%); width: 20px; height: 20px; border: 2px solid #ccc; border-radius: 50%; background: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; transition: 0.1s; }
body.selection-mode .msg-checkbox { display: flex !important; }
.msg-checkbox.checked { background: var(--accent); border-color: var(--accent); }
.msg-checkbox.checked::after { content: '✓'; color: #fff; font-size: 12px; font-weight: bold; }
body.selection-mode .msg-row.selected { opacity: 0.6; }
body.selection-mode .msg-row.selected .bubble { background: #e8ecf1 !important; }
.msg-private-wrap, .msg-group-wrap { position: relative; }

#mentionBanner { position: sticky !important; top: 0; z-index: 50; background: linear-gradient(135deg, #fff3cd, #ffe69c) !important; border-bottom: 1px solid #ffc107 !important; padding: 8px 12px !important; display: flex !important; align-items: center !important; justify-content: space-between !important; font-size: 13px !important; min-height: 36px !important; flex-shrink: 0; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important; line-height: 1.4 !important; border-radius: 8px; margin: 4px 8px; }
#mentionBanner .banner-text { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; }
#mentionBanner .banner-text span:first-child { font-weight: 700; color: #e65100; white-space: nowrap; }
#mentionBanner .banner-close { font-size: 16px; cursor: pointer; color: #999; margin-left: 8px; flex-shrink: 0; transition: 0.1s; }
#mentionBanner .banner-close:hover { color: #555; }

.c-item .meta .mention-badge.show { animation: mentionPulse 1.8s ease-in-out infinite !important; }
@keyframes mentionPulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.6); } 70% { transform: scale(1.15); box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); } }

#wcStickyToast { cursor: pointer; border-radius: 16px !important; background: #1e293b !important; padding: 20px 24px !important; max-width: 420px !important; box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important; border: 1px solid rgba(255,255,255,0.1) !important; transition: transform 0.2s ease, opacity 0.2s ease; }
#wcStickyToast:hover { transform: translateX(-50%) translateY(-2px) scale(1.02); }
#wcStickyToast .toast-title { font-size: 15px; font-weight: 600; color: #f1c40f; margin-bottom: 4px; }
#wcStickyToast .toast-body { font-size: 13px; color: #e2e8f0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
#wcStickyToast .toast-close { position: absolute; top: 8px; right: 12px; font-size: 20px; color: #94a3b8; cursor: pointer; transition: color 0.2s; }
#wcStickyToast .toast-close:hover { color: #f8fafc; }
#wcStickyToast .toast-arrow { display: inline-block; font-size: 14px; color: #60a5fa; margin-top: 4px; font-weight: 500; }

.search-results { padding: 4px 0; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.15); border: 1px solid #eee; font-size: 14px; }
.search-section-title { padding: 6px 12px; font-weight: bold; font-size: 12px; color: #999; background: #fafafa; border-bottom: 1px solid #f0f0f0; margin-top: 4px; }
.search-section-title:first-child { margin-top: 0; border-radius: 12px 12px 0 0; }
.r-item { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #f8f9fa; transition: 0.1s; color: #333; }
.r-item:last-child { border-bottom: none; border-radius: 0 0 12px 12px; }
.r-item:hover { background: #f0f2f5; }

.unread-badge-tab { background: #ff3b30; color: #fff; font-size: 10px; font-weight: bold; padding: 0 6px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 8px; display: inline-block; margin-left: 4px; vertical-align: middle; box-shadow: 0 1px 3px rgba(255, 59, 48, 0.4); }

@media (max-width: 768px) {
  #app { width: 100vw; height: 100vh; height: 100dvh; max-width: 100%; border-radius: 0; }
  #mainPanel { flex-direction: column; }
  #sidebar { width: 100%; min-width: unset; height: auto; max-height: 100vh; max-height: 100dvh; position: relative; left: 0; top: 0; background: #f5f6fa; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.06); box-shadow: none; border-radius: 0; display: flex; flex-direction: column; transition: none !important; }
  #sidebar .head { padding: 8px 14px; background: #fff; display: flex; align-items: center; gap: 10px; cursor: pointer; border-bottom: none; }
  #sidebar .srch { padding: 4px 12px 8px 12px; background: #f5f6fa; }
  #sidebar .srch input { border-radius: 18px; background: #fff; padding: 6px 12px; font-size: 14px; height: 30px; }
  #sidebar .chat-tabs { padding: 2px 12px 8px 12px; gap: 4px; background: #f5f6fa; }
  #sidebar .chat-tabs .tab { padding: 4px 0; font-size: 13px; }
  #sidebar #contacts { flex: 1; height: auto; overflow-y: auto; padding-bottom: 0; }
  .c-item { padding: 10px 14px; height: 62px; min-height: 62px; }
  .c-item .avatar-box { width: 42px; height: 42px; min-width: 42px; min-height: 42px; }
  .c-item .info .name { font-size: 14px; }
  .c-item .meta .time { font-size: 10px; }

  #chatArea { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100vh; 
    height: 100dvh; 
    z-index: 999; 
    background: #f0f2f5; 
    flex-direction: column; 
    min-height: 0;
  }
  #chatHeader { min-height: 54px; padding: 6px 12px; }
  .chat-header-name { font-size: 16px; }
  .mobile-back-btn { display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: normal; color: #333; padding: 0 4px; cursor: pointer; margin-right: 8px; width: 32px; height: 32px; border-radius: 50%; }
  .mobile-back-btn:hover { background: #f0f0f0; }

  #inputBar {
    height: auto !important;
    min-height: 100px !important;
    max-height: none !important;
    padding: 4px 12px 6px 12px !important;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: visible !important;
  }
  #mediaPreviewBar {
    max-height: 50px !important;
    gap: 4px !important;
    margin: 0 0 2px 0 !important;
  }
  .preview-item {
    width: 38px !important;
    height: 38px !important;
  }
  .preview-item .remove-btn {
    width: 14px !important;
    height: 14px !important;
    font-size: 9px !important;
    line-height: 14px !important;
    top: -3px !important;
    right: -3px !important;
  }
  #msgInp { min-height: 22px !important; max-height: 60px !important; font-size: 14px !important; }
  .qq-toolbar { margin-bottom: 2px !important; }
  .qq-toolbar .icon-btn { font-size: 16px !important; padding: 2px !important; }
  .qq-action-bar { margin-top: 0 !important; }
  .qq-action-bar .btn-send { padding: 4px 16px !important; font-size: 12px !important; border-radius: 20px !important; }

  #msgs { padding: 8px 10px; padding-top: 75px !important; }
  .bubble { padding: 6px 10px; font-size: 14px; border-radius: 16px; }
  #mobileMenuBtn { display: none !important; }
  #msgs .msg-row { -webkit-touch-callout: none !important; -webkit-user-select: none !important; user-select: none !important; touch-action: none !important; }
  #msgs .msg-row .bubble { touch-action: none !important; -webkit-touch-callout: none !important; -webkit-user-select: none !important; user-select: none !important; }
  #contacts .c-item { -webkit-touch-callout: none !important; -webkit-user-select: none !important; user-select: none !important; touch-action: none !important; }
  .bubble .meta { font-size: 10px !important; margin-left: 2px !important; gap: 1px !important; line-height: 1.2 !important; }
  .bubble.img-text img, .bubble.img-text video { max-width: 100% !important; border-radius: 4px !important; }
  .bubble.single-image img, .bubble.single-image video { max-width: 100% !important; border-radius: 12px !important; }
}

#msgs::-webkit-scrollbar, #contacts::-webkit-scrollbar, .emoji-list::-webkit-scrollbar, #groupMemberContainer::-webkit-scrollbar { display: none; width: 0; height: 0; }
#msgs, #contacts, .emoji-list, #groupMemberContainer { -ms-overflow-style: none; scrollbar-width: none; }
@media (max-width: 768px) { #msgs::-webkit-scrollbar, #contacts::-webkit-scrollbar { display: none; width: 0; height: 0; } }

.modal-overlay { z-index: 10002 !important; }
#groupModal { z-index: 9999 !important; }
#profileModal { z-index: 10000 !important; }
#avatarModal, #mediaPreviewModal, #botPanelPrivateModal, #botPanelGroupModal, #forgotPasswordModal, #forwardPickerModal { z-index: 10001 !important; }

#groupModal .modal { display: flex !important; flex-direction: column !important; overflow: hidden !important; max-height: 85vh !important; }
#groupModal .modal-header, #groupModal .profile-top, #groupModal .profile-section { flex-shrink: 0 !important; }
#groupMemberList { flex: 1 !important; min-height: 0 !important; overflow: visible !important; border-top: 1px solid #f0f0f0; margin-top: 4px; padding-top: 4px; }
#groupMemberContainer { max-height: 320px !important; overflow-y: auto !important; overflow-x: hidden !important; }
#groupMemberContainer::-webkit-scrollbar { display: none; width: 0; height: 0; }
#groupMemberContainer { -ms-overflow-style: none; scrollbar-width: none; }
#groupMemberList .profile-row, #groupMemberContainer .profile-row { width: 100% !important; box-sizing: border-box !important; overflow: hidden !important; }
#groupMemberList .g-username-only, #groupMemberList .g-member-nick { white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; max-width: 100% !important; display: inline-block !important; }

.add-friend-tip {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #fff;
    border-radius: 16px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 10000;
    border: 1px solid #f0f0f0;
    max-width: calc(100% - 20px);
    min-width: 0;
    width: fit-content;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}
.add-friend-tip.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.add-friend-tip .tip-content {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.add-friend-tip .tip-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}
.add-friend-tip .tip-desc {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}
.add-friend-tip .tip-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 10px;
}
.add-friend-tip .tip-icon {
    margin-right: 2px;
    flex-shrink: 0;
}
.add-friend-tip .tip-btn {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: 0.15s;
}
.add-friend-tip .tip-close {
    background: #f0f0f0;
    color: #666;
}
.add-friend-tip .tip-close:hover {
    background: #e0e0e0;
}
.add-friend-tip .tip-add {
    background: var(--accent);
    color: #fff;
}
.add-friend-tip .tip-add:hover {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .add-friend-tip {
        max-width: calc(100vw - 40px) !important;
        min-width: 0 !important;
        padding: 8px 12px !important;
        gap: 8px !important;
    }
    .add-friend-tip .tip-desc {
        display: none !important;
    }
    .add-friend-tip .tip-close {
        display: none !important;
    }
    .add-friend-tip .tip-close-mobile {
        display: inline-flex !important;
        font-size: 18px !important;
        padding: 2px !important;
        color: #999 !important;
        background: none !important;
        border: none !important;
        line-height: 1 !important;
        margin-left: 4px !important;
    }
    .add-friend-tip .tip-add {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
}

#contacts .c-item-wrapper {
    border-bottom: none !important;
}

#replyBar {
    background: #f0f4ff;
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0 18px 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.2s;
}
#replyBar .reply-bar-content {
    flex: 1;
    min-width: 0;
}
#replyBar .reply-bar-from {
    display: block;
    font-weight: bold;
    color: var(--accent);
    font-size: 12px;
    margin-bottom: 2px;
}
#replyBar .reply-bar-text {
    display: block;
    color: #666;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
#replyBar .reply-bar-close {
    font-size: 18px;
    color: #999;
    cursor: pointer;
    margin-left: 12px;
    flex-shrink: 0;
    transition: color 0.1s;
    line-height: 1;
}
#replyBar .reply-bar-close:hover {
    color: #333;
}

.bubble .meta {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}
.bubble .meta .time {
    margin-bottom: 1px;
    position: relative !important;
    top: 3px !important;
}
.bubble.mine .meta .time {
    top: 3px !important;
}
.bubble.other .meta .time {
    top: 3px !important;
}
.bubble .meta .status-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 2px;
    line-height: 1;
}
@media (max-width: 768px) {
    .bubble .meta .status-icon {
        width: 12px;
        margin-left: 1px;
    }
}

/* ============================================
   PWA 独立窗口自适应
   ============================================ */
@media (display-mode: standalone) {
    body {
        background: #f0f2f5;
    }
    #app {
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ============================================
   自绘标题栏（只在 Electron 里显示）
   - 高度 26px（极致紧凑）
   - 白色背景
   - 直角窗口
   - ★ 按钮放大版：宽 36px，字号 14px，字重 500
   ============================================ */

.custom-titlebar {
    display: none;
}

body.electron {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: #f0f2f5;
    padding: 0;
    margin: 0;
}

body.electron .custom-titlebar {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    height: 26px;
    min-height: 26px;
    max-height: 26px;
    background: #ffffff;
    border: none;
    box-shadow: none;
    outline: none;
    padding: 0;
    -webkit-app-region: drag;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
    position: relative;
    z-index: 99999;
    box-sizing: border-box;
}

body.electron .custom-titlebar .titlebar-buttons {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
    margin-left: auto;
    -webkit-app-region: no-drag;
    flex-shrink: 0;
}

/* ★ 放大版按钮：36px 宽，14px 字号，字重 500 */
body.electron .custom-titlebar .tb-btn {
    width: 36px;
    height: 26px;
    border: none;
    background: transparent;
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    outline: none;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1;
    -webkit-app-region: no-drag;
}

body.electron .custom-titlebar .tb-min:hover,
body.electron .custom-titlebar .tb-max:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.electron .custom-titlebar .tb-close:hover {
    background: #e81123;
    color: #ffffff;
}

body.electron #app {
    height: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    flex: 1;
    min-height: 0;
}