/* ============================================================
   MZL即时聊天系统 - 全局样式
   蓝金商务风：深蓝 #0d1526 + 金色 #f5b544
   响应式适配 PC / 手机
   ============================================================ */

/* 策略按钮默认隐藏，由JS根据权限控制显示 */
#strategyBtn { display: none !important; }
#strategyBtn.show { display: inline-block !important; }

/* 重置与基础 */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* 全局去除触摸方形高亮（移动端/WebView）：tap 高亮不跟随圆角，统一透明，
   覆盖所有按钮、图标按钮、链接及可点击元素，避免圆形/圆角按钮点击出现方形效果 */
button, a, .btn, [role="button"], select, label, summary,
input[type="button"], input[type="submit"], input[type="reset"],
.icon-btn, .tool-btn, .mobile-menu-btn, .conv-tab, .modal-close,
.input-send-btn, .back-to-bottom, .emoji-item {
    -webkit-tap-highlight-color: transparent;
}
/* 去除原生按钮默认外观，避免方形默认样式；聚焦时不显示方形轮廓 */
button {
    -webkit-appearance: none;
    appearance: none;
}
button:focus, button:focus-visible {
    outline: none;
}
html, body {  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: #333; background: #f0f2f5; }
a { color: #0d1526; text-decoration: none; }
a:hover { color: #f5b544; }
img { max-width: 100%; vertical-align: middle; }
input, textarea, button { font-family: inherit; font-size: inherit; outline: none; }

/* 颜色变量（CSS自定义属性，兼容降级） */
:root {
    --primary: #0d1526;
    --primary-light: #1b2c49;
    --primary-dark: #070c17;
    --gold: #f5b544;
    --gold-light: #ffd88a;
    --gold-dark: #c98f22;
    --bg: #f0f2f5;
    --white: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --success: #52c41a;
    --error: #f5222d;
    --warning: #faad14;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s ease;
    line-height: 1.5;
    user-select: none;
}
.btn-primary {
    background: linear-gradient(135deg, #0d1526 0%, #1b2c49 100%);
    color: #f5b544;
    border-color: #f5b544;
}
.btn-primary:hover { background: linear-gradient(135deg, #1b2c49 0%, #0d1526 100%); color: #ffd88a; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
    background: #ddd;
    color: #0d1526;
    border-color: #8a9bb0;
}
.btn-outline:hover { background: #0d1526; color: #f5b544; }
.btn-block { display: block; width: 100%; padding: 12px; font-size: 16px; }
.btn-small { padding: 4px 12px; font-size: 12px; }

/* ============================================================
   认证页面（登录/注册）
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1526 0%, #070c17 50%, #0d1526 100%);
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}
/* 页面级背景，避免滚动时露出空白 */
body.auth-page {
    background: linear-gradient(135deg, #0d1526 0%, #070c17 50%, #0d1526 100%);
}
.auth-page-lang {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}
.auth-page-lang .lang-selector select {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(201,169,97,0.4);
    padding: 6px 28px 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23c9a961' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.auth-page-lang .lang-selector select option {
    background: #0d1526;
    color: #fff;
}
/*.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(201,169,97,0.1) 0%, transparent 70%);
    border-radius: 50%;
}*/
.auth-container { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 35px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    border-top: 4px solid #f5b544;
}
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-logo { display: block; width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px; border: 1px solid rgba(245,181,68,.55); object-fit: contain; background:#0d1526; box-shadow: 0 10px 24px rgba(13,21,38,.18); }
.auth-header h1 { font-size: 24px; color: #0d1526; margin-bottom: 8px; }
.auth-header p { color: #999; font-size: 13px; }
.brand-slogan {
    display: inline-block;
    font-size: 12.5px;
    line-height: 1.6;
    font-weight: 600;
    letter-spacing: .08em;
    color: #8a5f12;
    margin: -2px 0 8px;
}
.brand-slogan-welcome {
    margin: 4px 0 12px;
    font-size: 14px;
    letter-spacing: .12em;
    color: #f5b544;
    opacity: .95;
}
.auth-header .brand-slogan { margin: 0 0 8px; }
.auth-form .form-group { margin-bottom: 20px; }
.auth-form label { display: block; margin-bottom: 6px; color: #555; font-weight: 500; font-size: 13px; }
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.auth-form input:focus { border-color: #f5b544; box-shadow: 0 0 0 2px rgba(201,169,97,0.15); }
.code-input-group { display: flex; gap: 10px; }
.code-input-group input { flex: 1; }
.code-input-group .btn { white-space: nowrap; padding: 10px 16px; }
.auth-footer { text-align: center; margin-top: 25px; padding-top: 20px; border-top: 1px solid #f0f0f0; color: #999; font-size: 13px; }
.auth-footer a { color: #0d1526; font-weight: 500; }

/* 提示框 */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 13px; }
.alert-error { background: #fff2f0; border: 1px solid #ffccc7; color: #f5222d; }
.alert-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }

/* ============================================================
   聊天主界面
   ============================================================ */
.chat-header {
    height: 56px;
    background: linear-gradient(120deg, #0b1220 0%, #0d1526 46%, #1a2942 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.22);
    border-bottom: 1px solid rgba(245,181,68,.22);
    position: relative;
    z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(245,181,68,.55); object-fit: contain; background: #0d1526; box-shadow: 0 4px 12px rgba(0,0,0,.22); }
.header-title { color: #f5b544; font-size: 18px; font-weight: 700; letter-spacing: .6px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.strategy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 32px;
    padding: 0 11px;
    border: 1px solid rgba(245,181,68,.46);
    border-radius: 999px;
    background: rgba(245,181,68,.08);
    color: #f5b544;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .3px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.strategy-btn svg { width: 15px; height: 15px; display: block; }
.strategy-btn:hover { background: rgba(245,181,68,.16); border-color: #f5b544; }
.strategy-btn:active { transform: scale(.96); }
.icon-btn {
    background: transparent;
    border: 1px solid rgba(201,169,97,0.3);
    color: #f5b544;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.icon-btn:hover { background: rgba(201,169,97,0.15); border-color: #f5b544; }
.sound-icon.sound-on { color: #f5b544; }
.sound-icon.sound-off { color: #666; opacity: 0.5; }
.user-info { display: flex; align-items: center; gap: 10px; margin-left: 10px; padding-left: 15px; border-left: 1px solid rgba(201,169,97,0.2); }
.user-name { color: #fff; font-size: 14px; }
.logout-link { color: #f5b544; font-size: 13px; }

.chat-container {
    display: flex;
    height: calc(100vh - 56px);
    background: #f0f2f5;
    overflow: hidden;
}

/* 会话列表 */
.conversation-list {
    width: 300px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.conv-list-header {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.conv-list-header h3 { font-size: 16px; color: #0d1526; }
.conv-list-body { flex: 1; overflow-y: auto; }
.conv-item {
    padding: 14px 15px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
}
.conv-item:hover { background: #f8f9fb; }
.conv-item.active { background: #eef3f8; border-left: 3px solid #f5b544; padding-left: 12px; }
.conv-delete-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    background: #ff4d4f;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: none;
    z-index: 2;
}
.conv-item:hover .conv-delete-btn { display: block; }
.conv-delete-btn:hover { background: #d9363e; }
.conv-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    color: #f5b544;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 14px; color: #333; font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last-msg { font-size: 12px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { text-align: right; flex-shrink: 0; }
.conv-time { font-size: 11px; color: #bbb; margin-bottom: 4px; }
.conv-unread {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    background: #f5222d;
    color: #fff;
    font-size: 11px;
    border-radius: 9px;
    text-align: center;
}
.loading-tip { text-align: center; color: #999; padding: 30px; font-size: 13px; }
.empty-tip { text-align: center; color: #999; padding: 40px 20px; font-size: 13px; }

/* 聊天区域（对齐落地页预览墙深蓝紫风格） */
.chat-area { flex: 1; display: flex; flex-direction: column; background: linear-gradient(135deg, #070c17 0%, #111d33 100%); min-width: 0; }
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}
.welcome-logo { width: 80px; height: 80px; border-radius: 18px; margin-bottom: 20px; border: 1px solid #f5b544; object-fit: contain; background: #0d1526; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.chat-welcome h2 { color: #e8edf7; font-size: 24px; margin-bottom: 10px; }
.chat-welcome p { color: rgba(232,237,247,0.65); margin-bottom: 30px; }
.welcome-actions { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
#groupWatermarkLayer { position: absolute; pointer-events: none; z-index: 2; background-repeat: repeat; background-position: 0 0; }
#chatMessages.protected-copy .msg-bubble,
#chatMessages.protected-copy .message-content { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; }
#chatMessages.protected-copy img { -webkit-user-drag: none; user-drag: none; }
.chat-topbar { min-width: 0;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}
.chat-target-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.target-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    color: #f5b544;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.target-avatar img { width: 100%; height: 100%; object-fit: cover; }
.target-name { font-size: 13px; font-weight: 600; color: #0d1526; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-status { font-size: 12px; color: #999; margin-right: 8px; flex-shrink: 0; }
.chat-type-pill { display:inline-flex; align-items:center; gap:5px; padding:2px 9px; border-radius:999px; font-size:11px; font-weight:500; line-height:1.5; letter-spacing:.2px; white-space:nowrap; border:1px solid transparent; }
.chat-type-pill::before { content:""; width:5px; height:5px; border-radius:50%; background:currentColor; opacity:.75; flex-shrink:0; }
.chat-type-pill.ctp-channel { background:#eaf2fb; color:#1b2c49; border-color:#d3e3f5; }
.chat-type-pill.ctp-discuss { background:#f3f5f7; color:#66707a; border-color:#e4e8ec; }
.chat-type-pill.ctp-vip { background:linear-gradient(135deg,#fdf7e8,#fbf0d2); color:#8a6a1c; border-color:#efdfb4; }

/* 消息列表 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(135deg, #070c17 0%, #111d33 100%);
    position: relative;
}
.msg-day-tip {
    text-align: center;
    margin: 15px 0;
    color: rgba(232,237,247,0.7);
    font-size: 12px;
}
.message-item {
    display: flex;
    margin-bottom: 18px;
    align-items: flex-start;
    gap: 10px;
}
.message-item.mine { flex-direction: row-reverse; }
.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    color: #f5b544;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.message-item.mine .msg-avatar { background: linear-gradient(135deg, #f5b544, #ffd88a); color: #0d1526; }
.msg-body { max-width: 65%; }
.msg-sender { font-size: 12px; color: #9db4dd; margin-bottom: 4px; font-weight: 600; }
.message-item.mine .msg-sender { text-align: right; color: rgba(255,255,255,0.85); }
.msg-bubble {
    display: inline-block;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 4px 14px 14px 14px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    background: #243050;
    color: #e8edf7;
    border: 1px solid rgba(255,255,255,0.08);
    position: relative;
}
.msg-bubble .msg-content { margin-top: 2px; }
.msg-bubble.msg-image .msg-sender { margin-bottom: 6px; }
.chat-img-preview { cursor: pointer; max-width: 220px; max-height: 220px; border-radius: 6px; }
/* Markdown 富文本转发的图片：宽度占满消息气泡，高度按比例自适应，不沿用 220px 缩略图限制 */
.chat-md-img { width: 100%; max-width: 100%; height: auto; max-height: none; border-radius: 6px; display: block; margin: 4px 0; box-sizing: border-box; cursor: zoom-in; }
.msg-bubble.msg-emoji { font-size: 28px; padding: 6px 10px; }
.message-item.mine .msg-body { text-align: right; }
.message-item.mine .msg-bubble {
    background: linear-gradient(135deg, #8a9bb0, #2c5f8a);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px 14px 4px 14px;
    text-align: left;
}
.msg-time { font-size: 11px; color: rgba(232,237,247,0.55); margin-top: 4px; }
.message-item.mine .msg-time { text-align: right; color: rgba(232,237,247,0.55); }
.msg-loading-more { text-align: center; padding: 10px; color: #999; font-size: 12px; }

/* 输入区域 */
.chat-input-area {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 12px 20px;
    flex-shrink: 0;
}
.input-tools { margin-bottom: 8px; }
.input-hint { font-size: 12px; color: #bbb; }
.chat-input-area textarea {
    width: 100%;
    min-height: 60px;
    max-height: 150px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s;
}
.chat-input-area textarea:focus { border-color: #f5b544; box-shadow: 0 0 0 2px rgba(201,169,97,0.15); }
.input-actions { text-align: right; margin-top: 10px; }

/* ============================================================
   弹窗
   ============================================================ */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-content {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-header {
    padding: 5px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #0d1526 0%, #1b2c49 100%);
}
.modal-header h3 { color: #f5b544; font-size: 17px; }
.modal-close {
    background: transparent;
    border: none;
    color: #f5b544;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-body p { color: #666; margin-bottom: 15px; font-size: 13px; line-height: 1.6; }
.code-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    background: #f8f9fb;
    margin-bottom: 15px;
    resize: vertical;
}
.link-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 15px;
    background: #f8f9fb;
}
.embed-preview { margin-top: 20px; padding-top: 20px; border-top: 1px solid #f0f0f0; }
.embed-preview h4 { color: #0d1526; margin-bottom: 12px; font-size: 14px; }
.preview-box { padding: 20px; background: #f8f9fb; border-radius: 6px; text-align: center; }
.share-tip { font-size: 12px; color: #999; margin-top: 15px !important; }

/* ============================================================
   后台管理
   ============================================================ */
.admin-body { background: #f0f2f5; min-height: 100vh; }
.admin-header {
    height: 56px;
    background: linear-gradient(135deg, #0d1526 0%, #070c17 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.admin-header-left { display: flex; align-items: center; gap: 12px; }
.admin-logo { width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(245,181,68,.55); object-fit: contain; background: #0d1526; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.admin-title { color: #f5b544; font-size: 17px; font-weight: 600; }
.admin-header-right { display: flex; align-items: center; gap: 20px; }
.admin-nav-link { color: #fff; font-size: 14px; }
.admin-nav-link:hover { color: #f5b544; }
.admin-user { color: #f5b544; font-size: 14px; }
.admin-logout { color: #fff; font-size: 13px; opacity: 0.8; }
.admin-logout:hover { opacity: 1; color: #f5b544; }

.admin-container { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* 统计卡片 */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid #0d1526;
}
.stat-card.stat-warning { border-left-color: #f5222d; }
.stat-icon { font-size: 32px; }
.stat-value { font-size: 26px; font-weight: 700; color: #0d1526; }
.stat-label { font-size: 13px; color: #999; margin-top: 2px; }

/* 面板 */
.admin-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 24px;
}
.panel-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h3 { color: #0d1526; font-size: 16px; white-space: nowrap; }
.panel-tip { color: #999; font-size: 12px; }
.panel-body { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.search-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-form input { padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; width: 200px; }

/* 表格 */
.admin-table { width: 100%; min-width: 100%; border-collapse: collapse; table-layout: auto; }
.admin-table th {
    background: #f8f9fb;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    letter-spacing: 0.2px;
    color: #8a94a6;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 2px solid #e8e8e8;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.admin-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; font-size: 13px; color: #333; vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tr:hover { background: #fafbfc; }
.admin-table tr.has-unread { background: #fff8f0; }
.admin-table tr.has-unread:hover { background: #fff3e6; }
.table-user { display: flex; align-items: center; gap: 8px; }
.table-user > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.table-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    color: #f5b544;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.table-avatar img { width: 100%; height: 100%; object-fit: cover; }
.last-msg { color: #666; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-red { background: #fff2f0; color: #f5222d; }
.badge-green { background: #f6ffed; color: #52c41a; }
.badge-gray { background: #f5f5f5; color: #999; }

/* ===== 列表信息防乱通用工具 ===== */
.cell-nowrap { white-space: nowrap; }
.cell-muted { color: #999; }
.cell-center { text-align: center; }
.cell-time { white-space: nowrap; color: #999; font-size: 12px; }
.cell-ellipsis { display: inline-block; max-width: 160px; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-ellipsis-sm { max-width: 110px; }
/* 操作按钮区：整齐排列、统一间距、不撑乱行高 */
.cell-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; white-space: nowrap; }
.cell-actions form { margin: 0; }
.cell-actions .btn { white-space: nowrap; }
/* 徽章+小操作上下两行 */
.cell-stack { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* 用户管理：列最多，固定列宽保证一屏不溢出、长文本省略 */
.users-table { table-layout: fixed; font-size: 10px; }
.users-table th, .users-table td { overflow: hidden; padding: 6px 7px; font-size: 10px; }
.users-table th { white-space: nowrap; }
.users-table .cell-time, .users-table .cell-muted { font-size: 9px; }
.users-table .badge { font-size: 9px; padding: 2px 5px; }
.users-table .cell-actions .btn, .users-table .btn-small { padding: 2px 7px; font-size: 10px; }
.users-table .remark-input { width: 100%; box-sizing: border-box; font-size: 10px; height: 26px; }
.users-table .cell-ellipsis { max-width: 100%; }
.users-table .cell-actions { overflow: visible; }
.users-table .cell-actions .btn { padding: 3px 8px; }
.users-table td.col-actions-cell { overflow: visible; }
.users-table .cell-stack[style*="min-width"] { min-width: 0 !important; }
.users-table .table-user > span:last-child { max-width: 100px; }

/* 分页 */
.pagination { padding: 16px 24px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 15px; }
.page-link { padding: 6px 14px; border: 1px solid #ddd; border-radius: 4px; color: #0d1526; font-size: 13px; }
.page-link:hover { border-color: #f5b544; color: #f5b544; }
.page-info { color: #999; font-size: 13px; }

/* 后台聊天布局 */
.admin-chat-container { display: flex; height: calc(100vh - 56px); }
.admin-chat-sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 24px;
    flex-shrink: 0;
    overflow-y: auto;
}
.customer-info-card { text-align: center; margin-bottom: 24px; }
.customer-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    color: #f5b544;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    margin: 0 auto 15px;
    overflow: hidden;
}
.customer-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.customer-name { color: #0d1526; font-size: 18px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.customer-email { color: #999; font-size: 13px; }
.customer-detail { border-top: 1px solid #f0f0f0; padding-top: 20px; }
.detail-item { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; }
.detail-label { color: #999; }
.detail-value { color: #333; font-weight: 500; }
.admin-chat-main { flex: 1; display: flex; flex-direction: column; background: #f0f2f5; min-width: 0; }

/* ============================================================
   响应式 - 平板
   ============================================================ */
@media (max-width: 992px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .conversation-list { width: 260px; }
    .admin-chat-sidebar { width: 220px; padding: 16px; }
}

/* ============================================================
   响应式 - 手机
   ============================================================ */
@media (max-width: 768px) {
    .chat-header { padding: 0 12px; }
    .header-title { font-size: 15px; }
    .user-name { display: none; }
    .icon-btn { width: 32px; height: 32px; font-size: 14px; }

    .chat-container { position: relative; }
    .conversation-list {
        position: absolute;
        left: 0; top: 0; bottom: 0;
        width: 85%;
        max-width: 320px;
        z-index: 5;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.15);
    }
    .conversation-list.show { transform: translateX(0); }

    .stats-row { grid-template-columns: 1fr; gap: 12px; }
    .admin-container { padding: 12px; }
    .admin-header { padding: 0 12px; }
    .admin-title { font-size: 14px; }
    .admin-header-right { gap: 10px; }
    .admin-nav-link { font-size: 13px; }

    .admin-chat-container { flex-direction: column; overflow: hidden; }
    .admin-chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 12px;
        max-height: 120px;
        flex-shrink: 0;
        overflow-y: auto;
    }
    .admin-chat-main { min-height: 0; overflow: hidden; }
    .customer-avatar-large { width: 48px; height: 48px; font-size: 20px; margin-bottom: 8px; }
    .customer-name { font-size: 15px; }
    .customer-detail { display: none; }

    .admin-table { font-size: 12px; }
    .admin-table th, .admin-table td { padding: 8px; }
    .search-form input { width: 120px; }

    .msg-body { max-width: 90%; }
    .msg-bubble { max-width: 100%; }
    .chat-messages { padding: 12px; }
    .chat-input-area { padding: 10px 12px; flex-shrink: 0; }

    .auth-card { padding: 30px 20px; }
    .modal-content { max-width: 100%; }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ============================================================
   工具栏按钮（表情/图片）
   ============================================================ */
.input-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px 6px 4px;
}
.input-tool-btns {
    display: flex;
    gap: 8px;
}
.tool-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.tool-btn:hover {
    background: #f0f4f8;
}

/* ============================================================
   表情面板
   ============================================================ */
.emoji-panel {
    position: absolute;
    bottom: 100%;
    left: 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    padding: 10px;
    width: 320px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}
.emoji-item {
    font-size: 22px;
    text-align: center;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}
.emoji-item:hover {
    background: #f0f4f8;
}

/* ============================================================
   图片消息
   ============================================================ */
.msg-image {
    padding: 4px;
    background: #243050;
    border: 1px solid rgba(255,255,255,0.08);
}
.msg-image img {
    max-width: 250px;
    max-height: 250px;
    border-radius: 6px;
    display: block;
    cursor: pointer;
}
.message-item.mine .msg-image {
    background: linear-gradient(135deg, #8a9bb0, #2c5f8a);
    border: 1px solid rgba(255,255,255,0.12);
}

/* ============================================================
   表情消息
   ============================================================ */
.msg-emoji {
    font-size: 48px;
    background: transparent !important;
    padding: 4px !important;
    box-shadow: none !important;
}

/* ============================================================
   策略消息卡片
   ============================================================ */
.strategy-card {
    max-width: 420px;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 12px !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
}
.strategy-card .msg-sender {
    padding: 10px 12px 4px;
    margin-bottom: 0;
}
.strategy-header {
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
.strategy-publisher {
    display: flex;
    align-items: center;
    gap: 8px;
}
.strategy-publisher-name {
    font-weight: 600;
    font-size: 14px;
}

.news-header {
    padding: 6px 12px;
    background: linear-gradient(135deg, #0d1526 0%, #8a9bb0 100%);
    color: #fff;
    border-radius: 8px 8px 0 0;
    margin: -8px -8px 8px -8px;
}
.news-tag {
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.strategy-tag {
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.strategy-images {
    padding: 0;
}
.strategy-img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    cursor: pointer;
    display: block;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
}
.strategy-title {
    padding: 10px 12px 4px;
    font-size: 15px;
    font-weight: 600;
    color: #e8edf7;
    line-height: 1.4;
}
.strategy-content {
    padding: 4px 12px;
    font-size: 13px;
    color: rgba(232,237,247,0.85);
    line-height: 1.6;
    word-break: break-word;
}
.strategy-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px 0;
    border-radius: 6px;
}
.strategy-content p {
    margin: 0 0 8px;
}
.strategy-content a {
    color: #7db0ff;
    text-decoration: underline;
}
.strategy-contact {
    padding: 8px 12px;
    font-size: 12px;
    color: rgba(232,237,247,0.6);
    border-top: 1px solid rgba(255,255,255,0.10);
    margin-top: 4px;
}
.strategy-footer {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border-top: 1px solid rgba(255,255,255,0.10);
}
.strategy-time {
    font-size: 11px;
    color: rgba(232,237,247,0.55);
}
.strategy-actions {
    display: flex;
    gap: 12px;
}
.strategy-edit-btn,
.strategy-delete-btn {
    font-size: 12px;
    color: #1a5fb4;
    cursor: pointer;
}
.strategy-delete-btn {
    color: #e74c3c;
}
.strategy-edit-btn:hover,
.strategy-delete-btn:hover {
    text-decoration: underline;
}

/* 策略图片上传预览 */
.strategy-img-upload-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}
.strategy-img-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.strategy-img-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
}
.strategy-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.strategy-img-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    font-size: 14px;
    cursor: pointer;
}

/* 富文本编辑器 */
.strategy-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}
.editor-btn {
    padding: 4px 10px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    min-width: 32px;
}
.editor-btn:hover {
    background: #e8f0fe;
    border-color: #1a5fb4;
}
.editor-select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    height: 28px;
}
.editor-select:hover {
    border-color: #1a5fb4;
}
.editor-color {
    width: 28px;
    height: 28px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
}
.editor-color:hover {
    border-color: #1a5fb4;
}
.strategy-editor {
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    background: #fff;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
}
.strategy-editor:focus {
    border-color: #1a5fb4;
    box-shadow: 0 0 0 2px rgba(26, 95, 180, 0.1);
}
.strategy-editor:empty:before {
    content: attr(placeholder);
    color: #999;
}
.strategy-editor p {
    margin: 0 0 8px;
}
.strategy-editor ul, .strategy-editor ol {
    margin: 0 0 8px;
    padding-left: 24px;
}
.strategy-editor a {
    color: #1a5fb4;
    text-decoration: underline;
}

/* ============================================================
   撤回消息
   ============================================================ */
.msg-bubble.msg-revoked {
    color: rgba(232,237,247,0.55) !important;
    font-style: italic;
    background: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.10) !important;
    font-size: 13px;
}
.msg-revoke-btn {
    color: #1a5fb4;
    cursor: pointer;
    font-size: 12px;
    margin-left: 8px;
}
.msg-revoke-btn:hover {
    text-decoration: underline;
}
.msg-read {
    color: #3f9c5b;
    font-weight: 700;
    margin-left: 6px;
    font-size: 12px;
    line-height: 1;
}

/* 聊天输入区域相对定位（表情面板定位用） */
.chat-input-area {
    position: relative;
}

/* 官方客服标识 */
.official-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f5b544, #e8d5a3);
    color: #0d1526;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: bold;
    vertical-align: middle;
    margin-left: 4px;
}
.badge-gold {
    background: linear-gradient(135deg, #f5b544, #e8d5a3);
    color: #0d1526;
}

/* 语言选择器 */
.lang-selector {
    display: inline-block;
    margin-right: 10px;
}
.lang-selector select {
    padding: 5px 10px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    background: #fff;
    color: #0d1526;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}
.lang-selector select:hover {
    border-color: #f5b544;
}
.lang-selector-label {
    display: inline-block;
    margin-right: 6px;
    font-size: 13px;
    color: #0d1526;
    vertical-align: middle;
    font-weight: 500;
}

/* 图形验证码 */
.captcha-group {
    display: flex;
    gap: 10px;
    align-items: center;
}
.captcha-img {
    width: 100px;
    height: 38px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
}

/* ============================================================
   好友系统样式
   ============================================================ */
.conv-tabs {
    display: flex;
    border-bottom: 1px solid #e8ecf1;
    background: #f8f9fb;
}
.conv-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #6b7c93;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}
.conv-tab:hover {
    color: #0d1526;
}
.conv-tab.active {
    color: #0d1526;
    border-bottom-color: #f5b544;
    font-weight: 600;
}
.friend-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    background: #e74c3c;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    margin-left: 4px;
    text-align: center;
}
.conv-tab-content {
    display: none;
}
.conv-tab-content.active {
    display: block;
}
.friend-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}
.friend-search-result {
    max-height: 300px;
    overflow-y: auto;
}
.friend-search-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f2f5;
    gap: 10px;
}
.friend-search-item:hover {
    background: #f8f9fb;
}
.friend-search-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #2c5f8a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}
.friend-search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.friend-search-info {
    flex: 1;
    min-width: 0;
}
.friend-search-name {
    font-weight: 600;
    color: #0d1526;
    font-size: 14px;
}
.friend-search-email {
    font-size: 12px;
    color: #8a9bb0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.friend-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    gap: 10px;
    transition: background 0.2s;
}
.friend-item:hover {
    background: #f0f4f8;
}
.friend-item-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #2c5f8a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}
.friend-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.friend-item-info {
    flex: 1;
    min-width: 0;
}
.friend-item-name {
    font-weight: 600;
    color: #0d1526;
    font-size: 14px;
}
.friend-item-email {
    font-size: 12px;
    color: #8a9bb0;
}
.friend-requests {
    border-bottom: 1px solid #e8ecf1;
    background: #fff8e7;
}
.friend-requests-title {
    padding: 8px 15px;
    font-size: 12px;
    color: #f5b544;
    font-weight: 600;
    background: #fef5e0;
}
.friend-request-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f0e6d0;
    gap: 10px;
}
.friend-request-actions {
    display: flex;
    gap: 6px;
}
.friend-request-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
}

/* 好友列表项 */
.friend-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d1526, #2c5f8a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}
.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.friend-info {
    flex: 1;
    min-width: 0;
}
.friend-name {
    font-weight: 600;
    color: #0d1526;
    font-size: 14px;
}
.friend-email {
    font-size: 12px;
    color: #8a9bb0;
}

/* 搜索结果 */
.search-user-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f2f5;
    gap: 10px;
}
.search-user-item:hover {
    background: #f8f9fb;
}
.search-user-info {
    flex: 1;
    min-width: 0;
}
.search-user-name {
    font-weight: 600;
    color: #0d1526;
    font-size: 14px;
}
.search-user-email {
    font-size: 12px;
    color: #8a9bb0;
}
.search-user-action {
    flex-shrink: 0;
}
.relation-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f0e8;
    color: #2d7a2d;
    border-radius: 4px;
    font-size: 12px;
}
.btn-add-friend {
    padding: 5px 12px;
    background: linear-gradient(135deg, #0d1526, #2c5f8a);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-add-friend:hover {
    background: linear-gradient(135deg, #2c5f8a, #0d1526);
}
.btn-add-friend:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 好友请求 */
.friend-request-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5b544, #d4b87a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.friend-request-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.friend-request-info {
    flex: 1;
    min-width: 0;
}
.friend-request-name {
    font-weight: 600;
    color: #0d1526;
    font-size: 13px;
}
.friend-request-email {
    font-size: 11px;
    color: #8a9bb0;
}
.btn-accept {
    padding: 4px 10px;
    background: #2d7a2d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-accept:hover {
    background: #236b23;
}
.btn-reject {
    padding: 4px 10px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-reject:hover {
    background: #a93226;
}

/* 好友系统 */
.conv-tabs {
    display: flex;
    border-bottom: 1px solid #e1e4e8;
    background: #fff;
}
.conv-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #586069;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}
.conv-tab:hover {
    color: #0d1526;
}
.conv-tab.active {
    color: #0d1526;
    border-bottom-color: #f5b544;
    font-weight: 600;
}
.friend-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    background: #d73a49;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    margin-left: 4px;
    text-align: center;
}
.friend-requests {
    border-bottom: 1px solid #e1e4e8;
    padding: 8px 12px;
    background: #fff8e1;
}
.friend-requests-title {
    font-size: 12px;
    color: #b08800;
    margin-bottom: 8px;
    font-weight: 600;
}
.friend-request-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.friend-request-item:last-child {
    border-bottom: none;
}
.friend-request-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0d1526;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-right: 10px;
    overflow: hidden;
}
.friend-request-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.friend-request-info {
    flex: 1;
    min-width: 0;
}
.friend-request-name {
    font-size: 13px;
    color: #24292e;
    font-weight: 500;
}
.friend-request-email {
    font-size: 11px;
    color: #959da5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.friend-request-actions {
    display: flex;
    gap: 6px;
}
.friend-request-actions button {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.btn-accept {
    background: #28a745;
    color: #fff;
}
.btn-reject {
    background: #d73a49;
    color: #fff;
}
.friend-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f6f8fa;
    transition: background 0.2s;
}
.friend-item:hover {
    background: #f6f8fa;
}
.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0d1526;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 12px;
    overflow: hidden;
    flex-shrink: 0;
}
.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.friend-info {
    flex: 1;
    min-width: 0;
}
.friend-name {
    font-size: 14px;
    color: #24292e;
    font-weight: 500;
}
.friend-email {
    font-size: 12px;
    color: #959da5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.friend-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.friend-search-box .link-input {
    flex: 1;
}
.friend-search-result {
    max-height: 300px;
    overflow-y: auto;
}
.search-user-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.search-user-item:last-child {
    border-bottom: none;
}
.search-user-info {
    flex: 1;
    min-width: 0;
}
.search-user-name {
    font-size: 14px;
    color: #24292e;
    font-weight: 500;
}
.search-user-email {
    font-size: 12px;
    color: #959da5;
}
.search-user-action {
    flex-shrink: 0;
}
.btn-add-friend {
    padding: 5px 12px;
    font-size: 12px;
    background: #0d1526;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.btn-add-friend:disabled {
    background: #959da5;
    cursor: not-allowed;
}
.relation-tag {
    font-size: 11px;
    color: #28a745;
    font-weight: 500;
}
.auth-page-lang {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
}
.auth-page-lang select {
    padding: 8px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
    color: #0d1526;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 140px;
}
@media (max-width: 480px) {
    .auth-page-lang {
        top: 10px;
        right: 10px;
    }
    .auth-page-lang select {
        padding: 6px 8px;
        font-size: 12px;
        max-width: 110px;
    }
}

/* ============================================================
   移动端菜单按钮
   ============================================================ */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #f5b544;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 8px;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: inline-block;
    }
    .chat-header {
        padding: 0 10px;
        height: 50px;
    }
    .header-title {
        display: none;
    }
    .header-right {
        gap: 6px;
    }
    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .user-name {
        display: none;
    }
    .logout-link {
        font-size: 12px;
    }
    /* 聊天页面header的语言选择器 */
    .chat-header .lang-selector {
        font-size: 12px;
        padding: 0;
    }
    /* 登录/注册/找回密码页面的语言选择器保持右上角样式 */
    .auth-page-lang {
        top: 5px;
        right: 8px;
    }
    .auth-page {
        padding-top: 55px;
    }
    .auth-page-lang .lang-selector select {
        font-size: 11px;
        padding: 4px 22px 4px 8px;
        max-width: 100px;
    }
    .conversation-list {
        position: absolute;
        left: 0; top: 0; bottom: 0;
        width: 85%;
        max-width: 300px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.15);
        background: #fff;
    }
    .conversation-list.show {
        transform: translateX(0);
    }
    .chat-area {
        width: 100%;
    }
    .chat-container {
        height: calc(100vh - 50px);
        overflow: hidden;
    }
    .chat-main {
        height: 100%;
        overflow: hidden;
    }
    .chat-topbar { min-width: 0;
        height: 48px;
        padding: 0 12px;
        justify-content: space-between;
    }
    .msg-body {
        max-width: 90%;
    }
    .msg-bubble {
        max-width: 100%;
    }
    .chat-messages {
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        padding-bottom: 10px;
    }
    .chat-input-area {
        flex-shrink: 0;
        padding: 8px 12px;
    }
    .chat-input-area textarea {
        min-height: 44px;
        max-height: 250px;
    }
    .emoji-panel {
        width: 280px;
        left: 8px;
    }
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    .msg-image img {
        max-width: 180px;
        max-height: 180px;
    }
    .input-hint {
        display: none;
    }
    .tool-btn {
        font-size: 22px;
        padding: 6px 10px;
    }
    #sendBtn {
        padding: 8px 14px;
        font-size: 15px;
    }
    #messageInput {
        font-size: 15px;
        min-height: 40px;
    }
    .msg-bubble {
        max-width: 100%;
    }
}

/* ============================================================
   后台管理员管理页面样式
   ============================================================ */
.admin-form-inline {
    width: 100%;
}
.form-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}
.form-item-inline {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
}
.form-item-inline label {
    font-size: 13px;
    color: #586069;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-input-inline {
    padding: 8px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-input-inline:focus {
    border-color: #0d1526;
    box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}
.form-item-btn {
    flex: 0 0 auto;
    min-width: auto;
}
.btn-add-admin {
    padding: 8px 24px;
    font-size: 14px;
    white-space: nowrap;
}
.nickname-input {
    transition: border-color 0.2s;
}
.nickname-input:focus {
    border-color: #f5b544;
    box-shadow: 0 0 0 3px rgba(201,169,97,0.15);
    outline: none;
}
.btn-save-nickname {
    margin-left: 6px;
    padding: 5px 12px;
    font-size: 12px;
}

/* 确保Tab按钮在所有环境下样式正确 */
.conversation-list .conv-tabs {
    flex-shrink: 0;
}
.conversation-list .conv-tab {
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.conversation-list .conv-tab:focus {
    outline: none;
}

/* ============================================================
   密码相关样式
   ============================================================ */
.code-input-group {
    display: flex;
    gap: 8px;
}
.code-input-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}
.code-input-group input:focus {
    border-color: #0d1526;
    box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}
.btn-code {
    white-space: nowrap;
    padding: 10px 16px;
    font-size: 13px;
}
.forgot-link {
    color: #0d1526;
    text-decoration: none;
    font-size: 13px;
}
.forgot-link:hover {
    text-decoration: underline;
    color: #f5b544;
}
.modal-body .form-group {
    margin-bottom: 15px;
}
.modal-body .form-group label {
    display: block;
    font-size: 13px;
    color: #586069;
    margin-bottom: 6px;
    font-weight: 500;
}
.modal-body .form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.modal-body .form-group input:focus {
    border-color: #0d1526;
    box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}

/* 后台客户备注输入框 */
.remark-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 12px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
.remark-input:focus {
    border-color: #0d1526;
    box-shadow: 0 0 0 2px rgba(26,58,92,0.1);
}

/* ============================================================
   超低分辨率手机（480px以下）优化
   ============================================================ */
@media (max-width: 480px) {
    .chat-header {
        padding: 0 8px;
        height: 48px;
    }
    .header-logo {
        display: none;
    }
    .header-left {
        gap: 6px;
    }
    .header-right {
        gap: 4px;
    }
    .icon-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .user-name {
        display: none;
    }
    .logout-link {
        font-size: 11px;
    }
    .chat-header .lang-selector select {
        font-size: 10px;
        padding: 3px 0px 3px 6px;
    }
    .chat-container {
        height: calc(100vh - 48px);
    }
    .chat-messages {
        padding: 12px;
    }
    .message-item {
        margin-bottom: 12px;
        gap: 6px;
    }
    .msg-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    .msg-body {
        max-width: 90%;
    }
    .msg-bubble {
        max-width: 100%;
        font-size: 13px;
        padding: 8px 12px;
    }
    .chat-input-area {
        padding: 6px 8px;
    }
    .chat-input-area textarea {
        min-height: 38px;
        max-height: 250px;
        font-size: 13px;
    }
    #sendBtn {
        padding: 8px 14px;
        font-size: 13px;
    }
    .auth-card {
        padding: 25px 20px;
    }
    .auth-logo {
        width: 48px;
        height: 48px;
    }
    .auth-header h1 {
        font-size: 18px;
    }
}
 
  
/* Allow text selection and copy in chat */
.chat-messages,.chat-main{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;-webkit-touch-callout:default}
#messageInput,input,textarea{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}  
.watermark-layer{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;z-index:1;overflow:hidden;opacity:0.06}  
.watermark-layer span{position:absolute;white-space:nowrap;font-size:14px;color:#000;transform:rotate(-30deg)}  
.screenshot-warning{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:rgba(0,0,0,0.85);color:#fff;padding:20px 40px;border-radius:8px;font-size:16px;z-index:99999;display:none;text-align:center}  
.screenshot-warning.show{display:block;animation:fadeInOut 2s ease-in-out}  
@keyframes fadeInOut{0%{opacity:0}20%{opacity:1}80%{opacity:1}100%{opacity:0}}

/* ===== 输入栏UI优化 ===== */
.chat-input-area {
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.input-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.input-hint { font-size: 11px; color: #bbb; }
.input-tool-btns { display: flex; gap: 4px; }
.tool-btn {
    width: 32px; height: 32px;
    background: none; border: none;
    font-size: 18px; cursor: pointer;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.tool-btn:hover { background: #f0f2f5; }
.chat-input-area textarea {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-area textarea:focus {
    border-color: #f5b544;
    box-shadow: 0 0 0 3px rgba(201,169,97,0.12);
    outline: none;
}
.input-actions { text-align: right; margin-top: 8px; }
.send-btn {
    background: linear-gradient(135deg, #0d1526 0%, #1b2c49 100%);
    color: #fff;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.send-btn:hover { opacity: 0.9; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 手机端语言切换优化 ===== */
@media (max-width: 768px) {
    .auth-page-lang {
        top: 8px;
        right: 8px;
    }
    .auth-page-lang select {
        padding: 5px 8px;
        font-size: 11px;
        max-width: 90px;
        border-radius: 4px;
    }
    .chat-header .lang-selector {
        max-width: 90px;
    }
    .chat-header .lang-selector select {
        font-size: 10px;
        padding: 3px 0px 3px 5px;
        max-width: 73px;
    }
}

/* ===== 群聊撤回按钮 ===== */
.group-revoke-btn {
    color: #0d1526;
    cursor: pointer;
    font-size: 11px;
    margin-left: 8px;
}
.group-revoke-btn:hover { text-decoration: underline; }

/* ===== 群系统消息 ===== */
.group-system-msg {
    text-align: center;
    margin: 16px auto;
    padding: 0 16px;
    background: none;
    border-radius: 0;
    font-size: 12px;
    color: #999;
    display: block;
    width: fit-content;
    max-width: 80%;
    clear: both;
}
.group-msg-sender {
    font-size: 12px;
    color: #576b95;
    margin-bottom: 3px;
    font-weight: 600;
}
.at-all-tag {
    color: #f5b544;
    font-weight: 600;
}
.muted-tip {
    text-align: center;
    padding: 8px;
    background: #fff3cd;
    color: #856404;
    font-size: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* ===== 新版输入框布局 ===== */
.chat-input-area {
    background: #fff !important;
    border-top: 1px solid #e8e8e8 !important;
    padding: 8px 12px !important;
    flex-shrink: 0;
}
.chat-input-area .input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}
.chat-input-area .input-row textarea {
    flex: 1 1 auto;
    min-height: 36px !important;
    max-height: 256px;
    padding: 7px 14px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 18px !important;
    resize: none !important;
    font-size: 14px !important;
    line-height: 20px !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: border-color 0.2s !important;
    overflow-y: hidden;
}
.chat-input-area .input-row textarea:focus {
    border-color: #f5b544 !important;
    box-shadow: 0 0 0 2px rgba(201,169,97,0.12) !important;
}
.chat-input-area .input-row .tool-btn {
    width: 34px !important;
    height: 34px !important;
    flex-shrink: 0 !important;
    background: none !important;
    border: none !important;
    font-size: 20px !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
    padding: 0 !important;
    line-height: 1 !important;
}
.chat-input-area .input-row .tool-btn:hover {
    background: #f0f2f5 !important;
}
.chat-input-area .input-send-btn {
    background: transparent !important;
    color: #3390ec !important;
    border: none !important;
    width: 36px !important;
    height: 33px !important;
    border-radius: 50% !important;
    font-size: 14px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
    padding: 0 !important;
}
.chat-input-area .input-send-btn:hover { background: #e8f0fe !important; }
.chat-input-area .input-send-btn:active { background: #d2e3fc !important; }
.chat-input-area .input-send-btn:disabled { opacity: 0.5 !important; cursor: not-allowed !important; }
.chat-input-area .input-send-btn svg { display: block; margin-left: 1px; }
.chat-input-area .input-send-btn .send-spinner {
    animation: send-spin 0.8s linear infinite;
    margin-left: 0;
    color: #999 !important;
}
@keyframes send-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 电脑端默认顺序：图片 | 输入框 | 表情 | @ | 发送 */
.chat-input-area .input-img-btn { order: 1; }
.chat-input-area .input-row textarea { order: 2; }
.chat-input-area .input-emoji-btn { order: 3; }

/* ============================================================
   自定义弹窗组件（替代浏览器alert）
   ============================================================ */
.mzl-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    max-width: 80%;
    text-align: center;
    word-break: break-word;
    animation: mzl-toast-in 0.2s ease-out;
    pointer-events: none;
}
@keyframes mzl-toast-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.mzl-toast.hide {
    animation: mzl-toast-out 0.2s ease-in forwards;
}
@keyframes mzl-toast-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 确认弹窗 */
.mzl-modal-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mzl-fade-in 0.2s ease-out;
}
@keyframes mzl-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.mzl-modal {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    z-index: 99999;
    background: #fff;
    border-radius: 12px;
    width: 300px;
    max-width: 85%;
    overflow: hidden;
    animation: mzl-modal-in 0.25s cubic-bezier(.22,.8,.36,1);
}
@keyframes mzl-modal-in {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.mzl-modal-title {
    padding: 18px 20px 8px;
    font-size: 16px;
    font-weight: 600;
    color: #0d1526;
    text-align: center;
}
.mzl-modal-content {
    padding: 0 20px 20px;
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.6;
    word-break: break-word;
}
.mzl-modal-btns {
    display: flex;
    border-top: 1px solid #f0f0f0;
}
.mzl-modal-btn {
    flex: 1;
    padding: 14px 0;
    font-size: 15px;
    border: none;
    background: none;
    cursor: pointer;
    transition: background 0.2s;
}
.mzl-modal-btn:active { background: #f5f5f5; }
.mzl-modal-btn.cancel {
    color: #999;
    border-right: 1px solid #f0f0f0;
}
.mzl-modal-btn.confirm {
    color: #0d1526;
    font-weight: 600;
}
.mzl-modal-btn.confirm.danger { color: #f56c6c; }

/* 手机端适配 */
@media (max-width: 768px) {
    .mzl-modal { width: 280px; }
    .mzl-toast { padding: 12px 20px; font-size: 13px; }
}
.chat-input-area .input-row #atAllBtn { order: 4; display: none !important; }
.chat-input-area .input-row #atAllBtn.show { display: flex !important; }
.chat-input-area .input-send-btn { order: 5; }

/* 手机端顺序：表情 | 输入框 | 图片 | @ | 发送 */
@media (max-width: 768px) {
    .chat-input-area {
        padding: 5px 6px !important;
    }
    .chat-input-area .input-row {
        gap: 3px !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .chat-input-area .input-emoji-btn { order: 1 !important; }
    .chat-input-area .input-row textarea { order: 2 !important; }
    .chat-input-area .input-img-btn { order: 3 !important; }
    .chat-input-area .input-row #atAllBtn { order: 4 !important; }
    .chat-input-area .input-send-btn { order: 5 !important; }
    .chat-input-area .input-row .tool-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 15px !important;
        min-width: 28px !important;
        flex-shrink: 0 !important;
    }
    .chat-input-area .input-send-btn {
        width: 36px !important;
        height: 30px !important;
        min-width: 36px !important;
        flex-shrink: 0 !important;
        background: transparent !important;
        color: #3390ec !important;
    }
    .chat-input-area .input-send-btn:hover { background: #e8f0fe !important; }
    .chat-input-area .input-send-btn svg {
        width: 20px !important;
        height: 20px !important;
    }
    .chat-input-area .input-send-btn svg {
        width: 20px !important;
        height: 20px !important;
    }
    .chat-input-area .input-row textarea {
        min-height: 30px !important;
        max-height: 250px !important;
        padding: 4px 10px !important;
        font-size: 13px !important;
        line-height: 20px !important;
        border-radius: 15px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: auto !important;
    }
}  

/* 语言切换按钮 - 高优先级 */
div.lang-selector { position: relative; display: inline-block; z-index: 9999; }
div.lang-selector button.lang-btn {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
    border: 1px solid rgba(201,169,97,0.4) !important;
    padding: 5px 5px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    line-height: 1.4 !important;
    font-family: inherit !important;
    box-shadow: none !important;
    outline: none !important;
}
div.lang-selector button.lang-btn:hover { background: rgba(201,169,97,0.25) !important; }
div.lang-selector div.lang-dropdown {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    background: #fff !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
    min-width: 100px !important;
    z-index: 99999 !important;
    overflow: hidden !important;
}
div.lang-selector:hover div.lang-dropdown { display: block !important; }
div.lang-selector div.lang-dropdown a {
    display: block !important;
    padding: 8px 16px !important;
    color: #333 !important;
    background: #fff !important;
    text-decoration: none !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    border: none !important;
    text-align: left !important;
}
div.lang-selector div.lang-dropdown a:hover { background: #f5f5f5 !important; color: #0d1526 !important; }
/* 白色背景页面 */
.white-bg div.lang-selector button.lang-btn,
.admin-page div.lang-selector button.lang-btn {
    background: #f5f5f5 !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
}
.white-bg div.lang-selector button.lang-btn:hover,
.admin-page div.lang-selector button.lang-btn:hover { background: #e8e8e8 !important; }

/* 聊天消息加载动画 */
.chat-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    min-height: 100px;
}
/* 全局加载旋转动画（聊天界面加载、上拉加载更多共用） */
.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: #0d1526;
    border-radius: 50%;
    animation: chat-spin 0.8s linear infinite;
    margin: 0 auto;
}
.chat-loading .loading-spinner {
    width: 36px;
    height: 36px;
}
@keyframes chat-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   盘语 TAPE 后台 侧边导航抽屉（v2.9 公共组件）
   桌面（后台 EXE）与窄屏（后台 APK）统一：默认隐藏、汉堡唤出
   样式自包含；仅调用 admin_sidenav_hamburger()/panel() 的页面有 DOM
   实时聊天页（chat.php / group_chat.php）不调用，UI 不受影响
   ============================================================ */

/* 顶部汉堡按钮：所有尺寸显示（仅导航页有该元素，聊天页没有，故不影响） */
.admin-hamburger {
    display: flex;
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex: none;
    margin-right: 4px;
    border: none;
    background: none;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    padding: 0;
    transition: background .15s;
}
.admin-hamburger:hover { background: rgba(255,255,255,.14); }
.admin-hamburger:active { background: rgba(255,255,255,.22); }
.admin-hamburger svg {
    width: 23px;
    height: 23px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 遮罩 */
.drawer-mask {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(15,30,50,.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
}
.drawer-mask.show { opacity: 1; visibility: visible; }

/* 抽屉主体（桌面宽 260px，覆盖式从左滑入） */
.side-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 901;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s ease, visibility 0s linear .28s;
    /* 关闭态不投影，避免右侧扩散阴影在 translateX(-100%) 后仍露在屏幕左缘 */
    box-shadow: none;
    visibility: hidden;
    padding-top: env(safe-area-inset-top);
}
.side-drawer.open { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.28); visibility: visible; transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s ease, visibility 0s linear 0s; }
body.drawer-lock { overflow: hidden; }

/* 抽屉头部 */
.drawer-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px;
    background: linear-gradient(135deg, #0d1526 0%, #1b2c49 100%);
    color: #fff;
}
.drawer-logo { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); }
.drawer-head-tx { flex: 1; min-width: 0; }
.drawer-title { font-size: 16px; font-weight: 700; line-height: 1.25; }
.drawer-sub { font-size: 12px; opacity: .82; margin-top: 2px; }
.drawer-close {
    width: 34px;
    height: 34px;
    flex: none;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}
.drawer-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin:round;
}
.drawer-close:hover { background: rgba(255,255,255,.28); }
.drawer-close:active { background: rgba(255,255,255,.34); }

/* 菜单 */
.drawer-nav { flex: 1; overflow-y: auto; padding: 8px 0; background: #fff; }
.drawer-item {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid #f1f4f8;
    background: #fff;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    font-size: 14.5px;
    color: #22303f;
    line-height: 1.2;
    transition: background .15s, color .15s;
}
.drawer-item:hover { background: #f3f7fc; }
.drawer-item:active { background: #eaf1f9; }
.drawer-item.active {
    background: #eef5fc;
    color: #1b2c49;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #1b2c49;
}
.drawer-item.active .drawer-ic { color: #1b2c49; }
.drawer-ic {
    width: 23px;
    height: 23px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a7088;
}
.drawer-ic svg, .drawer-ic-svg {
    width: 21px;
    height: 21px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.drawer-tx { flex: 1; min-width: 0; }
.drawer-chevron {
    width: 17px;
    height: 17px;
    flex: none;
    color: #c2ccd7;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.drawer-danger { margin-top: 6px; border-top: 1px solid #eef1f5; }
.drawer-danger .drawer-ic { color: #dc2626; }
.drawer-danger .drawer-tx { color: #dc2626; }
.drawer-foot {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    font-size: 12px;
    color: #9aa7b4;
    background: #fafbfc;
    border-top: 1px solid #eef1f5;
}

/* 分组小标题（桌面显示，窄屏隐藏） */
.drawer-group {
    display: block;
    padding: 14px 18px 6px;
    font-size: 11.5px;
    color: #9aa7b4;
    letter-spacing: .5px;
    background: #fff;
}

/* 响应式菜单：桌面显示管理项（desktop），窄屏显示移动项（mobile） */
.drawer-mobile { display: none; }
.drawer-desktop { display: flex; }

/* 抽屉内“通知设置”自包含弹窗（drawer.js 动态生成，不依赖 jQuery） */
.drawer-modal-mask {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15,30,50,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.drawer-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 320px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.drawer-modal-head {
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 700;
    color: #0d1526;
    border-bottom: 1px solid #eef1f5;
}
.drawer-modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    font-size: 15px;
    color: #22303f;
    border-bottom: 1px solid #f3f5f8;
    cursor: pointer;
}
.drawer-modal-row input {
    width: 22px;
    height: 22px;
    accent-color: #1b2c49;
    cursor: pointer;
}
.drawer-modal-foot { padding: 12px 18px; text-align: right; }
.drawer-modal-foot button {
    padding: 8px 22px;
    border: none;
    border-radius: 18px;
    background: #1b2c49;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.drawer-modal-foot button:active { background: #0d1526; }

/* ===== 第二期：频道只读条 / 频道广场 / 关联讨论群 ===== */
.group-square-entry {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}
.group-square-entry svg { flex-shrink: 0; }

.channel-readonly-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 1px solid #dbe6f3;
    border-radius: 13px;
    background: linear-gradient(135deg, #f7fafd 0%, #eef5fc 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.channel-readonly-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #f5b544;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    box-shadow: 0 3px 8px rgba(26,58,92,0.16);
}
.channel-readonly-copy { flex: 1; min-width: 0; }
.channel-readonly-title {
    font-size: 13px;
    font-weight: 600;
    color: #0d1526;
    line-height: 1.4;
}
.channel-readonly-desc {
    margin-top: 1px;
    font-size: 12px;
    line-height: 1.45;
    color: #7c8a99;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.channel-discuss-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 32px;
    padding: 0 11px;
    border: 1px solid #c9d9ea;
    border-radius: 17px;
    background: #fff;
    color: #1b2c49;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.channel-discuss-btn:hover { background: #f2f7fd; border-color: #9fbcd9; }
.channel-discuss-btn:active { transform: scale(0.97); }
.channel-discuss-btn:disabled { opacity: 0.58; cursor: default; background: #f5f7fa; border-color: #dfe6ee; color: #8b98a6; }
.channel-discuss-btn:disabled:active { transform: none; }
.channel-discuss-btn svg { flex-shrink: 0; }
.channel-discuss-btn span { line-height: 1; }

.gs-linked-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid #e4ebf3;
    border-radius: 8px;
    background: #f8fafc;
}
.gs-linked-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #0d1526;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.square-modal-content {
    position: relative;
    max-width: 660px !important;
    max-height: 86vh !important;
    padding: 0 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    background: #fff !important;
}
.square-hero {
    position: relative;
    padding: 20px 24px 18px;
    background: linear-gradient(135deg, #132f4c 0%, #1f4a78 62%, #1b2c49 100%);
    color: #fff;
    overflow: hidden;
}
.square-hero::after {
    content: "";
    position: absolute;
    right: -42px;
    top: -56px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    border: 1px solid rgba(201,169,97,0.34);
    box-shadow: 0 0 0 18px rgba(201,169,97,0.06);
    pointer-events: none;
}
.square-hero-copy { position: relative; z-index: 1; padding-right: 34px; }
.square-hero-eyebrow {
    font-size: 10px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: #d8c48f;
    margin-bottom: 4px;
}
.square-hero h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
}
.square-hero p {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.55;
    color: #c9d8e8;
    max-width: 430px;
}
.square-close {
    position: absolute;
    z-index: 2;
    right: 14px;
    top: 12px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.86);
    font-size: 20px;
    line-height: 28px;
    cursor: pointer;
    transition: background 0.18s ease;
}
.square-close:hover { background: rgba(255,255,255,0.22); }

.square-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid #eef1f5;
    background: #fff;
}
.square-search-box {
    flex: 1;
    min-width: 0;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid #e1e7ef;
    border-radius: 10px;
    background: #f7f9fc;
    color: #8d99a6;
    transition: border-color 0.18s ease, background 0.18s ease;
}
.square-search-box:focus-within { border-color: #f5b544; background: #fff; }
.square-search-box svg { flex-shrink: 0; }
.square-search-box input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #25384d;
}
.square-search-box input::placeholder { color: #a7b2bf; }

.square-list {
    flex: 1;
    min-height: 0;
    max-height: 52vh;
    overflow-y: auto;
    padding: 8px 12px 4px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}
.square-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 180px;
    color: #96a1ae;
    font-size: 13px;
}
.square-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #dbe6f2;
    border-top-color: #1b2c49;
    border-radius: 50%;
    animation: squareSpin 0.8s linear infinite;
}
@keyframes squareSpin { to { transform: rotate(360deg); } }

.square-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.square-card:hover { background: #f7f9fc; border-color: #e8eef5; }
.square-card.is-following { background: #fbfcfe; }
.square-card.is-following:hover { background: #f3f8fd; }
.square-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    color: #d8c48f;
    font-size: 17px;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(26,58,92,0.13);
}
.square-avatar img { width: 100%; height: 100%; object-fit: cover; }
.square-main { flex: 1; min-width: 0; }
.square-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.square-name-text {
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #23384d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.square-badge {
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    line-height: 1.5;
    color: #1b2c49;
    background: #eaf2fb;
    border: 1px solid #d6e5f4;
}
.square-desc {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.45;
    color: #7c8996;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.square-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    font-size: 11px;
    color: #9aa6b2;
    min-width: 0;
}
.square-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.square-meta-item svg { flex-shrink: 0; opacity: 0.85; }
.square-meta-time { color: #b0b9c3; }
.square-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    padding-top: 2px;
    flex-shrink: 0;
}
.square-follow-btn {
    height: 30px;
    min-width: 62px;
    padding: 0 13px;
    border: 1px solid #0d1526;
    border-radius: 16px;
    background: #0d1526;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.square-follow-btn:hover { background: #1b2c49; border-color: #1b2c49; }
.square-follow-btn:active { transform: scale(0.97); }
.square-follow-btn:disabled { opacity: 0.62; cursor: default; }
.square-follow-btn.followed {
    background: #fff;
    color: #6b7a89;
    border-color: #dbe4ee;
}
.square-follow-btn.followed:hover { background: #f4f7fa; border-color: #c8d6e5; }
.square-enter-hint { font-size: 10px; color: #a5b0bc; white-space: nowrap; }

.square-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 30px 16px;
    text-align: center;
}
.square-empty-icon { color: #b8c8da; margin-bottom: 8px; }
.square-empty-title { font-size: 14px; color: #526172; font-weight: 500; }
.square-empty-desc { margin-top: 5px; font-size: 12px; color: #9aa6b2; line-height: 1.6; max-width: 330px; }
.square-empty .btn { margin-top: 12px; }

.square-footer-tip {
    padding: 9px 20px 13px;
    border-top: 1px solid #f0f3f7;
    font-size: 11px;
    line-height: 1.5;
    color: #9aa6b2;
    background: #fcfdfe;
    text-align: center;
}

@media (max-width: 768px) {
    .group-square-entry { padding: 4px 8px !important; font-size: 11px !important; }
    .group-square-entry span { display: inline; }
    .channel-readonly-bar {
        min-height: 50px;
        padding: 7px 8px;
        gap: 8px;
        border-radius: 11px;
    }
    .channel-readonly-icon { width: 30px; height: 30px; }
    .channel-readonly-title { font-size: 12px; }
    .channel-readonly-desc { font-size: 11px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
    .channel-discuss-btn { height: 29px; padding: 0 9px; font-size: 11px; }
    .square-modal-content { max-height: 88vh !important; border-radius: 14px !important; }
    .square-hero { padding: 17px 18px 15px; }
    .square-hero h3 { font-size: 19px; }
    .square-hero p { font-size: 11px; }
    .square-close { right: 9px; top: 9px; }
    .square-search-row { padding: 10px 13px; gap: 6px; }
    .square-search-box { height: 35px; padding: 0 10px; }
    .square-search-box input { font-size: 12px; }
    .square-list { padding: 6px 8px 2px; min-height: 0; max-height: 54vh; }
    .square-card { gap: 9px; padding: 10px 7px; }
    .square-avatar { width: 42px; height: 42px; font-size: 15px; }
    .square-name-text { font-size: 13px; }
    .square-desc { font-size: 11px; -webkit-line-clamp: 2; }
    .square-meta { gap: 8px; font-size: 10px; }
    .square-follow-btn { height: 28px; min-width: 54px; padding: 0 10px; font-size: 11px; }
    .square-enter-hint { display: none; }
    .square-footer-tip { padding: 8px 14px 11px; font-size: 10px; }
    .gs-linked-row { padding: 8px 9px; }
}

/* 窄屏（后台 APK / 手机） */
@media (max-width: 768px) {
    .side-drawer { width: 80vw; max-width: 300px; }
    .drawer-item { padding: 14px 18px; font-size: 15px; }
    .drawer-ic { width: 24px; height: 24px; }
    .drawer-ic svg, .drawer-ic-svg { width: 22px; height: 22px; }
    .drawer-mobile { display: flex; }
    .drawer-desktop { display: none !important; }
    .drawer-group { display: none; }
    /* 只有“接入了侧边导航”的管理页(header 带 admin-has-nav)才在窄屏收起顶部链接，
       实时聊天页 header 不带该类，不受影响 */
    .admin-header.admin-has-nav .admin-header-right { display: none !important; }
}
/* ============================================================
   第三期：VIP / 频道邀请、审批、到期提示
   ============================================================ */
.mzl-modal-btn.confirm.primary { color: #0d1526; font-weight: 600; }

.group-expiry-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 8px 14px 0;
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid #f0e2bd;
    background: linear-gradient(135deg, #fffdf5 0%, #fdf6e5 100%);
    color: #8a6a1f;
    flex-shrink: 0;
}
.group-expiry-bar.is-grace {
    border-color: #f6d7b0;
    background: linear-gradient(135deg, #fffaf3 0%, #fdf0e2 100%);
    color: #a8641c;
}
.group-expiry-bar.is-expired {
    border-color: #f3c9c4;
    background: linear-gradient(135deg, #fff8f7 0%, #fdeceb 100%);
    color: #b33c30;
}
.group-expiry-icon {
    width: 30px; height: 30px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: rgba(201,169,97,.14);
}
.group-expiry-bar.is-grace .group-expiry-icon { background: rgba(216,132,44,.14); }
.group-expiry-bar.is-expired .group-expiry-icon { background: rgba(192,57,43,.12); }
.group-expiry-copy { min-width: 0; flex: 1; }
.group-expiry-title { font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.group-expiry-desc { font-size: 11.5px; line-height: 1.5; opacity: .86; margin-top: 1px; word-break: break-all; }

.group-expire-row { margin-top: 3px; }
.group-expire-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 10px;
    line-height: 16px;
    background: #fff4e0;
    color: #a86a00;
    white-space: nowrap;
}
.group-expire-badge.is-grace { background: #fdece2; color: #b35b18; }
.group-expire-badge.is-expired { background: #fdecea; color: #c0392b; }

.square-join-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 6px;
    border-radius: 8px;
    background: #eef3fa;
    color: #1b2c49;
    font-size: 10px;
    font-weight: 400;
    line-height: 16px;
    vertical-align: 1px;
}
.square-join-badge.is-invite { background: #f4eee2; color: #8a6a1f; }
.square-follow-btn.pending,
.square-follow-btn:disabled {
    background: #f4f5f7;
    border-color: #e2e5e9;
    color: #9aa3ad;
    cursor: default;
}
.square-follow-btn.pending { background: #fff8e8; border-color: #f2dfb9; color: #a1781f; }

.gs-expiry-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 9px 11px;
    border-radius: 7px;
    background: #f7f9fb;
    border: 1px solid #e8edf2;
}
.gs-expiry-state {
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 9px;
    background: #eaf3e4;
    color: #4a7c2c;
}
.gs-expiry-state.is-grace { background: #fdf0e1; color: #b35b18; }
.gs-expiry-state.is-expired { background: #fdecea; color: #c0392b; }
.gs-expiry-date { font-size: 12px; color: #66727f; }

/* 群简介：无边框纯文本展示 */
.gs-desc-text {
    font-size: 13px;
    line-height: 1.75;
    color: #3f4f60;
    padding: 1px 2px 2px;
    white-space: pre-wrap;
    word-break: break-word;
    letter-spacing: 0.2px;
}
.gs-desc-text.is-empty {
    color: #a9b4c0;
    font-size: 12.5px;
    letter-spacing: 0;
}


@media (max-width: 768px) {
    .group-expiry-bar { margin: 6px 10px 0; padding: 8px 10px; }
    .group-expiry-title { font-size: 12px; }
    .group-expiry-desc { font-size: 11px; }
}

/* ============================================================
   移动端底部导航 / 聊天页返回 / 我的面板（v3.7）
   仅手机端生效，桌面端不渲染任何变化
   ============================================================ */
.mobile-dock,
.ms-mask,
.ms-panel,
.chat-back-btn { display: none; }

@media (max-width: 768px) {
    /* 聊天页返回按钮（Telegram 式返回会话列表） */
    .chat-back-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        flex: 0 0 auto;
        margin-right: 2px;
        padding: 0;
        border: none;
        border-radius: 50%;
        background: transparent;
        color: #0d1526;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .chat-back-btn svg { width: 24px; height: 24px; display: block; stroke: #0d1526; }
    .chat-back-btn:active { background: #eef3f8; }
    .chat-topbar { padding: 0 10px 0 6px; }

    /* 输入区底部给 iPhone 手势条留安全区（Android 无 inset 时为 0，不影响原布局） */
    .chat-input-area { padding: 5px 6px calc(5px + env(safe-area-inset-bottom)) !important; }

    /* 顶栏精简：昵称 / 改名 / 改密 / 退出全部收进「我的」，
       顶栏只留 语言 / 刷新 / 声音 / 分享，四控件不再挤压溢出 */
    .header-right .user-info { display: none !important; }
    .header-right .strategy-btn { display: none !important; }
    .change-pwd-btn { display: none !important; }
    .logout-link { display: none !important; }

    /* 底部导航 */
    .mobile-dock {
        display: flex;
        align-items: center;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        height: 58px;
        padding: 0 4px;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.96);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        box-shadow: 0 6px 22px rgba(16, 36, 60, 0.16), 0 0 0 1px rgba(20, 40, 70, 0.05);
        z-index: 52;
        transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease;
    }
    .mobile-dock.dock-hidden {
        transform: translateY(120%);
        opacity: 0;
        pointer-events: none;
    }
    .dock-item {
        flex: 1;
        min-width: 0;
        height: 48px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 0;
        border: none;
        background: transparent;
        border-radius: 12px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.12s ease, background 0.12s ease;
    }
    .dock-item:active { transform: scale(0.94); background: rgba(26, 58, 92, 0.05); }
    .dock-ico { position: relative; display: flex; line-height: 0; }
    .dock-item[data-dock="strategy"] .dock-ico {
        width: 32px;
        height: 30px;
        flex: none;
        align-items: center;
        justify-content: center;
        border-radius: 9px;
        background: linear-gradient(180deg, #ffd88a 0%, #f5b544 58%, #d99a2b 100%);
        box-shadow: 0 0 0 2px rgba(255,255,255,.92), 0 0 0 5px rgba(245,181,68,.16), 0 5px 12px rgba(201,143,34,.34);
        transform: translateY(-3px);
    }
    .dock-item[data-dock="strategy"] .dock-ico::after {
        content: "";
        position: absolute;
        left: 4px;
        top: 4px;
        z-index: 2;
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 0 4px rgba(255,255,255,1), 0 0 1px rgba(255,255,255,1);
    }
    .dock-item[data-dock="strategy"] .dock-ico svg {
        width: 19px;
        height: 19px;
        stroke: #332208;
        stroke-width: 2.3;
    }
    .dock-item[data-dock="strategy"] .dock-label {
        color: #a9873f;
        font-weight: 700;
    }
    .dock-ico svg {
        width: 22px;
        height: 22px;
        stroke: #8b98a8;
        fill: none;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
        transition: stroke 0.16s ease;
    }
    .dock-label {
        max-width: 100%;
        font-size: 10.5px;
        line-height: 1.2;
        letter-spacing: 0.2px;
        color: #8b98a8;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        transition: color 0.16s ease;
    }
    .dock-item.active .dock-ico svg { stroke: #a9873f; }
    .dock-item.active .dock-label { color: #a9873f; font-weight: 600; }
    .dock-badge {
        position: absolute;
        top: -5px;
        right: -9px;
        min-width: 15px;
        height: 15px;
        padding: 0 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: #f5b544;
        color: #fff;
        font-size: 9px;
        font-weight: 600;
        line-height: 1;
        box-shadow: 0 1px 3px rgba(120, 90, 20, 0.25);
    }
    .dock-badge[hidden] { display: none; }

    /* 空态（欢迎页）给底部导航留出空间 */
    .chat-welcome { padding: 30px 24px 100px; }

    /* v3.8 列表页：抽屉整页宽，底部导航浮在列表之上（不再半遮半挡） */
    .conversation-list {
        width: 100%;
        max-width: none;
        border-right: none;
        box-shadow: none;
        overflow: hidden;
    }
    .conv-tab-content.active {
        display: flex !important;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }
    .conv-tab-content.active .conv-list-body {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
    }

    /* 「我的」底部面板 */
    .ms-mask {
        display: block;
        position: fixed;
        top: 0; right: 0; bottom: 0; left: 0;
        background: rgba(12, 24, 40, 0.42);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.24s ease;
        z-index: 890;
    }
    .ms-mask.show { opacity: 1; visibility: visible; }
    .ms-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 891;
        max-height: 78vh;
        background: #fff;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 30px rgba(12, 24, 40, 0.18);
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        overflow: hidden;
    }
    .ms-panel.show { transform: translateY(0); }
    .ms-handle {
        width: 38px; height: 4px;
        margin: 8px auto 2px;
        border-radius: 3px;
        background: #dfe5ec;
        flex: none;
    }
    .ms-head {
        display: flex;
        align-items: center;
        gap: 11px;
        padding: 8px 16px 14px;
        border-bottom: 1px solid #f2f5f8;
        flex: none;
    }
    .ms-avatar {
        width: 42px; height: 42px;
        border-radius: 50%;
        background: linear-gradient(135deg, #0d1526, #1b2c49);
        color: #f5b544;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        font-weight: 600;
        flex: none;
        overflow: hidden;
    }
    .ms-name {
        flex: 1;
        min-width: 0;
        font-size: 16px;
        font-weight: 600;
        color: #0d1526;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .ms-close {
        margin-left: auto;
        width: 36px; height: 36px;
        border: none;
        border-radius: 50%;
        background: #f4f7fa;
        color: #7b8794;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .ms-close:active { background: #e8eef5; }
    .ms-list {
        padding: 6px 8px 4px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ms-row {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        height: 52px;
        padding: 0 10px;
        border: none;
        border-radius: 12px;
        background: transparent;
        font-size: 15px;
        color: #22303f;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        font-family: inherit;
    }
    .ms-row:active { background: #f5f8fb; }
    .ms-row svg {
        width: 19px; height: 19px;
        flex: none;
        stroke: #8a97a6;
        fill: none;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .ms-row .ms-arrow { margin-left: auto; color: #c3ccd6; font-size: 16px; }
    .ms-row-danger {
        color: #d9534f;
        margin-top: 6px;
        border-top: 1px solid #f2f5f8;
        border-radius: 0 0 12px 12px;
    }
    .ms-row-danger svg { stroke: #d9534f; }
}
/* 移动端「我的」面板打开时锁定背景滚动 */
body.ms-open { overflow: hidden; }

/* 移动端地址栏 / 软键盘导致 100vh 虚高时，用动态视口高度兜底（老浏览器自动忽略） */
@supports (height: 100dvh) {
    @media (max-width: 768px) {
        .chat-container { height: calc(100dvh - 50px); }
    }
}


/* ============================================================
   方案 A · 手机端三段式（列表整页 / 聊天全屏 / 底部 4 Tab）v3.9
   仅 <=768px 生效，桌面端保持 300px 左栏原样
   ============================================================ */
@media (max-width: 768px) {
    /* 顶栏：只留 Logo + 盘语 TAPE + 搜索 + 新建 */
    .chat-header { padding: 0 12px; }
    .mobile-menu-btn { display: none !important; }
    .chat-header .header-logo { display: none !important; }
    .chat-header .mobile-brand {
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-width: 32px;
        height: 30px;
        padding: 0 8px;
        flex: none;
        border: 1px solid rgba(245,181,68,.65);
        border-radius: 8px;
        background: rgba(245,181,68,.08);
        color: #ffd88a;
        font-family: -apple-system, "Segoe UI", Arial, sans-serif;
        font-size: 11.5px;
        font-weight: 800;
        letter-spacing: 1px;
        box-sizing: border-box;
    }
    .header-title {
        display: inline-block !important;
        max-width: 46vw;
        margin-left: 10px;
        font-size: 16px;
        font-weight: 700;
        color: #e8c883;
        letter-spacing: 0.2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-right .lang-selector,
    .header-right #appRefreshBtn,
    .header-right #soundToggleBtn,
    .header-right #shareBtn,
    .header-right .user-info { display: none !important; }
    .mobile-head-actions { display: flex; align-items: center; gap: 8px; }
    .mobile-head-actions .icon-btn { color: #fff; }
    .mobile-head-actions .icon-btn svg { width: 20px; height: 20px; display: block; }

    /* 列表整页 */
    .chat-container {
        display: block;
        position: relative;
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px);
    }
    .conversation-list {
        position: absolute !important;
        left: 0 !important; top: 0 !important; right: 0 !important; bottom: 0 !important;
        width: 100% !important;
        max-width: none !important;
        transform: none !important;
        display: flex !important;
        flex-direction: column;
        z-index: 10;
        border: none;
        box-shadow: none;
        padding-bottom: calc(56px + env(safe-area-inset-bottom));
        box-sizing: border-box;
    }
    .conversation-list .conv-tabs { display: none !important; }
    #tabConversations .conv-list-header { display: none !important; }
    .conv-tab-content.active .conv-list-body { padding-bottom: 0 !important; }

    /* 聊天页全屏：隐藏全局品牌栏，返回键留在聊天顶栏 */
    body.mobile-chat-open .chat-header { display: none !important; }
    body.mobile-chat-open .chat-container { height: 100vh; height: 100dvh; }

    /* 聊天全屏 */
    .chat-area {
        position: absolute;
        left: 0; top: 0; right: 0; bottom: 0;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    .chat-container:not(.chat-open) .chat-area { display: none !important; }
    .chat-container.chat-open .conversation-list { display: none !important; }
    .chat-welcome { display: none !important; }
    .chat-main { flex: 1; min-height: 0; }

    /* 底部导航：整条通栏（方案 A），不再悬浮胶囊 */
    .mobile-dock {
        left: 0;
        right: 0;
        bottom: 0;
        height: calc(56px + env(safe-area-inset-bottom));
        padding: 0 4px env(safe-area-inset-bottom);
        border-radius: 0;
        background: #fff;
        box-shadow: 0 -1px 0 rgba(24, 45, 70, 0.08), 0 -10px 24px rgba(16, 36, 60, 0.05);
        z-index: 52;
    }
    .dock-item { height: 52px; gap: 4px; }
    .dock-label { font-size: 11px; letter-spacing: 0.3px; }
    .dock-ico svg { width: 23px; height: 23px; }
    .dock-badge { top: -6px; right: -10px; }

    /* 「我的」语言行 */
    .ms-lang-value { margin-left: auto; font-size: 13px; color: #8a97a6; }
    .ms-lang-row-open .ms-arrow { transform: rotate(90deg); }
    .ms-lang-list { display: none; padding: 0 8px 4px; }
    .ms-lang-list.show { display: block; }
    .ms-lang-list a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 44px;
        padding: 0 12px;
        border-radius: 10px;
        font-size: 14px;
        color: #22303f;
        text-decoration: none;
    }
    .ms-lang-list a:active { background: #f5f8fb; }
    .ms-lang-list a.is-current { color: #a9873f; font-weight: 600; }
    .ms-lang-list a.is-current::after { content: "\2713"; font-size: 15px; }
}

@media (min-width: 769px) {
    .mobile-brand,
    .mobile-head-actions { display: none !important; }
}


/* ============================================================
   客户端个性化：聊天外观 / 提示开关 / 刷新缓存 v1.0
   ============================================================ */
#appearanceBtn svg { width: 20px; height: 20px; display: block; }
#appearanceBtn:hover svg { transform: rotate(-8deg); transition: transform .25s ease; }

/* 我的面板：开关与副标题 */
.ms-row-toggle { cursor: default; }
.ms-row-toggle .mzl-switch { margin-left: auto; flex: none; }
.ms-sub {
    margin-left: auto;
    max-width: 48%;
    font-size: 11px;
    color: #8a97a6;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mzl-switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.mzl-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.mzl-switch-track {
    position: absolute; inset: 0;
    border-radius: 999px;
    background: #dbe2ea;
    box-shadow: inset 0 0 0 1px rgba(24,45,70,.06);
    transition: background .22s ease, box-shadow .22s ease;
}
.mzl-switch-track::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(16,32,52,.22);
    transition: transform .22s cubic-bezier(.32,.72,0,1);
}
.mzl-switch input:checked + .mzl-switch-track {
    background: linear-gradient(135deg, #f5b544, #ffd88a);
    box-shadow: inset 0 0 0 1px rgba(138,106,28,.18);
}
.mzl-switch input:checked + .mzl-switch-track::after { transform: translateX(18px); }
.mzl-switch input:focus-visible + .mzl-switch-track { outline: 2px solid rgba(201,169,97,.55); outline-offset: 2px; }

/* 聊天外观弹窗 */
.ap-modal { z-index: 1002; padding: 18px; }
.ap-card {
    max-width: 560px;
    max-height: 88vh;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(8,20,36,.35);
}
.ap-head {
    padding: 15px 20px 13px;
    background: linear-gradient(135deg, #17324f 0%, #1b2c49 100%);
    align-items: flex-start;
}
.ap-head h3 { color: #e8c883; font-size: 18px; letter-spacing: .3px; margin: 0 0 3px; }
.ap-head-sub { color: rgba(255,255,255,.66); font-size: 11px; line-height: 1.5; padding-right: 10px; }
.ap-head .modal-close { color: #e8c883; margin-top: -2px; }
.ap-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 18px 0;
    background: #fff;
    border-bottom: 1px solid #edf1f5;
}
.ap-tab {
    position: relative;
    border: none;
    background: transparent;
    padding: 10px 16px 12px;
    font-size: 14px;
    color: #6b7c93;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.ap-tab.active { color: #0d1526; font-weight: 600; }
.ap-tab.active::after {
    content: "";
    position: absolute;
    left: 18px; right: 18px; bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #f5b544, #ffd88a);
}
.ap-body { padding: 16px 18px 18px; background: #f6f8fb; }
.ap-pane { display: none; }
.ap-pane.active { display: block; }
.ap-section { margin-bottom: 14px; }
.ap-label { font-size: 13px; font-weight: 600; color: #22303f; margin-bottom: 9px; letter-spacing: .2px; }
.ap-tip { font-size: 12px; color: #8a97a6; line-height: 1.6; margin-top: -3px; }

.ap-choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.ap-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 10px;
    border: 1px solid #dde4ec;
    border-radius: 11px;
    background: #fff;
    color: #33475c;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    -webkit-tap-highlight-color: transparent;
}
.ap-choice.active {
    border-color: #f5b544;
    background: #fffdf7;
    box-shadow: 0 0 0 2px rgba(201,169,97,.13);
}
.ap-choice-ico {
    width: 26px; height: 22px;
    border-radius: 6px;
    flex: none;
    border: 1px solid #d9e1ea;
    background: linear-gradient(135deg, #070c17, #111d33);
}
.ap-ico-default { background: linear-gradient(135deg, #17324f, #1b2c49); }
.ap-ico-color { background: linear-gradient(135deg, #f5b544 0%, #f5b544 50%, #eef2f7 50%, #eef2f7 100%); }
.ap-ico-image { background: linear-gradient(135deg, #8fb7d8, #d8e9f5 55%, #6e9f7a 56%, #4e7f5e); }

.ap-sub { margin-bottom: 14px; }
.ap-color-line { display: flex; align-items: center; gap: 12px; }
.ap-color-wrap {
    width: 54px; height: 46px;
    padding: 0;
    border: 1px solid #d7e0ea;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    flex: none;
    cursor: pointer;
    box-shadow: inset 0 0 0 3px #fff;
}
.ap-color-wrap input[type=color] {
    width: 100%; height: 100%;
    border: none; padding: 0; background: transparent; cursor: pointer;
    -webkit-appearance: none; appearance: none;
}
.ap-color-wrap input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.ap-color-wrap input[type=color]::-webkit-color-swatch { border: none; border-radius: 0; }
.ap-hex {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 11px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-family: Consolas, Menlo, monospace;
    font-size: 12px;
    letter-spacing: .6px;
    color: #3a4b5e;
}
.ap-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ap-swatches button {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--sw);
    box-shadow: 0 0 0 1px #d7dfe8, 0 2px 6px rgba(16,32,52,.1);
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.ap-swatches button.active { box-shadow: 0 0 0 2px #f5b544, 0 2px 8px rgba(16,32,52,.16); transform: scale(1.04); }

.ap-upload {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 96px;
    padding: 10px;
    border: 1px dashed #c9d4e2;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.ap-upload:hover { border-color: #f5b544; }
.ap-upload-empty { display: flex; flex-direction: column; align-items: center; gap: 7px; color: #7b8b9e; font-size: 12px; }
.ap-upload-empty svg { width: 30px; height: 30px; stroke: #93a4b7; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ap-upload img { width: 100%; height: 132px; object-fit: cover; border-radius: 8px; display: block; }
.ap-upload-edit {
    position: absolute;
    right: 10px; bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(12,24,40,.72);
    color: #fff;
    font-size: 11px;
    backdrop-filter: blur(4px);
}
.ap-upload-edit svg { width: 13px; height: 13px; stroke: #fff; fill: none; stroke-width: 1.7; }
.ap-image-tools { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.ap-range-line { display: flex; align-items: center; gap: 9px; flex: 1; font-size: 12px; color: #5e6f83; }
.ap-range-line input[type=range] { flex: 1; min-width: 60px; accent-color: #f5b544; }
.ap-range-val { width: 36px; text-align: right; font-family: Consolas, monospace; font-size: 11px; color: #8a97a6; }
.ap-link-danger { border: none; background: transparent; color: #c05a55; font-size: 12px; cursor: pointer; padding: 6px 0; font-family: inherit; }

.ap-preview {
    position: relative;
    height: 186px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 10px 26px rgba(10,24,42,.18);
    background: linear-gradient(135deg, #070c17 0%, #111d33 100%);
    background-size: cover;
    background-position: center;
}
.ap-preview-top {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    background: rgba(9,18,32,.36);
    color: rgba(255,255,255,.86);
    font-size: 11px;
    letter-spacing: .3px;
    backdrop-filter: blur(4px);
}
.ap-preview-dot { width: 6px; height: 6px; border-radius: 50%; background: #e8c883; box-shadow: 0 0 0 2px rgba(232,200,131,.2); }
.ap-preview-body { padding: 14px 13px; display: flex; flex-direction: column; gap: 10px; }
.ap-pv-row { display: flex; }
.ap-pv-row.other { justify-content: flex-start; }
.ap-pv-row.mine { justify-content: flex-end; }
.ap-pv-bubble {
    max-width: 82%;
    padding: 8px 11px;
    border-radius: 4px 12px 12px 12px;
    background: #243050;
    color: #e8edf7;
    font-size: 12px;
    line-height: 1.55;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(6,14,26,.16);
}
.ap-pv-bubble.mine { border-radius: 12px 12px 4px 12px; background: #2c5f8a; color: #fff; }

.ap-bubble-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 13px 14px;
    margin-bottom: 11px;
}
.ap-bubble-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #24384d; margin-bottom: 10px; }
.ap-bubble-dot { width: 8px; height: 8px; border-radius: 50%; background: #243050; box-shadow: 0 0 0 2px rgba(36,48,80,.12); }
.ap-bubble-dot.mine { background: #2c5f8a; box-shadow: 0 0 0 2px rgba(44,95,138,.12); }
.ap-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-color-field { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: #7b8b9e; min-width: 0; }
.ap-color-inline {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 6px 0 5px;
    border: 1px solid #dfe6ee;
    border-radius: 9px;
    background: #fbfcfe;
    min-width: 0;
}
.ap-color-inline input[type=color] {
    width: 28px; height: 26px;
    border: none; padding: 0; background: transparent; cursor: pointer;
    -webkit-appearance: none; appearance: none;
    flex: none;
}
.ap-color-inline input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.ap-color-inline input[type=color]::-webkit-color-swatch { border: 1px solid #d7e0ea; border-radius: 6px; }
.ap-color-inline b {
    font-family: Consolas, Menlo, monospace;
    font-weight: 500;
    font-size: 11px;
    color: #52657a;
    letter-spacing: .4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ap-contrast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin: 2px 0 11px;
    border-radius: 10px;
    background: #fff8e8;
    border: 1px solid #f0dfb7;
    color: #8a6418;
    font-size: 12px;
    line-height: 1.5;
}
.ap-contrast[hidden] { display: none; }
.ap-contrast-dot { width: 7px; height: 7px; border-radius: 50%; background: #e0a52a; flex: none; }
.ap-bubble-preview {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 14px 13px;
    border-radius: 12px;
    background: linear-gradient(135deg, #070c17 0%, #111d33 100%);
}

.ap-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px calc(13px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #edf1f5;
}
.ap-footer-right { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.ap-pane-actions {
    display: flex;
    justify-content: flex-end;
    margin: 14px 0 4px;
    padding: 10px 0 2px;
    position: sticky;
    bottom: -1px;
    z-index: 2;
    background: #f6f8fb;
    box-shadow: 0 -10px 14px rgba(246, 248, 251, .92);
}
.ap-pane-actions .ap-btn { min-width: 132px; }
.ap-btn {
    height: 38px;
    padding: 0 17px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: filter .18s ease, background .18s ease;
    -webkit-tap-highlight-color: transparent;
}
.ap-btn:active { filter: brightness(.96); }
.ap-btn-ghost { background: transparent; color: #7a8899; padding-left: 0; }
.ap-btn-ghost:hover { color: #0d1526; }
.ap-btn-line { background: #fff; border-color: #d7e0ea; color: #53677d; }
.ap-btn-primary { background: linear-gradient(135deg, #0d1526, #1b2c49); color: #fff; box-shadow: 0 5px 14px rgba(26,58,92,.22); }

body.ap-open { overflow: hidden; }

@media (max-width: 768px) {
    .ap-modal { padding: 0; align-items: flex-end; }
    .ap-card {
        max-width: none;
        max-height: 92vh;
        height: auto;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -12px 40px rgba(8,20,36,.3);
    }
    .ap-head { padding: 14px 16px 12px; }
    .ap-head h3 { font-size: 17px; }
    .ap-tabs { padding: 8px 12px 0; }
    .ap-tab { flex: 1; padding: 10px 8px 11px; font-size: 13px; }
    .ap-body { padding: 14px 14px 16px; }
    .ap-choice-row { gap: 7px; }
    .ap-choice { padding: 9px 7px; font-size: 12px; gap: 6px; }
    .ap-choice-ico { width: 22px; height: 20px; }
    .ap-swatches { gap: 9px; }
    .ap-swatches button { width: 27px; height: 27px; }
    .ap-preview { height: 170px; }
    .ap-color-grid { gap: 8px; }
    .ap-footer { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
    .ap-btn { height: 40px; padding: 0 15px; }
    .ap-btn-ghost { padding-left: 0; padding-right: 6px; }
    .ap-footer-right { gap: 8px; }
    .ap-footer-right .ap-btn { flex: 1; }
}

@media (max-width: 380px) {
    .ap-choice { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 7px; }
    .ap-choice-ico { width: 100%; height: 18px; }
    .ap-color-grid { grid-template-columns: 1fr; }
    .ap-swatches button { width: 25px; height: 25px; }
    .ap-image-tools { flex-wrap: wrap; }
}

/* 移动端顶栏：两个动作按钮统一金色，小屏收紧 */
@media (max-width: 768px) {
    .mobile-head-actions { gap: 7px; }
    .mobile-head-actions .icon-btn { color: #e8c883 !important; }
    .mobile-head-actions .icon-btn svg { width: 21px; height: 21px; }
}
@media (max-width: 360px) {
    .mobile-head-actions { gap: 5px; }
    .mobile-head-actions .icon-btn { width: 26px; height: 26px; }
    .mobile-head-actions .icon-btn svg { width: 19px; height: 19px; }
    .header-title { max-width: 40vw !important; font-size: 15px !important; }
}
/* 移动端外观入口统一收进「我的」面板，避免顶栏重复 */
@media (max-width: 768px) {
    #appearanceBtn { display: none !important; }
}

/* 气泡「跟随系统」 */
.ap-follow-btn {
    margin-left: auto;
    flex: none;
    padding: 4px 9px;
    border: 1px solid #dbe3ec;
    border-radius: 999px;
    background: #fbfcfe;
    color: #718196;
    font-size: 11px;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
    -webkit-tap-highlight-color: transparent;
}
.ap-follow-btn:hover { border-color: #f5b544; color: #8a6418; }
.ap-follow-btn.is-following {
    border-color: #f5b544;
    background: #fff3d4;
    color: #8a6418;
    font-weight: 600;
}

/* 文字大小 */
.ap-font-card {
    padding: 16px;
    border: 1px solid #e0e7ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(18,38,62,.05);
}
.ap-font-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 15px; }
.ap-font-aa {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    line-height: 1;
    color: #0d1526;
    letter-spacing: -.5px;
    transition: font-size .15s ease;
}
.ap-font-value {
    font-family: Consolas, Menlo, monospace;
    font-size: 13px;
    font-weight: 600;
    color: #8a6418;
    background: #fff9ea;
    border: 1px solid rgba(201,169,97,.32);
    border-radius: 999px;
    padding: 3px 9px;
}
.ap-font-range {
    width: 100%;
    height: 28px;
    margin: 0;
    accent-color: #f5b544;
    cursor: pointer;
}
.ap-font-marks {
    display: flex;
    justify-content: space-between;
    margin-top: -3px;
    font-family: Consolas, Menlo, monospace;
    font-size: 10px;
    color: #9aa8b8;
}
.ap-font-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 13px; }
.ap-font-presets button {
    height: 30px;
    border: 1px solid #dde4ec;
    border-radius: 8px;
    background: #f8fafc;
    color: #5a6d82;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: all .18s ease;
    -webkit-tap-highlight-color: transparent;
}
.ap-font-presets button:hover { border-color: #f5b544; color: #8a6418; }
.ap-font-presets button.active { border-color: #f5b544; background: #fff9ea; color: #8a6418; font-weight: 600; }
.ap-font-sample {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 13px;
    padding: 15px 14px;
    border-radius: 13px;
    background: linear-gradient(135deg, #070c17 0%, #111d33 100%);
    box-shadow: 0 10px 24px rgba(10,24,42,.16);
}
.ap-font-sample .ap-pv-bubble { transition: font-size .15s ease; }

@media (max-width: 768px) {
    .ap-tabs { gap: 0; }
    .ap-tab { padding-left: 4px; padding-right: 4px; }
    .ap-font-card { padding: 14px; }
    .ap-font-aa { font-size: 27px; }
}
@media (max-width: 360px) {
    .ap-tab { font-size: 12px; }
    .ap-font-presets { gap: 5px; }
    .ap-font-presets button { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .mzl-modal,
    .mzl-modal-mask,
    .ap-font-aa,
    .ap-font-sample .ap-pv-bubble { animation: none !important; transition: none !important; }
}

/* ============================================================
   群设置弹窗（v57）
   与聊天外观弹窗同一套深蓝 + 金色视觉语言
   ============================================================ */
.gs-modal { z-index: 1003; padding: 18px; }
.gs-card {
    max-width: 560px;
    max-height: 90vh;
    border-radius: 18px;
    background: #f6f8fb;
    box-shadow: 0 24px 70px rgba(8,20,36,.35);
}
.gs-head {
    padding: 16px 18px;
    align-items: center;
    background: linear-gradient(135deg, #17324f 0%, #1b2c49 100%);
    border-bottom: 0;
}
.gs-head-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.gs-head-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #f4dfae;
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(201,169,97,.38), rgba(255,255,255,.14));
    border: 1px solid rgba(255,255,255,.24);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.gs-head-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gs-head-copy { min-width: 0; flex: 1; }
.gs-head h3 {
    margin: 0 0 2px;
    color: #fff;
    font-size: 18px;
    line-height: 1.3;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gs-head-sub {
    color: rgba(255,255,255,.66);
    font-size: 11.5px;
    line-height: 1.5;
}
.gs-head .modal-close {
    flex: none;
    width: 32px;
    height: 32px;
    margin-left: 8px;
    border-radius: 9px;
    color: #e8c883;
    font-size: 25px;
    line-height: 30px;
    transition: background .18s ease;
}
.gs-head .modal-close:hover { background: rgba(255,255,255,.1); }

.gs-body {
    padding: 14px 16px 16px;
    background: #f6f8fb;
}
.gs-section {
    margin-bottom: 12px;
    padding: 13px 14px;
    border: 1px solid #e6edf5;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(16,40,70,.04);
}
.gs-section:last-child { margin-bottom: 0; }
.gs-section-title {
    display: flex;
    align-items: center;
    margin: 0 0 10px;
    color: #7b8a9c;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 1px;
}
.gs-section-title::before {
    content: "";
    width: 3px;
    height: 10px;
    margin-right: 7px;
    border-radius: 2px;
    background: linear-gradient(180deg, #f5b544, #ffd88a);
}

.gs-field { margin-bottom: 12px; }
.gs-field:last-child { margin-bottom: 0; }
.modal-body .gs-field label,
.gs-label {
    display: block;
    margin: 0 0 6px;
    color: #7a8898;
    font-size: 12px;
    font-weight: 500;
}
.gs-readonly {
    width: 100%;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid #e5ebf2;
    border-radius: 9px;
    background: #f8fafc !important;
    color: #33475c;
    font-size: 13px;
    line-height: 1.5;
    box-sizing: border-box;
}
.gs-notice-textarea {
    min-height: 68px;
    resize: vertical;
    line-height: 1.65;
}
.gs-desc-text {
    padding: 9px 11px;
    border: 1px solid #eef3f8;
    border-radius: 9px;
    background: #f8fafc;
    color: #4a5b6d;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}
.gs-desc-text.is-empty { color: #a9b4c0; font-size: 12.5px; }
.gs-linked-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px 7px 11px;
    border: 1px solid #eef3f8;
    border-radius: 9px;
    background: #f8fafc;
}
.gs-linked-name {
    flex: 1;
    min-width: 0;
    color: #33475c;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gs-linked-row .btn-small { flex: none; }

.gs-expiry-box {
    padding: 9px 11px;
    border: 1px solid #e8edf2;
    border-radius: 9px;
    background: #f8fafc;
}
.gs-expiry-tip {
    margin-top: 8px;
    color: #8a97a6;
    font-size: 11.5px;
    line-height: 1.55;
}

.gs-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #eef2f6;
}
.gs-toggle-row:first-of-type { padding-top: 2px; }
.gs-toggle-row:last-child { padding-bottom: 2px; border-bottom: 0; }
.gs-toggle-copy { flex: 1; min-width: 0; }
.gs-toggle-title {
    color: #22303f;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}
.gs-toggle-hint {
    margin-top: 3px;
    color: #8a97a6;
    font-size: 11.5px;
    line-height: 1.55;
}
.gs-toggle-row .mzl-switch { margin-left: auto; }
.gs-toggle-row.is-disabled .gs-toggle-copy,
.gs-toggle-row.is-disabled .mzl-switch { opacity: .52; }
.mzl-switch input:disabled { cursor: not-allowed; }

.gs-members-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.gs-members-head .gs-section-title { margin: 0; }
.gs-member-count {
    flex: none;
    padding: 2px 8px;
    border: 1px solid #f0e0bd;
    border-radius: 999px;
    background: #fff7e6;
    color: #8a6a1f;
    font-size: 11px;
    font-weight: 600;
}
.gs-member-list {
    max-height: 232px;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid #edf2f7;
    border-radius: 11px;
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
}
.gs-member-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    border-radius: 8px;
}
.gs-member-item + .gs-member-item { border-top: 1px solid #f0f4f8; }
.gs-member-item:hover { background: #fff; }
.gs-member-avatar {
    width: 32px;
    height: 32px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8eef5, #dbe5ef);
    color: #5a7089;
    font-size: 12px;
    font-weight: 600;
}
.gs-member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gs-member-name {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    color: #33475c;
    font-size: 13px;
    line-height: 1.45;
}
.group-member-tag {
    display: inline-flex;
    align-items: center;
    height: 17px;
    padding: 0 5px;
    border-radius: 5px;
    background: #edf2f7;
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.group-member-tag.tag-owner { background: #fdf3dc; color: #96702a; }
.group-member-tag.tag-admin { background: #eaf1fb; color: #3b6aa0; }
.group-member-tag.tag-analyst { background: #eef0fb; color: #5b5fa6; }
.group-member-tag.tag-service { background: #eef8ef; color: #3f7d4a; }
.gs-member-action-btn {
    flex: none;
    padding: 4px 10px !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    font-weight: 600;
    line-height: 1.4;
}

.gs-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e9eff5;
    background: #fff;
}
.gs-leave-btn,
.gs-done-btn {
    height: 42px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.gs-leave-btn {
    flex: 1;
    border: 1px solid #f0d6d4;
    background: #fff7f6;
    color: #c74b43;
}
.gs-leave-btn:hover { background: #fff0ee; box-shadow: 0 4px 14px rgba(199,75,67,.12); }
.gs-done-btn {
    flex: 1.2;
    border: 0;
    background: linear-gradient(135deg, #0d1526, #1b2c49);
    color: #f0d49a;
    box-shadow: 0 6px 16px rgba(20,46,76,.18);
}
.gs-done-btn:hover { box-shadow: 0 8px 20px rgba(20,46,76,.26); transform: translateY(-1px); }

@media (max-width: 420px) {
    .gs-modal { padding: 8px; }
    .gs-card { max-height: 94vh; border-radius: 16px; }
    .gs-head { padding: 13px 14px; }
    .gs-head-avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
    .gs-head h3 { font-size: 16px; }
    .gs-body { padding: 10px 10px 12px; }
    .gs-section { padding: 11px; border-radius: 12px; margin-bottom: 9px; }
    .gs-toggle-row { gap: 8px; padding: 10px 0; }
    .gs-member-list { max-height: 210px; }
    .gs-footer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
    .gs-leave-btn, .gs-done-btn { height: 40px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
    .gs-done-btn, .gs-leave-btn, .gs-head .modal-close { transition: none !important; }
}

