/* ==========================================================================
   祖研上膳 —— 设计系统（Data-Dense Dashboard · 红金品牌系）
   tokens / 间距 4px 基准 / 统一高度 / SVG 图标 / 对比度 ≥4.5:1
   ========================================================================== */
:root {
  /* 品牌色（印章红 + 金，红只作交互色、与错误红 #b91c1c 拉开距离） */
  --primary: #a63a32;
  --primary-strong: #872b25;
  --primary-soft: #f9ecea;
  --accent: #c0912f;
  --accent-strong: #8f6a1e;
  --accent-soft: #f7f1e1;

  /* 中性色 */
  --sidebar-bg: #2a1517;
  --sidebar-text: #c9b4ae;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --border: #e3e8ef;
  --border-strong: #d3dbe5;
  --text: #1c2733;
  --text-2: #475569;   /* 次要文字（AA 对比度） */
  --text-3: #64748b;   /* 弱文字/辅助信息 */

  /* 语义色 */
  --nutri-bg: var(--primary-soft);
  --nutri-color: var(--primary-strong);
  --transfer-bg: #fef3e2;
  --transfer-color: #b45309;
  --self-bg: #e0f2fe;
  --self-color: #0369a1;
  --system-bg: #eef2f6;
  --system-color: #64748b;

  /* 尺寸与动效 */
  --sidebar-w: 216px;
  --header-h: 54px;
  --brand-h: 76px;
  --panel-head-h: 44px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 2px 8px rgba(15, 23, 42, 0.08);
  --transition: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* 键盘焦点可见 */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============ 整体布局 ============ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ============ 左侧导航 ============ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--brand-h);
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.nav { padding: 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 600;
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 17px; height: 17px; }

