/* =============================================================================
   订单雷达 OrderRadar · 中文界面样式
   浅色专业风；主色 #2563eb；背景 #f6f7fb；卡片白 / 圆角 12 / 边框 #e2e8f0
   零外部资源：不引用 CDN、字体、图标库
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-soft: #475569;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-weak: #eff4ff;
  --ok: #16a34a;
  --ok-weak: #ecfdf3;
  --warn: #d97706;
  --warn-weak: #fffbeb;
  --danger: #dc2626;
  --danger-weak: #fef2f2;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 6px 18px rgba(15, 23, 42, .07);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .16);
  --sidebar-w: 220px;
  --font: system-ui, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.35; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
hr.rule { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

button { font-family: inherit; font-size: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================== 布局骨架 ============================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 12px 14px;
  background: #fff;
  border-right: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-weak);
  flex: 0 0 auto;
}
.brand-mark svg { width: 26px; height: 26px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-size: 15.5px; font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 14px;
  transition: background .14s ease, color .14s ease;
}
.nav-item .icon { color: var(--muted); transition: color .14s ease; }
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item:hover .icon { color: var(--text-soft); }
.nav-item.active {
  background: var(--primary-weak);
  color: var(--primary-dark);
  font-weight: 600;
}
.nav-item.active .icon { color: var(--primary); }

.sidebar-foot { margin-top: auto; padding: 10px 8px 2px; border-top: 1px solid var(--border); }

.health {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.health-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--muted-light);
}
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(217, 119, 6, .12); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.dot-idle { background: var(--muted-light); }

.sidebar-note { margin-top: 6px; font-size: 11px; color: var(--muted-light); }

.sidebar-scrim { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.menu-btn { display: none; }

.topbar-titles { min-width: 0; }
.topbar-titles h1 { font-size: 19px; letter-spacing: .2px; }
.topbar-titles p { margin-top: 2px; font-size: 12.5px; color: var(--muted); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content {
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  padding: 20px 24px 72px;
}

.page { display: flex; flex-direction: column; gap: 16px; }
.page[hidden] { display: none !important; }

/* ============================== 通用组件 ============================== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.card-head h2 { font-size: 15.5px; }
.card-head .hint { margin-top: 3px; }

.hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.muted { color: var(--muted); }
.sub-title { font-size: 13.5px; font-weight: 650; color: var(--text-soft); margin: 16px 0 8px; }
.sub-title:first-child { margin-top: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.company-layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }

.settings-stack { display: flex; flex-direction: column; gap: 16px; }

.row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }
.toolbar-spacer { flex: 1 1 auto; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.hero-line { font-size: 13.5px; color: var(--text-soft); padding: 0 2px; }
.hero-line strong { color: var(--primary-dark); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease, opacity .14s ease;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--text-soft); border-color: var(--border-strong); }
.btn.ghost:hover { background: #f8fafc; color: var(--text); border-color: #b6c2d2; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn .icon { width: 16px; height: 16px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  cursor: pointer;
}
.icon-btn:hover { background: #f8fafc; color: var(--text); }

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* 表单 */
.form { display: flex; flex-direction: column; gap: 4px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.form-grid.tight { gap: 10px 12px; margin-top: 4px; }
.span-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field > .hint { margin: 0; }

.input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
textarea.input { resize: vertical; min-height: 64px; }
select.input, .select {
  appearance: none;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
.select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-soft);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  cursor: pointer;
}
.check-field input { width: 15px; height: 15px; accent-color: var(--primary); margin: 0; }
.check-field.span-2 { grid-column: 1 / -1; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.form-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.inline-input { max-width: 240px; }

.rule-rows { display: flex; flex-direction: column; gap: 8px; }
.rule-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.25fr) minmax(80px, .9fr) 76px 76px 92px 34px;
  gap: 8px;
  align-items: center;
}
.rule-row .input, .rule-row .select { font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.rule-row .icon-btn { border-color: transparent; color: var(--muted); }
.rule-row .icon-btn:hover { color: var(--danger); background: var(--danger-weak); }
.rule-row-head {
  display: grid;
  grid-template-columns: minmax(120px, 1.25fr) minmax(80px, .9fr) 76px 76px 92px 34px;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 0 2px;
}

/* ============================== 仪表盘 ============================== */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.metric-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.metric-value { margin-top: 6px; font-size: 30px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.metric-value .unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.metric-sub { margin-top: 4px; font-size: 12px; color: var(--muted-light); }
.metric-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-weak);
  color: var(--primary);
}
.metric-icon .icon { width: 17px; height: 17px; }
.metric-card.tone-ok .metric-icon { background: var(--ok-weak); color: var(--ok); }
.metric-card.tone-warn .metric-icon { background: var(--warn-weak); color: var(--warn); }
.metric-card.tone-neutral .metric-icon { background: #f1f5f9; color: var(--muted); }

.funnel { display: flex; flex-direction: column; gap: 11px; }
.funnel-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 64px; align-items: center; gap: 10px; }
.funnel-label { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.funnel-track { height: 9px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #60a5fa, var(--primary)); transition: width .4s ease; }
.funnel-count { text-align: right; font-size: 13px; font-weight: 700; color: var(--text); }
.funnel-count small { font-size: 11px; color: var(--muted-light); font-weight: 500; margin-left: 4px; }

.source-health { display: flex; flex-direction: column; gap: 10px; }
.source-health-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.source-health-item .name { font-size: 13px; font-weight: 600; }
.source-health-item .meta { font-size: 11.5px; color: var(--muted); }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.recent-list { display: flex; flex-direction: column; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 4px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}
.recent-item:last-child { border-bottom: 0; }
.recent-item:hover { background: #fafcff; }
.recent-main { flex: 1 1 auto; min-width: 0; }
.recent-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { margin-top: 2px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-score { font-size: 13px; font-weight: 700; color: var(--text-soft); min-width: 44px; text-align: right; }

/* ============================== 徽标 / 状态 ============================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-soft);
  white-space: nowrap;
}
.chip-type { background: #eef2ff; color: #4338ca; }
.verdict-qualified { background: var(--ok-weak); color: #15803d; }
.verdict-needs_info { background: var(--warn-weak); color: #b45309; }
.verdict-rejected { background: #f1f5f9; color: #64748b; }

.status-chip.contacted { background: #eff6ff; color: #1d4ed8; }
.status-chip.replied { background: #ecfeff; color: #0e7490; }
.status-chip.quoted { background: #fef3c7; color: #b45309; }
.status-chip.won { background: var(--ok-weak); color: #15803d; }
.status-chip.lost { background: var(--danger-weak); color: #b91c1c; }
.status-chip.archived { background: #f1f5f9; color: var(--muted); }
.status-chip.new { background: #f5f3ff; color: #6d28d9; }

.score-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 2px 9px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.score-badge small { font-size: 10.5px; color: var(--muted-light); font-weight: 600; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--text-soft);
  font-size: 11px;
}

/* ============================== 看板 / 列表 ============================== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  min-width: 260px;
  flex: 0 1 320px;
}
.search-box .icon { color: var(--muted); width: 17px; height: 17px; }
.search-box input {
  flex: 1 1 auto;
  border: 0;
  background: none;
  padding: 9px 0;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  min-width: 0;
}
.search-box input:focus { outline: none; }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: #eef2f7;
  border-radius: 9px;
}
.segmented button {
  border: 0;
  background: none;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
}
.segmented button.active { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow-sm); }

.tabs { display: inline-flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button {
  border: 0;
  background: none;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

.board-hint { font-size: 12.5px; color: var(--muted); }

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.board-column {
  background: #f1f4f9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.board-column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 6px;
}
.board-column-head .title { font-size: 13px; font-weight: 700; }
.board-column-head .count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-soft);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.board-column-head .rail { width: 3px; height: 14px; border-radius: 2px; background: var(--muted-light); }
.board-column.qualified .rail { background: var(--ok); }
.board-column.needs_info .rail { background: var(--warn); }
.board-column.rejected .rail { background: #94a3b8; }

.lead-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.lead-card:hover {
  border-color: #b9cdf5;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.lead-card-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.lead-card-top .score-badge { margin-left: auto; }
.lead-card-title {
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lead-meta {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 11.5px;
  color: var(--muted);
}
.lead-meta b { color: var(--text-soft); font-weight: 600; }
.lead-reasons { margin: 7px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.lead-reasons li { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-reasons li::before { content: "· "; color: var(--muted-light); }
.lead-card-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted-light);
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}

.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th {
  background: #f8fafc;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }
.table .col-time { width: 132px; white-space: nowrap; }
.table .col-action { width: 108px; }
.table .col-actor { width: 96px; }
.table .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; color: var(--text-soft); }
.table .detail-cell { color: var(--muted); font-size: 12px; max-width: 520px; word-break: break-word; }

.lead-list-head, .lead-list-row {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) 108px 108px 96px 78px 92px 104px;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
}
.lead-list-head {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.lead-list-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.lead-list-row:last-child { border-bottom: 0; }
.lead-list-row:hover { background: #fafcff; }
.lead-list-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-list-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-num { font-size: 12.5px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================== 待跟进 ============================== */

.followup-list { display: flex; flex-direction: column; gap: 10px; }
.followup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.followup-title { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.followup-meta { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.next-action {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--primary-dark);
  background: var(--primary-weak);
  border-radius: 7px;
  padding: 3px 9px;
}
.next-action .icon { width: 14px; height: 14px; }

/* ============================== 记忆库 ============================== */

.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.memory-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.memory-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.memory-title { font-size: 14px; font-weight: 650; }
.memory-content {
  font-size: 13px;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}
.memory-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); }
.memory-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.memory-actions .btn { padding: 5px 10px; font-size: 12px; }

details.clamp summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  list-style: none;
}
details.clamp summary::-webkit-details-marker { display: none; }

/* ============================== 公司版本 ============================== */

.version-list { display: flex; flex-direction: column; gap: 9px; }
.version-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.version-top { display: flex; align-items: center; gap: 8px; }
.version-no { font-size: 13px; font-weight: 700; }
.version-time { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.version-note { margin-top: 4px; font-size: 12px; color: var(--text-soft); word-break: break-word; }
.version-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ============================== 来源 / 状态行 ============================== */

.status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  font-size: 13px;
  min-height: 44px;
}
.status-line .status-text { font-weight: 650; }
.status-line .status-detail { font-size: 12px; color: var(--muted); }

.source-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.source-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.source-item .name { font-size: 13px; font-weight: 600; }
.source-item .url { font-size: 11.5px; color: var(--muted); word-break: break-all; }

.result-box {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  font-size: 12.5px;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.result-box.ok { background: var(--ok-weak); border-color: #bbf7d0; color: #166534; }
.result-box.warn { background: var(--warn-weak); border-color: #fde68a; color: #92400e; }
.result-box.error { background: var(--danger-weak); border-color: #fecaca; color: #991b1b; }
.result-list { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.result-list li { font-size: 12px; }

/* ============================== 空状态 / 骨架 / 错误 ============================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #f1f5f9;
  color: var(--muted-light);
}
.empty-title { font-size: 13.5px; font-weight: 650; color: var(--text-soft); }
.empty-desc { font-size: 12.5px; max-width: 420px; }
.board-column .empty-state { padding: 18px 8px; }

.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton-line.w70 { width: 70%; }
.skeleton-line.w50 { width: 50%; }
.skeleton-line.w90 { width: 90%; }
.skeleton-card { height: 96px; border-radius: 10px; background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.3s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: var(--danger-weak);
  color: #991b1b;
  font-size: 13px;
}
.error-box .icon { color: var(--danger); }

/* ============================== 详情抽屉 ============================== */

#drawer-root { position: relative; z-index: 80; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .34);
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 80;
}
.drawer-backdrop.open { opacity: 1; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(620px, 100vw);
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform .22s cubic-bezier(.32, .72, .28, 1);
  z-index: 81;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.drawer-title-block { min-width: 0; flex: 1 1 auto; }
.drawer-title { font-size: 16px; font-weight: 700; line-height: 1.4; word-break: break-word; }
.drawer-sub { margin-top: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 18px; }

.drawer-section { display: flex; flex-direction: column; gap: 9px; }
.drawer-section > h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 7px;
}
.drawer-section > h3 .count-hint { font-weight: 500; color: var(--muted-light); font-size: 11.5px; }

.raw-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-soft);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

.kv-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.kv-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; background: #fbfcfe; border: 1px solid var(--border); border-radius: 7px; min-width: 0; }
.kv-item .k { font-size: 11px; color: var(--muted); }
.kv-item .v { font-size: 13px; font-weight: 600; word-break: break-word; }
.kv-item .v.missing { color: var(--warn); font-weight: 600; }

.breakdown { display: flex; flex-direction: column; gap: 9px; }
.breakdown-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) 74px; align-items: center; gap: 10px; }
.breakdown-label { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.breakdown-track { height: 8px; border-radius: 999px; background: #eff3f8; overflow: hidden; }
.breakdown-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .35s ease; }
.breakdown-fill.zero { background: #cbd5e1; }
.breakdown-val { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.breakdown-note { grid-column: 2 / -1; margin-top: -4px; font-size: 11px; color: var(--muted-light); }

.reason-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.reason-list li {
  position: relative;
  padding: 7px 10px 7px 26px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-soft);
  word-break: break-word;
}
.reason-list li::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}
.reason-list li.hard::before { background: var(--danger); }

.missing-list { display: flex; flex-wrap: wrap; gap: 6px; }

.draft-box { display: flex; flex-direction: column; gap: 8px; }
.draft-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.draft-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.draft-count.over { color: var(--danger); font-weight: 700; }
.draft-box .input { min-height: 96px; font-size: 13px; line-height: 1.65; }

.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; }
.timeline-dot-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline-line { flex: 1 1 auto; width: 1px; background: var(--border); margin-top: 4px; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; background: #fbfcfe; }
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.timeline-head .who { font-weight: 650; color: var(--text-soft); }
.timeline-body { margin-top: 5px; font-size: 12.5px; color: var(--text-soft); white-space: pre-wrap; word-break: break-word; }
.timeline-error { margin-top: 4px; font-size: 12px; color: var(--danger); }

.drawer-foot {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
}

.status-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }

/* ============================== 弹窗 ============================== */

#modal-root { position: relative; z-index: 120; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
  animation: fadeIn .16s ease;
  z-index: 120;
}
.modal {
  width: min(520px, 100%);
  max-height: min(84vh, 760px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
.modal.wide { width: min(760px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 10px;
}
.modal-title { font-size: 16px; font-weight: 700; flex: 1 1 auto; }
.modal-desc { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.modal-body { padding: 4px 20px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-body p { font-size: 13.5px; color: var(--text-soft); line-height: 1.65; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  flex-wrap: wrap;
}
.modal-foot .btn:first-child:not(:last-child) { margin-right: auto; }
.modal-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-weak);
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.6;
}
.modal-note.danger { background: var(--danger-weak); border-color: #fecaca; color: #991b1b; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

/* ============================== Toast ============================== */

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: auto;
}
.toast-item.show { opacity: 1; transform: none; }
.toast-item .icon { width: 17px; height: 17px; margin-top: 1px; }
.toast-item.info .icon { color: var(--primary); }
.toast-item.success { border-color: #bbf7d0; }
.toast-item.success .icon { color: var(--ok); }
.toast-item.error { border-color: #fecaca; }
.toast-item.error .icon { color: var(--danger); }
.toast-text { word-break: break-word; }

/* ============================== 响应式（≤960px 折叠侧栏） ============================== */

@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lead-list-head, .lead-list-row { grid-template-columns: minmax(0, 2fr) 96px 96px 84px 88px; }
  .lead-list-head > :nth-child(6), .lead-list-row > :nth-child(6),
  .lead-list-head > :nth-child(7), .lead-list-row > :nth-child(7) { display: none; }
}

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
    z-index: 100;
  }
  .sidebar.open { transform: none; }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .34);
    z-index: 90;
  }
  .sidebar-scrim[hidden] { display: none; }

  .menu-btn { display: inline-grid; }

  .topbar { padding: 10px 14px; gap: 10px; min-height: 58px; }
  .topbar-titles h1 { font-size: 17px; }
  .topbar-titles p { display: none; }
  .topbar-actions .btn span { display: none; }

  .content { padding: 14px 14px 64px; }
  .page { gap: 12px; }
  .card { padding: 14px; }

  .grid-2, .company-layout { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: minmax(0, 1fr); }
  .board-column { min-height: 0; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }

  .toolbar { gap: 8px; }
  .search-box { flex: 1 1 100%; min-width: 0; }

  .rule-row, .rule-row-head { grid-template-columns: minmax(100px, 1.3fr) minmax(64px, .8fr) 64px 64px 78px 32px; }

  .lead-list-head, .lead-list-row { grid-template-columns: minmax(0, 1fr) 92px 84px; }
  .lead-list-head > :nth-child(n + 4), .lead-list-row > :nth-child(n + 4) { display: none; }

  .kv-list { grid-template-columns: minmax(0, 1fr); }
  .followup-item { grid-template-columns: minmax(0, 1fr); }
  .status-edit { grid-template-columns: minmax(0, 1fr); }

  .drawer { width: 100vw; border-left: 0; }
  .toast { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
  .toast-item { max-width: none; }
}

@media (max-width: 640px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-value { font-size: 25px; }
  .memory-grid { grid-template-columns: minmax(0, 1fr); }
  .modal { max-height: 88vh; }
  .drawer-body { padding: 14px 14px 20px; }
  .drawer-head, .drawer-foot { padding-left: 14px; padding-right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
