/* ================= 基础重置与变量 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg-color: #1a1a1a;
    --chat-bg: #2b2b2b;
    --header-bg: #333;
    --text-color: #e0e0e0;
    --doctor-bubble: #3d5a80;
    --operator-bubble: #444;
    --input-bg: #2b2b2b;
    --border-color: #444;
    --active-color: #5b8def;
    --tab-bar-bg: #2a2a2a;
    --card-bg: #252525;
}
/* 暗色（默认） */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --chat-bg: #2b2b2b;
    --header-bg: #333;
    --text-color: #e0e0e0;
    --doctor-bubble: #3d5a80;
    --operator-bubble: #444;
    --input-bg: #2b2b2b;
    --border-color: #444;
    --active-color: #5b8def;
    --tab-bar-bg: #2a2a2a;
    --card-bg: #252525;
}
/* 亮色 */
[data-theme="light"] {
    --bg-color: #f0f2f5;
    --chat-bg: #e5e5e5;
    --header-bg: #ffffff;
    --text-color: #1a1a1a;
    --doctor-bubble: #95ec69;
    --operator-bubble: #ffffff;
    --input-bg: #ffffff;
    --border-color: #d9d9d9;
    --active-color: #3d5a80;
    --tab-bar-bg: #f8f8f8;
    --card-bg: #ffffff;
}
/* 企鹅物流 — 冷蓝 */
[data-theme="penguin"] {
    --bg-color: #1a1d25;
    --chat-bg: #242836;
    --header-bg: #2a2e3a;
    --text-color: #d0d4e0;
    --doctor-bubble: #3b5998;
    --operator-bubble: #353a48;
    --input-bg: #242836;
    --border-color: #3d4458;
    --active-color: #4a9eff;
    --tab-bar-bg: #222632;
    --card-bg: #262a36;
}
/* 莱茵生命 — 冷绿 */
[data-theme="rhine"] {
    --bg-color: #1a241d;
    --chat-bg: #242e28;
    --header-bg: #2a352e;
    --text-color: #d0e0d5;
    --doctor-bubble: #2d7a4a;
    --operator-bubble: #353e38;
    --input-bg: #242e28;
    --border-color: #3d4a40;
    --active-color: #4ecb71;
    --tab-bar-bg: #202c24;
    --card-bg: #263028;
}
/* 深海猎人 — 深蓝黑 */
[data-theme="abyssal"] {
    --bg-color: #151a24;
    --chat-bg: #1e2432;
    --header-bg: #242b3a;
    --text-color: #c8d0e0;
    --doctor-bubble: #4a3060;
    --operator-bubble: #2a3040;
    --input-bg: #1e2432;
    --border-color: #353d50;
    --active-color: #e05555;
    --tab-bar-bg: #1c2230;
    --card-bg: #22283a;
}
/* 罗德岛 — 经典蓝黑 */
[data-theme="rhodes"] {
    --bg-color: #1a1e24;
    --chat-bg: #242a33;
    --header-bg: #2d3340;
    --text-color: #d8dce5;
    --doctor-bubble: #3d5a80;
    --operator-bubble: #363e4d;
    --input-bg: #242a33;
    --border-color: #404858;
    --active-color: #5b8def;
    --tab-bar-bg: #212632;
    --card-bg: #282e3a;
}
html, body {
    height: 100%; width: 100%; max-width: 100vw;
    overflow-x: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: background-color 0.3s, color 0.3s;
}
#app {
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
    max-width: 800px; margin: 0 auto;
    background-color: var(--bg-color);
    overflow: hidden;
    position: relative;
}

.hidden { display: none !important; }

/* ================= 视图容器系统 ================= */
.view {
    position: absolute; inset: 0;
    bottom: 0; /* will be overridden by tab bar */
    display: flex; flex-direction: column;
    background-color: var(--bg-color);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1;
}
.view.active { z-index: 10; }
.view:not(.active) { display: none; }
/* 有底部 Tab Bar 的视图（列表页、设置页） */
#view-messages, #view-contacts, #view-moments, #view-settings {
    bottom: 64px;
    bottom: calc(64px + env(safe-area-inset-bottom));
}
/* 全屏视图（聊天详情、群聊聊天、新建群聊）——也需为 tab bar 让位 */
#view-chat-detail, #view-group-chat, #view-group-create {
    bottom: 64px;
    bottom: calc(64px + env(safe-area-inset-bottom));
}

/* ================= 视图头部 ================= */
.view-header {
    display: flex; align-items: center;
    height: 52px; padding: 0 16px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: background-color 0.3s;
}
.view-header-title {
    font-size: 18px; font-weight: 700;
    color: var(--text-color);
}
.back-btn {
    background: none; border: none;
    color: var(--active-color); font-size: 20px;
    cursor: pointer; padding: 0 8px 0 0;
    transition: opacity 0.2s;
}
.back-btn:active { opacity: 0.6; }

/* ================= 消息页头部 ================= */
.messages-header {
    display: flex; align-items: center;
    height: 52px; padding: 0 16px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: background-color 0.3s;
}
.messages-header-title {
    flex: 1; text-align: center;
    font-size: 18px; font-weight: 700;
    color: var(--text-color);
}
.header-avatar {
    width: 36px; height: 36px;
    border-radius: 50%; object-fit: cover;
    cursor: pointer; flex-shrink: 0;
    transition: opacity 0.2s;
}
.header-avatar:active { opacity: 0.7; }
.header-add-btn {
    width: 36px; height: 36px;
    background: none; border: none;
    color: var(--text-color);
    font-size: 28px; line-height: 1;
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, opacity 0.2s;
}
.header-add-btn:active {
    background: var(--chat-bg);
    opacity: 0.7;
}

/* ================= 消息页 Tab 切换 ================= */
.messages-tabs {
    display: flex;
    padding: 0 16px;
    gap: 0;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.messages-tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.messages-tab.active {
    color: var(--active-color);
    border-bottom-color: var(--active-color);
}

/* ================= 聊天详情头部 ================= */
.chat-header {
    display: flex; align-items: center; gap: 10px;
    height: 52px; padding: 0 12px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: background-color 0.3s;
}
.chat-header-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: none;  /* JS controls visibility */
}
.chat-header-avatar[src]:not([src=""]) { display: block; }
#chat-detail-title, #group-chat-title {
    font-size: 16px; font-weight: 600;
    color: var(--text-color);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#chat-detail-title { flex: 0 1 auto; }
#group-chat-title { flex: 1; }
.chat-emotion-tag {
    flex: 0 0 auto;
    font-size: 11px; font-weight: 400;
    padding: 2px 8px; border-radius: 10px;
    background: rgba(91,141,239,0.15);
    color: var(--active-color);
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden; text-overflow: ellipsis;
    margin-right: auto;
}
#chat-detail-settings-btn, #group-chat-info-btn {
    background: none; border: 1px solid var(--border-color);
    border-radius: 50%; width: 34px; height: 34px;
    font-size: 16px; cursor: pointer;
    color: var(--text-color);
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s;
}

