
/* ===== 全局重置 & 变量 ===== */
:root {
  --primary: #4f6ef7;
  --primary-hover: #3b5de7;
  --primary-light: #eef1ff;
  --primary-subtle: rgba(79,110,247,0.08);
  --bg: #f2eee8;
  --bg-card: #ffffff;
  --bg-soft: #f7f4ef;
  --sidebar-bg: linear-gradient(180deg, #1a1f2e 0%, #0f1422 100%);
  --sidebar-text: #8892a8;
  --sidebar-active: #4f6ef7;
  --sidebar-hover: rgba(255,255,255,0.06);
  --text: #1a1f2e;
  --text-secondary: #7f8c9b;
  --text-muted: #9aa4b2;
  --border: #e8ecf1;
  --border-light: #f0f2f6;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  display: flex;
  user-select: none;
}

/* 允许选中对话内容 */
.chat-messages, .message .bubble, .split-msgs, .db-side-msgs, .sq-msg, .sq-msg-sql { user-select: text; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,0.06);
  position: relative;
}
.sidebar-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-header h1 {
  background: linear-gradient(135deg, #fff 0%, #8892a8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.sidebar-header .subtitle {
  color: var(--sidebar-text);
  font-size: 11px;
  margin-top: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 500;
}
.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 14px;
  transition: all 0.2s ease;
  border-radius: var(--radius);
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--sidebar-hover); color: #d0d4e0; }
.nav-item.active {
  background: rgba(79,110,247,0.15);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--sidebar-active);
}
.nav-item .icon { font-size: 16px; width: 22px; text-align: center; display: inline-flex; align-items: center; justify-content: center; }
.nav-sub-item {
  margin-left: 14px;
  padding-left: 12px;
  font-size: 13px;
}
.nav-sub-item::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  bottom: 50%;
  width: 14px;
  border-left: 1px solid rgba(255,255,255,0.12);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  border-bottom-left-radius: 8px;
}

/* ===== 主题切换：Emoji ↔ Font Awesome ===== */
.icon-emoji { display: inline; }
.icon-fa { display: none; }
.theme-fa .icon-emoji { display: none; }
.theme-fa .icon-fa { display: inline; }

