/* ============ 基础变量与重置 ============ */
:root {
  /* 中性色 */
  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --bg-subtle: #fafbfc;
  --bg-hover: #f2f4f7;
  --bg-elevated: #ffffff;
  --bg-dark: #0f172a;
  --bg-sidebar: #ffffff;
  --bg-sidebar-active: #eff6ff;

  /* 文字 */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-disabled: #cbd5e1;
  --text-inverse: #ffffff;

  /* 边框 */
  --border-light: #e2e8f0;
  --border-default: #cbd5e1;
  --border-strong: #94a3b8;

  /* 主题色：蓝（AI） */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  /* 状态色：绿（成功） */
  --success-50: #ecfdf5;
  --success-500: #10b981;
  --success-600: #059669;

  /* 状态色：橙（待处理/风险） */
  --warning-50: #fff7ed;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  /* 状态色：红（严重） */
  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;

  /* 紫色（高级） */
  --purple-50: #faf5ff;
  --purple-500: #a855f7;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.04);

  /* 圆角 */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* 布局 */
  --sidebar-w: 220px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html, body {
  height: 100%;
  overflow: hidden; /* 禁止 document 滚动，滚动交给内部容器 */
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ 整体布局 ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;        /* 固定视口高度，禁用整页滚动 */
  overflow: hidden;
}
.app.collapsed { grid-template-columns: 64px 1fr; }

/* ============ 侧边栏 ============ */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  height: var(--topbar-h);
}
.brand-logo {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-logo i { width: 18px; height: 18px; }
.brand-text { line-height: 1.2; min-width: 0; }
.brand-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.brand-env { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.app.collapsed .brand-text { display: none; }

.nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 2px;
  white-space: nowrap;
}
.nav-item [data-lucide] { width: 16px; height: 16px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.nav-item [data-lucide] svg { width: 16px; height: 16px; }
.nav-item i { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 500;
}
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge {
  background: var(--danger-500);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}
.app.collapsed .nav-label,
.app.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-light);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.user-card:hover { background: var(--bg-hover); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.user-switch { width: 14px; height: 14px; color: var(--text-tertiary); }
.app.collapsed .user-info,
.app.collapsed .user-switch { display: none; }

/* ============ 顶部工具栏 ============ */
.main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  height: 100vh;        /* 填满视口，与 .app 一起禁用整页滚动 */
  overflow: hidden;
}
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 9;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-center { flex: 1; max-width: 480px; margin: 0 auto; }
.breadcrumb {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}
.search-box {
  position: relative;
  display: flex; align-items: center;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 0 12px;
  height: 36px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.search-box i { width: 14px; height: 14px; color: var(--text-tertiary); }
.search-box input {
  flex: 1;
  border: none; outline: none; background: transparent;
  margin: 0 8px;
  color: var(--text-primary);
}
.search-box kbd {
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 4px;
  color: var(--text-tertiary);
}
.icon-btn {
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn i { width: 16px; height: 16px; }
.badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger-500);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}
.env-switch { display: flex; gap: 2px; background: var(--bg-page); padding: 2px; border-radius: var(--r-md); }
.env-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
}
.env-tag.env-prod { background: var(--primary-600); color: #fff; }
.topbar-time { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

/* ============ 内容区 ============ */
.content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 20px 24px 32px;
  overflow: auto;  /* 默认：内容区自身滚动（普通页面） */
}

/* 包含右侧子面板的页面：让 content 不滚动，子面板各自管理滚动 */
.content:has(.workbench),
.content:has(.user-chat),
.content:has(.prompt-editor) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 16px;
}
.content:has(.workbench) .page-header,
.content:has(.user-chat) .page-header,
.content:has(.prompt-editor) .page-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}
.content:has(.workbench) .workbench,
.content:has(.user-chat) .user-chat,
.content:has(.prompt-editor) .prompt-editor {
  flex: 1 1 0;
  min-height: 0;
  height: auto;       /* 覆盖基础 height: calc(...) */
  align-self: stretch;
  width: 100%;
}
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 20px; font-weight: 600; margin: 0; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============ 通用组件 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-primary);
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-default); }
.btn i { width: 14px; height: 14px; }
.btn.btn-primary { background: var(--primary-600); color: #fff; border-color: var(--primary-600); }
.btn.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn.btn-ghost { border-color: transparent; background: transparent; }
.btn.btn-ghost:hover { background: var(--bg-hover); }
.btn.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn.btn-danger { background: var(--danger-500); color: #fff; border-color: var(--danger-500); }
.btn.btn-danger:hover { background: var(--danger-600); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.card-title { font-size: 14px; font-weight: 600; margin: 0; }
.card-subtitle { font-size: 12px; color: var(--text-tertiary); }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ============ 标签 ============ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.tag.tag-primary { background: var(--primary-50); color: var(--primary-600); }
.tag.tag-success { background: var(--success-50); color: var(--success-600); }
.tag.tag-warning { background: var(--warning-50); color: var(--warning-600); }
.tag.tag-danger { background: var(--danger-50); color: var(--danger-600); }
.tag.tag-purple { background: var(--purple-50); color: var(--purple-500); }
.tag.tag-outline { background: transparent; border: 1px solid var(--border-light); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* 状态点 */
.status-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 6px;
  vertical-align: middle;
}
.status-online { background: var(--success-500); }
.status-warning { background: var(--warning-500); }
.status-offline { background: var(--text-tertiary); }
.status-danger { background: var(--danger-500); }

/* ============ 表格 ============ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tr:hover td { background: var(--bg-subtle); }
.table tr:last-child td { border-bottom: none; }

/* ============ 表单 ============ */
.form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.form-label { font-size: 13px; color: var(--text-secondary); min-width: 80px; }
.input, .select, .textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: #fff;
  outline: none;
  transition: border-color .15s;
  font-size: 13px;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary-500); box-shadow: 0 0 0 3px var(--primary-50); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ============ 指标卡 ============ */
.metric {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all .15s;
}
.metric:hover { border-color: var(--primary-200); box-shadow: var(--shadow-md); }
.metric-label { font-size: 12px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; }
.metric-label i { width: 14px; height: 14px; }
.metric-value { font-size: 24px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1.2; }
.metric-trend { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.metric-trend.up { color: var(--success-600); }
.metric-trend.down { color: var(--danger-600); }
.metric-trend i { width: 12px; height: 12px; }

/* ============ 聊天/工作台通用 ============ */
.chat-list { display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; min-width: 0; }
.chat-msg > div { min-width: 0; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.chat-msg.ai .chat-avatar { background: var(--primary-100); color: var(--primary-700); }
.chat-msg.user .chat-avatar { background: var(--bg-hover); color: var(--text-secondary); }
.chat-bubble {
  max-width: 70%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}
.chat-msg.ai .chat-bubble { background: #fff; border: 1px solid var(--border-light); }
.chat-msg.user .chat-bubble { background: var(--primary-600); color: #fff; }
.chat-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* 步骤条 */
.steps { display: flex; align-items: center; gap: 4px; padding: 8px 0; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-subtle);
}
.step.active { background: var(--primary-50); color: var(--primary-600); }
.step.done { background: var(--success-50); color: var(--success-600); }
.step.loading { color: var(--primary-600); }
.step.loading::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary-500);
  animation: pulse 1s infinite;
}
.step i { width: 12px; height: 12px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ============ 工作台三栏 ============ */
.workbench {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 56px);
  min-height: 600px;
}
.wb-col {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.wb-col-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.wb-col-title { font-size: 13px; font-weight: 600; }
.wb-col-tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.wb-col-tab {
  padding: 6px 10px; font-size: 12px;
  color: var(--text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.wb-col-tab.active { color: var(--primary-600); border-bottom-color: var(--primary-600); font-weight: 500; }
.wb-col-body { flex: 1; overflow-y: auto; padding: 12px 16px; min-height: 0; }

/* 会话队列项 */
.session-item {
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.session-item:hover { background: var(--bg-hover); }
.session-item.active { background: var(--primary-50); border-color: var(--primary-200); }
.session-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.session-user { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.session-time { font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.session-msg { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-tags { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }

/* ============ 抽屉 ============ */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 600px; max-width: 90vw;
  background: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 101;
  transform: translateX(100%);
  transition: transform .25s;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-light);
}
.drawer-header h3 { margin: 0; font-size: 15px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }

/* ============ Toast ============ */
.toast-container {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #0f172a;
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  pointer-events: auto;
}
.toast.success { background: var(--success-600); }
.toast.warning { background: var(--warning-600); }
.toast.danger { background: var(--danger-600); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ============ 流程图 ============ */
.flow-graph {
  position: relative;
  width: 100%;
  min-height: 460px;
  background:
    radial-gradient(circle, var(--border-light) 1px, transparent 1px);
  background-size: 16px 16px;
  padding: 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
}
.flow-svg {
  position: absolute; inset: 0;
  pointer-events: none;
  width: 100%; height: 100%;
}
.flow-nodes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  z-index: 1;
}
.flow-col-title {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.flow-node {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  position: relative;
  cursor: pointer;
  transition: all .15s;
}
.flow-node:hover { border-color: var(--primary-500); box-shadow: var(--shadow-md); }
.flow-node-name { font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.flow-node-meta { font-size: 11px; color: var(--text-tertiary); display: flex; gap: 8px; }
.flow-node-type {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 4px;
}
.flow-node.main .flow-node-type { background: var(--primary-50); color: var(--primary-600); }
.flow-node.business .flow-node-type { background: var(--success-50); color: var(--success-600); }
.flow-node.tool .flow-node-type { background: var(--warning-50); color: var(--warning-600); }

/* ============ 用户端对话页 ============ */
.user-chat {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 56px);
  min-height: 600px;
}
.user-chat-main {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.uc-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.uc-brand { display: flex; align-items: center; gap: 8px; }
.uc-brand .brand-logo { width: 28px; height: 28px; }
.uc-brand .brand-logo i { width: 14px; height: 14px; }
.uc-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.uc-body { flex: 1; overflow-y: auto; padding: 20px; min-height: 0; }
.uc-input-area {
  border-top: 1px solid var(--border-light);
  padding: 12px 20px;
}
.uc-quick-q { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.uc-quick-q .tag { cursor: pointer; }
.uc-quick-q .tag:hover { background: var(--primary-50); color: var(--primary-600); }
.uc-input-row { display: flex; gap: 8px; align-items: flex-end; }
.uc-input {
  flex: 1;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 8px 12px;
  min-height: 38px; max-height: 120px;
  resize: none;
  outline: none;
  font-size: 14px;
  line-height: 1.5;
}
.uc-input:focus { border-color: var(--primary-500); }
.uc-tools { display: flex; gap: 4px; padding: 4px 0; }

.uc-side {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.uc-side-tabs { display: flex; border-bottom: 1px solid var(--border-light); }
.uc-side-tab {
  flex: 1;
  padding: 10px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.uc-side-tab.active { color: var(--primary-600); border-bottom-color: var(--primary-600); font-weight: 500; }
.uc-side-body { flex: 1; overflow-y: auto; padding: 16px; min-height: 0; }

/* 引用块 */
.quote-block {
  background: var(--bg-subtle);
  border-left: 3px solid var(--primary-500);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.quote-block .quote-title { font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }

/* 评价按钮 */
.feedback-btns {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; flex-wrap: wrap;
}
.feedback-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.feedback-btn i { width: 11px; height: 11px; }
.feedback-btn:hover:not(.disabled):not([disabled]) {
  border-color: var(--primary-500);
  color: var(--primary-600);
  background: var(--primary-50);
}
/* 已选中（高亮，蓝色 + 实心背景，不置灰） */
.feedback-btn.voted,
.feedback-btn.voted[disabled] {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: #fff;
  opacity: 1;
  cursor: default;
}
.feedback-btn.voted i { color: #fff; }
/* 置灰禁用（淡一些：低饱和、低对比，不带删除线） */
.feedback-btn.disabled,
.feedback-btn[disabled] {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  color: var(--text-tertiary);
  opacity: 0.4;
  cursor: not-allowed;
}
.feedback-btn.disabled i,
.feedback-btn[disabled] i { color: var(--text-tertiary); }
.feedback-btn.disabled:hover,
.feedback-btn[disabled]:hover { background: var(--bg-subtle); color: var(--text-tertiary); }
/* "已记录"提示 */
.feedback-tip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px;
  color: var(--success, #10b981);
  margin-left: 4px;
  white-space: nowrap;
}
.feedback-tip i { width: 12px; height: 12px; }

/* 进度状态 */
.progress-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--primary-600);
  margin: 4px 0;
}
.progress-status i { width: 12px; height: 12px; }
.spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--primary-100);
  border-top-color: var(--primary-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 推荐回复 ============ */
.reply-suggestion {
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .2s ease;
  background: #fff;
  position: relative;
  user-select: none;
}
.reply-suggestion:hover { border-color: var(--primary-500); background: var(--primary-50); }
.reply-suggestion:active { transform: scale(0.99); }
/* 选中态：蓝色边框 + 浅蓝背景 + 左侧色条 */
.reply-suggestion.is-selected {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
  padding-left: 15px; /* 留出左侧色条位置 */
}
.reply-suggestion.is-selected::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--primary-500);
  border-radius: 0 2px 2px 0;
}
/* 编辑态：黄色边框 + 微抖动动画 */
.reply-suggestion.is-editing {
  border-color: var(--warning-500);
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
  cursor: default;
  animation: reply-edit-pulse 1.5s ease-in-out infinite;
}
@keyframes reply-edit-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08); }
  50% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
}
/* 已发送：绿色边框 + 半透明 + 勾选图标 */
.reply-suggestion.is-sent {
  border-color: var(--success-500);
  background: #f0fdf4;
  cursor: default;
}
.reply-suggestion.is-sent .reply-text {
  color: var(--text-secondary);
}
.reply-suggestion.is-sent::after {
  content: '✓';
  position: absolute;
  right: 10px; top: 10px;
  width: 22px; height: 22px;
  background: var(--success-500);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold;
  animation: reply-sent-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes reply-sent-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}
/* 已拒绝：灰色 + 文字划线 */
.reply-suggestion.is-rejected {
  border-color: var(--border-light);
  background: var(--bg-subtle);
  opacity: 0.7;
  cursor: default;
}
.reply-suggestion.is-rejected .reply-text {
  text-decoration: line-through;
  text-decoration-color: var(--text-tertiary);
  color: var(--text-tertiary);
}

.reply-suggestion .reply-tag { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; flex-wrap: wrap; }
.reply-suggestion .reply-text { font-size: 12px; color: var(--text-primary); line-height: 1.6; }
.reply-suggestion .reply-actions {
  display: flex; gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
  align-items: center;
}
.reply-suggestion .reply-actions .btn { font-size: 11px; }
/* 状态标签 */
.reply-state-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.reply-state-tag i { width: 11px; height: 11px; }
.reply-state-selected { background: var(--primary-50); color: var(--primary-600); }
.reply-state-sent { background: #dcfce7; color: #166534; }
.reply-state-rejected { background: var(--bg-hover); color: var(--text-tertiary); }

/* 编辑态：内联 textarea + 操作栏 */
.reply-edit-area {
  font-size: 12px;
  line-height: 1.6;
  min-height: 80px;
  margin-top: 4px;
  border-color: var(--warning-500);
}
.reply-edit-area:focus {
  border-color: var(--warning-500);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}
.reply-edit-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--warning-500);
}

/* ===== 推荐回复 - 点击效果增强 ===== */

/* Material Design 风格的点击波纹 */
.reply-suggestion .reply-ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.18;
  pointer-events: none;
  transform: scale(0);
  animation: reply-ripple-anim 0.6s ease-out forwards;
  z-index: 1;
}
@keyframes reply-ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* 卡片悬浮提升效果 */
.reply-suggestion {
  position: relative;
  overflow: hidden;
}
.reply-suggestion:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

/* 操作按钮：默认隐藏，hover 浮现 */
.reply-suggestion .reply-actions {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  transition: opacity .18s ease, max-height .25s ease, margin-top .2s ease;
}
.reply-suggestion:hover .reply-actions,
.reply-suggestion.is-selected .reply-actions,
.reply-suggestion.is-editing .reply-actions,
.reply-suggestion:focus-within .reply-actions {
  opacity: 1;
  max-height: 60px;
  margin-top: 8px;
}
/* 已发送/已拒绝态：始终展示操作栏 */
.reply-suggestion.is-sent .reply-actions,
.reply-suggestion.is-rejected .reply-actions {
  opacity: 1;
  max-height: 60px;
  margin-top: 8px;
}

/* 快捷键徽标（数字键 1/2/3 快速发送） */
.reply-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  border: 1px solid var(--border-light);
  margin-right: 2px;
}
.reply-suggestion.is-selected .reply-shortcut,
.reply-suggestion.is-sent .reply-shortcut {
  background: var(--primary-600);
  color: #fff;
  border-color: var(--primary-600);
}
.reply-suggestion.is-rejected .reply-shortcut {
  opacity: 0.4;
}

/* 文本可点击复制提示 */
.reply-text {
  cursor: text;
  position: relative;
}
.reply-suggestion.is-sent .reply-text,
.reply-suggestion.is-editing .reply-text,
.reply-suggestion.is-rejected .reply-text {
  cursor: default;
}
.reply-text:hover::after {
  content: '点击复制';
  position: absolute;
  top: -22px;
  right: 0;
  background: var(--text-primary);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  animation: reply-copy-hint .4s .6s ease-out forwards;
  white-space: nowrap;
  z-index: 5;
}
@keyframes reply-copy-hint {
  to { opacity: 0.9; }
}

/* 重新生成加载态：骨架/呼吸 */
.reply-suggestion.is-loading {
  border-color: var(--border-light);
  background: var(--bg-subtle);
  cursor: wait;
  opacity: 0.85;
  animation: reply-loading-breath 1.4s ease-in-out infinite;
}
.reply-suggestion.is-loading .reply-text {
  color: var(--text-tertiary);
  background: linear-gradient(90deg, var(--bg-hover) 0%, #fff 50%, var(--bg-hover) 100%);
  background-size: 200% 100%;
  animation: reply-shimmer 1.4s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  border-radius: 4px;
}
.reply-suggestion.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, 0.04) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: reply-shimmer-bg 1.4s linear infinite;
  pointer-events: none;
}
@keyframes reply-loading-breath {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
  50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.06); }
}
@keyframes reply-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes reply-shimmer-bg {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 顶部快捷键提示条 */
.reply-shortcuts-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 6px 10px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, var(--primary-50), transparent);
  border-left: 2px solid var(--primary-500);
  border-radius: 4px;
  flex-wrap: wrap;
}
.reply-shortcuts-hint kbd {
  display: inline-block;
  font-size: 10px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 0 5px;
  min-width: 16px;
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--text-secondary);
  box-shadow: 0 1px 0 var(--border-light);
  margin: 0 1px;
}
.reply-shortcuts-hint .hint-item { display: inline-flex; align-items: center; gap: 4px; }