/* ================= 底部 Tab Bar ================= */
#tab-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    display: flex;
    height: 64px;
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--tab-bar-bg);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    transition: background-color 0.3s;
}
.tab-btn {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    background: none; border: none;
    color: #888; cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.tab-btn.active { color: var(--active-color); }
.tab-icon { font-size: 22px; line-height: 1; }
.tab-label { font-size: 11px; }
.tab-btn { position: relative; }
.tab-badge {
    position: absolute; top: 4px; right: 50%;
    transform: translateX(22px);
    min-width: 16px; height: 16px; padding: 0 5px;
    background: #e74c3c; color: #fff;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
    border-radius: 8px;
    pointer-events: none;
}
.tab-badge.hidden { display: none; }

/* ================= 聊天列表搜索框 ================= */
.chat-list-search-wrap {
    padding: 10px 16px;
    background: var(--bg-color);
    flex-shrink: 0;
}
.chat-list-search-wrap input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.chat-list-search-wrap input:focus { border-color: var(--active-color); }

/* ================= 滚动列表通用 ================= */
.scroll-list {
    flex: 1; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* ================= 干员/群聊列表项 ================= */
.list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.list-item:active { background: var(--chat-bg); }
.list-item.pinned { background: var(--chat-bg); border-left: 3px solid var(--active-color); }
.list-item-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
    background-color: #555;
}
.list-item-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 4px;
}
.list-item-name {
    font-size: 15px; font-weight: 600;
    color: var(--text-color);
}
.list-item-preview {
    font-size: 12px; color: #888;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-bio {
    font-size: 12px; color: #888;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-badge {
    background: var(--active-color);
    color: #fff; font-size: 10px;
    padding: 2px 8px; border-radius: 10px;
    flex-shrink: 0;
}
/* 干员主动私聊消息项 */
.initiative-item {
    background: rgba(255, 152, 0, 0.06);
}
.initiative-item:active { background: rgba(255, 152, 0, 0.12); }
.initiative-badge {
    display: inline-block;
    background: #ff9800;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
}
/* 群聊列表项中的多头像拼图 */
.list-item-avatars {
    display: grid; gap: 2px;
    width: 48px; height: 48px;
    flex-shrink: 0;
}
.list-item-avatars.two { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.list-item-avatars.three { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.list-item-avatars.three img:first-child { grid-column: 1 / -1; }
.list-item-avatars.four { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.list-item-avatars img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 4px;
}

/* ================= 消息列表群聊分隔线 ================= */
.messages-section-divider {
    padding: 10px 16px 6px;
    font-size: 12px; color: #888;
    letter-spacing: 1px;
    font-weight: 600;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

/* ================= 消息列表空状态 ================= */
.messages-empty {
    flex: 1; display: flex;
    align-items: center; justify-content: center;
    color: #888; font-size: 15px;
}
.messages-empty.hidden { display: none; }

/* ================= 列表通用空状态 ================= */
.list-empty {
    text-align: center; color: #888;
    padding: 40px 20px; font-size: 14px;
}

/* ================= 新建群聊 ================= */
#group-create-ops { padding: 8px 0; }
.group-create-op {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.group-create-op:active { background: var(--chat-bg); }
.group-create-op img {
    width: 42px; height: 42px;
    border-radius: 50%; object-fit: cover;
    background-color: #555;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.group-create-op.selected img {
    border-color: var(--active-color);
    box-shadow: 0 0 10px rgba(91, 141, 239, 0.5);
}
.group-create-op-name {
    flex: 1; font-size: 15px; color: var(--text-color);
}
.group-create-op-check {
    width: 22px; height: 22px;
    border-radius: 50%; border: 2px solid var(--border-color);
    transition: all 0.2s;
    flex-shrink: 0;
}
.group-create-op.selected .group-create-op-check {
    background: var(--active-color); border-color: var(--active-color);
}
#group-create-confirm {
    background: var(--active-color); color: #fff;
    border: none; border-radius: 6px;
    padding: 6px 14px; font-size: 14px;
    cursor: pointer; font-weight: 600;
}
#group-create-confirm:disabled { opacity: 0.4; cursor: default; }

/* ================= 视图底部按钮 ================= */
.view-footer {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--header-bg);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}
#new-group-btn {
    width: 100%; padding: 12px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    color: var(--text-color); font-size: 15px;
    cursor: pointer; transition: all 0.2s;
}
#new-group-btn:active { border-color: var(--active-color); color: var(--active-color); }

/* ================= 设置页 ================= */
.settings-section {
    margin-bottom: 4px;
}
.settings-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 15px; color: var(--text-color);
    transition: background 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.settings-row:active { background: var(--chat-bg); }
.settings-row .settings-val { color: #888; font-size: 13px; }
.settings-row.danger { color: #e05555; }
.settings-row.danger .settings-val { color: #e05555; }

/* ================= 设置页 section 标题 ================= */
.settings-section-label {
    font-size: 12px; color: #888;
    padding: 20px 16px 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.settings-section-label:first-of-type { padding-top: 12px; }

/* ================= 设置页底部信息 ================= */
.settings-footer-info {
    padding: 40px 16px 32px;
    text-align: center;
}
.settings-footer-version {
    font-size: 12px; color: #555;
    margin-bottom: 6px;
}
.settings-footer-identity {
    font-size: 12px; color: #666;
}

/* ================= 博士人设编辑（结构化） ================= */
.doctor-field {
    margin-bottom: 10px;
}
.doctor-field-label {
    display: block;
    font-size: 12px; color: #888;
    margin-bottom: 4px;
    font-weight: 600;
}
.doctor-field textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-color); color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px; line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.settings-doctor-actions {
    display: flex; gap: 8px;
    padding: 10px 0 0;
}
.settings-btn-primary {
    padding: 7px 18px;
    background: var(--active-color); color: #fff;
    border: none; border-radius: 6px;
    font-size: 13px; cursor: pointer;
}
.settings-btn-secondary {
    padding: 7px 18px;
    background: transparent; color: #888;
    border: 1px solid var(--border-color); border-radius: 6px;
    font-size: 13px; cursor: pointer;
}
.doctor-field-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
}
.doctor-field-edit-btn {
    font-size: 11px;
    padding: 2px 10px;
    background: transparent;
    color: var(--active-color);
    border: 1px solid var(--active-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.doctor-field-edit-btn:hover { background: var(--active-color); color: #fff; }
.doctor-field-edit-btn.editing { background: var(--active-color); color: #fff; }
.doctor-field textarea[readonly] {
    background: var(--chat-bg);
    color: #999;
    cursor: default;
    border-style: dashed;
}
.doctor-field textarea:not([readonly]) {
    background: var(--bg-color);
    color: var(--text-color);
    cursor: text;
    border-style: solid;
    border-color: var(--active-color);
}
.settings-doctor-status {
    padding: 6px 0 0;
    font-size: 12px;
}
.settings-doctor-status.ok { color: var(--active-color); }
.settings-doctor-status.error { color: #e05555; }

/* ================= 头像选择器 ================= */
.avatar-picker {
    display: flex; flex-wrap: wrap; gap: 10px;
    padding: 4px 0;
}
.avatar-option {
    width: 52px; height: 52px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.15s;
    object-fit: cover;
}
.avatar-option:hover { border-color: #888; }
.avatar-option.selected { border-color: var(--active-color); }
.avatar-custom {
    border: 2px dashed #555;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #888;
    line-height: 1;
    transition: border-color 0.15s, color 0.15s;
}
.avatar-custom:hover { border-color: #aaa; color: #ccc; }
.avatar-custom.selected { border-color: var(--active-color); border-style: solid; }
.avatar-custom img {
    width: 100%; height: 100%;
    border-radius: 50%; object-fit: cover;
}

/* ================= API Key 弹窗 ================= */
#apikey-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.5);
}
#apikey-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    background: var(--header-bg);
    border-radius: 12px;
    width: calc(100vw - 64px); max-width: 400px;
    overflow: hidden;
}
.apikey-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.apikey-modal-header h3 { font-size: 16px; margin: 0; }
#apikey-close-btn {
    background: none; border: none;
    color: var(--text-color); font-size: 18px; cursor: pointer;
    padding: 4px 8px;
}
.apikey-modal-body {
    padding: 20px;
    display: flex; flex-direction: column; gap: 8px;
}
.apikey-modal-body label {
    font-size: 13px; color: #888;
    margin-top: 4px;
}
.apikey-modal-body input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    outline: none;
}
.apikey-modal-body input:focus {
    border-color: var(--active-color);
}
.apikey-hint {
    font-size: 12px; color: #666;
    margin-top: 8px;
    line-height: 1.5;
}
.apikey-modal-footer {
    display: flex; gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}
.apikey-modal-footer button {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--header-bg);
    color: var(--text-color);
    font-size: 14px; cursor: pointer;
    transition: background 0.15s;
}
.apikey-modal-footer button:active { background: var(--chat-bg); }
#apikey-save-btn {
    background: var(--active-color);
    color: #fff;
    border-color: var(--active-color);
}
#apikey-save-btn:disabled {
    opacity: 0.5; cursor: default;
}
#apikey-test-btn:disabled {
    opacity: 0.5; cursor: default;
}
/* ================= 隐藏 NSFW 暗号配置 ================= */
.nsfw-settings-label { color: #c8a050 !important; }
.nsfw-collapse-header {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 6px;
}
.nsfw-collapse-header:hover { opacity: 0.8; }
.nsfw-collapse-arrow { font-size: 10px; transition: transform 0.2s; }
/* ================= 设置页下拉选择框 ================= */
.settings-row-select select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    min-width: 80px;
    text-align: right;
    -webkit-appearance: none;
    appearance: none;
}
.settings-row-select select:focus {
    border-color: var(--accent-color);
}
.settings-row-static {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px 4px;
    font-size: 14px; color: var(--text-color);
}
.nsfw-hint { font-size: 11px; color: #666; }
.settings-row-input {
    padding: 4px 16px 14px;
}
.settings-row-input input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 13px;
    outline: none;
}
.settings-row-input input:focus {
    border-color: #c8a050;
}
.nsfw-settings-note {
    padding: 12px 16px 32px;
    font-size: 12px; color: #666;
    line-height: 1.6;
}

/* ================= 管理员邀请码管理 ================= */
.admin-invite-list {
    padding: 0 16px;
}
.admin-invite-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.admin-invite-item.used { opacity: 0.45; }
.admin-invite-code {
    font-family: monospace; font-size: 15px;
    color: var(--accent-color); font-weight: bold;
    flex: 1;
}
.admin-invite-meta {
    font-size: 12px; color: #888;
}
.admin-invite-del {
    background: none; border: none;
    color: #e05555; cursor: pointer;
    font-size: 16px; padding: 4px 8px;
    border-radius: 4px;
}
.admin-invite-del:hover { background: rgba(224,85,85,0.1); }
.admin-invite-empty {
    padding: 24px 16px; text-align: center;
    font-size: 13px; color: #666;
}
.admin-badge {
    font-size: 11px; color: #e0a055; font-weight: normal;
}

/* ================= 管理员运行时配置编辑器 ================= */
#admin-config-editor {
    padding: 8px 16px 16px;
}
#admin-config-textarea {
    width: 100%; box-sizing: border-box;
    background: #1a1a2e; color: #ccc;
    border: 1px solid var(--border-color);
    border-radius: 6px; padding: 12px;
    font-family: monospace; font-size: 13px;
    resize: vertical; line-height: 1.6;
}
.admin-config-actions {
    display: flex; gap: 10px;
    margin-top: 10px;
}
.admin-config-actions button {
    padding: 8px 20px; border-radius: 6px;
    font-size: 14px; cursor: pointer; border: none;
}
#admin-config-save { background: var(--accent-color); color: #fff; }
#admin-config-cancel { background: transparent; color: #666; border: 1px solid var(--border-color); }
.admin-user-del {
    margin-left: auto;
}