/* ===== FA 主题：黑白简约覆盖 ===== */
.theme-fa {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-soft: #fafafa;
  --border: #e5e5e7;
  --border-light: #ececf0;
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --text-muted: #a1a1a6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
}
/* FA 工具标签：灰白简约 */
.theme-fa .tp-tag {
  background: #f0f0f2 !important;
  color: #1d1d1f !important;
  border-color: #e0e0e2 !important;
}
.theme-fa .tp-tag:hover {
  background: #e5e5e7 !important;
  border-color: #ccc !important;
}
/* FA 阶段标签：灰色调 */
.theme-fa .phase-badge {
  border-color: #ddd !important;
}
.theme-fa .phase-thinking {
  background: #f5f5f5 !important;
  color: #555 !important;
}
.theme-fa .phase-tool {
  background: #eee !important;
  color: #333 !important;
}
.theme-fa .phase-result {
  background: #f0f0f0 !important;
  color: #222 !important;
}
.theme-fa .phase-error {
  background: #fff0f0 !important;
  color: #c00 !important;
}
.theme-fa .phase-knowledge {
  background: #f5f5f5 !important;
  color: #444 !important;
}
/* FA 统计卡片：简约 */
.theme-fa .stat-card {
  border-color: #e5e5e7 !important;
}
.theme-fa .stat-card .number {
  color: #1d1d1f !important;
}
.theme-fa .s-card {
  border-color: #e5e5e7 !important;
}
.theme-fa .s-card-number {
  color: #1d1d1f !important;
}
/* FA 统计卡片图标：去彩色渐变 → 灰白简约 */
.theme-fa .s-card-icon {
  background: #f0f0f2 !important;
  color: #555 !important;
  box-shadow: none !important;
  font-size: 18px !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
}
/* FA 筛选按钮：更中性的颜色 */
.theme-fa .filter-btn {
  background: #f5f5f7;
  border-color: #e5e5e7;
  color: #86868b;
}
.theme-fa .filter-btn:hover {
  background: #e5e5e7;
  border-color: #ccc;
  color: #1d1d1f;
}
.theme-fa .filter-btn.active {
  background: #1d1d1f;
  border-color: #1d1d1f;
  color: #fff;
  box-shadow: none;
}
/* FA 图例悬浮 */
.theme-fa .legend-item:hover {
  background: #f5f5f7;
}
/* FA 图表区 */
.theme-fa .stats-chart-card {
  border-color: #e5e5e7;
}
.theme-fa .chart-center-num {
  color: #1d1d1f;
}
/* FA 文档列表 */
.theme-fa .doc-item {
  border-color: #e5e5e7 !important;
}
/* FA 设置组 */
.theme-fa .settings-group {
  border-color: #e5e5e7 !important;
}
/* FA 页面标题底部阴影更淡 */
.theme-fa .page-header {
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
/* FA 思考面板简约 */
.theme-fa .thinking-panel {
  border-color: #e5e5e7;
}
.theme-fa .thinking-panel .tp-header {
  background: #f8f8f8;
  border-color: #e5e5e7;
}
/* FA 侧边栏文字更清淡 */
.theme-fa .sidebar {
  background: linear-gradient(180deg, #1a1a1f 0%, #121216 100%);
}
.theme-fa .sidebar-header h1 {
  background: linear-gradient(135deg, #fff 0%, #999 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* FA 消息气泡微调 */
.theme-fa .message.user .bubble {
  background: #1d1d1f;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.theme-fa .message.user .avatar {
  background: #1d1d1f !important;
}
.theme-fa .message.assistant .bubble {
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.theme-fa .message.assistant .avatar {
  background: #e5e5e7 !important;
  color: #333 !important;
}
/* FA 文件浏览 */
.theme-fa .fb-path-bar { border-color: #e5e5e7; }
.theme-fa .drive-btn { border-color: #e5e5e7 !important; }
/* FA 知识库搜索输入框 */
.theme-fa .kb-actions input {
  border-color: #e5e5e7;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--sidebar-active);
  color: #fff;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
}
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: var(--sidebar-text);
  text-align: center;
}
.sidebar-footer .status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  box-shadow: 0 0 6px rgba(46,204,113,0.4);
}
.sidebar-footer .status-dot.online { background: #2ecc71; }
.sidebar-footer .status-dot.offline { background: #e74c3c; box-shadow: 0 0 6px rgba(231,76,60,0.4); }

/* ===== 主内容区 ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.page { display: none; flex-direction: column; height: 100%; }
.page.active { display: flex; position: relative; }

/* ===== 页面标题栏 ===== */
.page-header {
  padding: 16px 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}
.page-header h2 { font-size: 18px; font-weight: 600; color: var(--text); }
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.talent-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 16px 24px 24px;
  background:
    linear-gradient(180deg, rgba(5, 150, 105, .08), transparent 220px),
    var(--bg);
}

/* ===== 聊天页面 ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
}
.chat-messages .empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}
.chat-messages .empty-state .big-icon { font-size: 56px; margin-bottom: 16px; }
.chat-messages .empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.chat-messages .empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto; line-height: 1.6; }

.message {
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}
.message .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  overflow: hidden;
}
.message .avatar .icon-fa { font-size: 18px; }
.message.user { flex-direction: row-reverse; }
.message.user .avatar { background: var(--primary); color: #fff; }
.message.assistant .avatar { background: #e8ecf1; color: #555; }
.message .bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}
.message.user .bubble {
  background: linear-gradient(135deg, var(--primary) 0%, #3b5de7 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(79,110,247,0.2);
}
.message.assistant .bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 20px;
  margin: 4px 0 4px 48px;
  animation: pulse 1.5s infinite;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.phase-thinking { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.phase-tool { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.phase-result { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.phase-error { background: #fce4ec; color: #c62828; border: 1px solid #f8bbd0; }
.phase-knowledge { background: #f3e5f5; color: #7b1fa2; border: 1px solid #e1bee7; }

/* 工具调用卡片 */
.tool-card {
  margin: 4px 0 4px 48px;
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: var(--radius);
  font-size: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.tool-card .tc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f0f4ff;
  border-bottom: 1px solid #e8ecf1;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}
.tool-card .tc-header .tc-icon { font-size: 14px; }
.tool-card .tc-header .tc-name { font-weight: 600; color: var(--primary); flex: 1; }
.tool-card .tc-header .tc-status { font-size: 11px; color: var(--text-secondary); }
.tool-card .tc-header .tc-toggle { color: #999; font-size: 10px; }
.tool-card .tc-body {
  padding: 8px 12px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  color: #555;
  background: #fff;
}
.tool-card .tc-body.collapsed { display: none; }
.tool-card.tc-running .tc-header { background: #fff8e1; }
.tool-card.tc-running .tc-status { color: #e65100; }
.tool-card.tc-error .tc-header { background: #fce4ec; }
.tool-card.tc-error .tc-status { color: #c62828; }

/* 消息复制按钮 */
.message { position: relative; }
.message .copy-btn {
  position: absolute; top: 8px; right: 8px;
  display: none; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer; font-size: 13px; color: var(--text-muted);
  z-index: 5;
}
.message:hover .copy-btn { display: flex; }
.message .copy-btn:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* === 新增：历史面板浮层 === */
.history-overlay { display:none; position:absolute; top:0; left:0; width:100%; height:100%; z-index:90; }
.history-overlay.open { display:flex; }
.history-backdrop { position:absolute; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.3); }
.history-content { position:relative; width:300px; height:100%; background:var(--bg-card); z-index:1; display:flex; flex-direction:column; box-shadow:2px 0 20px rgba(0,0,0,0.15); }
.history-content .ht-title { padding:12px 14px; border-bottom:1px solid var(--border); font-weight:600; font-size:13px; display:flex; justify-content:space-between; align-items:center; }
.history-content .ht-list { flex:1; overflow-y:auto; }
.ht-item { padding:10px 14px; cursor:pointer; border-bottom:1px solid #f5f5f5; font-size:13px; }
.ht-item:hover { background:var(--bg); }
.ht-item .ht-name { font-weight:500; }
.ht-item .ht-time { font-size:11px; color:var(--text-secondary); margin-top:2px; }

/* ===== 技能面板 ===== */
.skill-panel { display:none; position:absolute; top:0; left:0; width:100%; height:100%; z-index:91; }
.skill-panel.open { display:flex; }
.skill-panel-backdrop { position:absolute; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.3); }
.skill-panel-content { position:absolute; right:0; top:0; width:380px; height:100%; background:var(--bg-card); z-index:1; display:flex; flex-direction:column; box-shadow:-2px 0 20px rgba(0,0,0,0.15); }
.skill-panel-header { padding:14px 16px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.skill-panel-header h3 { margin:0; font-size:15px; font-weight:600; }
.skill-panel-body { flex:1; overflow-y:auto; padding:10px 12px; position:relative; display:grid; grid-template-columns:1fr 1fr; gap:6px; align-content:start; align-items:start; }
.skill-card { padding:8px 10px; margin:0; border:1px solid var(--border); border-radius:var(--radius); transition:0.15s; }
.skill-card:hover { border-color:var(--primary); }
.skill-card.active { border-color:var(--success); background:#e8f5e9; }
.skill-card-name { font-size:12px; font-weight:600; color:var(--text); display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 4px; }
.skill-card-name .active-badge { display:none; font-size:10px; background:var(--success); color:#fff; padding:0 5px; border-radius:3px; margin-left:4px; font-weight:400; }
.skill-card.active .skill-card-name .active-badge { display:inline; }
.skill-card-toggle { font-size:11px; color:var(--text-secondary); cursor:pointer; padding:2px 0; user-select:none; }
.skill-card-toggle:hover { color:var(--primary); }
.skill-card-toggle .toggle-arrow { font-size:10px; margin-right:2px; }
.skill-card-desc { display:none; font-size:11px; color:var(--text-secondary); margin:2px 0 4px; line-height:1.4; }
.skill-popup { position:fixed; z-index:999; max-width:340px; padding:8px 10px; background:#fff; border:1px solid var(--border); border-radius:6px; font-size:11px; line-height:1.5; color:var(--text); box-shadow:0 4px 16px rgba(0,0,0,0.12); }
.skill-card-actions { display:flex; gap:4px; }
.skill-card-actions .btn { font-size:10px; padding:2px 8px; }
.skill-section-title { font-size:11px; font-weight:600; color:var(--text-secondary); padding:4px 0 2px; margin-top:2px; border-bottom:1px solid var(--border-light); grid-column:1/-1; }
.skill-section-title:first-child { padding-top:0; margin-top:0; }
.skill-presets { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:4px; padding:0 0 6px; margin-bottom:4px; border-bottom:1px solid var(--border-light); }
.skill-preset-btn { padding:3px 8px; font-size:10px; border:1px solid var(--border); border-radius:12px; background:var(--bg-card); color:var(--text-secondary); cursor:pointer; white-space:nowrap; transition:all 0.12s; font-family:inherit; }
.skill-preset-btn:hover { border-color:var(--primary); color:var(--primary); background:var(--primary-light); }
.skill-preset-btn.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.skill-preset-btn.partial { border-color:var(--primary); color:var(--primary); background:var(--primary-light); }

/* ===== 数据库 ===== */
/* ===== 数据库页面（左右分栏） ===== */
.db-body { display:flex; flex:1; gap:24px; overflow:hidden; padding:20px 28px 28px; }
.db-main { flex:3; display:flex; flex-direction:column; overflow:hidden; min-width:0; }
.db-main-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; flex:1; display:flex; flex-direction:column; overflow:hidden; }
.db-section-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.db-section-header h3 { font-size:16px; font-weight:600; margin:0; }
.db-grid-3col { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; overflow-y:auto; }

/* 右侧侧栏（聊天风格） */
.db-side { flex:1; min-width:300px; max-width:400px; display:flex; flex-direction:column; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; }
.db-side-header { padding:16px 16px 0; }
.db-side-select { padding:10px 16px 8px; border-bottom:1px solid var(--border-light); }
.db-side-msgs { flex:1; overflow-y:auto; padding:12px 16px; display:flex; flex-direction:column; gap:10px; }
.db-side-msgs .db-side-empty { margin:auto; text-align:center; padding:30px 0; font-size:13px; color:var(--text-secondary); max-width:260px; line-height:1.6; }
.db-side-msgs .sq-msg { padding:10px 14px; border-radius:var(--radius); font-size:13px; line-height:1.5; }
.db-side-msgs .sq-msg.user { background:var(--primary-light); color:var(--text); align-self:flex-end; max-width:90%; }
.db-side-msgs .sq-msg.assistant { background:var(--bg); color:var(--text); align-self:flex-start; max-width:100%; }
.db-side-msgs .sq-msg .sq-msg-sql { background:#1a1f2e; color:#e8e8e8; padding:8px 10px; border-radius:6px; font-family:monospace; font-size:11px; margin-top:6px; overflow-x:auto; white-space:pre-wrap; max-height:120px; overflow-y:auto; }
.db-side-input { display:flex; gap:8px; padding:10px 16px 16px; border-top:1px solid var(--border-light); }
.db-side-input textarea { flex:1; padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; resize:none; font-family:inherit; outline:none; transition:0.2s; background:var(--bg-card); color:var(--text); min-height:36px; max-height:80px; }
.db-side-input textarea:focus { border-color:var(--primary); box-shadow:0 0 0 2px rgba(79,110,247,0.1); }
.db-side-input .btn { flex-shrink:0; padding:8px 14px; }

/* 主题兼容 */
.theme-fa .db-side { border-color:var(--border); }
.theme-fa .db-section-header h3 { color:var(--text); }

.db-config-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px; transition:0.2s; }
.db-config-card:hover { box-shadow:var(--shadow); }
.db-config-card .dcc-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:8px; }
.db-config-card .dcc-name { font-size:15px; font-weight:600; }
.db-config-card .dcc-type { font-size:11px; padding:2px 8px; border-radius:10px; background:var(--primary-light); color:var(--primary); font-weight:500; }
.db-config-card .dcc-info { font-size:13px; color:var(--text-secondary); line-height:1.6; }
.db-config-card .dcc-actions { display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; }
.db-table-item { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; border:1px solid var(--border-light); border-radius:var(--radius); margin-bottom:6px; }
.db-table-item .dbt-name { font-weight:500; font-size:13px; }
.db-table-item .dbt-info { font-size:12px; color:var(--text-secondary); }
.db-table-item .dbt-actions { display:flex; gap:6px; align-items:center; }
.sq-sql-toggle { font-size:12px; color:var(--text-secondary); cursor:pointer; padding:4px 0; user-select:none; }
.sq-sql-toggle:hover { color:var(--primary); }
.sq-sql-toggle .sq-sql-arrow { font-size:10px; margin-right:4px; }
.sq-step { display:flex; align-items:center; gap:10px; padding:8px 14px; border-radius:var(--radius); margin-bottom:6px; font-size:13px; }
.sq-step.running { background:#fff8e1; color:#f57f17; }
.sq-step.completed { background:#e8f5e9; color:#2e7d32; }
.sq-step.failed { background:#ffebee; color:#c62828; }
.sq-step-icon { font-size:16px; width:20px; text-align:center; }

.ctx-menu { display:none; position:fixed; z-index:999; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); box-shadow:0 4px 16px rgba(0,0,0,0.15); min-width:160px; padding:4px 0; }
.ctx-menu.open { display:block; }
.ctx-item { padding:8px 16px; font-size:13px; cursor:pointer; }
.ctx-item:hover { background:var(--bg); }
.ctx-item.danger { color:var(--danger); }
.ctx-divider { height:1px; background:var(--border); margin:4px 0; }

.message .bubble pre {
  background: #1e2433;
  color: #f8f8f2;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.5;
}
.message .bubble code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.message .bubble pre code { background: none; padding: 0; }
.message .bubble table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.message .bubble th, .message .bubble td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; }
.message .bubble th { background: #f5f5f5; font-weight: 600; }

.chat-input {
  padding: 16px 28px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
/* ---- 文件上传 ---- */
.chat-input .upload-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 0;
}
.chat-input .upload-area:empty { display: none; }
.chat-input .file-preview {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 28px 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-input .file-preview .file-icon { font-size: 14px; }
.chat-input .file-preview .file-name { overflow: hidden; text-overflow: ellipsis; }
.chat-input .file-preview .file-size { color: var(--text-muted); margin-left: 4px; }
.chat-input .file-preview .file-remove {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  cursor: pointer; opacity: 0.5; font-size: 14px; line-height: 1; padding: 2px;
}
.chat-input .file-preview .file-remove:hover { opacity: 1; color: #e53935; }
.chat-input .upload-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer; font-size: 18px; color: var(--text-muted);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); flex-shrink: 0;
}
.chat-input .upload-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,110,247,0.15); }
.chat-input .upload-btn:active { transform: scale(0.9); }
.chat-input .upload-progress {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
/* 拖拽高亮 */
.chat-col.drag-over .chat-input { background: var(--primary-light); border-color: var(--primary); }
.chat-col.drag-over .chat-input textarea { border-color: var(--primary); }
.chat-col .drag-hint {
  display: none;
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(79,110,247,0.08);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  align-items: center; justify-content: center;
  font-size: 16px; color: var(--primary); pointer-events: none; z-index: 10;
}
.chat-col.drag-over .drag-hint { display: flex; }
.chat-col { position: relative; }

/* 快捷命令栏 */
.quick-cmd-wrapper {
  margin-bottom: 8px;
}
.qc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 16px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  font-weight: 500;
}
.qc-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.qc-toggle.open {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.qc-panel {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.qc-panel.open {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.qc-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  font-family: inherit;
}
.qc-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.qc-btn:active {
  transform: scale(0.96);
}
.qc-btn .qc-cmd {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-weight: 600;
  font-size: 11px;
}
.qc-btn .qc-desc {
  color: var(--text-secondary);
  font-size: 11px;
}
.qc-tool-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.qc-tool-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.qc-tool-btn.open {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chat-input .input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  resize: none;
  min-height: 48px;
  max-height: 150px;
  line-height: 1.5;
  transition: border-color var(--transition);
}
.chat-input textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,0.08); }
.chat-input .send-btn {
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(79,110,247,0.2);
}
.chat-input .send-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79,110,247,0.3);
}
.chat-input .send-btn:active {
  transform: scale(0.93);
  box-shadow: 0 1px 4px rgba(79,110,247,0.15);
}
.chat-input .send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-input .input-row .stop-btn {
  padding: 12px 24px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(231,76,60,0.2);
}
.chat-input .input-row .stop-btn:hover {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231,76,60,0.3);
}
.chat-input .input-row .stop-btn:active {
  transform: scale(0.93);
  box-shadow: 0 1px 4px rgba(231,76,60,0.15);
}
/* tools-hint moved to .chat-tools-bar */

/* ===== 知识库页面（优化版） ===== */
.kb-content { flex: 1; overflow-y: auto; padding: 20px 28px; }

/* 统计卡片行 */
.kb-stats { display:flex; gap:16px; margin-bottom:20px; }
.stat-card { flex:1; display:flex; align-items:center; gap:16px; padding:20px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); transition:0.2s; cursor:default; }
.stat-card:hover { box-shadow:var(--shadow); transform:translateY(-2px); }
.stat-card .stat-icon { font-size:32px; width:48px; height:48px; display:flex; align-items:center; justify-content:center; border-radius:12px; flex-shrink:0; }
.stat-docs .stat-icon { background:#eef1ff; }
.stat-chunks .stat-icon { background:#e8f5e9; }
.stat-vectors .stat-icon { background:#fce4ec; }
.stat-card .stat-body { flex:1; }
.stat-card .number { font-size:28px; font-weight:700; color:var(--text); line-height:1.2; }
.stat-card .label { font-size:12px; color:var(--text-secondary); margin-top:2px; }

/* 索引面板 */
.kb-index-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; margin-bottom:16px; }
.kb-index-title { font-size:14px; font-weight:600; margin-bottom:12px; color:var(--text); }
.kb-index-row { display:flex; gap:10px; flex-wrap:wrap; }
.kb-index-row input[type="text"] { flex:1; min-width:200px; padding:10px 14px; border:1px solid var(--border); border-radius:var(--radius); font-size:14px; outline:none; transition:0.2s; }
.kb-index-row input[type="text"]:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(79,110,247,0.1); }
.kb-index-hint { margin-top:10px; font-size:12px; color:var(--text-secondary); line-height:1.5; }

/* 搜索栏 */
.kb-search-bar { display:flex; align-items:center; gap:10px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:8px 16px; margin-bottom:16px; }
.kb-search-icon { font-size:16px; flex-shrink:0; }
.kb-search-bar input[type="text"] { flex:1; border:none; outline:none; font-size:14px; background:transparent; padding:4px 0; }
.kb-search-bar input[type="text"]::placeholder { color:var(--text-secondary); }

/* 文档列表 */
.kb-doc-header { display:flex; justify-content:space-between; align-items:center; padding:8px 0 12px; font-size:14px; font-weight:600; color:var(--text); border-bottom:1px solid var(--border-light); margin-bottom:8px; }
.kb-doc-list { display:flex; flex-direction:column; gap:6px; }
.kb-doc-list .doc-item { display:flex; align-items:center; gap:12px; padding:12px 16px; background:var(--bg-card); border:1px solid var(--border-light); border-radius:var(--radius); transition:0.2s; box-shadow:var(--shadow-sm); }
.doc-item:hover { box-shadow:var(--shadow); transform:translateY(-1px); }
.doc-item .doc-icon { font-size:22px; flex-shrink:0; }
.doc-item .doc-info { flex:1; min-width:0; }
.doc-item .doc-name { font-weight:600; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.doc-item .doc-meta { font-size:12px; color:var(--text-secondary); margin-top:2px; }
.doc-item .doc-type { font-size:11px; padding:2px 8px; border-radius:8px; background:var(--primary-light); color:var(--primary); flex-shrink:0; }

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,110,247,0.3); }
.btn-primary:active { transform: scale(0.95); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(39,174,96,0.3); }
.btn-success:active { transform: scale(0.95); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(231,76,60,0.3); }
.btn-danger:active { transform: scale(0.95); }
.btn-outline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: #e8ecf1; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); border-color: #d0d4e0; }
.btn-outline:active { transform: scale(0.95); }
.btn-sm { padding: 6px 12px; font-size: 12px; }


/* ===== 团队文件 ===== */
.fb-content { flex: 1; overflow-y: auto; padding: 20px 28px; }
.fb-roots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.fb-root-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  transition: 0.15s;
  box-shadow: var(--shadow-sm);
}
.fb-root-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.fb-root-btn.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px rgba(79,110,247,0.15); }
.fb-root-btn .root-desc { font-size: 11px; font-weight: 400; color: var(--text-secondary); display: block; margin-top: 2px; }
.fb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.fb-toolbar .fb-path-bar { flex: 1; min-width: 200px; margin-bottom: 0; }
.fb-actions { display: flex; gap: 8px; flex-shrink: 0; }
.fb-path-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.fb-path-bar .path-text { flex: 1; color: var(--primary); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-path-bar .path-text:hover { text-decoration: underline; }
.fb-path-bar .nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  padding: 4px;
}
.fb-path-bar .nav-btn:hover { color: var(--primary); }

.fb-drives {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.fb-drives .drive-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
}
.fb-drives .drive-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }

.fb-items .fb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 13px;
}
.fb-item:hover { background: var(--bg-card); box-shadow: var(--shadow-sm); }
.fb-item .item-icon { font-size: 18px; width: 24px; text-align: center; }
.fb-item .item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-item .item-meta { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.fb-item .index-btn {
  opacity: 0;
  padding: 2px 10px;
  font-size: 11px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity var(--transition);
}
.fb-item:hover .index-btn { opacity: 1; }
.fb-item .index-btn:hover { background: #219a52; }

/* ===== 项目群聊工作区 ===== */
.workspace-header {
  align-items: center;
}
.workspace-projects {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 28px;
}
.project-create-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(135deg, #172032 0%, #243044 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.project-create-panel h3 {
  font-size: 20px;
  margin: 5px 0 8px;
  letter-spacing: 0;
}
.project-create-panel p {
  max-width: 760px;
  color: rgba(255,255,255,0.76);
  font-size: 13px;
  line-height: 1.7;
}
.project-kicker {
  display: inline-flex;
  color: #8be0d4;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.project-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(79,110,247,0.35);
  box-shadow: var(--shadow);
}
.project-card.archived {
  opacity: 0.68;
}
.project-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.project-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: #eaf8f5;
  color: #087b6f;
}
.project-card h3 {
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-card-top span {
  color: var(--text-secondary);
  font-size: 12px;
}
.project-card p {
  min-height: 44px;
  margin: 14px 0;
  color: #4a5568;
  font-size: 13px;
  line-height: 1.65;
}
.project-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.project-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: #f4f6fa;
  color: #566174;
  font-size: 12px;
}
.project-path {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.project-empty {
  grid-column: 1 / -1;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.62);
  border: 1px dashed #cfd6e3;
  border-radius: var(--radius);
  text-align: center;
  padding: 24px;
}
.project-empty i {
  font-size: 28px;
  color: #8a96aa;
}
.project-empty strong {
  color: var(--text);
  font-size: 15px;
}
.project-modal-card {
  width: 560px;
  max-width: calc(100vw - 32px);
}
.project-modal-field {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
}
.project-modal-field input,
.project-modal-field select,
.project-modal-field textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}
.project-modal-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  margin-top: 8px;
}
.project-member-count {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}
.project-role-picker {
  display: grid;
  gap: 8px;
  margin: 12px 0 4px;
}
.project-role-picker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.project-role-picker-head span {
  color: var(--text-secondary);
  font-size: 12px;
}
.project-role-search {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  background: #fff;
  box-sizing: border-box;
}
.project-role-search:focus {
  outline: none;
  border-color: var(--primary);
}
.project-role-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 210px;
  overflow: auto;
}
.project-role-chip {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}
.project-role-chip input {
  width: 15px;
  height: 15px;
}
.project-role-chip strong,
.project-role-chip em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}
.project-role-chip strong {
  font-size: 12px;
}
.project-role-chip em {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}
.talent-picker-existing {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-muted, #f0f2f5);
  color: var(--text-secondary, #667085);
  font-size: 12px;
}
.project-panel-overlay {
  align-items: center;
  justify-content: center;
}
.project-panel-card {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.project-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
}
.project-panel-head h3 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: 0;
}
.project-panel-head p {
  max-width: 760px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}
.project-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
}
.project-panel-body {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px 24px;
}
.project-roster-panel,
.project-task-panel {
  min-width: 0;
}
.project-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--text);
}
.project-section-title span {
  color: var(--text-secondary);
  font-size: 12px;
}
.project-roster-list,
.project-task-list {
  display: grid;
  gap: 10px;
}
.project-member-row,
.project-task-card,
.project-mini-empty {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.project-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}
.project-member-row.working {
  border-color: #b9cdfc;
  background: #f5f8ff;
}
.project-member-row.archived {
  background: #f7f7f8;
  opacity: .72;
}
.project-member-row strong,
.project-member-row span {
  display: block;
}
.project-member-row strong {
  font-size: 13px;
  margin-bottom: 3px;
}
.project-member-row span {
  color: var(--text-secondary);
  font-size: 12px;
}
.project-member-actions {
  display: grid;
  gap: 5px;
  justify-items: end;
}
.project-stop-btn.confirming {
  border-color: #e2626b;
  background: #fff0f1;
  color: #a43b44;
}
.project-task-card {
  padding: 14px;
}
.project-task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}
.task-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius);
  background: #fff5d6;
  color: #8a6418;
  font-weight: 700;
}
.status-approved .task-status { background: #e7f0ff; color: #3158a8; }
.status-dispatched .task-status { background: #eef2ff; color: #4b4fa3; }
.status-submitted .task-status { background: #f0eafe; color: #6245a6; }
.status-accepted .task-status { background: #e5f8ee; color: #247148; }
.status-rejected .task-status { background: #ffeaeb; color: #a43b44; }
.status-cancelled .task-status,
.status-timed_out .task-status { background: #edf0f4; color: #5d6673; }
.project-task-card h4 {
  margin: 0 0 7px;
  font-size: 15px;
  letter-spacing: 0;
}
.project-task-card p {
  margin: 0 0 10px;
  color: #4a5568;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.project-task-meta {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.project-task-meta span {
  min-width: 0;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: #f4f6fa;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
.project-task-feedback,
.project-task-result {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.project-task-feedback {
  border-left: 3px solid #d39b2f;
  background: #fff7e8;
  color: #735220;
}
.project-task-result {
  border-left: 3px solid var(--success);
  background: #f1fbf6;
  color: #2f5d47;
}
.project-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.project-task-done {
  color: var(--text-secondary);
  font-size: 12px;
}
.project-mini-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
}
@media (max-width: 880px) {
  .project-panel-body {
    grid-template-columns: 1fr;
  }
  .project-task-meta {
    grid-template-columns: 1fr;
  }
}
.project-chat-empty .big-icon {
  color: #087b6f;
}

/* ===== 设置页面 ===== */
.settings-content { flex: 1; overflow-y: auto; padding: 20px 28px; }
.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.settings-group h3 { font-size: 15px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
}
.settings-row:last-child { border-bottom: none; }
.settings-row label { font-size: 14px; }
.settings-row .desc { font-size: 12px; color: var(--text-secondary); }
.settings-row input, .settings-row select, .settings-row textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  width: 200px;
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
}
.settings-row textarea {
  width: min(420px, 48vw);
  resize: vertical;
  line-height: 1.5;
}
.settings-row input:focus, .settings-row select:focus, .settings-row textarea:focus { border-color: var(--primary); }

.wecom-settings {
  border-color: rgba(15, 159, 149, 0.18);
}
.wecom-base-settings {
  border-left: 3px solid #64748b;
}
.wecom-app-settings {
  border-left: 3px solid var(--primary);
}
.wecom-robot-settings {
  border-left: 3px solid #d97706;
}
.wecom-aibot-settings {
  border-left: 3px solid #2563eb;
}
.wecom-customer-settings {
  border-left: 3px solid #0f9f95;
}
.wecom-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.wecom-head h3 {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 6px;
}
.wecom-head p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.wecom-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.wecom-switch input,
.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}
.wecom-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.wecom-choice-card {
  position: relative;
  display: flex;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: 0.18s ease;
}
.wecom-choice-card:hover {
  border-color: #0f9f95;
  box-shadow: var(--shadow-sm);
}
.wecom-choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.wecom-choice-card span {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 3px 10px;
  align-items: center;
}
.wecom-choice-card i {
  color: #0f9f95;
  grid-row: 1 / 3;
}
.wecom-choice-card b {
  font-size: 14px;
  color: var(--text);
}
.wecom-choice-card small {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.wecom-choice-card:has(input:checked) {
  border-color: #0f9f95;
  background: rgba(15, 159, 149, 0.08);
}
.wecom-callbacks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}
.wecom-callbacks.one-col {
  grid-template-columns: 1fr;
}
.wecom-callbacks > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg);
}
.wecom-callbacks label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.wecom-callbacks code {
  display: block;
  white-space: normal;
  word-break: break-all;
  font-size: 12px;
  color: var(--text);
  user-select: text;
}
.copy-mini-btn {
  float: right;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}
.copy-mini-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.wecom-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 0 4px;
}
.wecom-actions #workTestResult,
.wecom-actions #workRobotTestResult {
  margin-left: 4px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .wecom-choice,
  .wecom-callbacks {
    grid-template-columns: 1fr;
  }
  .settings-row textarea {
    width: 100%;
  }
}

.switch-control {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}
.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}
.agent-config-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: linear-gradient(90deg, var(--bg-card), var(--bg));
  box-shadow: var(--shadow-sm);
}
.agent-config-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.agent-config-note {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-secondary);
}
.agent-catalog-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
  padding: 0;
}
.agent-catalog-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}
.agent-catalog-stat {
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid rgba(5, 150, 105, .16);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow-sm);
}
.agent-catalog-stat b {
  display: block;
  color: var(--text);
  font-size: 23px;
  line-height: 1;
  font-family: "Cascadia Code", Consolas, monospace;
}
.agent-catalog-stat span {
  display: block;
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 12px;
}
.agent-catalog-featured {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 34px;
  margin-bottom: 10px;
}
.agent-catalog-featured > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}
.agent-feature-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(100,116,139,.18);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, box-shadow .18s;
}
.agent-feature-chip:hover,
.agent-feature-chip.active {
  border-color: var(--cat-color, var(--primary));
  color: var(--cat-color, var(--primary));
  background: #f0fdf4;
  background: color-mix(in srgb, var(--cat-color, var(--primary)) 8%, #fff);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .12);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color, var(--primary)) 12%, transparent);
}
.agent-feature-chip b {
  color: inherit;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
}
.agent-catalog-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 140px;
  gap: 8px;
  margin-bottom: 12px;
}
.agent-catalog-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}
.agent-catalog-controls input,
.agent-catalog-controls select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}
.agent-search-wrap {
  position: relative;
  display: block;
}
.agent-search-wrap .icon-fa {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.agent-search-wrap input {
  padding-left: 34px;
  padding-right: 38px;
}
.agent-search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 30px;
  height: 30px;
  min-height: 30px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.agent-search-clear:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.agent-catalog-controls input:focus,
.agent-catalog-controls select:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .13);
}
.agent-catalog-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.agent-catalog-sidebar,
.agent-catalog-main,
.agent-catalog-detail {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-sm);
}
.agent-catalog-sidebar {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}
.agent-catalog-category {
  width: 100%;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  padding: 6px 8px 6px 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s;
}
.agent-catalog-category:hover {
  background: #f8fbff;
  background: color-mix(in srgb, var(--cat-color, var(--primary)) 8%, #fff);
}
.agent-catalog-category.active {
  background: #fff;
  border-color: var(--cat-color, var(--primary));
  border-color: color-mix(in srgb, var(--cat-color, var(--primary)) 48%, var(--border));
  box-shadow: inset 3px 0 0 var(--cat-color, var(--primary));
}
.agent-catalog-category .cat-bar {
  display: block;
  width: 4px;
  height: 28px;
  border-radius: 99px;
  background: var(--cat-color, var(--primary));
}
.agent-catalog-category strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.agent-catalog-category .cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  text-align: center;
  font-size: 11px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-style: normal;
}
.agent-catalog-main {
  min-height: 0;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agent-catalog-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  margin-bottom: 10px;
  padding: 0 2px;
  color: var(--text-secondary);
  font-size: 12px;
}
.agent-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}
.agent-catalog-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 146px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.agent-catalog-card:hover {
  border-color: var(--agent-type-color, var(--primary));
  border-color: color-mix(in srgb, var(--agent-type-color, var(--primary)) 48%, var(--border));
  box-shadow: 0 8px 22px rgba(15,23,42,.07);
  transform: translateY(-1px);
}
.agent-catalog-card.active {
  border-color: var(--agent-type-color, var(--primary));
  border-color: color-mix(in srgb, var(--agent-type-color, var(--primary)) 58%, var(--border));
  box-shadow: inset 3px 0 0 var(--agent-type-color, var(--primary)), 0 8px 22px rgba(15,23,42,.07);
}
.agent-catalog-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.agent-catalog-card strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}
.agent-catalog-pill {
  flex-shrink: 0;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--primary-light);
  background: color-mix(in srgb, var(--agent-type-color, var(--primary)) 10%, #fff);
  color: var(--agent-type-color, var(--primary));
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
}
.agent-catalog-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-catalog-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.agent-catalog-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
}
.agent-catalog-card em {
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  padding: 3px 7px;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}
.agent-catalog-more {
  min-height: 46px;
  border: 1px dashed rgba(15, 159, 149, .36);
  border-radius: 8px;
  background: rgba(240,253,250,.72);
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.agent-catalog-more:hover {
  background: #ecfdf5;
  border-color: #0f9f95;
}
.agent-catalog-detail {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #fff;
}
.agent-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.agent-detail-head > div {
  min-width: 0;
}
.agent-detail-head h4 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.agent-detail-head p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.agent-detail-status {
  align-self: flex-start;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e8f5e9;
  color: #247a3d;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.agent-detail-status.off {
  background: #f3f4f6;
  color: #6b7280;
}
.agent-detail-meta,
.agent-detail-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.agent-detail-meta {
  margin-top: 12px;
}
.agent-detail-meta span,
.agent-detail-tools span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text-secondary);
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.agent-detail-tools span {
  background: #f0fdfa;
  border-color: rgba(15, 159, 149, .18);
  color: #0f766e;
  font-family: "Cascadia Code", Consolas, monospace;
}
.agent-detail-block {
  margin-top: 12px;
}
.agent-detail-block label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.agent-detail-block div,
.agent-detail-block pre {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.agent-detail-block pre {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 10px;
}
.agent-detail-summary div {
  color: var(--text);
}
.agent-original-prompt {
  max-height: 340px;
}
.agent-markdown-overlay {
  padding: 24px;
}
.agent-markdown-modal {
  width: min(920px, calc(100vw - 48px));
  max-height: min(820px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .24);
}
.agent-markdown-head {
  min-height: 64px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.agent-markdown-head > div {
  min-width: 0;
}
.agent-markdown-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.agent-markdown-head p {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.agent-markdown-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
}
.agent-markdown-close:hover,
.agent-markdown-close:focus-visible {
  border-color: #0f9f95;
  color: #0f766e;
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 159, 149, .12);
}
.agent-markdown-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.agent-lang-btn {
  min-width: 54px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.agent-lang-btn.active {
  border-color: #0f9f95;
  background: #ecfdf5;
  color: #0f766e;
  box-shadow: inset 0 0 0 1px rgba(15, 159, 149, .1);
}
.agent-lang-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 159, 149, .12);
}
.agent-markdown-state {
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-markdown-body {
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  color: #1f2937;
  padding: 18px;
  font: 12px/1.65 "Cascadia Code", Consolas, monospace;
}
.agent-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.agent-catalog-empty {
  min-height: 180px;
  display: grid;
  gap: 8px;
  place-items: center;
  padding: 20px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
}
.agent-catalog-empty strong {
  color: var(--text);
  font-size: 15px;
}
.agent-profiles-input {
  min-width: 360px;
  max-width: 540px;
  width: 48%;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  outline: none;
}
.agent-profiles-input:focus {
  border-color: var(--primary);
}
.agent-builder-panel {
  display: flex;
  flex-direction: column;
  height: min(760px, calc(100vh - 132px));
  min-height: 560px;
  padding: 0;
  overflow: hidden;
}
.agent-builder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
}
.agent-builder-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
}
.agent-builder-head p {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.agent-builder-head #agentCountHint {
  flex-shrink: 0;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  padding: 6px 10px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}