/* 已发送计数徽标 */
.reply-sent-counter {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--success-50);
  color: var(--success-600);
  font-weight: 500;
  margin-left: 4px;
}
.reply-sent-counter i { width: 10px; height: 10px; }

/* 庆祝粒子（轻量版，避免视觉过载） */
.reply-suggestion .reply-burst {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
}
.reply-burst--1 { background: #10b981; }
.reply-burst--2 { background: #3b82f6; }
.reply-burst--3 { background: #f59e0b; }
.reply-burst--4 { background: #a855f7; }
@keyframes reply-burst-fly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: var(--burst-end) scale(0.2); opacity: 0; }
}
.reply-suggestion .reply-burst {
  animation: reply-burst-fly 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 聊天区新消息高亮 */
.chat-msg--new {
  animation: chat-new-glow 1.6s ease-out;
}
@keyframes chat-new-glow {
  0% {
    background: rgba(16, 185, 129, 0.18);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
    border-radius: var(--r-lg);
  }
  60% {
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.08);
    border-radius: var(--r-lg);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
    border-radius: var(--r-lg);
  }
}
.chat-msg--new.user {
  animation: chat-new-glow-user 1.6s ease-out;
}
@keyframes chat-new-glow-user {
  0% {
    background: rgba(59, 130, 246, 0.18);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
    border-radius: var(--r-lg);
  }
  60% {
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
    border-radius: var(--r-lg);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
    border-radius: var(--r-lg);
  }
}

/* 按钮点击反馈 - 按下时缩放 */
.reply-suggestion .btn:active {
  transform: scale(0.94);
  transition: transform 0.05s;
}
.reply-suggestion .btn {
  transition: all .15s ease;
}

/* 选中态增强：左侧色条 + 顶部细线动画 */
.reply-suggestion.is-selected::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-200));
  border-radius: 0 0 2px 2px;
  animation: reply-select-bar 0.4s ease-out;
}
@keyframes reply-select-bar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* 发送按钮悬浮提示 */
.reply-suggestion [data-action="send"]:hover {
  background: var(--primary-700) !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.reply-suggestion [data-action="edit"]:hover {
  border-color: var(--warning-500);
  color: var(--warning-600);
  background: #fffbeb;
}
.reply-suggestion [data-action="copy"]:hover {
  border-color: var(--primary-500);
  color: var(--primary-600);
  background: var(--primary-50);
}
.reply-suggestion [data-action="reject"]:hover {
  border-color: var(--danger-500);
  color: var(--danger-600);
  background: var(--danger-50);
}

/* 知识片段 */
.chunk {
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
}
.chunk:hover { border-color: var(--primary-500); }
.chunk-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chunk-id { font-size: 11px; color: var(--text-tertiary); font-family: monospace; }
.chunk-content { font-size: 12px; color: var(--text-primary); line-height: 1.6; }
.chunk-meta { display: flex; gap: 6px; margin-top: 6px; font-size: 11px; color: var(--text-tertiary); }

/* ============ 提示词编辑器 ============ */
.prompt-editor {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 56px);
  min-height: 600px;
}
.prompt-col {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.prompt-col-header { padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; font-weight: 600; }
.prompt-col-body { flex: 1; overflow-y: auto; padding: 12px 16px; min-height: 0; }

.prompt-tree-item {
  padding: 6px 8px;
  border-radius: var(--r-md);
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  color: var(--text-secondary);
}
.prompt-tree-item:hover { background: var(--bg-hover); }
.prompt-tree-item.active { background: var(--primary-50); color: var(--primary-600); font-weight: 500; }
.prompt-tree-item i { width: 12px; height: 12px; }
.prompt-tree-group { margin-bottom: 8px; }
.prompt-tree-group-title { font-size: 11px; color: var(--text-tertiary); padding: 4px 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.prompt-section {
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  margin-bottom: 12px;
}
.prompt-section-header {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 500;
}
.prompt-section-body { padding: 12px; }

/* ============ 模型路由 ============ */
.model-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.model-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary-500);
}
.model-card.turbo::before { background: var(--success-500); }
.model-card.plus::before { background: var(--primary-500); }
.model-card.max::before { background: var(--purple-500); }
.model-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.model-name { font-size: 14px; font-weight: 600; }
.model-tier { font-size: 11px; color: var(--text-tertiary); margin-bottom: 4px; }
.model-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.model-stat { font-size: 11px; color: var(--text-tertiary); }
.model-stat-val { font-size: 14px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ============ 图表 ============ */
.chart-container { position: relative; height: 240px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; }
.chart-legend-item { display: flex; align-items: center; gap: 4px; }
.chart-legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* SVG bar chart */
.bar-chart { width: 100%; height: 200px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.bar-label { min-width: 100px; color: var(--text-secondary); }
.bar-track { flex: 1; height: 8px; background: var(--bg-page); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary-500); border-radius: 4px; transition: width .3s; }
.bar-value { min-width: 50px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); }