/* ================= 干员主页 ================= */
#view-operator-profile { background: var(--bg-color); }
.profile-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    font-size: 17px; color: var(--text-color);
}
.profile-scroll {
    overflow-y: auto; height: calc(100vh - 110px); /* header + tab-bar */
    padding-bottom: 20px;
}
.profile-card {
    display: flex; flex-direction: column; align-items: center;
    padding: 28px 20px 20px;
    background: var(--header-bg);
    margin-bottom: 12px;
}
.profile-avatar-wrap { margin-bottom: 14px; }
.profile-avatar-wrap img {
    width: 80px; height: 80px; border-radius: 50%;
    border: 3px solid var(--active-color);
    object-fit: cover;
}
.profile-info { text-align: center; margin-bottom: 20px; }
.profile-name { font-size: 22px; font-weight: bold; color: var(--text-color); }
.profile-faction {
    display: inline-block; margin-top: 6px;
    padding: 3px 12px; border-radius: 12px;
    background: var(--active-color); color: #fff;
    font-size: 12px;
}
.profile-emotion-tabs {
    display: flex; gap: 8px; margin-bottom: 8px;
}
.emotion-tab {
    background: none; border: 1px solid #444; color: #888;
    padding: 2px 12px; border-radius: 10px; font-size: 11px;
    cursor: pointer; transition: all 0.15s;
}
.emotion-tab.active {
    border-color: var(--active-color); color: var(--active-color);
}
.emotion-tab:hover { border-color: #888; }
.profile-emotion-chart {
    width: 100%; min-height: 160px;
    display: flex; align-items: center; justify-content: center;
}
.profile-section {
    margin: 0 16px 12px; padding: 16px;
    background: var(--header-bg); border-radius: 10px;
}
.profile-section-title {
    font-size: 12px; color: #888; margin-bottom: 10px;
    text-transform: uppercase; letter-spacing: 1px;
}
.profile-trust-bar-wrap {
    display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.profile-trust-bar {
    flex: 1; height: 8px; background: var(--chat-bg);
    border-radius: 4px; overflow: hidden;
}
.profile-trust-bar-fill {
    height: 100%; background: var(--active-color);
    border-radius: 4px; transition: width 0.6s ease;
}
#profile-trust-value { font-size: 14px; color: var(--text-color); white-space: nowrap; }
.profile-trust-attitude {
    font-size: 13px; color: #888;
}
.profile-chat-stats, .profile-bio {
    font-size: 14px; color: var(--text-color); line-height: 1.6;
}
.profile-section-link {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; user-select: none;
    font-size: 15px; color: var(--text-color);
}
.profile-section-link:active { background: var(--chat-bg); }
.profile-link-arrow { color: #888; font-size: 16px; }
.profile-chat-btn-wrap {
    padding: 16px 0 8px;
    display: flex; justify-content: center;
}
.profile-start-chat-btn {
    width: 100%; max-width: 280px;
    padding: 12px 0;
    background: var(--active-color); color: #fff;
    border: none; border-radius: 8px;
    font-size: 16px; font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.profile-start-chat-btn:active { opacity: 0.8; }
.profile-relation-graph { width: 100%; height: 260px; position: relative; overflow: hidden; }
.profile-relation-graph svg { width: 100%; height: 100%; }
.profile-relation-placeholder { color: #888; font-size: 13px; display: flex; align-items: center; justify-content: center; height: 100%; }
.relation-node circle { stroke: var(--text-color); stroke-width: 1.5px; cursor: pointer; transition: r 0.2s; }
.relation-node text { font-size: 11px; fill: var(--text-color); pointer-events: none; text-anchor: middle; }
.relation-edge { stroke: #666; stroke-opacity: 0.5; fill: none; }
.relation-edge.positive { stroke: #4a9; }
.relation-edge.negative { stroke: #c55; }
.relation-edge.doctor { stroke: #c8a440; stroke-dasharray: 5 3; stroke-opacity: 0.6; }
.relation-edge.dynamic { stroke: #f90; stroke-dasharray: 3 3; stroke-opacity: 0.7; animation: edge-pulse 2s ease-in-out infinite; }
@keyframes edge-pulse { 0%, 100% { stroke-opacity: 0.4; } 50% { stroke-opacity: 0.9; } }

/* ================= PIN 验证弹窗 ================= */
#pin-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.7);
}
#pin-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 301;
    background: var(--header-bg);
    border: 1px solid #c8a050;
    border-radius: 12px;
    width: calc(100vw - 64px); max-width: 360px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(200,160,80,0.15);
}
.pin-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.pin-modal-header h3 { font-size: 16px; color: #c8a050; margin: 0; }
#pin-close-btn {
    background: none; border: none;
    color: var(--text-color); font-size: 18px; cursor: pointer;
}
.pin-modal-body {
    padding: 20px;
    display: flex; flex-direction: column; gap: 12px;
}
.pin-warning {
    font-size: 13px; color: #c8a050;
    text-align: center; margin: 0;
}
#pin-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 18px; text-align: center; letter-spacing: 8px;
    outline: none;
}
#pin-input:focus { border-color: #c8a050; }
.pin-error {
    font-size: 12px; color: #e05555;
    text-align: center; margin: 0;
}
.pin-modal-footer {
    display: flex;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    justify-content: center;
}
#pin-confirm-btn {
    width: 100%;
    padding: 10px 20px;
    border: 1px solid #c8a050;
    border-radius: 8px;
    background: rgba(200,160,80,0.1);
    color: #c8a050;
    font-size: 14px; cursor: pointer;
    transition: background 0.15s;
}
#pin-confirm-btn:active { background: rgba(200,160,80,0.25); }

/* NSFW 视觉做减法：降低遮罩强度 */
#nsfw-veil {
    opacity: 0.4 !important;
    transition: opacity 1s ease;
}
#nsfw-veil.active { opacity: 0.6 !important; }

/* ================= ntfy 推送通知弹窗（顶部弹出，避开键盘） ================= */
#ntfy-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}
#ntfy-modal {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--bg-color);
    z-index: 1001;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ntfy-modal-header {
    display: flex; align-items: center; justify-content: space-between;
}
.ntfy-modal-header span {
    font-size: 15px; font-weight: 600;
    color: var(--text-color);
}
#ntfy-close-btn {
    background: none; border: none;
    color: #888; font-size: 18px; cursor: pointer;
    padding: 0 4px;
}
.ntfy-modal-body {
    display: flex; flex-direction: column; gap: 10px;
}
.ntfy-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    color: var(--text-color); font-size: 14px;
}
.ntfy-modal-hint {
    font-size: 12px; color: #888; line-height: 1.6;
}
.ntfy-modal-hint a {
    color: var(--active-color); text-decoration: none;
}
.ntfy-topic-url {
    display: inline-block;
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--chat-bg);
    border-radius: 4px;
    font-size: 12px;
    color: var(--active-color);
    word-break: break-all;
    user-select: all;
}
.ntfy-modal-footer {
    display: flex; gap: 8px;
}
#ntfy-save-btn {
    flex: 1;
    padding: 9px 0;
    background: var(--active-color); color: #fff;
    border: none; border-radius: 8px;
    font-size: 14px; cursor: pointer;
}
#ntfy-save-btn:active { opacity: 0.8; }

/* ntfy toggle switch */
.ntfy-switch {
    position: relative;
    display: inline-block;
    width: 48px; height: 26px;
}
.ntfy-switch input { opacity: 0; width: 0; height: 0; }
.ntfy-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #555;
    border-radius: 26px;
    transition: 0.2s;
}
.ntfy-slider::before {
    content: "";
    position: absolute;
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}
.ntfy-switch input:checked + .ntfy-slider {
    background: var(--active-color);
}
.ntfy-switch input:checked + .ntfy-slider::before {
    transform: translateX(22px);
}