.agent-builder-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-soft);
}
.agent-list-search {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.agent-list-search .icon-fa {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.agent-list-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px 0 34px;
  outline: none;
}
.agent-list-search input:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .12);
}
.agent-builder {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.agent-list {
  min-height: 0;
  border: 0;
  border-right: 1px solid var(--border-light);
  border-radius: 0;
  background: #f8fafc;
  padding: 10px;
  overflow: auto;
}
.agent-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  gap: 3px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: transparent;
  padding: 10px 11px;
  margin-bottom: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: all .15s;
}
.agent-list-item:hover {
  background: #fff;
  border-color: rgba(5, 150, 105, .28);
}
.agent-list-item.active {
  background: var(--bg-card);
  border-color: #059669;
  box-shadow: inset 3px 0 0 #059669, var(--shadow-sm);
}
.agent-list-name {
  font-size: 14px;
  font-weight: 700;
}
.agent-list-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.agent-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-secondary);
}
.agent-list-meta em,
.agent-list-meta b {
  border-radius: 999px;
  padding: 3px 7px;
  font-style: normal;
}
.agent-list-meta em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #e0f2fe;
  color: #0369a1;
}
.agent-list-meta b {
  flex-shrink: 0;
  background: #ecfdf5;
  color: #047857;
}
.agent-empty-list,
.agent-editor-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.agent-editor {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg-card);
  padding: 18px 20px 22px;
  overflow: auto;
}
.agent-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.agent-editor-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}
.agent-editor-kicker {
  margin-bottom: 4px;
  color: #059669;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.agent-editor-sub {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
}
.agent-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.agent-form-grid label,
.agent-wide-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}
.agent-form-grid input,
.agent-form-grid select,
.agent-wide-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
}
.agent-wide-field {
  margin-top: 10px;
}
.agent-wide-field textarea {
  resize: vertical;
  line-height: 1.55;
}
.agent-form-grid input:focus,
.agent-form-grid select:focus,
.agent-wide-field textarea:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .1);
}
.agent-enable-row {
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.agent-save-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: sticky;
  bottom: -20px;
  z-index: 6;
  margin: 0 -28px -20px;
  padding: 14px 28px;
  border-top: 1px solid var(--border-light);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
}
#agentConfigHint {
  font-size: 12px;
  color: var(--text-muted);
}