/* ============ 漏斗图 ============ */
.funnel { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 12px 0; }
.funnel-step {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: var(--primary-50);
  color: var(--primary-700);
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
}
.funnel-step:nth-child(2) { width: 90%; }
.funnel-step:nth-child(3) { width: 80%; }
.funnel-step:nth-child(4) { width: 70%; }
.funnel-step:nth-child(5) { width: 60%; }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============ 实用类 ============ */
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: justify-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-primary-color { color: var(--primary-600); }
.text-success { color: var(--success-600); }
.text-warning { color: var(--warning-600); }
.text-danger { color: var(--danger-600); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.cursor-pointer { cursor: pointer; }

/* 空状态 */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: 13px;
}
.empty-state i { width: 36px; height: 36px; margin-bottom: 8px; opacity: 0.6; }

/* 响应式 */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .workbench { grid-template-columns: 240px 1fr 280px; }
  .prompt-editor { grid-template-columns: 200px 1fr 280px; }
  .bc-adjudicate { grid-template-columns: 1fr; }
  .bc-annotate { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .workbench, .prompt-editor, .user-chat { grid-template-columns: 1fr; height: auto; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: 12px; }
}

/* ============================================================
   Bad Case 裁定模块
   ============================================================ */

/* 角色切换器 */
.role-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.role-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .15s;
}
.role-pill i { width: 18px; height: 18px; color: var(--text-tertiary); flex-shrink: 0; }
.role-pill:hover { border-color: var(--primary-500); background: var(--primary-50); }
.role-pill.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 1px var(--primary-500);
}
.role-pill.active i { color: var(--primary-600); }

