/* 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: min(520px, 100%);
    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%;
}
/* ★ 2026-09-29：助手回复末尾的时间（便于用户报障时对时间、在操作审计里定位） */
.dm-msg-time {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
    opacity: .75;
    user-select: text;
}
/* 回复操作栏（复制/点赞/分叉，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: min(500px, 100%);
    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; }

  /* ★ 2026-09-25：老浏览器不支持 min() 时的兜底（移动端不撑宽） */
  #univerContainer { min-width: 0 !important; }
  .edit-msg-textarea { width: 100% !important; }
}

/* ============================================================
   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: min(520px, 100%);
    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: min(500px, 100%);
    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; }

  /* ★ 2026-09-25：老浏览器不支持 min() 时的兜底（移动端不撑宽） */
  #univerContainer { min-width: 0 !important; }
  .edit-msg-textarea { width: 100% !important; }
}

/* ============================================================
   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;
}


/* ═══════════════════════════════════════════════════════════════════
   ★ 2026-09-26 mobile-view：移动端视图切换（左上角 ☰ 下拉）
   设计：<768px 时三栏 → 单栏，通过 ☰ 下拉切换 工作区/对话/文件。
        桌面端（≥769px）完全不受影响。
   回退：删除本整块即可。
   ═══════════════════════════════════════════════════════════════════ */

/* 桌面端：☰ 按钮与下拉都不出现 */
@media (min-width: 769px) {
  .mobile-view-menu,
  .mobile-view-dropdown { display: none !important; }
}

/* 默认（桌面）：☰ 隐藏 */
.mobile-view-menu { display: none; }
.mobile-view-dropdown { display: none; }

@media (max-width: 768px) {

  /* 1) 左上角 ☰ 按钮 */
  .mobile-view-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 30px;
    margin-right: 2px;
    font-size: 17px; line-height: 1;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
  }
  .mobile-view-menu:active { background: var(--bg); }

  /* 2) 主容器改单栏（原为 flex 三栏） */
  /* P3：原 display:block 导致 .chat-scroll 的 flex:1 失效（无法滚动）—— 见文末 P3 块 */

  /* 3) 三个面板 → 全宽绝对层，默认隐藏 */
  #sessionPanel.session-panel,
  #filePanelHost,
  .file-panel,
  .excel-panel {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    z-index: 10;
    display: none;
  }

  /* 4) 激活的视图显示（内部保持可滚动） */
  .mobile-view-active {
    display: flex !important;
    flex-direction: column;
    overflow-y: auto;
  }

  /* 5) 对话区默认可见，全宽 */
  .chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .chat-input-inner { width: 100% !important; max-width: 100% !important; }

  /* 6) ☰ 下拉菜单 */
  .mobile-view-dropdown.open { display: block; }
  .mobile-view-dropdown {
    position: fixed;
    left: 8px;
    top: calc(var(--topbar-h, 48px) + 4px);
    min-width: 170px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    z-index: 400;
    overflow: hidden;
  }
  .mobile-view-dropdown .item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    min-height: 44px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
  }
  .mobile-view-dropdown .item:active { background: var(--bg); }
  .mobile-view-dropdown .item.active { color: var(--accent); font-weight: 600; }
  .mobile-view-dropdown .sep { height: 1px; background: var(--border); margin: 4px 0; }
  .mobile-view-dropdown .grp {
    padding: 8px 14px 2px; font-size: 11px;
    color: var(--text-muted); letter-spacing: .04em;
  }

  /* 7) 工具栏收纳：低频项在移动端隐藏（新家 = ☰ 菜单里的代理项） */
  #modelTrigger,
  #saveTemplateBtn,
  #fastToggle { display: none !important; }

  /* 8) 顶栏去重：+ Upload 与工具栏 + 重复 */
  #btnToggleUpload { display: none !important; }

  /* ★ 2026-09-26 P2：手机端隐藏"电脑专用"功能（用户确认清单）
     · 审计：含导出/归档/purge 等管理操作，小屏易误触
     · 工作区打包/根目录设置：桌面运维操作
     · + 开发任务：代码开发不适合手机
     ★ 2026-09-28：#btnPackWs 已**移出**本清单 —— 用户反馈"手机端文件下载/批量下载按钮
       不见了，云端文件没办法取走"。下载是取走产物的唯一出口，手机端必须保留。 */
  #btnAudit,
  #dmWsRootSave,
  #dmWsRootReset,
  #btnNewProject,
  /* ★ 2026-09-26 P13：工单按钮移入 ☰ 菜单（低频；底栏只留下载/审批/发送更清爽） */
  #helpBtn,
  /* ★ 2026-09-27（用户反馈"手机端权限出现了 2 个"）：权限按钮在**手机端只在 ☰ 菜单里**
     （与 #permMenuItem 完全同状态，底栏那个是重复入口）；**桌面端保留底栏入口**，更顺手。 */
  #permBtnLower { display: none !important; }




  /* 9) 触控友好 */
  .tool-btn { min-height: 34px; }
  .session-item, .file-item { min-height: 44px; }
  .msg-user, .msg-bot { max-width: 92% !important; }
}