/* ================= NSFW Toggle Switch ================= */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px; height: 26px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #555;
    border-radius: 26px;
    transition: background 0.3s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: #c8a050;
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}
.memory-nsfw-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--chat-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.memory-nsfw-row span {
    font-size: 14px; color: var(--text-color);
}

/* ================= 群聊设置面板 ================= */
#group-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    transition: opacity 0.3s;
}
#group-overlay.hidden { opacity: 0; pointer-events: none; }
#group-panel {
    position: fixed; top: 0; right: 0;
    width: 400px; max-width: 90vw;
    height: 100vh; height: 100dvh;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    z-index: 1001; display: flex; flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}
#group-panel.hidden { transform: translateX(100%); box-shadow: none; }
.group-panel-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.group-panel-header h2 { font-size: 18px; margin: 0; color: var(--text-color); }
#group-panel-close-btn {
    margin-left: auto; background: none;
    border: 1px solid var(--border-color); border-radius: 50%;
    width: 32px; height: 32px; cursor: pointer;
    color: var(--text-color); font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}
.group-panel-body {
    flex: 1; overflow-y: auto; padding: 20px;
    -webkit-overflow-scrolling: touch;
}
.group-settings-section {
    margin-bottom: 22px;
}
.group-settings-section label {
    display: block; font-size: 13px; color: #888;
    margin-bottom: 8px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.group-settings-section input,
.group-settings-section textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 14px; font-family: inherit;
    transition: border-color 0.2s;
}
.group-settings-section input:focus,
.group-settings-section textarea:focus {
    border-color: var(--active-color); outline: none;
}
.group-settings-section textarea {
    resize: vertical; min-height: 60px;
}
.group-panel-footer {
    padding: 16px 20px; border-top: 1px solid var(--border-color);
    display: flex; gap: 10px; flex-shrink: 0;
}
.group-panel-footer button {
    flex: 1; padding: 12px;
    border: 1px solid var(--border-color); border-radius: 8px;
    background: transparent; color: var(--text-color);
    font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.group-panel-footer button:active { opacity: 0.7; }
.group-panel-footer .danger-btn {
    color: #e05555; border-color: #e05555;
}

/* ================= 群聊成员列表 ================= */
.group-member-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.group-member-item img {
    width: 36px; height: 36px;
    border-radius: 50%; object-fit: cover;
    background: #555; flex-shrink: 0;
}
.group-member-item .member-name {
    flex: 1; font-size: 14px; color: var(--text-color);
}
.group-member-item .member-remove-btn {
    background: none; border: none;
    color: #888; font-size: 16px; cursor: pointer;
    padding: 4px 8px; transition: color 0.2s;
}
.group-member-item .member-remove-btn:hover { color: #e05555; }

/* ================= 添加成员弹窗 ================= */
#add-member-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); z-index: 1010;
    transition: opacity 0.3s;
}
#add-member-overlay.hidden { opacity: 0; pointer-events: none; }
#add-member-modal {
    position: fixed; top: 10%; left: 50%;
    transform: translate(-50%, 0);
    width: 380px; max-width: 90vw; max-height: 70vh;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    z-index: 1011; display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#add-member-modal.hidden { display: none; }
.add-member-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--border-color);
}
.add-member-header h3 { margin: 0; font-size: 16px; color: var(--text-color); }
#add-member-close-btn {
    background: none; border: none; color: #888;
    font-size: 18px; cursor: pointer;
}
#add-member-list {
    flex: 1; overflow-y: auto; padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}
.add-member-op {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; cursor: pointer; transition: background 0.15s;
}
.add-member-op:active { background: var(--chat-bg); }
.add-member-op img {
    width: 38px; height: 38px;
    border-radius: 50%; object-fit: cover; background: #555;
    border: 2px solid transparent; transition: border-color 0.2s;
}
.add-member-op.selected img {
    border-color: var(--active-color);
    box-shadow: 0 0 8px rgba(91,141,239,0.4);
}
.add-member-op .add-member-op-name { flex: 1; font-size: 14px; color: var(--text-color); }
.add-member-op .add-member-op-check {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--border-color); transition: all 0.2s;
}
.add-member-op.selected .add-member-op-check {
    background: var(--active-color); border-color: var(--active-color);
}
.add-member-footer {
    padding: 12px 16px; border-top: 1px solid var(--border-color);
}
#add-member-confirm-btn {
    width: 100%; padding: 12px;
    background: var(--active-color); color: #fff;
    border: none; border-radius: 8px;
    font-size: 14px; font-weight: bold; cursor: pointer;
}
#add-member-confirm-btn:disabled { opacity: 0.4; cursor: default; }

/* ================= 聊天区域（共享） ================= */
#chat-area, #group-chat-area {
    flex: 1; min-height: 0;
    overflow-y: auto; padding: 15px;
    -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column;
}
.message {
    display: flex; align-items: flex-start;
    margin-bottom: 15px; width: 100%; flex-shrink: 0;
}
.avatar {
    width: 40px; height: 40px;
    border-radius: 6px; object-fit: cover;
    flex-shrink: 0; background-color: #555;
    cursor: pointer;
}
.bubble {
    position: relative;
    max-width: 75%; padding: 10px 14px;
    border-radius: 12px; line-height: 1.5;
    font-size: 16px; word-wrap: break-word; overflow-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: background-color 0.3s, color 0.3s;
}
.message.doctor { flex-direction: row-reverse; }
.message.doctor .avatar { margin-left: 10px; }
.message.doctor .bubble {
    background-color: var(--doctor-bubble); color: #fff;
    border-top-right-radius: 2px;
}
.message.operator { flex-direction: row; }
.message.operator .avatar { margin-right: 10px; }
.message.operator .bubble {
    background-color: var(--operator-bubble); color: var(--text-color);
    border-top-left-radius: 2px;
}
.message.action { justify-content: center; }
.message.action .bubble {
    background-color: transparent; color: #888;
    font-style: italic; text-align: center;
    box-shadow: none; padding: 0; max-width: 90%;
}
/* 群聊干员名称标签 */
.msg-sender-name {
    font-size: 11px; color: var(--active-color);
    margin-bottom: 2px; margin-left: 4px; font-weight: 600;
}
/* 群聊发言闪烁 */
.message.speaking .bubble {
    animation: speak-pulse 1.5s ease-in-out infinite;
}
@keyframes speak-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(91,141,239,0.2); }
    50% { box-shadow: 0 0 12px rgba(91,141,239,0.5); }
}