/* 漏斗概览 */
.bc-funnel {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.bc-funnel-item {
  text-align: center;
  padding: 12px 6px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all .15s;
}
.bc-funnel-item:hover { background: var(--bg-hover); transform: translateY(-1px); }
.bc-funnel-item .v { font-size: 22px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.bc-funnel-item .l { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.bc-funnel-item.urgent { background: #fef2f2; }
.bc-funnel-item.urgent .v { color: #dc2626; }
.bc-funnel-item.primary { background: var(--primary-50); }
.bc-funnel-item.primary .v { color: var(--primary-600); }
.bc-funnel-item.success { background: var(--success-50); }
.bc-funnel-item.success .v { color: var(--success-600); }
.bc-funnel-item.warning { background: #fff7ed; }
.bc-funnel-item.warning .v { color: #d97706; }
.bc-funnel-item.purple { background: var(--purple-50); }
.bc-funnel-item.purple .v { color: var(--purple-500); }

/* 状态时间线 */
.bc-timeline { position: relative; padding-left: 6px; }
.bc-tl-item {
  position: relative;
  padding-left: 24px;
  padding-bottom: 16px;
}
.bc-tl-item:last-child { padding-bottom: 0; }
.bc-tl-dot {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  z-index: 1;
}
.bc-tl-dot.active { background: var(--primary-500); border-color: var(--primary-500); box-shadow: 0 0 0 4px var(--primary-50); }
.bc-tl-dot.done { background: var(--success-500); border-color: var(--success-500); }
.bc-tl-line {
  position: absolute;
  left: 9px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background: var(--border-light);
}
.bc-tl-item:last-child .bc-tl-line { display: none; }
.bc-tl-body { padding-top: 2px; }

/* 状态流转图（横向） */
.bc-flow {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 20px 12px;
  overflow-x: auto;
}
.bc-flow-track {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 600px;
  position: relative;
  gap: 4px;
}
.bc-flow-track::before {
  content: '';
  position: absolute;
  left: 24px; right: 24px;
  top: 14px;
  height: 2px;
  background: var(--border-light);
  z-index: 0;
}
.bc-flow-node {
  flex: 1;
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 4px;
}
.bc-flow-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  background: #fff;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  transition: all .2s;
}
.bc-flow-node.active .bc-flow-circle {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px var(--primary-50);
}
.bc-flow-label {
  font-size: 12px;
  margin-bottom: 4px;
}
.bc-flow-desc {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1.4;
  padding: 0 4px;
}

/* 标注差异对比 */
.bc-compare {
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-card);
}
.bc-compare-head {
  display: grid;
  grid-template-columns: 160px 1fr 1fr;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}
.bc-compare-head > div { padding: 12px; }
.bc-compare-a { border-left: 1px solid var(--border-light); border-right: 1px dashed var(--border-light); }
.bc-compare-b { border-left: 1px dashed var(--border-light); }
.bc-compare-row {
  display: grid;
  grid-template-columns: 160px 1fr 1fr;
  border-bottom: 1px solid var(--border-light);
  align-items: stretch;
}
.bc-compare-row:last-child { border-bottom: none; }
.bc-compare-row > div { padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.bc-compare-label {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 500;
  border-right: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 4px;
}
.bc-compare-cell { border-right: 1px dashed var(--border-light); }
.bc-compare-cell:last-child { border-right: none; }
.bc-compare-row.diff .bc-compare-cell {
  background: #fff7ed;
}
.bc-compare-row.diff .bc-compare-label {
  background: #fff7ed;
  color: #9a3412;
}

/* 归因柱状图 */
.attr-bars { display: flex; flex-direction: column; gap: 8px; }
.attr-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.attr-bar-label { color: var(--text-secondary); }
.attr-bar-track {
  height: 14px;
  background: var(--bg-page);
  border-radius: 4px;
  overflow: hidden;
}
.attr-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}
.attr-bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 风险告警条 */
.risk-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 12px;
}
.risk-alert.urgent {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.risk-alert.urgent i { color: #dc2626; }
.risk-alert.high {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}
.risk-alert.high i { color: #ea580c; }
.risk-alert i { width: 20px; height: 20px; flex-shrink: 0; }

/* 标注/裁定主面板 */
.bc-annotate {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  min-height: calc(100vh - var(--topbar-h) - 180px);
}
.bc-annotate-left, .bc-annotate-right {
  display: flex;
  flex-direction: column;
}
.bc-adjudicate {
  display: grid;
  grid-template-columns: 1fr 1.2fr 380px;
  gap: 12px;
  min-height: calc(100vh - var(--topbar-h) - 180px);
}
.bc-adjudicate-left, .bc-adjudicate-mid, .bc-adjudicate-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 证据/对话/AI链路 卡片 */
.evidence-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  overflow: hidden;
}
.evidence-card-head {
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
}
.evidence-card-body { padding: 12px 14px; }

/* 案例基本信息摘要 */
.case-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  font-size: 12px;
}
.case-summary-grid > div {
  background: var(--bg-subtle);
  padding: 8px 10px;
  border-radius: 4px;
}
.case-summary-grid .lbl { color: var(--text-tertiary); font-size: 11px; margin-bottom: 2px; }
.case-summary-grid .val { font-weight: 500; }

/* 工具调用行 */
.tool-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 4px;
}
.tool-row .tool-name { font-weight: 500; }
.tool-row .tool-params { color: var(--text-tertiary); font-family: monospace; font-size: 11px; }
.tool-row .tool-result { color: var(--text-secondary); margin-left: auto; }

/* 知识引用 */
.kb-ref {
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 12px;
  background: #fff;
}
.kb-ref.used { background: #eff6ff; border-color: #bfdbfe; }
.kb-ref-meta {
  display: flex; gap: 8px; margin-top: 4px;
  color: var(--text-tertiary); font-size: 11px;
}

/* AI 链路节点 */
.ai-chain { display: flex; flex-direction: column; gap: 0; }
.ai-chain-node {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  position: relative;
}
.ai-chain-node:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 26px;
  bottom: -2px;
  width: 2px;
  background: var(--border-light);
}
.ai-chain-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 11px; font-weight: 600;
  z-index: 1;
}
.ai-chain-content { flex: 1; }
.ai-chain-name { font-size: 12px; font-weight: 500; }
.ai-chain-detail { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.5; }
.ai-chain-time { font-size: 11px; color: var(--text-tertiary); font-family: monospace; }

/* 对话回放（标注/裁定专用） */
.case-replay {
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  padding: 12px;
  max-height: 360px;
  overflow-y: auto;
}
.replay-msg {
  display: flex; gap: 8px; margin-bottom: 12px;
  font-size: 12px;
}
.replay-msg .replay-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: #fff;
  color: var(--text-tertiary);
  border: 1px solid var(--border-light);
}
.replay-msg.ai .replay-avatar { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.replay-bubble {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1.6;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.replay-msg.user .replay-bubble { background: #eff6ff; border-color: #bfdbfe; }
.replay-meta {
  display: flex; gap: 8px; margin-top: 4px;
  font-size: 10px; color: var(--text-tertiary);
}

/* 标注表单 */
.annotate-form .form-row {
  margin-bottom: 10px;
}
.annotate-form .form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}
.annotate-form .form-label .req { color: var(--danger-500); margin-left: 2px; }
.annotate-form .select,
.annotate-form .input,
.annotate-form .textarea {
  font-size: 12px;
  width: 100%;
}
.annotate-form .textarea { min-height: 60px; resize: vertical; }
.form-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkbox-group { display: flex; gap: 12px; flex-wrap: wrap; }
.checkbox-group label { font-size: 12px; display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* 列表项内的进度条 */
.list-progress {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
}

/* 列表项风险色块 */
.list-risk-strip {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.list-risk-strip.urgent { background: var(--danger-500); }
.list-risk-strip.high { background: var(--warning-500); }
.list-risk-strip.medium { background: var(--primary-500); }
.list-risk-strip.low { background: var(--success-500); }
.session-item { position: relative; }

/* 操作按钮组 */
.action-bar {
  display: flex; gap: 8px;
  padding: 12px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  position: sticky; bottom: 0; z-index: 5;
}

/* 任务分配卡片 */
.staff-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
}
.staff-row:hover { border-color: var(--primary-500); background: var(--primary-50); }
.staff-row .staff-info { flex: 1; }
.staff-row .staff-name { font-weight: 500; }
.staff-row .staff-workload { color: var(--text-tertiary); font-size: 11px; }

/* 看板指标卡 */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 14px;
}
.metric-card .metric-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.metric-card .metric-label { font-size: 12px; color: var(--text-tertiary); }
.metric-card .metric-value { font-size: 26px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.metric-card .metric-trend { font-size: 11px; }
.metric-card .metric-trend.up { color: var(--success-600); }
.metric-card .metric-trend.down { color: var(--danger-600); }
.metric-card .metric-foot { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* 看板列表 */
.dash-list { display: flex; flex-direction: column; }
.dash-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item .rank { font-weight: 600; color: var(--text-tertiary); min-width: 18px; }
.dash-list-item .label { flex: 1; }
.dash-list-item .count { font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-list-item .trend { font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.dash-list-item .trend.up { background: #fef2f2; color: #dc2626; }
.dash-list-item .trend.down { background: var(--success-50); color: var(--success-600); }

/* ============================================================
   Few-shot 编辑器样式
   ============================================================ */
.fewshot-item {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-card);
}
.fewshot-item:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.fewshot-item.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.fewshot-item.disabled { opacity: 0.55; background: var(--bg-subtle); }
.fewshot-item.disabled:hover { background: var(--bg-hover); }
.fewshot-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.fewshot-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  background: var(--primary-100);
  color: var(--primary-700);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.fewshot-tag-row {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.fewshot-input-preview {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-page);
  padding: 4px 6px;
  border-radius: 3px;
  margin-bottom: 4px;
  font-family: monospace;
  line-height: 1.5;
  max-height: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.fewshot-output-preview {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 2px 6px;
  line-height: 1.5;
  max-height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.fewshot-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

/* 占位符下拉菜单 */
.ph-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  min-width: 240px;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.ph-menu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background 0.1s;
}
.ph-menu-item:hover { background: var(--primary-50); }

/* 版本列表 */
.version-list { display: flex; flex-direction: column; gap: 8px; }
.version-item {
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s;
}
.version-item:hover { border-color: var(--primary-300); }
.version-item.active { border-color: var(--primary-500); background: var(--primary-50); }
.version-tag { display: inline-block; margin-bottom: 4px; }
.version-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.version-meta { font-size: 11px; color: var(--text-tertiary); margin-bottom: 4px; }
.version-summary { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* 抽屉底部按钮区 */
.drawer-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
}
.drawer-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.drawer-section:last-of-type { border-bottom: none; }

/* ============ 系统设置页布局 ============ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
}
.settings-nav {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 8px;
  position: sticky;
  top: 80px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--r-md);
  cursor: pointer;
  margin-bottom: 2px;
  transition: all .15s;
}
.settings-nav-item i { width: 14px; height: 14px; flex-shrink: 0; }
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-nav-item.active {
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 500;
}
.settings-content { min-width: 0; }
.settings-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-50), #dbeafe);
  border-bottom: 1px solid var(--border-light);
}
.settings-banner-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  flex-shrink: 0;
}
.form-row-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.form-row-inline .form-row { margin-bottom: 0; }
.form-row-inline .form-row > .form-label { display: block; min-width: 0; margin-bottom: 4px; }

@media (max-width: 1100px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; flex-wrap: wrap; }
  .settings-nav-item { flex: 1; min-width: 100px; }
}

/* 漏斗步骤可点击交互 */
.funnel-step {
  cursor: pointer;
  transition: all 0.15s;
}
.funnel-step:hover {
  background: var(--primary-50);
  transform: translateX(4px);
}

/* 待处理事项卡片箭头 */
.text-primary-color { color: var(--primary-600); }

/* prompt-col-body 内滚动 */
.prompt-col-body { padding: 12px; }


/* ============ 语音输入浮层 ============ */
.voice-overlay {
  position: absolute;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 50;
  animation: slideUp .2s ease-out;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.voice-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  margin: 12px 0;
}
.voice-bar {
  width: 3px;
  background: var(--primary-500);
  border-radius: 2px;
  animation: voiceBeat 1s ease-in-out infinite;
}
@keyframes voiceBeat {
  0%, 100% { height: 8px; }
  50% { height: 36px; }
}
.voice-bar:nth-child(1) { animation-delay: 0s; }
.voice-bar:nth-child(2) { animation-delay: .1s; }
.voice-bar:nth-child(3) { animation-delay: .2s; }
.voice-bar:nth-child(4) { animation-delay: .3s; }
.voice-bar:nth-child(5) { animation-delay: .4s; }
.voice-bar:nth-child(6) { animation-delay: .5s; }
.voice-bar:nth-child(7) { animation-delay: .6s; }

/* ============ 修复流程步骤条 ============ */
.repair-steps {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 12px 0;
}
.repair-step {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 12px 14px;
  position: relative;
  font-size: 12px;
  line-height: 1.5;
}
.repair-step:first-child { border-radius: var(--r-lg) 0 0 var(--r-lg); }
.repair-step:last-child { border-radius: 0 var(--r-lg) var(--r-lg) 0; }
.repair-step + .repair-step { border-left: none; }
.repair-step::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 8px solid var(--border-light);
  z-index: 1;
}
.repair-step:last-child::after { display: none; }
.repair-step.done {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.repair-step.done::after { border-left-color: #6ee7b7; }
.repair-step.current {
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-700);
  font-weight: 500;
}
.repair-step.current::after { border-left-color: var(--primary-500); }
.repair-step-num {
  display: inline-flex;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}
.repair-step.done .repair-step-num { background: #10b981; color: #fff; }
.repair-step.current .repair-step-num { background: var(--primary-500); color: #fff; }

@media (max-width: 1100px) {
  .repair-steps { flex-direction: column; }
  .repair-step + .repair-step { border-left: 1px solid var(--border-light); border-top: none; }
  .repair-step::after { display: none; }
  .repair-step:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .repair-step:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
}

/* ============ Few-shot 编辑器 ============ */
.fewshot-item {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.fewshot-item:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
  transform: translateY(-1px);
}
.fewshot-item.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.fewshot-item.disabled { opacity: 0.6; }
.fewshot-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.fewshot-index {
  display: inline-flex;
  width: 22px; height: 18px;
  background: var(--primary-50);
  color: var(--primary-600);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
}
.fewshot-tag-row {
  display: flex; gap: 4px; margin-bottom: 4px;
}
.fewshot-input-preview {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.5;
  background: var(--bg-subtle);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  max-height: 36px;
  overflow: hidden;
}
.fewshot-output-preview {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  max-height: 32px;
  overflow: hidden;
}
.fewshot-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ============ 占位符菜单 ============ */
.ph-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  min-width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 4px;
}
.ph-menu-item {
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border-light);
}
.ph-menu-item:last-child { border-bottom: none; }
.ph-menu-item:hover { background: var(--primary-50); }

/* ============ 版本对比 diff ============ */
.diff-added {
  background: #ecfdf5;
  color: #065f46;
  padding: 2px 4px;
  border-radius: 3px;
}
.diff-removed {
  background: #fef2f2;
  color: #991b1b;
  text-decoration: line-through;
  padding: 2px 4px;
  border-radius: 3px;
}

/* ============ 路由历史 ============ */
.routing-history-item {
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.routing-history-item:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}

/* ============ 路由规则下拉面板 ============ */
.filter-opt:hover {
  background: var(--bg-hover);
}
.sort-opt:hover {
  background: var(--bg-hover);
}
.sort-opt:active {
  background: var(--primary-50);
}
.dropdown-panel {
  animation: dropIn 0.15s ease-out;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 路由规则表格：让图标按钮列更紧凑 */
#routingRuleTbody .icon-btn {
  width: 28px; height: 28px;
}
#routingRuleTbody .icon-btn i {
  width: 14px; height: 14px;
}

/* 工作量表 */
.staff-table { width: 100%; }
.staff-table th, .staff-table td { padding: 8px 6px; text-align: left; font-size: 12px; }
.staff-table th { color: var(--text-tertiary); font-weight: 500; border-bottom: 1px solid var(--border-light); }
.staff-table tr { border-bottom: 1px solid var(--border-light); }
.staff-table tr:last-child { border-bottom: none; }

/* 选项卡栏 */
.bc-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.bc-tab {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all .15s;
  display: flex; align-items: center; gap: 6px;
}
.bc-tab:hover { color: var(--primary-600); }
.bc-tab.active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-500);
  font-weight: 500;
}
.bc-tab .badge {
  background: var(--danger-500);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
}

/* 角色权限提示 */
.role-tip {
  background: linear-gradient(90deg, #eff6ff, transparent);
  border-left: 3px solid var(--primary-500);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  border-radius: 4px;
}
.role-tip strong { color: var(--primary-700); }
.role-tip.danger {
  background: linear-gradient(90deg, #fef2f2, transparent);
  border-left-color: var(--danger-500);
}
.role-tip.danger strong { color: #991b1b; }

/* 提交/关闭结果卡 */
.result-card {
  background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
  border: 1px solid #bbf7d0;
  border-radius: var(--r-md);
  padding: 16px;
  text-align: center;
  color: #166534;
}
.result-card.warn { background: linear-gradient(135deg, #fff7ed, #fef3c7); border-color: #fed7aa; color: #9a3412; }
.result-card.info { background: linear-gradient(135deg, #eff6ff, #e0e7ff); border-color: #bfdbfe; color: #1e3a8a; }
.result-card .icon { font-size: 36px; margin-bottom: 8px; }

/* 标注说明框 */
.note-area {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ============ 代码块（Agent Schema） ============ */
.code-block {
  background: #0f172a;
  color: #cbd5e1;
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.6;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* ============ 调用链监控 timeline ============ */
.call-chain { padding: 4px 4px 4px 0; }
.call-step { display: flex; gap: 12px; }
.call-dot {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  background: var(--success-500);
  position: relative; z-index: 1;
}
.call-dot.warn { background: var(--warning-500); }
.call-dot.err { background: var(--danger-500); }
.call-body { flex: 1; padding-bottom: 18px; position: relative; }
.call-line {
  position: absolute;
  left: 12px; top: 24px; bottom: 0;
  width: 2px;
  background: var(--border-light);
}
.call-step:last-child .call-body { padding-bottom: 0; }

/* ============ 骨架屏 skeleton ============ */
.skeleton {
  display: block;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
  min-height: 12px;
}
.skeleton.line { height: 12px; }
.skeleton.title { height: 18px; width: 60%; }
.skeleton.avatar { width: 32px; height: 32px; border-radius: 50%; }
.skeleton.card { height: 80px; }
.skeleton.thumb { height: 100px; }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-list-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.skeleton-list-item:last-child { border-bottom: none; }

/* ============ 空状态 ============ */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
}
.empty-state .icon { opacity: 0.4; margin-bottom: 8px; }

/* ============ 设置页 Banner ============ */
.settings-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-bottom: 1px solid var(--border-light);
}
.settings-banner-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============ 跨页跳转辅助 ============ */
.cross-link {
  color: var(--primary-600);
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
}
.cross-link:hover { text-decoration: underline; }
.cross-link::after { content: ' →'; opacity: 0.6; }

/* ============ 路由跳转 Toast 标签 ============ */
.toast.with-jump {
  position: relative;
  padding-right: 60px;
}
.toast .toast-jump {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  text-decoration: underline;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.9;
}
.toast .toast-jump:hover { opacity: 1; }

/* ============================================================
   Modal 通用弹窗
   ============================================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-mask.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  width: 92%;
  max-width: 520px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn .25s ease-out;
}
@keyframes modalSlideIn {
  from { transform: translateY(12px) scale(.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Modal 内通用布局 */
.modal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-light);
}
.modal-row:last-child { border-bottom: none; }
.modal-row .modal-row-label {
  width: 96px;
  color: var(--text-tertiary);
  font-size: 13px;
  flex-shrink: 0;
}
.modal-row .modal-row-value {
  flex: 1;
  color: var(--text-primary);
  font-size: 13px;
  word-break: break-all;
}

/* 标签选择器（用于用户标签 / 会话标签） */
.tag-picker {
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 10px;
  background: var(--bg-subtle);
  max-height: 220px;
  overflow-y: auto;
}
.tag-picker .tag-picker-title {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.tag-picker .tag-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.tag-pick:hover { border-color: var(--primary-500); color: var(--primary-700); }
.tag-pick.selected {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-500);
}
.tag-pick.selected::before {
  content: '✓';
  font-weight: 600;
  color: var(--primary-600);
}
.tag-custom-input {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.tag-custom-input .input { flex: 1; }

/* 记忆编辑项 */
.memory-edit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  background: #fff;
  transition: border-color .15s;
}
.memory-edit-item:focus-within { border-color: var(--primary-500); }
.memory-edit-item .mi-label {
  width: 110px;
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.memory-edit-item .mi-control {
  flex: 1;
  min-width: 0;
}
.memory-edit-item .mi-control .select,
.memory-edit-item .mi-control .input,
.memory-edit-item .mi-control .textarea { width: 100%; }
.memory-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 10px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.memory-section-title .text-tertiary {
  font-size: 12px;
  font-weight: 400;
}

/* 槽位提示徽章（智能会话填槽进度） */
.slot-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--primary-50);
  border-radius: 4px;
  font-size: 12px;
  color: var(--primary-700);
}
.slot-prompt .slot-progress {
  flex: 1;
  height: 4px;
  background: var(--primary-100);
  border-radius: 2px;
  overflow: hidden;
}
.slot-prompt .slot-progress-fill {
  height: 100%;
  background: var(--primary-500);
  border-radius: 2px;
  transition: width .3s;
}
.slot-prompt i { width: 14px; height: 14px; flex-shrink: 0; }
.slot-prompt.retry { background: var(--warning-50); color: var(--warning-600); }
.slot-prompt.retry .slot-progress-fill { background: var(--warning-500); }
.slot-prompt.retry .slot-progress { background: #fed7aa; }

/* ============================================================
   多轮填槽 - 选项按钮（用于模糊意图等引导式问答）
   ============================================================ */
.slot-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 0 2px;
}
.slot-option-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--primary-700);
  background: var(--primary-50);
  border: 1px solid var(--primary-200, #bfdbfe);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.4;
}
.slot-option-btn:hover {
  background: var(--primary-100, #dbeafe);
  border-color: var(--primary-500);
  color: var(--primary-800, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}
.slot-option-btn:active {
  transform: translateY(0);
  background: var(--primary-200, #bfdbfe);
}
.slot-option-btn.retry {
  color: var(--warning-700, #b45309);
  background: #fef3c7;
  border-color: #fcd34d;
}
.slot-option-btn.retry:hover {
  background: #fde68a;
  border-color: var(--warning-500, #f59e0b);
  color: #92400e;
}
.slot-text-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  padding: 0 2px;
}
.slot-text-hint i { width: 12px; height: 12px; }

/* 虚拟号码区（外呼） */
.virtual-phone-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #6ee7b7;
  border-radius: var(--r-md);
  margin-bottom: 8px;
}
.virtual-phone-card .vp-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.virtual-phone-card .vp-icon i { width: 16px; height: 16px; }
.virtual-phone-card .vp-info { flex: 1; min-width: 0; }
.virtual-phone-card .vp-label { font-size: 11px; color: var(--text-tertiary); }
.virtual-phone-card .vp-number {
  font-size: 16px;
  font-weight: 600;
  color: #047857;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}
.virtual-phone-card .vp-tel-btn {
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}
.virtual-phone-card .vp-tel-btn:hover { background: #059669; }
.virtual-phone-card .vp-tel-btn i { width: 12px; height: 12px; }

/* 筛选下拉面板 */
.wb-filter-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 50;
  animation: modalSlideIn .15s ease-out;
}
.wb-filter-panel .filter-section { margin-bottom: 12px; }
.wb-filter-panel .filter-section:last-child { margin-bottom: 0; }
.wb-filter-panel .filter-section-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.wb-filter-panel .filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wb-filter-panel .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all .12s;
}
.wb-filter-panel .filter-chip:hover { border-color: var(--primary-300, #93c5fd); }
.wb-filter-panel .filter-chip.active {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-500);
}
.wb-filter-panel .filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}
.wb-filter-panel .filter-result {
  font-size: 12px;
  color: var(--text-tertiary);
}
.page-actions .filter-toggle {
  position: relative;
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-700);
}
.page-actions .filter-toggle .filter-active-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-500);
  border: 2px solid var(--bg-card);
}

/* 用户标签 & 会话标签 - 用户画像区 */
.user-tag-display {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 24px;
  padding: 4px 0;
}
.user-tag-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: transparent;
  border: 1px dashed var(--border-default);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all .12s;
}
.user-tag-add-btn:hover {
  border-color: var(--primary-500);
  color: var(--primary-700);
  background: var(--primary-50);
}
.user-tag-add-btn i { width: 10px; height: 10px; }
.user-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 500;
}
.user-tag.user-tag-removable {
  padding-right: 4px;
}
.user-tag .user-tag-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 50%;
  transition: all .12s;
}
.user-tag .user-tag-remove:hover {
  opacity: 1;
  background: rgba(0,0,0,0.06);
}

/* ============================================================
   工作总览 - 时间范围筛选下拉
   ============================================================ */
.overview-range-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  display: none;
  animation: dropdownFadeIn 0.15s ease-out;
}
.overview-range-dropdown.open { display: block; }
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.overview-range-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.12s;
  user-select: none;
}
.overview-range-item:hover { background: var(--bg-subtle); }
.overview-range-item.active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 500;
}
.overview-range-item i { flex-shrink: 0; color: var(--primary-500); }
.overview-range-item:not(.active) i { color: var(--text-tertiary); }
.overview-range-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 6px;
}

/* 范围标签（页头显示） */
.overview-range-label {
  display: inline-block;
  padding: 1px 8px;
  background: var(--primary-50);
  border-radius: 4px;
  margin-right: 4px;
}

/* 自定义日期范围 - 弹窗表单 */
.ov-date-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s;
}
.ov-date-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* 刷新按钮 spin 动画 */
@keyframes overviewSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin-icon { display: inline-block; vertical-align: -2px; }

/* 按钮 disabled 态 */
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}
.btn-primary:disabled {
  background: var(--primary-500);
  color: #fff;
  opacity: 0.7;
}