.audit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.audit-table-wrap { margin-top: 4px; }
.audit-table-wrap .stats-table td {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}
.audit-table-wrap .stats-table td.audit-detail-cell {
  max-width: 420px;
  white-space: normal;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.4;
}
.audit-status-ok { color: var(--success); font-weight: 600; }
.audit-status-error { color: var(--danger); font-weight: 600; }
.audit-type-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary-subtle);
  color: var(--primary);
}

/* ===== 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);
  color: #fff;
  font-size: 14px;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 400px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 自定义弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.45); display: flex;
  align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px 32px 20px;
  max-width: 420px; width: 90%; animation: modalIn 0.2s ease;
}
.modal-card h3 { font-size: 17px; margin: 0 0 8px; color: var(--text); }
.modal-card p { font-size: 14px; color: var(--text-secondary); margin: 0 0 20px; line-height: 1.6; white-space: pre-wrap; }
.modal-card .modal-btns { display: flex; gap: 10px; justify-content: flex-end; }
.modal-card .modal-btns button {
  padding: 8px 20px; border-radius: 6px; font-size: 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  transition: 0.15s ease;
}
.modal-card .modal-btns button:hover { background: var(--border-light); }
.modal-card .modal-btns button.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.modal-card .modal-btns button.btn-danger:hover { background: #c0392b; }
.modal-card .modal-btns button.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(-8px); } }

.proposal-decision-overlay { background: rgba(19, 25, 31, 0.58); backdrop-filter: blur(3px); }
.proposal-decision-card {
  width: min(92vw, 520px); max-width: 520px; padding: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: 8px;
}
.proposal-decision-head {
  display: grid; grid-template-columns: 42px 1fr 34px; align-items: center; gap: 12px;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--border-light);
}
.proposal-decision-icon {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px;
  color: #fff; background: #176b4d; font-size: 18px;
}
.proposal-decision-head h3 { margin: 2px 0 0; font-size: 18px; }
.proposal-kicker { color: var(--text-secondary); font-size: 12px; }
.proposal-close {
  width: 34px; height: 34px; border: 0; background: transparent; color: var(--text-secondary);
  cursor: pointer; border-radius: 6px;
}
.proposal-close:hover { background: var(--border-light); color: var(--text); }
.proposal-id {
  display: flex; align-items: center; justify-content: space-between; margin: 18px 22px 10px;
  padding: 10px 12px; border-left: 3px solid #176b4d; background: var(--bg);
  color: var(--text-secondary); font-size: 12px;
}
.proposal-id strong { color: var(--text); font-family: Consolas, monospace; font-size: 13px; }
.modal-card p.proposal-summary {
  margin: 0 22px 16px; max-height: 104px; overflow: auto; color: var(--text-secondary); font-size: 13px;
}
.proposal-revision-label { display: block; margin: 0 22px 7px; color: var(--text); font-size: 13px; font-weight: 600; }
.proposal-revision {
  display: block; box-sizing: border-box; width: calc(100% - 44px); margin: 0 22px;
  padding: 10px 12px; resize: vertical; min-height: 72px; max-height: 150px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 13px; line-height: 1.5;
}
.proposal-revision:focus { outline: 2px solid rgba(23, 107, 77, 0.18); border-color: #176b4d; }
.proposal-validation { min-height: 18px; margin: 5px 22px 0; color: var(--danger); font-size: 12px; }
.modal-card .proposal-btns {
  padding: 13px 22px 18px; flex-wrap: wrap; border-top: 1px solid var(--border-light);
}
.modal-card .proposal-btns button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.modal-card .proposal-btns .proposal-revise { border-color: #b88725; color: #8a6418; background: #fffaf0; }
.modal-card .proposal-btns .proposal-revise:hover { background: #fff4d9; }
.proposal-inline-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light);
}
.proposal-inline-actions div { display: flex; align-items: center; gap: 8px; }
.proposal-inline-actions span { color: #8a6418; font-size: 12px; }
.proposal-inline-actions strong { font-family: Consolas, monospace; font-size: 12px; }
.proposal-inline-actions button {
  border: 1px solid #176b4d; border-radius: 6px; padding: 7px 11px;
  color: #176b4d; background: transparent; cursor: pointer; font-size: 12px;
}
.proposal-inline-actions button:hover { color: #fff; background: #176b4d; }
@media (max-width: 620px) {
  .proposal-decision-card { width: calc(100vw - 24px); }
  .modal-card .proposal-btns { display: grid; grid-template-columns: 1fr 1fr; }
  .modal-card .proposal-btns .proposal-confirm { grid-column: 1 / -1; grid-row: 1; }
  .proposal-inline-actions { align-items: flex-start; }
}

/* ===== 加载状态 ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
}

/* ===== 对话列表面板 ===== */
.conv-panel {
  position: fixed;
  left: 220px;
  top: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: none;
  flex-direction: column;
  z-index: 10;
}
.conv-panel.open { display: flex; }
.conv-panel .conv-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.conv-panel .conv-list { flex: 1; overflow-y: auto; }
.conv-panel .conv-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background var(--transition);
  font-size: 13px;
}
.conv-panel .conv-item:hover { background: var(--bg); }
.conv-panel .conv-item .conv-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-panel .conv-item .conv-time { font-size: 11px; color: var(--text-secondary); }

/* ===== 空状态 ===== */
.empty-list {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== 分屏面板 ===== */
.chat-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}
.chat-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-col .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
}
.chat-col .chat-input {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.agent-chatbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.agent-chatbar-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.agent-mode-label {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.agent-select {
  min-width: 128px;
  max-width: 220px;
  height: 32px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.agent-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.08);
}
.agent-chat-hint {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-new-btn {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.agent-new-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.chat-col .chat-input .input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-col .chat-input textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  resize: none;
  min-height: 36px;
  max-height: 100px;
  line-height: 1.5;
  transition: border-color var(--transition);
}
.chat-col .chat-input textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,0.08); }
.chat-col .chat-input .send-btn {
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(79,110,247,0.2);
}
.chat-col .chat-input .send-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79,110,247,0.3);
}
.chat-col .chat-input .send-btn:active {
  transform: scale(0.93);
  box-shadow: 0 1px 4px rgba(79,110,247,0.15);
}
.chat-col .chat-input .send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-col .chat-input .stop-btn {
  padding: 8px 18px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(231,76,60,0.2);
}
.chat-col .chat-input .stop-btn:hover {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231,76,60,0.3);
}
.chat-col .chat-input .stop-btn:active {
  transform: scale(0.93);
  box-shadow: 0 1px 4px rgba(231,76,60,0.15);
}

.split-col {
  display: none;
  border-left: 2px solid var(--border);
  background: var(--bg);
}
.theme-fa .split-col {
  background: var(--bg-card);
}
.split-col.open { display: flex; }
.split-col .split-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
}
.split-col .split-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.split-col .split-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.split-col .message { margin-bottom: 10px; }
.split-col .message .bubble { max-width: 90%; font-size: 13px; padding: 8px 12px; }

/* ===== 对话工作台优化 ===== */
.chat-page-header {
  min-height: 70px;
  gap: 16px;
}
.chat-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.chat-title-block {
  min-width: 0;
}
.chat-title-block h2 {
  line-height: 1.2;
}
.chat-title-block p {
  max-width: 560px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-header-actions:empty {
  display: none;
}
#page-chat .chat-body {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.78), rgba(246,248,252,0.94)),
    radial-gradient(circle at 18% 0%, rgba(64,128,255,0.08), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(28,171,156,0.08), transparent 30%);
}
.agent-dock {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 20px 10px;
  border-bottom: 1px solid rgba(210,216,229,0.72);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  scrollbar-width: thin;
}
.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(196,204,219,0.9);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.agent-chip i {
  font-size: 12px;
}
.agent-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.agent-chip.active {
  border-color: #1f7a6d;
  background: #e9f7f4;
  color: #17695e;
  box-shadow: 0 2px 8px rgba(31,122,109,0.12);
}
#page-chat .chat-col .chat-messages {
  padding: 24px clamp(18px, 3vw, 40px);
  scroll-behavior: smooth;
}
#page-chat .composer-panel {
  padding: 12px clamp(14px, 2vw, 24px) 16px;
  border-top: 1px solid rgba(210,216,229,0.88);
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 30px rgba(31,42,68,0.05);
}
#page-chat .agent-chatbar {
  margin-bottom: 8px;
}
#page-chat .agent-select {
  min-width: 136px;
  height: 34px;
  border-color: rgba(196,204,219,0.95);
  background: #fff;
}
#page-chat .agent-chat-hint {
  max-width: 220px;
}
.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#page-chat .agent-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  background: #fff;
  border-color: rgba(196,204,219,0.95);
}
#page-chat .input-row {
  padding: 8px;
  border: 1px solid rgba(196,204,219,0.92);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32,45,72,0.06);
}
#page-chat .chat-col .chat-input textarea {
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
}
#page-chat .chat-col .chat-input textarea:focus {
  background: #f7f9fc;
  box-shadow: none;
}
#page-chat .chat-col .chat-input .send-btn,
#page-chat .chat-col .chat-input .stop-btn {
  height: 36px;
  padding: 0 18px;
  border-radius: 6px;
}

@media (max-width: 760px) {
  .chat-page-header {
    align-items: flex-start;
  }
  .chat-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .agent-chatbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .agent-chatbar-main {
    width: 100%;
  }
  .agent-select {
    flex: 1;
    min-width: 0;
  }
  .composer-actions {
    width: 100%;
  }
  .agent-new-btn {
    width: 100%;
    justify-content: center;
  }
  #page-chat .input-row {
    flex-wrap: wrap;
  }
  #page-chat .chat-col .chat-input textarea {
    min-width: 100%;
  }
}

