/* ============================================
/* 左侧文件树侧边栏主规则 */
.ide-sidebar {
  position: relative;
  width: 320px;
  min-width: 320px;
  max-width: 560px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow: hidden;
  flex-shrink: 0;
}
   /* 超智能体3.0(superEntity3.0) - 深色科技风主题
   ============================================ */

/* ===== CSS 变量 ===== */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #1e1e36;
  --bg-hover: #2a2a4a;
  --bg-input: #16162a;
  
  --text-primary: #e8e8f0;
  --text-secondary: #9a9ab0;
  --text-muted: #5a5a7a;
  
  --accent-primary: #6c63ff;
  --accent-secondary: #4855cc;
  --accent-glow: rgba(108, 99, 255, 0.3);
  --accent-gradient: linear-gradient(135deg, #6c63ff, #4855cc);
  
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255,255,255,0.05);
  
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px var(--accent-glow);
  
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ===== 亮色主题（浅色） ===== */
[data-theme="light"] {
  --bg-primary: #f5f5f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #e8e8f0;
  --bg-input: #f0f0f5;
  
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a7a;
  --text-muted: #9a9ab0;
  
  --accent-primary: #6c63ff;
  --accent-secondary: #4855cc;
  --accent-glow: rgba(108, 99, 255, 0.15);
  --accent-gradient: linear-gradient(135deg, #6c63ff, #4855cc);
  
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --info: #2563eb;
  
  --border-color: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0,0,0,0.05);
  
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 30px var(--accent-glow);
}

[data-theme="light"] .sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
}

[data-theme="light"] .sidebar-toggle {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

[data-theme="light"] .chat-sidebar {
  background: #fafafa;
  border-right: 1px solid var(--border-color);
}

[data-theme="light"] .message.assistant .message-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .message.user .message-content {
  background: var(--accent-primary);
  color: #fff;
}

[data-theme="light"] .chat-input-wrapper {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

[data-theme="light"] .chat-input-area textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

[data-theme="light"] .code-header {
  background: #e8e8f0;
  color: var(--text-secondary);
}

[data-theme="light"] pre {
  background: #f8f8fc !important;
  border: 1px solid var(--border-color);
}

[data-theme="light"] pre code {
  color: #1a1a2e !important;
}

[data-theme="light"] .modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

[data-theme="light"] .conversation-item {
  border-bottom: 1px solid var(--border-light);
}

[data-theme="light"] .conversation-item.active {
  background: var(--accent-primary);
  color: #fff;
}

[data-theme="light"] .sidebar-footer {
  border-top: 1px solid var(--border-color);
}

[data-theme="light"] .user-dropdown {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

[data-theme="light"] .dropdown-item:hover {
  background: var(--bg-hover);
}

[data-theme="light"] .nav-item:hover {
  background: var(--bg-hover);
}

[data-theme="light"] .nav-item.active {
  background: rgba(108, 99, 255, 0.1);
  color: var(--accent-primary);
}

[data-theme="light"] .conversation-item:hover {
  background: var(--bg-hover);
}

[data-theme="light"] .typing-dot {
  background: var(--text-muted);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
}


.sidebar-tts-toggle {
  padding: 4px 16px;
  display: flex;
  align-items: center;
}

.tts-btn {
  width: 100%;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.tts-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tts-btn.active {
  background: rgba(74, 222, 128, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.tts-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  font-size: 14px;
}

.tts-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tts-toggle-btn.active {
  color: var(--success);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.25);
}

/* ===== 主题切换按钮 ===== */
.sidebar-theme-toggle {
  padding: 4px 16px;
  display: flex;
  align-items: center;
}

.theme-btn {
  width: 100%;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.theme-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== 应用布局 ===== */
#app-root {
  display: flex;
  height: 100vh;
}

/* ===== 侧边栏折叠 ===== */
.sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden;
  padding: 0;
  border-right: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* 展开按钮——独立定位，始终可见 */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  width: 28px;
  height: 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  box-shadow: 2px 0 8px rgba(0,0,0,0.2);
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* 折叠状态：展开按钮贴左边缘 */
.sidebar.collapsed + .sidebar-toggle {
  left: 0;
  border-radius: 0 8px 8px 0;
}

/* 展开状态：折叠按钮贴侧边栏右边缘 */
.sidebar:not(.collapsed) + .sidebar-toggle {
  left: var(--sidebar-width);
  margin-left: -14px;
}


/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .logo {
  width: 42px;
  height: 42px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.sidebar-brand .brand-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand .brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ===== 导航 ===== */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent-primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-primary);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 24px;
  text-align: center;
  font-size: 16px;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* ===== 底部用户 ===== */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding: 12px 16px;
  position: relative;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.sidebar-user:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.user-arrow {
  transition: transform 0.3s;
  color: var(--text-muted);
}

.user-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  z-index: 100;
  overflow: hidden;
}

.user-dropdown.show {
  display: block;
}

.dropdown-item {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); }
.status-dot.offline { background: var(--error); }
.status-dot.busy { background: var(--warning); animation: pulse 1.5s infinite; }

@keyframes pulse { 
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== 主内容 ===== */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg-primary);
}

.page {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* ===== 页面头部 ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h1 i {
  color: var(--accent-primary);
}

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

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.15);
}

.btn-primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 15px rgba(231,76,60,0.3);
  animation: stopPulse 1.5s ease-in-out infinite;
}

.btn-danger:hover {
  box-shadow: 0 6px 25px rgba(231,76,60,0.5);
  transform: translateY(-1px);
}

@keyframes stopPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(231,76,60,0.3); }
  50% { box-shadow: 0 4px 25px rgba(231,76,60,0.6); }
}

/* 深度思考切换 */
.deep-think-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  user-select: none;
  white-space: nowrap;
}

.deep-think-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.deep-think-toggle input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.deep-think-toggle .toggle-label {
  line-height: 1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ===== 加载动画 ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 400px;
}

/* ★★ 2026-08-10 新增：上次任务中断提示条 ★★ */
.interrupted-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 193, 7, 0.08);
  border: 1px solid rgba(255, 193, 7, 0.35);
  color: var(--text-primary);
  font-size: 13px;
  animation: slideIn 0.3s ease;
}
.interrupted-banner-icon {
  font-size: 20px;
  line-height: 1.3;
}
.interrupted-banner-text {
  flex: 1;
}
.interrupted-banner-title {
  font-weight: 600;
  color: #e6a817;
  margin-bottom: 4px;
}
.interrupted-banner-desc {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
  word-break: break-all;
}
.interrupted-banner-actions {
  display: flex;
  gap: 8px;
}
.interrupted-retry-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  background: linear-gradient(135deg, #f6a821, #e08e0b);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.interrupted-retry-btn:hover {
  opacity: 0.85;
}
.interrupted-dismiss-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.interrupted-dismiss-btn:hover {
  background: var(--bg-hover);
}

.toast.success { background: rgba(74, 222, 128, 0.15); border: 1px solid rgba(74, 222, 128, 0.3); color: var(--success); }
.toast.error { background: rgba(248, 113, 113, 0.15); border: 1px solid rgba(248, 113, 113, 0.3); color: var(--error); }
.toast.info { background: rgba(96, 165, 250, 0.15); border: 1px solid rgba(96, 165, 250, 0.3); color: var(--info); }
.toast.warning { background: rgba(251, 191, 36, 0.15); border: 1px solid rgba(251, 191, 36, 0.3); color: var(--warning); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   聊天界面
   ============================================ */
.chat-layout {
  display: flex;
  height: 100%;
  gap: 0;
  flex: 1;
}

.chat-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  display: flex;
  flex-direction: column;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-color);
}

.chat-sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.conversation-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.conversation-item.active {
  background: rgba(108, 99, 255, 0.12);
  color: var(--accent-primary);
}


/* ★ 2026-08-13 会话相对时间（时钟）——用主题变量自适应，暗色/亮色下均融入背景 */
.conversation-item .conv-time {
  font-size: 10px;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
  opacity: 0.85;
  transition: color 0.2s;
}
/* 暗色主题（默认）下时钟颜色融入深色背景（弱化亮度，避免突兀亮点） */
[data-theme="dark"] .conv-time {
  color: var(--text-muted);
  opacity: 0.9;
}
/* 暗色主题下 hover/选中时提亮，保持可读性 */
[data-theme="dark"] .conversation-item:hover .conv-time,
[data-theme="dark"] .conversation-item.active .conv-time {
  color: var(--text-secondary);
  opacity: 1;
}
.conversation-item:hover .conv-time,
.conversation-item.active .conv-time {
  color: var(--text-secondary);
}

.chat-sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

/* ===== 聊天主区域 ===== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeInUp 0.3s ease;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.message-avatar.user {
  background: var(--accent-gradient);
  color: #fff;
}

.message-avatar.assistant {
  background: linear-gradient(135deg, #4ade80, #22d3ee);
  color: #fff;
}

.message-avatar.system {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
}

.message-content {
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  min-width: 0;
}

.message.user .message-content {
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.2);
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.message.user .message-sender {
  color: var(--accent-primary);
}

.message-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  word-wrap: break-word;
}

.message-text p { margin-bottom: 8px; }
.message-text p:last-child { margin-bottom: 0; }

.message-text h1, .message-text h2, .message-text h3, .message-text h4, .message-text h5, .message-text h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: var(--accent-primary);
  line-height: 1.3;
}
.message-text h1 { font-size: 22px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.message-text h2 { font-size: 18px; border-bottom: 1px solid var(--border-color); padding-bottom: 4px; }

/* ===== 流式消息占位符 ===== */
.streaming-placeholder {
  color: #999;
  font-style: italic;
  animation: thinkingPulse 1.5s ease-in-out infinite;
}
@keyframes thinkingPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.message-text h3 { font-size: 16px; }
.message-text h4 { font-size: 15px; }
.message-text h5, .message-text h6 { font-size: 14px; }
.message-text hr { border: none; border-top: 1px solid var(--border-color); margin: 12px 0; }
.message-text blockquote {
  border-left: 3px solid var(--accent-primary);
  margin: 8px 0;
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.message-text a { color: var(--accent-primary); text-decoration: none; }
.message-text a:hover { text-decoration: underline; }
.message-text img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }

.message-text ul, .message-text ol {
  padding-left: 20px;
  margin: 8px 0;
}

.message-text li {
  margin-bottom: 4px;
}

.message-text code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.message-text pre {
  background: rgba(0,0,0,0.3);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--border-color);
}

.message-text pre code {
  background: none;
  padding: 0;
}

.message-text strong {
  color: var(--accent-primary);
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== 欢迎消息 ===== */
.welcome-msg {
  max-width: 100% !important;
}

.welcome-msg .message-content {
  background: linear-gradient(135deg, rgba(108,99,255,0.08), rgba(74,222,128,0.05));
  border: 1px solid rgba(108,99,255,0.15);
}

/* ===== 输入区 ===== */
.chat-input-area {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: relative;
}

/* ★ 规划面板（折叠在输入框上方） */
#plan-task-panel-top {
  margin-bottom: 10px;
}
#plan-task-panel-top .plan-task-body {
  padding: 10px 14px;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 4px 4px 8px;
  transition: border-color 0.3s;
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(108, 99, 255, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  padding: 8px 8px;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 120px;
  line-height: 1.5;
  min-height: 20px;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

/* ★ 附件按钮（左侧） */
/* ★ 麦克风语音输入按钮 */
.chat-mic-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  transition: all 0.3s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  position: relative;
}
.chat-mic-btn:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
}
.chat-mic-btn.recording {
  color: #ff4757;
  background: rgba(255, 71, 87, 0.12);
  animation: mic-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4);
}
.chat-mic-btn.recording:hover {
  background: rgba(255, 71, 87, 0.2);
}
@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}
/* 录音波动画波纹（麦克风周围扩散圈） */
.chat-mic-btn .mic-ripple {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #ff4757;
  animation: mic-ripple-effect 1.5s ease-out infinite;
  opacity: 0;
  pointer-events: none;
}
.chat-mic-btn .mic-ripple:nth-child(2) {
  animation-delay: 0.5s;
}
.chat-mic-btn .mic-ripple:nth-child(3) {
  animation-delay: 1s;
}
@keyframes mic-ripple-effect {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}
/* 语音识别状态Toast */
.voice-status-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  backdrop-filter: blur(10px);
  font-size: 14px;
}
.voice-status-toast .voice-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4757;
  animation: mic-pulse 1s ease-in-out infinite;
}
.voice-status-toast .voice-status-text {
  color: var(--text-primary);
}
.voice-status-toast .voice-status-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}
.voice-status-toast .voice-status-wave span {
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent-primary);
  border-radius: 2px;
  animation: voice-wave 1.2s ease-in-out infinite;
}
.voice-status-toast .voice-status-wave span:nth-child(2) { animation-delay: 0.2s; height: 16px; }
.voice-status-toast .voice-status-wave span:nth-child(3) { animation-delay: 0.4s; height: 20px; }
.voice-status-toast .voice-status-wave span:nth-child(4) { animation-delay: 0.6s; height: 14px; }
.voice-status-toast .voice-status-wave span:nth-child(5) { animation-delay: 0.8s; height: 10px; }
@keyframes voice-wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* ★ TTS播报状态指示器 */
.tts-speaking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent-primary);
  margin-left: 8px;
}
.tts-speaking-indicator .tts-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: tts-dot-bounce 1s ease-in-out infinite;
}
.tts-speaking-indicator .tts-dot:nth-child(2) { animation-delay: 0.2s; }
.tts-speaking-indicator .tts-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes tts-dot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ★ 打字光标动画 */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--accent-primary);
  margin-left: 2px;
  animation: blink-cursor 0.8s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.chat-attach-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-muted);
  transition: all 0.2s;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.chat-attach-btn:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
}

/* ★ 清空按钮 */
.chat-clear-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.chat-clear-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ★ 发送按钮（右侧） */
.chat-send-btn {
  flex-shrink: 0;
  height: 34px;
  min-width: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 15px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.chat-send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}
.chat-send-btn:active {
  transform: scale(0.95);
}