/* ============================================================
   知识库 - 文档操作下拉菜单
   ============================================================ */
.kb-doc-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 200;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  animation: dropdownFadeIn 0.12s ease-out;
}
.kb-doc-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-primary);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
  line-height: 1.4;
}
.kb-doc-menu-item:hover {
  background: var(--primary-50);
  color: var(--primary-700);
}
.kb-doc-menu-item i {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}
.kb-doc-menu-item:hover i {
  color: var(--primary-600);
}
.kb-doc-menu-item.kb-doc-menu-item-danger {
  color: var(--danger-600);
}
.kb-doc-menu-item.kb-doc-menu-item-danger i {
  color: var(--danger-500);
}
.kb-doc-menu-item.kb-doc-menu-item-danger:hover {
  background: var(--danger-50);
  color: var(--danger-600);
}
.kb-doc-menu-item.kb-doc-menu-item-danger:hover i {
  color: var(--danger-600);
}
.kb-doc-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 6px;
}

/* ============================================================
   知识库 - 筛选面板
   ============================================================ */
.kb-filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  margin-top: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 100;
  animation: dropdownFadeIn 0.15s ease-out;
}
.kb-filter-section {
  margin-bottom: 14px;
}
.kb-filter-section:last-of-type {
  margin-bottom: 0;
}
.kb-filter-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  font-weight: 500;
}
.kb-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kb-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
  line-height: 1.4;
}
.kb-filter-chip:hover {
  border-color: var(--primary-300, #93c5fd);
  color: var(--primary-700);
}
.kb-filter-chip.active {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-500);
  font-weight: 500;
}
.kb-filter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  gap: 8px;
}
.kb-filter-footer .btn {
  flex: 1;
  justify-content: center;
}
.kb-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--primary-500);
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 2px;
  line-height: 1;
}