/* ===== ★ 2026-09-26 P3 ===== */
@media (max-width: 768px) {

  /* ═══════════════════════════════════════════════════════════════════
     ★ 2026-09-26 P3：修复 8 个移动端问题（7 项；#6 极简保持现状）
     ═══════════════════════════════════════════════════════════════════ */

  /* #1 输入时页面横向溢出：锁住横向滚动 + 输入元素 16px（防 iOS 自动缩放） */
  html, body { overflow-x: hidden !important; max-width: 100% !important; }
  textarea, input, select { font-size: 16px !important; }
  .chat-input-inner { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }

  /* #2 字号提升（对齐 WorkBuddy 的移动端可读性） */
  body { font-size: 15px; }
  .msg-user, .msg-bot { font-size: 15px; line-height: 1.7; }
  .session-item { font-size: 14px; }
  .tool-btn { font-size: 13px; }

  /* #3 顶栏精简：隐藏 Tasks / Files 计数 / 用户名 */
  #navTabs,
  .nav-sep,
  .topbar-label,
  #fileCount,
  .file-count,
  .user-label { display: none !important; }

  /* #4 ★ 修 P1 引入的滚动失效：必须用 flex-column 让 .chat-scroll 的 flex:1 生效 */
  .main-layout {
    display: flex !important;
    flex-direction: column !important;
    position: relative;
    height: calc(100vh - var(--topbar-h, 48px) - 34px) !important;
    height: calc(100dvh - var(--topbar-h, 48px) - 34px) !important;
    padding-bottom: 0 !important;
    overflow: hidden;
  }
  .chat-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* #5 设置弹窗：Tab 改横向滚动（内容在下） */
  #settingsModalInner { width: 100% !important; max-width: 96vw !important; }
  #settingsModalInner .modal-body { flex-direction: column !important; }
  .set-tabs,
  #settingsModalInner .modal-tabs {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    width: 100% !important;
    padding-bottom: 2px;
  }
  .set-tabs > * { flex: 0 0 auto !important; }
  #settingsModalInner .set-content { width: 100% !important; }

  /* #8 输入框固定在底部 */
  .chat-input-inner {
    flex-shrink: 0 !important;
    margin-top: auto !important;
    position: sticky;
    bottom: 0;
    background: var(--bg);
    z-index: 5;
  }
}