/* ★ 停止按钮 */
.chat-stop-btn {
  flex-shrink: 0;
  height: 34px;
  min-width: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 15px;
  background: var(--danger);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.chat-stop-btn:hover {
  background: var(--danger-hover);
}

.chat-actions {

.chat-actions-btn {
  color: var(--accent-primary);
}
.chat-actions-btn:hover {
  color: var(--accent-hover);
}
.chat-actions-text {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  white-space: nowrap;
}
.chat-actions-text:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 12px;
}

.chat-status {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status.typing::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: pulse 1.2s infinite;
}

/* ============================================
   工具管理页
   ============================================ */
.tools-filter {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  flex: 1;
  max-width: 400px;
}

.search-box i {
  color: var(--text-muted);
  font-size: 14px;
}

.search-box input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.filter-tab:hover {
  background: var(--bg-hover);
}

.filter-tab.active {
  background: var(--accent-primary);
  color: #fff;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.tool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tool-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.tool-card-category {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(108, 99, 255, 0.12);
  color: var(--accent-primary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tool-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.tool-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 模态框覆盖层 - 使用class控制显示隐藏，避免[style*="display"]选择器冲突 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modal-overlay.modal-hidden {
  display: none !important;
}
/* 模态弹窗 */

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.2s ease;
}

.modal-sm {
  width: 440px;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-color);
}

.result-pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  overflow: auto;
  max-height: 400px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.config-pre {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ===== 系统监控 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

#stat-health .stat-icon { background: rgba(74, 222, 128, 0.12); color: var(--success); }
#stat-tools .stat-icon { background: rgba(108, 99, 255, 0.12); color: var(--accent-primary); }
#stat-memory .stat-icon { background: rgba(96, 165, 250, 0.12); color: var(--info); }
#stat-version .stat-icon { background: rgba(251, 191, 36, 0.12); color: var(--warning); }

.stat-info .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-info .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.info-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 200px;
}

.info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.panel-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

/* ===== 自我进化 ===== */
.evolution-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}

.evolution-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.card-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.card-body {
  padding: 16px 20px;
  flex: 1;
  overflow-y: auto;
}

.derive-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  margin-bottom: 12px;
  min-height: 80px;
  transition: border-color 0.3s;
}

.derive-input:focus {
  border-color: var(--accent-primary);
}

.derive-params {
  margin-bottom: 12px;
}

.param-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.param-row label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 100px;
}

.param-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.3s;
}

.param-input:focus {
  border-color: var(--accent-primary);
}

.num-input {
  width: 60px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
  padding: 4px 8px;
  outline: none;
  text-align: center;
}

.derive-result {
  margin-top: 16px;
  padding: 14px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}

/* ===== 任务管理 ===== */
.task-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.task-input-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  flex-shrink: 0;
}

.task-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  margin-bottom: 12px;
  min-height: 80px;
  transition: border-color 0.3s;
}

.task-input:focus {
  border-color: var(--accent-primary);
}

.task-options {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.task-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.task-options input[type="checkbox"] {
  accent-color: var(--accent-primary);
}

.task-result {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.task-result h3 {
  font-size: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ★ 任务执行进度条 */
.task-progress {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  flex-shrink: 0;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.task-progress-header .task-progress-pct {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent-primary);
  font-variant-numeric: tabular-nums;
}

.task-progress-bar-track {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.task-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #a29bfe);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.task-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: progressShine 1.5s infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.task-progress-step {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .evolution-container {
    grid-template-columns: 1fr;
  }
  .info-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .stat-card {
    padding: 10px;
  }
  .stat-value {
    font-size: 14px;
  }
  .stat-label {
    font-size: 11px;
  }
  .stat-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
  }
  
  .info-panels {
    grid-template-columns: 1fr !important;
  }
  
  .tools-grid {
    grid-template-columns: 1fr !important;
  }
  
  .evolution-container {
    grid-template-columns: 1fr !important;
  }
  .sidebar {
    width: 60px;
    min-width: 60px;
  }
  .sidebar-brand .brand-text,
  .nav-item span:not(.nav-icon),
  .sidebar-user .user-info,
  .sidebar-user .user-arrow,
  .sidebar-status {
    display: none;
  }
  .sidebar-brand {
    padding: 16px 10px;
    justify-content: center;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  /* ★ 2026-08-10 修复：手机端不再隐藏会话列表，改为抽屉式（用户无法切换历史会话的问题） */
  .chat-sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 85vw;
    height: 100vh;
    z-index: 1002;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
    transition: left 0.3s ease;
    background: var(--bg-secondary);
  }
  .chat-sidebar.open {
    left: 0;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .page {
    padding: 16px;
  }
}

/* ===== 打字光标动画 ===== */
.typing-cursor::after {
  content: '▌';
  animation: blink 0.8s infinite;
  color: var(--accent-primary);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== 表单组 ===== */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ===== 模型选择器 ===== */
.model-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}
.model-selector i { color: var(--accent-primary); font-size: 14px; }
.model-selector select {
  background: transparent; border: none; color: var(--text-primary);
  font-size: 12px; cursor: pointer; outline: none; padding: 2px 4px; min-width: 110px;
}
.model-selector select option { background: var(--bg-card); color: var(--text-primary); }

/* ===== 状态指示器 ===== */
.status-indicator {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); margin-right: 6px; vertical-align: middle;
  transition: all 0.3s;
}
.status-indicator.online { background: var(--success); box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.status-indicator.typing { background: var(--warning); animation: pulse 1s infinite; }
.status-indicator.offline { background: var(--error); }

.typing-cursor {
  display: inline-block; width: 8px; height: 16px;
  background: var(--accent-primary); margin-left: 2px;
  animation: blink 0.8s infinite; vertical-align: text-bottom;
}

@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.2); } }

/* ================================================================
   超智能体3.0(superEntity3.0) - 移动端响应式适配
   ================================================================ */

/* ===== 汉堡菜单按钮（固定在手机屏幕上） ===== */
.mobile-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  width: 42px;
  height: 42px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mobile-hamburger:hover { background: var(--bg-hover); }
.mobile-hamburger:active { transform: scale(0.95); }

/* 侧边栏遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9;
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-overlay.show {
  opacity: 1;
  display: block;
}

/* ===== 平板 & 小屏 (≤900px) ===== */
@media (max-width: 900px) {
  /* 侧边栏缩小 */
  :root { --sidebar-width: 220px; }
  
  .sidebar-brand { padding: 16px 14px 12px; }
  .sidebar-brand .logo { width: 36px; height: 36px; font-size: 20px; }
  .sidebar-brand .brand-text { font-size: 14px; }
  
  .nav-item { padding: 10px 12px; font-size: 13px; }
  
  .chat-sidebar { width: 220px; min-width: 220px; }
  
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .info-panels {
    grid-template-columns: 1fr;
  }
}

/* ===== 手机 (≤768px) ===== */
/* 手机 ≤768px */
@media (max-width: 768px) {
  /* 隐藏桌面端侧边栏折叠按钮（手机用汉堡菜单替代） */
  .sidebar-toggle {
    display: none !important;
  }

  /* 全局调整 */
  html, body { overflow-y: auto; }
  
  #app-root {
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 汉堡菜单显示 */
  .mobile-hamburger { display: flex; }
  
  /* 侧边栏 → 抽屉式 */
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    min-width: 280px;
    z-index: 100;
    transition: left 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  .sidebar.open { left: 0; }
  
  .sidebar-overlay { display: block; pointer-events: none; }
  /* ★ 移动端：如果同时有 collapsed, open 类，open 覆盖 collapsed 的视觉隐藏效果 */
  .sidebar.collapsed.open {
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 280px !important;
    min-width: 280px !important;
  }
  
  /* 主内容区全宽 */
  .sidebar-overlay.show { pointer-events: auto; }
  
  /* 主内容区全宽 */
  .main-content {
    width: 100%;
    margin-left: 0;
    padding-top: 0;
    overflow-y: visible;
  }
  
  .page { padding: 16px; }
  .page.active { min-height: 100vh; }
  
  /* 页面标题 */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding-top: 8px;
  }
  .page-header h1 { font-size: 20px; }
  .page-header .header-actions { width: 100%; justify-content: flex-end; }

  /* ===== 聊天页 ===== */
  #page-chat.page {
    padding: 0;   /* ★ 2026-08-13 手机端聊天页占满宽度，消除左右大边距 */
  }
  .chat-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 100px);
  }
  
  .chat-sidebar {
    width: 100%;
    min-width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
  }
  .chat-sidebar-header { padding: 10px 14px; }
  .chat-sidebar-header h3 { font-size: 14px; }
  .conversation-list { max-height: 150px; }
  .conversation-item { padding: 8px 14px; font-size: 13px; }
  
  .chat-main {
    border-radius: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  .chat-messages {
    padding: 12px;
    gap: 12px;
    flex: 1;
    max-height: none;
  }
  
  .message { max-width: 92%; gap: 8px; }
  .message-avatar { width: 30px; height: 30px; font-size: 13px; }
  .message-content { padding: 10px 12px; font-size: 14px; }
  .message-sender { font-size: 11px; }
  .message-time { font-size: 10px; }
  
  .chat-input-area {
    padding: 10px 12px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
  }
  .chat-input-wrapper {
    gap: 4px;
    padding: 3px 3px 3px 6px;
  }
  .chat-input { font-size: 16px; padding: 8px 6px; }
  .chat-attach-btn { width: 30px; height: 30px; font-size: 14px; }
  .chat-mic-btn { width: 30px; height: 30px; font-size: 14px; }
  .chat-clear-btn { width: 26px; height: 26px; font-size: 12px; }
  .chat-send-btn { height: 30px; min-width: 36px; padding: 0 10px; font-size: 14px; }
  .chat-stop-btn { height: 30px; min-width: 36px; padding: 0 10px; font-size: 14px; }
  
  .chat-actions {

.chat-actions-btn {
  color: var(--accent-primary);
}
.chat-actions-btn:hover {
  color: var(--accent-hover);
}
.chat-actions-text {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  white-space: nowrap;
}
.chat-actions-text:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }
  
  .model-selector { 
    flex: 1; 
    min-width: 120px; 
    justify-content: center;
  }
  .model-selector select { min-width: 90px; font-size: 12px; }
  
  .chat-status { font-size: 11px; }
  
  /* ===== 工具管理 ===== */
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .tools-filter {
    flex-direction: column;
    gap: 10px;
  }
  .search-box { width: 100%; }
  .filter-tabs { overflow-x: auto; white-space: nowrap; padding-bottom: 4px; }
  .filter-tab { font-size: 12px; padding: 5px 12px; }
  
  .tool-card { padding: 14px; }
  .tool-card-name { font-size: 14px; }
  .tool-card-desc { font-size: 12px; -webkit-line-clamp: 3; }
  .tool-card-category { font-size: 9px; padding: 1px 6px; }
  
  /* ===== 系统监控 ===== */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card { padding: 14px; }
  .stat-icon { width: 36px; height: 36px; font-size: 16px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }
  
  .info-panels {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .info-panel .panel-header h3 { font-size: 14px; }
  .info-panel .panel-body { font-size: 12px; padding: 12px; }
  
  /* ===== 自我进化 ===== */
  .evolution-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .evolution-card .card-header h3 { font-size: 15px; }
  .evolution-card .card-body { padding: 14px; }
  .derive-input { font-size: 13px; padding: 10px; }
  .derive-params .param-row { flex-direction: column; gap: 6px; }
  .derive-params .param-row label { width: auto; }
  .param-input { width: 100%; }
  #derive-btn { width: 100%; justify-content: center; font-size: 14px; padding: 12px; }
  
  .insight-card { padding: 12px; }
  .insight-card .insight-title { font-size: 13px; }
  .insight-card .insight-desc { font-size: 12px; }
  
  /* ===== 任务管理 ===== */
  .task-list { padding: 0; }
  .task-item { padding: 12px; flex-direction: column; gap: 8px; }
  .task-info { width: 100%; }
  .task-title { font-size: 14px; }
  .task-desc { font-size: 12px; }
  .task-meta { flex-wrap: wrap; gap: 6px; }
  .task-meta span { font-size: 10px; }
  .task-actions { width: 100%; justify-content: flex-end; gap: 6px; }
  .task-actions button { font-size: 11px; padding: 5px 10px; }
  
  #new-task-btn { width: 100%; justify-content: center; }
  
  /* ===== 模态弹窗 ===== */
  .modal-content {
    width: 95%;
    max-width: 95vw;
    margin: 10px;
    max-height: 85vh;
    border-radius: var(--radius-md);
  }
  .modal-header { padding: 14px 16px; }
  .modal-header h2 { font-size: 16px; }
  .modal-body { padding: 14px 16px; font-size: 13px; }
  .modal-footer { padding: 12px 16px; gap: 8px; }
  .modal-footer button { flex: 1; justify-content: center; font-size: 13px; }
  
  .result-pre { font-size: 12px; padding: 10px; max-height: 300px; white-space: pre-wrap; word-break: break-all; }
  
  /* ===== Toast适配 ===== */
  .toast-container {
    top: 56px;
    right: 12px;
    left: auto;
    width: auto;
    max-width: 320px;
  }
  .toast {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 10px;
  }
}

/* ===== 小手机 (≤480px) ===== */
@media (max-width: 480px) {
  .page { padding: 12px; }
  
  .page-header h1 { font-size: 18px; }
  .page-header .header-actions button { font-size: 12px; padding: 6px 14px; }
  
  /* 聊天 */
  #page-chat.page { padding: 0; }   /* ★ 2026-08-13 小屏聊天页占满宽度 */
  .chat-messages { padding: 8px; gap: 8px; }
  .message { max-width: 95%; gap: 6px; }
  .message-avatar { width: 26px; height: 26px; font-size: 11px; }
  .message-content { padding: 8px 10px; font-size: 13px; }
  .message.user .message-content { padding: 8px 10px; }
  
  .chat-input-area { padding: 8px 10px 12px; }
  .chat-input-wrapper { gap: 3px; padding: 2px 2px 2px 4px; }
  .chat-input { font-size: 16px; padding: 6px 4px; }
  .chat-attach-btn { width: 28px; height: 28px; font-size: 13px; }
  .chat-clear-btn { width: 24px; height: 24px; font-size: 11px; }
  .chat-send-btn { height: 28px; min-width: 34px; padding: 0 8px; font-size: 13px; }
  .chat-stop-btn { height: 28px; min-width: 34px; padding: 0 8px; font-size: 13px; }
  .chat-actions { gap: 6px; }

.chat-actions-btn {
  color: var(--accent-primary);
}
.chat-actions-btn:hover {
  color: var(--accent-hover);
}
.chat-actions-text {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  white-space: nowrap;
}
.chat-actions-text:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
  .model-selector { padding: 3px 8px; font-size: 11px; }
  .model-selector select { min-width: 70px; font-size: 11px; }
  /* ★ 极小屏：如果同时有 collapsed 类，open 覆盖其隐藏效果 */
  .sidebar.collapsed.open { opacity: 1 !important; pointer-events: auto !important; width: 260px !important; min-width: 260px !important; }
  
  /* 导航项 */
  
  /* 侧边栏 */
  .sidebar { width: 260px; min-width: 260px; left: -260px; }
  .sidebar.open { left: 0; }
  
  .nav-item { padding: 10px 12px; font-size: 13px; }
  
  /* 统计卡片 */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .stat-icon { width: 32px; height: 32px; font-size: 14px; }
  
  /* 工具卡片 */
  .tools-grid { gap: 8px; }
  .tool-card { padding: 12px; }
  
  /* 进化和任务 */
  .evolution-container { gap: 10px; }
  .evolution-card .card-body { padding: 12px; }
  
  .mobile-hamburger {
    width: 36px;
    height: 36px;
    font-size: 16px;
    top: 10px;
    left: 10px;
  }
}

/* ===== 超小屏 (≤360px) ===== */
@media (max-width: 360px) {
  .page { padding: 10px; }
  
  .page-header h1 { font-size: 16px; }
  
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 16px; }
  .stat-label { font-size: 9px; }
  
  .modal-content { margin: 6px; padding: 0; }
  .modal-header { padding: 10px 12px; }
  .modal-header h2 { font-size: 14px; }
  .modal-body { padding: 10px 12px; font-size: 12px; }
  .modal-footer { padding: 8px 12px; }
  
  .chat-messages { padding: 8px; gap: 8px; }
  .message-content { font-size: 12px; padding: 6px 8px; }
}