/* ===== 自媒体 Agent 三栏工作台 ===== */
#page-chat {
  background: #f4f7fb;
}
#page-chat .chat-page-header {
  min-height: 54px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid #e8edf5;
}
#page-chat .chat-title-block h2 {
  font-size: 16px;
}
#page-chat .chat-title-block p {
  font-size: 12px;
}
#page-chat .agent-workbench {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) minmax(280px, 340px);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: #f4f7fb;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#page-chat .agent-workbench.profile-mode {
  grid-template-columns: 252px minmax(0, 1fr) minmax(280px, 340px);
}
#page-chat .agent-workbench.history-mode {
  grid-template-columns: 252px minmax(0, 1fr) minmax(280px, 340px);
}
#page-chat .agent-workbench.reception-mode,
#page-chat .agent-workbench.project-chat-mode {
  grid-template-columns: 252px minmax(0, 1fr);
}
#page-chat .agent-workbench,
#page-chat .agent-profile-panel,
#page-chat .chat-collab-panel {
  transition: grid-template-columns .22s ease, width .22s ease, flex-basis .22s ease;
}
.agent-rail {
  order: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.agent-rail-head {
  padding: 16px 16px 10px;
  border-bottom: 1px solid #edf1f7;
}
.agent-rail-head div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.agent-rail-head strong {
  color: #14213d;
  font-size: 16px;
  letter-spacing: 0;
}
.agent-rail-head span {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}
.dock-search {
  padding: 10px 12px 0;
}
.dock-search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.dock-search-box .dock-search-icon {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  font-size: 13px;
  pointer-events: none;
}
.dock-search-box input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 30px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #14213d;
  font-size: 13px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.dock-search-box input::-webkit-search-cancel-button {
  appearance: none;
  -webkit-appearance: none;
}
.dock-search-box input:focus {
  border-color: #8bd7d0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 159, 149, 0.12);
}
.dock-search-box input::placeholder {
  color: #a4b1c3;
}
.dock-search-clear {
  position: absolute;
  right: 7px;
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #e8edf5;
  color: #64748b;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.dock-search-box input:not(:placeholder-shown) ~ .dock-search-clear {
  display: flex;
}
.dock-search-clear:hover {
  background: #dbe4ef;
  color: #14213d;
}
#page-chat .agent-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 18px;
  border-bottom: 0;
  background: #fff;
  backdrop-filter: none;
}
.agent-employee {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: #18243a;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.agent-employee:hover {
  background: #f8fbff;
  border-color: #d9e6ff;
}
.agent-employee.active {
  background: #ecf8f8;
  border-color: #8bd7d0;
  box-shadow: inset 3px 0 0 #0f9f95, 0 8px 20px rgba(15,159,149,0.1);
}
.agent-more-hint {
  padding: 8px 10px;
  color: #6b7a90;
  font-size: 12px;
  line-height: 1.4;
}
.project-chat-summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 12px;
  border: 1px solid #cfe8e5;
  border-radius: 8px;
  background: #f0fbfa;
  color: #14333b;
}
.project-chat-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-chat-summary p {
  margin: 0;
  color: #4b6770;
  font-size: 12px;
  line-height: 1.55;
}
#page-chat .project-chat-mode .agent-profile-panel,
#page-chat .reception-mode .agent-profile-panel {
  display: none;
}
#page-chat .project-chat-mode .agent-chatbar-main {
  grid-template-columns: auto minmax(140px, 220px) auto;
}
#page-chat .project-chat-mode .agent-select {
  color: #176b4d;
  background: #eef8f4;
  border-color: #b8dfcc;
}
.employee-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eef6ff;
  color: #1167b1;
  font-size: 17px;
}
.employee-copy {
  min-width: 0;
}
.employee-copy div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.employee-copy strong {
  font-size: 13px;
  color: #101828;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.employee-copy p {
  margin: 5px 0 6px;
  color: #53627a;
  font-size: 11px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.employee-copy small {
  color: #94a3b8;
  font-size: 11px;
}
.owner-badge {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 5px;
  background: #0f9f95;
  color: #fff;
  font-size: 10px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #cbd5e1;
}
.status-dot.green { background: #22c55e; }
.status-dot.orange { background: #f59e0b; }
.status-dot.blue { background: #3b82f6; }
.status-dot.gray { background: #cbd5e1; }
.agent-profile-panel {
  order: 3;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #e6ebf3;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.profile-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.profile-tab {
  min-width: 112px;
  height: 42px;
  border: 1px solid #e3e9f2;
  border-radius: 8px;
  background: #f9fbff;
  color: #111827;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.profile-tab i {
  font-size: 15px;
  color: #1167b1;
}
.profile-tab.active {
  background: #eef8f8;
  border-color: #8bd7d0;
  box-shadow: 0 0 0 1px #0f9f95 inset;
}
.profile-card {
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}
.agent-tab-panel {
  display: none;
}
.agent-tab-panel.active {
  display: flex;
}
.agent-history-card {
  min-height: 0;
  flex-direction: column;
  border: 1px solid #e6ebf3;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
#page-chat .agent-workbench.history-mode .agent-profile-panel {
  padding: 10px;
}
#page-chat .agent-workbench.history-mode .profile-tabs {
  margin-bottom: 8px;
}
#page-chat .agent-workbench.history-mode .agent-history-card {
  flex: 1;
}
#page-chat .agent-workbench.profile-mode .profile-card {
  flex: 1;
}
.agent-history-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f7;
}
.agent-history-head strong {
  color: #14213d;
  font-size: 13px;
}
.agent-history-head button {
  width: 34px;
  height: 34px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
}
.agent-history-head button:hover {
  color: #0f766e;
  border-color: #8bd7d0;
  background: #eef8f8;
}
.agent-history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}
.agent-history-item {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 8px 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.agent-history-item.active {
  background: #ecf8f8;
  border-color: #8bd7d0;
  box-shadow: inset 3px 0 0 #0f9f95;
}
.agent-history-item:hover {
  background: #f8fbff;
  border-color: #d9e6ff;
}
.agent-history-main {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.agent-history-item strong {
  max-width: 100%;
  color: #172033;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-history-item span {
  color: #94a3b8;
  font-size: 11px;
}
.agent-history-delete {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}
.agent-history-delete:hover {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #e11d48;
}
.agent-history-empty {
  padding: 28px 12px;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
}
.agent-history-group-title {
  padding: 8px 10px 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.agent-history-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 10px !important;
  font-weight: 600;
  vertical-align: 1px;
}
/* ── 左侧 rail dock 三段式会话列表：企惠接待 / 项目群聊 / 单 Agent 聊天 ── */
.dock-group-title {
  padding: 14px 10px 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-top: 1px solid #edf1f7;
  margin-top: 6px;
}
.dock-group-title:first-of-type {
  border-top: 0;
  margin-top: 0;
}
.dock-loading-hint,
.dock-empty-hint {
  padding: 12px 10px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}
.dock-project-item {
  min-height: 72px;
}
.dock-project-badge {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 4px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  font-size: 10px;
  font-weight: 600;
}
#page-chat .agent-dock .dock-group-title + .agent-employee,
#page-chat .agent-dock .dock-group-title + .dock-project-item {
  margin-top: 2px;
}
.profile-field {
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid #e6ebf3;
  border-radius: 7px;
  background: #fff;
}
.profile-field label {
  display: block;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}
.profile-field div {
  color: #172033;
  font-size: 13px;
  line-height: 1.5;
}
.profile-alert label {
  color: #e11d48;
}
.profile-alert div {
  color: #64748b;
}
#page-chat .chat-collab-panel {
  order: 2;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e6ebf3;
  border-radius: 8px;
  background: #fff;
}

#page-chat .reception-empty {
  max-width: 640px;
  margin: 0 auto;
  padding: 36px 20px;
}
.reception-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.reception-actions .btn {
  min-height: 36px;
  border-radius: 7px;
}
.collab-header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1f7;
  background: #fff;
  flex-shrink: 0;
}
.collab-header h3 {
  margin: 0;
  color: #10213f;
  font-size: 15px;
}
.collab-header p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}
.collab-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.collab-action-btn {
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.collab-action-btn:hover {
  background: #eef8f8;
  border-color: #8bd7d0;
  color: #0f766e;
}
.collab-action-btn.ghost {
  width: 34px;
  padding: 0;
}
.agent-clear-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.agent-clear-btn:hover {
  color: #0f66d8;
  border-color: #b8d4ff;
}
#page-chat .chat-collab-panel .chat-messages {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 24px;
  background: #fbfcfe;
}
#page-chat .chat-collab-panel .message {
  margin-bottom: 12px;
}
#page-chat .chat-collab-panel .message .bubble {
  max-width: 82%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.05);
}
#page-chat .chat-collab-panel .message.user .bubble {
  background: #1167b1;
  color: #fff;
}
#page-chat .chat-collab-panel .composer-panel {
  flex: 0 0 auto;
  background: #fff;
  box-shadow: none;
  border-top: 1px solid #edf1f7;
}
#page-chat .chat-collab-panel .agent-chatbar {
  display: none;
}
#page-chat .chat-collab-panel .input-row {
  border-radius: 8px;
  box-shadow: none;
  align-items: flex-end;
}
#page-chat .chat-collab-panel .composer-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  min-height: 104px;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid #d8e1ee;
  background: #fff;
}
#page-chat .chat-collab-panel .composer-box textarea {
  width: 100%;
  min-height: 56px;
  max-height: 132px;
  padding: 8px 10px;
  overflow-y: auto;
  line-height: 1.55;
  font-size: 14px;
}
.composer-footer {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.composer-left-tools,
.composer-right-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
#page-chat .chat-collab-panel .upload-btn,
#page-chat .chat-collab-panel .qc-tool-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  border-radius: 8px;
  border: 1px solid #dbe4ef;
  background: #f8fafc;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
#page-chat .chat-collab-panel .upload-btn:hover,
#page-chat .chat-collab-panel .qc-tool-btn:hover {
  border-color: #8bd7d0;
  background: #eef8f8;
  color: #0f766e;
  transform: none;
  box-shadow: none;
}
#page-chat .chat-collab-panel .send-btn,
#page-chat .chat-collab-panel .stop-btn {
  min-width: 78px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-size: 13px;
}
#page-chat .chat-collab-panel .send-btn {
  background: #1167b1;
}
#page-chat .chat-collab-panel .send-btn:hover {
  background: #0d5798;
  transform: none;
}
#page-chat .chat-collab-panel .stop-btn:hover {
  transform: none;
}
#page-chat .chat-collab-panel .thinking-panel {
  max-height: 38vh;
  overflow: hidden;
}
#page-chat .chat-collab-panel .thinking-panel .tp-body {
  max-height: 30vh;
  overflow-y: auto;
}
#page-chat .chat-collab-panel .tool-card {
  max-height: 34vh;
}
#page-chat .chat-collab-panel .tool-card .tc-body {
  max-height: 24vh;
}

@media (max-width: 1180px) {
  .agent-catalog-layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .agent-catalog-detail {
    grid-column: 1 / -1;
    position: static;
    min-height: 0;
    max-height: none;
  }
  #page-chat .agent-workbench {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  #page-chat .chat-collab-panel {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
  }
  #page-chat .agent-profile-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    max-height: 260px;
  }
}

@media (max-width: 920px) {
  .agent-builder-panel {
    height: auto;
    min-height: 0;
  }
  .agent-builder-head,
  .agent-builder-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .agent-builder {
    grid-template-columns: 1fr;
  }
  .agent-list {
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--border-light);
  }
  .agent-form-grid {
    grid-template-columns: 1fr;
  }
  .agent-catalog-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .agent-catalog-controls {
    grid-template-columns: 1fr;
  }
  .agent-catalog-layout {
    grid-template-columns: 1fr;
  }
  .agent-catalog-sidebar {
    max-height: 220px;
  }
}

@media (max-width: 820px) {
  #page-chat .agent-workbench {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .agent-rail {
    max-height: 260px;
  }
  .agent-profile-panel {
    display: none;
  }
}

@media (max-width: 620px) {
  .agent-catalog-stats {
    grid-template-columns: 1fr;
  }
  .agent-catalog-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== 工具菜单按钮 + 弹出面板 ===== */
.tool-menu-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}
.tool-menu-btn:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,110,247,0.15);
}
.tool-menu-btn:active { transform: scale(0.92); }
.tool-menu-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(79,110,247,0.3);
}

.tool-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.tool-panel.open { max-height: 600px; overflow-y: auto; }
.tool-panel-inner {
  padding: 14px 28px 18px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}
