:root {
  --sidebar-bg: #0f1d36;
  --sidebar-active: #2563eb;
  --sidebar-hover: rgba(255,255,255,0.06);
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-d: #1d4ed8;
  --brand-light: #eff6ff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --orange: #f59e0b;
  --orange-light: #fffbeb;
  --gray: #9ca3af;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --shadow: 0 4px 20px rgba(15, 29, 54, 0.06);
  --shadow-lg: 0 10px 40px rgba(15, 29, 54, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1d36 0%, #1e3a8a 55%, #2563eb 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  width: 400px;
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.login-logo {
  width: 42px; height: 42px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.login-card h1 { font-size: 22px; margin: 0; font-weight: 700; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink); background: #fff;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}
.field textarea { resize: vertical; min-height: 72px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.25); }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid #dbe4ff; }
.btn-ghost:hover { background: var(--brand-light); }
.btn-danger-ghost { background: #fff; color: var(--red); border: 1px solid #fecaca; }
.btn-danger-ghost:hover { background: var(--red-light); }
/* v=91 实心红按钮（危险操作二次确认用；此前只有 ghost 版，btn-danger 无样式） */
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,0.25); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

.login-card .btn-lg { width: 100%; margin-top: 4px; }
.login-card .hint { font-size: 12px; color: var(--muted); margin-top: 18px; text-align: center; }
.err { color: var(--red); font-size: 13px; margin-bottom: 10px; min-height: 16px; font-weight: 600; }

/* ---------- 布局 ---------- */
#app { display: none; height: 100vh; }
.sidebar {
  width: 240px; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
}
.sidebar-brand { padding: 22px 20px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.sidebar-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.sidebar-title { font-weight: 700; font-size: 16px; letter-spacing: 0.3px; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-bottom { padding: 14px 12px; border-top: 1px solid var(--line); }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; color: #64748b;
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px;
  margin-bottom: 4px; transition: all .15s;
}
.nav-item svg { flex: 0 0 20px; opacity: 0.95; }
.nav-item:hover { background: #e2e8f0; color: #111827; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,0.35); }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--orange); color: #fff; font-size: 12px; font-weight: 700;
  border-radius: 999px; line-height: 1;
}
.nav-item.active .nav-badge { background: #fff; color: var(--sidebar-active); }
/* v=90 未读批示红点：用红色区分于线索的橙色角标 */
.nav-badge.advice { background: var(--red); }
.nav-item.active .nav-badge.advice { background: #fff; color: var(--red); }

/* 侧边栏分组折叠 */
.nav-group { margin: 2px 0 6px; }
.nav-group-title {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 11.5px; font-weight: 700; letter-spacing: 0.6px;
  padding: 8px 14px 6px 10px; text-align: left;
}
.nav-group-title:hover { color: #475569; }
.nav-caret { flex: 0 0 14px; transition: transform .18s ease; opacity: .8; }
.nav-group.open .nav-caret { transform: rotate(90deg); }
.nav-group-body { display: none; padding-left: 10px; }
.nav-group.open .nav-group-body { display: block; }
.nav-group-body .nav-item { font-size: 13.5px; padding: 9px 12px; }
.nav-group-badge { background: var(--orange); color: #fff; }
.nav-group.open .nav-group-badge { display: none !important; }

.user-pill {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff;
}
.user-name { font-weight: 600; font-size: 13px; color: #111827; }
.user-role { font-size: 12px; color: #64748b; }

.main-area { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 24px;
  padding: 8px 14px; min-width: 260px; color: var(--muted);
  transition: border .15s, box-shadow .15s;
}
.search-box input { border: none; background: transparent; width: 100%; color: var(--ink); }
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }

.main { flex: 1; padding: 24px 28px; overflow: auto; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow);
}
.card-h {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 13px; color: var(--muted); }
.card-h.collapsible { cursor: pointer; user-select: none; }
.card-h.collapsible:hover { background: #f8fafc; border-radius: 10px; margin: -6px -10px; padding: 6px 10px; }
.collapse-meta { display: flex; align-items: center; gap: 10px; }
.collapse-arrow { font-size: 16px; color: var(--muted); width: 16px; text-align: center; }
.collapsible-body { padding-top: 8px; }
.signal-help { font-size: 12px; color: var(--muted); margin-bottom: 12px; padding: 8px 10px; background: #f8fafc; border-radius: 8px; }

/* ---------- 统计 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stat-icon.blue { background: var(--brand-light); }
.stat-icon.green { background: var(--green-light); }
.stat-icon.orange { background: var(--orange-light); }
.stat-icon.red { background: var(--red-light); }
.stat-icon.purple { background: var(--purple-light); }
/* 可下钻的看板卡（如「本月签单」点击进合同列表） */
.stat-card-click { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.stat-card-click:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-main { flex: 1; }
.stat-k { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.stat-v { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.stat-v small { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- 网格 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* ---------- 分布条 ---------- */
.bar-item { margin-bottom: 14px; }
.bar-top { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bar-label { font-weight: 600; color: var(--ink); }
.bar-num { color: var(--muted); }
.bar-track {
  height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }

/* ---------- 列表/行 ---------- */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px;
  background: var(--panel); transition: box-shadow .15s, transform .15s;
}
.list-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-weight: 600; color: var(--ink); font-size: 14px; }
.list-row-sub { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.move-btn {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); border-radius: 6px;
}
.move-btn:hover { color: var(--brand); background: var(--brand-light); }

/* ---------- 标签 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.pill-blue { background: var(--brand-light); color: var(--brand-d); }
.pill-green { background: var(--green-light); color: #047857; }
.pill-orange { background: var(--orange-light); color: #b45309; }
.pill-red { background: var(--red-light); color: #b91c1c; }
.pill-gray { background: #f3f4f6; color: #4b5563; }
.pill-purple { background: var(--purple-light); color: #6d28d9; }

/* 销冠复刻文章式卡片 */
.cc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cc-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 16px 12px; cursor: pointer; transition: .15s; }
.cc-card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(37,99,235,0.08); transform: translateY(-1px); }
.cc-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.cc-title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0; line-height: 1.4; }
.cc-meta { font-size: 12px; color: var(--muted); }
.cc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cc-summary { font-size: 13px; color: #475569; line-height: 1.6; margin: 0; white-space: pre-wrap; }
.cc-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.tag { background: #f3f4f6; color: #4b5563; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; }

/* 销冠复刻查看模式 */
.cc-view { padding: 4px 2px 10px; }
.cc-view-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.cc-view-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cc-view-body { background: #fafbfc; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; font-size: 14px; line-height: 1.85; color: #334155; }
.cc-view-line { margin: 0 0 10px; }
.cc-view-line:last-child { margin-bottom: 0; }
.cc-view-li { padding-left: 14px; position: relative; }
.cc-view-li::before { content: '•'; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.cc-view-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.cc-view-photos { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.cc-view-photos-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.cc-view-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cc-view-photo-thumb { display: block; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.cc-view-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 560px) {
  .cc-view-photo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 销冠复刻：全屏详情页 ---------- */
.cc-detail { max-width: 900px; }
.cc-detail-head { margin-bottom: 16px; }
.cc-detail-title { font-size: 22px; font-weight: 800; color: var(--ink); margin: 0 0 8px; line-height: 1.4; }
.cc-card .cc-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.cc-stat { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.cc-stat .on { color: var(--brand); font-weight: 700; }
.cc-foot-act { margin-left: auto; }

.cc-act-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.cc-act-btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); color: #475569; border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s; }
.cc-act-btn:hover { border-color: var(--brand); color: var(--brand); }
.cc-act-btn:disabled { opacity: .6; cursor: not-allowed; }
.cc-act-btn.on { background: #eff6ff; border-color: var(--brand); color: var(--brand); }
.cc-act-ico { font-size: 15px; line-height: 1; }
.cc-act-num { background: #f1f5f9; color: #475569; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.cc-act-btn.on .cc-act-num { background: #dbeafe; color: var(--brand); }
.cc-learn-stat { font-size: 12px; color: var(--muted); margin-top: 10px; }
.cc-learners { margin-top: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.cc-learners-title { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.cc-learner { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; color: var(--ink); border-bottom: 1px dashed var(--line); }
.cc-learner:last-child { border-bottom: none; }
.cc-learner-av { width: 24px; height: 24px; border-radius: 50%; background: #dbeafe; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.cc-learner i { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); }

.cc-cmt-card { margin-top: 20px; }
.cc-cmt-form { margin-bottom: 6px; }
.cc-cmt-form textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-family: inherit; line-height: 1.6; resize: vertical; }
.cc-cmt-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.cc-cmt-form-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cc-cmt-hint { font-size: 12px; color: var(--muted); }
.cc-cmt-form-foot .btn { margin-left: auto; }
.cc-cmt-list { margin-top: 14px; border-top: 1px solid var(--line); }
.cc-cmt { display: flex; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cc-cmt:last-child { border-bottom: none; }
.cc-cmt-av { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,#3b82f6,#06b6d4); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex: none; }
.cc-cmt-main { flex: 1; min-width: 0; }
.cc-cmt-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.cc-cmt-hd b { font-size: 13px; color: var(--ink); }
.cc-cmt-hd span { font-size: 12px; color: var(--muted); }
.cc-cmt-del { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 4px; }
.cc-cmt-del:hover { color: var(--red); }
.cc-cmt-body { font-size: 13px; color: #334155; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 560px) {
  .cc-detail-title { font-size: 18px; }
  .cc-act-bar { gap: 8px; }
  .cc-act-btn { padding: 7px 12px; font-size: 12px; }
  .cc-act-bar .cc-act-btn:last-child { width: 100%; justify-content: center; }
}

/* ---------- 等级徽标 ---------- */
.lv { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.lv.极高 { background: var(--purple-light); color: #6d28d9; }
.lv.高 { background: var(--green-light); color: #047857; }
.lv.中 { background: var(--orange-light); color: #b45309; }
.lv.低 { background: #f3f4f6; color: #6b7280; }
.lv.极低 { background: #e5e7eb; color: #4b5563; }
.lv.成交 { background: var(--brand-light); color: var(--brand-d); }
.lv.流失 { background: var(--red-light); color: #b91c1c; }

/* ---------- 表格 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  padding: 9px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
/* 看板「按销售对比」表格：移动端也保留（横向滚动），区别于全局 .table-wrap 的隐藏约定 */
.cmp-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow-x: auto; margin-top: 2px; }
.cmp-table table { min-width: 300px; }
/* 按销售对比加了「签单」列（v=93）后 5 列在手机上会挤到换行 —— 表头不换行、签单金额另起小字，避免整表被撑宽 */
.cmp-table th { white-space: nowrap; }
.cmp-table th, .cmp-table td { padding: 13px 11px; }
.cmp-table .cmp-amt { font-size: 11px; color: var(--muted); line-height: 1.4; }
/* 线索表列多（9 列 + 5 个操作按钮），窄屏改为横向滚动，避免「来源/状态/归属」被压成竖排 */
.lead-table { overflow-x: auto; }
.lead-table table { min-width: 1120px; }
.lead-table th, .lead-table td { white-space: nowrap; }
.lead-table th:first-child, .lead-table td:first-child { white-space: normal; min-width: 168px; max-width: 260px; }
.lead-table th:nth-child(3), .lead-table td:nth-child(3) { white-space: normal; min-width: 172px; max-width: 260px; }
.lead-table td:nth-child(7) { white-space: normal; max-width: 150px; }
.lead-table .lead-actions { flex-wrap: nowrap; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; transition: background .15s; }
tr.clickable:hover { background: #f9fafb; }
tr.pinned-row { background: #fffbeb; }
tr.pinned-row:hover { background: #fef3c7; }
td .cell-title { font-weight: 600; color: var(--ink); }
td .cell-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
td .cell-addr { font-size: 12px; color: var(--muted); margin-top: 2px; }
td .cell-elevator { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 40px; font-size: 14px; }
.pin-icon { display: inline-flex; align-items: center; justify-content: center; margin-right: 4px; font-size: 13px; }
.pin-btn { color: var(--brand); }
.pin-btn:hover { background: var(--brand-light); color: var(--brand-d); }

/* ---------- 表单弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
.modal-mask.show { display: flex; }
/* 通用确认层：层级高于业务弹窗，可与业务弹窗叠加显示。
   确认属轻量操作，做成居中小卡片，不占满整屏（业务弹窗仍保持原有版式）。 */
.cfm-mask { z-index: 60; background: rgba(15,23,42,0.35); }
.cfm-mask .modal { width: 340px; height: auto; max-height: 78vh; border-radius: var(--radius-xl); padding: 22px; }
.modal { background: #fff; border-radius: var(--radius-xl); padding: 28px; width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-h h3 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-close { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-section { margin: 16px 0 12px; }
.form-section-title { font-size: 13px; font-weight: 700; color: var(--brand-d); padding-left: 10px; border-left: 3px solid var(--brand); }

.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-opt {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; user-select: none; color: var(--muted); background: #fff;
  transition: all .15s;
}
.tag-opt input { margin: 0; accent-color: var(--brand); }
.tag-opt:hover { border-color: #bfdbfe; }
.tag-opt.on { border-color: var(--brand); color: var(--brand-d); background: var(--brand-light); }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 11px 20px; border-radius: var(--radius); font-size: 13px; opacity: 0; transition: opacity .2s; z-index: 99; pointer-events: none; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; }

/* ---------- AI 意向卡 ---------- */
.intent-card { background: linear-gradient(135deg, #ffffff, #eff6ff); border: 1px solid #dbeafe; }
.intent-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.intent-score { font-size: 36px; font-weight: 800; color: var(--brand); line-height: 1; }
.intent-score-label { color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.intent-signal-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.intent-signal-num { font-size: 22px; font-weight: 800; color: #7c3aed; line-height: 1; }
.intent-signal-max { font-size: 13px; font-weight: 600; color: var(--muted); }
.score-tip { font-size: 11px; color: var(--muted); background: #f1f5f9; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.reasons { margin: 14px 0 0; padding: 0; list-style: none; }
.reasons li { font-size: 13px; color: var(--muted); padding: 6px 0; border-bottom: 1px dashed var(--line); }
.reasons li:last-child { border-bottom: none; }
.next-box { background: #fff; border: 1px solid #dbeafe; border-radius: var(--radius); padding: 14px 16px; margin-top: 16px; }
.next-row { display: flex; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.next-row:last-child { margin-bottom: 0; }
.next-row .lab { color: var(--brand); font-weight: 700; min-width: 64px; flex-shrink: 0; }
.next-row .val { color: var(--ink); font-weight: 500; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 18px 12px; }
.tl-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px #dbeafe; }
.tl-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.tl-content { font-size: 14px; color: var(--ink); line-height: 1.5; }
/* ---- 未读批示红点（v=89）：华哥批示后，销售的销售机会与跟进记录上出红点提醒 ---- */
.advice-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 5px; margin: 0 6px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: middle; box-shadow: 0 0 0 2px rgba(239, 68, 68, .14); }
/* 有时间线红点的记录：把时间线圆点也染红，一眼看出「这条是新的」 */
.tl-item.unread-advice::before { background: var(--red); box-shadow: 0 0 0 3px #fee2e2; }
/* 近期跟进动态：客户名可点击进入客户详情 */
.tl-cust { color: var(--brand); font-weight: 600; cursor: pointer; border-bottom: 1px dashed var(--brand); }
.tl-cust:hover { background: var(--brand-light, #eff6ff); border-bottom-style: solid; }

/* ---------- 成交信号清单 ---------- */
.deal-lock { background: var(--orange-light); color: #92400e; border: 1px solid #fde68a; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin: 0 0 12px; font-weight: 600; }
/* 条件式承诺（#3）：高意向但卡在价格，用黄色区分于已锁定的橙色，避免销售误判为「稳了」 */
.price-hurdle { background: #fffbeb; color: #b45309; border: 1px dashed #fbbf24; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin: 0 0 12px; font-weight: 600; }
.judgment-box { background: #fffbeb; border-left: 3px solid #f59e0b; color: #78350f; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6; margin: 0 0 12px; }
.deal-info { background: var(--brand-light); color: var(--brand-d); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin: 0 0 12px; }
.risk-box { background: var(--red-light); border: 1px solid #fecaca; color: #b91c1c; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin: 0 0 12px; }
.risk-title { font-weight: 700; margin-bottom: 4px; }
.risk-list { margin: 0; padding-left: 18px; }
.risk-list li { line-height: 1.7; }
.sig-group { margin-top: 8px; }
.sig-group-title { font-weight: 700; font-size: 13px; color: var(--brand-d); margin: 16px 0 8px; }
.sig-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.sig-item:hover { background: #f9fafb; }
.sig-item.done { background: var(--green-light); border-color: #a7f3d0; }
.sig-item.ai { background: var(--purple-light); border-color: #ddd6fe; }
.sig-box {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid #d1d5db;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #8b5cf6; flex: 0 0 auto; margin-top: 1px;
}
.sig-item.done .sig-box { background: var(--green); border-color: var(--green); color: #fff; }
.sig-item.ai .sig-box { border-color: #8b5cf6; background: #f3e8ff; }
.sig-text { font-size: 13px; line-height: 1.5; color: var(--ink); }
.sig-text small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.sig-item.done .sig-text { color: #047857; font-weight: 600; }
.sig-item.ai .sig-text { color: #6d28d9; }
.sig-badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; margin-left: 6px; font-weight: 600; }
.sig-badge.checked { background: #d1fae5; color: #047857; }
.sig-badge.ai { background: #ede9fe; color: #6d28d9; }

/* ---------- 详情页布局 ---------- */
.detail-header { margin-bottom: 20px; }
.detail-back { color: var(--brand); text-decoration: none; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.detail-back:hover { color: var(--brand-d); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.info-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row .lab { color: var(--muted); min-width: 72px; flex-shrink: 0; }
.info-row .val { color: var(--ink); font-weight: 500; flex: 1; word-break: break-all; }

/* ===== 客户画像独立卡片 ===== */
.profile-card { margin-top: 18px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 6px; }
.profile-item { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.profile-item .lab { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.profile-item .val { font-size: 14px; font-weight: 600; color: var(--ink); }
.profile-item .val .pill { font-weight: 500; }
.profile-empty { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.6; background: #f8fafc; border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.profile-hint { margin-top: 14px; padding: 12px 14px; background: #eef4ff; border: 1px solid #cfe0ff; border-radius: var(--radius-sm); }
.profile-hint-title { font-size: 13px; font-weight: 600; color: #1d4ed8; margin-bottom: 8px; }
.profile-hint-list { margin: 0 0 10px; padding-left: 18px; font-size: 13px; color: var(--ink); }
.profile-hint-list li { margin: 3px 0; }
.profile-hint-list b { color: #1d4ed8; }

/* ---------- 移动端组件（桌面端默认隐藏） ---------- */
.tabbar { display: none; }
.fab { display: none; }
.mobile-cards { display: none; }

/* 移动端卡片列表 */
.m-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s; cursor: pointer;
}
.m-card:active { transform: scale(0.99); }
.m-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-card-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.m-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.m-card-addr { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.m-card-elevator { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.m-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.m-card-score { font-size: 12px; color: var(--muted); }
.m-card-score b { font-size: 16px; color: var(--brand); font-weight: 800; }
.m-card-owner { font-size: 12px; color: var(--muted); }
.m-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.m-card-actions .btn { flex: 1; }
.m-card.pinned { border-color: #fbbf24; background: #fffbeb; }
.m-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }

/* 底部 Tab 栏 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: 60px; padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(255,255,255,0.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: none; align-items: flex-start; padding-top: 7px;
}
.tab {
  flex: 1; border: none; background: none; display: flex; flex-direction: column;
  align-items: center; gap: 2px; color: var(--gray); font-size: 9.5px; font-weight: 600;
  position: relative; padding: 2px 0; min-width: 0;
}
.tab span { white-space: nowrap; }
.tab svg { width: 21px; height: 21px; }
.tab.on { color: var(--brand); }
.tab-badge {
  position: absolute; top: -2px; left: 50%; margin-left: 6px;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px; padding: 0 4px;
  display: none; align-items: center; justify-content: center;
}

/* 悬浮按钮 */
.fab {
  position: fixed; right: 18px; bottom: 78px; z-index: 39;
  width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: #fff;
  box-shadow: 0 8px 24px rgba(37,99,235,0.45); display: none;
  align-items: center; justify-content: center;
}
.fab:active { transform: scale(0.94); }

/* 我的页面 */
.me-card { padding: 18px; }
.me-head { display: flex; align-items: center; gap: 14px; }
.me-avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #fff; flex: 0 0 48px; }
.me-name { font-size: 17px; font-weight: 700; }
.me-role { font-size: 12px; color: var(--muted); margin-top: 2px; }
.me-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 4px; border: none; background: none; border-bottom: 1px solid var(--line);
  font-size: 15px; color: var(--ink); font-weight: 500;
}
.me-row:last-child { border-bottom: none; }
.me-row svg { width: 20px; height: 20px; color: var(--brand); flex: 0 0 20px; }
.me-row .arrow { margin-left: auto; color: var(--gray); }

/* ---------- 通话录音 / 拨号 ---------- */
.tel-link { color: var(--brand); text-decoration: none; font-weight: 600; border-bottom: 1px dashed currentColor; }
.m-card-phone { font-size: 13px; color: var(--muted); margin-top: 8px; }
.m-card-phone .tel-link { font-size: 14px; }
.btn-record { background: var(--red); color: #fff; border-color: var(--red); }
.btn-record:hover { background: #d33a3a; border-color: #d33a3a; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 7px; line-height: 1.4; }

/* 录音浮层 */
.recorder-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,0.55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 24px; }
.recorder { width: 100%; max-width: 340px; background: #fff; border-radius: 20px; padding: 26px 22px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
.rec-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.rec-timer { font-size: 40px; font-weight: 800; letter-spacing: 2px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rec-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--red); margin: 16px auto; animation: recpulse 1.1s ease-in-out infinite; }
@keyframes recpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(225,29,29,0.5); } 50% { box-shadow: 0 0 0 12px rgba(225,29,29,0); } }
.rec-actions { display: flex; gap: 10px; margin-top: 8px; }
.rec-actions .btn { flex: 1; }
.rec-status { margin-top: 12px; font-size: 12px; color: var(--muted); min-height: 16px; }

/* 时间线音频块 */
.tl-audio-item .tl-audio { width: 100%; margin: 8px 0; height: 38px; }
.tl-summary { background: #f0f7ff; border: 1px solid #d6e8ff; border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 13px; color: var(--ink); line-height: 1.6; }
.tl-summary b { color: #1d4ed8; }
.tl-ai { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tl-ai.err { color: var(--red); }
.tl-detail { margin-top: 8px; font-size: 13px; }
.tl-detail summary { cursor: pointer; color: var(--brand); font-size: 12px; user-select: none; }
.tl-transcript { margin-top: 6px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; font-size: 13px; color: var(--ink); line-height: 1.6; white-space: pre-wrap; max-height: 240px; overflow: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .detail-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  /* 侧边栏与顶栏右侧在手机端隐藏，改用底部 Tab */
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .topbar { padding: 0 16px; height: 56px; }
  .topbar-right { display: none; }
  .page-title { font-size: 18px; }
  .main { padding: 14px 14px 96px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-3 { grid-template-columns: 1fr; }
  .stat-card { flex-direction: column; align-items: flex-start; padding: 14px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 18px; }
  .stat-v { font-size: 24px; }
  /* 手机端用卡片列表替代表格 */
  .table-wrap { display: none; }
  .mobile-cards { display: block; }
  .row2 { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  /* 手机端筛选区改为规整网格 */
  .toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: stretch; margin-bottom: 12px; }
  .toolbar input { grid-column: 1 / -1; width: 100%; }
  .toolbar select { width: 100%; min-width: 0; }
  .toolbar .btn-ghost { grid-column: 1 / -1; width: 100%; justify-content: center; }
  .toolbar .btn-primary { display: none; } /* 手机端用 FAB 新建 */
  /* 底部 Tab + FAB 显示 */
  .tabbar { display: flex; }
  .fab { display: flex; }
  /* 弹窗全屏 */
  .modal-mask { padding: 0; }
  .modal { width: 100%; height: 100%; max-height: 100%; max-width: 100%; border-radius: 0; padding: 22px 18px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0)); }
  .modal-actions { position: sticky; bottom: 0; background: #fff; padding-top: 12px; }
  /* 线索统计手机端紧凑排布 */
  .lead-stat-card { padding: 14px; }
  .lead-stats-grid { gap: 8px; }
  .stat-box { padding: 12px 6px; }
  .stat-num { font-size: 22px; }
  .stat-lab { font-size: 11px; margin-top: 4px; }
  .lead-stat-card .card-h { flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
  .lead-stat-card .period-label { margin-bottom: 10px; }
  .bar-chart { gap: 8px; min-height: 120px; padding-right: 52px; }
  .bar-chart .bar-track { height: 80px; }
  .bar-chart .bar-col { min-width: 48px; }
  .bar-chart .bar-lab { max-width: 56px; font-size: 11px; margin-top: 6px; }
  .chart-title { margin: 16px 0 10px; }
}

/* ---------- 强制手机预览模式 (?mobile=1) ---------- */
/* 在任意宽度的预览框里都按手机界面渲染，并居中成手机外壳 */
html.preview-phone { background: #e9edf4; }
html.preview-phone body { display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; }
html.preview-phone #app {
  display: flex; flex-direction: column;
  width: 414px; max-width: 414px; min-height: 88vh;
  box-shadow: 0 16px 60px rgba(15, 23, 42, .22); border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, .08); overflow: hidden;
}
html.preview-phone .main-area { min-height: 0; flex: 1; display: flex; flex-direction: column; }
html.preview-phone .main { flex: 1; overflow-y: auto; }
html.preview-phone .main::-webkit-scrollbar { display: none; }
html.preview-phone .sidebar { display: none; }
html.preview-phone .main-area { margin-left: 0; }
html.preview-phone .topbar { padding: 0 16px; height: 56px; }
html.preview-phone .topbar-right { display: none; }
html.preview-phone .page-title { font-size: 18px; }
html.preview-phone .main { padding: 14px 14px 96px; }
html.preview-phone .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
html.preview-phone .grid-2 { grid-template-columns: 1fr; }
html.preview-phone .grid-3 { grid-template-columns: 1fr; }
html.preview-phone .stat-card { flex-direction: column; align-items: flex-start; padding: 14px; gap: 10px; }
html.preview-phone .stat-icon { width: 38px; height: 38px; font-size: 18px; }
html.preview-phone .stat-v { font-size: 24px; }
html.preview-phone .table-wrap { display: none; }
html.preview-phone .mobile-cards { display: block; }
html.preview-phone .row2 { grid-template-columns: 1fr; }
html.preview-phone .toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: stretch; margin-bottom: 12px; }
html.preview-phone .toolbar input { grid-column: 1 / -1; width: 100%; }
html.preview-phone .toolbar select { width: 100%; min-width: 0; }
html.preview-phone .toolbar .btn-ghost { grid-column: 1 / -1; width: 100%; justify-content: center; }
html.preview-phone .toolbar .btn-primary { display: none; }
/* 线索统计在预览模式同样按手机排布 */
html.preview-phone .lead-stat-card { padding: 14px; }
html.preview-phone .lead-stats-grid { gap: 8px; }
html.preview-phone .stat-box { padding: 12px 6px; }
html.preview-phone .stat-num { font-size: 22px; }
html.preview-phone .stat-lab { font-size: 11px; margin-top: 4px; }
html.preview-phone .stat-rate { font-size: 11px; margin-top: 2px; }
html.preview-phone .lead-stat-card .card-h { flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
html.preview-phone .lead-stat-card .period-label { margin-bottom: 10px; }
html.preview-phone .lead-source-bars { padding-right: 0; }
html.preview-phone .chart-title { margin: 16px 0 10px; }
/* 工程管理在预览模式同样按手机排布 */
html.preview-phone .prj-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
html.preview-phone .prj-stats .stat-num { font-size: 17px; }
html.preview-phone .prj-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
html.preview-phone .prj-chips::-webkit-scrollbar { display: none; }
html.preview-phone .pc-empty { display: none; }
html.preview-phone .prj-toolbar { flex-wrap: wrap; }
html.preview-phone .prj-search-input { width: 100%; min-width: 0; flex: 1 1 auto; }
html.preview-phone .prj-toolbar .btn-primary { display: inline-flex; }
html.preview-phone .ct-stats { grid-template-columns: repeat(2, 1fr); column-gap: 8px; row-gap: 8px; }
html.preview-phone .ct-stat { padding: 10px 10px 11px 14px; }
html.preview-phone .ct-stat-num { font-size: 16px; }
html.preview-phone .ct-stat-lbl { font-size: 11px; }

/* 线索统计来源分布：水平细条 */
.lead-source-bars { margin-top: 4px; padding-right: 52px; }
.lead-source-bars .bar-item:last-child { margin-bottom: 0; }
html.preview-phone .tabbar { display: flex; position: absolute; left: 0; right: 0; bottom: 0; }
html.preview-phone .fab { display: flex; }
html.preview-phone .modal-mask { padding: 0; position: absolute; }
html.preview-phone .modal {
  width: 100%; height: 100%; max-height: 100%; max-width: 100%;
  border-radius: 0; padding: 22px 18px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0));
}
html.preview-phone .modal-actions { position: sticky; bottom: 0; background: #fff; padding-top: 12px; }
html.preview-phone .login-wrap { max-width: 414px; width: 100%; margin: 0 auto; }

/* ---------- 客户电梯信息 ---------- */
.elevator-card {}
.elevator-grid { display: grid; gap: 10px; }
/* 电梯信息卡片 / 数据看板分布卡片：可折叠，折叠时头部分不留多余间距 */
.elevator-card .card-h, .dash-dist-card .card-h { margin-bottom: 0; }
.elevator-card .card-h.collapsible:hover, .dash-dist-card .card-h.collapsible:hover { margin: -6px -10px 0; padding: 6px 10px; }
.elevator-card .collapsible-body, .dash-dist-card .collapsible-body { padding-top: 14px; }
.floor-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.floor-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: #334155; font-size: 12px; border: 1px solid #e2e8f0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 14px; }
.photo-thumb { display: block; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #f8fafc; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.elevator-remark { white-space: pre-wrap; line-height: 1.6; color: var(--ink); }

.elevator-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.elevator-form-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.floor-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.floor-empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.floor-row { display: flex; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.floor-label { font-size: 13px; color: var(--muted); min-width: 42px; }
.floor-input { flex: 1; border: none; background: transparent; padding: 4px 6px; font-size: 14px; color: var(--ink); min-width: 0; }
.floor-input:focus { outline: none; }
.photo-upload-list { margin: 10px 0; }
.photo-empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.photo-grid-upload { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 10px; }
.photo-counter { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.photo-counter b { color: var(--brand); font-size: 14px; }
.photo-thumb-upload { position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #f8fafc; }
.photo-thumb-upload img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(15,23,42,.7); color: #fff; font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.photo-del:hover { background: var(--red); }

/* ---------- 跟进记录图片 ---------- */
.followup-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 12px; }
.followup-img-thumb { position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #f8fafc; display: block; }
.followup-img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 768px) {
  .followup-images { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

/* 图片灯箱（工程日志/合同附件等） */
.img-lightbox { position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,0.92); display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.img-lightbox-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.15); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; }
.img-lightbox-counter { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; background: rgba(0,0,0,0.4); padding: 4px 12px; border-radius: 999px; z-index: 10; }
.img-lightbox-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 60px 56px; box-sizing: border-box; }
.img-lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.img-lightbox-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255,255,255,0.15); color: #fff; font-size: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; }
.img-lightbox-arrow:hover { background: rgba(255,255,255,0.28); }
.img-lightbox-prev { left: 12px; }
.img-lightbox-next { right: 12px; }
.followup-img-thumb img, .photo-thumb img, .cc-view-photo-thumb img, .photo-thumb-upload img { cursor: zoom-in; }
@media (max-width: 768px) {
  .img-lightbox-stage { padding: 56px 0; }
  .img-lightbox-arrow { width: 38px; height: 38px; font-size: 24px; }
  .img-lightbox-prev { left: 4px; }
  .img-lightbox-next { right: 4px; }
}

@media (max-width: 768px) {
  .photo-grid, .photo-grid-upload { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .floor-inputs { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 销售线索 ---------- */
.lead-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.lead-tab {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #fff; color: var(--muted); border: 1px solid var(--line); transition: all .15s;
}
.lead-tab:hover { border-color: var(--brand); color: var(--brand); }
.lead-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 4px 12px rgba(37,99,235,0.28); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 线索统计 ---------- */
.lead-stat-card { margin-top: 22px; }
.period-switch {
  display: inline-flex; background: #f1f5f9; border-radius: 999px; padding: 3px; gap: 2px;
}
.period-btn {
  padding: 5px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--muted); background: transparent; transition: all .15s;
}
.period-btn.active { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(15,23,42,.12); }
.period-label { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.lead-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-box {
  border-radius: var(--radius); padding: 18px 16px; text-align: center;
  border: 1px solid var(--line); background: #fff;
}
.stat-num { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-lab { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stat-rate { font-size: 12px; color: var(--muted); margin-top: 4px; opacity: .9; }
.stat-new { background: var(--brand-light); border-color: #dbeafe; }
.stat-new .stat-num { color: var(--brand); }
.stat-conv { background: var(--green-light); border-color: #d1fae5; }
.stat-conv .stat-num { color: var(--green); }
.stat-inv { background: var(--red-light); border-color: #fee2e2; }
.stat-inv .stat-num { color: var(--red); }

.third-party-line { margin-top: 12px; font-size: 13px; color: var(--muted); }
.third-party-line b { color: var(--purple); font-size: 14px; }
.chart-title { font-size: 14px; font-weight: 700; color: var(--ink); margin: 22px 0 14px; }
.bar-chart {
  display: flex; align-items: flex-end; gap: 12px; overflow-x: auto;
  padding: 4px 2px 2px; min-height: 200px;
}
.bar-col { flex: 1 1 0; min-width: 56px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.bar-val { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.bar-chart .bar-track {
  width: 100%; height: 150px; display: flex; align-items: flex-end; justify-content: center;
  background: #f8fafc; border-radius: 8px 8px 0 0;
}
.bar-chart .bar-fill {
  width: 60%; min-height: 6px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #60a5fa 0%, var(--brand) 100%);
  transition: height .3s ease;
}
.bar-lab {
  margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center;
  max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 排序表头 ---------- */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: var(--brand); }
.sort-arrow { display: inline-block; margin-left: 4px; color: var(--brand); font-size: 12px; }

/* ---------- 考勤打卡 / 日报 / 绩效 ---------- */
.muted { color: var(--muted); font-size: 12px; }
.checkin-hero { text-align: center; padding: 8px 0; }
.checkin-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.ck-cam { border: 1px dashed #e5e7eb; border-radius: 10px; padding: 10px; background: #f8fafc; }
.ck-cam video, .ck-shot { width: 100%; max-height: 300px; object-fit: cover; border-radius: 8px; background: #000; display: block; }
#ckCamBtns { display: flex; gap: 8px; margin-top: 10px; }
.ck-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid #e5e7eb; }
.ck-thumb:hover { border-color: var(--brand); }
.seg { display: flex; gap: 8px; }
.seg-btn { flex: 1; padding: 10px; border: 1px solid #e5e7eb; background: #fff; border-radius: 10px; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg-btn.on { border-color: var(--brand); color: var(--brand); background: var(--brand-light); font-weight: 600; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mini { text-align: center; background: #f8fafc; border-radius: 10px; padding: 12px 6px; }
.mini-v { font-size: 22px; font-weight: 700; color: var(--brand); }
.mini-k { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-mini { margin-bottom: 16px; }
.kpi-metric { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.kpi-metric > span { width: 130px; flex-shrink: 0; color: var(--muted); }
.kpi-metric > span b { color: var(--ink); font-size: 15px; font-weight: 700; margin: 0 2px; }
.kpi-metric > span small { color: var(--gray); font-size: 11px; }
.kpi-bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.kpi-bar-fill { height: 100%; background: var(--brand); transition: width 0.3s; }
.kpi-bar-fill.ok { background: var(--green); }
.kpi-bar-fill.mid { background: var(--orange); }
.kpi-bar-fill.low { background: var(--red); }
@media (max-width: 560px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-5 { grid-template-columns: repeat(3, 1fr); } .kpi-metric > span { width: 110px; font-size: 12px; } }

/* ---- 考勤设置 ---- */
.att-set { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; padding: 14px 2px 2px; }
.att-set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; background: var(--bg); border-radius: 10px; }
.att-set-k { color: var(--muted); font-size: 13px; }
.att-set-v { font-weight: 600; font-size: 14px; }
/* ---- 月度统计 ---- */
.att-filters { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.att-user-sel { padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--text); max-width: 160px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 4px 2px 2px; }
.stat-box { background: var(--bg); border-radius: 12px; padding: 14px 8px; text-align: center; }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-box.danger .stat-num { color: var(--red); }
.stat-box.warn .stat-num { color: var(--orange); }
.cell-danger { color: var(--red); font-weight: 700; }
.cell-warn { color: var(--orange); font-weight: 700; }
@media (max-width: 560px) {
  .att-set { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-box { padding: 10px 4px; }
  .stat-num { font-size: 18px; }
  /* 工程管理手机端：统计 2 列、阶段筛选横滑 */
  .prj-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .prj-stats .stat-num { font-size: 17px; }
  .prj-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
  .prj-chips::-webkit-scrollbar { display: none; }
  .prj-toolbar { flex-wrap: wrap; }
  .prj-search-input { width: 100%; min-width: 0; flex: 1 1 auto; }
  .prj-toolbar .btn-primary { display: inline-flex; }
  .pc-empty { display: none; }
  /* 合同列表统计：手机 2 列 */
  .ct-stats { grid-template-columns: repeat(2, 1fr); column-gap: 8px; row-gap: 8px; }
  .ct-stat { padding: 10px 10px 11px 14px; }
  .ct-stat-num { font-size: 16px; }
  .ct-stat-lbl { font-size: 11px; }
}

/* ---- 工程管理 ---- */
.prj-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 720px; margin-bottom: 14px; }
/* ---- 工程列表统计（v=88：只保留「总工程单」，去掉金额）---- */
.prj-total { display: inline-flex; align-items: baseline; gap: 8px; background: var(--bg); border-radius: 12px; padding: 13px 20px; margin-bottom: 12px; }
.prj-total-num { font-size: 22px; font-weight: 700; line-height: 1.1; color: var(--brand); }
.prj-total-lbl { font-size: 12px; color: var(--muted); }

.prj-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; max-width: 820px; }
.prj-chips .seg-btn { flex: 0 0 auto; white-space: nowrap; padding: 8px 14px; }

/* ---- 合同列表统计（v=82 重做：6 项 3×2 对齐，取代原 7 个散块）---- */
.ct-stat-card { margin-bottom: 14px; }
.ct-stats { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 10px; row-gap: 12px; }
.ct-stat { position: relative; background: var(--bg); border-radius: 12px; padding: 12px 14px 13px 17px; display: flex; flex-direction: column; gap: 5px; min-width: 0; overflow: hidden; }
.ct-stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); opacity: .35; }
.ct-stat.g::before { background: var(--green); opacity: .6; }
.ct-stat.r::before { background: var(--red); opacity: .6; }
.ct-stat-lbl { font-size: 12px; color: var(--muted); }
.ct-stat-num { font-size: 21px; font-weight: 700; line-height: 1.15; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-stat.g .ct-stat-num { color: var(--green); }
.ct-stat.r .ct-stat-num { color: var(--red); }
.prj-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: nowrap; }
.prj-search-input { min-width: 220px; width: 320px; flex: 0 0 auto; }

/* ---- 进店统计 ---- */
.sv-range { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sv-range input[type="date"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); font-size: 13px; }
.sv-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.sv-tab { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg); border: none; cursor: pointer; }
.sv-tab.on { background: var(--brand-light); color: var(--brand-d); }
.sv-bars { display: flex; flex-direction: column; gap: 2px; }
.sv-bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 8px 2px; }
.sv-bar-label { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-bar-track { height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.sv-bar-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width 0.3s; }
.sv-bar-num { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 768px) {
  .sv-range { width: 100%; margin-left: 0; margin-top: 8px; }
  .sv-range input[type="date"] { flex: 1; min-width: 0; }
  .sv-tabs { gap: 6px; }
  .sv-tab { padding: 5px 10px; font-size: 12px; }
  .sv-bar-row { grid-template-columns: 86px 1fr auto; gap: 8px; padding: 6px 0; }
  .sv-bar-label { font-size: 12px; }
  .sv-bar-num { font-size: 11px; }
}

/* ===== 报价模板 / 报价单 ===== */
.quote-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.quote-tpl-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer; transition: .15s; }
.quote-tpl-card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(29,78,216,.12); transform: translateY(-2px); }
.quote-tpl-card.empty-tpl { border-style: dashed; background: #fbfcfe; }
.qt-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.qt-status { font-size: 13px; margin: 6px 0 4px; }
.qt-meta { font-size: 12px; color: var(--muted); }
.tpl-row { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 8px; }
.tpl-row .tpl-intro-title { font-weight: 600; }
.tpl-empty { font-size: 13px; color: var(--muted); padding: 10px 12px; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; }
.tpl-img-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tpl-img-thumb { width: 120px; height: 67px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.tpl-img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-img-meta { display: flex; flex-direction: column; gap: 4px; }
.tpl-img-no { font-size: 12px; color: var(--muted); }
.tpl-img-cap { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 13px; }
.tpl-img-link { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 13px; color: var(--brand); }
.tpl-img-row-deco { align-items: flex-start; }
.tpl-tbl { width: 100%; border-collapse: collapse; }
.tpl-tbl th, .tpl-tbl td { border: 1px solid var(--line); padding: 6px 8px; font-size: 13px; }
.tpl-tbl input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 13px; }
.chk-group { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.deco-chk { display: flex; flex-direction: column; gap: 6px; width: 160px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; position: relative; }
.deco-chk:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
.deco-chk input { position: absolute; top: 8px; left: 8px; }
.deco-chk-thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--bg); }
.deco-chk-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.deco-chk-cap { font-size: 12px; color: var(--ink); text-align: center; }
.deco-chk-link { position: absolute; top: 8px; right: 8px; background: var(--brand); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-total-preview { margin-top: 12px; padding: 12px 16px; background: var(--bg); border-radius: 10px; font-size: 14px; }
.q-total-preview b { font-size: 16px; }

/* 报价预览 */
.qp-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.quote-preview { max-width: 860px; margin: 0 auto; background: #fff; padding: 32px 36px; border: 1px solid var(--line); border-radius: 14px; }
.qp-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--brand); padding-bottom: 16px; margin-bottom: 8px; }
.qp-head h2 { font-size: 22px; margin: 0 0 4px; }
.qp-sub { color: var(--muted); font-size: 13px; }
.qp-brand { background: var(--brand); color: #fff; padding: 6px 14px; border-radius: 8px; font-weight: 700; }
.quote-preview h3 { font-size: 17px; margin: 26px 0 10px; color: var(--brand); border-left: 4px solid var(--brand); padding-left: 10px; }
.qp-info { width: 100%; border-collapse: collapse; font-size: 13px; }
.qp-info td { border: 1px solid var(--line); padding: 8px 10px; }
.qp-info .lbl { color: var(--muted); width: 96px; white-space: nowrap; }
.qp-section { margin-top: 14px; }
.qp-body { line-height: 1.8; font-size: 14px; }
.qp-body img { max-width: 100%; }
.qp-img-wrap { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: var(--bg); margin-top: 4px; }
.qp-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qp-deco-link { margin-top: 8px; }
.qp-deco-link a { display: inline-flex; align-items: center; gap: 4px; background: var(--brand); color: #fff; padding: 7px 14px; border-radius: 20px; font-size: 13px; text-decoration: none; }
.qp-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.qp-tbl th, .qp-tbl td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.qp-tbl th { background: var(--bg); }
.qp-tbl .num, .quote-preview .num { text-align: right; font-variant-numeric: tabular-nums; }
.qp-total { margin-top: 18px; background: var(--bg); border-radius: 10px; padding: 16px 20px; }
.qp-row { display: flex; justify-content: space-between; padding: 4px 0; }
.qp-final { font-size: 20px; font-weight: 800; color: var(--red); border-top: 1px dashed #cdd; margin-top: 6px; padding-top: 8px; }
.qp-pay { line-height: 1.9; white-space: pre-wrap; background: #fffdf5; border: 1px solid #f0e6c8; border-radius: 8px; padding: 12px 16px; font-size: 13px; }
.qp-qr { display: flex; gap: 16px; align-items: center; margin-top: 26px; padding-top: 18px; border-top: 1px dashed #dde; }
.qp-qr-img img { width: 150px; height: 150px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qp-qr-cap { font-size: 12px; color: var(--muted); }
.qp-url { font-size: 11px; color: #99a; word-break: break-all; }
.qp-foot { text-align: center; color: #aab; font-size: 12px; margin-top: 22px; }
.m-price { font-weight: 800; color: var(--red); }

/* AI 跟进建议卡片 */
.ai-suggest-block { margin-top: 16px; }
.ai-sg-card { background: linear-gradient(135deg, #f3f1ff 0%, #eef4ff 100%); border: 1px solid #dfe3ff; border-radius: 12px; padding: 14px 16px; }
.ai-sg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ai-sg-title { font-weight: 700; color: #4b3fb0; font-size: 14px; }
.ai-sg-head .card-sub { color: #8a86b8; font-size: 12px; }
.ai-sg-list { display: flex; flex-direction: column; gap: 10px; }
.ai-sg-item { display: flex; align-items: flex-start; gap: 10px; background: #fff; border: 1px solid #e6e8f7; border-radius: 10px; padding: 10px 12px; }
.ai-sg-text { flex: 1; font-size: 13.5px; line-height: 1.7; color: #2c2c3a; }
.ai-sg-item .btn-xs { flex-shrink: 0; white-space: nowrap; }
.ai-sg-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #f7f8fc; border: 1px dashed #d4d8e6; border-radius: 12px; padding: 14px 16px; color: #6b7088; font-size: 13px; }

/* ---------- 首页激励横幅 + 作战看板 + 待办 ---------- */
.encourage-banner {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(90deg, #eff6ff, #f0fdf4);
  border: 1px solid #dbeafe; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 18px;
  font-size: 14px; color: #1e3a8a; font-weight: 600; line-height: 1.5;
}
.war-card .card-h { display: flex; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 2px; }
.seg-btn { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; color: #64748b; }
.seg-btn.on { background: #fff; color: #1d4ed8; box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.war-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.war-cell { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; text-align: center; }
.war-k { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.war-v { font-size: 28px; font-weight: 800; color: #0f172a; line-height: 1; }
.war-delta { font-size: 11px; margin-top: 6px; }
.war-delta.up { color: #16a34a; }
.war-delta.down { color: #dc2626; }
.war-delta.flat { color: #94a3b8; }
.task-remind .card-h { display: flex; align-items: center; gap: 8px; }
.task-remind .card-h-actions { margin-left: auto; display: flex; gap: 6px; }
.task-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.task-row { display: flex; align-items: flex-start; gap: 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; }
.task-row.done { opacity: .55; }
.task-row input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; }
.task-main { flex: 1; min-width: 0; }
.task-content { font-size: 13px; color: #0f172a; }
.task-row.done .task-content { text-decoration: line-through; }
.task-cust { color: #2563eb; font-size: 12px; }
.task-meta { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.readonly-val { padding: 8px 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; color: #334155; }
.ai-sg-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
@media (max-width: 768px) { .war-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } .war-v { font-size: 22px; } }

/* 打印 */
@media print {
  .sidebar, .topbar, .tabbar, .fab, .no-print { display: none !important; }
  .main-area { margin: 0; }
  .quote-preview { border: none; padding: 0; max-width: 100%; }
  body { background: #fff; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .quote-preview { padding: 18px 16px; }
}

/* ---- 渠道管理 / 推荐单 ---- */
.link-btn { background: none; border: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }
.rf-list { display: flex; flex-direction: column; gap: 10px; }
.rf-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.rf-top { display: flex; align-items: center; justify-content: space-between; }
.rf-top b { font-size: 15px; color: var(--text); }
.rf-unpaid { font-size: 12px; color: var(--orange); font-weight: 600; }
.rf-meta { color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.rf-actions { display: flex; gap: 8px; }

/* 提升高度实时提示（电梯信息编辑弹窗，层高输入下方） */
.rise-hint { margin: -4px 0 10px; font-size: 13px; color: var(--muted, #6b7280); }
.rise-hint b { color: var(--primary, #2563eb); }

/* ---------- 工程管理：施工跟进时间线 ---------- */
/* 工程详情：左侧字段列表 + 右侧工地二维码（客户扫码输手机号看施工过程） */
.pd-body { display: flex; gap: 22px; align-items: flex-start; }
.pd-main { flex: 1; min-width: 0; }
.pd-qr { flex: 0 0 208px; width: 208px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px; text-align: center; background: #fbfdff; }
.pd-qr-t { font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.pd-qr-img { width: 168px; height: 168px; display: block; margin: 0 auto 10px; border-radius: 8px; background: #fff; }
.pd-qr-hint { font-size: 12px; color: var(--muted); text-align: left; line-height: 1.65; margin-bottom: 10px; }
.pd-qr-btns { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 900px) {
  .pd-body { flex-direction: column; }
  .pd-qr { width: 100%; flex: none; }
}
html.preview-phone .pd-body { flex-direction: column; }
html.preview-phone .pd-qr { width: 100%; flex: none; }
.plog-list { display: flex; flex-direction: column; gap: 14px; }
.plog-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: #fff; }
.plog-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plog-type { font-weight: 700; font-size: 14px; color: var(--ink); }
.plog-time { margin-left: auto; font-size: 12px; color: var(--muted); }
.plog-edit, .plog-confirm, .plog-share { border: none; background: none; font-size: 12px; cursor: pointer; padding: 0 4px; border-radius: 4px; }
.plog-edit { color: var(--brand); }
.plog-edit:hover { background: rgba(37,99,235,.08); }
.plog-confirm { color: #fff; background: var(--brand); padding: 2px 8px; }
.plog-confirm:hover { filter: brightness(1.05); }
.plog-share { color: var(--green); }
.plog-share:hover { background: rgba(16,185,129,.08); }
.plog-del { border: none; background: none; color: #ef4444; font-size: 12px; cursor: pointer; padding: 0 2px; }
#shareLink { width: 100%; font-size: 13px; }
.plog-by { font-size: 12px; color: var(--muted); margin-top: 6px; }
.plog-content { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.plog-note { margin-top: 6px; font-size: 13px; color: var(--orange); background: #fffbeb; border-radius: 8px; padding: 6px 10px; }
@media (max-width: 768px) {
  .plog-item { padding: 10px 12px; }
  .plog-time { margin-left: 0; width: 100%; }
}

/* ---------- 工程单合同附件 ---------- */
.contract-list { display: flex; flex-wrap: wrap; gap: 10px; }
.contract-item { display: flex; align-items: center; gap: 6px; }
.contract-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }

/* ---------- AI 参考话术来源（知识库场景检索） ---------- */
.kb-hits { margin-top: 10px; padding: 8px 10px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; font-size: 12px; color: #475569; line-height: 1.9; }
.kb-hits .kb-t { color: #64748b; font-weight: 600; margin-right: 2px; }
.kb-hits .kb-p { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; background: var(--brand-light); color: var(--brand-d); border-radius: 10px; font-size: 11.5px; }

/* ---------- 客户方案 & 报价附件 ---------- */
.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: #fff; transition: background .15s; }
.file-row:hover { background: #f9fafb; }
.file-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.file-icon { font-size: 22px; line-height: 1; }
.file-meta { min-width: 0; }
.file-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.quote-files-card .card-h { align-items: center; }
.file-drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  background: #f8fafc;
}
.file-drop-zone:hover { background: #f1f5f9; border-color: #94a3b8; }
.file-drop-zone.drag-over { background: #eef4ff; border-color: var(--brand); }
.file-drop-zone.has-file { background: #f0fdf4; border-color: #22c55e; }
.file-drop-icon { font-size: 28px; margin-bottom: 8px; }
.file-drop-text { font-size: 14px; color: var(--ink); font-weight: 600; }
.file-drop-name { font-size: 12px; color: var(--muted); margin-top: 6px; word-break: break-all; }
@media (max-width: 768px) {
  .file-row { align-items: flex-start; }
  .file-info { gap: 10px; }
  .file-sub { font-size: 11px; }
}

/* 近期跟进动态：回复/批示 */
.tl-actions { margin-top: 8px; display: flex; gap: 8px; }
.tl-reply-box { margin-top: 10px; padding: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); display: none; }
.tl-reply-box .reply-textarea { width: 100%; min-height: 60px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; line-height: 1.5; resize: vertical; box-sizing: border-box; }
.tl-reply-box .reply-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.tl-reply-box .reply-actions { margin-top: 10px; display: flex; gap: 8px; }
.tl-replies { margin-top: 12px; padding-left: 12px; border-left: 3px solid var(--brand); }
.tl-reply-title { font-size: 12px; font-weight: 700; color: var(--brand); margin-bottom: 8px; }
.tl-reply { margin-bottom: 8px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tl-reply:last-child { margin-bottom: 0; }
.tl-reply-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.tl-reply-content { font-size: 13px; color: var(--ink); line-height: 1.5; white-space: pre-wrap; }

/* ---------- 线索列表/卡片操作区（2026-09-12：操作列多了「编辑」，5 个按钮要挤一行） ---------- */
/* 表格：压缩内边距 + 行距，5 个按钮在常规桌面宽度下一行放下；实在放不下仍可换行（flex-wrap 兜底） */
.lead-actions { flex-wrap: wrap; gap: 2px; }
.lead-actions .btn-sm { padding: 6px 7px; font-size: 12.5px; }
/* 手机卡片：不能再用 flex:1 均分（5 个按钮会把「删除」挤出卡片），改成按内容宽度 + 允许换行 */
.lead-card-actions { flex-wrap: wrap; gap: 6px; }
.lead-card-actions .btn { flex: 0 0 auto; padding: 6px 9px; font-size: 12.5px; }