/* ===== 暗色模式强制覆盖 ===== */
@media (prefers-color-scheme: light) {
  /* 保持深色科技风不变 */
}

/* ===== 多模态图片消息样式 ===== */
.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  padding: 4px 0;
}

.message-image-item {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.1);
  transition: all 0.2s;
  position: relative;
}

.message-image-item:hover {
  border-color: #00d4ff;
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0,212,255,0.3);
}

.message-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 图片上传预览 */
.image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  margin-bottom: 8px;
}

.image-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #00d4ff;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 9px;
  text-align: center;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(255,0,0,0.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.image-preview-remove:hover {
  background: rgba(255,0,0,1);
  transform: scale(1.2);
}

/* 图片灯箱预览 */
.image-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}

.image-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0,212,255,0.3);
  cursor: default;
  animation: scaleIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 模型选择器增强 */
.model-selector select {
  background: rgba(0,0,0,0.3);
  color: #e0e0e0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  min-width: 140px;
  transition: all 0.2s;
}

.model-selector select:hover {
  border-color: #00d4ff;
  background: rgba(0,212,255,0.1);
}

.model-selector select:focus {
  outline: none;
  border-color: #00d4ff;
  box-shadow: 0 0 10px rgba(0,212,255,0.2);
}

.model-selector select option {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 8px;
}

/* 图片按钮样式 */
.btn-icon .fa-image {
  color: #00d4ff;
  font-size: 16px;
}

.btn-icon:hover .fa-image {
  color: #00ff88;
}

/* 移动端图片适配 */
@media (max-width: 480px) {
  .message-image-item {
    width: 80px;
    height: 80px;
  }
  
  .image-preview-item {
    width: 60px;
    height: 60px;
  }
  
  .model-selector select {
    min-width: 100px;
    font-size: 11px;
    padding: 4px 6px;
  }
}

/* ===== 消息操作按钮 ===== */
.message-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.message-content:hover .message-actions {
  opacity: 1;
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.msg-action-btn:hover {
  color: var(--text-primary);
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ===== 代码复制按钮 ===== */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 2;
}

pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  color: var(--text-primary);
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ===== 图片预览弹窗 ===== */
.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.image-preview-full {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: default;
  animation: zoomIn 0.25s ease;
}

.image-preview-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.image-preview-close:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== 打字光标动画 ===== */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent-primary);
  margin-left: 2px;
  animation: blink 0.8s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 流式消息高亮边框 */
.message.assistant#streaming-msg {
  border-left: 3px solid var(--accent-primary);
}

/* ===== 流式响应加载动画 ===== */
.streaming-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 8px 12px;
}

.streaming-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: dotPulse 1.4s ease-in-out infinite both;
}

.streaming-dots span:nth-child(1) { animation-delay: -0.32s; }
.streaming-dots span:nth-child(2) { animation-delay: -0.16s; }
.streaming-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== 拖拽上传浮层 ===== */
.drop-zone-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(108, 99, 255, 0.15);
  backdrop-filter: blur(4px);
  border: 2px dashed var(--accent-primary);
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 50;
  animation: fadeIn 0.2s ease;
}

.drop-zone-overlay.active {
  display: flex;
}

.drop-zone-overlay i {
  font-size: 48px;
  color: var(--accent-primary);
  animation: float 2s ease-in-out infinite;
}

.drop-zone-overlay span {
  font-size: 16px;
  color: var(--accent-primary);
  font-weight: 500;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* ===== 图片预览容器增强 ===== */
.image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 1px solid var(--border-color);
}

.image-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid var(--border-color);
}

.image-preview-item:hover {
  transform: scale(1.05);
  border-color: var(--accent-primary);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-name {
  display: none;
}

.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-preview-item:hover .image-preview-remove {
  opacity: 1;
}

/* 消息中的图片网格 */
.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.message-image-item {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: transform 0.2s;
}

.message-image-item:hover {
  transform: scale(1.05);
  border-color: var(--accent-primary);
}

.message-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== 工具调用卡片 ===== */
.tool-call-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 8px 48px 8px 48px;
  animation: slideIn 0.3s ease;
  transition: all 0.3s ease;
}

.tool-call-card.tool-call-done {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.05);
}

.tool-call-card.tool-call-error {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
}

.tool-call-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tool-call-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
}

.tool-call-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.tool-call-status {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
}

.tool-call-status.status-running {
  color: var(--info);
  background: rgba(96, 165, 250, 0.1);
}

