/* ================= 熵客 CRM 样式 ================= */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e6e8ec;
  --border-strong: #d5d8de;
  --text: #17191d;
  --text-2: #4b5563;
  --muted: #868e9c;
  --success: #16a34a;
  --success-soft: #e9f7ee;
  --warn: #d97706;
  --warn-soft: #fdf4e3;
  --danger: #dc2626;
  --danger-soft: #fdeced;
  --info-soft: #eef4ff;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --sidebar-w: 218px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-brand {
  background: #0f172a; color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand h1 { font-size: 30px; font-weight: 500; letter-spacing: .5px; line-height: 1.35; }
.login-brand p { color: #94a3b8; margin-top: 14px; font-size: 14px; max-width: 360px; line-height: 1.8; }
.login-brand ul { list-style: none; margin-top: 40px; }
.login-brand li { color: #cbd5e1; font-size: 13.5px; padding: 7px 0; display: flex; gap: 10px; align-items: center; }
.login-brand li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #3b82f6; flex: none; }

/* 品牌标识（登录页左上角） */
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.brand-lockup .brand-mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff; font-size: 19px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .45);
}
.brand-lockup .brand-name { font-size: 19px; font-weight: 600; letter-spacing: .6px; color: #fff; }
.brand-lockup .brand-sub { font-size: 11px; letter-spacing: 2.4px; color: #7c8aa3; text-transform: uppercase; }
.brand-foot { color: #64748b; font-size: 12px; letter-spacing: .3px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-box { width: 100%; max-width: 340px; }
.login-box h2 { font-size: 22px; font-weight: 500; margin-bottom: 6px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field .req::after { content: " *"; color: var(--danger); }
.field input, .field select, .field textarea,
input:not([type]), input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
select { cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f3c9cb; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--primary-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; padding: 10px; font-size: 14px; }
.btn-text { color: var(--primary); font-size: 13px; padding: 2px 4px; white-space: nowrap; }
.btn-text:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
#app { display: none; height: 100vh; grid-template-columns: var(--sidebar-w) 1fr; }
#app.on { display: grid; }
.sidebar {
  background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden;
}
.logo { padding: 18px 20px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--border); }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 500;
}
.logo-text { font-size: 15px; font-weight: 500; letter-spacing: .3px; }
.logo-sub { font-size: 11px; color: var(--muted); margin-top: -2px; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-sec + .nav-sec { margin-top: 2px; }
/* 一级分组（2026-11-19 老板要求放大）：原来是 11px 小灰字，屏幕上像脚注。
   现在与二级栏目同字号（13.5px），靠上下留白 + 右侧箭头维持「这是分组」，
   不再靠缩小字号做层级 —— 字太小等于看不见。
   2026-11-19 两次调浅：--text(#17191d) → #3b4149 → **--text-2(#4b5563) + 500 字重**。
   老板两次反馈「太黑、突兀」，说明 600 粗体本身就是扎眼来源；
   现在与二级栏目完全同色同重，层级交给留白和箭头，不再靠颜色压人。 */
.nav-group {
  display: flex; align-items: center; gap: 6px;
  font-size: 13.5px; color: var(--text-2); font-weight: 500; padding: 11px 10px;
}
.nav-sec > .nav-group .nav-caret svg { width: 11px; height: 11px; }
/* 可折叠的分组标题：整行可点，右侧箭头指示展开状态。
   以前首组是固定展开的（.nav-sec.fixed），2026-11-15 起所有分组一律可收起，故去掉 fixed 分支。 */
.nav-sec > .nav-group { cursor: pointer; border-radius: var(--radius-sm); user-select: none; }
.nav-sec > .nav-group:hover { background: #f7f8fa; }
.nav-caret { margin-left: auto; display: inline-flex; opacity: .5; transition: transform .16s; }
/* 分组标题的箭头只认直接挂在 .nav-group 里的那个，别去转二级项的箭头 */
.nav-sec.open > .nav-group .nav-caret { transform: rotate(90deg); opacity: .8; }
.nav-items { display: none; }
.nav-sec.open .nav-items { display: block; }
/* 2026-11-21 侧栏默认全收起后，收起态下必须能看出「我现在在哪一组」，
   否则左边就是一排同样颜色的灰字，用户会以为页面跳到别的模块去了。
   做法很轻：标题字色转主色 + 左侧一条 3px 竖杠，展开后就不再需要（子项自己有高亮）。 */
.nav-sec.has-cur > .nav-group { color: var(--primary); }
.nav-sec:not(.open).has-cur > .nav-group {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
  border-radius: var(--radius-sm);
}
.nav-sec:not(.open).has-cur > .nav-group .nav-caret { opacity: 1; color: var(--primary); }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; margin-bottom: 2px; cursor: pointer; position: relative;
}
.nav-item:hover { background: #f7f8fa; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
/* 带二级的父项：自己不是终点，子项才是。所以只给一层浅底，不用主色实心，
   否则父项和子项都亮会像两个并级入口。 */
.nav-item.has-sub.parent-on { color: var(--text); background: #f4f6fa; }
/* 二级菜单：默认收起，父项右侧箭头指示；点开才下拉（2026-11-15 老板要求，
   原来三条一直铺在侧栏里，把下面的栏目往下顶）。 */
.nav-item.has-sub .nav-sub-caret { opacity: .38; }
.nav-item.has-sub:hover .nav-sub-caret { opacity: .7; }
.nav-item.has-sub.is-open .nav-sub-caret { transform: rotate(90deg); opacity: .8; }
.nav-sub { display: none; margin: 0 0 4px 26px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-sub.open { display: block; animation: navSubIn .14s ease-out; }
@keyframes navSubIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.nav-item.sub { padding: 5px 10px; font-size: 12.5px; margin-bottom: 0; color: var(--muted); }
.nav-item.sub:hover { color: var(--text); }
.nav-item.sub.active { color: var(--primary); font-weight: 500; background: var(--primary-soft); }
/* 二级栏目（2026-11-19 老板定版三层结构）：一级分组下面的栏目行 + 缩进的三级菜单。
   2026-11-19 二次调整：原先是 11px 浅灰小标题，老板反馈「和 AI 客户营销字体不一样、太小」，
   现改为与普通菜单项完全同字号同色（13.5px / --text-2），层级改由下方缩进列表 + 竖线表达。
   带 path 的（专家广场 / 知识库）整行可点，右侧给 › 提示能进去。 */
.nav-label {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-bottom: 2px;
  font-size: 13.5px; font-weight: 500; color: var(--text-2); border-radius: var(--radius-sm);
}
.nav-label.nav-go { cursor: pointer; }
.nav-label.nav-go:hover { color: var(--primary); background: #f7f8fa; }
.nav-label.on { color: var(--primary); font-weight: 500; background: var(--primary-soft); }
.nav-label-go { margin-left: auto; opacity: .45; font-size: 14px; line-height: 1; }
.nav-label.nav-go:hover .nav-label-go { opacity: .9; }
/* 三级列表：缩进 22px + 竖线，和栏目行拉开「谁是上级」的距离（原来只有 12px，几乎贴平） */
.nav-kids { margin: 0 0 6px 22px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-kids .nav-item { padding: 6px 9px; font-size: 13px; margin-bottom: 1px; color: var(--text-2); }
.nav-kids .nav-item .ico { opacity: .7; }
.nav-kids .nav-item.active .ico { opacity: 1; }
.nav-item .ico { width: 16px; text-align: center; font-size: 14px; opacity: .85; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px;
  min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px;
}
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 54px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 20px; flex: none;
}
.topbar .page-title { font-size: 15px; font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-2); position: relative;
}
.topbar .icon-btn:hover { background: #f2f4f7; }
.dot-red { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 20px; cursor: pointer; }
.user-chip:hover { background: #f2f4f7; }
.avatar {
  width: 27px; height: 27px; border-radius: 50%; background: #e0e7ff; color: #3730a3;
  display: grid; place-items: center; font-size: 12px; font-weight: 500;
}
.view { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-head h3 { font-size: 14px; font-weight: 500; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* ---------- 指标卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 24px; font-weight: 500; margin-top: 6px; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.stat .delta { font-size: 12px; margin-top: 2px; color: var(--muted); }
.stat.accent { border-left: 3px solid var(--primary); }
.stat.warn { border-left: 3px solid var(--warn); }
.stat.danger { border-left: 3px solid var(--danger); }
.stat.ok { border-left: 3px solid var(--success); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 110px; padding: 6px 10px; font-size: 13px; }
.search-box { position: relative; }
.search-box input { padding-left: 30px; min-width: 210px; }
.search-box::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; font-weight: 500; color: var(--text-2); font-size: 12.5px;
  background: #fafbfc; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #f0f1f4; vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.link { color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
.check-col { width: 36px; }

/* ---------- 徽标 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 11px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.tag.blue { background: #eaf1ff; color: #1e48b8; }
.tag.green { background: var(--success-soft); color: #15803d; }
.tag.amber { background: var(--warn-soft); color: #a15c07; }
.tag.red { background: var(--danger-soft); color: #b91c1c; }
.tag.gray { background: #f1f2f5; color: #5b636e; }
.tag.purple { background: #f3eeff; color: #6d28d9; }
.tag.teal { background: #e7f7f2; color: #0f766e; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.level-A { color: #b91c1c; font-weight: 500; }
.level-B { color: #b45309; font-weight: 500; }
.level-C { color: #2563eb; font-weight: 500; }
.level-D { color: #6b7280; }

/* ---------- 分页 ---------- */
/* 分页条吸在滚动容器底部：长列表（83 单、68 个客户、69 张工单）滚到一半也能翻页。
   原来它跟着表格末尾一路沉到页面第 2000+ px，使用者以为「只有第一页」。 */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); position: sticky; bottom: 0; z-index: 5; background: #fff; }
.pager .pages { display: flex; gap: 4px; }
.pager .pg { min-width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); display: grid; place-items: center; background: #fff; }
.pager .pg:hover { border-color: var(--primary); color: var(--primary); }
.pager .pg.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 空状态 ---------- */
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 30px; opacity: .35; margin-bottom: 8px; }
.empty p { font-size: 13.5px; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .38); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s;
}
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { transform: translateY(8px); opacity: 0 } }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s;
}
.modal.wide { max-width: 820px; }
.modal.narrow { max-width: 420px; }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { font-size: 15px; font-weight: 500; }
.modal-head .x { margin-left: auto; color: var(--muted); font-size: 19px; line-height: 1; padding: 0 4px; }
/* min-height:0 是必须的：flex 子项默认 min-height:auto 会拒绝收缩，
   高内容弹窗（如交付流程编辑器）会直接顶穿底部按钮，怎么滚都滚不到最后一行。 */
.modal-body { padding: 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Toast ---------- */
/* 提示永远在最顶层：抽屉里再开弹窗也要看得见操作结果 */
#toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 99999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1f2937; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: pop .18s; max-width: 78vw;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }

/* ---------- 详情布局 ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 14px; align-items: start; }
.detail-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.detail-head h2 { font-size: 18px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-head .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.detail-head .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); word-break: break-word; }
.section-title { font-size: 13px; font-weight: 500; color: var(--text-2); margin: 18px 0 10px; display: flex; align-items: center; gap: 6px; }
.section-title:first-child { margin-top: 0; }

/* 时间轴 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ""; position: absolute; left: -17px; top: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: #fff; border: 2px solid var(--primary);
}
.tl-item.result-deal::before { border-color: var(--success); }
.tl-item.result-refuse::before { border-color: var(--danger); }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.tl-body { margin-top: 4px; font-size: 13.5px; line-height: 1.65; }
.tl-next { margin-top: 6px; font-size: 12.5px; color: var(--text-2); background: #f7f8fa; border-radius: 6px; padding: 6px 9px; }

/* 看板 */
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: #f1f3f6; border-radius: var(--radius); padding: 10px; min-width: 230px; }
.board-col h4 { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.board-col .sum { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.opp-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px; cursor: pointer; }
.opp-card:hover { border-color: var(--primary); }
.opp-card .t { font-size: 13px; font-weight: 500; }
.opp-card .a { font-size: 15px; font-weight: 500; color: var(--primary); margin-top: 4px; }
.opp-card .m { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; justify-content: space-between; }

/* 图表 */
.chart { width: 100%; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 8px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* 分组 tab */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 8px 14px; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab .cnt { font-size: 11.5px; color: var(--muted); background: #f1f2f5; border-radius: 8px; padding: 0 6px; }

/* 提示条 */
.alert { display: block; padding: 10px 13px; border-radius: 8px; font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.alert.info { background: var(--info-soft); color: #1e40af; }
.alert.warn { background: var(--warn-soft); color: #92400e; }
.alert.danger { background: var(--danger-soft); color: #991b1b; }
.alert.ok { background: var(--success-soft); color: #166534; }
/* success 是历史写法（9 处），与 ok 同义，别让它变成没样式的裸文字 */
.alert.success { background: var(--success-soft); color: #166534; }

/* 导入 */
.import-area textarea { min-height: 190px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.report-line { display: flex; gap: 16px; font-size: 13px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.report-line b { font-weight: 500; }

/* 手机底部导航 */
.mobile-nav { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .detail-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 230px); }
}
@media (max-width: 780px) {
  #app.on { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 90;
    transform: translateX(-100%); transition: transform .22s; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 89; }
  .topbar .user-chip span { display: none; }
  .view { padding: 12px 12px 84px; }
  .topbar { padding: 0 12px; height: 50px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat { padding: 11px 12px; }
  .stat .value { font-size: 20px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1; }
  .search-box input { min-width: 0; width: 100%; }
  .search-box { flex: 1 1 100%; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-top: 1px solid var(--border); z-index: 80; padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav a { padding: 7px 0 8px; text-align: center; font-size: 10.5px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .mobile-nav a .ico { font-size: 17px; line-height: 1; }
  .mobile-nav a.active { color: var(--primary); }
  .modal { max-height: 92vh; border-radius: 12px; }
  .modal-body { padding: 14px; }
  table.stack thead { display: none; }
  table.stack tbody tr { display: block; padding: 11px 12px; border-bottom: 1px solid var(--border); }
  table.stack tbody td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: none; text-align: right; }
  table.stack tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: none; text-align: left; }
  table.stack tbody td.cell-name { padding-bottom: 6px; }
  table.stack tbody td.cell-name::before { display: none; }
  table.stack tbody td.cell-name > * { text-align: left; }
  table.stack .hide-m { display: none; }
  .hide-m { display: none !important; }
  .row { flex-direction: column; gap: 0; }
}
@media (min-width: 781px) { .only-m { display: none !important; } }

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

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(37,99,235,.25); border-top-color: var(--primary); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg) } }
.loading-box { padding: 60px; text-align: center; color: var(--muted); }

/* AI 接入页：日期输入与选中行（2026-11 新增 Token 用量区间） */
.input-sm { padding: 5px 8px; font-size: 12.5px; border: 1px solid var(--line,#e5e7eb); border-radius: 6px; }
tr.row-on td { background: color-mix(in srgb, var(--primary,#3b82f6) 7%, transparent); }

/* 通话详情：AI 风控质检（2026-11 第 12 条） */
.qc-card { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; overflow: hidden; background: #fff; }
.qc-head { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: #fafbfc; border-bottom: 1px solid var(--line, #e5e7eb); }
.qc-score { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.qc-score i { font-size: 11px; font-weight: 500; font-style: normal; margin-left: 2px; opacity: .7; }
.qc-sum { font-size: 12.5px; color: var(--text-2, #4b5563); margin-top: 6px; line-height: 1.6; }
.qc-items { padding: 4px 0; }
.qc-item { padding: 10px 14px; border-bottom: 1px solid #f4f5f7; }
.qc-item:last-child { border-bottom: none; }
.qc-item-top { display: flex; align-items: center; gap: 8px; }
.qc-item-top b { font-size: 13px; font-weight: 600; }
.qc-lv { font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.qc-ev { font-size: 12.5px; color: var(--text-2, #4b5563); margin-top: 5px; line-height: 1.65; font-style: italic; }
.qc-adv { font-size: 12px; color: var(--text-2, #4b5563); margin-top: 5px; line-height: 1.6; background: #f7f8fa; border-radius: 6px; padding: 6px 9px; }
.qc-adv span { color: var(--primary, #2563eb); margin-right: 6px; font-weight: 500; }
.qc-adv-empty { color: var(--muted, #8b90a0); font-style: normal; }
.qc-ok { padding: 16px 14px; font-size: 12.5px; color: #15803d; }
.qc-foot { padding: 8px 14px; font-size: 11.5px; color: var(--muted, #8b90a0); border-top: 1px solid #f4f5f7; background: #fcfcfd; }

/* ---------- 分页浮标：真实分页条滚出视口后接管（见 ui.js mountPagerDock） ---------- */
.pager-dock {
  position: fixed; right: 22px; bottom: 20px; z-index: 70;
  display: none; align-items: center; gap: 8px;
  padding: 6px 8px 6px 14px; border-radius: 22px;
  background: rgba(255, 255, 255, .98); border: 1px solid var(--border);
  box-shadow: 0 8px 24px -10px rgba(15, 23, 42, .28);
  font-size: 12.5px; color: var(--text-2); backdrop-filter: blur(6px);
}
.pager-dock.on { display: flex; }
.pager-dock .pd-p { color: var(--text); font-weight: 500; }
.pager-dock button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; font-size: 15px; line-height: 1; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
}
.pager-dock button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager-dock button:disabled { opacity: .35; cursor: default; }

/* ==================== 数字员工 · 全局悬浮入口 ==================== */
.agent-fab-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 9600; }
.agent-fab {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: grab;
  background: #fff; color: #fff; display: grid; place-items: center; padding: 3px;
  box-shadow: 0 8px 22px -6px rgba(37, 99, 235, .45);
  transition: transform .15s ease, box-shadow .15s ease;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.agent-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -6px rgba(37, 99, 235, .55); }
.agent-fab:active { cursor: grabbing; }
.agent-fab.is-dragging { transform: scale(1.08); box-shadow: 0 16px 32px -6px rgba(37, 99, 235, .6); }
.agent-fab svg { width: 54px; height: 54px; display: block; }

.agent-avatar { width: 26px; height: 26px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.agent-avatar svg { width: 26px; height: 26px; display: block; }

.agent-panel {
  position: absolute; right: 0; bottom: 68px; width: 380px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 120px);
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 44px -12px rgba(15, 23, 42, .3);
  display: flex; flex-direction: column; overflow: hidden;
}
.agent-fab-wrap.is-left .agent-panel { right: auto; left: 0; }
.agent-panel[hidden] { display: none; }

.agent-panel-head {
  display: flex; align-items: center; gap: 8px; padding: 13px 15px;
  border-bottom: 1px solid var(--border); background: #fbfcfe;
}
.agent-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.agent-title { font-size: 14px; font-weight: 600; color: var(--text); }
.agent-sub { font-size: 11.5px; color: var(--text-2); margin-left: 2px; }
.agent-close { margin-left: 2px; border: none; background: none; font-size: 20px; line-height: 1; color: var(--text-2); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.agent-close:hover { background: #eef0f3; color: var(--text); }
.agent-clear { margin-left: auto; border: none; background: none; font-size: 11.5px; color: var(--text-2); cursor: pointer; padding: 3px 8px; border-radius: 6px; }
.agent-clear:hover { background: #eef0f3; color: var(--text); }

.agent-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.agent-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; }
.agent-suggest { padding: 6px 14px 4px; }
.agent-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
}
.agent-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.agent-msg { display: flex; margin-bottom: 10px; }
.agent-msg.user { justify-content: flex-end; }
.agent-bubble {
  max-width: 82%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.6;
  word-break: break-word; white-space: pre-wrap;
}
.agent-msg.user .agent-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 3px; }
.agent-msg.bot .agent-bubble { background: #f1f3f6; color: var(--text); border-bottom-left-radius: 3px; }
.agent-extra { margin-top: 3px; font-size: 11px; color: var(--text-2); }
.agent-flag { font-size: 11px; color: #dc2626; }
.agent-flag.warn { color: #d97706; }

.agent-result { margin-top: 6px; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.agent-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 11px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.agent-row:last-child { border-bottom: none; }
.agent-row-main { color: var(--text); font-weight: 500; display: flex; align-items: center; gap: 6px; min-width: 0; }
.agent-row-sub { color: var(--text-2); font-size: 12px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.agent-row-tag { font-style: normal; font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); }
.agent-sep { padding: 5px 11px 2px; font-size: 11px; color: var(--text-2); background: #fafbfc; }
.agent-more { padding: 6px 11px; font-size: 11.5px; color: var(--text-2); text-align: center; }

.agent-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: #fff; }
.agent-input {
  flex: 1; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 11px;
  font-size: 13px; color: var(--text); outline: none;
}
.agent-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.agent-send {
  border: none; background: var(--primary); color: #fff; font-size: 13px; padding: 0 16px;
  border-radius: 8px; cursor: pointer;
}
.agent-send:hover { background: var(--primary-hover); }
.agent-send:disabled { opacity: .5; cursor: default; }

/* 数字员工语音输入 */
.agent-voice {
  flex: none; width: 36px; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.agent-voice:hover { border-color: var(--primary); color: var(--primary); }
.agent-voice.is-rec { background: #dc2626; border-color: #dc2626; color: #fff; animation: agent-pulse 1.2s infinite; }
.agent-voice.is-busy { color: var(--primary); opacity: .7; }
@keyframes agent-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
.agent-voice-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px 0;
}
.agent-voice-mode {
  border: 1px solid var(--border-strong); background: #f6f8fb; color: var(--sub);
  font-size: 11.5px; padding: 3px 9px; border-radius: 12px; cursor: pointer;
}
.agent-voice-mode.is-direct { background: var(--primary); color: #fff; border-color: var(--primary); }
.agent-voice-tip { font-size: 11px; color: var(--sub-2, #9aa4b2); margin-left: auto; }
