        * {
            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: 100%;
            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: none;
        }

        .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;
        }

        /* 2026-10-17 图标由 chevron 改为原子轨道（fa-atom），旋转无意义，改用颜色变化表示展开态 */
        /* 2026-10-17 折叠箭头：文字后缀，展开时旋转 90 度 */
        .reasoning-summary .fold-arrow {
            margin-left: 8px;
            margin-right: 0;
            font-size: 0.75rem;
            color: #64748b;
            transition: transform 0.2s;
        }
        .reasoning-summary.open .fold-arrow {
            transform: rotate(90deg);
        }

        .reasoning-summary.open i {
            color: #93c5fd;
        }

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

        /* 2026-10-17 工具调用行：贴最左，不缩进、不折行，与思维链正文区分 */
        .tool-call-line {
            margin-left: -16px;
            margin-right: -16px;
            padding: 2px 16px;
            white-space: normal;
            word-break: break-word;
            font-size: 0.88rem;
            color: #cbd5e1;
        }

        /* 2026-10-17 思维链时间线：一条左侧竖线贯穿，圆点/图标压在线上 */
        .tl-wrap {
            position: relative;
            padding-left: 20px;
            margin: 4px 0;
        }
        .tl-wrap::before {
            content: "";
            position: absolute;
            left: 6px;
            top: 8px;
            bottom: 8px;
            width: 2px;
            background: #334155;
            border-radius: 1px;
        }
        .tl-item {
            position: relative;
            margin: 0 0 10px 0;
            padding-left: 0;
        }
        .tl-item:last-child { margin-bottom: 0; }
        .tl-dot {
            position: absolute;
            left: -17px;
            top: 7px;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #64748b;
            box-shadow: 0 0 0 3px #0f172a;
        }
        /* 2026-10-17 图标压在竖线正中（与圆点同一纵坐标）：
           竖线中心相对 .tl-item = 6+1-20 = -13px；
           .tl-dot 已验证对齐（left:-17 width:8 -> 中心 -13px），图标同样用中心锚定，不再依赖宽度相加。 */
        .tl-icon {
            position: absolute;
            left: -13px;
            top: 1px;                  /* 2026-10-17 固定对齐首行中线，不用 50% 居中：多行文字时 50% 会落到中间行，导致图标看起来偏低 */
            transform: translateX(-50%);
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            line-height: 1;
            text-align: center;
            background: #0f172a;
            border-radius: 50%;
            z-index: 5;
        }
        .tl-body {
            color: #94a3b8;
            font-size: 0.9rem;
            line-height: 1.5;
            white-space: pre-wrap;
            word-break: break-word;
        }
        .tl-tool .tl-body { color: #cbd5e1; }
        .tl-tool .tl-body {
            color: #cbd5e1;
        }

        .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: 100%;
            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: transparent;
            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;
        }
        .action-icon:hover {
            background: #1e293b;
            color: #e2e8f0;
        }

        .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;
        }

        /* ========== 大纲导航 ========== */
        /* 2026-10-17 回到最新消息悬浮球：贴输入框右上角外侧，滚离底部时才出现 */
        .scroll-to-bottom-btn {
            position: absolute;
            right: 8px;
            top: -52px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #1e293b;
            border: 1px solid #334155;
            color: #94a3b8;
            font-size: 1rem;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 40;
            box-shadow: 0 2px 8px rgba(0,0,0,.35);
            transition: background .15s, color .15s, transform .15s, opacity .15s;
        }
        .scroll-to-bottom-btn.show { display: flex; }
        .scroll-to-bottom-btn:hover { background: #334155; color: #e2e8f0; transform: translateY(-1px); }

        /* 2026-10-17 生成中：外圈转圈动画 */
        .scroll-to-bottom-btn.generating::before {
            content: '';
            position: absolute;
            inset: -4px;
            border-radius: 50%;
            border: 2px solid transparent;
            border-top-color: #60a5fa;
            border-right-color: #60a5fa;
            animation: stbSpin 0.9s linear infinite;
        }
        @keyframes stbSpin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .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;
            position: relative;   /* 2026-10-17 作为回到最新悬浮球的定位基准 */
        }

        /* 2026-10-17 输入框下方 AI 声明（与主流大模型一致） */
        .ai-disclaimer {
            margin-top: 8px;
            text-align: center;
            font-size: 0.72rem;
            color: #64748b;
            user-select: none;
        }

        /* 一体化输入面板：模式键+操作键全部收进同一板块 */
        .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); }
        }
        /* ★ 2026-10-16 工具运行动画：正在调用工具时放大镜轻微摆动，传达「进行中」 */
        .tool-spin {
            display: inline-block;
            animation: toolSpin 1.4s ease-in-out infinite;
        }
        @keyframes toolSpin {
            0%, 100% { transform: rotate(-12deg) scale(1); }
            50% { transform: rotate(12deg) scale(1.15); }
        }
        .tool-timer {
            color: #60a5fa;
            font-size: 0.85em;
            font-variant-numeric: tabular-nums;
        }
        .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;
        }

        /* ★ 2026-09-21 打印确认表单（选页/份数/纸张） */
        .confirm-form {
            margin: 16px 0;
        }
        .confirm-form .cf-row {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }
        .confirm-form .cf-label {
            min-width: 70px;
            color: #94a3b8;
            font-size: 0.9rem;
        }
        .confirm-form .cf-radios {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }
        .confirm-form .cf-radios label {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 0.9rem;
            cursor: pointer;
        }
        .confirm-form input[type="number"] {
            width: 70px;
            padding: 6px 8px;
            border-radius: 8px;
            border: 1px solid #334155;
            background: #0f172a;
            color: #f1f5f9;
        }
        .confirm-form select {
            padding: 6px 10px;
            border-radius: 8px;
            border: 1px solid #334155;
            background: #0f172a;
            color: #f1f5f9;
        }

        .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;
        }

        /* ========== 新增：步骤时间线与预览卡片样式 ========== */
        /* 2026-10-17 排版修正：去掉独立卡片外观与第二条左侧竖线，融入思维链
           原因：.reasoning-bubble 已有 border-left，步骤区再带一条同色线会形成"两条时间线"；
           标准版里工具调用只是思维链正文的一行文字，不应有独立背景/圆角/边框 */
        .steps-timeline {
            margin: 2px 0 8px 0;
            padding: 0;
            background: transparent;
            border-radius: 0;
            border-left: none;
        }

        .step-item {
            display: flex;
            align-items: flex-start;
            padding: 2px 0;
            gap: 8px;
            border-bottom: none;
        }

        .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;
}