.tool-call-status.status-success {
  color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

.tool-call-status.status-error {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(96, 165, 250, 0.3);
  border-top-color: var(--info);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.tool-call-params {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.param-item {
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.param-key {
  color: var(--accent-primary);
  font-weight: 600;
}

.tool-call-result {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  /* ★ 2026-08-10 优化：长结果折叠限高+滚动，避免工具结果撑爆聊天区 */
  max-height: 140px;
  overflow-y: auto;
  word-break: break-all;
  white-space: pre-wrap;
  transition: max-height 0.25s ease;
}
/* 折叠按钮：点击展开/收起 */
.tool-call-result.expanded {
  max-height: none;
}

.result-success {
  color: var(--success);
}

.result-error {
  color: var(--error);
}

.result-progress {
  color: var(--info);
  font-style: italic;
}

/* ===== 任务列表样式 ===== */
.task-list {
  list-style: none !important;
  padding-left: 0 !important;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.task-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  cursor: default;
  position: relative;
  flex-shrink: 0;
}

.task-item.task-done input[type="checkbox"] {
  background: var(--success);
  border-color: var(--success);
}

.task-item.task-done input[type="checkbox"]::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

.task-item.task-pending input[type="checkbox"] {
  border-color: var(--text-muted);
}

.task-item.task-done {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ===== 代码块头部 ===== */
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid var(--border-color);
  border-radius: 8px 8px 0 0;
  font-size: 11px;
}

.code-lang {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-transform: lowercase;
}

/* 代码块整体样式增强 */
.message-text pre {
  background: #1e1e2e !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 12px 0;
  position: relative;
}

.message-text pre code {
  display: block;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  font-family: var(--font-mono);
  color: #d4d4d8;
  background: transparent !important;
}

/* 表格样式增强 */
.message-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.message-text table th {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.message-text table td {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.message-text table tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

.message-text table tr:hover {
  background: rgba(108, 99, 255, 0.05);
}

/* 引用样式增强 */
.message-text blockquote {
  border-left: 3px solid var(--accent-primary);
  padding: 8px 16px;
  margin: 12px 0;
  background: rgba(108, 99, 255, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.message-text blockquote p {
  margin: 4px 0;
}

/* 行内代码增强 */
.message-text code {
  background: rgba(108, 99, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: #e8a0e0;
}

/* ===== Markdown 渲染增强 ===== */
.message-text {
  line-height: 1.7;
  font-size: 14px;
}
.message-text h1, .message-text h2, .message-text h3,
.message-text h4, .message-text h5, .message-text h6 {
  color: var(--accent-primary);
  margin: 20px 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}
.message-text h1 { font-size: 1.5em; border-bottom: 2px solid var(--accent-primary); }
.message-text h2 { font-size: 1.3em; }
.message-text h3 { font-size: 1.15em; }
.message-text h4, .message-text h5, .message-text h6 { font-size: 1.05em; border-bottom: none; }

.message-text p { margin: 8px 0; }
.message-text p:first-child { margin-top: 0; }
.message-text p:last-child { margin-bottom: 0; }

.message-text ul, .message-text ol {
  padding-left: 24px;
  margin: 8px 0;
}
.message-text li { margin: 4px 0; }

.message-text code {
  background: rgba(108, 99, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Fira Code', 'Courier New', monospace;
  color: var(--accent-primary);
}
.message-text pre {
  background: #0d0d1a !important;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0;
  margin: 12px 0;
  overflow: hidden;
}
.message-text pre code {
  background: transparent !important;
  padding: 16px;
  display: block;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #e8e8f0;
}
.message-text strong { color: var(--text-primary); font-weight: 600; }
.message-text blockquote {
  border-left: 3px solid var(--accent-primary);
  padding: 8px 16px;
  margin: 12px 0;
  background: rgba(108, 99, 255, 0.05);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}
.message-text blockquote p { margin: 4px 0; }
.message-text hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}
.message-text a { color: var(--accent-primary); text-decoration: none; }
.message-text a:hover { text-decoration: underline; }
.message-text img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.message-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}
.message-text table th, .message-text table td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}
.message-text table th {
  background: var(--bg-hover);
  font-weight: 600;
  color: var(--text-primary);
}
.message-text table tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.message-text table tr:hover { background: rgba(108, 99, 255, 0.05); }

/* ===== 性能优化 ===== */
.chat-messages {
  will-change: scroll-position;
  contain: content; /* 优化重绘性能 */
  overscroll-behavior: contain; /* 防止滚动链 */
}

/* 消息卡片硬件加速 */
.message {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* 动画性能优化 */
.sidebar, .main-content {
  will-change: transform;
}

/* toast通知性能优化 */
.toast-container {
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  will-change: transform, opacity;
}

.mobile-hamburger {
}
/* ============================================
   移动端响应式适配 - 全面增强
   ============================================ */

/* ===== 汉堡菜单按钮 ===== */
.mobile-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: all 0.3s;
}

.mobile-hamburger:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

/* ===== 侧边栏遮罩 ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
  opacity: 1;
}

/* ===== 侧边栏+平板优化（768-1024px） ===== */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  /* ★ 页面容器防溢出 */
  .page {
    padding: 16px;
    overflow-x: hidden;
  }
  
  .chat-layout {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative; /* ★ 让 digital-human-panel 绝对定位相对此容器定位 */
  }
  
  .chat-sidebar {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
  }
  
  .chat-main {
    flex: 1;
    min-width: 0;        /* ★ 防止flex子项撑破容器 */
    max-width: 100%;
    overflow: hidden;
    /* width: 0 已移除，flex: 1 自动分配宽度 */
  }
  
  .chat-messages {
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .message {
    max-width: 90%;
  }
  
  .tool-call-card {
    margin: 8px 8px 8px 8px;
  }
  
  .chat-actions {

.chat-actions-btn {
  color: var(--accent-primary);
}
.chat-actions-btn:hover {
  color: var(--accent-hover);
}
.chat-actions-text {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  white-space: nowrap;
}
.chat-actions-text:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }
  
  .chat-actions .model-selector {
    flex-shrink: 1;
    min-width: 0;
  }
  .chat-actions .model-selector select {
    min-width: 80px;
    max-width: 120px;
  }
  
  .chat-input-wrapper {
    max-width: 100%;
    flex-wrap: nowrap;
  }
  
  .chat-input-wrapper .chat-input {
    min-width: 40px;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }
  
  body {
    overflow-x: hidden;
    touch-action: manipulation;
  }
  
  /* 显示汉堡按钮 */
  .mobile-hamburger {
    display: flex;
  }
  
  /* 侧边栏从左侧滑入 */
  .sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    z-index: 999;
    transition: left 0.3s ease;
    box-shadow: 4px 0 30px rgba(0,0,0,0.3);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .sidebar-overlay {
    display: block;
  }
  
  /* 主内容全宽 */
  .main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    padding-top: 60px;
  }
  
  #app-root {
    flex-direction: column;
  }
  
  /* 聊天布局堆叠 */
  .chat-layout {
    flex-direction: column;
    height: 100%;
  }
  
  /* ★ 2026-08-10 修复：手机端会话列表改为左侧抽屉（不再隐藏，用户可切换历史会话） */
  .chat-sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 85vw;
    height: 100vh;
    z-index: 1002;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
    transition: left 0.3s ease;
    background: var(--bg-secondary);
  }
  .chat-sidebar.open {
    left: 0;
  }
  
  .chat-main {
    border-radius: 0;
    height: 100%;
  }
  
  .chat-messages {
    padding: 4px 6px;
    gap: 6px;
  }
  
  .message {
    max-width: 100%;
  }
  
  .message.user {
    max-width: 90%;
  }
  
  .message.assistant {
    max-width: 100%;
  }
  
  .message-content {
    padding: 10px 14px;
    font-size: 14px;
  }
  
  .message-images {
    gap: 4px;
  }
  
  .message-image-item {
    width: 60px;
    height: 60px;
  }
  
  /* 聊天输入区 */
  .chat-input-area {
    padding: 8px 12px;
  }
  
  .chat-input-wrapper {
    padding: 3px 3px 3px 6px;
    gap: 4px;
  }
  
  .chat-input {
    font-size: 16px;
    padding: 6px 4px;
  }
  
  .chat-attach-btn { width: 28px; height: 28px; font-size: 13px; }
  .chat-clear-btn { width: 24px; height: 24px; font-size: 11px; }
  .chat-send-btn { height: 28px; min-width: 36px; padding: 0 10px; font-size: 13px; }
  .chat-stop-btn { height: 28px; min-width: 36px; padding: 0 10px; font-size: 13px; }
  
  .chat-actions {

.chat-actions-btn {
  color: var(--accent-primary);
}
.chat-actions-btn:hover {
  color: var(--accent-hover);
}
.chat-actions-text {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  white-space: nowrap;
}
.chat-actions-text:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
  }
  
  .model-selector {
    flex: 1;
    min-width: 120px;
  }
  
  .model-selector select {
    font-size: 12px;
    padding: 6px 8px;
  }
  
  .btn.btn-primary {
    padding: 8px 14px;
    font-size: 13px;
  }
  
  /* 统计卡片网格 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
  }
  
  .stat-card {
    padding: 14px;
  }
  
  .stat-value {
    font-size: 20px;
  }
  
  .info-panels {
    flex-direction: column;
    padding: 0 12px 12px;
  }
  
  .info-panel {
    min-width: auto;
  }
  
  /* 工具网格 */
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    padding: 12px;
  }
  
  .tools-filter {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  
  .search-box {
    width: 100%;
  }
  
  /* Toast通知调整 — 右上角，不占左边空间 */
  .toast-container {
    top: 12px;
    right: 12px;
    left: auto;
    max-width: 320px;
  }
  
  .toast {
    max-width: 100%;
    font-size: 12px;
    padding: 10px 14px;
  }
  
  /* 模态框适配 */
  .modal-content {
    width: 90%;
    margin: 40px auto;
    max-height: 80vh;
  }
  
  .modal-overlay {
    align-items: flex-start;
    padding-top: 60px;
  }
  
  /* 页面标题 */
  .page-header {
    flex-direction: column;
    gap: 10px;
    padding: 16px 16px 12px;
  }
  
  .page-header h1 {
    font-size: 20px;
  }
  
  .header-actions {
    width: 100%;
  }
  
  .header-actions .btn {
    flex: 1;
    text-align: center;
  }
  
  /* 进化页面 */
  .evolution-container {
    padding: 12px;
  }
  
  .derive-section {
    padding: 16px;
  }
  
  .derive-input-row {
    flex-direction: column;
    gap: 8px;
  }
  
  /* 任务管理 */
  .task-controls {
    flex-direction: column;
    padding: 12px;
  }
  
  .task-input-row {
    flex-direction: column;
    gap: 8px;
  }
  
  .task-options {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  :root {
    --sidebar-width: 260px;
  }
  
  .sidebar {
    width: 260px;
    left: -280px;
  }
  
  .main-content {
    padding-top: 50px;
  }
  
  .mobile-hamburger {
    top: 8px;
    left: 8px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .chat-messages {
    padding: 2px 4px;
    gap: 4px;
  }
  
  .message-content {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .message.user {
    max-width: 95%;
  }
  
  .message-avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  
  .message-image-item {
    width: 50px;
    height: 50px;
  }
  
  .chat-input-area {
    padding: 6px 8px;
  }
  
  .chat-input-wrapper {
    padding: 4px 8px;
  }
  
  .chat-input {
    font-size: 16px;
    min-height: 36px;
  }
  
  .chat-actions {

.chat-actions-btn {
  color: var(--accent-primary);
}
.chat-actions-btn:hover {
  color: var(--accent-hover);
}
.chat-actions-text {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  white-space: nowrap;
}
.chat-actions-text:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
    gap: 4px;
  }
  
  .model-selector select {
    font-size: 11px;
    padding: 5px 6px;
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .btn-icon {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }
  
  .stat-card {
    padding: 10px;
  }
  
  .stat-value {
    font-size: 18px;
  }
  
  .stat-label {
    font-size: 11px;
  }
  
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
  }
  
  .tool-card {
    padding: 12px;
  }
  
  .tool-card-name {
    font-size: 13px;
  }
  
  .filter-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .filter-tab {
    font-size: 12px;
    padding: 4px 10px;
  }
  
  .info-panels {
    padding: 0 8px 8px;
  }
  
  .info-panel .panel-body {
    padding: 10px;
  }
  
  .config-pre {
    font-size: 11px;
  }
  
  .modal-content {
    width: 95%;
    margin: 30px auto;
    border-radius: 14px;
  }
  
  .modal-overlay {
    padding-top: 40px;
    align-items: flex-start;
  }
  
  .modal-header {
    padding: 14px 16px;
  }
  
  .modal-header h2 {
    font-size: 16px;
  }
  
  .modal-body {
    padding: 14px 16px;
  }
  
  .modal-footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  .page-header {
    padding: 12px 12px 10px;
  }
  
  .page-header h1 {
    font-size: 18px;
  }
  
  .conversation-item {
    padding: 8px 10px;
    font-size: 12px;
  }
  
  .nav-item {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .sidebar-brand {
    padding: 16px 16px 12px;
  }
  
  .sidebar-brand .logo {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  
  .sidebar-brand .brand-text {
    font-size: 14px;
  }
  
  .tool-call-card {
    margin: 6px 4px;
    padding: 10px 12px;
  }
  
  /* 图片预览灯箱 */
  .image-lightbox-img {
    max-width: 95vw;
    max-height: 85vh;
  }
  
  .image-preview-close {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    font-size: 15px;
  }
  
  /* 拖拽上传浮层 */
  .drop-zone-overlay {
    font-size: 14px;
    gap: 8px;
  }
  
  .drop-zone-overlay i {
    font-size: 32px;
  }
  
  /* 系统监控图表面板 */
  .chart-panels {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 8px;
  }
  
  .chart-panel {
    padding: 12px;
  }
  
  /* 进化洞察 */
  .insights-body {
    padding: 10px;
    font-size: 12px;
  }
  
  /* 页面内容间距 */
  .page {
    padding-bottom: 20px;
  }
  
  /* 会话侧栏移动端（★ 2026-08-10 统一为左侧抽屉方案，与768px规则一致） */
  .chat-sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 85vw;
    height: 100vh;
    z-index: 1002;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
    transition: left 0.3s ease;
    background: var(--bg-secondary);
  }
  
  .chat-sidebar.open {
    left: 0;
  }
}

@media (max-width: 360px) {
  .sidebar {
    width: 240px;
    left: -260px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  
  .stat-card {
    padding: 8px;
  }
  
  .stat-value {
    font-size: 16px;
  }
  
  .message-content {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .chat-messages {
    padding: 6px;
    gap: 6px;
  }
  
  .chat-input {
    font-size: 16px;
    min-height: 32px;
  }
  
  .model-selector select {
    font-size: 10px;
    padding: 4px 6px;
    max-width: 120px;
  }
  
  .btn {
    padding: 5px 10px;
    font-size: 11px;
  }
  
  .btn-icon {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  .page-header h1 {
    font-size: 16px;
  }
}

/* ===== 平板横屏优化 ===== */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  .chat-layout {
    flex-direction: row;
  }
  
  .chat-sidebar {
    width: 200px;
    min-width: 200px;
    display: flex;
  }
  
  .message {
    max-width: 80%;
  }
  
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== 移动端聊天侧栏切换按钮 ===== */
.chat-sidebar-toggle {
  display: none;
}

@media (max-width: 480px) {
  .chat-sidebar-toggle {
    display: flex;
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 90;
    box-shadow: 0 4px 15px var(--accent-glow);
  }
}

/* ===== 暗色滚动条优化 ===== */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 3px;
    height: 3px;
  }
}

/* ===== 触摸优化 - 增大点击区域 ===== */
@media (hover: none) and (pointer: coarse) {
  .nav-item {
    padding: 14px 14px;
  }
  
  .btn, .btn-icon, .nav-item, .filter-tab {
    min-height: 44px;
  }
  
  .filter-tab {
    padding: 8px 14px;
  }
  
  .conversation-item {
    padding: 12px 12px;
  }
  
  .sidebar-user {
    padding: 12px 8px;
  }
  
  .dropdown-item {
    padding: 12px 16px;
  }
}

/* ===== 安全区域适配 (iPhone X 等刘海屏) ===== */
@supports (padding: max(0px)) {
  @media (max-width: 480px) {
    .main-content {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
      padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .chat-input-area {
      padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .sidebar {
      padding-top: max(0px, env(safe-area-inset-top));
    }
    
    .mobile-hamburger {
      top: max(12px, env(safe-area-inset-top));
      left: max(12px, env(safe-area-inset-left));
    }
  }

/* ============================================
   模型配置页面
   ============================================ */

.model-providers {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.provider-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s;
}

.provider-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(108,99,255,0.1);
}

.provider-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.provider-card-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.provider-card-name h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.provider-card-name .provider-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: #fff;
}

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

.provider-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.provider-card-body .info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.provider-card-body .info-row .label {
  color: var(--text-muted);
  min-width: 60px;
}

.provider-card-body .info-row .value {
  color: var(--text-primary);
  word-break: break-all;
}

.provider-card-models {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.provider-card-models .models-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.model-tag.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(108,99,255,0.1);
}

.model-tag.vision {
  border-color: rgba(251,191,36,0.3);
  color: var(--warning);
}

.provider-card-footer {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.provider-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.provider-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-lg {
  max-width: 600px;
}

.provider-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
}

.provider-status.configured {
  background: rgba(74,222,128,0.1);
  color: var(--success);
  border: 1px solid rgba(74,222,128,0.3);
}

.provider-status.unconfigured {
  background: rgba(248,113,113,0.1);
  color: var(--error);
  border: 1px solid rgba(248,113,113,0.3);
}

.conversation-item .conv-actions {
  display: none;
  gap: 2px;
  margin-left: auto;
}

.conversation-item:hover .conv-actions {
  display: flex;
}

.conversation-item .conv-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 11px;
  border-radius: 3px;
}

.conversation-item .conv-actions button:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.conversation-item .conv-preview {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.modal-sm {
  max-width: 400px;
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}

.btn-success:hover {
  box-shadow: 0 0 20px rgba(34,197,94,0.3) !important;
}

@media (max-width: 768px) {
  .provider-card-body {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .modal-lg {
    max-width: 95%;
    margin: 10px;
  }
  
  .provider-card-actions .btn span {
    display: none;
  }
}
}

/* ===== 文件上传预览 ===== */
.file-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px 8px 4px 4px;
  font-size: 12px;
  position: relative;
  animation: filePreviewIn 0.25s ease-out;
}

@keyframes filePreviewIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.file-preview-img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}

.file-preview-icon {
  font-size: 20px;
  line-height: 1;
}

.file-preview-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 11px;
}

.file-preview-type {
  color: var(--text-muted);
  font-size: 9px;
  background: var(--bg-hover);
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
}

.file-preview-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.file-preview-remove:hover {
  color: var(--error);
}

/* ===== 消息中的文件附件展示 ===== */
.message-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.message-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.message-file-item .file-icon {
  font-size: 16px;
}

.message-file-item .file-name {
  color: var(--text-secondary);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-file-item .file-size {
  color: var(--text-muted);
  font-size: 10px;
}

/* ===== 拖拽上传浮层 ===== */
.drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(108, 99, 255, 0.1);
  border: 2px dashed var(--accent-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(4px);
}

.drop-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drop-overlay-content {
  text-align: center;
  color: var(--text-primary);
}

.drop-overlay-content i {
  font-size: 48px;
  color: var(--accent-primary);
  margin-bottom: 12px;
}

.drop-overlay-content p {
  font-size: 16px;
  margin: 0;
}

.drop-overlay-content small {
  color: var(--text-muted);
  font-size: 12px;
}


/* ============================================
   推理/思考内容折叠面板（参考1.0 agentLoop）
   ============================================ */
.message-reasoning {
  margin: 6px 0 8px 0;
  border: 1px solid rgba(137, 180, 250, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(137, 180, 250, 0.06);
  overflow: hidden;
  max-width: 100%;
}

.reasoning-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
  border-radius: var(--radius-sm);
}

.reasoning-header:hover {
  background: rgba(137, 180, 250, 0.1);
}

.reasoning-arrow {
  font-size: 10px;
  color: var(--info);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.reasoning-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--info);
  flex: 1;
}

.reasoning-status {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(137, 180, 250, 0.12);
  padding: 1px 8px;
  border-radius: 8px;
}

.reasoning-body {
  border-top: 1px solid rgba(137, 180, 250, 0.1);
  max-height: 200px;
  overflow-y: auto;
}

.reasoning-content {
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #a6adc8;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================
   消息宽度修复 - 防止工具调用内容撑宽
   ============================================ */
.message {
  max-width: 85%;
  min-width: 0;  /* 允许flex收缩 */
}

.message-content {
  min-width: 0;  /* 允许内部内容换行 */
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.message-text {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.message-text pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.message-text code {
  word-break: break-all;
}

.message-text img {
  max-width: 100%;
  height: auto;
}

/* 工具调用卡片宽度修复 */
.tool-call-card {
  max-width: calc(100% - 96px);
  margin: 8px 48px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.tool-call-params {
  max-width: 100%;
  overflow-x: auto;
}

.tool-call-result {
  max-width: 100%;
  overflow-x: auto;
}

/* 回复内容中的表格也限制宽度 */
.message-text table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* 文件预览容器宽度修复 */
.message-files {
  max-width: 100%;
  flex-wrap: wrap;
}

.message-file-item {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .message {
    max-width: 92%;
  }
  .tool-call-card {
    margin: 8px 16px;
    max-width: calc(100% - 32px);
  }
}

/* ============================================
   自定义弹窗/确认框 - 科技风
   ============================================ */

/* 确认弹窗标题图标 */
#confirm-title i {
  color: var(--warning);
}

/* 确认弹窗消息 */
#confirm-message {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== 用户详情弹窗 ===== */
.user-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.profile-info-value {
  padding: 10px 14px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 14px;
}

/* ===== 工具调用详情扩展 ===== */
.tool-call-header {
  cursor: pointer;
  user-select: none;
}

.tool-call-header:hover {
  background: rgba(108, 99, 255, 0.08);
}

.tool-expand-icon {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
  padding: 4px;
}

.tool-call-details {
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border-color);
  margin: 0 -12px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 500px; }
}

.tool-call-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tool-call-param-row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.tool-call-param-row:last-child {
  border-bottom: none;
}

.tool-call-param-row .param-key {
  color: var(--accent-primary);
  font-weight: 500;
  min-width: 80px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

.tool-call-param-row .param-val {
  color: var(--text-secondary);
  word-break: break-all;
  font-size: 12px;
  font-family: var(--font-mono);
}

.tool-call-params-summary {
  padding: 4px 12px 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  margin: 0 -12px;
  padding-left: 40px;
}

.tool-params-more {
  color: var(--accent-primary);
  font-weight: 500;
}

/* ===== 消息操作按钮 ===== */
.message-actions {
  display: flex;
  gap: 4px;
  padding: 4px 0 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.message-content:hover .message-actions {
  opacity: 1;
}

.msg-action-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.msg-action-btn:hover {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-action {
  width: 28px;
  height: 28px;
  font-size: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.btn-action:hover {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ===== 侧边栏用户菜单增强 ===== */
.dropdown-item i {
  width: 20px;
  text-align: center;
}

/* 用户详情按钮在用户下拉中高亮 */
.dropdown-item:first-child {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
  padding-bottom: 10px;
}


/* ===== 聊天侧栏底部按钮（紧凑） ===== */
.chat-sidebar-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--border-color);
  justify-content: center;
  background: var(--bg-secondary);
}

.chat-sidebar-footer .btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  white-space: nowrap;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all 0.2s;
  cursor: pointer;
}

.chat-sidebar-footer .btn-sm:hover {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
}

.chat-sidebar-footer .btn-sm i {
  margin-right: 3px;
  font-size: 11px;
}

/* ===== 文件管理器 ===== */
.modal-lg {
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
}

.file-manager-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.file-manager-path {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  background: var(--bg-input);
  border-radius: 4px;
}

.file-manager-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.file-manager-grid {
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.file-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
  gap: 8px;
}

.file-item:hover {
  background: var(--bg-hover);
}

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

.file-item-dir {
  color: var(--accent-primary);
}

.file-icon {
  width: 28px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.file-item-dir .file-icon {
  color: var(--warning);
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.file-size {
  width: 70px;
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.file-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.file-item:hover .file-actions {
  opacity: 1;
}

.btn-icon-sm {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border-radius: 4px;
}

.file-empty, .file-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.file-empty i, .file-error i {
  font-size: 32px;
  margin-bottom: 8px;
  display: block;
}

.file-error i {
  color: var(--error);
}

/* ===== 会话设置 ===== */
#session-settings-modal .modal-content {
  max-width: 520px;
  width: 90%;
}

#session-settings-modal .form-group {
  margin-bottom: 16px;
}

#session-settings-modal label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-sm {
  max-width: 400px;
  width: 90%;
}

/* ===== 信息行（用户详情） ===== */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  font-size: 13px;
  color: var(--text-muted);
}

.info-row .value {
  font-size: 13px;
  color: var(--text-primary);
  text-align: right;
}

/* ============================================
   Agent Collaboration - 协作面板样式
   ============================================ */

/* 统计卡片 */
.collab-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 协作区块 */
.collab-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Agent网格 */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.agent-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.agent-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.agent-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.agent-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.agent-icon.orchestrator { background: #9b59b6; }
.agent-icon.coder { background: #3498db; }
.agent-icon.tester { background: #2ecc71; }
.agent-icon.reviewer { background: #f39c12; }
.agent-icon.debugger { background: #e74c3c; }
.agent-icon.researcher { background: #1abc9c; }

.agent-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.agent-status.status-online { background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }
.agent-status.status-busy { background: #f39c12; box-shadow: 0 0 6px #f39c12; animation: pulse 1.5s infinite; }
.agent-status.status-offline { background: #95a5a6; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.agent-card-body {
  margin-bottom: 8px;
}

.agent-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  margin-top: 4px;
}

.agent-progress {
  margin-top: 8px;
}

.progress-bar {
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 2px;
  transition: width 0.3s;
}

.agent-card-footer {
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.agent-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cap-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-color);
  color: #fff;
  opacity: 0.8;
}

/* 团队列表 */
.team-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.team-item:hover {
  border-color: var(--accent-color);
}

.team-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.team-state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.team-state-label {
  font-size: 12px;
  font-weight: 500;
  margin-left: auto;
}

.team-item-body {
  margin-bottom: 6px;
}

.team-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.team-item-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.team-time {
  margin-left: auto;
  font-size: 11px;
}

/* 协作执行卡片 */
.collab-exec-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
}

.collab-input {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
  resize: vertical;
  margin-bottom: 12px;
}

.collab-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.collab-exec-actions {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.collab-agent-select {
  flex: 1;
}

.collab-agent-select label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.collab-agent-select select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-primary);
}

.collab-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.collab-result h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

/* 消息历史 */
.message-log {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-secondary);
  font-size: 12px;
}

.msg-item:hover {
  background: var(--border-color);
}

.msg-time {
  color: var(--text-muted);
  font-family: monospace;
  min-width: 70px;
}

.msg-type {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.msg-type.task_assign { background: #3498db22; color: #3498db; }
.msg-type.task_complete { background: #2ecc7122; color: #2ecc71; }
.msg-type.task_failed { background: #e74c3c22; color: #e74c3c; }
.msg-type.task_progress { background: #f39c1222; color: #f39c12; }
.msg-type.agent_register { background: #9b59b622; color: #9b59b6; }
.msg-type.coordinate { background: #1abc9c22; color: #1abc9c; }

.msg-sender {
  color: var(--accent-color);
  font-weight: 500;
  min-width: 80px;
}

.msg-preview {
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 详情弹窗中的网格 */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--text-primary);
}

.detail-value.mono {
  font-family: monospace;
  font-size: 12px;
}

/* 能力列表 */
.cap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cap-item {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.cap-item strong {
  font-size: 13px;
  color: var(--accent-color);
}

.cap-item p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* 任务列表迷你版 */
.task-list-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-item-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-size: 12px;
}

.task-status {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

.task-status.pending { background: #95a5a622; color: #95a5a6; }
.task-status.assigned { background: #3498db22; color: #3498db; }
.task-status.running { background: #f39c1222; color: #f39c12; }
.task-status.completed { background: #2ecc7122; color: #2ecc71; }
.task-status.failed { background: #e74c3c22; color: #e74c3c; }

.task-time {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state p {
  margin-top: 12px;
  font-size: 14px;
}

/* 表单控件 */
.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-color);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* ============================================
   WebIDE - 文件管理系统样式
   ============================================ */

/* 主容器 */
.ide-container {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-primary);
}

/* ===== 左侧文件树 ===== */


/* 左侧文件树侧边栏主规则 */
.ide-sidebar {
  position: relative;
  width: 280px;
  min-width: 280px;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow: hidden;
  flex-shrink: 0;
}
.ide-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  overflow: hidden;
}

.ide-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.ide-sidebar-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.ide-sidebar-actions {
  display: flex;
  gap: 4px;
}

.ide-sidebar-search {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-input);
  flex-shrink: 0;
}

.ide-sidebar-search i {
  color: var(--text-muted);
  margin-right: 6px;
  font-size: 12px;
}

.ide-sidebar-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.ide-sidebar-search input::placeholder {
  color: var(--text-muted);
}

.ide-file-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 4px 0;
}

/* IDE侧边栏折叠后显示展开按钮 */
.ide-sidebar-toggle-float {
  display: none;
  position: absolute;
  left: 0;
  top: 60px;
  z-index: 1002;
  width: 24px;
  height: 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}
.ide-sidebar-toggle-float:hover {
  color: var(--accent-primary);
  background: var(--bg-hover);
}
.ide-sidebar.collapsed + .ide-sidebar-toggle-float {
  display: flex;
}

/* 侧边栏拖拽调整宽度手柄 */
.ide-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 1001;
}
.ide-resize-handle:hover,
.ide-resize-handle.active {
  background: var(--accent-primary);
}



.ide-tree-item {
  user-select: none;
}

.ide-tree-node {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  margin: 1px 4px;
  transition: background 0.15s;
  min-width: 0;
}

/* 文件名：超出容器自动省略，悬停显示完整名称 */
.ide-tree-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--text-primary);
}

.ide-tree-node:hover {
  background: var(--bg-hover);
}

.ide-tree-icon {
  width: 20px;
  text-align: center;
  margin-right: 6px;
  flex-shrink: 0;
}

.ide-tree-icon i {
  font-size: 14px;
  color: var(--text-muted);
}

.ide-tree-item.dir > .ide-tree-icon i {
  color: var(--warning);
}

.ide-tree-item.file > .ide-tree-icon i {
  color: var(--info);
}

/* 三角形展开/折叠指示器 */
.ide-tree-arrow {
  width: 16px;
  text-align: center;
  margin-right: 2px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ide-tree-arrow i {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.ide-tree-arrow-hidden {
  visibility: hidden;
}

/* 文件节点（无子节点）隐藏展开箭头，保留占位对齐 */
.ide-tree-arrow.empty {
  visibility: hidden;
}

/* 当父目录展开时，三角旋转90度 */
.dir.expanded > .ide-tree-node .ide-tree-arrow i,
.ide-tree-arrow.rotated i {
  transform: rotate(90deg);
}

.ide-tree-children {
  /* ★ 2026-08-16 修复：树形子节点增加层级缩进，否则所有子节点贴左侧无法区分层级 */
  padding-left: 16px;
}

/* 确保文件树容器可以横向滚动并显示完整文件名 */
.ide-file-tree {
  min-width: fit-content;
}

.ide-tree-item {
  min-width: 0;
}

/* 非树型（平铺列表）显示模式 */
.ide-file-tree.list-mode .ide-tree-children {
  display: none !important;
}

.ide-file-list-view {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0;
}

.ide-file-list-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  margin: 1px 4px;
  transition: background 0.15s;
  font-size: 13px;
}

.ide-file-list-item:hover {
  background: var(--bg-hover);
}

.ide-file-list-item .ide-tree-icon {
  margin-right: 8px;
}

.ide-file-list-item .ide-tree-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ide-file-list-item .file-path-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* 视图切换按钮 */
.ide-view-toggle {
  font-size: 12px !important;
  padding: 2px 6px !important;
}

/* 浮动按钮始终在最上层 */
.ide-sidebar-toggle-float {
  z-index: 100;
}

/* 侧边栏与顶部导航不重叠 */
.ide-sidebar-header .btn-icon-sm {
  font-size: 12px;
  width: 26px;
  height: 26px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .ide-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    width: 280px;
    min-width: 280px;
  }
  
  .ide-sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
  }
  
  .ide-sidebar-toggle-float {
    display: flex;
  }
  
  .ide-sidebar.collapsed + .ide-sidebar-toggle-float {
    display: flex;
  }
  
  .ide-container {
    position: relative;
  }
}
  /* 子节点缩进已在padding-left中处理 */


.ide-sidebar-footer {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.ide-sidebar-footer .btn {
  flex: 1;
  font-size: 11px;
  padding: 4px 6px;
}

/* ===== 中间编辑器区域 ===== */
.ide-editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.ide-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 32px;
}

.ide-tabs::-webkit-scrollbar {
  height: 2px;
}

.ide-tabs-empty {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.ide-tab {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--border-color);
  white-space: nowrap;
  transition: background 0.15s;
  position: relative;
}

.ide-tab:hover {
  background: var(--bg-hover);
}

.ide-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent-primary);
}

.ide-tab-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ide-tab-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0 0 6px;
  font-size: 10px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}

.ide-tab:hover .ide-tab-close {
  opacity: 0.7;
}

.ide-tab-close:hover {
  opacity: 1 !important;
  color: var(--error);
}

.ide-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-width: 0;
  /* ★ 2026-08-16 修复：嵌套 flex 高度链缺少 min-height:0，导致 MD 预览面板
     flex:1 + height:0 + overflow-y:auto 无法触发滚动 */
  min-height: 0;
  width: 100%;
}

.ide-editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
}

.ide-editor-empty p {
  font-size: 14px;
}

.ide-editor-empty small {
  font-size: 12px;
  opacity: 0.6;
}

/* ===== 编辑器工具栏 ===== */
.ide-editor-toolbar {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  flex-shrink: 0;
}
.ide-editor-toolbar .btn-icon-sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ide-editor-toolbar .btn-icon-sm:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.ide-editor-toolbar .btn-icon-sm.active {
  background: var(--accent-gradient);
  color: #fff;
}
.ide-toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 6px;
}

/* ===== 编辑器搜索栏 ===== */
.ide-search-bar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  flex-shrink: 0;
}
.ide-search-bar input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 3px 8px;
  font-size: 12px;
  outline: none;
  width: 160px;
}
.ide-search-bar input:focus {
  border-color: var(--accent-primary);
}
.ide-search-count {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: center;
}


/* ===== WebIDE 拖拽上传浮层 ===== */
.ide-drop-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(30, 30, 54, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
  pointer-events: none;
  border: 3px dashed var(--accent);
  border-radius: 8px;
  margin: 4px;
}
.ide-drop-overlay i {
  font-size: 48px;
  color: var(--accent);
  opacity: 0.6;
}
.ide-drop-overlay span {
  font-size: 16px;
  color: var(--text-secondary);
}
.ide-editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  position: relative;
}
[data-theme="light"] .ide-drop-overlay {
  background: rgba(255, 255, 255, 0.92);
}

/* ===== 编辑器预览面板（语法高亮） ===== */
.ide-editor-preview {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-primary);
  padding: 12px 16px;
  box-sizing: border-box;
}
#ide-editor-preview-body {
  width: 100%;
  min-width: 0;
}
.ide-editor-preview pre {
  margin: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
}
.ide-editor-preview code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  tab-size: 2;
}
/* ★ Markdown 预览排版（md 文件时覆盖代码样式） */
.ide-editor-preview .md-preview {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.7;
  white-space: normal;
  word-break: normal;
  color: var(--text-primary);
}
.ide-editor-preview .md-preview h1,
.ide-editor-preview .md-preview h2,
.ide-editor-preview .md-preview h3,
.ide-editor-preview .md-preview h4,
.ide-editor-preview .md-preview h5,
.ide-editor-preview .md-preview h6 {
  color: var(--accent-primary);
  margin: 20px 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}
.ide-editor-preview .md-preview h1 { font-size: 1.5em; border-bottom: 2px solid var(--accent-primary); }
.ide-editor-preview .md-preview h2 { font-size: 1.3em; }
.ide-editor-preview .md-preview h3 { font-size: 1.15em; }
.ide-editor-preview .md-preview h4, .ide-editor-preview .md-preview h5, .ide-editor-preview .md-preview h6 { font-size: 1.05em; border-bottom: none; }
.ide-editor-preview .md-preview p { margin: 8px 0; }
.ide-editor-preview .md-preview ul, .ide-editor-preview .md-preview ol { padding-left: 24px; margin: 8px 0; }
.ide-editor-preview .md-preview li { margin: 4px 0; }
.ide-editor-preview .md-preview a { color: var(--accent-primary); text-decoration: none; }
.ide-editor-preview .md-preview a:hover { text-decoration: underline; }
.ide-editor-preview .md-preview img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.ide-editor-preview .md-preview blockquote {
  border-left: 3px solid var(--accent-primary);
  padding: 8px 16px;
  margin: 12px 0;
  background: rgba(108, 99, 255, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.ide-editor-preview .md-preview table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.ide-editor-preview .md-preview table th { background: var(--bg-hover); font-weight: 600; padding: 8px 12px; text-align: left; border: 1px solid var(--border-color); }
.ide-editor-preview .md-preview table td { padding: 6px 12px; border: 1px solid var(--border-color); color: var(--text-secondary); }
.ide-editor-preview .md-preview table tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.ide-editor-preview .md-preview table tr:hover { background: rgba(108, 99, 255, 0.05); }
.ide-editor-preview .md-preview pre {
  background: #0d0d1a !important;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0;
  margin: 12px 0;
  overflow: hidden;
}
.ide-editor-preview .md-preview pre code {
  background: transparent !important;
  padding: 16px;
  display: block;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #e8e8f0;
  white-space: pre;
  word-break: normal;
}
.ide-editor-preview .md-preview code {
  background: rgba(108, 99, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--accent-primary);
}
.ide-editor-preview .md-preview hr { border: none; border-top: 1px solid var(--border-color); margin: 12px 0; }
.ide-editor-preview .md-preview strong { color: var(--text-primary); font-weight: 600; }
[data-theme="light"] .ide-editor-preview {
  background: #fafafa;
}
.ide-editor-textarea {
  flex: 1;
  border: none;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px 16px;
  resize: none;
  outline: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.ide-editor-textarea:focus {
  box-shadow: none;
}

.ide-statusbar {
  display: flex;
  align-items: center;
  padding: 3px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  gap: 16px;
  flex-shrink: 0;
}

.ide-statusbar span {
  white-space: nowrap;
}

#ide-status-modified {
  color: var(--warning);
  font-weight: 600;
}

/* ===== 底部终端面板 ===== */
.ide-terminal-panel {
  height: 180px;
  min-height: 30px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: height 0.2s;
}

.ide-terminal-panel.collapsed {
  height: 30px !important;
  overflow: hidden;
}

.ide-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  height: 30px;
}

.ide-terminal-tabs {
  display: flex;
  gap: 4px;
}

.ide-terminal-tab {
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ide-terminal-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ide-terminal-tab.active {
  background: var(--bg-primary);
  color: var(--accent-primary);
}

.ide-terminal-actions {
  display: flex;
  gap: 2px;
}

.ide-terminal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ide-terminal-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  background: var(--bg-primary);
}

.ide-terminal-line {
  white-space: pre-wrap;
  word-break: break-all;
  padding: 1px 0;
}

.ide-terminal-line.welcome {
  color: var(--accent-primary);
  font-weight: 600;
}

.ide-terminal-line.info {
  color: var(--text-muted);
}

.ide-terminal-line.command {
  color: var(--text-primary);
  font-weight: 500;
}

.ide-terminal-line.output {
  color: var(--text-secondary);
}

.ide-terminal-line.error {
  color: var(--error);
}

.ide-terminal-input-line {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.ide-terminal-prompt {
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 13px;
  margin-right: 8px;
  font-weight: 600;
}

.ide-terminal-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}

.ide-terminal-input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

/* 输出面板 */
.ide-output-content {
  flex: 1;
  overflow: auto;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin: 0;
  background: var(--bg-primary);
}

/* 问题面板 */
.ide-problems-content {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: var(--bg-primary);
}

.ide-problems-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* 右键菜单 */
.ide-context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  z-index: 9999;
  min-width: 140px;
  padding: 4px 0;
}

.ide-context-item {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
}

.ide-context-item i {
  width: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.ide-context-item:hover {
  background: var(--bg-hover);
}

.ide-context-item-danger {
  color: var(--error);
}

.ide-context-item-danger i {
  color: var(--error);
}

.ide-context-item-danger:hover {
}
.ide-context-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}
  background: rgba(248, 113, 113, 0.1);


/* 搜索结果 */
.ide-search-results-header {
  padding: 8px 12px 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ide-tree-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.ide-tree-error {
  padding: 20px;
  text-align: center;
  color: var(--error);
  font-size: 13px;
}

/* 亮色主题适配 */
[data-theme="light"] .ide-sidebar {
  background: var(--bg-secondary);
}

[data-theme="light"] .ide-terminal-content {
  background: #f8f8fc;
}

[data-theme="light"] .ide-sidebar-search {
  background: var(--bg-input);
}

[data-theme="light"] .ide-context-menu {
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 编辑器焦点高亮 */
.ide-editor-textarea:focus {
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}
/* ===== CodeMirror 编辑器容器 ===== */
.ide-codemirror-wrapper {
  flex: 1;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
}

.ide-codemirror-wrapper .CodeMirror {
  height: 100% !important;
  width: 100% !important;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.ide-codemirror-wrapper .CodeMirror-scroll {
  min-width: 0;
}

/* ★ 修复：CodeMirror 每行代码是 pre 元素，被全局 [data-theme="dark"] pre 的
   border-top/bottom 命中导致"每一行都有边线"，这里显式清除 */
.ide-codemirror-wrapper .CodeMirror pre,
.ide-codemirror-wrapper .CodeMirror-line,
.ide-codemirror-wrapper .CodeMirror-code pre {
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* 深色主题 CodeMirror 覆盖 */
[data-theme="light"] .ide-codemirror-wrapper .CodeMirror {
  background: #fafafa;
  color: #333;
}

[data-theme="light"] .ide-codemirror-wrapper .CodeMirror-gutters {
  background: #f0f0f0;
  border-right: 1px solid #ddd;
}

[data-theme="light"] .ide-codemirror-wrapper .CodeMirror-cursor {
  border-left: 2px solid #333;
}

[data-theme="light"] .ide-codemirror-wrapper .CodeMirror-selected {
  background: #b3d4fc;
}

/* ===== AI 代码补全浮层 ===== */
.ide-ai-complete-overlay {
  position: absolute;
  bottom: 40px;
  right: 20px;
  width: 480px;
  max-height: 300px;
  background: var(--bg-card);
  border: 1px solid var(--accent-primary);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.ide-ai-complete-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.ide-ai-complete-header .btn-icon-xs {
  margin-left: auto;
  color: rgba(255,255,255,0.7);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}

.ide-ai-complete-header .btn-icon-xs:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.ide-ai-complete-content {
  flex: 1;
  overflow: auto;
  padding: 12px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg-primary);
  max-height: 200px;
}

.ide-ai-complete-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-color);
  justify-content: flex-end;
}

/* ===== 编辑器顶部工具栏 ===== */
.ide-editor-toolbar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  gap: 2px;
  flex-shrink: 0;
  height: 34px;
}

.ide-editor-toolbar .btn-icon-sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

/* ===== 文件内搜索栏 ===== */
.ide-file-search-bar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
  gap: 6px;
  flex-shrink: 0;
}

.ide-file-search-bar input {
  flex: 1;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  outline: none;
}

.ide-file-search-bar input:focus {
  border-color: var(--accent-primary);
}

.ide-file-search-bar span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== ide-editor 整体布局调整 ===== */
.ide-editor {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
}

/* ===== 单文件搜索结果高亮 ===== */
/* ★ 2026-08-15 修复：WebIDE 页面占满主区域，移除 .page 默认 padding/overflow，
   修复 .ide-editor-preview 高度链断裂导致 MD 预览无法滚动的问题 */
#page-ide.page {
  padding: 0 !important;
  overflow: hidden !important;
}
#page-ide.page.active {
  display: flex;
  flex-direction: column;
}
#page-ide .ide-container {
  flex: 1;
  height: auto;
  min-height: 0;
}

