* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a4b8c;
  --primary-dark: #12263f;
  --primary-light: #eaf1fb;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #7a8290;
  --border: #e3e8ef;
  --red: #c62828;
  --orange: #e65100;
  --amber: #b8860b;
  --green: #2e7d32;
  --blue: #01579b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16,30,54,.06), 0 1px 2px rgba(16,30,54,.04);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.6;
  display: flex; min-height: 100vh;
}

/* ---------- Login ---------- */
.login-wrap {
  position: fixed; inset: 0; z-index: 200;
  background: linear-gradient(150deg, #12263f 0%, #1a4b8c 55%, #2b6cb0 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-wrap.off { display: none; }
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 12px;
  box-shadow: 0 24px 60px rgba(8,20,40,.35); padding: 28px 26px 24px;
}
.login-card .logo { font-size: 17px; font-weight: 700; color: var(--primary-dark); letter-spacing: .5px; }
.login-card .sub { font-size: 11.5px; color: var(--muted); margin: 4px 0 20px; }
.login-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.login-tabs button {
  flex: 1; border: 0; background: 0; padding: 9px 0; font-size: 12.5px; cursor: pointer;
  color: var(--muted); font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.login-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.fld { margin-bottom: 13px; }
.fld label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.fld input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit; color: var(--text); background: #fff;
}
.fld input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,75,140,.1); }
.fld .err { font-size: 11px; color: var(--red); margin-top: 4px; min-height: 15px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .btn { white-space: nowrap; }
.btn-block { width: 100%; padding: 10px; font-size: 13.5px; }
.login-foot { font-size: 11px; color: var(--muted); margin-top: 14px; text-align: center; line-height: 1.7; }
.wx-btn { display: flex; align-items: center; justify-content: center; gap: 7px; }
.wx-btn svg { width: 16px; height: 16px; fill: var(--green); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 226px; flex: 0 0 226px; background: var(--primary-dark); color: #cfd8e3;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 16px 18px 13px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand h1 { font-size: 14.5px; color: #fff; letter-spacing: .4px; }
.brand p { font-size: 10.5px; color: #7d8fa6; margin-top: 3px; }
.nav { padding: 8px 0; flex: 1; }
.nav-group { padding: 12px 18px 5px; font-size: 10.5px; color: #6b7d94; letter-spacing: 1px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px; font-size: 12.5px; color: #c3cede; cursor: pointer;
  border-left: 3px solid transparent; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(255,255,255,.09); color: #fff; border-left-color: #4e8ee0; font-weight: 600; }
.nav .badge { font-size: 10px; background: var(--red); color: #fff; border-radius: 8px; padding: 1px 6px; }
.nav .badge.grey { background: #3c516e; }
.sidebar-foot { padding: 10px 18px 14px; font-size: 10.5px; color: #64788f; border-top: 1px solid rgba(255,255,255,.07); }

/* ---------- 备案号（仅自建版渲染，见 js/main.js 的 applyBeian()） ---------- */
/* 两处底色不同（登录卡是白底、侧栏是深底），所以颜色按下挂位置分别给 */
.beian { margin-top: 10px; font-size: 10.5px; line-height: 1.6; }
.beian a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.beian a:hover { opacity: .75; }
#beianLogin { text-align: center; margin-top: 16px; color: var(--muted); }
#beianSide  { color: #64788f; margin-top: 6px; }

/* ---------- Layout ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { font-size: 13.5px; font-weight: 600; }
.topbar .crumb span { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 12px; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.role-tag { background: var(--primary-light); color: var(--primary); border-radius: 4px; padding: 1px 7px; font-size: 11px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; flex: 0 0 26px; }

.content { padding: 20px 22px 48px; }
.page { display: none; }
.page.on { display: block; }

/* ---------- Generic ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; }
.card-hd { padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-hd h3 { font-size: 13.5px; font-weight: 600; }
.card-hd .sub { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.card-bd { padding: 16px; }
.card-bd.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1280px) { .g4, .g5 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1fr; } .g2 { grid-template-columns: 1fr; } }

.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .lbl { font-size: 11.5px; color: var(--muted); }
.kpi .val { font-size: 24px; font-weight: 700; color: var(--primary); font-family: -apple-system, Arial; line-height: 1.25; }
.kpi .val small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.kpi .foot { font-size: 11px; color: var(--muted); margin-top: 3px; }
.kpi.warn .val { color: var(--orange); }
.kpi.danger .val { color: var(--red); }
.kpi.ok .val { color: var(--green); }
/* 可点击的 KPI（老何第四轮：看板数字点进去看客户）——
   必须让人一眼看出「这个能点」，否则需求做了也没人知道。 */
.kpi.kpi-link { cursor: pointer; }
.kpi.kpi-link:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0, 0, 0, .09); }
.kpi.kpi-link:active { transform: translateY(1px); }
.kpi.kpi-link .val { text-decoration: underline; text-decoration-color: rgba(0, 0, 0, .18); text-underline-offset: 3px; }
.kpi.kpi-link::after { content: '查看 →'; display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; vertical-align: middle; }
th { background: #fafbfd; color: var(--muted); font-weight: 600; font-size: 11.5px; white-space: nowrap;
  position: sticky; top: 0; z-index: 2; }
tbody tr:hover { background: #fafcff; }
.table-scroll { max-height: 62vh; overflow: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ctr { text-align: center; }
.link { color: var(--primary); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }

.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; line-height: 18px; white-space: nowrap; }
.t-red { background: #fdecea; color: var(--red); }
.t-orange { background: #fff2e3; color: var(--orange); }
.t-amber { background: #fdf6e3; color: var(--amber); }
.t-green { background: #e8f5e9; color: var(--green); }
.t-blue { background: #e7f1fb; color: var(--primary); }
.t-grey { background: #f0f2f5; color: var(--muted); }
.t-purple { background: #f2ecfb; color: #6b3fa0; }
.t-black { background: #1f2329; color: #fff; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.d-red { background: var(--red); } .d-orange { background: var(--orange); }
.d-amber { background: var(--amber); } .d-green { background: var(--green); }
.d-grey { background: #b9c2ce; }

.btn { display: inline-block; padding: 6px 13px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 12.5px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.btn:hover { border-color: #b9c6d8; }
.btn.pri { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.pri:hover { background: #163f76; }
.btn.danger { color: var(--red); border-color: #f0c9c9; }
.btn.sm { padding: 3px 9px; font-size: 11.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px;
  font-family: inherit; background: #fff; color: var(--text);
}
.toolbar input { min-width: 200px; }
.spacer { flex: 1; }

/* ---------- 多选下拉面板（沟通结果 / 推进阶段，老何 2026-10-15 第 8 轮）----------
   ★ z-index 必须够高：工具条在客户卡里，下面就是表格容器 #custTableWrap
     （它有 overflow:auto）。面板如果被表格盖住，用户会以为「点了没反应」。
   ★ 面板用 position:absolute + 父级 .msel{position:relative}，所以不会撑开工具条高度。 */
.msel { position: relative; display: inline-block; }
.msel-pop {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 190px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px;
  box-shadow: 0 10px 28px rgba(28, 34, 48, .16); max-height: 320px; overflow: auto;
}
.msel-pop[hidden] { display: none; }
.msel-item {
  display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; white-space: nowrap; color: var(--text);
}
.msel-item:hover { background: #f2f5f9; }
/* 勾选框用 CSS 画：真 checkbox 配 <label> 会让 click 委托被触发两次
   （点文字时浏览器会转发一次 click 给 input）—— 见 pages.js 的 mselHtml 注释。 */
.msel-tick {
  width: 13px; height: 13px; flex: none; border: 1px solid var(--border); border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; color: #fff; background: #fff;
}
.msel-tick.on { background: var(--primary, #2b6cb0); border-color: var(--primary, #2b6cb0); }

/* ---------- 分段按钮组（线索分类 / 评级多选 / 分配方式）----------
   ★ 之前 .seg 在 CSS 里根本没定义 —— 两处用它包按钮的地方（泳道筛选、
     智能分配方式）一直是个裸 div，靠按钮自身的 inline-block 自然流排。
     视觉上能用，但按钮之间的间距跟着父容器的 flex 走，一换页面就忽宽忽窄。
   ★ 只加 display/gap/align，不动按钮自身的样式，所以不会影响别处。 */
.seg { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-left: 2px; }
.seg .lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }

/* ---------- 手机号：可拨号 + 可复制 ---------- */
.tel { color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.tel:hover { text-decoration: underline; }
.btn.copy { padding: 1px 6px; font-size: 11px; margin-left: 4px; color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- 批量操作条（勾选若干行后出现的分配工具条） ---------- */
.batch-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 12px;
  background: #f2f7ff; border: 1px solid #cfe0f7; border-left: 3px solid var(--primary);
  border-radius: 6px; font-size: 12.5px;
}
.batch-bar b { color: var(--primary-dark); }
.batch-bar select {
  padding: 5px 9px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; font-family: inherit; background: #fff; color: var(--text); min-width: 170px;
}
.batch-bar .hint { margin-left: auto; color: var(--muted); }
/* 勾选中的行给个底色 —— 翻页回来后也能一眼看出哪些还没取消 */
table tbody tr.row-sel { background: #eef5ff; }
table tbody tr.row-sel:hover { background: #e4efff; }

.bar-wrap { background: #eef1f5; border-radius: 4px; height: 7px; overflow: hidden; }
.bar { height: 100%; background: var(--primary); border-radius: 4px; }

.modal-mask { position: fixed; inset: 0; background: rgba(16,30,54,.45); display: none; z-index: 60;
  align-items: center; justify-content: center; padding: 30px; }
.modal-mask.on { display: flex; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 880px; max-height: 88vh;
  overflow: auto; box-shadow: 0 20px 50px rgba(16,30,54,.3); }
.modal-hd { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex;
  justify-content: space-between; align-items: flex-start; position: sticky; top: 0; background: #fff; z-index: 3; }
.modal-hd h3 { font-size: 15px; }
.modal-hd .x { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; border: 0; background: 0; }
.modal-bd { padding: 18px 20px; }
.modal-ft { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px;
  justify-content: flex-end; position: sticky; bottom: 0; background: #fff; }

.empty { padding: 40px; text-align: center; color: var(--muted); font-size: 12.5px; }
.hint { font-size: 11.5px; color: var(--muted); }
.note { background: #f4f7fb; border-left: 3px solid var(--primary); padding: 9px 12px;
  font-size: 12px; border-radius: 0 6px 6px 0; margin: 10px 0; }
.note.warn { background: #fff8ec; border-left-color: var(--orange); }
.note.ok { background: #eef8ef; border-left-color: var(--green); }

.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.step .n { width: 20px; height: 20px; border-radius: 50%; background: #e8ecf2; color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 11px; }
.step.on { color: var(--primary); font-weight: 600; }
.step.on .n { background: var(--primary); color: #fff; }
.step.done .n { background: var(--green); color: #fff; }
.step-line { width: 26px; height: 1px; background: var(--border); }

.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: flex; align-items: center; gap: 10px; }
.funnel-row .name { width: 108px; font-size: 12px; color: var(--muted); }
.funnel-row .track { flex: 1; background: #eef1f5; height: 22px; border-radius: 4px; overflow: hidden; }
.funnel-row .fill { height: 100%; background: linear-gradient(90deg, #1a4b8c, #4e8ee0); }
.funnel-row .v { width: 92px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend span { display: flex; align-items: center; }

.drop { border: 1.5px dashed #c3cede; border-radius: 8px; padding: 26px; text-align: center;
  background: #fafbfd; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.drop:hover { border-color: var(--primary); background: #f7faff; }
.drop strong { color: var(--primary); }

.days-0 { color: var(--red); font-weight: 600; } .days-1 { color: var(--orange); font-weight: 600; }
.days-2 { color: var(--amber); font-weight: 600; } .days-3 { color: var(--green); }
.days-x { color: var(--muted); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 11.5px;
  background: var(--primary-light); color: var(--primary); }
.chip.grey { background: #f0f2f5; color: var(--muted); }
/* 「额外口径」标签上那个 ×（2026-10-13 四轮）——
   这些维度在工具条上没有下拉，只能靠这枚标签显示 + 取消。
   字号刻意比标签本身大一点：这是整条提示里**唯一可交互**的东西，
   太小了用户看不出来能点，那这条口径就又变回「看不见的筛选」了。 */
.chip.chip-x b.link { font-size: 13px; line-height: 1; margin-left: 2px; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 4px 0;
  font-size: 12px; color: var(--muted); }

/* ---------- Toast ---------- */
#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-item { background: #12263f; color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(16,30,54,.3); max-width: 560px; }
.toast-item.err { background: #8e2020; }
.toast-item.ok { background: #1e5c2c; }

/* ---------- Loading ---------- */
#booting { position: fixed; inset: 0; background: var(--bg); z-index: 250;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
  color: var(--muted); font-size: 12.5px; }
#booting.off { display: none; }
.spin { width: 26px; height: 26px; border: 2.5px solid #dfe5ee; border-top-color: var(--primary);
  border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.sec-title { font-size: 12px; font-weight: 600; color: var(--primary-dark); margin: 18px 0 8px;
  padding-left: 8px; border-left: 3px solid var(--primary); }
.sec-title:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.ops { display: flex; gap: 6px; flex-wrap: wrap; }