/* ===== ★ 2026-09-26 P4 ===== */
@media (max-width: 768px) {

  /* ★ 2026-09-26 P4：额度明细行改两行布局（小屏可读，用户反馈"显示不全"） */
  .points-panel,
  #pointsModal .modal-content { max-width: 96vw !important; }
  #pointsTransactionList,
  #pointsTransactionList2,
  .history-list { width: 100% !important; box-sizing: border-box; }

  .history-list { list-style: none; padding: 0; margin: 0; }
  .history-list li {
    display: grid !important;
    grid-template-columns: 1fr auto !important;   /* 左：描述  右：金额 */
    grid-template-areas: "desc amount" "date balance";
    gap: 2px 10px;
    padding: 10px 12px !important;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    width: 100% !important;
    box-sizing: border-box;
  }
  .history-list li > .date    { grid-area: date;    font-size: 11px; color: var(--text-muted); }
  .history-list li > .change  { grid-area: amount;  font-weight: 600; text-align: right; white-space: nowrap; }
  .history-list li > span:nth-child(2) { grid-area: desc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .history-list li > span:nth-child(4) { grid-area: balance; font-size: 11px; color: var(--text-muted); text-align: right; }

  /* ★ 2026-09-26 P4：#2b 开发者工具的配置条两个分区强制等宽 */
  .dt-scope-head,
  [data-scope-body],
  .dt-scope-body { width: 100% !important; box-sizing: border-box; }
}

/* ===== ★ 2026-09-26 P5 ===== */
@media (max-width: 768px) {

  /* ★ 2026-09-26 P5：#4 底栏只保留「额度余额」与「本次消费」 */
  #roundCount, #sessionCost, #sessionCostSep { display: none !important; }
  /* 兜底：按所属 span 隐藏 */
  #bottomBar > span:nth-child(5),
  #bottomBar > span:nth-child(6),
  #bottomBar > span:nth-child(7) { display: none !important; }
  .dm-hide-mobile { display: none !important; }
}

.dm-hide-mobile { display: none !important; }

/* ===== ★ 2026-09-26 P6 对话区滚动增强 ===== */
@media (max-width: 768px) {
  /* 让 touch 滚动在 iOS 上稳定生效 */
  .chat-scroll {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
  }
  .chat-messages { touch-action: pan-y !important; }
  /* 防止某些内联 overflow:hidden 阻断（仅作用于消息区祖先） */
  .main-layout { overscroll-behavior: contain; }
}

/* ═══════════════════════════════════════════════════════════════════
   ★ 2026-09-26 P7：修「手机端对话区不能滚动」——真根因
   真根因（Chromium 真机视口 390x844 实测）：P3 把 .main-layout 改成
   flex-column 后，.chat-panel 作为 flex item 的 min-height 仍是 auto
   ⇒ 被内容（.chat-scroll）撑开 ⇒ .chat-scroll 的
   clientHeight == scrollHeight（实测 20932px）⇒ scrollTop 恒为 0
   ⇒ 手指滑动、自动滚到底（scrollChat）全部失效，新消息落在可视区之外
   （用户描述："显示了一下就没了"）。桌面端是 flex-row，纵轴不是主轴，
   所以一直没暴露。
   修法：整条 flex 链上的高度必须可收缩（min-height:0 + overflow:hidden）。
   回退：删除本块即退回"不能滚动"。
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .main-layout { display: flex !important; flex-direction: column !important; }
  .main-layout > .chat-panel {
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .chat-panel > .chat-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .chat-scroll > .chat-messages { flex: 0 0 auto; min-height: 0; }
  /* iPhone home bar 安全区：否则最后一行被系统横条遮住 */
  .chat-input-inner { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}

/* ═══════════════════════════════════════════════════════════════════
   ★ 2026-09-26 P17-a：设置面板「内容区」窄屏改**上下堆叠**
   问题（手机 390px 实测）：面板仅 374px，而内容区沿用桌面布局
   （`.set-group{display:flex}` + `.set-col{width:250px;flex-shrink:0}`）
   ⇒ 左侧标签列霸占 250px，右侧控件区只剩 **132px**，主题卡片/字号按钮
   **有一部分被挤出屏幕外**，预览框被挤成 137×218 的细长条。
   （P3 当时只把设置「Tab 栏」改成了横滚，没动内容区 —— 本次补上。）
   修法：窄屏下标签在上、控件在下、都占满宽度（无需横向滚动，零手势冲突）。
   回退：删除本块。
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #settingsModalInner .set-group {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 16px 0 !important;
  }
  #settingsModalInner .set-col {
    width: 100% !important;
    flex-shrink: 1 !important;
  }
  #settingsModalInner .set-ctrl { width: 100% !important; }
  #settingsModalInner .option-group { width: 100% !important; }
  /* 主题三卡片等分一行（3 × ~115px 可放下，不再溢出屏幕） */
  #settingsModalInner .theme-cards .theme-option {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 14px 6px !important;
  }
  /* 预览框占满宽度（不再被挤成细条） */
  #settingsModalInner .set-preview {
    flex: 1 1 auto !important;
    width: 100% !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   ★ 2026-09-26 P17-b：**全局隐藏「交互」设置 tab**（用户决定，含电脑云端与客户端）
   背景：该页两项设置（「显示思考过程」＝默认开、「文件预览方式」＝侧边栏预览）
   用户反馈"完全用不到"。隐藏后两项保持默认值运行，界面少一个 tab。
   ⚠️ 代价（用户已知情）：无法再手动关闭"显示思考过程"。
   ⚠️ 只隐藏入口、**保留 DOM 与逻辑** ⇒ 将来要恢复只需删掉这两条规则。
   ═══════════════════════════════════════════════════════════════════ */