.ide-search-highlight {
  background: rgba(255, 255, 0, 0.3);
  border-radius: 2px;
}

[data-theme="light"] .ide-search-highlight {
  background: rgba(255, 200, 0, 0.5);
}

/* ===== 对话总结面板 ===== */
.summary-msg {
  margin: 8px 16px !important;
  padding: 8px 12px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--accent-primary) !important;
  border-radius: 8px !important;
  opacity: 0.95;
}

.summary-text {
  font-size: 12px !important;
  color: var(--text-secondary) !important;
  line-height: 1.5 !important;
}

.summary-text h1, .summary-text h2, .summary-text h3 {
  font-size: 13px !important;
  color: var(--accent-primary) !important;
  margin: 4px 0 !important;
}

/* ===== 用户详情弹窗修复 ===== */
#user-profile-modal .modal-content {
  max-width: 360px !important;
}

#user-profile-modal .profile-info-value {
  font-size: 14px;
  padding: 6px 0;
  color: var(--text-primary);
}

/* ===== 头像下拉菜单修复 ===== */
.user-dropdown.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;

/* ===== 消息Markdown增强样式（高优先级，放在最后确保覆盖） ===== */
.chat-messages .message .message-content .message-text {
  line-height: 1.75;
  font-size: 14.5px;
}
.chat-messages .message .message-content .message-text h1,
.chat-messages .message .message-content .message-text h2,
.chat-messages .message .message-content .message-text h3,
.chat-messages .message .message-content .message-text h4 {
  margin-top: 22px !important;
  margin-bottom: 10px !important;
  font-weight: 650 !important;
  line-height: 1.3;
}
.chat-messages .message .message-content .message-text p {
  margin-top: 4px !important;
  margin-bottom: 10px !important;
}
.chat-messages .message .message-content .message-text ul,
.chat-messages .message .message-content .message-text ol {
  padding-left: 28px !important;
  margin-top: 6px !important;
  margin-bottom: 10px !important;
}
.chat-messages .message .message-content .message-text li {
  margin-bottom: 5px !important;
  line-height: 1.65;
}
.chat-messages .message .message-content .message-text blockquote {
  margin-top: 10px !important;
  margin-bottom: 10px !important;
  padding: 8px 16px !important;
}
.chat-messages .message .message-content .message-text pre {
  margin-top: 10px !important;
  margin-bottom: 14px !important;
}
.chat-messages .message .message-content .message-text hr {
  margin-top: 18px !important;
  margin-bottom: 18px !important;
}
.chat-messages .message .message-content .message-text table {
  margin-top: 10px !important;
  margin-bottom: 14px !important;
}
}
/* ===== 日志监控页面样式 ===== */
/* ===== 监控面板布局：上下结构 ===== */
/* 顶部：监控卡片（水平自适应排列） */
/* 底部：日志面板（全宽，高度受限） */
.monitor-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  box-sizing: border-box;
}

