/* ============ 成都仓配空运线索系统 · 后台样式 ============ */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e5e9f2;
  --line-2: #eef1f7;
  --text: #101828;
  --text-2: #475467;
  --muted: #8a93a6;
  --primary: #2563eb;
  --primary-soft: #eef4ff;
  --primary-dark: #1d4ed8;
  --sidebar: #0c1828;
  --sidebar-2: #16273d;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --r: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd6e4; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 0%, #1b3a63 0%, #0c1828 55%, #070f1a 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 16px;
  padding: 36px 32px 30px; box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-mark {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
  letter-spacing: -.5px;
}
.login-title { font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 8px 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid #d8dfeb; border-radius: 8px; padding: 9px 12px;
  background: #fff; color: var(--text); outline: none; transition: .16s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.login-tip { font-size: 12px; color: var(--muted); margin-top: 18px; line-height: 1.7; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid #d8dfeb; background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
  transition: .15s; white-space: nowrap;
}
.btn:hover { background: #f8fafc; border-color: #c6cfdd; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #f3c0bb; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; padding: 10px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link-btn { border: 0; background: none; color: var(--primary); font-size: 13px; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---------- 主框架 ---------- */
.app { display: none; min-height: 100vh; }
.app.on { display: flex; }
.sidebar {
  width: 214px; flex: 0 0 214px; background: var(--sidebar); color: #c6d2e3;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 18px 18px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  background: linear-gradient(135deg, #2f6ff5, #0ea5e9);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
}
.brand-txt b { display: block; color: #fff; font-size: 13.5px; font-weight: 600; letter-spacing: .2px; }
.brand-txt span { font-size: 11px; color: #64748b; }
.nav { padding: 10px 10px 20px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 10.5px; color: #55637a; letter-spacing: .8px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  color: #a8b6cb; font-size: 13.5px; cursor: pointer; margin-bottom: 2px;
  border-left: 2px solid transparent; transition: .14s; position: relative;
}
.nav-item:hover { background: var(--sidebar-2); color: #e3eaf4; }
.nav-item.on { background: rgba(47, 111, 245, .16); color: #fff; border-left-color: #4f8bf9; }
.nav-item .ico { width: 16px; text-align: center; opacity: .85; font-size: 13px; }
.nav-badge {
  margin-left: auto; background: #d92d20; color: #fff; font-size: 10.5px;
  min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center;
  padding: 0 5px; font-weight: 600;
}
.side-foot {
  padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11px; color: #55637a; line-height: 1.7;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 15.5px; font-weight: 600; letter-spacing: -.2px; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 9px 5px 5px;
  border-radius: 20px; border: 1px solid var(--line); cursor: pointer; font-size: 13px;
}
.user-chip:hover { background: #f8fafc; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: #e8eefb; color: var(--primary);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
}
.role-dot { font-size: 11px; color: var(--muted); }
.content { padding: 20px 22px 40px; flex: 1; }

/* ---------- 卡片 / 通用 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-hd {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
}
.card-hd h3 { font-size: 14px; font-weight: 600; }
.card-hd .sub { font-size: 12px; color: var(--muted); }
.card-hd .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-bd { padding: 16px; }
.grid { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.nowrap { white-space: nowrap; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px;
  border-radius: 6px; font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap;
}
.tag-lg { font-size: 12.5px; padding: 2px 9px; }
.tag-high { background: #fef3f2; color: #b42318; }
.tag-mid { background: #fffaeb; color: #b54708; }
.tag-low { background: #f2f4f7; color: #475467; }
.tag-invalid { background: #f2f4f7; color: #98a2b3; }
.tag-blue { background: var(--primary-soft); color: var(--primary-dark); }
.tag-green { background: var(--ok-soft); color: var(--ok); }
.tag-gray { background: #f2f4f7; color: #475467; }
.tag-purple { background: #f4f3ff; color: #5925dc; }
.tag-line { background: #fff; border: 1px solid var(--line); color: var(--text-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* ---------- 筛选条 ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--line-2); background: #fcfdfe;
}
.filters .input, .filters .select { height: 34px; padding: 0 10px; font-size: 13px; width: auto; }
.filters .input.search { width: 220px; }
.seg { display: inline-flex; background: #f2f4f7; border-radius: 8px; padding: 2px; }
.seg button {
  border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-size: 13px;
  color: var(--text-2);
}
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--shadow); font-weight: 500; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; font-weight: 500; color: #667085; font-size: 12px;
  padding: 10px 12px; background: #fafbfd; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0;
}
table.tb td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.tb tbody tr { transition: background .12s; }
table.tb tbody tr:hover { background: #f9fbff; }
table.tb tbody tr.clickable { cursor: pointer; }
table.tb .clue-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
table.tb .excerpt { color: var(--text-2); max-width: 380px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.review-dot { width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; display: inline-block; margin-left: 5px; vertical-align: 1px; }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 26px; margin-bottom: 8px; opacity: .5; }

.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.pager .pg { display: flex; gap: 4px; margin-left: auto; }
.pager .pg button {
  min-width: 30px; height: 30px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; font-size: 12.5px; color: var(--text-2);
}
.pager .pg button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .pg button:disabled { opacity: .45; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 16px 14px; box-shadow: var(--shadow); }
.kpi .lb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .num { font-size: 27px; font-weight: 650; letter-spacing: -1px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .num small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.kpi .fo { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.hl { background: linear-gradient(180deg, #f5f8ff, #fff); border-color: #d7e5ff; }

/* ---------- 抽屉 ---------- */
.drawer-mask, .modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .42); z-index: 60;
  opacity: 0; pointer-events: none; transition: .18s;
}
.drawer-mask.on, .modal-mask.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 620px; max-width: 94vw;
  background: #fff; z-index: 61; transform: translateX(102%); transition: .22s cubic-bezier(.2,.8,.3,1);
  display: flex; flex-direction: column; box-shadow: -8px 0 40px rgba(16,24,40,.14);
}
.drawer.on { transform: none; }
.drawer-hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-hd h3 { font-size: 15px; font-weight: 600; }
.drawer-bd { padding: 18px 20px 30px; overflow-y: auto; flex: 1; }
.drawer-ft { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; background: #fcfdfe; }
.close-x { margin-left: auto; border: 0; background: none; font-size: 18px; color: var(--muted); line-height: 1; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98);
  background: #fff; border-radius: 14px; width: 560px; max-width: 94vw; max-height: 88vh;
  display: flex; flex-direction: column; opacity: 0; pointer-events: none; transition: .18s;
  box-shadow: var(--shadow-lg);
}
.modal.on { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-hd h3 { font-size: 15px; font-weight: 600; }
.modal-bd { padding: 18px 20px; overflow-y: auto; }
.modal-ft { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline:before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 14px 0; }
.tl-item:before {
  content: ""; position: absolute; left: -18px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid #c7d2e4;
}
.tl-item.collect:before { border-color: #7f8fa6; }
.tl-item.ai:before { border-color: #7c3aed; }
.tl-item.push:before { border-color: #0ea5e9; }
.tl-item.assign:before { border-color: #f59e0b; }
.tl-item.follow:before { border-color: #12b76a; }
.tl-item .tt { display: flex; gap: 8px; align-items: baseline; }
.tl-item .tt b { font-size: 13px; font-weight: 550; }
.tl-item .tt span { font-size: 11.5px; color: var(--muted); }
.tl-item .ds { font-size: 12.5px; color: var(--text-2); margin-top: 2px; word-break: break-all; }

/* ---------- 信息块 ---------- */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 10px; font-size: 13px; }
.kv .k { color: var(--muted); }
.box { background: #fafbfd; border: 1px solid var(--line-2); border-radius: 9px; padding: 12px 14px; font-size: 13px; line-height: 1.65; color: var(--text-2); }
.box.quote { background: #f8fafc; border-left: 3px solid #cbd5e1; }
.box.ai { background: #fbf9ff; border-color: #ece4fb; }
.section-title { font-size: 12.5px; font-weight: 600; color: var(--text); margin: 18px 0 9px; display: flex; align-items: center; gap: 7px; }
.section-title .bar { width: 3px; height: 12px; background: var(--primary); border-radius: 2px; }
.section-title .link-btn { margin-left: auto; font-weight: 400; }
.section-title .cnt { color: var(--muted); font-weight: 400; }
.section-title:first-child { margin-top: 0; }

/* ---------- 图表 ---------- */
.chart-lg { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; }
.bar-row .nm { width: 96px; color: var(--text-2); }
.bar-row .track { flex: 1; height: 8px; background: #eef1f7; border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 4px; transition: width .5s; }
.bar-row .val { width: 42px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.funnel-row { display: flex; gap: 6px; align-items: stretch; }
.funnel-step { flex: 1; text-align: center; }
.funnel-bar {
  height: 62px; border-radius: 7px; display: grid; place-items: center; color: #fff;
  font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.funnel-step .nm { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: #d0d7e4; border-radius: 20px;
  transition: .18s; cursor: pointer;
}
.switch span:before {
  content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span:before { transform: translateX(17px); }

/* ---------- 提示 ---------- */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #101828; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: tin .18s ease-out; max-width: 70vw;
}
.toast.err { background: #b42318; }
.toast.ok { background: #067647; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- 数据源卡片 ---------- */
.src-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.src-card { border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px; background: #fff; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.src-card h4 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.src-meta { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.9; }
.src-note { font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: 7px; padding: 8px 10px; margin-top: auto; line-height: 1.6; }
.src-card .row.mt8 { margin-bottom: 10px; }

/* ---------- 关键词 ---------- */
.kw-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kw-card .kw-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 16px; max-height: 260px; overflow-y: auto; }
.kw-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #f4f6fa;
  border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; font-size: 12.5px;
}
.kw-chip.off { opacity: .45; text-decoration: line-through; }
.kw-chip button { border: 0; background: none; color: var(--muted); font-size: 13px; line-height: 1; padding: 0; }
.kw-chip button:hover { color: var(--danger); }

/* ---------- 落地页预览 ---------- */
.preview-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 14px; align-items: start; }
.phone {
  width: 320px; height: 620px; border-radius: 26px; border: 9px solid #1b2432;
  overflow: hidden; background: #fff; box-shadow: var(--shadow-lg); margin: 0 auto;
}
.phone iframe { width: 100%; height: 100%; border: 0; }

/* ---------- 设置项 ---------- */
.set-row { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: 0; }
.set-row .lb { width: 190px; flex: 0 0 190px; font-size: 13px; }
.set-row .lb small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.5; }
.set-row .ct { flex: 1; min-width: 0; }
.set-row .ct .select, .set-row .ct .input { width: 100%; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .chart-lg { grid-template-columns: 1fr; }
  .kw-groups { grid-template-columns: 1fr; }
  .src-grid { grid-template-columns: 1fr; }
  .preview-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .kpis { grid-template-columns: 1fr; }
}
