        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background: #0a0f1a;
            height: 100vh;
            overflow: hidden;
        }

        .app-container {
            display: flex;
            width: 100%;
            height: 100vh;
            background: #111827;
            overflow: hidden;
        }

        .sidebar {
            width: 260px;
            background: #111827;
            border-right: 1px solid #1e293b;
            display: flex;
            flex-direction: column;
            height: 100%;
            flex-shrink: 0;
        }

        .sidebar-header {
            padding: 20px 16px;
            flex-shrink: 0;
        }

        .new-chat-btn {
            width: 100%;
            padding: 10px;
            background: #3b82f6;
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 1rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .new-chat-btn:hover {
            background: #2563eb;
            transform: translateY(-1px);
        }

        .tab-switch {
            display: flex;
            margin: 10px 16px;
            background: #1e293b;
            border-radius: 12px;
            padding: 2px;
            flex-shrink: 0;
        }

        .tab-item {
            flex: 1;
            text-align: center;
            padding: 6px 0;
            font-size: 0.9rem;
            cursor: pointer;
            border-radius: 8px;
            transition: 0.2s;
            color: #94a3b8;
        }

        .tab-item.active {
            background: #3b82f6;
            color: white;
            font-weight: 500;
            box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
        }

        .list-container {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
        }

        .history-group {
            margin-bottom: 20px;
        }

        .history-date {
            font-size: 0.75rem;
            color: #64748b;
            margin-bottom: 8px;
            font-weight: 500;
        }

        .list-item {
            padding: 10px 12px;
            margin-bottom: 4px;
            border-radius: 12px;
            cursor: pointer;
            font-size: 0.9rem;
            color: #cbd5e1;
            display: flex;
            align-items: center;
            gap: 8px;
            position: relative;
            transition: background 0.2s;
        }

        .item-title {
            flex: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
        }

        .item-menu-btn {
            display: none;
            background: none;
            border: none;
            color: #64748b;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 0.8rem;
            flex-shrink: 0;
        }

        .list-item:hover .item-menu-btn,
        .list-item.active .item-menu-btn {
            display: block;
        }

        .item-menu-btn:hover {
            background: #334155;
            color: white;
        }

        .item-menu {
            position: absolute;
            right: 8px;
            top: calc(100% - 2px);
            background: #1e293b;
            border: 1px solid #334155;
            border-radius: 10px;
            padding: 4px;
            z-index: 200;
            min-width: 130px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
        }

        .item-menu-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.85rem;
            color: #cbd5e1;
            white-space: nowrap;
        }

        .item-menu-item:hover {
            background: #334155;
            color: white;
        }

        .item-menu-item.danger {
            color: #f87171;
        }

        .item-menu-item.danger:hover {
            background: rgba(239, 68, 68, 0.15);
            color: #fca5a5;
        }

        .list-item:hover {
            background: #1e293b;
        }

        .list-item i {
            font-size: 0.8rem;
            color: #5b6e8c;
            width: 16px;
        }

        .list-item.active {
            background: #3b82f6;
            color: white;
        }

        .list-item.active i {
            color: white;
        }

        .knowledge-search {
            padding: 8px 16px;
            border-bottom: 1px solid #1e293b;
        }

        .knowledge-search input {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #334155;
            border-radius: 20px;
            outline: none;
            font-size: 0.9rem;
            background: #111827;
            color: #f1f5f9;
        }

        .admin-entry {
            padding: 12px 16px;
            background: #111827;
            flex-shrink: 0;
        }

        .admin-entry .btn {
            width: 100%;
            padding: 8px;
            background: #3b82f6;
            color: white;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 0.9rem;
            transition: background 0.2s;
        }

        .admin-entry .btn:hover {
            background: #2563eb;
        }

        .sidebar-footer {
            padding: 16px;
            flex-shrink: 0;
            background: #111827;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: #3b82f6;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
        }

        .user-details {
            flex: 1;
            overflow: hidden;
        }

        .user-name {
            font-size: 0.9rem;
            font-weight: 500;
            color: #f1f5f9;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .user-logout {
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            font-size: 0.9rem;
            padding: 4px;
            border-radius: 6px;
        }

        .user-logout:hover {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.1);
        }

        .login-btn {
            width: 100%;
            padding: 10px;
            background: #3b82f6;
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 1rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #111827;
            position: relative;
            height: 100%;
            overflow: hidden;
        }

        .chat-header {
            padding: 20px max(24px, 5%);
            background: #111827;
            color: #f1f5f9;
            flex-shrink: 0;
            display: flex;
            justify-content: center;
            position: relative;
        }

        .chat-header-inner {
            width: 100%;
            max-width: 800px;
            display: flex;
            align-items: center;
            font-weight: 600;
            font-size: 1.2rem;
        }

        .gh-left {
            flex: 1 1 0;
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.95rem;
            color: #cbd5e1;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .gh-center {
            flex: 0 0 auto;
            text-align: center;
            max-width: 60%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .gh-right {
            flex: 1 1 0;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
            position: relative;
        }

        /* ★ 2026-09-10 群消息头像 + 昵称行（对标微信/QQ） */
        .grp-msg-row {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            width: 100%;
            margin-bottom: 4px;
        }
        .grp-msg-row-self {
            flex-direction: row-reverse;
        }
        .grp-avatar {
            width: 36px;
            height: 36px;
            border-radius: 6px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 16px;
            font-weight: 600;
            user-select: none;
        }
        .grp-msg-col {
            display: flex;
            flex-direction: column;
            min-width: 0;
            max-width: 100%;
        }
        .grp-msg-row-self .grp-msg-col {
            align-items: flex-end;
        }
        .grp-msg-name {
            font-size: 12px;
            color: #94a3b8;
            margin-bottom: 3px;
            padding: 0 2px;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 24px max(24px, 5%);
            background: #111827;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 0;
            scroll-behavior: smooth;
        }

        .messages-container {
            width: 100%;
            max-width: 800px;
            display: flex;
            flex-direction: column;
            gap: 24px;
        }

        .chat-messages::-webkit-scrollbar,
        .list-container::-webkit-scrollbar {
            width: 5px;
        }

        .chat-messages::-webkit-scrollbar-track,
        .list-container::-webkit-scrollbar-track {
            background: #1e293b;
            border-radius: 10px;
        }

        .chat-messages::-webkit-scrollbar-thumb,
        .list-container::-webkit-scrollbar-thumb {
            background: #475569;
            border-radius: 10px;
        }

        .admin-frame-container {
            display: none;
            height: 100%;
            width: 100%;
            background: #111827;
        }

        .admin-frame-container iframe {
            width: 100%;
            height: 100%;
            border: none;
            background: white;
        }

        .message {
            display: flex;
            max-width: 100%;
            animation: fadeIn 0.2s ease;
            width: fit-content;
            flex-direction: column;
        }

        .user-message {
            align-self: flex-end;
            margin-left: auto;
        }

        .assistant-message {
            align-self: flex-start;
        }

        /* 消息内附件卡片（用户气泡顶部，2026-08-14 新增） */
        .msg-attachments {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 10px;
            width: 100%;
            /* ★ 2026-08-15 修复：用户侧消息的附件卡片靠右贴边（对齐用户气泡） */
            align-items: flex-end;
        }
        .msg-attachment-card {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 10px;
            max-width: 320px;
        }
        .msg-att-icon {
            font-size: 20px;
            color: #3b82f6;
            flex-shrink: 0;
        }
        .msg-att-info {
            min-width: 0;
        }
        .msg-att-name {
            font-size: 13px;
            font-weight: 600;
            color: inherit;
            word-break: break-all;
            line-height: 1.4;
        }
        .msg-att-meta {
            font-size: 11px;
            opacity: 0.7;
            margin-top: 2px;
        }

        /* 思考折叠条 - 位于气泡内部 */
        .reasoning-bubble {
            margin-bottom: 12px;
            border-radius: 16px;
            overflow: hidden;
            background: #0f172a;
            border-left: 3px solid #3b82f6;
        }

        .reasoning-summary {
            display: flex;
            align-items: center;
            padding: 10px 16px;
            background: #0f172a;
            color: #cbd5e1;
            font-size: 0.9rem;
            cursor: pointer;
            user-select: none;
            transition: background 0.2s;
        }

        .reasoning-summary:hover {
            background: #1e293b;
        }

        .reasoning-summary i {
            margin-right: 10px;
            font-size: 0.9rem;
            color: #3b82f6;
            transition: transform 0.2s;
        }

        .reasoning-summary.open i {
            transform: rotate(90deg);  /* ★2026-09-07：展开态箭头旋转由CSS控制 */
        }

        .reasoning-content.collapsed {
            display: none;
        }

        .reasoning-content {
            padding: 16px;
            background: #0f172a;
            color: #94a3b8;
            font-size: 0.9rem;
            white-space: pre-wrap;
            line-height: 1.5;
            border-top: 1px solid #1e293b;
        }

        .message-content {
            padding: 14px 18px;
            border-radius: 20px;
            line-height: 1.6;
            word-wrap: break-word;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            font-size: 0.95rem;
            white-space: pre-wrap;
            word-break: break-word;
            width: fit-content;
            max-width: 100%;
        }

        .user-message .message-content {
            background: #2563eb;
            color: white;
            border-bottom-right-radius: 4px;
        }

        .assistant-message .message-content {
            background: #1e293b;
            color: #e2e8f0;
            border-bottom-left-radius: 4px;
        }

        /* 消息底部操作栏 */
        .message-actions {
            display: flex;
            align-items: center;
            margin-top: 8px;
            gap: 6px;
        }

        .assistant-message .message-actions {
            justify-content: flex-start;
        }

        .user-message .message-actions {
            justify-content: flex-end;
        }

        .action-icon {
            background: none;
            border: none;
            color: #64748b;
            cursor: pointer;
            font-size: 0.9rem;
            padding: 6px 10px;
            border-radius: 8px;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #1e293b;
        }

        .action-icon:hover {
            color: #3b82f6;
            background: #334155;
        }

        .action-icon.liked {
            color: #3b82f6;
            transition: transform 0.2s;
        }

        .action-icon.disliked {
            color: #ef4444;
        }

        /* 代码块容器 */
        .code-block-wrapper {
            position: relative;
            margin: 12px 0;
            border-radius: 12px;
            overflow: hidden;
        }

        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 16px;
            background: #1e293b;
            color: #94a3b8;
            font-size: 0.8rem;
        }

        .code-actions {
            display: flex;
            gap: 8px;
        }

        .code-actions button {
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 0.8rem;
            transition: all 0.2s;
        }

        .code-actions button:hover {
            background: #334155;
            color: white;
        }

        /* ========== KaTeX 公式 ========== */
        .message-content .katex-display {
            overflow-x: auto;
            overflow-y: hidden;
            padding: 8px 4px;
            margin: 12px 0;
        }
        .message-content .katex {
            font-size: 1.05em;
        }

        /* ========== 大纲导航 ========== */
        .outline-fab {
            position: fixed;
            right: 24px;
            bottom: 120px;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: #1e293b;
            border: 1px solid #334155;
            color: #94a3b8;
            font-size: 1.2rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            transition: all 0.2s;
        }
        .outline-fab:hover {
            background: #334155;
            color: white;
            transform: scale(1.05);
        }
        .outline-fab.active {
            background: #3b82f6;
            color: white;
            border-color: #3b82f6;
        }
        .outline-panel {
            position: fixed;
            right: 24px;
            bottom: 172px;
            width: 300px;
            max-height: 60vh;
            overflow-y: auto;
            background: #111827;
            border: 1px solid #334155;
            border-radius: 12px;
            padding: 12px;
            z-index: 1001;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
            display: none;
        }
        .outline-panel.show {
            display: block;
        }
        .outline-panel h4 {
            color: #94a3b8;
            font-size: 0.85rem;
            margin-bottom: 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid #1e293b;
        }
        .outline-panel .outline-empty {
            color: #64748b;
            font-size: 0.85rem;
            text-align: center;
            padding: 16px 0;
        }
        .outline-item {
            display: block;
            color: #cbd5e1;
            text-decoration: none;
            font-size: 0.85rem;
            padding: 4px 8px;
            border-radius: 6px;
            cursor: pointer;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            transition: background 0.15s;
        }
        .outline-item:hover {
            background: #1e293b;
            color: white;
        }
        .outline-item.lv2 {
            padding-left: 16px;
        }
        .outline-item.lv3 {
            padding-left: 32px;
        }
        .outline-item.lv4 {
            padding-left: 48px;
        }

        pre {
            margin: 0 !important;
            border-radius: 0 0 12px 12px !important;
        }

        /* 输入区域 */
        .chat-input-wrapper {
            padding: 16px 24px;
            background: #111827;
            flex-shrink: 0;
        }

        /* 输入区内容与消息区（messages-container）同宽居中 */
        .chat-input-inner {
            width: 100%;
            max-width: 800px;
            margin: 0 auto;
        }

        /* 一体化输入面板：模式键+操作键全部收进同一板块 */
        .input-panel {
            background: #111827;
            border: 1px solid #334155;
            border-radius: 24px;
            padding: 12px 16px 10px;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .input-panel:focus-within {
            border-color: #3b82f6;
            box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
        }

        /* 附件暂存区（2026-08-14）：上传文件先入附件区，扫描提取文字后等用户描述再发送 */
        .attachment-preview-area {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 10px;
        }

        .attachment-card {
            display: flex;
            align-items: center;
            gap: 8px;
            max-width: 100%;
            background: #1e293b;
            border: 1px solid #334155;
            border-radius: 10px;
            padding: 6px 10px;
            font-size: 0.85rem;
            color: #e2e8f0;
        }

        /* 扫描中：旋转spinner + 呼吸边框，明确"正在处理"而非卡死 */
        .attachment-card.scanning {
            border-color: #3b82f6;
            animation: attScanPulse 1.6s ease-in-out infinite;
        }
        @keyframes attScanPulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.35); }
            50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
        }
        .attachment-card.scanning .att-icon {
            color: #3b82f6;
            transition: transform 0.2s;
        }
        .att-spinner {
            display: inline-block;
            width: 14px;
            height: 14px;
            border: 2px solid rgba(59, 130, 246, 0.25);
            border-top-color: #3b82f6;
            border-radius: 50%;
            animation: attSpin 0.8s linear infinite;
            vertical-align: -2px;
            margin-right: 4px;
        }
        @keyframes attSpin {
            to { transform: rotate(360deg); }
        }
        .att-scan-timer {
            color: #60a5fa;
            font-size: 0.7rem;
            font-variant-numeric: tabular-nums;
        }

        .attachment-card .att-icon {
            color: #60a5fa;
            flex-shrink: 0;
        }

        .attachment-card .att-name {
            max-width: 160px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .attachment-card .att-status {
            color: #94a3b8;
            font-size: 0.75rem;
            flex-shrink: 0;
        }

        .attachment-card .att-status.ok {
            color: #34d399;
        }

        .attachment-card .att-status.err {
            color: #f87171;
        }

        .attachment-card .att-preview {
            max-width: 320px;
            max-height: 90px;
            overflow-y: auto;
            white-space: pre-wrap;
            word-break: break-all;
            color: #94a3b8;
            font-size: 0.75rem;
            line-height: 1.4;
            background: rgba(148, 163, 184, 0.08);
            border-radius: 6px;
            padding: 4px 6px;
        }

        .attachment-card .att-remove {
            cursor: pointer;
            color: #94a3b8;
            border: none;
            background: none;
            padding: 2px 4px;
            font-size: 0.9rem;
        }

        .attachment-card .att-remove:hover {
            color: #f87171;
        }

        #messageInput {
            width: 100%;
            padding: 4px 2px 10px;
            border: none;
            outline: none;
            font-size: 1rem;
            background: transparent;
            color: #f1f5f9;
            min-height: 28px;
            max-height: 160px;
            resize: none;
            overflow-y: auto;
            font-family: inherit;
            display: block;
        }

        /* 底部工具栏：左=模式按钮，中=录音计时，右=操作按钮 */
        .input-toolbar {
            display: flex;
            align-items: center;
            gap: 8px;
            border-top: 1px solid #1e293b;
            padding-top: 8px;
            margin-top: 4px;
        }

        .input-toolbar-left {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .mode-btn {
            padding: 5px 12px;
            border-radius: 16px;
            background: #1e293b;
            color: #94a3b8;
            border: none;
            cursor: pointer;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 5px;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .mode-btn:hover {
            background: #334155;
            color: #e2e8f0;
        }

        .mode-btn.active {
            background: #3b82f6;
            color: white;
        }

        .input-toolbar-center {
            flex: 1;
            text-align: center;
            min-width: 0;
        }

        .action-buttons {
            display: flex;
            align-items: center;
            gap: 2px;
            margin-left: auto;
            flex-shrink: 0;
        }

        .action-btn {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            border: none;
            background: transparent;
            color: #94a3b8;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            flex-shrink: 0;
            font-size: 1rem;
        }

        .action-btn:hover {
            background: #1e293b;
            color: white;
        }

        #sendBtn {
            background: #3b82f6;
            color: white;
        }

        #sendBtn:hover {
            background: #2563eb;
        }

        #micBtn.recording {
            background: #dc2626;
            color: white;
        }

        #sendBtn.stop {
            background: #ef4444;
        }

        #timer {
            font-size: 0.9rem;
            color: #94a3b8;
            margin-left: 8px;
        }

        .file-upload {
            display: flex;
            align-items: center;
        }

        .file-upload label {
            cursor: pointer;
            color: #94a3b8;
            font-size: 1.2rem;
        }

        .file-upload input {
            display: none;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(8px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        .modal.show {
            display: flex;
        }

        .modal-content {
            background: #1e293b;
            border-radius: 24px;
            padding: 24px;
            width: 400px;
            max-width: 90%;
            color: #f1f5f9;
            border: 1px solid #334155;
        }

        .modal-title {
            font-size: 1.2rem;
            font-weight: 600;
            margin-bottom: 20px;
        }

        .login-switch {
            margin: 10px 0;
            display: flex;
            gap: 12px;
            justify-content: center;
        }

        .login-switch a {
            cursor: pointer;
            color: #3b82f6;
            text-decoration: none;
        }

        .code-row {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .code-input {
            flex: 1;
        }

        .captcha-btn {
            white-space: nowrap;
            background: #3b82f6;
            border: none;
            padding: 0 12px;
            border-radius: 12px;
            color: white;
            cursor: pointer;
        }

        .login-input {
            width: 100%;
            padding: 12px;
            border: 1px solid #334155;
            border-radius: 12px;
            margin-bottom: 16px;
            font-size: 0.95rem;
            background: #111827;
            color: #f1f5f9;
        }

        .login-submit {
            width: 100%;
            padding: 12px;
            background: #3b82f6;
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 1rem;
            cursor: pointer;
            margin-top: 8px;
            transition: background 0.2s;
        }

        .login-submit:hover {
            background: #2563eb;
        }

        .login-error {
            color: #ef4444;
            font-size: 0.85rem;
            margin-top: 8px;
            text-align: center;
        }

        .register-link {
            text-align: center;
            margin-top: 16px;
        }

        .register-link a {
            color: #3b82f6;
            cursor: pointer;
            text-decoration: none;
        }

        .typing-indicator {
            display: inline-flex;
            gap: 4px;
            align-items: center;
        }

        .typing-indicator span {
            width: 8px;
            height: 8px;
            background: #94a3b8;
            border-radius: 50%;
            animation: typing 1s infinite ease-in-out;
        }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes typing {

            0%,
            60%,
            100% {
                transform: translateY(0);
                opacity: 0.4;
            }

            30% {
                transform: translateY(-8px);
                opacity: 1;
            }
        }

        /* 自定义确认弹窗 */
        .custom-confirm-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            z-index: 2000;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .custom-confirm-dialog {
            background: #1e293b;
            border-radius: 20px;
            padding: 24px;
            max-width: 400px;
            width: 90%;
            color: #f1f5f9;
            border: 1px solid #334155;
        }

        .custom-confirm-message {
            margin: 20px 0;
            line-height: 1.5;
        }

        .custom-confirm-actions {
            display: flex;
            gap: 12px;
            justify-content: flex-end;
        }

        .custom-confirm-actions button {
            padding: 8px 20px;
            border-radius: 12px;
            border: none;
            cursor: pointer;
            font-size: 0.9rem;
        }

        .confirm-btn {
            background: #3b82f6;
            color: white;
        }

        .reject-btn {
            background: #ef4444;
            color: white;
        }

        /* ========== 新增：步骤时间线与预览卡片样式 ========== */
        .steps-timeline {
            margin-bottom: 12px;
            background: #0f172a;
            border-radius: 12px;
            padding: 4px 0;
            border-left: 3px solid #3b82f6;
        }

        .step-item {
            display: flex;
            align-items: flex-start;
            padding: 8px 16px;
            gap: 12px;
            border-bottom: 1px solid #1e293b;
        }

        .step-item:last-child {
            border-bottom: none;
        }

        .step-icon {
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #64748b;
            font-size: 14px;
        }

        .step-icon.success {
            color: #10b981;
        }

        .step-icon.error {
            color: #ef4444;
        }

        .step-icon.running {
            color: #3b82f6;
            transition: transform 0.2s;
        }

        .step-content {
            flex: 1;
        }

        .step-title {
            font-size: 14px;
            font-weight: 500;
            color: #e2e8f0;
            margin-bottom: 2px;
        }

        .step-detail {
            font-size: 12px;
            color: #64748b;
            word-break: break-word;
        }

        .preview-files {
            margin-top: 16px;
            background: #0f172a;
            padding: 12px;
            border-radius: 12px;
            max-height: 200px;
            overflow-y: auto;
        }

        .preview-file-item {
            margin-bottom: 12px;
            border-bottom: 1px solid #334155;
            padding-bottom: 8px;
        }

        .preview-file-item:last-child {
            border-bottom: none;
            margin-bottom: 0;
            padding-bottom: 0;
        }

        .preview-file-path {
            font-weight: 600;
            color: #3b82f6;
            margin-bottom: 4px;
        }

        .preview-file-content {
            background: #1e293b;
            padding: 8px;
            border-radius: 8px;
            font-family: monospace;
            font-size: 12px;
            white-space: pre-wrap;
            word-break: break-all;
            max-height: 100px;
            overflow-y: auto;
        }

        /* ================================================ */

        /* ================================================ */
        /*  对话窗口 Markdown 版式系统（架构层排版修复）     */
        /*  只作用于 .message-content 内部，不影响页面布局   */
        /* ================================================ */

        .message-content {
            white-space: normal !important;   /* 修复：不禁用自动换行 */
        }

        /* --- 标题层级（视觉阶梯：字号+字重+间距+分隔线） --- */
        .message-content h1 { font-size: 1.75rem; margin: 34px 0 16px; color: #ffffff; font-weight: 800; letter-spacing: 0.5px; }
        .message-content h2 { font-size: 1.5rem; margin: 32px 0 14px; color: #ffffff; font-weight: 700; border-bottom: 2px solid #475569; padding-bottom: 8px; }
        .message-content h3 { font-size: 1.3rem; margin: 26px 0 12px; color: #f1f5f9; font-weight: 700; }
        .message-content h4 { font-size: 1.15rem; margin: 20px 0 10px; color: #f1f5f9; font-weight: 650; }
        .message-content h5, .message-content h6 { font-size: 1.05rem; margin: 16px 0 8px; color: #e2e8f0; font-weight: 600; }

        /* --- 段落（宽松行距+清晰段距） --- */
        .message-content p {
            margin: 0 0 14px 0;
            line-height: 1.85;
            color: #e2e8f0;
        }
        .message-content p:last-child { margin-bottom: 0; }

        /* --- 无序列表 --- */
        .message-content ul {
            margin: 0 0 16px 0;
            padding-left: 24px;
            list-style-type: disc;
        }
        .message-content ul ul { list-style-type: circle; }
        .message-content ul ul ul { list-style-type: square; }

        /* --- 有序列表 --- */
        .message-content ol {
            margin: 0 0 12px 0;
            padding-left: 20px;
        }

        /* --- 列表项 --- */
        .message-content li {
            margin-bottom: 4px;
            line-height: 1.65;
        }
        .message-content li:last-child { margin-bottom: 0; }

        /* --- 列表内的段落（避免双重间距） --- */
        .message-content li > p {
            margin: 0;
        }

        /* --- 加粗 --- */
        .message-content strong, .message-content b {
            font-weight: 700;
            color: #f8fafc;
        }

        /* --- 行内代码 --- */
        .message-content code:not(pre code) {
            background: #1e293b;
            color: #e2e8f0;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 0.88em;
            font-family: 'SF Mono', 'Fira Code', monospace;
        }

        /* --- 引用块 --- */
        .message-content blockquote {
            margin: 12px 0;
            padding: 10px 16px;
            border-left: 3px solid #3b82f6;
            background: #0f172a;
            border-radius: 0 8px 8px 0;
            color: #94a3b8;
        }
        .message-content blockquote p {
            margin: 0;
        }

        /* --- 水平分割线 --- */
        .message-content hr {
            margin: 20px 0;
            border: none;
            border-top: 1px solid #334155;
        }

        /* --- 链接 --- */
        .message-content a {
            color: #60a5fa;
            text-decoration: underline;
            text-underline-offset: 2px;
        }
        .message-content a:hover {
            color: #93c5fd;
        }

        /* --- 表格 --- */
        .message-content table {
            width: 100%;
            margin: 12px 0;
            border-collapse: separate;
            border-spacing: 0;
            border: 1px solid #334155;
            border-radius: 10px;
            overflow: hidden;
            font-size: 0.9rem;
        }
        .message-content thead {
            background: #1e293b;
        }
        .message-content th {
            padding: 10px 14px;
            text-align: left;
            font-weight: 600;
            color: #e2e8f0;
            border-bottom: 1px solid #334155;
            white-space: nowrap;
        }
        .message-content td {
            padding: 8px 14px;
            border-bottom: 1px solid #1e293b;
            color: #cbd5e1;
            line-height: 1.5;
        }
        .message-content tbody tr:last-child td {
            border-bottom: none;
        }
        .message-content tbody tr:nth-child(even) {
            background: #0f172a;
        }
        /* 行悬停高亮（DeepSeek 风格） */
        .message-content tbody tr:hover {
            background: #1e293b;
        }
        .message-content tbody tr:hover td {
            color: #f1f5f9;
        }

        /* --- 表格横向滚动容器（列多时出滚动条而非变形） --- */
        .message-content .table-wrapper {
            overflow-x: auto;
            margin: 12px 0;
            border-radius: 10px;
            -webkit-overflow-scrolling: touch;
        }
        .message-content .table-wrapper table {
            margin: 0;
            min-width: 100%;
        }

        /* --- 任务列表（Checkbox） --- */
        .message-content .task-list-item {
            list-style: none;
            margin-left: -20px;
        }
        .message-content .task-list-item input[type="checkbox"] {
            margin-right: 8px;
            accent-color: #3b82f6;
            vertical-align: middle;
        }
        .message-content .task-list-item.checked {
            color: #64748b;
        }
        .message-content .task-list-item.checked span {
            text-decoration: line-through;
            text-decoration-color: #475569;
        }

        /* --- 提示块 Callout（按 emoji 前缀区分语义色） --- */
        .message-content blockquote.callout {
            border-left: 3px solid;
            border-radius: 8px;
            padding: 12px 16px;
            margin: 12px 0;
            background: #0f172a;
        }
        .message-content blockquote.callout p { margin: 0; }
        .message-content blockquote.callout-warning { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
        .message-content blockquote.callout-info    { border-left-color: #3b82f6; background: rgba(59, 130, 246, 0.08); }
        .message-content blockquote.callout-success { border-left-color: #10b981; background: rgba(16, 185, 129, 0.08); }
        .message-content blockquote.callout-danger  { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.08); }
        .message-content blockquote.callout-tip     { border-left-color: #8b5cf6; background: rgba(139, 92, 246, 0.08); }

        /* --- 图片 --- */
        .message-content img {
            max-width: 100%;
            border-radius: 8px;
            margin: 8px 0;
        }

        /* ================================================ */
        /* ===== 颜色微调（不改布局） ===== */
        /* 用户消息 */
        .message-bubble.user, .user-msg, .msg-item.user {
            background: #3b82f6 !important;
            color: white !important;
            border-bottom-right-radius: 6px !important;
        }
        /* 助手消息 */
        .message-bubble.assistant, .assistant-msg, .msg-item.assistant {
            background: #1e293b !important;
            color: #e2e8f0 !important;
            border: 1px solid #334155 !important;
            border-radius: 12px !important;
        }
        /* 输入框聚焦 */
        #message-input:focus, .chat-input:focus {
            border-color: #3b82f6 !important;
            box-shadow: 0 0 0 3px rgba(59,130,246,0.2) !important;
            outline: none !important;
        }
        /* 侧边栏激活项 */
        .sidebar .list-item.active {
            background: #3b82f6 !important;
            color: white !important;
        }
        /* 数据管理 - 数据优化开关 */
        .dm-track { background: #475569; }
        .dm-knob { left: 3px; }
        input:checked + .dm-track { background: #3b82f6; }
        input:checked + .dm-track + .dm-knob { left: 25px; }
        /* 状态图标颜色（成功/错误/加载） */
        .st-ok { color: #10b981; }
        .st-err { color: #ef4444; }
        .st-run { color: #3b82f6; }
        /* 空状态 / 辅助提示文本 */
        .empty-tip { padding: 16px; text-align: center; color: #94a3b8; }
        .exec-tip { margin-top: 12px; color: #94a3b8; }
        /* ===== 数据管理弹窗抽离类 ===== */
        .dm-back-row { margin-bottom:12px; display:flex; align-items:center; cursor:pointer; color:#94a3b8; }
        .dm-back-icon { margin-right:8px; font-size:12px; }
        .dm-card { background:#1e293b; border-radius:10px; padding:16px; margin-bottom:12px; }
        .dm-card-head { display:flex; align-items:center; justify-content:space-between; }
        .dm-card-title { font-size:14px; font-weight:600; color:#e2e8f0; }
        .dm-card-desc { font-size:12px; color:#94a3b8; margin-top:4px; }
        .dm-card-desc-block { font-size:12px; color:#94a3b8; margin-bottom:12px; }
        .dm-btn-primary { padding:8px 16px; background:#334155; color:#e2e8f0; border:1px solid #475569; border-radius:8px; cursor:pointer; font-size:13px; }
        .dm-btn-danger { padding:8px 16px; background:#dc2626; color:#fff; border:none; border-radius:8px; cursor:pointer; font-size:13px; }
        .dm-danger-card { background:#2d1b1b; border:1px solid #7f1d1d; border-radius:10px; padding:16px; }
        .dm-danger-title { font-size:14px; font-weight:600; color:#f87171; margin-bottom:8px; }
        .dm-danger-desc { font-size:12px; color:#fca5a5; margin-bottom:12px; }
        .dm-manage-btn { padding:6px 14px; background:#4f46e5; color:#fff; border:none; border-radius:8px; cursor:pointer; font-size:12px; }
        .dm-card-head-main { flex:1; margin-right:12px; }
        .dm-hint { font-size:12px; color:#94a3b8; margin-top:8px; }
        .kb-empty { padding:16px; text-align:center; color:#94a3b8; }
        .share-empty { padding:20px; text-align:center; color:#94a3b8; font-size:14px; }
        .share-item { display:flex; align-items:center; gap:10px; padding:12px 14px; border:1px solid #334155; border-radius:8px; margin-bottom:8px; cursor:pointer; background:#0f172a; }
        .share-item input[type="radio"] { accent-color:#3b82f6; width:16px; height:16px; }
        .share-item-title { flex:1; font-size:14px; color:#e2e8f0; }
        .kb-clear-wrap { text-align:center; }
        .kb-clear-btn { background:#3b82f6; color:white; border:none; padding:4px 12px; border-radius:16px; }

        /* ===== 弹窗内联样式抽离区（S12/S13，配合 templates/index.html 模板弹窗）===== */
        /* settingsModal */
        #settingsModal .modal-content { width:480px; max-height:80vh; overflow-y:auto; padding:20px; }
        #settingsModal .modal-title { margin-bottom:16px; }
        #settingsModal .login-submit { margin-top:16px; background:#3c3c3c; }
        /* sharedLinksModal */
        #sharedLinksModal .modal-content { width:560px; padding:24px; }
        /* deleteConfirmModal */
        #deleteConfirmModal .modal-content { width:420px; padding:24px; text-align:center; }
        /* shareDialogModal */
        .modal-content-share { width:520px; padding:0 !important; overflow:hidden; border-radius:12px; }
        /* shareConfirm / shareSuccess */
        #shareConfirmModal .modal-content { width:460px; padding:24px; }
        #shareSuccessModal .modal-content { width:460px; padding:24px; }

        /* 通用弹窗结构类 */
        .dlg-head-row { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
        .dlg-head { display:flex; justify-content:space-between; align-items:center; }
        .dlg-head-border { padding:16px 20px; border-bottom:1px solid #334155; }
        .dlg-title { color:#e2e8f0; font-weight:600; }
        .dlg-title-sm { font-size:16px; }
        .dlg-title-center { text-align:center; }
        .dlg-close { background:transparent; border:none; color:#94a3b8; font-size:22px; cursor:pointer; line-height:1; padding:0; }
        .dlg-list { max-height:360px; overflow-y:auto; margin-bottom:16px; }
        .dlg-hint { font-size:13px; color:#94a3b8; }
        .dlg-icon { font-size:40px; margin-bottom:12px; }
        .dlg-desc { font-size:14px; color:#94a3b8; line-height:1.7; margin-bottom:20px; }
        .dlg-desc-sm { margin-bottom:20px; }
        .dlg-desc-center { text-align:center; }
        .dlg-btn-row { display:flex; gap:12px; justify-content:center; }
        .dlg-btn-row-end { justify-content:flex-end; }
        .dlg-btn { flex:1; padding:10px 0; border-radius:8px; cursor:pointer; font-size:14px; border:none; }
        .dlg-btn-cancel { background:#334155; color:#e2e8f0; }
        .dlg-btn-danger { background:#dc2626; color:#fff; }
        .dlg-btn-primary { background:#3b82f6; color:#fff; }
        /* shareDialog 结构 */
        .dlg-body { padding:20px; }
        .dlg-sub { font-size:14px; color:#cbd5e1; margin-bottom:16px; }
        .dlg-scroll { max-height:260px; overflow-y:auto; }
        .dlg-foot { padding:16px 20px; border-top:1px solid #334155; display:flex; justify-content:flex-end; gap:12px; }
        .dlg-foot .dlg-btn { flex:none; padding:8px 16px; }
        /* shareSuccess 结果盒 */
        .dlg-result-box { padding:12px 14px; background:#0f172a; border:1px solid #334155; border-radius:8px; display:flex; justify-content:space-between; align-items:center; gap:10px; }
        .dlg-result-url { font-size:13px; color:#60a5fa; word-break:break-all; flex:1; }
        .dlg-result-copy { padding:6px 12px; background:#3b82f6; color:#fff; border:none; border-radius:6px; cursor:pointer; font-size:13px; white-space:nowrap; }
        /* ===== JS层动态样式抽离区 ===== */
        /* 中断提示(appendInterruptAction) */
        .intr-wrap { margin-top:10px; padding:8px 12px; border:1px dashed #e0a020; border-radius:8px; background:#fffbea; font-size:13px; }
        .intr-label { color:#b8860b; font-weight:bold; margin-bottom:6px; }
        .intr-btn { background:#4f46e5; color:#fff; border:none; border-radius:6px; padding:5px 14px; cursor:pointer; font-size:13px; }
        /* settings 菜单项渲染 */
        .settings-group { margin-bottom:16px; }
        .settings-group-title { font-size:12px; color:#94a3b8; margin-bottom:8px; text-transform:uppercase; }
        .settings-item { display:flex; align-items:center; padding:10px 12px; border-radius:8px; cursor:pointer; margin-bottom:4px; transition:background 0.2s; }
        .settings-item:hover { background:#1e293b; }
        .settings-icon { width:24px; text-align:center; }
        .settings-label { flex:1; margin-left:12px; font-size:14px; }
        .settings-chevron { font-size:12px; color:#64748b; }

/* ★ 2026-09-10 群聊 Agent 名称小标签（与主对话风格一致） */
.group-agent-name { font-size: 12px; color: #888; margin-bottom: 4px; }

/* ★ 2026-09-11 @ 群成员选择器（输入框上方候选面板） */
.at-mention-panel {
    position: absolute;
    left: 12px;
    bottom: 100%;
    margin-bottom: 6px;
    min-width: 200px;
    max-width: 320px;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    padding: 6px;
    z-index: 200;
}
.at-mention-panel .at-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}
.at-mention-panel .at-item:hover,
.at-mention-panel .at-item-active {
    background: #eef2ff;
}
.at-mention-panel .at-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4a7dff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}
.at-mention-panel .at-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