.monitor-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  flex-shrink: 1;
}

.monitor-row-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.monitor-row-bottom {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.monitor-right {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 45vh;
  min-height: 200px;
  overflow: hidden;
  box-sizing: border-box;
  flex-shrink: 0;
}

.card {
  background: var(--card-bg, #1e1e2e);
  border-radius: 8px;
  border: 1px solid var(--border-color, #2d2d3d);
  overflow: hidden;
}

.card-header {
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color, #2d2d3d);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.card-body {
  padding: 14px;
}

.stats-grid.mini {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card.mini {
  text-align: center;
  padding: 10px;
  background: var(--bg-secondary, #16162a);
  border-radius: 6px;
}

.stat-card.mini .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent, #6c5ce7);
}

.stat-card.mini .stat-label {
  font-size: 11px;
  color: var(--text-secondary, #888);
  margin-top: 4px;
}

.chart-container {
  background: var(--bg-secondary, #16162a);
  border-radius: 6px;
  padding: 8px;
  margin-top: 8px;
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.progress-label {
  font-size: 12px;
  color: var(--text-secondary, #888);
  min-width: 80px;
}

.progress-bar {
  flex: 1;
  height: 20px;
  background: var(--bg-secondary, #16162a);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6c5ce7, #a29bfe);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

.table.compact {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table.compact th, .table.compact td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #2d2d3d);
}

.table.compact th {
  font-weight: 600;
  color: var(--text-secondary, #888);
  font-size: 11px;
  text-transform: uppercase;
}

/* 日志面板 */
.log-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
}

.log-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--bg-secondary, #0d0d1a);
  max-height: calc(45vh - 50px);
  min-height: 120px;
  width: 100%;
  max-width: 100%;
  word-break: break-all;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  box-sizing: border-box;
}

.log-entry {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  word-break: break-all;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

.log-entry .log-time {
  color: var(--text-secondary, #666);
  margin-right: 8px;
  font-size: 11px;
}

.log-entry .log-level {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 6px;
  min-width: 48px;
  text-align: center;
}

.log-level-ERROR { color: #ff4757; background: rgba(255,71,87,0.15); }
.log-level-WARN  { color: #ffa502; background: rgba(255,165,2,0.15); }
.log-level-INFO  { color: #2ed573; background: rgba(46,213,115,0.15); }
.log-level-DEBUG { color: #747d8c; background: rgba(116,125,140,0.15); }

.log-entry .log-msg {
  color: var(--text-primary, #ccc);
  word-break: break-all;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  display: inline;
}

.log-placeholder {
  color: var(--text-secondary, #666);
  text-align: center;
  padding: 40px;
  font-style: italic;
}

/* 日志过滤控件 */
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
}

#log-level-filter {
  background: var(--bg-secondary, #16162a);
  color: var(--text-primary, #ccc);
  border: 1px solid var(--border-color, #2d2d3d);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  margin-left: 8px;
}

/* 总结永久显示 */
.persistent-summary {
  border-left: 3px solid #a29bfe !important;
  background: rgba(108,92,231,0.08) !important;
}

.persistent-summary .message-header {

}

/* ===== Plan Task 规划器样式 ===== */
/* 顶部规划面板（折叠在输入框上方） */
#plan-task-panel-top {
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
}
#plan-task-panel-top .plan-task-panel {
  margin: 0;
}
#plan-task-panel-top .plan-task-body {
  padding: 10px 14px;
  max-height: 220px;
  overflow-y: auto;
}
.plan-task-panel {
  background: linear-gradient(135deg, rgba(108,92,231,0.08), rgba(162,155,254,0.05));
  border: 1px solid rgba(108,92,231,0.2);
  border-radius: 12px;
  margin: 8px 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.plan-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(108,92,231,0.1);
  cursor: pointer;
  user-select: none;
}

.plan-task-header:hover {
  background: rgba(108,92,231,0.15);
}

.plan-task-header .plan-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary, #6c5ce7);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-task-header .plan-title i {
  font-size: 16px;
}

.plan-task-header .plan-badge {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(108,92,231,0.2);
  color: var(--accent-primary, #6c5ce7);
  font-weight: 500;
}

.plan-task-body {
  padding: 12px 16px;
}

.plan-step-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.plan-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.plan-step-item:hover {
  background: rgba(255,255,255,0.06);
}

.plan-step-item .step-index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(108,92,231,0.15);
  color: var(--accent-primary, #6c5ce7);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.plan-step-item .step-content {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary, #e0e0e0);
  line-height: 1.5;
}

.plan-step-item .step-status {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.plan-step-item.step-pending {
  opacity: 0.6;
}

.plan-step-item.step-active {
  border-color: rgba(108,92,231,0.3);
  background: rgba(108,92,231,0.08);
}

.plan-step-item.step-active .step-index {
  background: var(--accent-primary, #6c5ce7);
  color: #fff;
  animation: stepPulse 1.5s infinite;
}

.plan-step-item.step-done {
  opacity: 0.85;
}

.plan-step-item.step-done .step-index {
  background: rgba(0,200,83,0.2);
  color: #00c853;
}

.plan-step-item.step-failed .step-index {
  background: rgba(255,82,82,0.2);
  color: #ff5252;
}

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108,92,231,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(108,92,231,0); }
}

.plan-result {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(0,200,83,0.06);
  border: 1px solid rgba(0,200,83,0.15);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary, #e0e0e0);
}

.plan-error {
  background: rgba(255,82,82,0.06);
  border-color: rgba(255,82,82,0.15);
  color: #ff5252;
}

.plan-progress-bar {
  display: flex;
  gap: 4px;
  margin: 8px 0;
  padding: 0 4px;
}

.plan-progress-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(108,92,231,0.15);
  transition: all 0.3s;
}

.plan-progress-step.done {
  background: var(--accent-primary, #6c5ce7);
}

.plan-progress-step.active {
  background: var(--accent-primary, #6c5ce7);
  animation: progressPulse 1s infinite;
}

.plan-progress-step.failed {
  background: #ff5252;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 暗色主题适配 */
[data-theme="dark"] .plan-step-item {
  background: rgba(255,255,255,0.03);
}
[data-theme="dark"] .plan-step-item:hover {
  background: rgba(255,255,255,0.06);
}
/* ★ 2026-08-12 暗色模式完整兜底：确保dark下关键组件绝对深色（杜绝浅色残留） */
[data-theme="dark"] body,
[data-theme="dark"] .app-container,
[data-theme="dark"] .main-content,
[data-theme="dark"] .chat-main,
[data-theme="dark"] .chat-sidebar,
[data-theme="dark"] .ide-sidebar,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .toast,
[data-theme="dark"] .user-dropdown,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .sidebar-footer,
[data-theme="dark"] .chat-input-wrapper,
[data-theme="dark"] .chat-input-area textarea {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .chat-sidebar,
[data-theme="dark"] .sidebar {
  background-color: var(--bg-secondary) !important;
}
[data-theme="dark"] .message.assistant .message-content {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .message.user .message-content {
  background: rgba(108, 99, 255, 0.15) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .conversation-item {
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .conversation-item.active {
  background: rgba(108, 99, 255, 0.12) !important;
  color: var(--accent-primary) !important;
}
[data-theme="dark"] pre,
[data-theme="dark"] pre code,
[data-theme="dark"] .result-pre,
[data-theme="dark"] .config-pre {
  background-color: rgba(0,0,0,0.4) !important;
  color: #e8e8f0 !important;
}
[data-theme="dark"] .chat-input {
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15) !important;
}

.code-header {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  background: rgba(108,92,231,0.12);
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #a29bfe;
}

/* 响应式 - 监控面板（上下结构：顶部卡片，底部日志） */
@media (max-width: 1200px) {
  .monitor-left {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
  }
  .monitor-right {
    max-height: 40vh;
    min-height: 180px;
  }
  .log-container {
    min-height: 100px;
    max-height: calc(40vh - 50px);
    font-size: 11px;
  }
}

@media (max-width: 900px) {
  .monitor-grid {
    gap: 12px;
    padding: 12px;
  }
  .monitor-left {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .monitor-right {
    max-height: 40vh;
    min-height: 160px;
  }
  .log-container {
    min-height: 90px;
    max-height: calc(40vh - 50px);
  }
}

@media (max-width: 600px) {
  .monitor-grid {
    padding: 6px;
    gap: 8px;
  }
  .monitor-left {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .monitor-right {
    max-height: 35vh;
    min-height: 120px;
  }
  .log-container {
    min-height: 70px;
    max-height: calc(35vh - 50px);
    font-size: 10px;
    padding: 4px 6px;
  }
  .card-body {
    padding: 8px;
  }
  .stats-grid.mini {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .stat-card.mini {
    padding: 6px;
  }
  .stat-card.mini .stat-value {
    font-size: 16px;
  }
}

/* 超宽屏 - 可适当增加日志面板高度 */
@media (min-width: 1600px) {
  .monitor-right {
    max-height: 50vh;
    min-height: 250px;
  }
  .log-container {
    max-height: calc(50vh - 50px);
    min-height: 180px;
  }
}

/* 防止卡片内容溢出 */
.monitor-left .card,
.monitor-right .card {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.monitor-left .card-body,
.monitor-right .card-body {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}



/* ===== 实时协作看板 ===== */
.collab-board {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  min-height: 300px;
}

.board-column {
  display: flex;
  flex-direction: column;
}

.board-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
}

.board-card-header {
  background: var(--bg-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-card-body {
  padding: 12px;
  max-height: 320px;
  overflow-y: auto;
}

.board-message-flow {
  max-height: 320px;
  overflow-y: auto;
}

/* 任务树节点 */
.task-tree-node {
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 6px;
  border-left: 3px solid #337ab7;
  background: var(--card-bg);
  font-size: 13px;
  transition: all 0.2s;
}

.task-tree-node:hover {
  background: var(--hover-bg);
}

.task-tree-node.pending { border-left-color: #f0ad4e; }
.task-tree-node.running { border-left-color: #337ab7; background: rgba(51,122,183,0.08); }
.task-tree-node.completed { border-left-color: #5cb85c; }
.task-tree-node.failed { border-left-color: #d9534f; }

.task-tree-node .task-status {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

.task-tree-node .task-agent {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 6px;
}

/* Agent状态卡片(小) */
.agent-mini-card {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 6px;
  background: var(--card-bg);
  gap: 8px;
  font-size: 13px;
  transition: all 0.2s;
}

.agent-mini-card:hover {
  background: var(--hover-bg);
}

.agent-mini-card .mini-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agent-mini-card .mini-status.idle { background: #5cb85c; }
.agent-mini-card .mini-status.busy { background: #f0ad4e; animation: pulse 1s infinite; }
.agent-mini-card .mini-status.offline { background: #999; }

.agent-mini-card .mini-name {
  font-weight: 500;
  flex: 1;
}

.agent-mini-card .mini-role {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 1px 6px;
  background: var(--bg-primary);
  border-radius: 10px;
}

.agent-mini-card .mini-progress {
  font-size: 11px;
  color: var(--text-secondary);
}

/* 消息流条目 */
.flow-message {
  padding: 6px 8px;
  margin: 3px 0;
  border-radius: 4px;
  font-size: 12px;
  background: var(--card-bg);
  border-left: 2px solid #5bc0de;
  animation: slideIn 0.3s ease;
}

.flow-message.task { border-left-color: #337ab7; }
.flow-message.result { border-left-color: #5cb85c; }
.flow-message.error { border-left-color: #d9534f; }
.flow-message.info { border-left-color: #5bc0de; }

.flow-message .flow-time {
  font-size: 10px;
  color: var(--text-secondary);
  margin-right: 6px;
}

.flow-message .flow-sender {
  font-weight: 600;
  margin-right: 4px;
}

.flow-message .flow-target {
  color: var(--text-secondary);
  margin: 0 4px;
}

.flow-message .flow-content {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 移动端适配 */
@media (max-width: 900px) {
  .collab-board { grid-template-columns: 1fr; }
}

/* ============================================
   超智能体3.0 - 前端拟人化增强
   ============================================ */

/* ===== 3D粒子背景画布 ===== */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* ===== 主内容区域z-index提升 ===== */
/* ★ 修复：仅提升 .main-content 的 z-index（保证显示在粒子画布之上）。
   原先同时给 .sidebar/.mobile-hamburger 设置 position:relative，因位于
   文件末尾、同特异性下覆盖了移动端媒体查询中的 position:fixed，
   导致手机端侧边栏占据文档流、把聊天界面挤出屏幕（y>视口高度）。 */
.main-content {
  position: relative;
  z-index: 10;
}


/* ===== 动态头像呼吸光晕 ===== */
.message-avatar.assistant {
  position: relative;
  animation: avatarGlow 3s ease-in-out infinite;
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.15);
}
.message-avatar.assistant i {
  animation: avatarIconFloat 3s ease-in-out infinite;
}
@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(74, 222, 128, 0.1); }
  50% { box-shadow: 0 0 25px rgba(74, 222, 128, 0.3); }
}
@keyframes avatarIconFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.05); }
}

/* ===== 消息气泡入场动画 ===== */
.message {
  animation: messageSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  animation-fill-mode: forwards;
}
.message.user { animation-delay: 0.05s; }
.message.assistant { animation-delay: 0.1s; }
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== AI消息渐变边框 ===== */
.message.assistant .message-content {
  position: relative;
  border: 1px solid rgba(74, 222, 128, 0.08);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.05), rgba(34, 211, 238, 0.05), var(--bg-card));
}
.message.assistant .message-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #4ade80, #22d3ee, transparent);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  opacity: 0.6;
}

/* ===== 打字光标增强 ===== */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 18px;
  background: var(--accent-primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blinkCursor 0.8s steps(2) infinite;
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(108, 99, 255, 0.6);
}
@keyframes blinkCursor {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== 流式输出打字效果 ===== */
.streaming-message-text {
  border-right: 2px solid var(--accent-primary);
  animation: typingBlink 0.8s steps(2) infinite;
  padding-right: 4px;
}
@keyframes typingBlink {
  0%, 100% { border-color: var(--accent-primary); }
  50% { border-color: transparent; }
}

/* ===== 思考中动画增强 ===== */
.streaming-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.streaming-placeholder::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: thinkingDot 1.2s ease-in-out infinite;
  margin-left: 4px;
}
@keyframes thinkingDot {
  0%, 100% { transform: scale(0.3); opacity: 0.3; }
  50% { transform: scale(1); opacity: 1; }
}

/* ===== 发送按钮微动效 ===== */
#chat-send-btn {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#chat-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(108, 99, 255, 0.4);
}
#chat-send-btn:active {
  transform: scale(0.9);
}

/* ===== 消息时间戳淡入 ===== */
.message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.message:hover .message-time {
  opacity: 1;
}

/* ===== 输入框科技感聚焦 ===== */
#chat-input:focus {
  box-shadow: 0 0 20px rgba(108, 99, 255, 0.15);
  border-color: var(--accent-primary) !important;
}

/* ===== 表情反馈浮层 ===== */
.reaction-float {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 64px;
  z-index: 9999;
  pointer-events: none;
  animation: reactionPop 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes reactionPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(0.8); opacity: 0; }
}

/* ===== AI状态指示器 ===== */
.ai-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.12);
  transition: all 0.3s ease;
}
.ai-status-indicator.online {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.1);
}
.ai-status-indicator .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: statusDotPulse 2s ease-in-out infinite;
}
@keyframes statusDotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

/* ===== 系统自检仪表盘 ===== */
.health-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding: 0 20px;
}
.health-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all 0.3s ease;
  cursor: default;
}
.health-card:hover {
  border-color: rgba(108, 99, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}
.health-card[data-status="ok"] { border-left: 3px solid #4ade80; }
.health-card[data-status="warning"] { border-left: 3px solid #fbbf24; }
.health-card[data-status="error"] { border-left: 3px solid #f87171; }
.health-card[data-status="loading"] { border-left: 3px solid var(--text-muted); }
.health-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(108, 99, 255, 0.1);
  color: var(--accent-primary);
  flex-shrink: 0;
}
.health-info { flex: 1; min-width: 0; }
.health-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.health-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.health-badge {
  font-size: 24px;
  flex-shrink: 0;
}

/* ============================================
   3D数字人面板 - AI虚拟助手
   ============================================ */
.digital-human-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 220px;
  height: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card), 0 0 40px rgba(108, 99, 255, 0.08);
  overflow: hidden;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}
.digital-human-panel:hover {
  box-shadow: var(--shadow-card), 0 0 60px rgba(108, 99, 255, 0.15);
  border-color: rgba(108, 99, 255, 0.3);
}
.digital-human-panel.collapsed {
  height: 40px;
  width: 180px;
}
.digital-human-panel.collapsed .dh-canvas-wrapper {
  opacity: 0;
  pointer-events: none;
  height: 0;
}

.dh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(108, 99, 255, 0.1);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  cursor: move;
  user-select: none;
  min-height: 40px;
}
.dh-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dh-title i {
  font-size: 14px;
}
.dh-controls {
  display: flex;
  gap: 4px;
}
.dh-toggle-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s;
}
.dh-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dh-canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  background: radial-gradient(ellipse at center, #1a1a3e 0%, #0f0f1a 100%);
}
#dh-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 状态指示器 */
.dh-status-overlay {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 10px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.dh-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: dhPulse 2s infinite;
}
.dh-status-dot.speaking {
  background: var(--accent-primary);
  animation: dhPulse 0.6s infinite;
}
.dh-status-dot.thinking {
  background: var(--warning);
  animation: dhPulse 0.8s infinite;
}
@keyframes dhPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* 语音气泡 */
.dh-speech-bubble {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 85%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-primary);
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  line-height: 1.4;
  border: 1px solid rgba(108, 99, 255, 0.2);
}
.dh-speech-bubble.show {
  opacity: 1;
}
.dh-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(0, 0, 0, 0.75);
}

/* 数字人面板拖拽时的光标 */
.digital-human-panel.dragging {
  opacity: 0.9;
  cursor: grabbing;
  transition: none;
}

/* ★ 响应式：小屏幕隐藏数字人面板，改用浮动语音条（avatar mode专属） */
@media (max-width: 900px) {
  .digital-human-panel {
    display: none !important;  /* 移动端默认隐藏，通过avatar-mode开关控制 */
  }
  /* 当avatar-mode激活时，显示精简版语音条替代全面板 */
  .chat-mode-avatar .avatar-mode-bar {
    display: flex;
  }
}
@media (max-width: 600px) {
  .chat-mode-avatar .avatar-mode-bar {
    top: 8px;
    right: 8px;
    left: 8px;
    padding: 6px 12px;
    gap: 6px;
    border-radius: 10px;
  }
  .chat-mode-avatar .avatar-mode-bar .amb-title {
    font-size: 11px;
  }
  .chat-mode-avatar .avatar-mode-bar .amb-wave {
    height: 16px;
  }
  .chat-mode-avatar .avatar-mode-bar .amb-wave span {
    width: 2px;
    height: 10px;
  }
}

/* ===== 3D数字人增强样式 ===== */

/* 聆听状态（语音输入） */
.dh-status-dot.listening {
  background: var(--info);
  animation: dhListenPulse 0.4s infinite;
}
@keyframes dhListenPulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 6px var(--info); }
  50% { opacity: 0.6; transform: scale(1.3); box-shadow: 0 0 12px var(--info); }
}

/* 错误状态 */
.dh-status-dot.error {
  background: var(--error);
  animation: none;
  box-shadow: 0 0 8px var(--error);
}

/* 状态文字 */
.dh-status-text {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 语音气泡 visible 类（兼容 .show） */
.dh-speech-bubble.visible {
  opacity: 1;
}

/* 数字人面板呼吸光晕动画 */
@keyframes dhAuraPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(108, 99, 255, 0.1); }
  50% { box-shadow: 0 0 40px rgba(108, 99, 255, 0.2); }
}
.digital-human-panel {
  animation: dhAuraPulse 3s ease-in-out infinite;
}

/* 折叠状态增强 */
.digital-human-panel.collapsed .dh-header {
  cursor: pointer;
}

/* 拖拽手柄提示 */
.dh-header::before {
  content: '⋮⋮';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.3;
  letter-spacing: 1px;
}

/* 面板展开/折叠过渡动画 */
#dh-canvas-wrapper {
  transition: opacity 0.3s ease, height 0.3s ease, max-height 0.3s ease;
}

/* ============================================
   聊天双模式切换系统
   ============================================ */

/* ★ 模式切换按钮 */
.chat-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.chat-mode-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(108, 99, 255, 0.08);
}
.chat-mode-toggle i {
  font-size: 13px;
}
.chat-mode-toggle .toggle-label {
  font-size: 11px;
  font-weight: 500;
}

/* ============================================
   Avatar Mode - 浮动语音条（移动端替代面板）
   ============================================ */
.avatar-mode-bar {
  display: none;  /* 默认隐藏，avatar-mode时显示 */
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 20px;
  box-shadow: var(--shadow-card), 0 0 40px rgba(108, 99, 255, 0.08);
  backdrop-filter: blur(12px);
  align-items: center;
  gap: 10px;
  max-width: 90%;
  transition: all 0.3s ease;
  animation: slideDownBar 0.3s ease;
}
@keyframes slideDownBar {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.avatar-mode-bar .amb-avatar-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  animation: ambPulse 3s ease-in-out infinite;
}
@keyframes ambPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(108, 99, 255, 0.3); }
  50% { box-shadow: 0 0 20px rgba(108, 99, 255, 0.6); }
}
.avatar-mode-bar .amb-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
  white-space: nowrap;
}
.avatar-mode-bar .amb-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}
.avatar-mode-bar .amb-wave span {
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent-primary);
  border-radius: 2px;
  animation: ambWave 1.2s ease-in-out infinite;
}
.avatar-mode-bar .amb-wave span:nth-child(2) { animation-delay: 0.2s; height: 16px; }
.avatar-mode-bar .amb-wave span:nth-child(3) { animation-delay: 0.4s; height: 20px; }
.avatar-mode-bar .amb-wave span:nth-child(4) { animation-delay: 0.6s; height: 14px; }
.avatar-mode-bar .amb-wave span:nth-child(5) { animation-delay: 0.8s; height: 10px; }
@keyframes ambWave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}
.avatar-mode-bar .amb-status {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}
.avatar-mode-bar .amb-mic-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.avatar-mode-bar .amb-mic-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(108, 99, 255, 0.4);
}
.avatar-mode-bar .amb-mic-btn.recording {
  background: var(--error);
  animation: ambMicPulse 0.6s ease-in-out infinite;
}
@keyframes ambMicPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 20px rgba(248, 113, 113, 0.8); }
}
.avatar-mode-bar .amb-speech-bubble {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  border: 1px solid rgba(108, 99, 255, 0.2);
}
.avatar-mode-bar .amb-speech-bubble.show {
  opacity: 1;
}
.avatar-mode-bar .amb-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(0, 0, 0, 0.75);
}

/* ============================================
   传统聊天模式 - 全屏聊天
   ============================================ */
.chat-mode-traditional .digital-human-panel {
  display: none !important;
}
.chat-mode-traditional .avatar-mode-bar {
  display: none !important;
}

/* ============================================
   Toast通知 - 确保不挤压布局
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}
.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-card), 0 0 20px rgba(0,0,0,0.2);
  animation: toastSlideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 400px;
  word-break: break-word;
}
.toast.success { background: rgba(74, 222, 128, 0.2); border: 1px solid rgba(74, 222, 128, 0.4); color: var(--success); }
.toast.error { background: rgba(248, 113, 113, 0.2); border: 1px solid rgba(248, 113, 113, 0.4); color: var(--error); }
.toast.info { background: rgba(96, 165, 250, 0.2); border: 1px solid rgba(96, 165, 250, 0.4); color: var(--info); }
.toast.warning { background: rgba(251, 191, 36, 0.2); border: 1px solid rgba(251, 191, 36, 0.4); color: var(--warning); }
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   移动端响应式覆盖
   ============================================ */
@media (max-width: 768px) {
  .chat-mode-toggle .toggle-label {
    display: none;  /* 移动端只显示图标 */
  }
  .chat-mode-toggle {
    padding: 4px 8px;
  }
  /* 移动端toast位置调整 */
  .toast-container {
    top: 12px;
    right: 12px;
    left: auto;
    max-width: 280px;
  }
  .toast {
    font-size: 12px;
    padding: 10px 14px;
  }
  /* 确保chat-layout在移动端不溢出 */
  .chat-layout {
    max-width: 100vw;
    overflow: hidden;
  }
  .chat-main {
    max-width: 100%;
    overflow-x: hidden;
  }
  .chat-messages {
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 600px) {
  .avatar-mode-bar {
    padding: 6px 14px;
    gap: 6px;
    top: 8px;
    border-radius: 16px;
  }
  .avatar-mode-bar .amb-avatar-icon {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
  .avatar-mode-bar .amb-title {
    font-size: 10px;
  }
  .avatar-mode-bar .amb-wave {
    height: 14px;
  }
  .avatar-mode-bar .amb-wave span {
    width: 2px;
    height: 8px;
  }
  .avatar-mode-bar .amb-wave span:nth-child(2) { height: 12px; }
  .avatar-mode-bar .amb-wave span:nth-child(3) { height: 14px; }
  .avatar-mode-bar .amb-wave span:nth-child(4) { height: 10px; }
  .avatar-mode-bar .amb-wave span:nth-child(5) { height: 8px; }
  .avatar-mode-bar .amb-status {
    font-size: 10px;
    max-width: 60px;
  }
  .avatar-mode-bar .amb-mic-btn {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
}


/* ============================================
   小屏幕布局修复 — 确保聊天区始终可见
   ============================================ */
@media (max-width: 768px) {
  /* 移动端主题内容区域全屏宽度 */
  .main-content {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }
  /* 聊天布局占满全屏 */
  .chat-layout {
    width: 100%;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
  }
  .chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
  }
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
  }
  .chat-input-area {
    flex-shrink: 0;
    padding: 8px 12px 12px;
  }
  .chat-input-wrapper {
    gap: 4px;
  }
  .chat-input {
    font-size: 16px;
    min-height: 40px;
  }
  /* 修复avatar-mode-bar不遮挡输入框 */
  .avatar-mode-bar {
    z-index: 9999;
  }
}

/* 极端小屏（≤480px）额外修复 */
@media (max-width: 480px) {
  .chat-messages {
    min-height: 150px;
    padding: 8px;
  }
  .chat-input-area {
    padding: 6px 8px 10px;
  }
  .chat-input {
    min-height: 36px;
    padding: 4px 6px;
  }
}

/* ===== 移动端悬浮主题切换按钮（2026-08-09 新增） ===== */
.mobile-theme-btn {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 17px;
  cursor: pointer;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  -webkit-tap-highlight-color: transparent;
}
.mobile-theme-btn:hover { background: var(--bg-hover); }
.mobile-theme-btn:active { transform: scale(0.92); }

@media (max-width: 768px) {
  .mobile-theme-btn { display: flex; }
}

/* ★ 2026-08-10 新增：手机端会话历史抽屉按钮（聊天页左上角） */

/* ============================================
   ★ 2026-08-13 多窗口 tab 栏样式 + 自定义确认弹窗
   ============================================ */

/* ---- 多窗口 tab 栏 ---- */
.chat-window-tabbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.chat-window-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
}
.chat-window-tabs::-webkit-scrollbar { height: 4px; }
.chat-window-tabs::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.chat-window-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.2s;
  max-width: 200px;
}
.chat-window-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.chat-window-tab.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.chat-window-tab.active .chat-window-title { color: #fff; }
.chat-window-tab.main { border-style: dashed; }
.chat-window-tab.main.active { border-style: solid; }

.chat-window-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  color: inherit;
}
.chat-window-tab.active .chat-window-badge {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

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

.chat-window-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s;
}
.chat-window-close:hover {
  background: var(--error);
  color: #fff;
  opacity: 1;
}

