/* ==========================================================================
   DocLoop 数字员工平台 · 静态原型样式
   观感对齐 MES / Element UI：深色侧栏 + 浅灰背景 + 白色卡片
   ========================================================================== */

:root {
  /* 中性蓝主色 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;

  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #64748b;
  --info-light: #f8fafc;

  --bg: #ffffff;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-2: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --text-4: #9ca3af;

  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;

  /* 极简：细圆角 + 几乎无阴影 + 紧凑间距 */
  --radius: 6px;
  --radius-lg: 10px;
  --radius-card: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.06);
  --spacing: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

html { scroll-behavior: smooth; }

::selection { background: var(--primary-light); color: var(--primary-dark); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); background-clip: padding-box; }

a { transition: color 0.15s; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0; }

.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.nowrap { white-space: nowrap; }
.flex { display: flex; }
.flex-1 { flex: 1; min-width: 0; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------- 布局 ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 30;
  overflow-y: auto;
  transition: transform 0.2s ease;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 3px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--primary);
  color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.brand-name { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.4px; }
.brand-sub { color: #8a9bb0; font-size: 12px; margin-top: 2px; }

.side-label {
  padding: 18px 20px 8px;
  font-size: 11px;
  color: #6b7d92;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px 11px 22px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  border-radius: 0 10px 10px 0;
  margin: 1px 0;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  cursor: pointer;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-link.active {
  background: rgba(64, 158, 255, 0.16);
  color: #fff;
  border-left-color: var(--sidebar-active);
  font-weight: 600;
}
.nav-ico {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px; font-weight: 700; color: #cfe0f5;
  flex: none;
}
.nav-link.active .nav-ico { background: var(--sidebar-active); color: #fff; }
.nav-link:hover .nav-ico { background: rgba(255, 255, 255, 0.16); }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  text-align: center;
}
.nav-badge.gray { background: rgba(255, 255, 255, 0.15); color: #d8e0e8; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #8a9bb0;
}
.sidebar-footer .who { color: #fff; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.sidebar-footer > div:last-child { color: #8a9bb0; font-size: 11px; }

.main { flex: 1; min-width: 0; margin-left: 240px; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.menu-btn {
  display: none;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px;
}
.topbar-title { font-size: 16px; font-weight: 650; }
.topbar-spacer { flex: 1; }
.topbar-search {
  width: 260px;
  height: 38px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topbar-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-2);
  transition: all 0.15s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn .red-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
}
.role-select {
  height: 38px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: #fff;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-2);
  outline: none;
  cursor: pointer;
}
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-2);
  padding-left: 6px;
  border-left: 1px solid var(--border);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 650; flex: none;
}
.avatar.lg { width: 48px; height: 48px; font-size: 16px; border-radius: 14px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

.page { padding: 26px; max-width: 1400px; width: 100%; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 24px;
}
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-3); font-size: 14px; margin-top: 6px; line-height: 1.6; }
.head-actions { display: flex; gap: 10px; flex: none; }

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .sub { color: var(--text-3); font-size: 13px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 22px; }
.card-body.tight { padding: 16px 22px; }
.card-body.flush { padding: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  transition: border-color 0.15s;
}
.stat:hover { border-color: var(--border-2); }
.stat .label { color: var(--text-3); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.stat .value { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.stat .foot { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.stat .foot .up { color: var(--success); }
.stat .foot .down { color: var(--danger); }

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

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 18px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: #fff; color: var(--text-2);
  font-size: 14px; font-family: var(--font);
  font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #5daf34; border-color: #5daf34; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #f78989; border-color: #f78989; color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: #ebb563; border-color: #ebb563; color: #fff; }
.btn-text { border: none; background: none; color: var(--primary); padding: 0 6px; height: auto; font-size: 14px; font-weight: 500; }
.btn-text:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; border-radius: 6px; }
.btn-text.danger { color: var(--danger); }
.btn-text.danger:hover { background: var(--danger-light); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- 标签/徽标 ---------- */

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px;
  border-radius: 7px;
  font-size: 12px; font-weight: 500; line-height: 1;
  background: var(--info-light); color: var(--text-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag.blue { background: var(--primary-light); color: var(--primary-dark); border-color: #d9ecff; }
.tag.green { background: var(--success-light); color: #529b2e; border-color: #e1f3d8; }
.tag.orange { background: var(--warning-light); color: #b88230; border-color: #faecd8; }
.tag.red { background: var(--danger-light); color: #c45656; border-color: #fde2e2; }
.tag.gray { background: var(--info-light); color: var(--text-3); }
.tag.purple { background: #f5f0ff; color: #7b5cd6; border-color: #e8dcff; }
.tag .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}
.tag.plain { background: #fff; border-color: var(--border-2); color: var(--text-2); }
.tag.lg { height: 28px; padding: 0 12px; font-size: 13px; }

.risk-R0 { background: var(--info-light); color: var(--text-3); }
.risk-R1 { background: var(--primary-light); color: var(--primary-dark); }
.risk-R2 { background: var(--success-light); color: #529b2e; }
.risk-R3 { background: var(--warning-light); color: #b88230; }
.risk-R4 { background: var(--danger-light); color: #c45656; }

/* ---------- 表格 ---------- */

.table-wrap { width: 100%; overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  background: #fafafa;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 13px;
}
.table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
  font-size: 13px;
}
.table tbody tr:hover td { background: #f7fafd; }
.table tbody tr:last-child td { border-bottom: none; }
.table .name-cell { display: flex; align-items: center; gap: 10px; }
.table .name-cell strong { color: var(--text); font-weight: 600; }
.table .name-cell .sub { color: var(--text-3); font-size: 12px; }
.table .row-actions { text-align: right; white-space: nowrap; }
.table.compact th { padding: 10px 12px; }
.table.compact td { padding: 11px 12px; }

/* ---------- 表单 ---------- */

.form-row { margin-bottom: 18px; }
.form-row label, .form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 8px;
}
.form-row .hint { color: var(--text-3); font-size: 12px; line-height: 1.6; margin-top: 6px; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input, .select { height: 40px; padding: 0 12px; }
.textarea { padding: 10px 12px; min-height: 96px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.input[readonly], .textarea[readonly] { background: #f5f7fa; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.switch {
  position: relative; display: inline-block;
  width: 40px; height: 20px; flex: none;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: #dcdfe6; border-radius: 10px; cursor: pointer;
  transition: background 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute;
  width: 16px; height: 16px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- 标签页 ---------- */

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: #fff;
}
.tab {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 650; }
.tab .count {
  display: inline-block;
  margin-left: 5px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  text-align: center;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: tab-fade 0.16s ease; }
@keyframes tab-fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ---------- 提示/告警 ---------- */

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 18px;
  border-radius: var(--radius-card);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert .ico { flex: none; font-size: 16px; line-height: 1.4; }
.alert.info { background: var(--primary-light); color: #2f6fb3; border-color: #d9ecff; }
.alert.success { background: var(--success-light); color: #4c8a2b; border-color: #e1f3d8; }
.alert.warning { background: var(--warning-light); color: #a56a1c; border-color: #faecd8; }
.alert.danger { background: var(--danger-light); color: #b94a4a; border-color: #fde2e2; }

.notice-bar {
  display: flex; align-items: center; gap: 10px;
  background: #fdf6ec; border: 1px solid #faecd8;
  color: #a56a1c; padding: 14px 18px; border-radius: var(--radius-card);
  font-size: 13px; line-height: 1.6; margin-bottom: 20px;
}

/* ---------- 进度条 ---------- */

.progress {
  height: 8px;
  background: #ebeef5;
  border-radius: 4px;
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}
.progress .bar.green { background: var(--success); }
.progress .bar.orange { background: var(--warning); }
.progress .bar.red { background: var(--danger); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .pct { width: 42px; text-align: right; font-size: 12px; color: var(--text-3); }

/* ---------- 简单柱状图 ---------- */

.bars {
  display: flex; align-items: flex-end; gap: 8px;
  height: 120px; padding-top: 8px;
}
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar-col .bar {
  width: 100%; max-width: 34px;
  background: linear-gradient(180deg, #79bbff, #409eff);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
}
.bars .bar-col .bar.green { background: linear-gradient(180deg, #95d475, #67c23a); }
.bars .bar-col .bar.orange { background: linear-gradient(180deg, #f3d19e, #e6a23c); }
.bars .bar-col .lbl { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ---------- 时间线/审计 ---------- */

.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -20px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary);
}
.timeline-item.green::before { border-color: var(--success); }
.timeline-item.orange::before { border-color: var(--warning); }
.timeline-item.red::before { border-color: var(--danger); }
.timeline-item.gray::before { border-color: var(--text-4); }
.timeline-item .tl-time { font-size: 11px; color: var(--text-3); }
.timeline-item .tl-title { font-size: 13px; color: var(--text); margin: 2px 0; font-weight: 500; }
.timeline-item .tl-desc { font-size: 12px; color: var(--text-3); }
.timeline-item .tl-card {
  margin-top: 8px; background: #fafafa; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; font-size: 12px;
}

/* ---------- 描述列表 ---------- */

.desc-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.desc-item {
  display: flex; border-bottom: 1px solid var(--border);
  font-size: 13px; min-height: 48px;
}
.desc-item:nth-child(odd) { border-right: 1px solid var(--border); }
.desc-item .k {
  width: 130px; flex: none; background: #fafafa;
  padding: 14px 16px; color: var(--text-3); font-weight: 500;
}
.desc-item .v { padding: 14px 16px; color: var(--text); flex: 1; min-width: 0; line-height: 1.6; }

/* ---------- 空状态 ---------- */

.empty {
  padding: 48px 24px; text-align: center; color: var(--text-3); font-size: 14px;
}
.empty .ico { font-size: 34px; display: block; margin-bottom: 10px; opacity: 0.5; }

/* ---------- 员工卡片（视觉焦点卡片） ---------- */

.colleague-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.colleague-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 22px 18px;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.colleague-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}
/* 顶部：头像 + 名称 + 状态 */
.colleague-card .top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.colleague-card .name {
  font-size: 17px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}
.colleague-card .position {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 头像加大、强化为视觉锚点 */
.avatar.lg {
  width: 52px;
  height: 52px;
  font-size: 20px;
  border-radius: 14px;
  font-weight: 700;
}
/* 标签区 */
.colleague-card .meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
}
/* 描述区 */
.colleague-card .desc {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 14px;
  min-height: 44px;
}
/* 底部：指标 + 动作（始终单行，指标过长省略） */
.colleague-card .foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}
.colleague-card .foot-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.colleague-card .foot-metrics > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.colleague-card .foot > .field-help { flex-shrink: 0; }
.colleague-card .foot-metrics > span:first-child {
  color: var(--text-2);
  font-weight: 500;
}
.colleague-card .foot-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.colleague-card .foot-actions button,
.colleague-card .foot-actions > span {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------- 审批卡 ---------- */

.approval-card {
  border: 1px solid var(--border); border-radius: var(--radius-card);
  background: #fff; margin-bottom: 16px; overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.approval-card .ac-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.approval-card .ac-body { padding: 18px 20px; }
.approval-card .ac-title { font-size: 15px; font-weight: 650; color: var(--text); }
.approval-card .ac-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.approval-card .ac-row { display: flex; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.approval-card .ac-row .k { width: 64px; flex: none; color: var(--text-3); }
.approval-card .ac-row .v { color: var(--text-2); flex: 1; }
.approval-card .ac-evidence { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.approval-card .ac-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--border);
  background: #fafafa;
}
.approval-card .ac-foot .spacer { flex: 1; }
.approval-card .ac-foot .hint { font-size: 12px; color: var(--text-3); }

/* ---------- 聊天 ---------- */

.chat-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: calc(100vh - 64px);
  overflow: hidden;
  background: #fff;
}
/* 对话页：main 锁定视口高度，页面占满 topbar 以下、页脚以上，聊天区内滚，页脚不再遮挡 */
body.chat-mode .main {
  height: 100vh;
  overflow: hidden;
}
.page-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.page-chat .chat-layout {
  flex: 1;
  min-height: 0;
  height: auto;
}
.chat-side,
.chat-main { min-height: 0; }
.chat-side {
  border-right: 1px solid var(--border);
  background: #fafafa;
  overflow-y: auto;
  padding: 18px;
}
.chat-side .side-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin: 6px 4px 12px; }
.chat-side .colleague-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  cursor: pointer; margin-bottom: 3px;
  transition: background 0.15s;
}
.chat-side .colleague-row:hover { background: #f0f2f5; }
.chat-side .colleague-row.active { background: var(--primary-light); }
.chat-side .colleague-row .name { font-size: 14px; color: var(--text); font-weight: 500; }
.chat-side .colleague-row .pos { font-size: 12px; color: var(--text-3); }

.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  background: #fff;
}
.chat-head .name { font-size: 16px; font-weight: 650; }
.chat-head .sub { font-size: 13px; color: var(--text-3); }
.chat-head .spacer { flex: 1; }
.chat-body {
  flex: 1; overflow-y: auto; padding: 26px 28px;
  background: #f7f8fa;
}
.chat-day { text-align: center; font-size: 12px; color: var(--text-3); margin: 10px 0 20px; }
.msg { display: flex; gap: 12px; margin-bottom: 22px; max-width: 860px; }
.msg .bubble {
  background: #fff; border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px;
  font-size: 14px; color: var(--text-2); line-height: 1.7;
  min-width: 0;
  box-shadow: var(--shadow-soft);
}
.msg.agent .bubble { border-top-left-radius: 2px; }
.msg.user { flex-direction: row-reverse; margin-left: auto; }
.msg.user .bubble {
  background: var(--primary); color: #fff; border-color: var(--primary);
  border-top-right-radius: 2px;
}
.msg .bubble p + p { margin-top: 8px; }
.msg .bubble ul { margin: 6px 0; padding-left: 18px; }
.msg .bubble li { margin: 2px 0; }
.msg .bubble blockquote {
  margin: 8px 0; padding: 8px 12px; background: #f5f7fa;
  border-left: 3px solid var(--primary); color: var(--text-2);
  font-size: 12px; border-radius: 2px;
}
.msg .bubble .cite {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--primary-light); color: var(--primary-dark);
  border-radius: 3px; padding: 1px 6px; font-size: 11px;
  cursor: pointer; margin: 0 2px;
}
.msg .bubble .cite:hover { background: #d9ecff; }
.msg-meta { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.msg.user .msg-meta { text-align: right; }

.tool-trace {
  margin: 10px 0; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.tool-trace .tt-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #fafafa; font-size: 12px; color: var(--text-2);
}
.tool-trace .tt-body { padding: 8px 12px; font-size: 12px; color: var(--text-3); }
.tool-trace .tt-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.tool-trace .tt-item .ok { color: var(--success); }
.tool-trace .tt-item .run { color: var(--primary); }

.approval-inline {
  margin: 12px 0; border: 1px solid #f3d19e;
  background: #fdf6ec; border-radius: var(--radius); padding: 12px 14px;
}
.approval-inline .ai-title { font-size: 13px; font-weight: 600; color: #a56a1c; margin-bottom: 6px; }
.approval-inline .ai-body { font-size: 12px; color: #8a6120; line-height: 1.7; }
.approval-inline .ai-actions { display: flex; gap: 8px; margin-top: 10px; }

.composer {
  border-top: 1px solid var(--border);
  padding: 12px 20px 16px;
  background: #fff;
}
.composer .composer-box {
  display: flex; align-items: flex-end; gap: 10px;
  border: 1px solid var(--border-2); border-radius: 14px;
  padding: 10px; background: #fff;
  box-shadow: var(--shadow-soft);
}
.composer .composer-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.composer textarea {
  flex: 1; border: none; outline: none; resize: none;
  font-family: var(--font); font-size: 14px; line-height: 1.6;
  min-height: 48px; max-height: 140px; padding: 6px 4px;
}
.composer .composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.composer .composer-actions .spacer { flex: 1; }

/* ---------- 聘请向导 ---------- */

.steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 20px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; overflow-x: auto;
}
.step { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.step .num {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border-2); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex: none;
}
.step .txt { font-size: 13px; color: var(--text-3); }
.step.active .num { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.active .txt { color: var(--text); font-weight: 600; }
.step.done .num { background: var(--success-light); border-color: var(--success); color: var(--success); }
.step.done .txt { color: var(--text-2); }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 12px; min-width: 20px; }

.position-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.position-card {
  border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 18px; cursor: pointer; transition: all 0.18s; background: #fff;
  box-shadow: var(--shadow-soft);
}
.position-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1); }
.position-card.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-light); }
.position-card .pc-ico { font-size: 26px; }
.position-card .pc-name { font-size: 15px; font-weight: 650; margin-top: 8px; }
.position-card .pc-desc { font-size: 13px; color: var(--text-3); margin-top: 6px; line-height: 1.6; }
.position-card .pc-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 16px; border-top: 1px solid var(--border); margin-top: 20px;
}
.wizard-foot .spacer { flex: 1; }

/* ---------- 模态框 ---------- */

.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: none; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 580px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column;
}
.modal.lg { width: 800px; }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; font-weight: 650; }
.modal-head .close {
  margin-left: auto; border: none; background: none; font-size: 20px;
  color: var(--text-3); cursor: pointer; line-height: 1;
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  padding: 12px 18px; font-size: 14px; color: var(--text-2);
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  animation: toast-in 0.2s ease;
  pointer-events: auto;
}
.toast.success { border-color: #e1f3d8; background: var(--success-light); color: #4c8a2b; }
.toast.warning { border-color: #faecd8; background: var(--warning-light); color: #a56a1c; }
.toast.error { border-color: #fde2e2; background: var(--danger-light); color: #b94a4a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 其他 ---------- */

.kv { display: flex; gap: 8px; font-size: 13px; margin-bottom: 8px; }
.kv .k { width: 90px; flex: none; color: var(--text-3); }
.kv .v { color: var(--text-2); flex: 1; min-width: 0; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 140px; }
.filter-bar .spacer { flex: 1; }

.seg {
  display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--radius); overflow: hidden;
}
.seg button {
  border: none; background: #fff; padding: 9px 16px; font-size: 13px;
  font-weight: 500; color: var(--text-2); cursor: pointer; font-family: var(--font);
  transition: all 0.15s;
}
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button.on { background: var(--primary); color: #fff; }

.tree { font-size: 13px; }
.tree { font-size: 14px; }
.tree .tree-node { padding: 7px 0 7px 20px; position: relative; color: var(--text-2); line-height: 1.6; }
.tree .tree-node.root { padding-left: 0; font-weight: 600; color: var(--text); }
.tree .tree-node::before {
  content: "▸"; position: absolute; left: 4px; color: var(--text-4); font-size: 11px;
}
.tree .tree-node.root::before { content: ""; }
.tree .tree-node.leaf::before { content: "·"; left: 8px; }

.hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ---------- 数据来源页脚 ---------- */

.data-source {
  margin-top: auto;
  padding: 18px 26px 22px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.data-source .ds-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}
.data-source .ds-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.data-source .ds-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}
.data-source .ds-item b {
  font-weight: 500;
  color: var(--text-2);
}
.data-source .ds-src {
  flex: none;
  font-size: 11px;
  line-height: 18px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}
/* 来源类型配色：本平台 / 外部系统 / 用户内容 / 原型演示 */
.ds-src.platform { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.ds-src.external { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.ds-src.user     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.ds-src.demo     { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.data-source .ds-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-4);
  line-height: 1.7;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar-search { display: none; }
  .page { padding: 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { display: none; }
  .desc-grid { grid-template-columns: 1fr; }
  .desc-item:nth-child(odd) { border-right: none; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .head-actions { width: 100%; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-user .name { display: none; }
}

/* 打印/演示辅助 */
.demo-flag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--warning); background: var(--warning-light);
  border: 1px solid #faecd8; border-radius: 3px; padding: 1px 6px;
}
.hidden { display: none !important; }

/* ── 字段定义：默认隐藏，悬停显形，点击弹出 ── */
.field-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 4px; border-radius: 50%;
  border: 1px solid var(--border-2); color: var(--text-3);
  font-size: 10px; font-weight: 600; line-height: 1; cursor: pointer;
  vertical-align: middle; user-select: none;
  opacity: 0; transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.has-def:hover .field-help, .field-help:hover, .field-help:focus { opacity: .95; }
.field-help:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (hover: none) { .field-help { opacity: .4; } }

.field-def-pop {
  position: fixed; z-index: 9999; width: 340px; max-width: calc(100vw - 24px);
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .18);
  padding: 14px 16px; font-size: 13px; line-height: 1.6;
}
.field-def-pop .fd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.field-def-pop .fd-head strong { font-size: 14px; }
.field-def-pop .fd-close { border: 0; background: none; padding: 0 2px; font-size: 18px; line-height: 1; color: var(--text-3); cursor: pointer; }
.field-def-pop .fd-close:hover { color: var(--text); }
.field-def-pop .fd-row { display: flex; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--border); }
.field-def-pop .fd-k { flex: 0 0 60px; color: var(--text-3); font-size: 12px; }
.field-def-pop .fd-v { flex: 1; color: var(--text-2); }
.field-def-pop .fd-note { margin-top: 8px; padding: 8px 10px; background: #f8fafc; border-radius: 6px; color: var(--text-3); font-size: 12px; }