/* ==================== 移动端适配（完整）2026-09-19 ==================== */
/* 断点：≤768px 手机/小平板；≤480px 窄屏微调 */

/* 汉堡菜单按钮（默认桌面隐藏） */
.mobile-menu-btn {
    display: none;
    position: fixed;
    left: 12px;
    top: 14px;
    z-index: 2001;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* 侧边栏遮罩（默认隐藏） */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
    /* 1. 侧边栏改抽屉：默认移出视口，可唤出 */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 2px 0 14px rgba(0, 0, 0, 0.45);
        width: 78%;
        max-width: 300px;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .mobile-menu-btn { display: flex; }

    /* 2. 顶部栏紧凑 + 给汉堡按钮留位 */
    .chat-header { padding: 12px 14px 12px 60px; }
    .chat-header-inner { font-size: 1rem; }
    .gh-center { max-width: 50%; font-size: 0.95rem; }
    .gh-left { font-size: 0.85rem; }

    /* 3. 消息区收窄内边距 */
    .chat-messages { padding: 16px 12px; }
    .messages-container { gap: 16px; }

    /* 4. 输入区适配 */
    .chat-input-wrapper { padding: 8px 10px; }
    .input-panel { padding: 10px 12px 8px; border-radius: 18px; }
    .input-toolbar { flex-wrap: wrap; gap: 6px; }
    .input-toolbar-left { gap: 4px; }
    .mode-btn { padding: 5px 9px; font-size: 0.72rem; }
    .input-toolbar-center { display: none; }
    .action-btn { width: 40px; height: 40px; font-size: 1.05rem; }

    /* 5. 弹窗全屏化 */
    .modal-content { width: 92% !important; max-width: 92% !important; padding: 18px; border-radius: 16px; }
    #settingsModal .modal-content,
    #sharedLinksModal .modal-content,
    #deleteConfirmModal .modal-content,
    .modal-content-share { width: 92% !important; max-width: 92% !important; }

    /* 6. 大纲浮层全宽 */
    .outline-fab { right: 14px; bottom: 96px; width: 42px; height: 42px; }
    .scroll-to-bottom-btn { right: 6px; top: -46px; width: 36px; height: 36px; font-size: 0.9rem; }
    .outline-panel { right: 12px; left: 12px; width: auto; bottom: 146px; max-height: 55vh; }

    /* 7. 群聊侧栏收窄 */
    .groups-sidebar { width: 132px !important; padding: 6px 4px !important; }
    #groupMembersPanel { width: 240px !important; }

    /* 8. 管理后台 iframe 容器全屏 */
    .admin-frame-container { width: 100%; }
}

