/* 2026-08-19: code/command blocks explicit monospace font (Windows->Consolas, macOS->SF Mono/Menlo) */
pre, code, kbd, samp { font-family: Consolas, "JetBrains Mono", "SF Mono", Menlo, monospace; }
/* ============================================================
   BusinessMind MVP - Test Console Stylesheet v2
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --topbar-h: 48px;
    font-size: 13px;
}

[data-theme="dark"] {
    --primary: #818CF8;
    --primary-light: #A5B4FC;
    --primary-dark: #4F46E5;
    --bg: #111827;
    --surface: #1F2937;
    --text: #F9FAFB;
    --text-muted: #9CA3AF;
    --border: #374151;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #60A5FA;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ---------- Topbar / Nav ---------- */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    font-size: 12px;
}
.logo {
    color: #10B981;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    margin-right: 6px;
}
.brand {
    font-weight: 700;
    font-size: 14px;
    color: #10B981;
    margin-right: 10px;
}

/* Nav tabs */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
    margin-right: 12px;
    height: 100%;
}
.nav-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.nav-tab:hover {
    color: var(--text);
    background: var(--bg);
}
.nav-tab.active {
    color: var(--primary);
    background: #EEF2FF;
    border-color: var(--primary-light);
    font-weight: 600;
}
.nav-icon { font-size: 14px; }

.nav-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
}

.topbar-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ws-path {
    color: var(--text);
    font-weight: 500;
    font-size: 12px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: 0.15s;
}
.ws-path:hover {
    background: var(--bg);
    border-color: var(--border);
}
.ws-path-input {
    font-size: 12px;
    font-weight: 500;
    max-width: 300px;
    padding: 3px 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    outline: none;
    color: var(--text);
    background: var(--surface);
}
.ws-path-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.15);
}
.filler { flex: 1; }
.file-count {
    font-weight: 700;
    color: var(--primary);
    font-size: 13px;
    min-width: 20px;
    text-align: center;
}
.user-label {
    color: var(--text-muted);
    font-size: 11px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    margin-left: 4px;
}

/* ---------- Button ---------- */
.btn-sm {
    padding: 4px 12px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
    transition: 0.15s;
}
.btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EEF2FF;
}
.btn-send {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: 0.15s;
    white-space: nowrap;
}
.btn-send:hover { background: var(--primary-dark); }
.btn-send:disabled { background: var(--text-muted); cursor: not-allowed; }

/* ---------- Upload Panel ---------- */
.upload-panel {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px;
    transition: 0.2s;
}
.upload-panel.hidden { display: none; }
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: 0.15s;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: #EEF2FF;
}
.drop-icon { font-size: 28px; }
.dropzone p { margin-top: 6px; color: var(--text); font-size: 13px; }
.drop-hint { font-size: 11px !important; color: var(--text-muted) !important; }
.upload-status {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    min-height: 18px;
}

/* ---------- Main Layout ---------- */
.main-layout {
    display: flex;
    height: calc(100vh - var(--topbar-h));
    padding-bottom: 40px;
    padding-bottom: 40px;
    padding-bottom: 36px;
}
.file-panel {
    width: 260px;
    min-width: 200px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.panel-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: default;
}
.file-item:hover { background: var(--bg); }
.file-icon { font-size: 16px; flex-shrink: 0; }
.file-type-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--accent-light, #EEF4FC);
    color: var(--primary, #236FD2);
    white-space: nowrap;
}
.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-size {
    color: var(--text-muted);
    font-size: 10px;
    flex-shrink: 0;
}
.file-delete-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: 0.15s;
    opacity: 0;
}
.file-item:hover .file-delete-btn {
    opacity: 1;
}
.file-delete-btn:hover {
    background: #FEE2E2;
    color: var(--danger);
    border-color: #FECACA;
}
.empty-hint {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 20px 10px;
}

/* ---------- Chat Panel ---------- */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    min-width: 0;
}

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- Excel Panel (right side) ---------- */
.excel-panel {
    width: 50%;
    min-width: 520px;
    flex-shrink: 0;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* 确保面板有明确的尺寸，避免 flex 计算为 0 */
    min-height: 200px;
    /* 确保面板有实际像素宽度 */
    position: relative;
}
.excel-panel.hidden { display: none; }

/* Sheet tabs in header */
.sheet-tabs {
    display: flex;
    gap: 2px;
}
.sheet-tab {
    padding: 2px 10px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.15s;
}
.sheet-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.sheet-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

/* Spreadsheet container (top half) */
.excel-spreadsheet {
    flex: 1;
    min-height: 150px;
    min-width: 300px;
    width: 100%;
    overflow: hidden;
    position: relative;
    background: var(--bg);
    /* 确保容器有明确的尺寸 */
    height: 100%;
}
.excel-spreadsheet .empty-hint {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* Operation log (bottom) */
.excel-log {
    max-height: 220px;
    border-top: 2px solid var(--border);
    overflow-y: auto;
    padding: 8px 10px;
    background: #FAFAFA;
    font-size: 11px;
}

.excel-step {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    padding: 3px 0;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.4;
}
.excel-step:last-child { border-bottom: none; }
.excel-step-icon {
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1.4;
}
.excel-step-text {
    flex: 1;
    word-break: break-word;
}
.excel-step-tool    { color: var(--info); }
.excel-step-result  { color: var(--success); font-weight: 600; }
.excel-step-detail  { color: var(--text-muted); }
.excel-step-error   { color: var(--danger); font-weight: 600; }
.excel-step-system  { color: var(--text-muted); font-style: italic; }

/* Dedicated Univer mount point — explicit fill with safe minimums */
#univerContainer {
    width: 100%;
    height: 100%;
    min-width: 520px;
    min-height: 300px;
    /* 确保 Univer 容器可见 */
    display: block;
    position: relative;
    /* 确保容器有实际像素尺寸 */
    overflow: hidden;
}

/* Loading overlay above Univer UI */
.excel-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.excel-loading-overlay .empty-hint {
    position: static;
    transform: none;
}

/* Univer host element sizing */
.excel-spreadsheet [class*="univer"],
.excel-spreadsheet .univer-container {
    width: 100% !important;
    height: 100% !important;
}

/* Univer canvas should fill container */
.excel-spreadsheet canvas {
    max-width: 100%;
}

/* Univer formula bar — compact */
.excel-spreadsheet .univer-formula-bar {
    font-size: 12px;
}

/* Univer sheet tab bar — match theme */
.excel-spreadsheet .univer-sheet-bar {
    font-size: 11px;
}

/* Loading / empty state */
.loading-notice {
    text-align: center;
    padding: 48px 20px;
    font-size: 14px;
    color: var(--text-muted);
}
.loading-notice .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.chat-messages {
    flex: none;
    overflow-y: visible;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}