/* ============================================================
   知识库 - 导入文档弹窗
   ============================================================ */
.kb-import-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  margin-top: 8px;
  border: 1.5px dashed var(--border-default);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.kb-import-area:hover {
  border-color: var(--primary-500);
  background: var(--primary-50);
}
.kb-import-area.dragging {
  border-color: var(--primary-500);
  background: var(--primary-50);
  transform: scale(1.01);
}
.kb-import-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 8px;
}
.kb-import-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.kb-import-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  font-size: 12px;
  transition: border-color 0.12s;
}
.kb-import-file:hover {
  border-color: var(--primary-300, #93c5fd);
}
.kb-import-file i {
  flex-shrink: 0;
}

/* ============================================================
   知识库 - 召回测试台（全屏 Modal）
   ============================================================ */
.kb-recall-test {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  margin: -18px;  /* 抵消 modal-body padding */
}
.kb-recall-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}
.kb-recall-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.kb-recall-side {
  border-right: 1px solid var(--border-light);
  padding: 14px;
  overflow-y: auto;
  background: var(--bg-subtle);
}
.kb-recall-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.kb-recall-section {
  margin-bottom: 18px;
}
.kb-recall-section:last-child {
  margin-bottom: 0;
}
.kb-recall-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.kb-recall-kbs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kb-recall-kb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.kb-recall-kb-item:hover {
  background: rgba(59, 130, 246, 0.08);
}
.kb-recall-kb-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}
.kb-recall-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.kb-recall-history-item {
  padding: 6px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.12s;
}
.kb-recall-history-item:hover {
  border-color: var(--primary-500);
  background: var(--primary-50);
}
.kb-recall-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
}
.kb-recall-input {
  flex: 1;
  font-size: 13px;
  height: 36px;
}
.kb-recall-inputbar .btn {
  height: 36px;
}
.kb-recall-result {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-page);
}
.kb-recall-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-tertiary);
}
.kb-recall-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.kb-recall-score {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.kb-recall-mark {
  background: #fef08a;
  color: #713f12;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 500;
}

/* ============================================================
   知识库 - 片段卡片（chunks Tab）
   ============================================================ */
.chunk {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chunk:hover {
  border-color: var(--primary-300, #93c5fd);
  box-shadow: var(--shadow-sm);
}
.chunk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.chunk-id {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 3px;
}
.chunk-content {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-primary);
  word-break: break-word;
}
.chunk-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-light);
}
.chunk-meta i {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* spinner 动画（用于导入/测试 loading） */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ============================================================
   知识库 - 召回片段完整弹窗
   ============================================================ */
.kb-recall-full-modal {
  font-size: 13px;
}
.kb-recall-full-modal .grid-4 .card {
  transition: transform 0.15s;
}
.kb-recall-full-modal .grid-4 .card:hover {
  transform: translateY(-1px);
}

/* ============================================================
   提示词中心 - 可编辑 section
   ============================================================ */
.prompt-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.prompt-section:hover {
  border-color: var(--primary-300, #93c5fd);
}
.prompt-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-light);
}
.prompt-section-header > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.prompt-section-header > span i {
  width: 14px;
  height: 14px;
  color: var(--primary-600);
}
.prompt-section-body {
  font-size: 12px;
  line-height: 1.7;
}
.prompt-section-list,
.prompt-section-examples {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.prompt-list-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 2px 0;
}
.prompt-list-row .prompt-list-textarea {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  padding: 4px 8px !important;
  transition: background 0.1s, border-color 0.1s;
}
.prompt-list-row .prompt-list-textarea:hover {
  background: var(--bg-page);
  border-color: var(--border-light);
}
.prompt-list-row .prompt-list-textarea:focus {
  background: var(--bg-page);
  border-color: var(--primary-400, #60a5fa);
  outline: none;
}
.prompt-example-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.prompt-example-row .prompt-example-textarea {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 4px 8px !important;
  transition: border-color 0.1s;
}
.prompt-example-row .prompt-example-textarea:focus {
  border-color: var(--primary-400, #60a5fa);
  outline: none;
}
.prompt-section-textarea {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  transition: border-color 0.1s, background 0.1s;
}
.prompt-section-textarea:hover {
  background: var(--bg-card);
  border-color: var(--primary-300, #93c5fd);
}
.prompt-section-textarea:focus {
  background: var(--bg-card);
  border-color: var(--primary-500);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* 未保存徽标 */
#promptDirtyBadge {
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 提示词占位符菜单 */
.ph-menu {
  position: absolute;
  z-index: 1000;
  min-width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  max-height: 280px;
  overflow-y: auto;
  animation: dropdownFadeIn 0.12s ease-out;
}
.ph-menu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background 0.1s;
}
.ph-menu-item:hover {
  background: var(--primary-50);
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 提示词中心 - 版本对比 diff 样式 */
.prompt-version-diff {
  font-size: 12px;
  line-height: 1.7;
}
.prompt-version-diff .diff-added {
  background: #dcfce7;
  color: #166534;
  padding: 2px 6px;
  border-radius: 3px;
}
.prompt-version-diff .diff-removed {
  background: #fee2e2;
  color: #b91c1c;
  padding: 2px 6px;
  border-radius: 3px;
  text-decoration: line-through;
}
.prompt-version-diff .diff-modified {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 8px 10px;
  border-radius: 4px;
}