.chat-window-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.chat-window-add:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}

/* ---- 自定义确认弹窗 ---- */
.confirm-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  animation: confirmFadeIn 0.2s ease;
}
.confirm-dialog {
  width: 360px;
  max-width: calc(100vw - 40px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card), 0 0 40px rgba(108,99,255,0.15);
  padding: 20px 22px;
  animation: confirmSlideIn 0.25s ease;
}
.confirm-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 22px;
  background: rgba(248,113,113,0.12);
  color: var(--error);
}
.confirm-title {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.confirm-message {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 18px;
  word-break: break-word;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.confirm-actions .btn {
  flex: 1;
  justify-content: center;
}
.confirm-actions .btn-cancel {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.confirm-actions .btn-cancel:hover {
  background: rgba(255,255,255,0.12);
}
.confirm-actions .btn-danger-solid {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 15px rgba(231,76,60,0.3);
}
.confirm-actions .btn-danger-solid:hover {
  box-shadow: 0 6px 25px rgba(231,76,60,0.5);
  transform: translateY(-1px);
}

@keyframes confirmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes confirmSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   ★ 2026-08-13 规划中心左右分栏样式（左侧列表 + 右侧详情）
   ============================================================ */
.plan-center-body {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow: hidden;
}
.plan-tab-content-split {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.plan-center-list {
  width: 42%;
  min-width: 220px;
  border-right: 1px solid var(--border, #333);
  overflow-y: auto;
  flex-shrink: 0;
}
.plan-center-detail {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: rgba(0,0,0,0.08);
}
.plan-center-item {
  cursor: pointer;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bg-hover, rgba(255,255,255,0.06));
  transition: background 0.2s;
}
.plan-center-item:hover {
  background: var(--bg-hover, rgba(255,255,255,0.1));
}
.plan-center-item.active {
  background: rgba(64,158,255,0.15);
  border-left: 3px solid var(--accent-primary, #409eff);
}
.plan-center-item-done {
  opacity: 0.7;
}
.plan-center-step {
  padding: 6px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--bg-hover, rgba(255,255,255,0.06));
}
.plan-center-pct {
  font-size: 11px;
  color: var(--text-secondary, #999);
  white-space: nowrap;
}

/* ============================================================
/* ★ 2026-08-14 白天模式发送框样式修复
/*   原：发送按钮蓝紫色背景(#6c63ff) + 输入框区域偏蓝
/*   改：发送按钮改为深色渐变(白天更协调)，输入框白色背景 + 深色文字
/* ============================================================ */
[data-theme="light"] .chat-input-wrapper {
  background: #ffffff !important;
  border-color: #d8d8e4 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .chat-input-wrapper:focus-within {
  border-color: #9a94ff !important;
  box-shadow: 0 0 20px rgba(108, 99, 255, 0.12) !important;
}

[data-theme="light"] .chat-input {
  background: transparent !important;
  color: #2a2a3e !important;
  caret-color: #6c63ff !important;
}

[data-theme="light"] .chat-input::placeholder {
  color: #a0a0b8 !important;
}

[data-theme="light"] .chat-send-btn {
  background: linear-gradient(135deg, #3a3a52, #5a5a78) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .chat-send-btn:hover {
  background: linear-gradient(135deg, #2d2d42, #4a4a66) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="light"] .chat-send-btn:active {
  transform: scale(0.93) !important;
}

/* 清除按钮在白天模式下与发送框协调 */
[data-theme="light"] .chat-clear-btn,
[data-theme="light"] .chat-mic-btn,
[data-theme="light"] .chat-attach-btn {
  color: #5a5a7a !important;
  background: transparent !important;
}

/* 阻止浏览器自动填充导致的蓝色背景 */
[data-theme="light"] .chat-input:-webkit-autofill,
[data-theme="light"] .chat-input:-webkit-autofill:hover,
[data-theme="light"] .chat-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #2a2a3e !important;
  caret-color: #6c63ff !important;
  transition: background-color 9999s ease-in-out 0s !important;
}