/* ================= 底部输入区（共享） ================= */
#input-area, #group-input-area {
    display: flex; padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background-color: var(--header-bg);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: background-color 0.3s;
}
#msg-input, #group-msg-input {
    flex: 1; padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px; background-color: var(--input-bg);
    color: var(--text-color); font-size: 16px; line-height: 1.4;
    outline: none; transition: all 0.3s;
    resize: none; overflow-y: auto;
    min-height: 42px; max-height: 150px;
    font-family: inherit;
}
#msg-input:focus, #group-msg-input:focus { border-color: #5b8def; }
#send-btn, #group-send-btn {
    margin-left: 10px; padding: 0 20px;
    background-color: #5b8def; color: white;
    border: none; border-radius: 20px;
    font-size: 16px; font-weight: bold; cursor: pointer;
}
#send-btn:active, #group-send-btn:active { background-color: #4a7bd4; }

/* 场景模式小图标 */
.scene-mode-btn {
    margin-right: 6px; width: 36px; height: 36px;
    border-radius: 50%; border: none;
    background: transparent; color: #888;
    font-size: 16px; cursor: pointer; transition: all 0.3s;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 20px;
}
.scene-mode-btn.active {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9a96e' stroke-width='2'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
    box-shadow: 0 0 10px rgba(201,169,110,0.3);
}
/* 发送按钮动态文字 */
#send-btn, #group-send-btn {
    transition: all 0.2s;
}

/* ================= 消息时间戳 ================= */
.time-divider {
    text-align: center; margin: 12px 0 4px;
    font-size: 11px; color: #777;
    user-select: none;
}
.msg-time {
    display: block; font-size: 10px; color: #999;
    margin-top: 4px; text-align: right;
    opacity: 0; transition: opacity 0.2s;
}
.message:hover .msg-time {
    opacity: 1;
}

/* ================= 输入状态提示 ================= */
.typing-indicator {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 16px; margin-bottom: 15px;
    font-size: 13px; color: #888;
    animation: typing-pulse 1.5s ease-in-out infinite;
}
@keyframes typing-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ================= 未读红点 ================= */
.list-item-badge {
    min-width: 20px; height: 20px;
    border-radius: 10px;
    background: #e05555; color: #fff;
    font-size: 11px; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    padding: 0 6px; margin-left: auto; flex-shrink: 0;
}
/* 场景模式消息 */
.message.doctor.scene .bubble {
    font-style: italic; color: #b0a090;
    background-color: rgba(61, 90, 128, 0.35);
    border: 1px dashed rgba(160, 140, 120, 0.3);
}

/* ================= 登录页 ================= */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; min-height: 100dvh;
    background: #1a1a1a; padding: 20px;
}
.login-container {
    text-align: center; background: #2b2b2b;
    padding: 40px 30px; border-radius: 16px;
    width: 100%; max-width: 420px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.login-avatar {
    width: 80px; height: 80px;
    border-radius: 50%; margin-bottom: 16px; object-fit: cover;
}
.login-container h2 {
    color: #e0e0e0; font-size: 18px;
    margin-bottom: 24px; font-weight: normal;
}
.input-group { text-align: left; margin-bottom: 16px; }
.input-group label { display: block; color: #888; font-size: 14px; margin-bottom: 6px; }
.input-group input {
    width: 100%; padding: 12px 14px;
    border: 1px solid #444; border-radius: 8px;
    background: #1a1a1a; color: #e0e0e0;
    font-size: 16px; outline: none;
    transition: border-color 0.3s; -webkit-appearance: none;
}
.input-group input:focus { border-color: #5b8def; }
.login-btn {
    width: 100%; padding: 14px; margin-top: 8px;
    background: #5b8def; color: #fff;
    border: none; border-radius: 8px;
    font-size: 16px; font-weight: bold; cursor: pointer;
    transition: background 0.2s; -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}
.login-btn:active { background: #4a7bd4; }
.error-msg { color: #e05555; font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-tabs {
    display: flex; gap: 0;
    margin-bottom: 20px;
    border: 1px solid #444; border-radius: 8px;
    overflow: hidden;
}
.login-tab {
    flex: 1; padding: 10px 0;
    background: #1a1a1a; color: #888;
    border: none; font-size: 14px; cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.login-tab.active { background: #5b8def; color: #fff; }
.login-tab:first-child { border-right: 1px solid #444; }
.login-hint {
    color: #666; font-size: 12px;
    margin-bottom: 8px; text-align: left;
    line-height: 1.5;
}

/* ================= NSFW 里模式视觉 ================= */
#nsfw-veil {
    position: fixed; inset: 0; z-index: 100;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(200,160,80,0.0) 0%, rgba(180,120,60,0.0) 100%);
    transition: background 2.5s ease-out;
}
body.nsfw-entering #nsfw-veil,
body.nsfw-mode:not(.nsfw-entering):not(.nsfw-exiting) #nsfw-veil {
    background: radial-gradient(ellipse at center, rgba(200,160,80,0.08) 0%, rgba(180,120,60,0.03) 100%);
}
body.nsfw-exiting #nsfw-veil {
    background: radial-gradient(ellipse at center, rgba(200,160,80,0.0) 0%, rgba(180,120,60,0.0) 100%);
    transition: background 2s ease-out;
}
body.nsfw-entering #chat-area,
body.nsfw-entering #group-chat-area {
    background-color: #2a2520;
    transition: background-color 2.5s ease-out;
}
body.nsfw-mode:not(.nsfw-entering):not(.nsfw-exiting) #chat-area,
body.nsfw-mode:not(.nsfw-entering):not(.nsfw-exiting) #group-chat-area {
    background-color: #2a2520;
    transition: background-color 0.6s ease;
}
body.nsfw-exiting #chat-area,
body.nsfw-exiting #group-chat-area {
    background-color: var(--chat-bg);
    transition: background-color 2s ease-out;
}
body.nsfw-entering .chat-header,
body.nsfw-mode:not(.nsfw-entering):not(.nsfw-exiting) .chat-header {
    border-bottom-color: #5a4a3a;
    transition: border-color 2.5s ease-out;
}
body.nsfw-exiting .chat-header {
    border-bottom-color: var(--border-color);
    transition: border-color 2s ease-out;
}

/* ================= 聊天操作按钮 ================= */
.chat-clear-btn {
    background: transparent; color: #888;
    border: none; font-size: 16px; cursor: pointer;
    padding: 0 4px; transition: color 0.2s;
}
.chat-clear-btn:hover { color: #e05555; }

/* ================= 聊天项上下文菜单 ================= */
#chat-context-menu {
    position: fixed; z-index: 500;
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    min-width: 140px;
}
#chat-context-menu button {
    display: block; width: 100%; padding: 12px 16px;
    border: none; background: transparent;
    color: var(--text-color); font-size: 14px;
    cursor: pointer; text-align: left;
    border-bottom: 1px solid var(--border-color);
}
#chat-context-menu button:last-child { border-bottom: none; }
#chat-context-menu button:active { background: var(--chat-bg); }
#chat-context-menu button[data-action="delete"] { color: #e05555; }