.input-upper { flex: 1; min-height: 0; padding: 0; }
.status-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 4px 12px;
    font-size: 11px;
    color: #10B981;  /* 与 Agent ON 按钮一致 */
    background: var(--surface);  /* 自适应主题（浅色/深色） */
    border-bottom: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
    animation: statusPulse 1.5s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.status-spacer { display: none; }
.status-divider { opacity: 0.4; }
.input-upper .do-input {
    width: 100%; border: none; outline: none; background: #fff;
    font-size: 14px; color: #1f2937; font-family: inherit;
    padding: 8px 12px; resize: none; min-height: 32px; max-height: 160px;
    line-height: 1.5; overflow-y: auto; box-sizing: border-box;
    border-radius: 10px;
}
.input-lower { border-top: 1px solid #e2e8f0; padding-top: 8px; margin-top: 6px; flex-shrink: 0; }
.toolbar-actions {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.tool-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    height: 32px; padding: 0 10px; border-radius: 6px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 12px; font-weight: 500; color: var(--text);
    cursor: pointer; white-space: nowrap; font-family: inherit;
}
.tool-btn:hover { background: var(--hover); }
.btn-send-new {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: #4f6ef7; border: none; color: #fff;
    font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.btn-send-new:hover { background: #3b5de7; }
.dropup-wrap { position: relative; display: inline-block; }
.dropup-menu {
    position: absolute; bottom: calc(100% + 8px); left: 0;
    min-width: 200px; background: var(--surface);
    border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px 0; z-index: 200; display: none;
    border: 1px solid var(--border);
}
.dropup-menu.open { display: block; }
.chat-input-inner {
    display: flex; flex-direction: column;
    border-radius: 16px; padding: 12px 16px 10px;
    width: 1100px; max-width: 100%; box-sizing: border-box;
    margin: 0 auto 10px; background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .2s;
}
.chat-input-inner:focus-within { border-color: #4f6ef7; box-shadow: 0 0 0 2px rgba(79,110,247,0.08); }
.chat-input-inner textarea {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    transition: 0.15s;
}
.chat-input-inner textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}

/* ---------- Messages ---------- */
.msg-system {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 4px 0;
}
.msg-user, .msg-bot {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: inherit;
    line-height: 1.55;
    word-break: break-word;
}
.msg-user { max-width: 78%; }
.msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}
.msg-bot {
    align-self: flex-start;
    /* 2026-08-31（S1.0）：去掉气泡，直接平铺输出（dsh 风格） */
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 6px 2px;
    width: 100%;
}
/* 回复操作栏（复制/点赞/分叉，dsh 风格，2026-08-31） */
.msg-actions-bar {
    display: flex;
    gap: 2px;
    margin-top: 6px;
    opacity: 0.55;
    transition: opacity .15s;
}
.msg-bot:hover .msg-actions-bar,
.msg-actions-bar:hover { opacity: 1; }
.msg-actions-bar button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border: none; border-radius: 6px;
    background: transparent; color: var(--text-muted, #6b7280);
    cursor: pointer; transition: background .12s, color .12s;
}
.msg-actions-bar button:hover { background: rgba(127,127,127,.12); color: var(--text, #1f2937); }
.msg-actions-bar button.liked { color: var(--primary, #2563eb); }
.msg-text { margin: 0; white-space: pre-wrap; }
.msg-header {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.msg-thinking {
    opacity: 0.7;
    font-style: italic;
    font-size: 12px;
}

/* ── Session Panel (左侧会话列表) ── */
.session-panel {
    width: 220px;
    min-width: 220px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* User Message Actions */
.msg-user { position: relative; }
.msg-user .msg-actions {
    display: none;
    margin-top: 6px;
    gap: 4px;
}
.msg-user:hover .msg-actions {
    display: flex;
}
.msg-action-btn {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 8px;
    color: #333;
}

/* Bottom Status Bar */
.bottom-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 14px; background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted);
    z-index: 1001;
}
.bottom-bar-link { cursor: pointer; color: var(--text-muted); white-space: nowrap; }
.bar-sep { color: var(--border); font-size: 11px; user-select: none; }
.bottom-bar-link:hover { color: var(--text); } color: var(--text-muted); white-space: nowrap; }
.bar-sep { color: var(--border); font-size: 11px; user-select: none; }
.bottom-bar-link:hover { color: var(--text); }

.feedback-box {
    margin-top: 6px; padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.feedback-box textarea {
    width: 100%; padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px; font-size: 12px;
    resize: vertical; box-sizing: border-box;
}

.msg-action-btn:hover {
    opacity: 1;
    background: var(--hover);
}
.edit-msg-textarea {
    width: 500px;
    height: 50px;
    padding: 10px 12px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
    min-height: 80px;
    color: var(--text);
    background: var(--bg);
    outline: none;
}
.edit-msg-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.session-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
}
.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.session-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.session-item:hover { background: var(--hover); }
.session-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.session-title {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-time {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.session-delete {
    float: right;
    font-size: 10px;
    color: var(--danger);
    cursor: pointer;
    opacity: 0;
    border: none;
    background: none;
    padding: 0 2px;
}
.session-item:hover .session-delete { opacity: 1; }

/* ── File Panel Right (右侧可收起) ── */
.file-panel-right {
    width: 260px;
    min-width: 260px;
    border-left: 1px solid var(--border);
    transition: min-width 0.2s, width 0.2s, padding 0.2s;
    overflow: hidden;
}
.file-panel-right.collapsed {
    width: 32px;
    min-width: 32px;
}
.file-panel-right.collapsed .panel-header h3,
.file-panel-right.collapsed .panel-header button:not(#btnToggleFiles),
.file-panel-right.collapsed .file-list {
    display: none;
}
.file-panel-right.collapsed #btnToggleFiles::before {
    content: "\25B6";
}

/* ── Session Actions ── */
.session-actions {
    display: none;
    position: absolute;
    right: 4px;
    top: 4px;
    gap: 2px;
}
.session-item:hover .session-actions {
    display: flex;
}
.session-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    padding: 1px 3px;
    border-radius: 2px;
    color: var(--text-muted);
    opacity: 0.6;
}
.session-action-btn:hover { opacity: 1; background: var(--hover); }
.session-item { position: relative; }
.session-rename-input {
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 3px;
    font-size: 12px;
    padding: 2px 4px;
    color: var(--text);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

/* ── Approval Dialog ── */
.modal-content { background: var(--surface); color: var(--text); }
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.approval-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.approval-dialog h3 { margin: 0 0 12px; font-size: 16px; }
.approval-dialog p { margin: 6px 0; font-size: 13px; }
.approval-dialog code { background: var(--bg); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.btn-approve { background: #27ae60; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-approve:hover { background: #219a52; }
.btn-reject { background: #e74c3c; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-reject:hover { background: #c0392b; }
#rejectReasonInput { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; box-sizing: border-box; }

/* ── Token Indicator ── */
.token-indicator {
    position: fixed; bottom: 8px; right: 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 4px 10px;
    font-size: 11px; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 4px;
    z-index: 999; box-shadow: var(--shadow);
}
#compressionBadge {
    background: #27ae60; color: #fff; border-radius: 8px;
    padding: 0 6px; font-size: 10px; margin-left: 4px;
}

.agent-step {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 4px 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.agent-step:last-child { border-bottom: none; }
.agent-step-icon {
    flex-shrink: 0;
    font-size: 13px;
    line-height: 1.5;
}
.agent-step-text {
    flex: 1;
    word-break: break-word;
}
.agent-step-thinking { color: var(--text-muted); }
.agent-step-tool_call { color: var(--info); }
.agent-step-tool_result { color: var(--text); background: var(--bg); border-radius: 4px; padding: 4px 6px; }
.agent-step-response { color: var(--text); font-weight: 500; }
.agent-step-error { color: var(--danger); }
.agent-step-waiting { color: var(--text-muted); font-style: italic; }

/* 已思考折叠（V3.34：Co-op 与 Tasks 一致，执行完成后折叠推理步骤） */
.agent-collapse { margin: 2px 0 6px 2px; }
.agent-collapse-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--primary); cursor: pointer;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; padding: 2px 10px; user-select: none;
}
.agent-collapse-btn:hover { background: var(--primary); color: #fff; }
.agent-collapse-body { margin: 4px 0 0 8px; border-left: 2px solid var(--border); padding-left: 10px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-intent { background: #E0E7FF; color: var(--primary); }
.badge-route { background: #FEF3C7; color: #92400E; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-warning { background: #FEF3C7; color: #92400E; }

/* ---------- Cards in messages ---------- */
.card {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 12px;
}
.card h4 {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.gscp-card { border-left: 3px solid var(--info); }
.consensus-card { border-left: 3px solid var(--success); }
.upload-request-card { border-left: 3px solid var(--warning); }
.missing-card { border-left: 3px solid var(--danger); }
.plan-card { border-left: 3px solid var(--primary); }
.exec-card { border-left: 3px solid #8B5CF6; }
.valid-card { border-left: 3px solid var(--success); }
.agg-card { border-left: 3px solid #EC4899; }

.gscp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.gscp-table td {
    padding: 2px 8px;
    border-bottom: 1px solid var(--border);
}
.gscp-table td:first-child {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.missing-card ul {
    margin: 4px 0 0 16px;
    font-size: 12px;
}
.card pre {
    font-size: 11px;
    max-height: 200px;
    overflow: auto;
    background: var(--surface);
    padding: 8px;
    border-radius: 4px;
}

/* ---------- Pipeline progress bar ---------- */
.pipeline-steps {
    display: flex;
    gap: 2px;
    margin: 6px 0;
    font-size: 11px;
}
.pipeline-step {
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--border);
    color: var(--text-muted);
    font-weight: 500;
}
.pipeline-step.done { background: #D1FAE5; color: #065F46; }
.pipeline-step.active { background: #E0E7FF; color: var(--primary); font-weight: 700; animation: pulse-step 1.5s infinite; }
.pipeline-step.fail { background: #FEE2E2; color: #991B1B; }
@keyframes pulse-step {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ---------- Pipeline result cards ---------- */
.step-list { font-size: 11px; margin: 4px 0; }
.step-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}
.step-status {
    width: 16px; height: 16px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step-status.ok { background: #D1FAE5; color: #065F46; }
.step-status.run { background: #FEF3C7; color: #92400E; }
.step-status.err { background: #FEE2E2; color: #991B1B; }

.score-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    margin: 6px 0;
    overflow: hidden;
}
.score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s;
}
.score-fill.pass { background: var(--success); }
.score-fill.warn { background: var(--warning); }
.score-fill.fail { background: var(--danger); }

/* ---------- Action buttons in messages ---------- */
.action-bar {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.btn-action {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid var(--primary);
    background: var(--surface);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    white-space: nowrap;
}
.btn-action:hover { background: #EEF2FF; }
.btn-action.primary {
    background: var(--primary);
    color: white;
}
.btn-action.primary:hover { background: var(--primary-dark); }


/* Session Footer (user + settings) */
.session-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-top: 1px solid var(--border);
    font-size: 12px; margin-top: auto;
}
.user-display { cursor: default; color: var(--text-muted); }
.settings-icon { cursor: pointer; font-size: 14px; opacity: 0.6; }
.settings-icon:hover { opacity: 1; }

/* Settings Panel */
.settings-panel { max-width: 720px !important; min-height: 420px !important; padding: 0 !important; border-radius: 10px !important; overflow: hidden; }
.settings-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    font-size: 15px; font-weight: 600;
}
.settings-close { cursor: pointer; font-size: 18px; opacity: 0.5; }
.settings-close:hover { opacity: 1; }
.settings-body { display: flex; min-height: 380px; height: 380px; }
.settings-sidebar {
    width: 100px; padding: 12px 0; border-right: 1px solid var(--border);
    background: var(--bg);
}
.settings-tab {
    padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--text-muted);
    border-right: 2px solid transparent; transition: 0.15s;
}
.settings-tab:hover { color: var(--text); background: var(--hover); }
.settings-tab.active { color: var(--primary); border-right-color: var(--primary); background: var(--hover); }
.settings-content { flex: 1; padding: 16px 20px; overflow-y: auto; }
/* 选项按钮不显示对勾 */
.option-btn .check { display: none !important; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content h4 { margin: 12px 0 6px; font-size: 13px; }
.tab-content h4:first-of-type { margin-top: 0; }
.radio-group { display: flex; gap: 12px; margin-bottom: 4px; }
.radio-group label { font-size: 12px; cursor: pointer; }

/* Points Modal */
.points-panel { max-width: 480px !important; padding: 0 !important; border-radius: 10px !important; overflow: hidden; }

/* Transaction list */
.tx-item { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12px; border-bottom: 1px solid var(--border); }
.tx-date { color: var(--text-muted); font-size: 11px; }
.tx-amount { font-weight: 500; }
.tx-amount.negative { color: var(--danger); }
.tx-amount.positive { color: var(--success); }


/* Recharge Panel */
.recharge-panel { max-width: 460px !important; padding: 0 !important; border-radius: 10px !important; overflow: hidden; }
.recharge-plans { display: flex; flex-direction: column; gap: 8px; }
.recharge-plan {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: 0.15s; position: relative;
}
.recharge-plan:hover { border-color: var(--primary); background: var(--hover); }
.recharge-plan.active { border-color: var(--primary); background: rgba(59,130,246,0.08); box-shadow: 0 0 0 1px var(--primary); }
.plan-points { font-size: 14px; font-weight: 600; }
.plan-price { font-size: 13px; color: var(--text-muted); }
.plan-badge {
    position: absolute; right: -4px; top: -6px;
    background: var(--primary); color: #fff; font-size: 10px;
    padding: 1px 6px; border-radius: 8px;
}
.payment-methods { display: flex; gap: 10px; }
.payment-method {
    flex: 1; display: flex; align-items: center; gap: 6px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; font-size: 13px; transition: 0.15s;
}
.payment-method:hover { border-color: var(--primary); }
.payment-method.active { border-color: var(--primary); background: rgba(59,130,246,0.08); }
.pay-icon { font-size: 20px; }
.pay-note { font-size: 10px; color: var(--text-muted); margin-left: auto; }

.thinking-collapse {
    margin: 6px 0;
    font-size: 13px;
}
.thinking-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    padding: 4px 0;
    user-select: none;
}
.thinking-toggle:hover { color: var(--text); }
.thinking-arrow { font-size: 11px; flex-shrink: 0; }
.thinking-body { border-left: 2px solid var(--border); margin: 4px 0 4px 8px; padding-left: 10px; }
.thinking-body .agent-step { font-size: 13px; }

.history-list {
    list-style: none; padding: 0; margin: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.history-list li {
    display: flex;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    gap: 8px;
}
.history-list li:last-child { border-bottom: none; }
.history-list .date { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.history-list .change.negative { color: #dc2626; }
.history-list .change.positive { color: #16a34a; }

/* ---------- Dot pulse animation ---------- */
.dot-pulse {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1.2s infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Task Manager page ---------- */
.tasks-layout {
    display: flex;
    height: calc(100vh - var(--topbar-h));
    padding-bottom: 40px;
    padding-bottom: 40px;
}
.task-list-panel {
    width: 300px;
    min-width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.task-detail-panel {
    flex: 1;
    background: var(--bg);
    overflow-y: auto;
    padding: 16px 20px;
}
.task-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: 0.1s;
}
.task-item:hover { background: var(--bg); }
.task-item.selected { background: #EEF2FF; border-left: 3px solid var(--primary); }
.task-item .task-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.task-item .task-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; }
.task-item .task-intent { font-size: 10px; margin-top: 2px; }

.detail-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.detail-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.detail-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .file-panel { width: 180px; min-width: 160px; }
    .excel-panel { width: 40%; min-width: 300px; }
    .ws-path { max-width: 120px; }
    .msg-user, .msg-bot { max-width: 92%; }
    .task-list-panel { width: 200px; min-width: 160px; }
    .nav-tab span.nav-label { display: none; }
}
@media (max-width: 520px) {
    .file-panel { display: none; }
    .excel-panel { display: none; }
    .task-list-panel { width: 140px; min-width: 120px; }
    .ws-path { max-width: 80px; }
}

/* ============================================================
   TaskTracker 任务清单
   ============================================================ */
.task-tracker {
    flex: none;
    margin: 0 auto;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-width: 1100px;
    width: 1100px;
    box-sizing: border-box;
    font-size: 12px;
    margin-bottom: 4px;
}
.task-tracker-header {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.task-tracker-progress {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}
.task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    transition: opacity 0.3s;
}
.task-check {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: 0.2s;
}
.task-check.completed {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.task-check.executing {
    border-color: var(--primary);
    animation: pulse-dot 1s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}
.task-label {
    color: var(--text);
    font-size: 12px;
    line-height: 1.4;
}
.task-label.completed {
    color: var(--text-muted);
    text-decoration: line-through;
}
.task-done-msg {
    font-size: 12px;
    color: var(--success);
    font-weight: 600;
    margin-top: 4px;
}.dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 20px; font-size: 13px; color: var(--text);
    cursor: pointer; border: none; background: transparent;
    width: 100%; text-align: left; font-family: inherit; white-space: nowrap;
}﻿/* ============================================================
   BusinessMind MVP - Test Console Stylesheet v2
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --topbar-h: 48px;
    font-size: 13px;
}

[data-theme="dark"] {
    --primary: #818CF8;
    --primary-light: #A5B4FC;
    --primary-dark: #4F46E5;
    --bg: #111827;
    --surface: #1F2937;
    --text: #F9FAFB;
    --text-muted: #9CA3AF;
    --border: #374151;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #60A5FA;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ---------- Topbar / Nav ---------- */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    font-size: 12px;
}
.logo {
    color: #10B981;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    margin-right: 6px;
}
.brand {
    font-weight: 700;
    font-size: 14px;
    color: #10B981;
    margin-right: 10px;
}

/* Nav tabs */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
    margin-right: 12px;
    height: 100%;
}
.nav-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.nav-tab:hover {
    color: var(--text);
    background: var(--bg);
}
.nav-tab.active {
    color: var(--primary);
    background: #EEF2FF;
    border-color: var(--primary-light);
    font-weight: 600;
}
.nav-icon { font-size: 14px; }

.nav-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
}

.topbar-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ws-path {
    color: var(--text);
    font-weight: 500;
    font-size: 12px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: 0.15s;
}
.ws-path:hover {
    background: var(--bg);
    border-color: var(--border);
}
.ws-path-input {
    font-size: 12px;
    font-weight: 500;
    max-width: 300px;
    padding: 3px 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    outline: none;
    color: var(--text);
    background: var(--surface);
}
.ws-path-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.15);
}
.filler { flex: 1; }
.file-count {
    font-weight: 700;
    color: var(--primary);
    font-size: 13px;
    min-width: 20px;
    text-align: center;
}
.user-label {
    color: var(--text-muted);
    font-size: 11px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    margin-left: 4px;
}

/* ---------- Button ---------- */
.btn-sm {
    padding: 4px 12px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
    transition: 0.15s;
}
.btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EEF2FF;
}
.btn-send {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: 0.15s;
    white-space: nowrap;
}
.btn-send:hover { background: var(--primary-dark); }
.btn-send:disabled { background: var(--text-muted); cursor: not-allowed; }

/* ---------- Upload Panel ---------- */
.upload-panel {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px;
    transition: 0.2s;
}
.upload-panel.hidden { display: none; }
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: 0.15s;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: #EEF2FF;
}
.drop-icon { font-size: 28px; }
.dropzone p { margin-top: 6px; color: var(--text); font-size: 13px; }
.drop-hint { font-size: 11px !important; color: var(--text-muted) !important; }
.upload-status {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    min-height: 18px;
}

/* ---------- Main Layout ---------- */
.main-layout {
    display: flex;
    height: calc(100vh - var(--topbar-h));
    padding-bottom: 40px;
    padding-bottom: 40px;
    padding-bottom: 36px;
}
.file-panel {
    width: 260px;
    min-width: 200px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.panel-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: default;
}
.file-item:hover { background: var(--bg); }
.file-icon { font-size: 16px; flex-shrink: 0; }
.file-type-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--accent-light, #EEF4FC);
    color: var(--primary, #236FD2);
    white-space: nowrap;
}
.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-size {
    color: var(--text-muted);
    font-size: 10px;
    flex-shrink: 0;
}
.file-delete-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: 0.15s;
    opacity: 0;
}
.file-item:hover .file-delete-btn {
    opacity: 1;
}
.file-delete-btn:hover {
    background: #FEE2E2;
    color: var(--danger);
    border-color: #FECACA;
}
.empty-hint {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 20px 10px;
}

/* ---------- Chat Panel ---------- */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    min-width: 0;
}

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- Excel Panel (right side) ---------- */
.excel-panel {
    width: 50%;
    min-width: 520px;
    flex-shrink: 0;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* 确保面板有明确的尺寸，避免 flex 计算为 0 */
    min-height: 200px;
    /* 确保面板有实际像素宽度 */
    position: relative;
}
.excel-panel.hidden { display: none; }

/* Sheet tabs in header */
.sheet-tabs {
    display: flex;
    gap: 2px;
}
.sheet-tab {
    padding: 2px 10px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.15s;
}
.sheet-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.sheet-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

/* Spreadsheet container (top half) */
.excel-spreadsheet {
    flex: 1;
    min-height: 150px;
    min-width: 300px;
    width: 100%;
    overflow: hidden;
    position: relative;
    background: var(--bg);
    /* 确保容器有明确的尺寸 */
    height: 100%;
}
.excel-spreadsheet .empty-hint {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* Operation log (bottom) */
.excel-log {
    max-height: 220px;
    border-top: 2px solid var(--border);
    overflow-y: auto;
    padding: 8px 10px;
    background: #FAFAFA;
    font-size: 11px;
}

.excel-step {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    padding: 3px 0;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.4;
}
.excel-step:last-child { border-bottom: none; }
.excel-step-icon {
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1.4;
}
.excel-step-text {
    flex: 1;
    word-break: break-word;
}
.excel-step-tool    { color: var(--info); }
.excel-step-result  { color: var(--success); font-weight: 600; }
.excel-step-detail  { color: var(--text-muted); }
.excel-step-error   { color: var(--danger); font-weight: 600; }
.excel-step-system  { color: var(--text-muted); font-style: italic; }

/* Dedicated Univer mount point — explicit fill with safe minimums */
#univerContainer {
    width: 100%;
    height: 100%;
    min-width: 520px;
    min-height: 300px;
    /* 确保 Univer 容器可见 */
    display: block;
    position: relative;
    /* 确保容器有实际像素尺寸 */
    overflow: hidden;
}

/* Loading overlay above Univer UI */
.excel-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.excel-loading-overlay .empty-hint {
    position: static;
    transform: none;
}

/* Univer host element sizing */
.excel-spreadsheet [class*="univer"],
.excel-spreadsheet .univer-container {
    width: 100% !important;
    height: 100% !important;
}

/* Univer canvas should fill container */
.excel-spreadsheet canvas {
    max-width: 100%;
}

/* Univer formula bar — compact */
.excel-spreadsheet .univer-formula-bar {
    font-size: 12px;
}

/* Univer sheet tab bar — match theme */
.excel-spreadsheet .univer-sheet-bar {
    font-size: 11px;
}

/* Loading / empty state */
.loading-notice {
    text-align: center;
    padding: 48px 20px;
    font-size: 14px;
    color: var(--text-muted);
}
.loading-notice .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.chat-messages {
    flex: none;
    overflow-y: visible;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}
.input-upper { flex: 1; min-height: 0; padding: 0; }
.input-upper .do-input {
    width: 100%; border: none; outline: none; background: #fff;
    font-size: 14px; color: #1f2937; font-family: inherit;
    padding: 8px 12px; resize: none; min-height: 32px; max-height: 160px;
    line-height: 1.5; overflow-y: auto; box-sizing: border-box;
    border-radius: 10px;
}
.input-lower { border-top: 1px solid #e2e8f0; padding-top: 8px; margin-top: 6px; flex-shrink: 0; }
.toolbar-actions {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.tool-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    height: 32px; padding: 0 10px; border-radius: 6px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 12px; font-weight: 500; color: var(--text);
    cursor: pointer; white-space: nowrap; font-family: inherit;
}
.tool-btn:hover { background: var(--hover); }
.btn-send-new {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: #4f6ef7; border: none; color: #fff;
    font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.btn-send-new:hover { background: #3b5de7; }
.dropup-wrap { position: relative; display: inline-block; }
.dropup-menu {
    position: absolute; bottom: calc(100% + 8px); left: 0;
    min-width: 200px; background: var(--surface);
    border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px 0; z-index: 200; display: none;
    border: 1px solid var(--border);
}
.dropup-menu.open { display: block; }
.chat-input-inner {
    display: flex; flex-direction: column;
    border-radius: 16px; padding: 12px 16px 10px;
    width: 1100px; max-width: 100%; box-sizing: border-box;
    margin: 0 auto 10px; background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .2s;
}
.chat-input-inner:focus-within { border-color: #4f6ef7; box-shadow: 0 0 0 2px rgba(79,110,247,0.08); }
.chat-input-inner textarea {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    transition: 0.15s;
}
.chat-input-inner textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}

/* ---------- Messages ---------- */
.msg-system {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 4px 0;
}
.msg-user, .msg-bot {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: inherit;
    line-height: 1.55;
    word-break: break-word;
}
.msg-user { max-width: 78%; }
.msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}
.msg-bot {
    align-self: flex-start;
    /* 2026-08-31（S1.0）：去掉气泡，直接平铺输出（dsh 风格） */
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 6px 2px;
    width: 100%;
}
/* 回复操作栏（复制/点赞/分叉，dsh 风格，2026-08-31） */
.msg-actions-bar {
    display: flex;
    gap: 2px;
    margin-top: 6px;
    opacity: 0.55;
    transition: opacity .15s;
}
.msg-bot:hover .msg-actions-bar,
.msg-actions-bar:hover { opacity: 1; }
.msg-actions-bar button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border: none; border-radius: 6px;
    background: transparent; color: var(--text-muted, #6b7280);
    cursor: pointer; transition: background .12s, color .12s;
}
.msg-actions-bar button:hover { background: rgba(127,127,127,.12); color: var(--text, #1f2937); }
.msg-actions-bar button.liked { color: var(--primary, #2563eb); }
.msg-text { margin: 0; white-space: pre-wrap; }
.msg-header {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.msg-thinking {
    opacity: 0.7;
    font-style: italic;
    font-size: 12px;
}

/* ── Session Panel (左侧会话列表) ── */
.session-panel {
    width: 220px;
    min-width: 220px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* User Message Actions */
.msg-user { position: relative; }
.msg-user .msg-actions {
    display: none;
    margin-top: 6px;
    gap: 4px;
}
.msg-user:hover .msg-actions {
    display: flex;
}
.msg-action-btn {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 8px;
    color: #333;
}

/* Bottom Status Bar */
.bottom-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 14px; background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted);
    z-index: 1001;
}
.bottom-bar-link { cursor: pointer; color: var(--text-muted); white-space: nowrap; }
.bar-sep { color: var(--border); font-size: 11px; user-select: none; }
.bottom-bar-link:hover { color: var(--text); } color: var(--text-muted); white-space: nowrap; }
.bar-sep { color: var(--border); font-size: 11px; user-select: none; }
.bottom-bar-link:hover { color: var(--text); }

.feedback-box {
    margin-top: 6px; padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.feedback-box textarea {
    width: 100%; padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px; font-size: 12px;
    resize: vertical; box-sizing: border-box;
}

.msg-action-btn:hover {
    opacity: 1;
    background: var(--hover);
}
.edit-msg-textarea {
    width: 500px;
    height: 50px;
    padding: 10px 12px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
    min-height: 80px;
    color: var(--text);
    background: var(--bg);
    outline: none;
}
.edit-msg-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.session-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
}
.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.session-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.session-item:hover { background: var(--hover); }
.session-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.session-title {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-time {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.session-delete {
    float: right;
    font-size: 10px;
    color: var(--danger);
    cursor: pointer;
    opacity: 0;
    border: none;
    background: none;
    padding: 0 2px;
}
.session-item:hover .session-delete { opacity: 1; }

/* ── File Panel Right (右侧可收起) ── */
.file-panel-right {
    width: 260px;
    min-width: 260px;
    border-left: 1px solid var(--border);
    transition: min-width 0.2s, width 0.2s, padding 0.2s;
    overflow: hidden;
}
.file-panel-right.collapsed {
    width: 32px;
    min-width: 32px;
}
.file-panel-right.collapsed .panel-header h3,
.file-panel-right.collapsed .panel-header button:not(#btnToggleFiles),
.file-panel-right.collapsed .file-list {
    display: none;
}
.file-panel-right.collapsed #btnToggleFiles::before {
    content: "\25B6";
}

/* ── Session Actions ── */
.session-actions {
    display: none;
    position: absolute;
    right: 4px;
    top: 4px;
    gap: 2px;
}
.session-item:hover .session-actions {
    display: flex;
}
.session-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    padding: 1px 3px;
    border-radius: 2px;
    color: var(--text-muted);
    opacity: 0.6;
}
.session-action-btn:hover { opacity: 1; background: var(--hover); }
.session-item { position: relative; }
.session-rename-input {
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 3px;
    font-size: 12px;
    padding: 2px 4px;
    color: var(--text);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

/* ── Approval Dialog ── */
.modal-content { background: var(--surface); color: var(--text); }
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.approval-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.approval-dialog h3 { margin: 0 0 12px; font-size: 16px; }
.approval-dialog p { margin: 6px 0; font-size: 13px; }
.approval-dialog code { background: var(--bg); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.btn-approve { background: #27ae60; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-approve:hover { background: #219a52; }
.btn-reject { background: #e74c3c; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-reject:hover { background: #c0392b; }
#rejectReasonInput { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; box-sizing: border-box; }

/* ── Token Indicator ── */
.token-indicator {
    position: fixed; bottom: 8px; right: 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 4px 10px;
    font-size: 11px; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 4px;
    z-index: 999; box-shadow: var(--shadow);
}
#compressionBadge {
    background: #27ae60; color: #fff; border-radius: 8px;
    padding: 0 6px; font-size: 10px; margin-left: 4px;
}

.agent-step {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 4px 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.agent-step:last-child { border-bottom: none; }
.agent-step-icon {
    flex-shrink: 0;
    font-size: 13px;
    line-height: 1.5;
}
.agent-step-text {
    flex: 1;
    word-break: break-word;
}
.agent-step-thinking { color: var(--text-muted); }
.agent-step-tool_call { color: var(--info); }
.agent-step-tool_result { color: var(--text); background: var(--bg); border-radius: 4px; padding: 4px 6px; }
.agent-step-response { color: var(--text); font-weight: 500; }
.agent-step-error { color: var(--danger); }
.agent-step-waiting { color: var(--text-muted); font-style: italic; }

/* 已思考折叠（V3.34：Co-op 与 Tasks 一致，执行完成后折叠推理步骤） */
.agent-collapse { margin: 2px 0 6px 2px; }
.agent-collapse-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--primary); cursor: pointer;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; padding: 2px 10px; user-select: none;
}
.agent-collapse-btn:hover { background: var(--primary); color: #fff; }
.agent-collapse-body { margin: 4px 0 0 8px; border-left: 2px solid var(--border); padding-left: 10px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-intent { background: #E0E7FF; color: var(--primary); }
.badge-route { background: #FEF3C7; color: #92400E; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-warning { background: #FEF3C7; color: #92400E; }

/* ---------- Cards in messages ---------- */
.card {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 12px;
}
.card h4 {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.gscp-card { border-left: 3px solid var(--info); }
.consensus-card { border-left: 3px solid var(--success); }
.upload-request-card { border-left: 3px solid var(--warning); }
.missing-card { border-left: 3px solid var(--danger); }
.plan-card { border-left: 3px solid var(--primary); }
.exec-card { border-left: 3px solid #8B5CF6; }
.valid-card { border-left: 3px solid var(--success); }
.agg-card { border-left: 3px solid #EC4899; }

.gscp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.gscp-table td {
    padding: 2px 8px;
    border-bottom: 1px solid var(--border);
}
.gscp-table td:first-child {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.missing-card ul {
    margin: 4px 0 0 16px;
    font-size: 12px;
}
.card pre {
    font-size: 11px;
    max-height: 200px;
    overflow: auto;
    background: var(--surface);
    padding: 8px;
    border-radius: 4px;
}

/* ---------- Pipeline progress bar ---------- */
.pipeline-steps {
    display: flex;
    gap: 2px;
    margin: 6px 0;
    font-size: 11px;
}
.pipeline-step {
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--border);
    color: var(--text-muted);
    font-weight: 500;
}
.pipeline-step.done { background: #D1FAE5; color: #065F46; }
.pipeline-step.active { background: #E0E7FF; color: var(--primary); font-weight: 700; animation: pulse-step 1.5s infinite; }
.pipeline-step.fail { background: #FEE2E2; color: #991B1B; }
@keyframes pulse-step {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ---------- Pipeline result cards ---------- */
.step-list { font-size: 11px; margin: 4px 0; }
.step-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}
.step-status {
    width: 16px; height: 16px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step-status.ok { background: #D1FAE5; color: #065F46; }
.step-status.run { background: #FEF3C7; color: #92400E; }
.step-status.err { background: #FEE2E2; color: #991B1B; }

.score-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    margin: 6px 0;
    overflow: hidden;
}
.score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s;
}
.score-fill.pass { background: var(--success); }
.score-fill.warn { background: var(--warning); }
.score-fill.fail { background: var(--danger); }

/* ---------- Action buttons in messages ---------- */
.action-bar {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.btn-action {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid var(--primary);
    background: var(--surface);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    white-space: nowrap;
}
.btn-action:hover { background: #EEF2FF; }
.btn-action.primary {
    background: var(--primary);
    color: white;
}
.btn-action.primary:hover { background: var(--primary-dark); }


/* Session Footer (user + settings) */
.session-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-top: 1px solid var(--border);
    font-size: 12px; margin-top: auto;
}
.user-display { cursor: default; color: var(--text-muted); }
.settings-icon { cursor: pointer; font-size: 14px; opacity: 0.6; }
.settings-icon:hover { opacity: 1; }

/* Settings Panel */
.settings-panel { max-width: 720px !important; min-height: 420px !important; padding: 0 !important; border-radius: 10px !important; overflow: hidden; }
.settings-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    font-size: 15px; font-weight: 600;
}
.settings-close { cursor: pointer; font-size: 18px; opacity: 0.5; }
.settings-close:hover { opacity: 1; }
.settings-body { display: flex; min-height: 380px; height: 380px; }
.settings-sidebar {
    width: 100px; padding: 12px 0; border-right: 1px solid var(--border);
    background: var(--bg);
}
.settings-tab {
    padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--text-muted);
    border-right: 2px solid transparent; transition: 0.15s;
}
.settings-tab:hover { color: var(--text); background: var(--hover); }
.settings-tab.active { color: var(--primary); border-right-color: var(--primary); background: var(--hover); }
.settings-content { flex: 1; padding: 16px 20px; overflow-y: auto; }
/* 选项按钮不显示对勾 */
.option-btn .check { display: none !important; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content h4 { margin: 12px 0 6px; font-size: 13px; }
.tab-content h4:first-of-type { margin-top: 0; }
.radio-group { display: flex; gap: 12px; margin-bottom: 4px; }
.radio-group label { font-size: 12px; cursor: pointer; }

/* Points Modal */
.points-panel { max-width: 480px !important; padding: 0 !important; border-radius: 10px !important; overflow: hidden; }

/* Transaction list */
.tx-item { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12px; border-bottom: 1px solid var(--border); }
.tx-date { color: var(--text-muted); font-size: 11px; }
.tx-amount { font-weight: 500; }
.tx-amount.negative { color: var(--danger); }
.tx-amount.positive { color: var(--success); }


/* Recharge Panel */
.recharge-panel { max-width: 460px !important; padding: 0 !important; border-radius: 10px !important; overflow: hidden; }
.recharge-plans { display: flex; flex-direction: column; gap: 8px; }
.recharge-plan {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: 0.15s; position: relative;
}
.recharge-plan:hover { border-color: var(--primary); background: var(--hover); }
.recharge-plan.active { border-color: var(--primary); background: rgba(59,130,246,0.08); box-shadow: 0 0 0 1px var(--primary); }
.plan-points { font-size: 14px; font-weight: 600; }
.plan-price { font-size: 13px; color: var(--text-muted); }
.plan-badge {
    position: absolute; right: -4px; top: -6px;
    background: var(--primary); color: #fff; font-size: 10px;
    padding: 1px 6px; border-radius: 8px;
}
.payment-methods { display: flex; gap: 10px; }
.payment-method {
    flex: 1; display: flex; align-items: center; gap: 6px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; font-size: 13px; transition: 0.15s;
}
.payment-method:hover { border-color: var(--primary); }
.payment-method.active { border-color: var(--primary); background: rgba(59,130,246,0.08); }
.pay-icon { font-size: 20px; }
.pay-note { font-size: 10px; color: var(--text-muted); margin-left: auto; }

.thinking-collapse {
    margin: 6px 0;
    font-size: 13px;
}
.thinking-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    padding: 4px 0;
    user-select: none;
}
.thinking-toggle:hover { color: var(--text); }
.thinking-arrow { font-size: 11px; flex-shrink: 0; }
.thinking-body { border-left: 2px solid var(--border); margin: 4px 0 4px 8px; padding-left: 10px; }
.thinking-body .agent-step { font-size: 13px; }

.history-list {
    list-style: none; padding: 0; margin: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.history-list li {
    display: flex;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    gap: 8px;
}
.history-list li:last-child { border-bottom: none; }
.history-list .date { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.history-list .change.negative { color: #dc2626; }
.history-list .change.positive { color: #16a34a; }

/* ---------- Dot pulse animation ---------- */
.dot-pulse {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1.2s infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Task Manager page ---------- */
.tasks-layout {
    display: flex;
    height: calc(100vh - var(--topbar-h));
    padding-bottom: 40px;
    padding-bottom: 40px;
}
.task-list-panel {
    width: 300px;
    min-width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.task-detail-panel {
    flex: 1;
    background: var(--bg);
    overflow-y: auto;
    padding: 16px 20px;
}
.task-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: 0.1s;
}
.task-item:hover { background: var(--bg); }
.task-item.selected { background: #EEF2FF; border-left: 3px solid var(--primary); }
.task-item .task-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.task-item .task-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; }
.task-item .task-intent { font-size: 10px; margin-top: 2px; }

.detail-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.detail-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.detail-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .file-panel { width: 180px; min-width: 160px; }
    .excel-panel { width: 40%; min-width: 300px; }
    .ws-path { max-width: 120px; }
    .msg-user, .msg-bot { max-width: 92%; }
    .task-list-panel { width: 200px; min-width: 160px; }
    .nav-tab span.nav-label { display: none; }
}
@media (max-width: 520px) {
    .file-panel { display: none; }
    .excel-panel { display: none; }
    .task-list-panel { width: 140px; min-width: 120px; }
    .ws-path { max-width: 80px; }
}

/* ============================================================
   TaskTracker 任务清单
   ============================================================ */
.task-tracker {
    flex: none;
    margin: 0 auto;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-width: 1100px;
    width: 1100px;
    box-sizing: border-box;
    font-size: 12px;
    margin-bottom: 4px;
}
.task-tracker-header {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.task-tracker-progress {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}
.task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    transition: opacity 0.3s;
}
.task-check {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: 0.2s;
}
.task-check.completed {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.task-check.executing {
    border-color: var(--primary);
    animation: pulse-dot 1s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}
.task-label {
    color: var(--text);
    font-size: 12px;
    line-height: 1.4;
}
.task-label.completed {
    color: var(--text-muted);
    text-decoration: line-through;
}
.task-done-msg {
    font-size: 12px;
    color: var(--success);
    font-weight: 600;
    margin-top: 4px;
}


/* @ 文件引用菜单 */
.at-menu {
    position: fixed;
    z-index: 9999;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 4px 0;
    min-width: 220px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    font-size: 13px;
}
.at-menu-item {
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    transition: 0.1s;
}
.at-menu-item:hover,
.at-menu-item.selected {
    background: rgba(79,70,229,0.1);
    color: var(--primary);
}
.at-menu-item .file-icon {
    flex-shrink: 0;
}


/* ============================================================
   Session Management (UI v2)
   ============================================================ */
.sidebar-item .more-btn {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0 4px;
    cursor: pointer;
}
.sidebar-item:hover .more-btn { opacity: 1; }

.sidebar-pin-badge {
    font-size: 11px;
    color: #faad14;
    background: rgba(250,173,20,0.1);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}
.session-list .msg-count {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 4px;
}

/* Archived page */
.archived-page .archived-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    flex-wrap: wrap;
}
.archived-page input, .archived-page select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}
.archived-page .archived-summary {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.archived-page .archived-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.archived-page .archived-item:last-child { border-bottom: none; }
.archived-page .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Delete dialog */
.delete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.delete-dialog {
    width: 380px;
    background: var(--surface);
    border-radius: 12px;
    padding: 28px 24px 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    text-align: center;
}
.delete-dialog .icon { font-size: 32px; margin-bottom: 10px; }
.delete-dialog .msg {
    font-size: 15px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 24px;
}
.delete-dialog .actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.delete-dialog .actions .btn-cancel {
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
}
.delete-dialog .actions .btn-danger {
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    background: #f53f3f;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
}


/* 客户端下载提示气泡入场动画（2026-08-13） */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Markdown 渲染（dsh 输出配套，2026-08-30）── */
.markdown-body { line-height: 1.78; word-break: break-word; }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }
.markdown-body p { margin: 8px 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  margin: 12px 0 6px; font-weight: 600; line-height: 1.4; color: var(--text, #1f2937);
}
/* ★ 2026-09-01：正式回复字体大小与风格（S1.0 dsh 平铺无气泡）——
   正文 15px / 行高 1.7 / 正文色；与输出组件 output.js 渲染的 msg-content 结构对齐 */
.msg-bot .msg-content.markdown-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text, #1f2937);
}
.markdown-body h1 { font-size: 1.4em; } .markdown-body h2 { font-size: 1.25em; }
.markdown-body h3 { font-size: 1.1em; } .markdown-body h4 { font-size: 1em; }
.markdown-body ul, .markdown-body ol { margin: 6px 0; padding-left: 22px; }
.markdown-body li { margin: 3px 0; }
.markdown-body strong { font-weight: 600; }
.markdown-body a { color: var(--primary, #2563eb); text-decoration: underline; }
.markdown-body code {
  font-family: Consolas, "Courier New", monospace; font-size: 0.9em;
  background: rgba(127,127,127,.12); padding: 1px 5px; border-radius: 4px;
}
.markdown-body pre {
  background: #f6f8fa; color: #1f2937; border: 1px solid #e5e7eb;
  border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 8px 0;
}
/* ★ 2026-09-07：方案B-代码块跟随主题——浅色=白底深字；深色=深底白字。
   修复：原写法 background: var(--surface-2, #f6f8fa) 中 --surface-2 从未定义，
   深色主题下文字 var(--text) 变白 → 白底白字看不清。 */
html[data-theme="dark"] .markdown-body pre {
  background: #1F2937; color: #F9FAFB; border-color: #374151;
}
.markdown-body pre code { background: none; padding: 0; font-size: 0.88em; color: inherit; }
.markdown-body table {
  border-collapse: collapse; margin: 8px 0; width: 100%;
  font-size: 0.92em; table-layout: auto; width: 100%;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border, #e5e7eb); padding: 6px 10px; text-align: left;
  word-break: break-word; white-space: normal; vertical-align: top;
}
.markdown-body th { background: #f3f4f6; color: #1f2937; font-weight: 600; white-space: nowrap; }
html[data-theme="dark"] .markdown-body th { background: #1f2937; color: #f9fafb; } /* ★ 2026-08-31：深色主题表头强制深底白字（防白底白字看不清） */
.markdown-body tr:nth-child(even) td { background: rgba(127,127,127,.04); }
.markdown-body blockquote {
  border-left: 3px solid var(--border, #d1d5db); margin: 8px 0;
  padding: 2px 12px; color: var(--text-muted, #6b7280);
}
.markdown-body hr { border: none; border-top: 1px solid var(--border, #e5e7eb); margin: 10px 0; }
.markdown-body img { max-width: 100%; border-radius: 6px; }

/* ── 字体统一（2026-08-31）：会话列表/用户消息/文件面板/功能按钮 与智能体回复一致 ── */
.session-panel, .session-item, .session-title, .session-sub, .session-tt, .session-pid, .session-time,
.msg-user, .msg-user .msg-text, .msg-bot, .msg-bot .msg-text, .msg-bot .markdown-body,
.chat-input-inner, .chat-input-inner button, .tool-btn, .chatbar-tools {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}
/* ★ 2026-08-31：会话列表与 Workspace Files 一致（以文件面板为准）——主体 12px，辅助 10px */
.session-panel, .session-item, .session-title, .session-sub, .session-tt { font-size: 12px; }
.session-pid, .session-time, .session-sub { font-size: 10px; }
/* 用户消息操作栏：默认隐藏，hover 显示（2026-08-31） */
.msg-user .msg-actions-bar { opacity: 0; transition: opacity .15s; }
.msg-user:hover .msg-actions-bar { opacity: 1; }
/* 会话任务类型标签 + 项目号 */
.session-title-row { display: flex; align-items: center; min-width: 0; }
.session-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-tt {
  display: inline-block; font-size: 11px; line-height: 1; padding: 2px 5px;
  border-radius: 4px; margin-right: 6px; flex-shrink: 0;
}
.session-tt-general { background: #e6f6ec; color: #0a7d3c; }
.session-tt-dev { background: #eef2ff; color: #4f46e5; }
.session-sub { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.session-pid { font-size: 11px; color: var(--text-muted, #6b7280); }

/* ★ 2026-09-04（DM 推广）：Workspace Files 组件化滚动（filePanelHost 高度链 + 显式兜底） */
.file-panel-right { display: flex; flex-direction: column; }
.file-panel-right.collapsed { display: flex; }
#filePanelHost { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#filePanelHost .file-list,
.file-panel-right .file-list {
  flex: 1 1 auto;
  max-height: calc(100vh - var(--topbar-h, 48px) - 130px);
  overflow-y: auto;
  min-height: 0;
}