.sidebar-footer {
  padding: 12px 18px;
  font-size: 11px;
  color: rgba(159, 180, 189, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

/* ============ 内容区 ============ */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* 页头（三个子页面统一高度） */
.page-header {
  height: var(--header-h);
  flex-shrink: 0;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-header h2 { font-size: 16px; font-weight: 600; }
.page-subtitle { font-size: 12.5px; color: var(--text-3); }

/* ============ 占位页（机器人配置） ============ */
.placeholder-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.placeholder-card {
  width: 100%;
  max-width: 460px;
  padding: 48px 32px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.placeholder-icon svg { width: 28px; height: 28px; color: var(--primary-strong); }
.placeholder-title { font-size: 15px; color: var(--text-2); font-weight: 600; }
.placeholder-note { font-size: 12.5px; color: var(--text-3); }

/* ============ 群管理三栏 ============ */
.group-manage { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* 面板统一顶部栏高度 */
.panel-title,
.chat-header {
  height: var(--panel-head-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

/* 左：班级树 */
.tree-panel {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.tree { padding: 8px; font-size: 13px; }
.tree-class { margin-bottom: 6px; }
.tree-class > .tree-node { font-weight: 600; color: var(--text); }
.tree-robots { padding-left: 14px; }
.tree-robot { margin: 2px 0; }
.tree-robot > .tree-node { color: var(--text-2); font-weight: 500; }
.tree-groups { padding-left: 14px; }
.tree-node {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.tree-icon { display: inline-flex; align-items: center; flex-shrink: 0; }
.tree-icon svg { width: 15px; height: 15px; }
.tree-class > .tree-node .tree-icon svg,
.tree-robot > .tree-node .tree-icon svg { color: var(--text-3); }
.tree-group { cursor: pointer; }
.tree-group:hover { background: #eef2f7; }
/* 分支节点（Agent / 客服bot）：点整行收缩/展开 */
.tree-branch { cursor: pointer; }
.tree-branch:hover { background: #eef2f7; }
.tree-branch:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.tree-caret {
  display: inline-block;
  width: 1em;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
}
.tree-group.selected {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.tree-group.selected .group-count { background: #f0e6cf; color: var(--accent-strong); }
.tree-group .group-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  background: #eef2f6;
  border-radius: 10px;
  padding: 1px 8px;
  flex-shrink: 0;
}

/* 中：聊天区 */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fbfcfe;
}
.chat-header { font-size: 14px; }
.chat-meta { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.clear-chat-btn { margin-left: auto; }
.clear-chat-btn:hover { color: #c0392b; border-color: #c0392b; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  display: flex;
  gap: 10px;
  max-width: 82%;
}
.msg.self { align-self: flex-end; flex-direction: row-reverse; }
.msg-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow-card);
}
.msg-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.msg-name { font-size: 12px; color: var(--text-2); font-weight: 600; }
.msg-time { font-size: 11px; color: var(--text-3); }
.badge {
  display: inline-block;
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-nutri { background: var(--nutri-bg); color: var(--nutri-color); }
.badge-transfer { background: var(--transfer-bg); color: var(--transfer-color); }
.badge-self { background: var(--self-bg); color: var(--self-color); }
.badge-demo { background: #eef2f6; color: var(--text-3); }
.badge-client { background: #f1ecfd; color: #6b3fc7; }
.msg.nutritionist .msg-body { background: var(--nutri-bg); border-color: #ecd3cf; }
.msg.self .msg-body { background: var(--self-bg); border-color: #c3e2f4; }
.msg.transfer .msg-body { background: var(--transfer-bg); border-color: #f0ddbc; }
.msg.process { max-width: 90%; }
.msg.process .msg-body { background: var(--surface); border-color: var(--border); opacity: 0.75; }
.msg.process .msg-name { font-weight: 400; }
.msg-process-text { color: var(--text-3); font-size: 12.5px; }
.badge-process { background: #f0f2f5; color: var(--text-3); }
.msg-img { display: block; margin-top: 6px; max-width: 220px; border-radius: 6px; }
.msg.system { align-self: center; max-width: 90%; }
.msg.system .msg-body {
  background: var(--system-bg);
  border: none;
  color: var(--system-color);
  font-size: 12px;
  border-radius: 14px;
  padding: 5px 14px;
  box-shadow: none;
}
.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e8edf4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

/* 右：成员区 */
.member-panel {
  width: 230px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.member-section { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.member-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.member-section-note { font-size: 11px; font-weight: 400; color: var(--text-3); }
.member-list { display: flex; flex-direction: column; gap: 2px; }
.member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  transition: background var(--transition);
}
.member-item:hover { background: #f2f5f9; }
.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8edf4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.member-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-item .badge-nutri, .member-item .badge-client { flex-shrink: 0; }

/* 结营报告：成员行挂状态徽标 + 可点进操作弹窗 */
.member-item.member-report { cursor: pointer; }
.member-item .badge-report-none, .member-item .badge-report-run,
.member-item .badge-report-done, .member-item .badge-report-sent,
.member-item .badge-report-bad { flex-shrink: 0; }
.badge-report-none { background: #eef2f6; color: var(--text-3); }
.badge-report-run { background: var(--transfer-bg); color: var(--transfer-color); }
.badge-report-done { background: var(--self-bg); color: var(--self-color); }
.badge-report-sent { background: var(--nutri-bg); color: var(--nutri-color); }
.badge-report-bad { background: #fdecec; color: #b3261e; }
.member-report-tip { font-size: 11.5px; line-height: 1.5; color: var(--text-3); padding: 4px 8px 8px; }

/* ============ SOP 推送 ============ */
.sop-push { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.sop-flow-panel {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sop-flow-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.sop-flow-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition),
    box-shadow var(--transition);
}
.sop-flow-item:hover { border-color: var(--primary); box-shadow: var(--shadow-card); }
.sop-flow-item.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}
.sop-flow-days {
  font-size: 11px;
  color: var(--text-3);
  background: #eef2f6;
  border-radius: 10px;
  padding: 2px 8px;
  flex-shrink: 0;
}
.sop-flow-item.selected .sop-flow-days { background: #fff; color: var(--primary-strong); }

/* 流程删除按钮（仅控制面新建的流程显示） */
.sop-flow-del {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.sop-flow-del svg { width: 13px; height: 13px; }
.sop-flow-del:hover { background: #fee2e2; color: #b91c1c; }

.sop-content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #fbfcfe;
}

/* ---- SOP 看板工具栏 ---- */
.sop-board-toolbar {
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.sop-board-hint { font-size: 12px; color: var(--text-3); }
#sop-mode-badge { flex-shrink: 0; }
.sop-report-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-2, var(--text-3));
  cursor: pointer;
  user-select: none;
}
.sop-report-toggle input { accent-color: var(--primary); cursor: pointer; }
.sop-report-toggle input:disabled { cursor: not-allowed; }

/* ---- SOP 看板：每天一列，卡片可拖拽/编辑 ---- */
.sop-board {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 14px;
  overflow-x: auto;
  overflow-y: hidden;
}
.sop-col {
  width: 252px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #eef2f6;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.sop-col-head {
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.sop-col-count { font-size: 11px; font-weight: 400; color: var(--text-3); }
/* 列尾常驻新增占位卡（虚线空卡片；类名避开 .sop-card，不参与拖拽落点计算） */
.sop-add-tile {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-3);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.sop-add-tile:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--primary-soft);
}
.sop-col-body {
  flex: 1;
  min-height: 60px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sop-col-body.drop-append {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--primary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.sop-col-empty { text-align: center; font-size: 12px; color: var(--text-3); padding: 18px 6px; line-height: 1.6; }

/* 任务卡片 */
.sop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.sop-card:hover { box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.sop-card.dragging { opacity: 0.45; cursor: grabbing; }
.sop-card.drop-before { box-shadow: 0 -3px 0 0 var(--primary); }
.sop-card.drop-after { box-shadow: 0 3px 0 0 var(--primary); }
.sop-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; min-width: 0; }
.sop-card-time { font-size: 13px; font-weight: 700; color: var(--primary-strong); flex-shrink: 0; }
.sop-card-action {
  font-size: 10.5px;
  color: var(--text-2);
  background: #eef2f6;
  border-radius: 4px;
  padding: 2px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sop-card-ops { margin-left: auto; display: none; align-items: center; gap: 2px; flex-shrink: 0; }
.sop-card:hover .sop-card-ops { display: inline-flex; }
.sop-card-op {
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.sop-card-op:hover { background: var(--primary-soft); color: var(--primary-strong); }
.sop-card-op svg { width: 13px; height: 13px; }
.sop-card-content {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.sop-card-imgs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.sop-card-imgs img,
.sop-card-img-ph {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #f0f3f7;
}
.sop-card-img-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
}
.sop-card-img-ph svg { width: 18px; height: 18px; }
.sop-card-img-more { font-size: 11px; color: var(--text-3); }

/* 编辑表单卡片 */
.sop-card-editing { cursor: default; border-color: var(--primary); }
.sop-edit-row { display: flex; gap: 8px; }
.sop-edit-field { display: block; flex: 1; min-width: 0; margin-bottom: 8px; }
.sop-edit-field.sop-edit-time { flex: 0 0 100px; }
.sop-edit-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; }
.sop-edit-field input,
.sop-edit-field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: #fff;
}
.sop-edit-field input:focus,
.sop-edit-field textarea:focus { outline: none; border-color: var(--primary); }
/* 勾选框不吃上面的 width:100%（否则拉满整行、同行文字被挤成竖排） */
.sop-edit-field input[type="checkbox"] { width: auto; margin: 0; }
.sop-edit-field textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.sop-edit-imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.sop-edit-img { position: relative; }
.sop-edit-img img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #f0f3f7;
}
.sop-edit-img-rm {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #b91c1c;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sop-edit-img-rm svg { width: 10px; height: 10px; }
.sop-edit-imgs-empty { font-size: 11.5px; color: var(--text-3); align-self: center; }
.sop-img-lib-btn { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; }
.sop-img-lib-btn svg { width: 13px; height: 13px; }
.sop-img-lib {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}
/* 网格内的分段标题（封面弹窗里「封面库 / 图片库」两段）：整行占满、和图块区分开 */
.sop-lib-group {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}
.sop-lib-group:first-child { margin-top: 0; }
.sop-img-lib-tip {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--text-3);
  padding: 4px 2px;
}
.sop-img-lib-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.sop-img-lib-item:hover { border-color: var(--primary); }
.sop-img-lib-item.picked { border-color: var(--primary); background: var(--primary-soft); }
.sop-img-lib-item img {
  width: 100%;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
}
.sop-img-lib-name {
  font-size: 10.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sop-img-lib-used {
  font-size: 10px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sop-img-lib-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 62px;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: #f0f3f7;
  font-size: 10.5px;
  color: var(--text-3);
}
.sop-img-lib-item video,
.sop-img-lib-item .sop-lib-video-cover {
  width: 100%;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0f172a;
}
/* 播放覆盖层：盖在视频缩略图上（尺寸与 padding 与 .sop-img-lib-item / video 对齐） */
.sop-img-play {
  position: absolute;
  top: 5px;
  left: 5px;
  width: calc(100% - 10px);
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.28);
  color: #fff;
  cursor: pointer;
}
.sop-img-play svg { width: 18px; height: 18px; }
.sop-img-play:hover { background: rgba(15, 23, 42, 0.44); }
.sop-card-video {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: #f0f3f7;
  color: var(--text-2);
  font-size: 11.5px;
  text-decoration: none;
}
.sop-card-video:hover { border-color: var(--primary); color: var(--primary-strong); }
.sop-card-video svg { width: 12px; height: 12px; flex-shrink: 0; }
/* 视频芯片内的首帧封面小图（OSS jpg，lazy 加载） */
.sop-card-video-thumb {
  width: 34px;
  height: 22px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}
.sop-card-video-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sop-card-appmsg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: #f0f3f7;
  color: var(--text-2);
  font-size: 11.5px;
}
.sop-card-appmsg img { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
/* 链接卡片：只读卡片上的小块（封面缩略 + 标题），无封面时给个链接图标 */
.sop-card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: #f0f3f7;
  color: var(--text-2);
  font-size: 11.5px;
  text-decoration: none;
}
.sop-card-link img { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; object-fit: cover; }
.sop-card-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.sop-edit-video { position: relative; }
.sop-appmsg-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.sop-appmsg-pick-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  font-family: inherit;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.sop-appmsg-pick-item img { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }
.sop-appmsg-pick-item:hover { border-color: var(--primary); }
.sop-appmsg-pick-item.selected {
  border-color: var(--primary);
  background: var(--primary-soft, #f9ecea);
  color: var(--primary-strong);
}
.sop-appmsg-pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sop-edit-btn-mini {
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.sop-edit-btn-mini:hover { border-color: var(--primary); color: var(--primary-strong); }
.sop-edit-btn-mini:disabled { opacity: 0.6; cursor: default; }
.sop-edit-btns { display: flex; gap: 8px; margin-top: 2px; }
.sop-edit-btn {
  flex: 1;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.sop-edit-btn:hover { background: #f2f5f9; }
.sop-edit-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.sop-edit-btn.primary:hover { background: var(--primary-strong); }
/* primary 变体自带实色背景，浏览器默认置灰对它无效（结营报告面板 generating 期间要看得出禁用） */
.sop-edit-btn:disabled { opacity: .55; cursor: not-allowed; }

.sop-empty { text-align: center; color: var(--text-3); padding: 48px 0; font-size: 13px; }

/* ============ SOP 上传（左下角，吸底） ============ */
.sop-upload {
  flex-shrink: 0;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.sop-upload-btn {
  width: 100%;
  height: 44px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition),
    color var(--transition);
}
.sop-upload-btn:hover,
.sop-upload-btn.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.sop-upload-btn.loading { opacity: 0.6; pointer-events: none; }
.sop-upload-icon { display: inline-flex; align-items: center; }
.sop-upload-icon svg { width: 16px; height: 16px; }
.sop-upload-hint { margin-top: 6px; text-align: center; font-size: 11px; color: var(--text-3); }

/* ============ SOP 新建（流程列表下方，吸底上传区之上） ============ */
.sop-create {
  flex-shrink: 0;
  padding: 10px 10px 0;
}
.sop-create-btn {
  width: 100%;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background var(--transition);
}
.sop-create-btn:hover { background: var(--primary-strong); }
.sop-create-icon { display: inline-flex; align-items: center; }
.sop-create-icon svg { width: 15px; height: 15px; }

/* ============ 新建 SOP 弹窗 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  width: 320px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
  padding: 18px 20px 16px;
}
.modal-head { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Skill 上传弹窗：文件夹选择区 + 已选文件清单 */
.skill-drop-zone {
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  padding: 14px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color .15s;
}
.skill-drop-zone:hover { border-color: var(--primary); color: var(--text-2); }
.skill-drop-zone.has-files { border-style: solid; color: var(--text-2); }
.skill-file-list {
  margin-top: 8px;
  max-height: 120px;
  overflow-y: auto;
  font-family: var(--mono, monospace);
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.7;
}

/* 图片库选择弹窗：比新建 SOP 弹窗宽得多，网格才能一眼扫到图 */
.modal-img { width: min(760px, 92vw); }
.sop-img-lib-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sop-img-lib-bar input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 9px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
}
.sop-img-lib-bar input:focus { outline: none; border-color: var(--primary); }
.sop-img-lib-count { flex-shrink: 0; font-size: 11.5px; color: var(--text-3); }

/* 链接卡片弹窗：上半截是字段，下半截直接复用图片库网格点封面，
   故把网格高度从 56vh 压到 34vh——整窗（含底部三个按钮）一屏放得下 */
.modal-link .sop-img-lib { max-height: 34vh; }
.modal-link .modal-foot > :first-child { margin-right: auto; }
.sop-link-form { margin-bottom: 10px; }
.sop-link-fields { display: flex; gap: 10px; }
.sop-link-fields .sop-edit-field { flex: 1 1 0; min-width: 0; }
/* 视频号这一档标题与封面都不给填：置灰到「看得出不能点」，红字说明原因 */
.sop-link-warn { color: #b3261e; }
.sop-edit-field input:disabled,
.sop-img-lib-bar input:disabled { background: var(--bg); color: var(--text-3); }
.sop-link-kind { font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; }
.sop-link-kind:empty { margin-bottom: 0; }

/* ============ 结营报告操作弹窗（群管理页点成员打开） ============ */
.modal-report { width: min(460px, 92vw); }
.report-info { display: flex; flex-direction: column; gap: 6px; }
.report-row { display: flex; gap: 10px; font-size: 12.5px; }
.report-label { flex: 0 0 92px; color: var(--text-3); }
.report-value { flex: 1; min-width: 0; color: var(--text); word-break: break-word; }
.report-note {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.6;
  color: var(--transfer-color);
  background: var(--transfer-bg);
  border-radius: 6px;
  padding: 8px 10px;
}
.report-actions { flex-wrap: wrap; }

/* ---- 生成过程步进条：灰空心=未开始 / 蓝=已完成 / 蓝空心闪动=进行中 / 红=失败 ---- */
.rp-steps { display: flex; flex-direction: column; gap: 8px; }
.rp-bar { display: flex; }
.rp-step {
  flex: 1;
  position: relative;
  padding-top: 24px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
}
.rp-label { display: block; white-space: nowrap; }
.rp-step::before, .rp-step::after {
  content: "";
  position: absolute;
  top: 8px;
  height: 2px;
  background: var(--border-strong);
}
.rp-step::before { left: 0; right: 50%; margin-right: 9px; }
.rp-step::after { left: 50%; right: 0; margin-left: 9px; }
.rp-step:first-child::before, .rp-step:last-child::after { display: none; }
/* 线段两段各归一边：进入本步的前半段在本步开工即变蓝，离开本步的后半段要等本步完成 */
.rp-step.rp-done::before, .rp-step.rp-done::after,
.rp-step.rp-running::before, .rp-step.rp-failed::before { background: var(--primary); }
.rp-dot {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}
.rp-step.rp-done .rp-dot { background: var(--primary); border-color: var(--primary); }
.rp-step.rp-running .rp-dot { border-color: var(--primary); animation: rp-pulse 1.4s ease-in-out infinite; }
.rp-step.rp-failed .rp-dot { background: #b3261e; border-color: #b3261e; }
.rp-step.rp-done { color: var(--text-2); }
.rp-step.rp-running { color: var(--primary-strong); font-weight: 600; }
.rp-step.rp-failed { color: #b3261e; font-weight: 600; }
@keyframes rp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(166, 58, 50, .35); }
  50% { box-shadow: 0 0 0 5px rgba(166, 58, 50, 0); }
}
.rp-cap { font-size: 11.5px; line-height: 1.5; color: var(--text-3); word-break: break-word; }
.rp-cap.bad { color: #b3261e; }

/* ============ Toast 提示 ============ */
.app-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: 360px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;   /* 校验失败是 problems 多行拼接 */
  padding: 10px 16px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.app-toast.success { background: var(--accent-strong); }
.app-toast.error { background: #b91c1c; }
.app-toast.hide { opacity: 0; transform: translateY(8px); }

/* ============ 机器人配置（提示词库） / 群绑定 ============ */
.bot-config {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 0;
  padding: 0 16px 16px;
}
.bind-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}
.bind-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  background: #fff;
}
.bind-item:hover { border-color: var(--primary); }
.bind-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.bind-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.bind-item-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bind-item-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.bind-item-warn {
  margin-top: 4px;
  font-size: 11px;
  color: #b45309;
  background: #fef3c7;
  border-radius: 4px;
  padding: 3px 6px;
}
.prompt-count { font-weight: 400; font-size: 11px; color: var(--text-3); margin-left: 4px; }
.bind-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.bind-detail { flex: 1; min-height: 0; }
.bind-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
/* 开营日期行：日期输入 + 「清空发送记录」按钮同行（按钮不随 .sop-edit-btn 撑满） */
.bind-date-row { display: flex; align-items: center; gap: 8px; }
.sop-edit-field .bind-date-input { flex: 1 1 auto; width: auto; min-width: 0; }
.bind-date-clear { flex: 0 0 auto; height: 30px; padding: 0 12px; white-space: nowrap; font-size: 12.5px; }
.bind-info {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.bind-info-row {
  display: flex;
  gap: 10px;
  font-size: 12px;
  padding: 3px 0;
}
.bind-info-row.warn { color: #b45309; background: #fef3c7; border-radius: 4px; padding: 4px 8px; margin: 3px 0; }
.bind-info-key { flex: 0 0 80px; color: var(--text-3); }
.bind-info-val { color: var(--text); word-break: break-all; }
.bind-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}
.bind-select:focus { outline: none; border-color: var(--primary); }
/* 转人工 @ 名单选择器（2026-09-15）：点选 staff_members 候选池，不手填 user_id */
.bind-staff-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 120px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.bind-staff-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  padding: 3px 0;
  cursor: pointer;
}
.bind-staff-item input { flex: 0 0 auto; margin: 0; }
.bind-staff-hint { font-size: 12px; color: #b45309; margin-top: 4px; line-height: 1.5; }

/* ============ 定时任务：Agent 简介 + 任务小卡片 ============ */
.sched-agent-info { flex-shrink: 0; }
.sched-agent-info .bind-info { margin-bottom: 0; }
/* 新建占位卡：作为网格里的下一格，与任务卡同高 */
.sched-add-card {
  min-height: 158px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition),
    color var(--transition);
}
.sched-add-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.sched-add-icon { display: inline-flex; align-items: center; }
.sched-add-icon svg { width: 20px; height: 20px; }
.sched-task-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 158px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.sched-task-card:hover { border-color: var(--primary); box-shadow: var(--shadow-card); }
.sched-task-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sched-task-time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* 卡片右上角启用开关：停用不影响配置，只停到点触发 */
.sched-toggle {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  cursor: pointer;
}
.sched-toggle input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}
.sched-toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #d5dbe3;
  transition: background var(--transition);
}
.sched-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: transform var(--transition);
}
.sched-toggle input:checked + .sched-toggle-track { background: var(--primary); }
.sched-toggle input:checked + .sched-toggle-track::after { transform: translateX(16px); }
.sched-toggle input:disabled + .sched-toggle-track { opacity: 0.6; cursor: default; }
.sched-task-freq { font-size: 12px; color: var(--text-2); }
.sched-task-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  word-break: break-all;
}
.sched-task-query {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
  min-height: 56px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sched-task-meta {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sched-task-error { font-size: 11.5px; line-height: 1.5; color: #b3261e; }
.sched-task-foot { margin-top: auto; display: flex; gap: 6px; justify-content: flex-end; }
.sched-task-foot .sop-edit-btn {
  flex: 0 0 auto;
  height: 26px;
  padding: 0 12px;
  font-size: 12px;
}

/* 编辑卡片：整行铺开，直接在卡片里改，不再弹窗 */
.sched-task-card.editing {
  grid-column: 1 / -1;
  min-height: 0;
  gap: 10px;
  border-color: var(--primary);
  box-shadow: var(--shadow-card);
  cursor: default;
}
.sched-edit-head { display: flex; align-items: center; gap: 8px; }
.sched-edit-title { font-size: 14px; font-weight: 600; }
.sched-edit-body { display: flex; flex-direction: column; gap: 8px; }
.sched-edit-body .sop-edit-field { margin-bottom: 0; }
.sched-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sched-edit-actions .sop-edit-btn { flex: 0 0 auto; min-width: 76px; }
.sched-form-row { display: flex; align-items: flex-start; gap: 12px; }
.sched-form-row .sop-edit-field { margin-bottom: 0; }
.sched-form-row .sched-time-field { flex: 0 0 150px; }

/* 定时任务编辑器：星期几多选（横向排，窄屏自动换行） */
.sched-days { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.sched-day-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.sched-day-item input { margin: 0; }
.sched-day-item:hover { border-color: var(--primary); }

/* ============ 机器人配置：子导航 + 卡片网格 + 全页编辑器（2026-09-16） ============ */
.sub-nav {
  flex: 0 0 108px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}
.sub-nav-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  text-align: center;
}
.sub-nav-item:hover { border-color: var(--primary); color: var(--primary); }
.sub-nav-item.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.sub-page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entity-view { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.entity-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.entity-bar .sop-board-hint { flex: 1 1 320px; min-width: 0; }
.entity-new { flex: 0 0 auto; height: 30px; padding: 0 14px; font-size: 12.5px; }
.entity-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  align-content: start;
  padding: 2px 2px 8px;
}
.entity-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px 14px;
  min-height: 150px;
}
.entity-card:hover { border-color: var(--primary); }
.entity-card-head { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.entity-card-name {
  font-weight: 600; font-size: 14px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.entity-card-id { font-size: 11px; color: var(--text-3); word-break: break-all; }
.entity-card-preview {
  flex: 1;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.entity-card-meta { font-size: 11.5px; color: var(--text-3); line-height: 1.6; }
.entity-card-meta b { color: var(--text-2); font-weight: 600; }
.entity-card-foot { display: flex; gap: 6px; justify-content: flex-end; }
.entity-card-foot .sop-edit-btn { height: 28px; padding: 0 12px; font-size: 12.5px; }
.entity-empty { grid-column: 1 / -1; padding: 24px; text-align: center; }

/* 全页编辑器：返回 + 标题固定在顶部，表单在下方滚动 */
.editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.editor-back {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-2);
  height: 28px;
  padding: 0 12px;
  font-size: 12.5px;
  cursor: pointer;
  flex: 0 0 auto;
}
.editor-back:hover { border-color: var(--primary); color: var(--primary); }
.editor-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.editor-title .entity-card-id { font-weight: 400; margin-left: 6px; }
.entity-detail { flex: 1; overflow-y: auto; min-height: 0; }
.entity-detail .bind-form { margin-bottom: 10px; }

/* tools / skills / bots 点选表格：整行可点；列宽走 grid 轨道（JS 写在容器上，行 inherit 对齐）。
   不用 flex 排文字：中文文本节点的 min-content = 1 个字，会被不可断行的英文标识挤成一字一行 */
.entity-picker {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow: auto;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.picker-head, .picker-item {
  display: grid;
  grid-template-columns: inherit;
  gap: 2px 12px;
  align-items: start;
  padding: 6px 10px;
}
.picker-head {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px; color: var(--text-3);
}
.picker-item { cursor: pointer; border-bottom: 1px solid var(--border); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--primary-soft); }
.picker-item input { margin: 2px 0 0; }
.picker-name { font-size: 13px; color: var(--text); }
.picker-code { font-size: 11.5px; color: var(--text-3); word-break: break-all; }
.picker-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b0bccb; }
::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   portal 外部编排界面 + 共享大图预览（app.js / portal.js 共用）
   ========================================================================== */
/* 图片库缩略图「放大查看」按钮（常显半透明，hover 加深） */
.sop-img-lib-zoom {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.52);
  color: #fff;
  cursor: zoom-in;
  opacity: 0.72;
  transition: opacity 0.12s, background 0.12s;
}
.sop-img-lib-item:hover .sop-img-lib-zoom {
  opacity: 1;
  background: rgba(15, 23, 42, 0.72);
}
.sop-img-lib-zoom svg { width: 14px; height: 14px; }

/* 大图预览浮层：滚轮/按钮缩放 + 拖拽平移，长图默认适应宽度、上下滚动 */
.img-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 56px;
  background: rgba(13, 22, 27, 0.82);
}
.img-preview-overlay.hidden { display: none; }
.img-preview-viewport {
  flex: 1;
  display: flex;
  overflow: auto;
  cursor: grab;
}
.img-preview-viewport.dragging { cursor: grabbing; }
.img-preview-viewport img {
  margin: auto;
  display: block;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.img-preview-toolbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
}
.img-preview-toolbar button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.img-preview-toolbar button:hover { background: rgba(255, 255, 255, 0.24); }
.img-preview-toolbar .img-preview-fit {
  width: auto;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 12px;
}
.img-preview-zoom-val {
  min-width: 44px;
  text-align: center;
  color: #fff;
  font-size: 12px;
  user-select: none;
}
.img-preview-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.img-preview-close:hover { background: rgba(255, 255, 255, 0.3); }

/* ===== 消息导出 ===== */
.msg-export {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg-export-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-export-step .panel-title { height: auto; padding: 0; }
.msg-export-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.msg-export-actions { display: flex; align-items: center; gap: 12px; }
.msg-export-count { font-size: 13px; color: var(--text-2); }
.msg-export-btn { flex: 0 0 auto; padding: 0 28px; }
.msg-export-status {
  font-size: 12px;
  color: var(--text-3);
  min-height: 16px;
  white-space: pre-wrap;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.chip-mini {
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.chip-mini:hover { color: var(--primary); }
.msg-export-step-tools { display: flex; align-items: center; gap: 6px; }
.msg-export-search-input {
  width: 180px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}
.msg-export-search-input:focus { border-color: var(--primary); }
.msg-export-search-input::placeholder { color: var(--text-3); }
.msg-export-date-input { width: 128px; }