/* ================= 深聊模式 ================= */
.deep-chat-btn {
    background: transparent; color: #888;
    border: none; font-size: 20px; cursor: pointer;
    padding: 0 6px; transition: all 0.3s;
}
.deep-chat-btn:hover { color: #ccc; }
.deep-chat-btn.active { color: #c9a96e; text-shadow: 0 0 8px rgba(201,169,110,0.4); }

#deep-chat-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; background: rgba(91,141,239,0.08);
    border-bottom: 1px solid rgba(91,141,239,0.2);
    flex-shrink: 0; font-size: 13px;
    transition: all 0.4s;
}
#deep-chat-bar.hidden { display: none; }
#deep-chat-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #5b8def; flex-shrink: 0;
    transition: background 0.6s;
}
#deep-chat-topic-label { color: var(--text-color); font-weight: bold; flex: 1; }
.deep-chat-round { color: #888; font-size: 12px; flex-shrink: 0; }
.deep-chat-end-btn {
    background: transparent; color: #888;
    border: 1px solid #555; border-radius: 12px;
    padding: 2px 12px; font-size: 12px; cursor: pointer;
    transition: all 0.3s; flex-shrink: 0;
}
.deep-chat-end-btn:hover { border-color: #e05555; color: #e05555; }

#deep-chat-cards {
    padding: 6px 12px; background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; overflow: hidden;
    transition: all 0.4s;
}
#deep-chat-cards.hidden { display: none; }
#deep-chat-cards-scroll {
    display: flex; gap: 8px; overflow-x: auto;
    scrollbar-width: none; padding: 2px 0;
}
#deep-chat-cards-scroll::-webkit-scrollbar { display: none; }
.deep-card {
    flex-shrink: 0; padding: 4px 10px;
    background: rgba(91,141,239,0.12); border: 1px solid rgba(91,141,239,0.25);
    border-radius: 12px; font-size: 12px; color: var(--text-color);
    white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
    animation: cardIn 0.3s ease-out;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}
.deep-card.star {
    background: rgba(200,160,80,0.18); border-color: rgba(200,160,80,0.45);
    font-weight: 600; box-shadow: 0 0 4px rgba(200,160,80,0.15);
}

/* 情绪弧线 */
#deep-emotion-arc {
    display: flex; gap: 4px; align-items: center; margin-top: 6px; padding: 2px 4px;
}
.emotion-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    transition: background 0.4s ease;
}

/* 沉浸模式：深聊时隐藏 tab bar */
#tab-bar.deep-chat-immersive {
    transform: translateY(100%);
    transition: transform 0.4s ease;
}
#view-chat-detail.deep-chat-active {
    bottom: 0;
    bottom: env(safe-area-inset-bottom, 0);
    transition: bottom 0.4s ease;
}

/* ================= 记忆管理面板 ================= */
#memory-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    transition: opacity 0.3s;
}
#memory-overlay.hidden { opacity: 0; pointer-events: none; }
#memory-panel {
    position: fixed; top: 0; right: 0;
    width: 400px; max-width: 90vw;
    height: 100vh; height: 100dvh;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    z-index: 1001; display: flex; flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}
#memory-panel.hidden { transform: translateX(100%); box-shadow: none; }
.memory-panel-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.memory-panel-header h2 { font-size: 18px; margin: 0; color: var(--text-color); }
#memory-operator-name { color: var(--active-color); font-weight: bold; font-size: 14px; }
#memory-close-btn {
    margin-left: auto; background: none;
    border: 1px solid var(--border-color); border-radius: 50%;
    width: 32px; height: 32px; cursor: pointer;
    color: var(--text-color); font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