@media (max-width: 480px) {
    .gh-center { font-size: 0.88rem; }
    .mode-btn { padding: 4px 7px; font-size: 0.68rem; }
    .chat-header { padding: 10px 10px 10px 56px; }
    .messages-container { gap: 12px; }
}

/* ★ 2026-09-21 附件按钮二选一菜单 */
.file-upload { position: relative; }
.attach-menu {
    display: none;
    position: absolute;
    bottom: 44px;
    left: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 6px;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 1000;
}
.attach-menu.show { display: block; }
.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}
.attach-menu-item:hover { background: #334155; }
.attach-menu-item i { width: 16px; text-align: center; color: #60a5fa; }

/* ★ 2026-09-21 设备文件浏览面板 */
.fb-panel { max-width: 560px; width: 92%; display: flex; flex-direction: column; max-height: 76vh; }
.fb-pathbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    padding: 8px 10px;
    background: #0f172a;
    border-radius: 10px;
    position: relative;
}
.fb-path-picker-btn {
    background: #334155;
    border: none;
    color: #e2e8f0;
    width: 30px; height: 30px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.fb-path-picker-btn:hover { background: #475569; }
.fb-path-menu {
    display: none;
    position: absolute;
    top: 44px;
    right: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 6px;
    min-width: 170px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    z-index: 1200;
}
.fb-path-menu.show { display: block; }
.fb-path-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
}
.fb-path-menu-item:hover { background: #334155; }
.fb-path-menu-item i { width: 16px; text-align: center; color: #60a5fa; }
.fb-up-btn {
    background: #334155;
    border: none;
    color: #e2e8f0;
    width: 30px; height: 30px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.fb-up-btn:disabled { opacity: 0.4; cursor: default; }
.fb-path-text {
    font-size: 0.82rem;
    color: #94a3b8;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.fb-path-text .fb-crumb {
    color: #cbd5e1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}
.fb-path-text .fb-crumb:hover {
    background: #334155;
    color: #fff;
}
.fb-path-text .fb-crumb-sep {
    color: #64748b;
    margin: 0 1px;
}
.fb-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 6px;
    min-height: 220px;
}
.fb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    color: #e2e8f0;
}
.fb-item:hover { background: #334155; }
.fb-item.selected { background: #1d4ed8; }
.fb-item.disabled { opacity: 0.45; cursor: default; }
.fb-item.disabled:hover { background: transparent; }
.fb-item .fb-ico { width: 18px; text-align: center; flex-shrink: 0; }
.fb-item .fb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-item .fb-size { font-size: 0.75rem; color: #94a3b8; flex-shrink: 0; }
.fb-empty { padding: 30px 10px; text-align: center; color: #64748b; font-size: 0.88rem; }
.fb-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}
.fb-selected { font-size: 0.82rem; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-print-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 9px 22px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.fb-print-btn:disabled { background: #475569; cursor: default; }

/* ================================================================
   ★ 2026-10-18 正文排版重构（对齐文档样板图规格，深色底适配）
   作用域：仅 .assistant-message .message-content 内部
   ================================================================ */

.assistant-message .message-content {
    padding: 20px 22px !important;
    border-radius: 14px !important;
    background: #1b2433 !important;
    color: #d6dee8 !important;
    line-height: 1.8 !important;
    font-size: 0.95rem !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25) !important;
}

.assistant-message .message-content h1 {
    font-size: 1.65rem !important;
    margin: 30px 0 16px !important;
    color: #eaf0f7 !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    border: none !important;
    padding: 0 !important;
}
.assistant-message .message-content h2 {
    font-size: 1.38rem !important;
    margin: 28px 0 14px !important;
    color: #e2e8f0 !important;
    font-weight: 700 !important;
    border: none !important;
    border-bottom: none !important;
    padding: 0 !important;
}
.assistant-message .message-content h3 {
    font-size: 1.18rem !important;
    margin: 24px 0 12px !important;
    color: #dde5ee !important;
    font-weight: 650 !important;
    border: none !important;
}
.assistant-message .message-content h4 {
    font-size: 1.05rem !important;
    margin: 20px 0 10px !important;
    color: #d5dee8 !important;
    font-weight: 600 !important;
}
.assistant-message .message-content h1:first-child,
.assistant-message .message-content h2:first-child,
.assistant-message .message-content h3:first-child {
    margin-top: 4px !important;
}

.assistant-message .message-content p {
    margin: 0 0 14px 0 !important;
    line-height: 1.8 !important;
    color: #d6dee8 !important;
}
.assistant-message .message-content p:last-child { margin-bottom: 0 !important; }

.assistant-message .message-content ul {
    margin: 0 0 16px 0 !important;
    padding-left: 22px !important;
    list-style-type: disc !important;
}
.assistant-message .message-content ol {
    margin: 0 0 16px 0 !important;
    padding-left: 22px !important;
}
.assistant-message .message-content li {
    margin-bottom: 6px !important;
    line-height: 1.75 !important;
    color: #d6dee8 !important;
}
.assistant-message .message-content li:last-child { margin-bottom: 0 !important; }
.assistant-message .message-content li > p { margin: 0 !important; }

.assistant-message .message-content strong,
.assistant-message .message-content b {
    font-weight: 700 !important;
    color: #eef3f9 !important;
}

/* --- 行内代码（样板：浅灰底、圆角 4px、等宽略小于正文）--- */
.assistant-message .message-content code:not(pre code) {
    background: #26303f !important;
    color: #dbe4ef !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-size: 0.86em !important;
    font-family: 'SF Mono', 'Menlo', 'Consolas', 'Fira Code', monospace !important;
    border: none !important;
}

/* --- 代码块容器（样板：圆角 8-10px、无边框）--- */
.assistant-message .message-content .code-block-wrapper {
    margin: 14px 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    border: 1px solid #2a3546 !important;
    background: #141b26 !important;
}

/* --- 代码块工具栏（左语言标签 + 右复制/下载）--- */
.assistant-message .message-content .code-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 14px !important;
    background: #1a2230 !important;
    color: #8b98a9 !important;
    font-size: 0.78rem !important;
    border-bottom: 1px solid #2a3546 !important;
}
.assistant-message .message-content .code-actions button {
    background: none !important;
    border: none !important;
    color: #8b98a9 !important;
    cursor: pointer !important;
    padding: 2px 8px !important;
    border-radius: 5px !important;
    font-size: 0.78rem !important;
    transition: all 0.15s !important;
}
.assistant-message .message-content .code-actions button:hover {
    background: #26303f !important;
    color: #e2e8f0 !important;
}

/* --- 代码文字（等宽 13-14px，行高 1.65）--- */
.assistant-message .message-content pre {
    margin: 0 !important;
    padding: 14px 16px !important;
    background: #141b26 !important;
    overflow-x: auto !important;
    border-radius: 0 !important;
    border: none !important;
}
.assistant-message .message-content pre code {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: 0.84rem !important;
    line-height: 1.65 !important;
    font-family: 'SF Mono', 'Menlo', 'Consolas', 'Fira Code', monospace !important;
    color: #e2e8f0 !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

/* --- 表格（深色适配，对齐样板的轻量感）--- */
.assistant-message .message-content table {
    width: 100% !important;
    margin: 14px 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 1px solid #2a3546 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    font-size: 0.88rem !important;
}
.assistant-message .message-content thead {
    background: #1a2230 !important;
}
.assistant-message .message-content th {
    padding: 9px 13px !important;
    text-align: left !important;
    font-weight: 600 !important;
    color: #dbe4ef !important;
    border-bottom: 1px solid #2a3546 !important;
    white-space: nowrap !important;
}
.assistant-message .message-content td {
    padding: 8px 13px !important;
    border-bottom: 1px solid #222c3a !important;
    color: #c9d4e2 !important;
    line-height: 1.6 !important;
}
.assistant-message .message-content tbody tr:last-child td {
    border-bottom: none !important;
}
.assistant-message .message-content tbody tr:nth-child(even) {
    background: #181f2b !important;
}
.assistant-message .message-content tbody tr:hover {
    background: #202a39 !important;
}

/* --- 引用块（左边框 + 淡底）--- */
.assistant-message .message-content blockquote {
 margin: 14px 0 !important;
 padding: 12px 16px !important;
 border-left:3px solid #3b82f6 !important;
 background: #1a2230 !important;
 border-radius: 0 6px 6px 0 !important;
 color: #a7b4c4 !important;
}
.assistant-message .message-content blockquote p {
 margin:0 !important;
 color: inherit !important;
}

/* --- 分隔线 --- */
.assistant-message .message-content hr {
 margin: 22px 0 !important;
 border: none !important;
 border-top:1px solid #2a3546 !important;
}

/* --- 链接 --- */
.assistant-message .message-content a {
 color: #6aa9f0 !important;
 text-decoration: underline !important;
 text-underline-offset:2px !important;
}
.assistant-message .message-content a:hover {
 color: #8fc0f5 !important;
}

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

/* white-space fix: message-content was pre-wrap, breaks paragraph spacing */
.assistant-message .message-content {
    white-space: normal !important;
}

/* hljs dark adaptation: original github.min.css is a light theme */
.assistant-message .message-content pre code.hljs,
.assistant-message .message-content .hljs {
    background: transparent !important;
    color: #c9d4e2 !important;
}
.assistant-message .message-content .hljs-doctag,
.assistant-message .message-content .hljs-keyword,
.assistant-message .message-content .hljs-template-tag,
.assistant-message .message-content .hljs-template-variable,
.assistant-message .message-content .hljs-type,
.assistant-message .message-content .hljs-variable.language_ {
    color: #ff7b9c !important;
}
.assistant-message .message-content .hljs-title,
.assistant-message .message-content .hljs-title.class_,
.assistant-message .message-content .hljs-title.function_ {
    color: #c792ea !important;
}
.assistant-message .message-content .hljs-attr,
.assistant-message .message-content .hljs-attribute,
.assistant-message .message-content .hljs-literal,
.assistant-message .message-content .hljs-number,
.assistant-message .message-content .hljs-operator,
.assistant-message .message-content .hljs-variable {
    color: #79c0ff !important;
}
.assistant-message .message-content .hljs-string,
.assistant-message .message-content .hljs-regexp,
.assistant-message .message-content .hljs-meta .hljs-string {
    color: #a5d6a7 !important;
}
.assistant-message .message-content .hljs-built_in,
.assistant-message .message-content .hljs-symbol {
    color: #ffab70 !important;
}
.assistant-message .message-content .hljs-comment,
.assistant-message .message-content .hljs-code,
.assistant-message .message-content .hljs-formula {
    color: #6e7d8f !important;
    font-style: italic !important;
}
.assistant-message .message-content .hljs-name,
.assistant-message .message-content .hljs-quote,
.assistant-message .message-content .hljs-selector-tag {
    color: #7ee787 !important;
}
.assistant-message .message-content .hljs-section {
    color: #79c0ff !important;
    font-weight: 700 !important;
}
.assistant-message .message-content .hljs-emphasis { font-style: italic !important; }
.assistant-message .message-content .hljs-strong { font-weight: 700 !important; }

.assistant-message .message-content pre {
 max-width: 100% !important;
 box-sizing: border-box !important;
}
.assistant-message .message-content .code-block-wrapper {
 max-width: 100% !important;
 box-sizing: border-box !important;
}
.assistant-message .message-content .code-block-wrapper pre code.hljs {
 padding: 0 !important;
 display: block !important;
 overflow-x: visible !important;
}

/* ===== 2026-10-18 附件正方形卡片 ===== */
.attachment-preview-area { align-items: flex-start; }
.att-square {
    position: relative; width: 62px; height: 62px;
    border-radius: 10px; overflow: hidden;
    background: #1a2230; border: 1px solid #2a3546;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s; flex-shrink: 0;
}
.att-square:hover { border-color: #3b82f6; }
.att-square img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-square .att-sq-icon { font-size: 22px; color: #6b7d94; }
.att-square.scanning { border-color: #3b82f6; animation: attScanPulse 1.6s ease-in-out infinite; }
.att-square.failed { border-color: #ef4444; }
.att-sq-badge {
    position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: rgba(15,23,42,0.85);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; color: #60a5fa;
}
.att-sq-badge.spin i { animation: attSpin 0.9s linear infinite; }
.att-sq-badge.err { color: #f87171; }
.att-sq-remove {
    position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
    border-radius: 50%; border: none; background: rgba(15,23,42,0.85);
    color: #cbd5e1; font-size: 9px; cursor: pointer; padding: 0;
    display: none; align-items: center; justify-content: center;
}
.att-square:hover .att-sq-remove { display: flex; }
.att-sq-remove:hover { background: #ef4444; color: #fff; }

/* ===== 附件预览浮层 ===== */
.att-preview-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75);
    display: none; align-items: center; justify-content: center;
    z-index: 9999; padding: 40px;
}
.att-preview-overlay.show { display: flex; }
.att-preview-box {
    background: #111827; border: 1px solid #334155; border-radius: 14px;
    max-width: 90vw; max-height: 85vh; overflow: auto;
    position: relative; padding: 20px;
}
.att-preview-box img { max-width: 100%; max-height: 75vh; border-radius: 8px; display: block; }
.att-preview-box pre {
    margin: 0; white-space: pre-wrap; word-break: break-word;
    color: #cbd5e1; font-size: 0.85rem; line-height: 1.7; max-width: 800px;
}
.att-preview-close {
    position: absolute; top: 10px; right: 12px;
    background: transparent; border: none; color: #94a3b8;
    font-size: 22px; cursor: pointer; line-height: 1;
}
.att-preview-close:hover { color: #fff; }

/* 2026-10-18 AI reply bubble fills width (user bubble keeps fit-content) */
.assistant-message { width: 100% !important; align-self: stretch !important; }
.assistant-message .message-content { width: 100% !important; max-width: 100% !important; }

/* 2026-10-18 user bubble keeps shrink-to-fit after .message becomes 100% */
.user-message, .user-message .message-content { width: fit-content !important; }

/* ===== 2026-10-18 右侧消息导航条 ===== */
.msg-nav-bar {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 61;
    display: flex;
    align-items: center;
}
.msg-nav-dots {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 4px;
    max-height: 196px;
    overflow-y: auto;
    scrollbar-width: none;
}
.msg-nav-dots::-webkit-scrollbar { width: 0; }
.msg-nav-dots::-webkit-scrollbar-thumb { background: #475569; border-radius: 2px; }
.msg-nav-dots::-webkit-scrollbar-track { background: transparent; }
.msg-nav-dot {
    width: 10px;
    height: 2px;
    border-radius: 1px;
    background: #C9CDD4;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.msg-nav-dot:hover {
    background: #94a3b8;
    width: 14px;
}
.msg-nav-dot.active {
    background: #3370FF;
    width: 16px;
    height: 3px;
}
.msg-nav-card {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 230px;
    max-height: 196px;
    overflow-y: auto;
    background: #1a2230;
    border: 1px solid #2a3546;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    padding: 10px 22px 10px 16px;
    display: none;
    z-index: 60;
}
.msg-nav-bar:hover .msg-nav-card { display: block; }
.msg-nav-item {
    font-size: 12px;
    line-height: 25px;
    color: #7aa2f7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    padding-right: 8px;
}
.msg-nav-item:hover {
    color: #a9c4ff;
}
.msg-nav-item.active {
    color: #3370FF;
}

/* 2026-10-18 正文与代码块分离：确保 pre 不吞并前后正文 */
.assistant-message .message-content > p {
    margin: 0 0 14px 0 !important;
}
.assistant-message .message-content > pre {
    margin: 14px 0 !important;
}

/* 2026-10-18 nav card scrollbar */
.msg-nav-card::-webkit-scrollbar { width: 3px; }
.msg-nav-card::-webkit-scrollbar-thumb { background: #475569; border-radius: 2px; }
.msg-nav-card::-webkit-scrollbar-track { background: transparent; }
.msg-nav-card { scrollbar-width: thin; }