/* ⚠️ 必须带 `#settingsModalInner` 提高特异性：index.html 内联 <style> 里的
   `.modal-tabs .tab-item`（0,2,0）与本规则同级，但它在 <link> 之后 ⇒ 同权时后者胜。
   加上 id 后为 (1,2,0)，稳定胜出。 */
#settingsModalInner .tab-item[data-tab="interaction"] { display: none !important; }
#settingsModalInner #panelInteraction { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════
   ★ 2026-09-26 P18：空会话「首屏引导」样式（学 WorkBuddy 的"我能帮你做什么"）
   · 无图标（用户要求：emoji 太花哨）⇒ 只有文字胶囊
   · 每屏 4 条；「换一换」重随机；「查看更多能力」展开全部 30 条
   · 只在空会话显示；一旦有消息就移除（由 app.js 的 MutationObserver 控制）
   ═══════════════════════════════════════════════════════════════════ */
.dm-welcome { padding: 28px 4px 10px; max-width: 640px; }
.dm-welcome-head { text-align: center; margin-bottom: 16px; }
.dm-welcome-title { font-size: 22px; font-weight: 700; }
.dm-welcome-sub { font-size: 15px; font-weight: 600; margin-top: 6px; color: var(--text); }
.dm-welcome-note { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }
.dm-welcome-list { display: flex; flex-direction: column; gap: 8px; }
.dm-chip {
  text-align: left; padding: 11px 14px; font-size: 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s;
  font-family: inherit;
}
.dm-chip:hover { border-color: var(--primary); background: var(--hover); }
.dm-chip-more { color: var(--text-muted); }
.dm-welcome-foot { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.dm-respin {
  padding: 8px 14px; font-size: 13px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); border-radius: 18px; cursor: pointer;
  font-family: inherit;
}
.dm-respin:hover { color: var(--primary); border-color: var(--primary); }
@media (max-width: 768px) {
  .dm-welcome { padding: 18px 2px 8px; }
  .dm-welcome-title { font-size: 20px; }
  .dm-chip { padding: 13px 14px; font-size: 14.5px; }   /* 触控友好 */
}

/* ★ 2026-10-16：以下样式**只作用于 md 文件预览弹窗（#mdPreview）**，刻意不用 `.markdown-body` 选择器 ——
   因为聊天消息也用 `.markdown-body`，用户明确要求「聊天区格式保持原样、完全不要动」。
   原 .markdown-body 里本来就没有 table / task-list 规则，所以这里凭空新增的部分更不能外溢到聊天区。 */
#mdPreview table { border-collapse: collapse; margin: 10px 0; display: block; max-width: 100%; overflow-x: auto; }
#mdPreview table th, #mdPreview table td {
  border: 1px solid var(--border, #d0d7de); padding: 6px 12px; text-align: left; vertical-align: top;
}
#mdPreview table th { background: rgba(127,127,127,.10); font-weight: 600; }
#mdPreview table tr:nth-child(2n) { background: rgba(127,127,127,.04); }
/* task list（- [ ] 复选框；markdown-it-task-lists 输出 .task-list-item / .contains-task-list） */
#mdPreview ul.contains-task-list, #mdPreview ol.contains-task-list { padding-left: 4px; }
#mdPreview li.task-list-item { list-style: none; }
#mdPreview li.task-list-item input[type="checkbox"] { margin: 0 6px 0 0; vertical-align: middle; }
/* 代码块：配色交给 highlight.js 的主题 CSS（github 浅色，其选择器是 `pre code.hljs`），
   这里只让内层 code 背景透明（好露出 .markdown-body pre 的底色）并保证横向滚动 */
#mdPreview pre code.hljs { background: transparent; display: block; overflow-x: auto; }
#mdPreview hr { border: none; border-top: 1px solid var(--border, #e5e7eb); margin: 14px 0; }
#mdPreview img { max-width: 100%; }
#mdPreview blockquote {
  margin: 8px 0; padding: 4px 12px; color: var(--text-muted, #6b7280);
  border-left: 3px solid var(--border, #e5e7eb); background: rgba(127,127,127,.05);
}
