/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 600;
  line-height: 1.2;
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all .15s var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity:.5; cursor:not-allowed; }

.btn-primary {
  background: var(--grad-brand);
  border-color: transparent;
  color: var(--text-invert);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { filter: brightness(1.06); background: var(--grad-brand); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--text-invert); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

/* ===== Form ===== */
.form-group { display:flex; flex-direction:column; gap:6px; margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-label .req { color: var(--danger); margin-left: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-help { font-size: 11px; color: var(--text-tertiary); }
.form-error { font-size: 11px; color: var(--danger); margin-top: 2px; }

.form-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

/* ===== Cards ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.card-title .accent { width:4px; height:14px; background: var(--grad-brand); border-radius: 2px; }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease-out), box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: ""; position: absolute; right: -10px; top: -10px;
  width: 80px; height: 80px;
  background: var(--grad-mesh);
  opacity: .6; pointer-events:none;
}
.stat-card .label { color: var(--text-tertiary); font-size: 11px; margin-bottom: 4px; }
.stat-card .value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* ===== Chips / Badges ===== */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  font-size: 11px; font-weight: 600;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
  line-height: 1.3;
}
.chip.brand   { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.chip.success { background: #ecfdf5; color: #065f46; border-color: #d1fae5; }
.chip.warn    { background: #fff7ed; color: #9a3412; border-color: #ffedd5; }
.chip.danger  { background: #fef2f2; color: #991b1b; border-color: #fee2e2; }
.chip.info    { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.chip.dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* ===== Table ===== */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl .cell-actions { white-space: nowrap; }
.tbl .cell-actions .btn { margin-right: 4px; }
.tbl .code { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }

/* ===== Pagination ===== */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-surface);
  font-size: 12px; color: var(--text-tertiary);
}
.pagination-nav { display: flex; gap: 4px; }
.pagination-nav button {
  min-width: 32px; height: 30px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  border-radius: var(--r-xs);
  cursor: pointer;
  font-weight: 600;
}
.pagination-nav button:hover:not(:disabled) { background: var(--bg-hover); }
.pagination-nav button.active { background: var(--brand-500); color: white; border-color: var(--brand-500); }
.pagination-nav button:disabled { opacity:.4; cursor:not-allowed; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; top: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 99999;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 240px;
  pointer-events: auto;
  animation: slide-in .25s var(--ease-spring);
  border-left: 3px solid var(--brand-500);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warn    { border-left-color: var(--warning); }
.toast .icon { font-size: 16px; }
@keyframes slide-in {
  from { opacity:0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .4);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  animation: fadeIn .15s var(--ease-out);
}
.modal {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: modal-in .2s var(--ease-spring);
}
.modal.lg { width: min(820px, 94vw); }
.modal.xl { width: min(1100px, 96vw); }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 8px;
  background: var(--grad-glass);
}
.modal-head h3 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-close {
  background: transparent; border: none;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg-subtle);
}
@keyframes modal-in {
  from { opacity:0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ===== Tab ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  position: relative;
  transition: color .15s;
  background: none; border: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--brand-600); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: -1px;
  height: 2px;
  background: var(--grad-brand);
  border-radius: 2px 2px 0 0;
}

/* ===== Search input ===== */
.search-bar {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
}
.search-input {
  flex: 1; min-width: 200px; max-width: 320px;
}

/* ===== Progress ===== */
.progress {
  width: 100%; height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress > .bar {
  height: 100%;
  background: var(--grad-brand);
  border-radius: var(--r-full);
  transition: width .3s var(--ease-out);
}
.progress.success > .bar { background: var(--success); }
.progress.warn > .bar { background: var(--warning); }
.progress.danger > .bar { background: var(--danger); }

/* 工具卡 */
.skill-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: all .15s var(--ease-out);
}
.skill-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--brand-200); }
.skill-card .icon-box {
  width: 40px; height: 40px;
  background: var(--brand-50);
  color: var(--brand-600);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.skill-card .info { flex: 1; min-width: 0; }
.skill-card .name { font-weight: 700; font-size: 14px; }
.skill-card .desc { color: var(--text-tertiary); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== v4: 系统设置中的小型统计卡 ===== */
.stat-mini {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 110px;
  text-align: left;
}
.stat-mini .stat-num {
  font-size: 22px;
  font-weight: 600;
  color: var(--brand-600, #4f46e5);
  line-height: 1.2;
}
.stat-mini .stat-label {
  font-size: 11px;
  color: var(--text-secondary, #6b7280);
  margin-top: 2px;
}

/* ===== v4: data-table 通用样式补强 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--gray-50, #f9fafb);
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
}
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.data-table tr:hover td {
  background: var(--gray-50, #f9fafb);
}

/* ===== v7: 运行控制台弹窗 ===== */
.run-modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  z-index: 9000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.run-modal {
  background: #fff;
  width: min(1100px, 96vw); height: min(820px, 90vh);
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden;
}
.run-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border, #e5e7eb);
}
.run-modal-title { font-size: 15px; font-weight: 700; color: var(--text-primary, #111827); }
.run-modal-eid { color: var(--text-tertiary, #9ca3af); font-weight: 500; font-size: 12px; }
.run-modal-sub { font-size: 12px; color: var(--text-secondary, #6b7280); margin-top: 2px; }
.run-modal-actions { display: flex; gap: 8px; align-items: center; }
.btn-sm { padding: 4px 10px; font-size: 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; background: #fff; cursor: pointer; }
.btn-sm:hover { background: var(--gray-50, #f9fafb); }

.run-status-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 12px;
  border: 1px solid;
}
.run-status-chip.pending  { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.run-status-chip.running  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.run-status-chip.success  { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.run-status-chip.danger   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.run-status-chip.warn     { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.run-modal-progress { position: relative; height: 6px; background: var(--gray-100, #f3f4f6); }
.run-modal-progress-bar {
  position: absolute; top: 0; left: 0; height: 100%;
  background: linear-gradient(90deg, #4f46e5, #6366f1); transition: width .3s;
}
.run-modal-progress-text {
  position: absolute; right: 12px; top: 8px; font-size: 11px;
  color: var(--text-secondary, #6b7280);
}

.run-modal-body { flex: 1; display: flex; min-height: 0; }
.run-modal-steps { flex: 1; overflow-y: auto; padding: 14px 18px; border-right: 1px solid var(--border, #e5e7eb); }
.run-modal-logs { width: 380px; overflow-y: auto; padding: 10px 14px; background: #0f172a; color: #e2e8f0; display: flex; flex-direction: column; gap: 4px; font-family: ui-monospace, monospace; font-size: 11.5px; }

.step-card {
  border: 1px solid var(--border, #e5e7eb); border-radius: 8px;
  margin-bottom: 10px; overflow: hidden; background: #fff;
}
.step-card.status-running   { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.step-card.status-succeeded { border-color: #86efac; }
.step-card.status-failed    { border-color: #fca5a5; }

.step-card-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; cursor: pointer; user-select: none;
}
.step-card-row:hover { background: var(--gray-50, #f9fafb); }
.step-card-status-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.status-pending   .step-card-status-icon { background: #e5e7eb; color: #6b7280; }
.status-pending   .step-card-status-icon::after { content: "⋯"; }
.status-running   .step-card-status-icon { background: #3b82f6; color: #fff; animation: pulse 1.4s ease-in-out infinite; }
.status-running   .step-card-status-icon::after { content: "▶"; font-size: 10px; }
.status-succeeded .step-card-status-icon { background: #10b981; color: #fff; }
.status-succeeded .step-card-status-icon::after { content: "✓"; }
.status-failed    .step-card-status-icon { background: #ef4444; color: #fff; }
.status-failed    .step-card-status-icon::after { content: "✗"; }
@keyframes pulse { 0%,100%{ opacity: 1 } 50%{ opacity: .55 } }

.step-card-meta { flex: 1; min-width: 0; }
.step-card-title { font-weight: 600; font-size: 13px; color: var(--text-primary, #111827); }
.step-card-sub { font-size: 11px; color: var(--text-tertiary, #9ca3af); margin-top: 2px; }
.step-card-sub .dot { margin: 0 4px; }
.step-card-progress { width: 100px; height: 4px; background: var(--gray-100, #f3f4f6); border-radius: 2px; overflow: hidden; }
.step-card-progress-bar { height: 100%; background: var(--brand-500, #4f46e5); transition: width .3s; }

.step-card-detail {
  padding: 10px 14px 14px; background: var(--gray-50, #f9fafb);
  border-top: 1px solid var(--border, #e5e7eb);
}
.step-output {
  background: #fff; padding: 10px; border-radius: 6px;
  font-family: ui-monospace, monospace; font-size: 11px;
  white-space: pre-wrap; max-height: 200px; overflow-y: auto;
  color: #374151;
}

.step-card-artifacts { margin-top: 10px; }
.art-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; background: #fff; border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px; margin-bottom: 4px; font-size: 12px;
}
.art-item .art-icon { font-size: 16px; }
.art-item .art-name { flex: 1; color: var(--text-primary, #111827); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-item .art-size { font-size: 11px; color: var(--text-tertiary, #9ca3af); }
.art-item .art-link { font-size: 11px; color: var(--brand-600, #4f46e5); text-decoration: none; padding: 2px 6px; }
.art-item .art-link:hover { background: var(--brand-50, #eef2ff); border-radius: 3px; }
.empty-art, .empty-step { color: var(--text-tertiary, #9ca3af); font-size: 12px; padding: 8px; }

.log-line { display: flex; gap: 6px; line-height: 1.5; }
.log-line .log-ts { color: #94a3b8; font-size: 10.5px; flex-shrink: 0; }
.log-line .log-level { font-weight: 700; font-size: 10px; flex-shrink: 0; padding: 0 5px; border-radius: 3px; }
.log-line.log-info  .log-level { color: #93c5fd; }
.log-line.log-warn  .log-level { color: #fbbf24; }
.log-line.log-error .log-level { color: #fca5a5; }
.log-line .log-msg { color: #e2e8f0; word-break: break-word; }


/* ===== v10: 预览 modal ===== */
.preview-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 9100; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.preview-modal {
  background: #fff;
  width: min(1100px, 96vw); height: min(820px, 92vh);
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden;
}
.preview-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--border,#e5e7eb);
}
.preview-title { font-weight: 600; font-size: 14px; color: var(--text-primary,#111827); }
.preview-actions { display: flex; gap: 8px; }
.preview-body { flex: 1; overflow: auto; background: #fafbfc; }
.preview-img-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 14px; min-height: 100%;
}
.preview-img-wrap img { max-width: 100%; max-height: 78vh; box-shadow: 0 4px 12px rgba(0,0,0,.08); border-radius: 4px; }
.preview-text {
  white-space: pre-wrap; word-break: break-word;
  padding: 16px 22px; margin: 0;
  font-family: ui-monospace, monospace; font-size: 12px;
  line-height: 1.6; color: #1f2937; background: #fff; min-height: 100%;
}
.preview-binary {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 40px;
}
.preview-binary-icon { font-size: 56px; opacity: .55; margin-bottom: 16px; }
.preview-binary-text { font-size: 13px; color: var(--text-secondary,#6b7280); text-align: center; max-width: 360px; line-height: 1.7; }


/* ===== v10: Agent 模式 / 范式工具栏 ===== */
.agent-toolbar {
  background: #fff; border: 1px solid var(--border,#e5e7eb);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 14px;
}
.agent-mode-row { display: flex; align-items: center; gap: 14px; margin: 4px 0; }
.agent-row-label { font-size: 12px; color: var(--text-secondary,#6b7280); width: 70px; flex-shrink: 0; }
.agent-mode-tabs, .agent-paradigm-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-mode-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 12px;
  background: var(--gray-50,#f9fafb); border: 1px solid var(--border,#e5e7eb);
  border-radius: 18px; cursor: pointer; transition: all .15s;
}
.agent-mode-tab:hover { background: #eef2ff; }
.agent-mode-tab.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.agent-mode-tab .mode-icon { font-size: 14px; }

.agent-paradigm-tab {
  padding: 5px 14px; font-size: 11.5px;
  background: var(--gray-50,#f9fafb); border: 1px solid var(--border,#e5e7eb);
  border-radius: 4px; cursor: pointer;
}
.agent-paradigm-tab.active { background: #10b981; color: #fff; border-color: #10b981; }

/* ===== Chat 主区 ===== */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 14px; height: calc(100vh - 280px); min-height: 460px; }
.chat-sessions { background: #fff; border: 1px solid var(--border,#e5e7eb); border-radius: 8px; padding: 6px; overflow-y: auto; }
.chat-main { background: #fff; border: 1px solid var(--border,#e5e7eb); border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px 22px; }
.chat-input-bar {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border,#e5e7eb); background: #fafbfc;
}
.chat-input-bar textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 120px;
  border: 1px solid var(--border,#e5e7eb); border-radius: 6px;
  padding: 8px 10px; font-family: inherit; font-size: 13px; line-height: 1.6;
}

.sess-item {
  padding: 8px 10px; border-radius: 6px; cursor: pointer; position: relative;
  font-size: 12px; transition: background .12s;
  border: 1px solid transparent;
}
.sess-item:hover { background: var(--gray-50,#f9fafb); }
.sess-item.active { background: #eef2ff; border-color: #c7d2fe; }
.sess-title { font-weight: 600; color: var(--text-primary,#111827); margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-meta { display: flex; gap: 8px; font-size: 10.5px; color: var(--text-tertiary,#9ca3af); }
.sess-mode { color: #4f46e5; }
.sess-del {
  position: absolute; top: 6px; right: 6px;
  width: 18px; height: 18px; border-radius: 4px; border: none; background: transparent;
  color: #9ca3af; cursor: pointer; font-size: 14px;
}
.sess-del:hover { background: #fee2e2; color: #b91c1c; }

/* ===== 欢迎卡 ===== */
.chat-welcome { text-align: center; padding: 40px 20px; }
.welcome-icon { font-size: 48px; color: #4f46e5; opacity: .7; margin-bottom: 12px; }
.welcome-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.welcome-sub { font-size: 12px; color: var(--text-secondary,#6b7280); line-height: 1.8; margin-bottom: 20px; }
.welcome-examples { display: flex; flex-direction: column; gap: 8px; max-width: 540px; margin: 0 auto; }
.ex-chip {
  padding: 8px 14px; font-size: 12.5px;
  background: var(--gray-50,#f9fafb); border: 1px solid var(--border,#e5e7eb);
  border-radius: 18px; cursor: pointer; transition: all .12s;
}
.ex-chip:hover { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }

/* ===== 消息气泡 ===== */
.msg { margin-bottom: 14px; display: flex; }
.msg-user { justify-content: flex-end; }
.msg-user .msg-bubble {
  background: #4f46e5; color: #fff;
  padding: 9px 14px; border-radius: 12px 12px 2px 12px; max-width: 70%;
  font-size: 13px; line-height: 1.65; white-space: pre-wrap;
}
.msg-assistant { flex-direction: column; align-items: flex-start; }
.msg-assistant .msg-bubble {
  background: var(--gray-50,#f9fafb); color: var(--text-primary,#111827);
  padding: 10px 14px; border-radius: 12px 12px 12px 2px;
  border: 1px solid var(--border,#e5e7eb);
  max-width: 80%; font-size: 13px; line-height: 1.7; white-space: pre-wrap;
}
.msg-tool-banner {
  font-size: 11px; color: #4338ca; background: #eef2ff;
  padding: 4px 10px; border-radius: 10px; margin-bottom: 6px; display: inline-block;
}
.msg-tool {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 8px 12px; max-width: 80%;
  font-size: 11.5px; margin: 4px 0;
}
.msg-tool-header { color: #92400e; font-weight: 600; margin-bottom: 4px; }
.tool-trace-toggle {
  background: transparent; border: none; color: #92400e;
  cursor: pointer; font-size: 11px; padding: 2px 0;
}
.tool-trace-content {
  background: #fff; border: 1px solid #fde68a;
  border-radius: 4px; padding: 8px; max-height: 240px;
  overflow: auto; font-family: ui-monospace, monospace; font-size: 10.5px;
  white-space: pre-wrap; word-break: break-word;
}

/* ===== Tools modal ===== */
.tools-cat { margin-bottom: 16px; }
.tools-cat-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary,#111827);
  margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border,#e5e7eb);
}
.tools-cat-cnt {
  display: inline-block; font-size: 10px; font-weight: 500;
  background: var(--gray-100,#f3f4f6); padding: 1px 8px; border-radius: 10px; color: #6b7280;
}
.tools-cat-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px;
}
.tool-card {
  background: var(--gray-50,#f9fafb); border: 1px solid var(--border,#e5e7eb);
  border-radius: 6px; padding: 8px 10px;
}
.tool-card.tool-meta { background: #eff6ff; border-color: #bfdbfe; }
.tool-name { font-size: 12px; font-weight: 600; color: var(--text-primary,#111827); margin-bottom: 2px; }
.tool-desc { font-size: 11px; color: var(--text-secondary,#6b7280); line-height: 1.5; }
.chip-meta { font-size: 9px; padding: 1px 5px; background: #1d4ed8; color: #fff; border-radius: 8px; margin-left: 4px; vertical-align: middle; }

/* ===== v10: AI 工作流编排弹窗 ===== */
.plan-card {
  background: linear-gradient(135deg, #f5f3ff, #eff6ff);
  border: 1px solid #c7d2fe; border-radius: 8px; padding: 14px 16px;
}
.plan-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 12px; }
.plan-name { font-size: 14px; font-weight: 700; color: #1f2937; }
.plan-meta { font-size: 11px; color: var(--text-secondary,#6b7280); margin-top: 4px; }
.plan-conf { color: #fff; font-size: 10px; font-weight: 600; padding: 3px 10px; border-radius: 10px; }
.plan-fallback { font-size: 10px; color: #b45309; margin-top: 6px; }
.plan-section { margin-bottom: 10px; }
.plan-label { font-size: 11px; font-weight: 700; color: var(--text-secondary,#6b7280); margin-bottom: 4px; }
.plan-text { font-size: 12px; line-height: 1.7; color: #1f2937; background: #fff; padding: 6px 10px; border-radius: 4px; }
.plan-code { font-family: ui-monospace, monospace; font-size: 11px; background: #fff; padding: 6px 10px; border-radius: 4px; margin: 0; white-space: pre-wrap; }
.plan-steps { display: flex; flex-direction: column; gap: 4px; }
.plan-step { font-size: 12px; padding: 4px 10px; background: #fff; border-radius: 4px; }
.plan-ok { color: #047857; font-size: 12px; font-weight: 600; margin-top: 8px; }
.plan-warn { color: #b45309; font-size: 12px; font-weight: 600; margin-top: 8px; }

/* ===== v10: 报告模板页 ===== */
.tpl-card {
  background: #fff; border: 1px solid var(--border,#e5e7eb);
  border-radius: 8px; padding: 14px; transition: all .15s;
}
.tpl-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); border-color: #c7d2fe; }
.tpl-card-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.tpl-name { font-size: 14px; font-weight: 700; color: var(--text-primary,#111827); }
.tpl-code { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-tertiary,#9ca3af); margin-top: 2px; }
.tpl-chip-builtin { font-size: 10px; padding: 2px 8px; background: #eef2ff; color: #4338ca; border-radius: 10px; }
.tpl-desc { font-size: 12px; color: var(--text-secondary,#6b7280); line-height: 1.7; margin-bottom: 10px; min-height: 60px; }
.tpl-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tpl-tag { font-size: 10px; padding: 2px 8px; background: var(--gray-50,#f9fafb); border: 1px solid var(--border,#e5e7eb); border-radius: 10px; color: #6b7280; }
.tpl-foot .btn-sm { margin-left: auto; }

.tpl-sections { display: flex; flex-direction: column; gap: 6px; }
.tpl-section { display: flex; gap: 10px; padding: 8px 10px; background: var(--gray-50,#f9fafb); border-radius: 6px; }
.tpl-section-no {
  width: 22px; height: 22px; flex-shrink: 0;
  background: #4f46e5; color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.tpl-section-body { flex: 1; }
.tpl-section-type { font-family: ui-monospace, monospace; font-size: 12px; font-weight: 600; color: #1f2937; }
.tpl-section-desc { font-size: 11px; color: var(--text-secondary,#6b7280); margin-top: 2px; }
.tpl-section-text { font-size: 11.5px; color: #4338ca; margin-top: 4px; font-style: italic; }

/* ===== v11: AI 按钮禁用样式 ===== */
button.ai-disabled, .btn.ai-disabled {
  opacity: 0.5; cursor: not-allowed !important;
  filter: grayscale(0.4);
}
button.ai-disabled:hover { background: inherit !important; }

/* v11: AI 输出展示框 */
.ai-output-box {
  background: linear-gradient(135deg, #f5f3ff, #eff6ff);
  border: 1px solid #c7d2fe;
  border-radius: 8px; padding: 14px 18px;
  font-size: 13px; line-height: 1.75; color: #1f2937;
  white-space: pre-wrap; word-break: break-word;
  font-family: inherit;
}
.ai-output-box h4 { margin: 0 0 6px; color: #4338ca; font-size: 13px; }
.ai-output-box .ai-section { margin-bottom: 12px; }
.ai-output-box .ai-section:last-child { margin-bottom: 0; }
.ai-loading {
  text-align: center; padding: 30px;
  color: #6b7280; font-size: 13px;
}
.ai-loading-spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid #e0e7ff; border-top-color: #4f46e5;
  border-radius: 50%; animation: ai-spin .9s linear infinite;
  margin-right: 10px; vertical-align: middle;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* v11: 步骤 AI 解读小气泡 */
.step-ai-insight {
  margin: 6px 0 0 36px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #f5f3ff, #eff6ff);
  border-left: 3px solid #4f46e5;
  border-radius: 4px;
  font-size: 11.5px; line-height: 1.6; color: #1f2937;
}
.step-ai-insight .ai-icon { color: #4338ca; margin-right: 4px; font-weight: 700; }

/* v11: AI 标记 chip */
.ai-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  background: #eef2ff;
  color: #4338ca;
  border-radius: 8px;
  vertical-align: middle;
  margin-left: 4px;
  font-weight: 500;
}
.ai-action {
  background: linear-gradient(135deg, #f5f3ff, #eef2ff) !important;
  color: #4338ca !important;
  border-color: #c7d2fe !important;
}

/* v13: Agent 推荐卡片 hover */
.reco-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  border-color: #c7d2fe !important;
}
