:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --brand: #2769f7;
  --brand-d: #1a54d6;
  --text: #1f2733;
  --muted: #7a869a;
  --line: #e6eaf2;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* 登录 */
.login-wrap { height: 100%; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 360px; background: var(--card); border-radius: 14px; padding: 36px 32px;
  box-shadow: 0 12px 40px rgba(30, 50, 100, .12);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 13px; }
.login-card .demo { margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.login-card .demo code { background: #eef2fb; padding: 1px 6px; border-radius: 4px; color: var(--brand); }

/* 通用表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  outline: none; background: #fff; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer;
  font-size: 13px; transition: all .15s;
}
.btn:hover { border-color: #c9d3e6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { color: var(--err); border-color: #f3cfcf; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* 布局 */
.layout { display: flex; height: 100%; }
.side {
  width: 210px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.side .brand { font-weight: 700; font-size: 15px; padding: 6px 10px 18px; color: var(--brand); }
.side .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 2px; }
.nav-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; color: #3b465c;
  display: flex; align-items: center; gap: 9px; margin-bottom: 2px; font-size: 13.5px;
}
.nav-item:hover { background: #f2f5fc; }
.nav-item.active { background: #eaf1ff; color: var(--brand); font-weight: 600; }
.side .me { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; color: var(--muted); }
.side .me b { color: var(--text); display: block; font-size: 13px; margin-bottom: 2px; }

.main { flex: 1; overflow: auto; padding: 22px 26px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar h2 { margin: 0; font-size: 18px; }
.topbar .desc { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi .n { font-size: 26px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi.b .n { color: var(--brand); } .kpi.g .n { color: var(--ok); }
.kpi.w .n { color: var(--warn); } .kpi.r .n { color: var(--err); }

/* 工具条 */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.toolbar .sp { margin-left: auto; }

/* 表格：紧凑行距 + 大表渲染优化 */
table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }  /* separate 布局比 collapse 快（大表） */
th, td { text-align: left; padding: 4px 9px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
th { color: var(--muted); font-weight: 600; background: #fafbfe; position: sticky; top: 0; z-index: 2; }
tbody tr { content-visibility: auto; contain-intrinsic-size: auto 28px; }  /* 视口外的行跳过渲染（滚动流畅的关键） */
tr:hover td { background: #fafbff; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px; }
.tag.gray { background: #eef1f6; color: #5b6478; }
.tag.blue { background: #e7f0ff; color: var(--brand); }
.tag.green { background: #e6f7ed; color: var(--ok); }
.tag.orange { background: #fdf1e0; color: var(--warn); }
.tag.red { background: #fdeaea; color: var(--err); }
.tag.purple { background: #f3e8ff; color: #7c3aed; }
.mapgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; }
/* 防闪烁：视图刷新时保留旧内容，仅做半透明过渡（不清空、不跳动） */
.main { transition: opacity .14s ease; }
.main.updating { opacity: .55; pointer-events: none; }
.mapf { display: flex; flex-direction: column; gap: 3px; }
.mapf label { font-size: 12px; color: var(--muted); }
.mapf select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(20,30,50,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 480px; max-height: 86vh; overflow: auto; padding: 22px; }
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal .row { display: flex; gap: 12px; }
.modal .row .field { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; z-index: 99; opacity: .96;
}
.toast.ok { background: var(--ok); } .toast.err { background: var(--err); }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px; }
pre.logbox { background: #0f172a; color: #cbd5e1; padding: 12px; border-radius: 8px; font-size: 12px; overflow: auto; max-height: 240px; }

/* ============ 增强（助贷数据中台） ============ */
.brand-big { font-size: 22px; font-weight: 800; color: var(--brand); margin-bottom: 4px; letter-spacing: 1px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: var(--brand); font-weight: 700; font-size: 15px; }
.side .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 2px; }
.logo-img {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px;
  object-fit: contain; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.nav-item .ni { display: inline-block; width: 18px; text-align: center; opacity: .75; }
/* ⧉ 新窗口打开按钮：默认淡出，悬停菜单项时浮现 */
.ni-new { margin-left: auto; font-size: 12px; opacity: 0; padding: 2px 5px; border-radius: 5px; transition: opacity .12s; }
.nav-item:hover .ni-new { opacity: .55; }
.ni-new:hover { opacity: 1 !important; background: #dde7fb; color: var(--brand); }
.nav-item.active .ni { opacity: 1; }

/* 可点击标签 */
.tagf { cursor: pointer; transition: filter .12s, box-shadow .12s; }
.tagf:hover { filter: brightness(.95); box-shadow: 0 0 0 2px rgba(39,105,247,.15); }
.tagf.on { box-shadow: 0 0 0 2px var(--brand); }
.th, th.sorted { color: var(--brand); }

/* 排序表头 */
th[data-sort]:hover { color: var(--brand); }
.nowrap { white-space: nowrap; }

/* 进度条（来源通道占比） */
.bar { background: #eef2fb; height: 9px; border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #2769f7, #6f9bff); }

/* 可点击卡片 */
.card.clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.card.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(30,50,100,.10); }

/* 下载下拉 */
.dlwrap { position: relative; display: inline-block; }
.dlmenu {
  position: absolute; right: 0; top: 42px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(30,50,100,.14); padding: 6px; z-index: 30; min-width: 120px;
}
.dlmenu a { display: block; padding: 8px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text); }
.dlmenu a:hover { background: #eaf1ff; color: var(--brand); }

/* 提示条 */
.hint { background: #eef4ff; border: 1px solid #d6e4ff; color: #2b56b8; border-radius: 10px; padding: 9px 13px; font-size: 12.5px; margin: 8px 0; }
.hint.err { background: #fdeeee; border-color: #f6d5d5; color: #c0392b; }

/* 草稿卡 */
.notecard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }

.kpi[data-goto] { transition: box-shadow .15s, transform .15s; }
.kpi[data-goto]:hover { box-shadow: 0 4px 14px rgba(30,64,175,.15); transform: translateY(-2px); }
.kpi.on { outline: 2px solid var(--brand); outline-offset: -2px; }
/* 上传进度浮窗（右下角，可最小化） */
.upfloat {
  position: fixed; right: 18px; bottom: 18px; width: 420px; max-width: 92vw;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(15,23,42,.18); z-index: 95; overflow: hidden;
}
.uphead {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: #f6f8fc; border-bottom: 1px solid var(--line); font-size: 13px;
}
.uphead b { font-size: 13px; }
.upbtns { margin-left: auto; display: flex; gap: 12px; }
.upbtns a { color: var(--brand); cursor: pointer; font-size: 12px; user-select: none; }
.upbody { max-height: 260px; overflow: auto; padding: 6px 14px 10px; }
.uprow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.uprow:last-child { border-bottom: none; }
.uprow-l { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.upname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.updetail { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ============ 侧边栏二级菜单 ============ */
.nav-sub { margin: -2px 0 4px 0; }
.nav-subitem {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 26px;
  font-size: 12.8px; color: #5b6478; cursor: pointer; border-radius: 7px; margin-bottom: 1px;
}
.nav-subitem i { width: 6px; height: 6px; border-radius: 50%; background: #c4cddf; flex: 0 0 6px; }
.nav-subitem:hover { background: #f2f5fc; color: var(--brand); }
.nav-subitem.on { background: #eaf1ff; color: var(--brand); font-weight: 600; }
.nav-subitem.on i { background: var(--brand); }

/* ============ 公海数据总看板 ============ */
.sea-head {
  background: linear-gradient(120deg, #2769f7 0%, #4a83ff 55%, #6f9bff 100%);
  border-radius: 14px; color: #fff; padding: 20px 24px; margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(39, 105, 247, .25);
}
.sea-head h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: 1px; }
.sea-head .sea-meta { font-size: 12.5px; opacity: .92; }
.sea-head .sea-meta b { font-size: 13.5px; }
/* 多维筛选 */
.seagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px; }
.seaf label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.seaf select, .seaf input {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 12.8px; outline: none; background: #fff;
}
.seaf select:focus, .seaf input:focus { border-color: var(--brand); }
.sea-quick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
/* 号码总表徽标 */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 12px; font-size: 11.5px;
  background: #eaf1ff; color: var(--brand); font-weight: 600;
}
.badge.n { background: #fdf1e0; color: var(--warn); }
.badge.warn { background: #fdeaea; color: var(--err); }
.lk { color: var(--brand); cursor: pointer; }
.lk:hover { text-decoration: underline; }
.sea-table td { font-size: 12.5px; vertical-align: top; }
.sea-table th { white-space: nowrap; }
/* 列设置弹窗 */
.sea-colmodal { width: 380px; }
.sea-colmodal .colrows { max-height: 62vh; overflow: auto; margin-top: 10px; }
.colrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 4px; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.colrow label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.colbtns { display: flex; gap: 4px; }
.colbtns .btn { padding: 2px 9px; }
/* 列内子项（单元格里的小标签组：可单独隐藏/调序） */
.colsubs { margin: 2px 0 6px 22px; padding-left: 8px; border-left: 2px dashed var(--line); }
.colsub { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px; font-size: 12.2px; color: var(--muted); }
.colsub label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* 列宽拖拽：表头右缘 7px 把手（拖一次整列同步，宽度写本机 localStorage） */
#poolTable, table.sea-table { table-layout: fixed; }
#poolTable td, table.sea-table td { overflow: hidden; text-overflow: ellipsis; }
#poolTable th, table.sea-table th { overflow: hidden; text-overflow: ellipsis; }
#poolTable td > div, table.sea-table td > div { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.col-rsz {
  position: absolute; top: 0; right: 0; width: 7px; height: 100%;
  cursor: col-resize; z-index: 6; background: transparent;
}
.col-rsz:hover, .col-rsz.on { background: var(--brand); opacity: .4; }

/* 表头固定吸顶 + 每列筛选 */
.sea-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: #f2f5fc; box-shadow: 0 1px 0 var(--line);
}
.thf {
  display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 5px;
  color: var(--muted); cursor: pointer; font-size: 11px; border: 1px solid transparent;
}
.thf:hover { color: var(--brand); border-color: var(--brand); background: #eaf1ff; }
.colmenu {
  position: fixed; z-index: 120; min-width: 180px; max-height: 320px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(30, 50, 100, .16); padding: 6px;
}
.colmenu-t { font-size: 11.5px; color: var(--muted); padding: 4px 8px 6px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; }
.colmenu a { display: block; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 12.8px; }
.colmenu a:hover { background: #eaf1ff; color: var(--brand); }
.lk2 { cursor: pointer; }
.lk2:hover { box-shadow: 0 0 0 2px var(--brand); }

/* 号码跟进面板 */
.pp-modal { width: 860px; max-width: 96vw; padding: 0; overflow: auto; }
.pp-head {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(120deg, #2769f7, #5b8bff); color: #fff;
  padding: 16px 20px; border-radius: 14px 14px 0 0;
}
.pbadge { background: rgba(255,255,255,.22); padding: 3px 10px; border-radius: 14px; font-size: 12px; }
.pbadge.g { background: #16a34a; } .pbadge.o { background: #d97706; } .pbadge.r { background: #dc2626; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 18px; padding: 16px 20px; }
.pp-l { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.pp-v { font-size: 13px; line-height: 1.6; }
.pp-sec { font-size: 14.5px; font-weight: 700; border-left: 3px solid var(--brand); padding-left: 8px; margin: 6px 20px 10px; }
.pp-block { background: #f8faff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0 20px 10px; }
.pp-t { font-size: 12.5px; font-weight: 700; margin-bottom: 6px; color: #33415e; }
.pp-row { padding: 3px 0; font-size: 12.8px; }
.pp-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 20px 10px; }

/* 号码分析条（内嵌四大库视图）：分类格 */
.an-cell { cursor: pointer; border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; min-width: 118px; transition: border-color .12s, background .12s; }
.an-cell:hover { border-color: #1a7ae0; }
.an-cell.on { border-color: #1a7ae0; background: #eaf3fd; }

/* 表头拖拽调列序 */
th[data-col][draggable="true"] { cursor: grab; user-select: none; }
th[data-col][draggable="true"]:active { cursor: grabbing; }
th.th-dragging { opacity: .45; background: #eaf1ff; }
th.th-drop-l { box-shadow: inset 3px 0 0 var(--brand); }
th.th-drop-r { box-shadow: inset -3px 0 0 var(--brand); }

/* 每日流水线未完成提醒横幅（06:30 导入+AI → 07:00 清理，前置失败时禁止删除并提醒重跑） */
.daily-banner{position:fixed;left:0;right:0;top:0;z-index:9998;display:flex;gap:14px;align-items:center;justify-content:space-between;
  padding:10px 16px;background:#fff5f5;border-bottom:2px solid #e5484d;color:#8a1c1c;font-size:13px;
  box-shadow:0 2px 10px rgba(229,72,77,.15)}
.daily-banner .db-text{flex:1;min-width:0}
.daily-banner .db-jobs{margin-top:4px;color:#a13b3f;font-size:12px}
.daily-banner .db-msg{color:#8a6a6a;font-size:11px;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.daily-banner .db-actions{display:flex;gap:6px;flex-shrink:0}
.daily-banner .ok{color:#2f9e44}.daily-banner .bad{color:#e03131}.daily-banner .wait{color:#a1711a}