.tool-panel.open .tool-panel-inner {
  opacity: 1;
  transform: translateY(0);
}
.tp-category {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 10px 0 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tp-category:first-child { margin-top: 0; }
.tp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tp-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
}
.tp-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ===== 思考过程面板 ===== */
.thinking-panel {
  margin: 4px 0 4px 48px;
  border: 1px solid #e8ecf1;
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.thinking-panel .tp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #f8f9fb;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e8ecf1;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.thinking-panel .tp-header:hover { background: #f0f2f6; }
.thinking-panel .tp-header.tp-collapsed {
  border-bottom: 0;
  background: #f8fafc;
}
.tp-timer {
  font-size: 11px;
  color: #e65100;
  background: #fff3e0;
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.exec-timer {
  margin-left: 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.status-bar {
  font-size: 12px;
  margin-left: 48px;
  animation: pulse 1.5s infinite;
}
.thinking-panel .tp-body {
  padding: 8px 12px;
  max-height: 360px;
  overflow-y: auto;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: #555;
}
.thinking-panel .tp-body .tp-sep {
  display: block;
  margin: 6px 0;
  height: 1px;
  background: #eee;
}
.thinking-panel .tp-body .tp-tool-label {
  color: var(--primary);
  font-weight: 600;
  font-family: var(--font);
}
.thinking-panel .tp-body .tp-result-label {
  color: var(--success);
  font-weight: 600;
  font-family: var(--font);
}
.thinking-panel .tp-body.collapsed { display: none; }

/* ===== 历史多选 ===== */
.ht-toolbar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: #fafbfc;
  flex-shrink: 0;
}
.ht-checkbox {
  margin-right: 8px;
  cursor: pointer;
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.ht-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  font-size: 13px;
  transition: background var(--transition);
}
.ht-item:hover { background: var(--bg); }
.ht-item .ht-info { flex: 1; min-width: 0; }
.ht-item .ht-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-item .ht-time { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.ht-group-title {
  padding: 10px 14px 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ht-group-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 10px;
  font-weight: 600;
  vertical-align: 1px;
}

/* ===== 调试面板 ===== */
.debug-drawer {
  position: fixed; bottom: 0; left: 220px; right: 0;
  height: 42%; min-height: 220px;
  background: #1a1f2e; color: #c8ccd4;
  z-index: 100; display: none;
  flex-direction: column;
  font-family: 'Courier New', Consolas, 'Microsoft YaHei', monospace;
  font-size: 12px;
  border-top: 2px solid #4f6ef7;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.debug-drawer.open { display: flex; }
.debug-drawer .dd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px;
  background: #242b3d;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.debug-drawer .dd-header h3 { font-size: 13px; font-weight: 600; color: #fff; font-family: var(--font); }
.debug-drawer .dd-tabs {
  display: flex; gap: 2px; padding: 0 16px;
  background: #242b3d; flex-shrink: 0;
}
.debug-drawer .dd-tab {
  padding: 6px 16px; cursor: pointer;
  font-size: 12px; font-family: var(--font);
  color: #8890a4; border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.debug-drawer .dd-tab:hover { color: #c8ccd4; }
.debug-drawer .dd-tab.active { color: #4f6ef7; border-bottom-color: #4f6ef7; }
.debug-drawer .dd-body {
  flex: 1; overflow-y: auto; padding: 8px 16px;
  line-height: 1.7;
}
.debug-drawer .dd-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 16px; background: #1e2433;
  border-top: 1px solid #333; flex-shrink: 0;
  font-size: 11px; color: #6a7090; font-family: var(--font);
}
.dd-entry { margin-bottom: 6px; border-left: 3px solid #333; padding-left: 10px; }
.dd-entry.dd-thinking { border-left-color: #e65100; }
.dd-entry.dd-toolcall { border-left-color: #2e7d32; }
.dd-entry.dd-toolresult { border-left-color: #1565c0; }
.dd-entry.dd-knowledge { border-left-color: #7b1fa2; }
.dd-entry.dd-error { border-left-color: #c62828; }
.dd-entry.dd-answer { border-left-color: #4f6ef7; }
.dd-entry .dd-time { color: #5a6080; font-size: 10px; }
.dd-entry .dd-phase { font-weight: 600; font-family: var(--font); font-size: 11px; margin-bottom: 2px; }
.dd-entry .dd-detail { color: #9098b0; word-break: break-all; white-space: pre-wrap; max-height: 120px; overflow-y: auto; font-size: 11px; }
.dd-entry .dd-detail.expanded { max-height: none; }
.dd-entry .dd-expand { color: #4f6ef7; cursor: pointer; font-size: 10px; font-family: var(--font); margin-left: 8px; }
.dd-entry .dd-args { color: #e8b84b; }
.dd-entry .dd-result { color: #6bcf7f; }
.dd-log-entry { padding: 2px 0; font-size: 11px; border-bottom: 1px solid #1e2433; }
.dd-log-entry .dd-log-lvl { font-weight: 600; margin-right: 6px; }
.dd-log-INFO { color: #6bcf7f; }
.dd-log-WARNING { color: #e8b84b; }
.dd-log-ERROR { color: #e74c3c; }
.dd-log-DEBUG { color: #6a7090; }
.dd-empty { text-align: center; padding: 30px; color: #5a6080; font-family: var(--font); }

/* ===== 侧边栏模式切换 ===== */
.sidebar-mode {
  padding: 10px 14px 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-mode .mode-label {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}
.sidebar-mode .mode-buttons {
  display: flex;
  gap: 4px;
}
.mode-btn {
  flex: 1;
  padding: 5px 0;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: #8892a8;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.mode-btn:hover { background: rgba(255,255,255,0.06); color: #d0d4e0; }
.mode-btn.active {
  background: #4f6ef7;
  color: #fff;
  border-color: #4f6ef7;
}

/* ===== 计划卡片 ===== */
.plan-card {
  margin: 8px 0 8px 48px;
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  animation: fadeIn 0.3s ease;
}
.plan-card .plan-title {
  font-size: 15px;
  font-weight: 700;
  color: #4f6ef7;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #eef1ff;
}
.plan-card .plan-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.plan-card .plan-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(79,110,247,0.08);
  border-radius: 6px;
  font-size: 13px;
}
.plan-card .plan-step .step-num {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: #4f6ef7;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.plan-card .plan-step .step-desc { flex: 1; color: #1a1f2e; }
.plan-card .plan-step .step-tool {
  font-size: 11px;
  color: #7f8c9b;
  background: #f2eee8;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.plan-card .plan-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid #f0f2f6;
}
.plan-card .plan-actions .btn-primary {
  background: #4f6ef7;
  color: #fff;
  border: none;
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.2s;
}
.plan-card .plan-actions .btn-primary:hover { background: #3b5de7; }
.plan-card .plan-actions .btn-outline {
  background: transparent;
  color: #7f8c9b;
  border: 1px solid #e8ecf1;
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.plan-card .plan-actions .btn-outline:hover { border-color: #4f6ef7; color: #4f6ef7; }

/* ===================================================================
   统计页面 — 全新优化版
   =================================================================== */

/* --- 页面容器 --- */
.stats-body { flex: 1; overflow-y: auto; padding: 20px 28px 28px; display: flex; flex-direction: column; gap: 20px; }

/* --- 统计卡片行 --- */
.stats-summary { display: flex; gap: 12px; flex-wrap: wrap; }
.s-card {
  flex: 1; min-width: 140px;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.25s cubic-bezier(.34,1.56,.64,1);
  cursor: default;
}
.s-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.s-card-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.s-card-body { flex: 1; min-width: 0; }
.s-card-number {
  font-size: 24px; font-weight: 800;
  color: var(--text); line-height: 1.15;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.s-card-label {
  font-size: 12px; color: var(--text-secondary);
  margin-top: 3px; font-weight: 500;
}

/* --- 左右布局 --- */
.stats-main { display: flex; gap: 20px; flex: 1; min-height: 0; }

/* 左列：图表卡片 — 撑满高度与右侧表格对齐 */
.stats-left { width: 320px; flex-shrink: 0; display: flex; }
.stats-chart-card {
  flex: 1;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: var(--shadow-sm);
}

/* 时间筛选 */
.stats-filter { display: flex; gap: 6px; margin-bottom: 16px; }
.filter-btn {
  padding: 5px 16px; border: 1px solid var(--border);
  border-radius: 16px; background: var(--bg);
  color: var(--text-secondary); font-size: 12px;
  cursor: pointer; font-family: inherit;
  transition: all .15s; font-weight: 500;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 8px rgba(79,110,247,.3); }

/* 扇形图 — 更紧凑 */
.chart-donut-wrap {
  position: relative; width: 280px; height: 280px; margin: 0 auto; flex-shrink: 0;
}
.chart-donut-wrap canvas { display: block; }
.chart-donut-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%); text-align: center; pointer-events: none;
}
.chart-center-num { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1.1; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.chart-center-label { font-size: 11px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }

/* 图例 */
.chart-legend { display: flex; justify-content: center; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.legend-item {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; padding: 5px 12px;
  border-radius: 8px; transition: background .15s; user-select: none;
}
.legend-item:hover { background: var(--primary-subtle); }
.legend-item.hidden { opacity: .35; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.legend-label { font-size: 12px; color: var(--text); font-weight: 500; }
.legend-num { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; font-family: "SF Mono", "Cascadia Code", Consolas, monospace; min-width: 50px; text-align: right; }

/* --- 右列：表格 --- */
.stats-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stats-table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; flex: 1;
  box-shadow: var(--shadow-sm);
}
.stats-table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.stats-table-header h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }

/* 排序按钮组 */
.stats-sort { display: flex; align-items: center; gap: 6px; }
.stats-sort-label { font-size: 12px; color: var(--text-secondary); }
.stats-sort-btn {
  padding: 4px 12px; border: 1px solid var(--border);
  border-radius: 6px; background: transparent;
  color: var(--text-secondary); font-size: 12px;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.stats-sort-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.stats-sort-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 表格滚动容器 */
.stats-table-scroll { overflow-y: auto; flex: 1; }

/* 表格 */
.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stats-table thead { background: var(--primary-subtle); position: sticky; top: 0; z-index: 2; }
.stats-table th {
  padding: 10px 14px; text-align: left; font-weight: 600;
  color: var(--text-secondary); font-size: 12px;
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
.stats-table th.num { text-align: right; }
.stats-table th.sortable { cursor: pointer; user-select: none; }
.stats-table th.sortable:hover { color: var(--primary); }

.stats-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border-light);
  color: var(--text); font-size: 13px;
}
.stats-table td.num {
  text-align: right; font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 12px;
}
.stats-table tbody tr {
  cursor: pointer; transition: background .12s;
}
.stats-table tbody tr:hover { background: var(--primary-subtle); }
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table .conv-title {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stats-table .conv-title:hover { color: var(--primary); }

/* 序号列 / 日期列 紧凑 */
.stats-table td:first-child { color: var(--text-secondary); font-size: 12px; width: 32px; text-align: center; padding-right: 4px; }
.stats-table td:nth-child(3) { white-space: nowrap; font-size: 12px; color: var(--text-secondary); }

/* 空状态 */
.stats-empty {
  padding: 60px 20px; text-align: center;
  color: var(--text-secondary); flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.stats-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .6; }
.stats-empty p { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.stats-empty-hint { font-size: 13px !important; color: var(--text-secondary) !important; opacity: .7; }

.usage-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.usage-tag.api { background: #e8f5e9; color: #2e7d32; }
.usage-tag.est { background: #fff3e0; color: #ef6c00; }

/* --- theme-fa 覆盖 --- */
.theme-fa .stats-table thead { background: var(--border-light); }

/* ===== 登录 ===== */
.login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 20, 34, 0.72);
  align-items: center;
  justify-content: center;
}
.login-overlay.open { display: flex; }
body.login-lock .main,
body.login-lock .sidebar { filter: blur(2px); pointer-events: none; }
.login-card {
  width: min(380px, 92vw);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 { margin-bottom: 6px; font-size: 22px; }
.login-sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 18px; }
.login-card label { display: block; font-size: 12px; color: var(--text-secondary); margin: 10px 0 4px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
}
.login-error { min-height: 20px; color: var(--danger); font-size: 13px; margin: 8px 0; }
.login-hint { margin-top: 12px; font-size: 12px; text-align: center; color: var(--text-secondary); }
.login-hint a { color: var(--primary); text-decoration: none; }
.login-hint a:hover { text-decoration: underline; }
.login-submit { width: 100%; margin-top: 12px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 8px 10px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--sidebar-text);
  flex-wrap: wrap;
}
.user-role-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
}
.user-role-badge.role-admin { background: rgba(79,110,247,0.35); color: #c5d0ff; }
.btn-logout {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #aab4cc;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.btn-logout:hover { color: #fff; }

/* ===== 管理页 ===== */
.admin-content { flex: 1; overflow-y: auto; padding: 20px 28px; }
.admin-stats { display: flex; gap: 16px; margin-bottom: 20px; }
.admin-stats .stat-users .stat-icon { background: #eef1ff; }
.admin-stats .stat-active .stat-icon { background: #e8f5e9; }
.admin-stats .stat-convs .stat-icon { background: #fff3e0; }
.admin-group { margin-bottom: 20px; }
.admin-create-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.admin-create-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 12px 16px;
}
@media (max-width: 900px) {
  .admin-form-grid { grid-template-columns: 1fr; }
}
.admin-form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.admin-form-field input,
.admin-form-field select,
.admin-conv-toolbar select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: 0.2s;
}
.admin-form-field input:focus,
.admin-form-field select:focus,
.admin-conv-toolbar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
}
.admin-create-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.admin-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.admin-list-count { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.admin-user-cards { display: flex; flex-direction: column; gap: 8px; }
.admin-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: 0.2s;
  box-shadow: var(--shadow-sm);
}
.admin-user-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.admin-user-card-main { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.admin-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.admin-user-avatar .icon-fa { font-size: 18px; }
.admin-user-name { font-size: 15px; font-weight: 600; color: var(--text); }
.admin-user-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.admin-role-badge.role-admin { background: var(--primary-light); color: var(--primary); }
.admin-role-badge.role-member { background: #e8f5e9; color: #1e7e34; }
.admin-role-badge.role-readonly { background: #f5f5f5; color: var(--text-secondary); }
.admin-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}
.admin-status-dot.on { background: var(--success); }
.admin-status-dot.off { background: var(--danger); }
.admin-user-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-role-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
}
.admin-conv-toolbar {
  margin-bottom: 14px;
}
.admin-conv-toolbar select {
  flex: 1;
  min-width: 160px;
  border: none;
  background: transparent;
  padding: 4px 0;
}
.admin-conv-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 16px;
  height: min(560px, calc(100vh - 260px));
  min-height: 360px;
  max-height: 560px;
}
@media (max-width: 960px) {
  .admin-conv-layout { grid-template-columns: 1fr; height: auto; max-height: none; }
  .admin-conv-panel-preview { min-height: 400px; max-height: 480px; }
}
.admin-conv-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
  min-height: 0;
  height: 100%;
}
.admin-panel-title {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.admin-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-conv-row {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.15s;
  box-shadow: var(--shadow-sm);
}
.admin-conv-row:hover { border-color: var(--primary); background: var(--primary-light); }
.admin-conv-row.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(79, 110, 247, 0.15);
}
.admin-conv-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-source-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.admin-conv-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}
.admin-conv-panel-preview {
  min-height: 0;
}
.admin-conv-preview {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-card);
}
.admin-preview-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 14px 14px;
  -webkit-overflow-scrolling: touch;
}
.admin-preview-scroll::-webkit-scrollbar { width: 6px; }
.admin-preview-scroll::-webkit-scrollbar-thumb {
  background: #c5cad6;
  border-radius: 3px;
}
.admin-preview-scroll::-webkit-scrollbar-thumb:hover { background: #a8afc0; }
.admin-preview-scroll > .admin-preview-empty,
.admin-preview-scroll > .admin-empty,
.admin-preview-scroll > .loading {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.admin-preview-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}
.admin-preview-empty .big-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.85; }
.admin-preview-empty p { font-size: 13px; }
.admin-preview-head {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  background: var(--bg-card);
}
.admin-preview-msg {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--bg);
}
.admin-preview-msg.role-user {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
}
.admin-preview-msg.role-assistant { border-left: 3px solid var(--success); }
.admin-preview-msg .msg-role {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.admin-preview-msg .msg-body {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
}
.admin-preview-msg .msg-body::-webkit-scrollbar { width: 4px; }
.admin-preview-msg .msg-body::-webkit-scrollbar-thumb {
  background: #d0d4de;
  border-radius: 2px;
}
.admin-empty, .admin-loading {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.text-muted { color: var(--text-secondary); font-size: 12px; }
#page-admin.active { display: flex; flex-direction: column; }

/* ── 群聊发言人气泡 ── */
.speaker-message .bubble { padding-top: 8px; }
.msg-speaker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.msg-speaker-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex: 0 0 auto;
}
.msg-speaker-avatar.manager { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.msg-speaker-avatar.member { background: linear-gradient(135deg, #0ea5e9, #22d3ee); }
.msg-speaker-name { font-weight: 600; font-size: 13px; }
.msg-speaker-typing { font-size: 12px; color: var(--text-secondary); animation: qihui-pulse 1.2s ease-in-out infinite; }
.speaker-avatar { width: 34px; height: 34px; font-size: 16px; }
.speaker-avatar.manager { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.speaker-avatar.member { background: linear-gradient(135deg, #0ea5e9, #22d3ee); }
.project-task-result-readonly {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--bg-soft, #f8fafc);
  font-size: 13px;
  color: var(--text-primary);
}
@keyframes qihui-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── 任务 run 实时进度条（F5 SSE 进度反馈）── */
.task-run-progress {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  max-width: 360px;
  animation: qihui-pulse 2s ease-in-out infinite;
}
.task-run-progress-body {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--bg-card, #ffffff);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  color: var(--text-primary);
}
.task-run-progress-icon {
  flex: 0 0 auto;
}
.task-run-progress-text {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-run-progress-cancel {
  flex: 0 0 auto;
  border: 1px solid var(--border, #e5e7eb);
  background: transparent;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
}
.task-run-progress-cancel:hover {
  border-color: #ef4444;
  color: #ef4444;
}
.project-task-running {
  color: var(--text-secondary, #6b7280);
  font-size: 12px;
  align-self: center;
}

/* ── 自媒体工作台 ── */
#page-media-workbench.active { display: flex; flex-direction: column; }
.media-workbench-header {
  border-bottom: 1px solid var(--border-light);
}
.mw-header-actions,
.mw-toolbar-actions,
.mw-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mw-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: #f6f7f4;
}
.mw-side {
  min-height: 0;
  padding: 16px;
  border-right: 1px solid #dde1d6;
  background: #fbfbf7;
  overflow-y: auto;
}
.mw-panel-title {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #66705c;
  text-transform: uppercase;
}
.mw-project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mw-project-item {
  width: 100%;
  min-height: 74px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid #dde1d6;
  border-radius: 8px;
  background: #fff;
  color: #263126;
  cursor: pointer;
}
.mw-project-item:hover,
.mw-project-item.active {
  border-color: #4f7f55;
  box-shadow: 0 0 0 2px rgba(79, 127, 85, 0.12);
}
.mw-project-item strong,
.mw-project-item span {
  display: block;
}
.mw-project-item span {
  margin-top: 5px;
  font-size: 12px;
  color: #6b7568;
  line-height: 1.4;
}
.mw-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  overflow: hidden;
}
.mw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dde1d6;
  border-radius: 8px;
  background: #fff;
}
.mw-toolbar strong {
  display: block;
  color: #1f2a21;
}
.mw-project-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mw-back-to-board {
  display: none;
}
.mw-toolbar span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: #6b7568;
}
.mw-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 8px;
}
.mw-stat {
  padding: 10px 12px;
  border: 1px solid #dde1d6;
  border-radius: 8px;
  background: #fff;
}
.mw-stat span {
  display: block;
  font-size: 12px;
  color: #6b7568;
}
.mw-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  color: #1f2a21;
}
.mw-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.mw-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #dde1d6;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.mw-section-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid #eef0ea;
}
.mw-section-head span {
  font-size: 12px;
  color: #7b8476;
}
.mw-board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  gap: 10px;
  padding: 12px;
  overflow-x: auto;
}
.mw-column {
  min-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mw-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-radius: 7px;
  background: #eef1e9;
  color: #344037;
  font-size: 12px;
}
.mw-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mw-task-card {
  width: 100%;
  min-height: 104px;
  padding: 10px;
  border: 1px solid #e0e4da;
  border-radius: 8px;
  background: #fff;
  color: #253126;
  text-align: left;
  cursor: pointer;
}
.mw-task-card:hover,
.mw-task-card.active {
  border-color: #4f7f55;
  background: #f8fbf4;
}
.mw-task-card strong,
.mw-task-card span,
.mw-task-card em {
  display: block;
}
.mw-task-card span,
.mw-task-card em {
  margin-top: 7px;
  font-size: 12px;
  color: #697365;
  font-style: normal;
  line-height: 1.4;
}
.mw-task-detail {
  flex: 1;
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
}
.mw-section-detail {
  display: none;
}
.mw-detail-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.mw-detail-title h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: #1f2a21;
}
.mw-detail-title span {
  font-size: 12px;
  color: #697365;
}
.mw-next-step {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #bcd1b2;
  border-radius: 8px;
  background: #f3f8ee;
}
.mw-next-step span {
  display: block;
  margin-bottom: 4px;
  color: #5e7359;
  font-size: 12px;
  font-weight: 700;
}
.mw-next-step strong {
  display: block;
  color: #1e2c20;
  font-size: 16px;
}
.mw-next-step p {
  margin: 6px 0 0;
  color: #445141;
  font-size: 13px;
  line-height: 1.5;
}
.mw-next-step em {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  color: #4f6651;
  font-size: 12px;
  font-style: normal;
  border: 1px solid #d7e2d2;
}
.mw-content-block,
.mw-candidate,
.mw-version {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e1e5dc;
  border-radius: 8px;
  background: #fbfcf8;
}
.mw-content-block > strong,
.mw-candidate > strong {
  display: block;
  margin-bottom: 8px;
}
.mw-operator-content {
  padding: 0;
  border: 0;
  background: transparent;
}
.mw-work-content {
  width: 100%;
  max-width: none;
  margin: 0;
}
.mw-content-intro {
  padding: 17px 20px;
  border-left: 5px solid #5d7f61;
  background: #eef5ec;
}
.mw-content-intro-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.mw-content-intro-head span,
.mw-content-intro-head strong,
.mw-content-intro-head p {
  display: block;
}
.mw-content-intro-head span {
  color: #536b55;
  font-size: 13px;
  font-weight: 700;
}
.mw-content-intro-head strong {
  margin-top: 4px;
  color: #18291c;
  font-size: 19px;
  line-height: 1.35;
}
.mw-content-intro-head p {
  max-width: none;
  margin: 7px 0 0;
  color: #465747;
  font-size: 14px;
  line-height: 1.6;
}
.mw-content-purpose {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #a9c1aa;
  border-radius: 6px;
  background: #fff;
  color: #34563a;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}
.mw-content-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.mw-content-checks em {
  position: relative;
  padding: 5px 8px 5px 23px;
  border: 1px solid #c9dac7;
  border-radius: 5px;
  background: #fff;
  color: #3d5540;
  font-size: 12px;
  font-style: normal;
}
.mw-content-checks em::before {
  content: "✓";
  position: absolute;
  left: 8px;
  color: #397246;
  font-weight: 800;
}
.mw-content-intro.platform {
  border-left-color: #47799a;
  background: #eaf2f7;
}
.mw-content-intro.platform .mw-content-intro-head span {
  color: #42677e;
}
.mw-content-intro.platform .mw-content-purpose {
  border-color: #b4cad8;
  color: #315e78;
}
.mw-operator-section {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  margin-top: 12px;
  border: 1px solid #dfe4db;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.mw-operator-owner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 128px;
  padding: 18px;
  border-left: 5px solid #6a876d;
  background: #eef5ed;
}
.mw-operator-owner span,
.mw-operator-owner small,
.mw-operator-owner strong {
  display: block;
}
.mw-operator-owner span {
  color: #3d6945;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}
.mw-operator-owner small {
  margin-top: 12px;
  color: #6a7969;
  font-size: 12px;
}
.mw-operator-owner strong {
  margin-top: 3px;
  color: #263e2a;
  font-size: 14px;
  line-height: 1.4;
}
.mw-operator-main {
  min-width: 0;
  padding: 16px 18px;
}
.mw-operator-main > header {
  padding-bottom: 11px;
  border-bottom: 1px solid #ebeee8;
}
.mw-operator-main > header strong,
.mw-operator-main > header p {
  display: block;
}
.mw-operator-main > header strong {
  color: #1d2a1f;
  font-size: 17px;
}
.mw-operator-main > header p {
  margin: 5px 0 0;
  color: #627060;
  font-size: 13px;
  line-height: 1.5;
}
.mw-operator-section-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}
.mw-operator-section-body .mw-field {
  grid-template-columns: 108px minmax(0, 1fr);
  padding: 10px 2px;
  border-bottom: 1px solid #f0f2ed;
  border-radius: 0;
  background: transparent;
}
.mw-operator-section-body .mw-field-long {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
}
.mw-operator-section-body .mw-field:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.mw-operator-section-body .mw-field:last-child {
  border-bottom: 0;
}
.mw-operator-section.tone-content .mw-operator-owner,
.mw-operator-section.tone-produce .mw-operator-owner {
  border-left-color: #4f7da0;
  background: #edf3f8;
}
.mw-operator-section.tone-content .mw-operator-owner span,
.mw-operator-section.tone-produce .mw-operator-owner span {
  color: #386887;
}
.mw-operator-section.tone-content .mw-operator-owner strong,
.mw-operator-section.tone-produce .mw-operator-owner strong {
  color: #294d63;
}
.mw-operator-section.tone-publish .mw-operator-owner {
  border-left-color: #3d8178;
  background: #eaf5f2;
}
.mw-operator-section.tone-publish .mw-operator-owner span {
  color: #277065;
}
.mw-operator-section.tone-publish .mw-operator-owner strong {
  color: #24554f;
}
.mw-operator-section.tone-check .mw-operator-owner {
  border-left-color: #b1792b;
  background: #fff5e7;
}
.mw-operator-section.tone-check .mw-operator-owner span {
  color: #98611b;
}
.mw-operator-section.tone-check .mw-operator-owner strong {
  color: #6e4b1e;
}
.mw-reference-details {
  margin-top: 14px;
  border: 1px solid #e1e5dc;
  border-radius: 7px;
  background: #f7f8f5;
}
.mw-reference-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}
.mw-reference-details summary::-webkit-details-marker {
  display: none;
}
.mw-reference-details summary span {
  color: #394638;
  font-size: 14px;
  font-weight: 700;
}
.mw-reference-details summary small {
  color: #7a8477;
  font-size: 11px;
}
.mw-reference-details summary::after {
  content: "展开";
  color: #59705b;
  font-size: 11px;
}
.mw-reference-details[open] summary::after {
  content: "收起";
}
.mw-reference-details summary small {
  margin-left: auto;
}
.mw-reference-details > div {
  padding: 4px 10px 10px;
  border-top: 1px solid #edf0e9;
}
.mw-candidate {
  border-color: #b7cba8;
  background: #f3f8ee;
}
.mw-candidate-list {
  display: grid;
  gap: 10px;
}
.mw-candidate-list .mw-candidate {
  margin-top: 0;
}
.mw-candidate summary {
  cursor: pointer;
  list-style: none;
}
.mw-candidate summary::-webkit-details-marker {
  display: none;
}
.mw-candidate summary::after {
  content: "展开";
  float: right;
  margin-left: 12px;
  padding: 2px 7px;
  border: 1px solid #d7e2d2;
  border-radius: 999px;
  background: #fff;
  color: #4f6651;
  font-size: 12px;
}
.mw-candidate[open] summary::after {
  content: "收起";
}
.mw-candidate-body {
  margin-top: 8px;
}
.mw-candidate > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.mw-candidate summary > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-right: 56px;
}
.mw-candidate > div:first-child span {
  display: block;
  margin-top: 4px;
  color: #64715f;
  font-size: 12px;
}
.mw-candidate > .btn {
  margin: 8px 0;
}
.mw-candidate > div:first-child > .btn,
.mw-candidate summary > div > .btn {
  flex: 0 0 auto;
}
.mw-detail-tabs {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #e2e6dc;
  overflow-x: auto;
}
.mw-detail-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #d8ded2;
  border-radius: 7px 7px 0 0;
  background: #f8faf4;
  color: #4c584b;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.mw-detail-tab:hover,
.mw-detail-tab.active {
  border-color: #9ab68f;
  background: #ffffff;
  color: #1f2a21;
  font-weight: 700;
}
.mw-detail-panel {
  min-height: 260px;
}
.mw-actions .btn[disabled],
.mw-actions .btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}
.mw-task-detail pre {
  margin: 0;
  padding: 9px;
  border-radius: 7px;
  background: #ffffff;
  color: #263126;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
}
.mw-readable {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mw-field {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px;
  border-radius: 7px;
  background: #fff;
}
.mw-field span {
  color: #6c7668;
  font-size: 12px;
  font-weight: 700;
}
.mw-field p {
  margin: 0;
  color: #253126;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.mw-field-long {
  grid-template-columns: 1fr;
}
.mw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mw-chips em {
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf2e8;
  color: #344037;
  font-size: 12px;
  font-style: normal;
}
.mw-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mw-history-item {
  padding: 8px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #edf0e8;
}
.mw-history-item > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.mw-history-item span {
  color: #697365;
  font-size: 12px;
}
.mw-history-item pre {
  max-height: 180px;
}
.mw-history-block .mw-readable {
  max-height: 220px;
  overflow: auto;
}
.mw-warn {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff1d6;
  color: #9a5b00;
  font-size: 11px;
}
.mw-metrics {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.mw-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  background: #fff;
}
.mw-metrics span {
  color: #697365;
  font-size: 12px;
}
.mw-total-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}
.mw-total-grid div {
  padding: 8px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #edf0e8;
}
.mw-total-grid strong,
.mw-total-grid em {
  display: block;
}
.mw-total-grid strong {
  color: #1f2a21;
  font-size: 18px;
}
.mw-total-grid em {
  margin-top: 2px;
  color: #697365;
  font-size: 12px;
  font-style: normal;
}
.mw-empty {
  padding: 28px 12px;
  color: #7b8476;
  text-align: center;
  font-size: 13px;
}
.mw-empty.compact {
  padding: 12px 8px;
  border: 1px dashed #d9ded3;
  border-radius: 8px;
}
.mw-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20, 29, 22, 0.38);
}
.mw-modal {
  width: min(520px, 100%);
  max-height: min(720px, 92vh);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(24, 35, 25, 0.22);
  overflow: hidden;
}
.mw-modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e6eadf;
}
.mw-modal-close {
  width: 30px;
  height: 30px;
  border: 1px solid #dde1d6;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #3b463c;
}
.mw-modal-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  overflow-y: auto;
}
.mw-modal-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: #39443a;
}
.mw-modal-form small {
  color: #7a8575;
  font-size: 12px;
  line-height: 1.45;
}
.mw-modal-form input,
.mw-modal-form textarea,
.mw-modal-form select {
  width: 100%;
  border: 1px solid #d8ded2;
  border-radius: 7px;
  padding: 9px 10px;
  font: inherit;
  color: #233026;
  background: #fbfcf8;
}
.mw-modal-form textarea {
  resize: vertical;
}
.mw-modal-form input:focus,
.mw-modal-form textarea:focus,
.mw-modal-form select:focus {
  outline: none;
  border-color: #4f7f55;
  box-shadow: 0 0 0 2px rgba(79, 127, 85, 0.14);
}
.mw-detail-mode {
  overflow-y: auto;
}
.mw-shell.mw-detail-mode {
  grid-template-columns: 1fr;
}
.mw-shell.mw-detail-mode .mw-side {
  display: none;
}
.mw-detail-mode .mw-grid {
  flex: 1;
  grid-template-columns: 1fr;
  overflow: visible;
}
.mw-detail-mode .mw-section-board,
.mw-detail-mode .mw-stats {
  display: none;
}
.mw-detail-mode .mw-toolbar-actions {
  display: none;
}
.mw-main.mw-detail-mode .mw-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 5px 14px rgba(31, 42, 33, 0.06);
}
.mw-detail-mode .mw-back-to-board {
  display: inline-flex;
}
.mw-detail-mode .mw-header-actions .btn-primary {
  display: none;
}
.mw-detail-mode .mw-section-detail {
  min-height: 0;
  display: flex;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.mw-detail-mode .mw-section-detail > .mw-section-head {
  display: none;
}
.mw-detail-mode .mw-task-detail {
  padding: 0;
  overflow: visible;
}
.mw-detail-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mw-detail-summary {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.5fr);
  border: 1px solid #dce3d7;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.mw-detail-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid #e6eae2;
}
.mw-detail-kicker {
  margin-bottom: 7px;
  color: #6c7769;
  font-size: 12px;
  font-weight: 700;
}
.mw-detail-top h3 {
  max-width: 100%;
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  color: #1f2a21;
  overflow-wrap: anywhere;
}
.mw-task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.mw-task-meta span {
  color: #697365;
  font-size: 12px;
}
.mw-task-meta .mw-task-status {
  padding: 3px 7px;
  border: 1px solid #d9e3d4;
  border-radius: 5px;
  background: #f5f8f2;
  color: #49604b;
  font-weight: 700;
}
.mw-detail-summary .mw-next-step {
  min-width: 0;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
}
.mw-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid #e0e4da;
  border-radius: 8px;
  background: #fff;
}
.mw-detail-actions > span {
  flex: 0 0 auto;
  color: #697365;
  font-size: 12px;
  font-weight: 700;
}
.mw-detail-actions .mw-actions {
  justify-content: flex-end;
}
.mw-agent-running {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #354636;
}
.mw-agent-running > i {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid #cdd9c8;
  border-top-color: #4f7f55;
  border-radius: 50%;
  animation: mw-agent-spin 0.8s linear infinite;
}
.mw-agent-running strong,
.mw-agent-running small {
  display: block;
}
.mw-agent-running strong {
  font-size: 13px;
}
.mw-agent-running small {
  margin-top: 2px;
  color: #71806e;
  font-size: 11px;
}
@keyframes mw-agent-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .mw-agent-running > i {
    animation: none;
    border-color: #4f7f55;
  }
}
.mw-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 12px;
}
.mw-platform-card,
.mw-platform-candidate,
.mw-asset-item,
.mw-shooting {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e1e5dc;
  border-radius: 8px;
  background: #fff;
}
.mw-asset-item {
  overflow: hidden;
}
.mw-asset-media {
  display: block;
  width: 100%;
  max-height: 360px;
  border-radius: 6px;
  background: #111;
  object-fit: contain;
}
.mw-asset-image-link {
  display: block;
  cursor: zoom-in;
}
.mw-asset-image-link .mw-asset-media {
  min-height: 160px;
  background: #f1f3ee;
}
.mw-asset-meta {
  margin-top: 10px;
}
.mw-asset-item:not(:has(.mw-asset-media)) .mw-asset-meta {
  margin-top: 0;
}
.mw-asset-meta > div > strong,
.mw-asset-meta > div > span {
  display: block;
}
.mw-asset-meta > div > span {
  margin-top: 3px;
  color: #6c7769;
  font-size: 12px;
}
.mw-asset-meta p a {
  color: #315f7b;
  font-weight: 700;
}
.mw-platform-candidate > strong {
  display: block;
  margin-bottom: 8px;
  color: #1f2a21;
}
.mw-platform-tabs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mw-platform-tab-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid #e0e4dc;
  border-radius: 8px;
  background: #eef1ec;
}
.mw-platform-tab-label {
  flex: 0 0 auto;
  min-width: 96px;
  min-height: 48px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #4a5648;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.mw-platform-tab-label:hover,
.mw-platform-tab-label.active {
  border-color: #93ad97;
  background: #fff;
  color: #1f3d24;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(40, 55, 42, 0.08);
}
.mw-platform-tab-label.active {
  box-shadow: inset 0 -3px 0 #4f7f55, 0 1px 3px rgba(40, 55, 42, 0.08);
}
.mw-platform-tab-label:focus-visible,
.mw-detail-tab:focus-visible,
.mw-reference-details summary:focus-visible {
  outline: 3px solid rgba(79, 110, 247, 0.3);
  outline-offset: 2px;
}
.mw-platform-tab-label span,
.mw-platform-tab-label em {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-style: normal;
  color: #6b7568;
}
.mw-platform-tab-label em {
  color: #9a5b00;
}
.mw-data-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e6f4ea;
  color: #1f6b35;
  font-size: 12px;
  font-style: normal;
  border: 1px solid #b9dfc1;
}
.mw-readonly-note {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid #d8ded2;
  border-radius: 999px;
  background: #f7f8f3;
  color: #6b7568;
  font-size: 12px;
}
.mw-platform-tab-panel .mw-platform-candidate {
  margin-top: 0;
}
.mw-publish-platform-tabs .mw-platform-card {
  margin-top: 0;
}
.mw-platform-card.status-published {
  border-color: #9cc6a0;
  background: #f6fbf4;
}
.mw-platform-card.status-skipped,
.mw-platform-card.status-failed {
  border-color: #ecd0a4;
  background: #fffaf0;
}
.mw-platform-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.mw-platform-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  margin: 10px 0;
  border: 1px solid #dfe4dc;
  border-radius: 8px;
  background: #f7f8f5;
  overflow: hidden;
}
.mw-platform-progress-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 66px;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid #dfe4dc;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mw-platform-progress-step:last-child {
  border-right: 0;
}
.mw-platform-progress-step > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 2px solid #c8cec5;
  border-radius: 50%;
  background: #fff;
  color: #737c70;
  font-size: 12px;
  font-weight: 800;
}
.mw-platform-progress-step strong,
.mw-platform-progress-step em {
  display: block;
}
.mw-platform-progress-step strong {
  color: #525d50;
  font-size: 13px;
  line-height: 1.35;
}
.mw-platform-progress-step em {
  margin-top: 3px;
  color: #7a8377;
  font-size: 11px;
  font-style: normal;
}
.mw-platform-progress-step.done {
  background: #edf5ec;
}
.mw-platform-progress-step.done > span {
  border-color: #5f8c65;
  background: #5f8c65;
  color: #fff;
}
.mw-platform-progress-step.done em {
  color: #48734e;
}
.mw-platform-progress-step.active {
  background: #eaf2f8;
  box-shadow: inset 0 -3px 0 #47799a;
}
.mw-platform-progress-step.active > span {
  border-color: #47799a;
  color: #315f7b;
}
.mw-platform-progress-step.active strong,
.mw-platform-progress-step.active em {
  color: #274f68;
}
.mw-platform-progress-step:hover {
  background: #f0f4ef;
}
.mw-platform-progress-step.locked,
.mw-platform-progress-step.locked:hover {
  background: #f3f4f1;
  color: #8b9289;
  cursor: not-allowed;
  opacity: 0.68;
}
.mw-platform-progress-step.locked > span {
  border-color: #d5d9d2;
  background: #eef0ec;
  color: #858d82;
}
.mw-platform-progress-step.locked > span i {
  font-size: 11px;
}
.mw-platform-progress-step.locked strong,
.mw-platform-progress-step.locked em {
  color: #7b8278;
}
.mw-platform-progress-step.selected {
  z-index: 1;
  box-shadow: inset 0 -4px 0 #315f7b;
}
.mw-platform-progress-step.selected > span {
  border-color: #315f7b;
}
.mw-platform-progress-step:focus-visible {
  z-index: 2;
  outline: 3px solid rgba(79, 110, 247, 0.32);
  outline-offset: -3px;
}
.mw-platform-progress.preview {
  margin-top: 0;
}
.mw-platform-step-panel {
  min-height: 180px;
}
.mw-platform-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0;
  padding: 12px 14px;
  border: 1px solid #cddfca;
  border-radius: 8px;
  background: #f5faf1;
}
.mw-platform-next > div:first-child {
  min-width: 0;
}
.mw-platform-next .mw-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
}
.mw-platform-next span {
  display: block;
  margin-bottom: 3px;
  color: #5f735b;
  font-size: 12px;
  font-weight: 700;
}
.mw-platform-next strong {
  display: block;
  color: #1f2a21;
}
.mw-platform-next p {
  margin: 5px 0 0;
  color: #445141;
  font-size: 12px;
  line-height: 1.5;
}
.mw-platform-package {
  margin-top: 8px;
}
.mw-platform-assets {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #edf0e8;
}
.mw-platform-package > strong,
.mw-platform-assets > strong {
  display: block;
  margin-bottom: 8px;
  color: #374136;
}
.mw-platform-head span,
.mw-asset-item span,
.mw-shooting span {
  display: block;
  margin-top: 4px;
  color: #697365;
  font-size: 12px;
}
.mw-note-line {
  margin-top: 8px;
  padding: 8px;
  border-radius: 7px;
  background: #f7f8f3;
  color: #596457;
  font-size: 12px;
  line-height: 1.55;
  word-break: break-word;
}
.mw-card-badge {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef1e9;
  color: #465244;
  font-size: 12px;
}
.mw-assets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.mw-asset-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.mw-asset-group {
  min-width: 0;
  padding-top: 10px;
  border-top: 2px solid #d9e2d4;
}
.mw-asset-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.mw-asset-group > header strong {
  color: #29352a;
  font-size: 14px;
}
.mw-asset-group > header span {
  color: #738070;
  font-size: 12px;
}
.mw-asset-item p,
.mw-asset-item em,
.mw-shooting p {
  display: block;
  margin: 6px 0 0;
  color: #596457;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
  font-style: normal;
}
.mw-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid #d8ded2;
  border-radius: 7px;
  background: #fbfcf8;
}
.mw-checks label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.mw-checks input[type="checkbox"],
.mw-modal-form .field-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.mw-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.mw-modal-error {
  min-height: 18px;
  color: #b42318;
  font-size: 12px;
}
@media (max-width: 1100px) {
  .mw-shell { grid-template-columns: 1fr; }
  .mw-side { max-height: 180px; border-right: 0; border-bottom: 1px solid #dde1d6; }
  .mw-project-list { flex-direction: row; overflow-x: auto; }
  .mw-project-item { min-width: 220px; }
  .mw-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .mw-section-board { min-height: 360px; }
  .mw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mw-detail-layout { grid-template-columns: 1fr; }
  .mw-detail-summary { grid-template-columns: 1fr; }
  .mw-detail-top { border-right: 0; border-bottom: 1px solid #e6eae2; }
  .mw-operator-section-body { grid-template-columns: 1fr; }
  .mw-asset-overview { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .mw-main { padding: 10px; }
  .mw-project-title-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .mw-detail-actions { align-items: flex-start; flex-direction: column; }
  .mw-detail-actions .mw-actions { justify-content: flex-start; }
  .mw-detail-summary .mw-next-step { flex-direction: column; }
  .mw-platform-progress { grid-template-columns: 1fr; }
  .mw-platform-progress-step { border-right: 0; border-bottom: 1px solid #dfe4dc; }
  .mw-platform-progress-step:last-child { border-bottom: 0; }
  .mw-platform-next { align-items: flex-start; flex-direction: column; }
  .mw-platform-next .mw-actions { justify-content: flex-start; }
  .mw-content-intro-head { flex-direction: column; }
  .mw-operator-section { grid-template-columns: 1fr; }
  .mw-operator-owner {
    min-height: 0;
    padding: 12px 14px;
    border-left: 0;
    border-top: 5px solid #6a876d;
  }
  .mw-operator-section.tone-content .mw-operator-owner,
  .mw-operator-section.tone-produce .mw-operator-owner { border-top-color: #4f7da0; }
  .mw-operator-section.tone-publish .mw-operator-owner { border-top-color: #3d8178; }
  .mw-operator-section.tone-check .mw-operator-owner { border-top-color: #b1792b; }
  .mw-operator-owner small { margin-top: 7px; }
  .mw-operator-main { padding: 14px; }
  .mw-operator-section-body .mw-field { grid-template-columns: 1fr; }
  .mw-reference-details summary small { display: none; }
}