#memory-close-btn:hover { color: #e05555; border-color: #e05555; }
.memory-panel-body {
    flex: 1; overflow-y: auto; padding: 20px;
    -webkit-overflow-scrolling: touch;
}
.memory-section { margin-bottom: 28px; }
.memory-section h3 {
    font-size: 14px; color: #888; margin-bottom: 12px;
    padding-bottom: 6px; border-bottom: 1px solid var(--border-color);
    text-transform: uppercase; letter-spacing: 1px;
}
.memory-item {
    background: #3a3a3a; border: 1px solid #555;
    border-radius: 8px; padding: 12px; margin-bottom: 10px;
    transition: border-color 0.2s; color: #e8e8e8;
}
.memory-item:hover { border-color: #5b8def; }
.memory-item-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.memory-item-time { font-size: 11px; color: #999; }
.memory-item-topic { font-size: 11px; color: var(--active-color); font-weight: bold; }
.memory-edit-hint {
    font-size: 10px; color: var(--text-color);
    border: 1px solid var(--border-color); border-radius: 3px;
    padding: 1px 6px; opacity: 0.5;
}
.memory-item-summary {
    width: 100%; background: #2a2a2a;
    border: 1px solid #555; border-radius: 6px;
    padding: 8px 10px; color: #e0e0e0;
    font-size: 13px; font-family: inherit; line-height: 1.5;
    resize: vertical; min-height: 60px; transition: all 0.2s;
    cursor: text;
}
.memory-item-summary:hover {
    border-color: var(--active-color);
    opacity: 0.7;
}
.memory-item-summary:focus {
    border-color: var(--active-color); outline: none;
    box-shadow: inset 0 0 0 1px rgba(91,141,239,0.2);
    background: var(--input-bg);
}
.memory-item-fact { display: flex; align-items: center; gap: 10px; }
.memory-item-fact-text { flex: 1; font-size: 13px; color: var(--text-color); line-height: 1.5; }
.memory-delete-btn {
    background: none; border: 1px solid transparent; border-radius: 4px;
    color: #888; cursor: pointer; font-size: 12px;
    padding: 4px 8px; transition: all 0.2s; flex-shrink: 0;
}
.memory-delete-btn:hover { color: #e05555; border-color: #e05555; }
.op-settings-form { display: flex; flex-direction: column; gap: 10px; }
.op-setting-row { display: flex; align-items: center; gap: 10px; }
.op-setting-row label { font-size: 13px; color: #aaa; min-width: 60px; flex-shrink: 0; }
.op-setting-row input[type="text"],
.op-setting-row select {
    flex: 1; background: var(--input-bg); border: 1px solid var(--border-color);
    border-radius: 6px; padding: 8px 10px; color: var(--text-color);
    font-size: 14px; font-family: inherit;
}
.op-setting-row input[type="text"]:focus,
.op-setting-row select:focus { border-color: var(--active-color); outline: none; }
.op-setting-row-col { flex-direction: column; align-items: stretch; }
.op-setting-row-col label { min-width: auto; }
.op-setting-row-col textarea {
    width: 100%; background: var(--input-bg); border: 1px solid var(--border-color);
    border-radius: 6px; padding: 8px 10px; color: var(--text-color);
    font-size: 13px; font-family: inherit; line-height: 1.5;
    resize: vertical; min-height: 56px;
}
.op-setting-row-col textarea:focus { border-color: var(--active-color); outline: none; }

.memory-panel-footer {
    padding: 16px 20px; border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}
#memory-clear-all-btn {
    width: 100%; padding: 12px; background: transparent;
    border: 1px solid #e05555; border-radius: 8px;
    color: #e05555; font-size: 14px; font-weight: bold;
    cursor: pointer; transition: all 0.2s;
}
#memory-clear-all-btn:hover { background: #e05555; color: #fff; }
#memory-clear-all-btn.confirm {
    background: #e05555; color: #fff;
    animation: pulse-red 0.6s ease-in-out infinite alternate;
}
@keyframes pulse-red {
    from { box-shadow: 0 0 4px rgba(224,85,85,0.4); }
    to   { box-shadow: 0 0 16px rgba(224,85,85,0.8); }
}
.memory-empty { text-align: center; color: #555; font-size: 13px; padding: 20px 0; font-style: italic; }
.memory-saved {
    color: #4caf50; font-size: 11px; margin-left: 8px;
    opacity: 0; transition: opacity 0.3s;
}
.memory-saved.show { opacity: 1; }

/* L2 添加表单 */
#l2-add-topic, #l2-add-summary {
    width: 100%;
    background: var(--input-bg); border: 1px solid var(--border-color);
    color: var(--text-color); border-radius: 4px; font-size: 13px;
}
#l2-add-topic { padding: 4px 8px; margin-bottom: 6px; }
#l2-add-summary { padding: 6px 8px; }
#l2-add-cancel { background: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color); padding: 4px 12px; border-radius: 4px; cursor: pointer; }
#l2-add-save { background: #2a5a2a; color: #ccc; border: 1px solid #3a7a3a; padding: 4px 12px; border-radius: 4px; cursor: pointer; }

/* ================= 信赖值详情（记忆面板内） ================= */
#trust-section h3 { color: #c8a050; }
.trust-bar-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.trust-bar { flex: 1; height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden; }
.trust-bar-fill { width: 0; height: 100%; background: #888; border-radius: 4px; transition: width 0.6s ease, background 0.6s ease; }
.trust-value-text { font-size: 14px; font-weight: bold; color: var(--text-color); min-width: 50px; text-align: right; }
.trust-attitude {
    font-size: 12px; color: #888; line-height: 1.6;
    margin-bottom: 16px; padding: 8px 10px;
    background: var(--chat-bg); border-radius: 6px; border-left: 3px solid #c8a050;
}
.trust-history-title { font-size: 11px; color: #666; margin-bottom: 8px; letter-spacing: 0.5px; }
.trust-history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 12px;
}
.trust-history-item .change { font-weight: bold; min-width: 36px; text-align: right; }
.trust-history-item .change.positive { color: #4caf50; }
.trust-history-item .change.negative { color: #e05555; }
.trust-history-item .date { color: #555; margin-left: 8px; }
.trust-history-item .reason { flex: 1; color: #999; margin-left: 8px; }

/* ================= 动态页 ================= */
#view-moments {
    display: flex; flex-direction: column;
}
/* 子Tab */
.moments-tabs {
    display: flex; gap: 0;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color, #333);
}
.moments-tab {
    flex: 1; padding: 8px 0;
    font-size: 14px; font-weight: 500;
    color: #888; background: none; border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer; transition: all 0.2s;
    text-align: center;
}
.moments-tab.active {
    color: var(--active-color);
    border-bottom-color: var(--active-color);
}
.moments-scroll {
    flex: 1; overflow-y: auto;
}
.moments-placeholder {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 60px 20px; color: #888; font-size: 15px;
    gap: 8px; text-align: center;
}
.moments-empty-hint {
    font-size: 12px; color: #aaa;
}
/* 动态卡片 */
.moment-card {
    margin: 0 12px 10px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--card-bg, #2a2a2a);
    border: 1px solid var(--border-color, #333);
}
.moment-card-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.moment-type-tag {
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 10px;
    letter-spacing: 0.3px;
}
.moment-type-broadcast { background: rgba(91,141,239,0.15); color: #5b8def; }
.moment-type-rumor { background: rgba(201,169,110,0.15); color: #c9a96e; }
.moment-type-daily_life { background: rgba(136,204,136,0.15); color: #8c8; }
.moment-type-emergency { background: rgba(224,85,85,0.15); color: #e55; }
.moment-type-operator_post { background: rgba(180,140,220,0.15); color: #b48cdc; }
.moment-time {
    font-size: 11px; color: #888; margin-left: auto;
}
.moment-card-body {
    font-size: 14px; line-height: 1.6; color: var(--text-color);
    white-space: pre-wrap;
}
.moment-delete-btn {
    position: absolute; bottom: 8px; right: 12px;
    border: none; background: transparent;
    color: #888; font-size: 12px;
    cursor: pointer; padding: 2px 6px;
    transition: color 0.15s;
    z-index: 1;
}
.moment-delete-btn:hover {
    color: #e55;
}
.moment-card-footer {
    margin-top: 10px; font-size: 11px;
    color: #888; padding-top: 8px;
    border-top: 1px solid var(--border-color, #333);
}
/* 干员个人动态卡片（社交媒体风格） */
.operator-post-card {
    padding: 12px 16px;
}
.op-post-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 10px;
}
.op-post-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--border-color);
}
.op-post-header-info {
    display: flex; flex-direction: column;
    gap: 2px;
}
.op-post-name {
    font-size: 14px; font-weight: 600;
    color: var(--active-color);
}
.op-post-time {
    font-size: 11px; color: #888;
}
.op-post-body {
    font-size: 14px; line-height: 1.7;
    padding-left: 0;
}
.op-post-comments {
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    margin-top: 8px;
    background: var(--card-bg);
    border-radius: 0 0 8px 8px;
}
.op-post-comment {
    font-size: 13px;
    color: #999;
    padding: 4px 0;
    line-height: 1.5;
}
.op-post-comment + .op-post-comment {
    border-top: 1px solid rgba(128,128,128,0.08);
}
/* 用户评论 */
.op-post-user-comments {
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    background: var(--card-bg);
}
.op-post-user-comment {
    font-size: 13px;
    padding: 4px 0;
    line-height: 1.6;
}
/* ──── 互动事件卡片 ──── */
.interactive-card.status-pending { border-left: 3px solid #ff9800; }
.interactive-card.status-processing { border-left: 3px solid #2196f3; }
.interactive-card.status-resolved { border-left: 3px solid #4caf50; }
.moment-type-interactive {
    background: rgba(255,152,0,0.12);
    color: #ff9800;
}
/* 干员选择器 */
.interactive-ops { margin: 12px 0 8px; }
.interactive-ops-label {
    font-size: 12px; color: var(--secondary-text);
    margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;
}
.interactive-ops-row {
    display: flex; gap: 8px; overflow-x: auto;
    padding: 4px 0; scrollbar-width: none;
}
.interactive-ops-row::-webkit-scrollbar { display: none; }
.interactive-op-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 10px; border-radius: 10px;
    border: 2px solid transparent; cursor: pointer;
    min-width: 52px; transition: all 0.2s;
    background: var(--card-bg);
}
.interactive-op-item:hover { border-color: var(--border-color); }
.interactive-op-item.selected {
    border-color: var(--active-color);
    background: rgba(33,150,243,0.08);
}
.interactive-op-ava {
    width: 32px; height: 32px;
    border-radius: 50%; object-fit: cover;
    background: var(--border-color);
}
.interactive-op-item span {
    font-size: 10px; color: var(--secondary-text);
    white-space: nowrap; max-width: 56px;
    overflow: hidden; text-overflow: ellipsis;
}
/* 选项按钮 */
.interactive-options {
    display: flex; flex-direction: column; gap: 6px;
    margin-top: 12px;
}
.interactive-option-btn {
    display: flex; flex-direction: column; align-items: flex-start;
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px; background: transparent;
    color: var(--text-color); cursor: pointer;
    text-align: left; transition: all 0.15s;
    font-size: 13px; line-height: 1.5;
}
.interactive-option-btn:hover {
    border-color: var(--active-color);
    background: rgba(33,150,243,0.04);
}
.interactive-option-btn strong {
    font-size: 13px; margin-bottom: 2px;
}
.interactive-option-btn span {
    font-size: 11px; color: var(--secondary-text);
}
.interactive-option-btn.risk-low { border-left: 3px solid #4caf50; }
.interactive-option-btn.risk-mid { border-left: 3px solid #ff9800; }
.interactive-option-btn.risk-high { border-left: 3px solid #f44336; }
/* 处理中脉冲 */
.interactive-processing {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 0; font-size: 14px; color: var(--secondary-text);
}
.interactive-pulse {
    width: 10px; height: 10px; border-radius: 50%;
    background: #2196f3;
    display: inline-block;
    animation: interactive-breathe 1.4s ease-in-out infinite;
}
@keyframes interactive-breathe {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}
/* 已处理结果 */
.interactive-result { margin-top: 8px; }
.interactive-result-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
}
.interactive-result-avatar {
    width: 28px; height: 28px;
    border-radius: 50%; object-fit: cover;
    background: var(--border-color);
}
.interactive-result-info {
    display: flex; align-items: center; gap: 8px;
}
.interactive-result-name {
    font-size: 13px; font-weight: 600;
    color: var(--text-color);
}
.interactive-result-tag {
    font-size: 10px; padding: 1px 6px; border-radius: 8px;
    background: rgba(76,175,80,0.15); color: #4caf50;
}
.interactive-result-text {
    font-size: 13px; line-height: 1.7;
    color: var(--secondary-text);
    padding: 8px 12px; border-radius: 8px;
    background: var(--card-bg);
}
/* 摇晃提示 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.shake { animation: shake 0.3s ease-in-out; }

.uc-doctor { color: #5b8def; }
.uc-reply { color: #e0a0c0; }
/* 评论输入 */
.op-post-comment-input-wrap {
    display: flex; gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 0 0 8px 8px;
}
.op-post-comment-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    background: var(--input-bg);
    color: var(--text-color);
    outline: none;
}
.op-post-comment-input:focus { border-color: var(--active-color); }
.op-post-comment-btn {
    background: var(--active-color);
    color: #fff; border: none;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 12px; cursor: pointer;
    white-space: nowrap;
}
.op-post-comment-btn:disabled { opacity: 0.5; }

/* ================= 导出弹窗 ================= */
#export-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 340px; max-height: 80vh;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px; z-index: 200;
    display: flex; flex-direction: column;
}
#export-modal .modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--border-color);
}
#export-modal .modal-header span { font-size: 16px; font-weight: 600; }
#export-modal .modal-close-btn {
    background: none; border: none; color: var(--secondary-text);
    font-size: 20px; cursor: pointer;
}
#export-modal .modal-body { padding: 16px; overflow-y: auto; }
.export-section { margin-bottom: 16px; }
.export-section label { display: block; font-size: 13px; color: var(--secondary-text); margin-bottom: 8px; }
.export-format-wrap { display: flex; gap: 8px; }
.export-format-btn {
    flex: 1; padding: 8px; border: 1px solid var(--border-color);
    background: transparent; color: var(--text-color);
    border-radius: 6px; cursor: pointer; font-size: 13px;
}
.export-format-btn.active {
    border-color: var(--active-color); color: var(--active-color);
    background: rgba(33, 150, 243, 0.08);
}
.export-ops-list { max-height: 240px; overflow-y: auto; margin-bottom: 8px; }
.export-op-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 4px; cursor: pointer; border-radius: 6px;
}
.export-op-item:hover { background: rgba(255,255,255,0.03); }
.export-op-item input { accent-color: var(--active-color); width: 16px; height: 16px; cursor: pointer; }
.export-op-item img { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.export-op-item-name { flex: 1; font-size: 14px; }
.export-op-item-count { font-size: 11px; color: var(--secondary-text); }
.export-select-all {
    background: transparent; border: none;
    color: var(--active-color); cursor: pointer;
    font-size: 12px; padding: 4px 0;
}
.export-confirm-btn {
    width: 100%; padding: 10px; border: none;
    background: var(--active-color); color: #fff;
    border-radius: 8px; cursor: pointer; font-size: 14px; margin-top: 8px;
}
.export-confirm-btn:disabled { opacity: 0.4; cursor: default; }

/* 导入聊天记录 */
#import-modal .modal-body { padding: 16px; overflow-y: auto; }
.import-section { margin-bottom: 16px; }
.import-section label { display: block; font-size: 13px; color: var(--secondary-text); margin-bottom: 8px; }
.import-format-wrap { display: flex; gap: 8px; }
.import-mode-btn {
    flex: 1; padding: 8px; border: 1px solid var(--border-color);
    background: transparent; color: var(--text-color);
    border-radius: 6px; cursor: pointer; font-size: 13px;
}
.import-mode-btn.active {
    border-color: var(--active-color); color: var(--active-color);
    background: rgba(33, 150, 243, 0.08);
}
.import-ops-list { max-height: 200px; overflow-y: auto; margin-bottom: 8px; }
.import-op-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 4px; font-size: 13px;
}
.import-op-row img { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.import-op-row-name { flex: 1; }
.import-op-row-count { font-size: 11px; color: var(--secondary-text); }
.import-error {
    color: #e05555; font-size: 12px; margin-bottom: 8px;
    padding: 8px; background: rgba(224,85,85,0.08); border-radius: 6px;
}
.import-confirm-btn {
    width: 100%; padding: 10px; border: none;
    background: var(--active-color); color: #fff;
    border-radius: 8px; cursor: pointer; font-size: 14px; margin-top: 8px;
}
.import-confirm-btn:disabled { opacity: 0.4; cursor: default; }
#import-file-input { font-size: 13px; color: var(--text-color); }
#import-file-input::file-selector-button {
    padding: 6px 12px; border: 1px solid var(--border-color);
    background: transparent; color: var(--text-color);
    border-radius: 4px; cursor: pointer; margin-right: 8px;
}

/* ================= Error Log Viewer ================= */
#error-log-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.5);
}
#error-log-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    width: 90vw; max-width: 640px; max-height: 80vh;
    background: var(--bg-color);
    border-radius: 12px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.error-log-header-actions {
    display: flex; gap: 8px; align-items: center;
}
.error-log-header-actions button {
    background: transparent; border: none;
    color: var(--secondary-text); font-size: 13px;
    cursor: pointer; padding: 2px 8px;
}
.error-log-loading {
    text-align: center; color: var(--secondary-text); padding: 40px 0;
}
#error-log-empty {
    text-align: center; padding: 40px 0; font-size: 16px; color: var(--secondary-text);
}
#error-log-pre {
    margin: 0; padding: 12px;
    background: #1a1a2e; color: #c0c0c0;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 11px; line-height: 1.6;
    white-space: pre-wrap; word-break: break-all;
    border-radius: 8px;
    max-height: 55vh; overflow-y: auto;
}
#error-log-summary {
    font-size: 12px; color: var(--secondary-text);
}

/* ================= 引用回复 ================= */
.reply-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid var(--border-color); background: var(--bg-primary);
    cursor: pointer; opacity: 0; transition: opacity 0.15s;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: var(--secondary-text);
    line-height: 1; padding: 0;
}
.message:hover .reply-btn,
.message.reply-active .reply-btn,
.message.swiped-left .reply-btn { opacity: 1; }
.reply-btn:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

/* 引用条（私聊） */
#reply-quote-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin: 0 12px 4px;
    background: var(--bg-secondary); border-left: 3px solid var(--accent);
    border-radius: 6px; font-size: 12px;
}
#reply-quote-bar.hidden { display: none; }
.reply-quote-label { color: var(--accent); font-weight: 600; flex-shrink: 0; }
.reply-quote-sender { color: var(--primary-text); font-weight: 500; flex-shrink: 0; }
.reply-quote-sender::after { content: ':'; }
.reply-quote-text { color: var(--secondary-text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-quote-close { border: none; background: none; cursor: pointer; color: var(--secondary-text); font-size: 14px; padding: 0 4px; }
.reply-quote-close:hover { color: var(--primary-text); }

/* 引用条（群聊） */
#group-reply-quote-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin: 0 12px 4px;
    background: var(--bg-secondary); border-left: 3px solid var(--accent);
    border-radius: 6px; font-size: 12px;
}
#group-reply-quote-bar.hidden { display: none; }

/* ================= QQ风格内嵌引用块 ================= */
.quote-block {
    margin-bottom: 6px; padding: 6px 10px;
    background: rgba(128,128,128,0.12);
    border-left: 3px solid var(--active-color);
    border-radius: 4px;
    font-size: 12px; line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s;
    max-width: 100%; overflow: hidden;
}
.quote-block:hover {
    background: rgba(91,141,239,0.15);
}
.quote-sender {
    color: var(--active-color);
    font-weight: 600;
}
.quote-text {
    color: #999;
    display: inline;
}

/* ================= 消息右键菜单 ================= */
.msg-context-menu {
    position: fixed; z-index: 600;
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    min-width: 100px;
}
.msg-ctx-reply-btn {
    display: block; width: 100%; padding: 10px 16px;
    border: none; background: transparent;
    color: var(--text-color); font-size: 14px;
    cursor: pointer; text-align: left;
    transition: background 0.1s;
}
.msg-ctx-reply-btn:hover { background: var(--chat-bg); }

/* ================= 手机端左滑回复 ================= */
.message.swiped-left {
    transform: translateX(-60px);
    transition: transform 0.2s ease;
}
.message.swiped-left .reply-btn {
    opacity: 1;
    background: var(--active-color);
    color: #fff;
    border-color: var(--active-color);
}

/* ================= @提及 下拉 ================= */
#mention-dropdown {
    position: absolute; bottom: 100%; left: 12px; right: 12px;
    background: var(--bg-primary); border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0; box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    max-height: 200px; overflow-y: auto; z-index: 50;
}
#mention-dropdown.hidden { display: none; }
.mention-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    transition: background 0.1s;
}
.mention-item:hover, .mention-item.active { background: var(--accent-light); }
.mention-item img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.mention-item span { color: var(--primary-text); }

/* group-input-area 相对定位给 mention dropdown 用 */
#group-input-area { position: relative; }

/* ================= 观察者消息 ================= */
.msg.observer .bubble {
    border-left: 2px solid #c8a050;
    background: rgba(200, 160, 80, 0.08);
    color: #d4c080;
}
