:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --border: #e5e7eb;
  --border-soft: #eef1f5;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --violet: #7c5cff;
  --violet-dark: #6438eb;
  --violet-soft: #f3f0ff;
  --sidebar: #0f0a1f;
  --sidebar-2: #181030;
  --sidebar-br: rgba(255, 255, 255, 0.06);
  --sidebar-t: #c8bfe0;
  --sidebar-tm: #8a7fb0;
  --sidebar-active: rgba(124, 92, 255, 0.18);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 0 rgba(15, 23, 42, 0.02);
  --shadow-lg: 0 20px 60px -20px rgba(15, 23, 42, 0.25), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "PingFang SC", "Helvetica Neue", "Inter", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ========== Sidebar ========== */
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-t);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-right: 1px solid #000;
  overflow: hidden;
  position: relative;
}
.sidebar::before {
  content: "";
  position: absolute;
  top: -80px; left: -80px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.22), transparent 70%);
  pointer-events: none;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 10px;
  position: relative;
}
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2a1850, #0a0420);
  display: grid; place-items: center;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 4px 12px rgba(124, 92, 255, 0.3);
}
.brand-logo img { width: 32px; height: 32px; object-fit: cover; }
.brand-text { line-height: 1.2; }
.brand-name { color: #fff; font-weight: 600; font-size: 14px; letter-spacing: 0.2px; }
.brand-sub { color: var(--sidebar-tm); font-size: 11px; margin-top: 2px; }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--sidebar-br);
  border-radius: 7px;
  padding: 6px 8px;
  margin: 0 4px;
}
.sidebar-search input {
  background: transparent; border: none; outline: none;
  color: #fff; flex: 1; font-size: 12px;
}
.sidebar-search input::placeholder { color: var(--sidebar-tm); }
.s-icon { color: var(--sidebar-tm); font-size: 13px; }
.s-kbd {
  font-size: 10px; color: var(--sidebar-tm);
  background: rgba(255,255,255,0.06);
  padding: 2px 5px; border-radius: 4px;
  font-family: "SF Mono", Menlo, monospace;
}

.sidebar-section {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 6px;
}
.sec-label {
  font-size: 10.5px;
  color: var(--sidebar-tm);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 10px 4px;
  font-weight: 500;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--sidebar-t);
  font-size: 12.5px;
  text-align: left;
  transition: background 0.1s;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active-soft { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item > span:nth-child(2) { flex: 1; }
.nav-item svg { color: var(--sidebar-tm); flex-shrink: 0; }
.nav-item.active svg, .nav-item.active-soft svg { color: var(--violet); }
.nav-count {
  font-size: 10.5px;
  color: var(--sidebar-tm);
  background: rgba(255,255,255,0.04);
  padding: 1px 6px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { background: rgba(124, 92, 255, 0.3); color: #fff; }
.nav-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  margin: 0 3px;
}

.sidebar-footer {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--sidebar-br);
  padding-top: 10px;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #4f2fdb);
  color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.user-meta { flex: 1; line-height: 1.2; overflow: hidden; }
.user-name { color: #fff; font-size: 12px; font-weight: 500; }
.user-email { color: var(--sidebar-tm); font-size: 10.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { color: var(--sidebar-tm); padding: 4px 6px; border-radius: 4px; }
.user-menu:hover { background: rgba(255,255,255,0.06); color: #fff; }

/* ========== Main ========== */
.main {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.main-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  height: 48px;
  flex-shrink: 0;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.crumb-soft { color: var(--text-mute); }
.crumb-sep { color: var(--text-mute); }
.crumb-cur { color: var(--text); font-weight: 500; }
.header-actions { display: flex; gap: 6px; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 12px;
  border: 1px solid var(--border);
  background: #fff;
  transition: all 0.1s;
}
.btn-ghost:hover { background: #f8fafc; color: var(--text); }
.btn-ghost.full { width: 100%; justify-content: center; padding: 8px; margin-top: 6px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  background: var(--violet);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: background 0.1s;
}
.btn-primary:hover { background: var(--violet-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.full { width: 100%; justify-content: center; padding: 9px; }
.btn-primary.sm { padding: 5px 12px; font-size: 12px; }

.page-body {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 40px;
}
.page-title-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px;
}
.page-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}
.page-sub { color: var(--text-mute); font-size: 12px; }
.view-tabs {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.view-tab {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-soft);
  border-radius: 5px;
}
.view-tab.active { background: var(--bg); color: var(--text); font-weight: 500; box-shadow: var(--shadow); }

/* ========== Stats ========== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stat-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.stat-label { font-size: 12px; color: var(--text-soft); font-weight: 500; }
.stat-delta {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.delta-up { color: #047857; background: #ecfdf5; }
.delta-down { color: #b91c1c; background: #fef2f2; }
.delta-flat { color: #b45309; background: #fefce8; }
.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
.stat-spark {
  position: absolute;
  bottom: 10px; right: 12px;
  width: 90px; height: 22px;
  opacity: 0.9;
}
.stat-violet { color: var(--violet); }
.stat-violet .stat-value { color: var(--text); }
.stat-blue { color: #3b82f6; }
.stat-blue .stat-value { color: var(--text); }
.stat-amber { color: #eab308; }
.stat-amber .stat-value { color: var(--text); }
.stat-green { color: #10b981; }
.stat-green .stat-value { color: var(--text); }

/* ========== Toolbar / Filters ========== */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.filters { display: flex; gap: 6px; }
.dropdown { position: relative; }
.dropdown select {
  appearance: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 24px 5px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.dropdown select:hover { border-color: #cbd5e1; }
.dd-caret { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 9px; color: var(--text-mute); pointer-events: none; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-mute);
}
.chip-filter:hover { color: var(--violet); border-color: var(--violet); }
.search-wrap {
  display: flex; align-items: center; gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  width: 260px;
}
.search-wrap .s-icon { color: var(--text-mute); }
.search-input {
  border: none; outline: none; background: transparent;
  flex: 1; font-size: 12px;
}

/* ========== Table ========== */
.table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.leads-table thead th {
  text-align: left;
  padding: 9px 12px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  color: var(--text-mute);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.leads-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.leads-table tbody tr:last-child td { border-bottom: none; }
.lead-row { cursor: pointer; transition: background 0.08s; }
.lead-row:hover { background: #fafbfc; }
.th-check, .td-check { width: 32px; padding-left: 16px !important; }
.th-act, .td-act { width: 36px; }

.cell-name { display: flex; align-items: center; gap: 10px; }
.avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.avatar-xs {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  color: #fff; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 600;
}
.n-primary { font-weight: 500; color: var(--text); }
.n-secondary { color: var(--text-mute); font-size: 11.5px; margin-top: 1px; }

.country-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-variant-numeric: tabular-nums;
}
.flag { font-size: 14px; line-height: 1; }
.product-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--violet-soft);
  color: #5c3ee3;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
}
.score-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 84px; }
.score-num { font-variant-numeric: tabular-nums; font-weight: 500; min-width: 20px; }
.score-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  max-width: 56px;
}
.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.2s ease;
}
.score-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.pill-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.owner-cell { display: flex; align-items: center; gap: 6px; color: var(--text-soft); }
.date-cell { color: var(--text-soft); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 4px; }
.date-today { color: #C2410C; font-weight: 600; }
.date-overdue { color: #DC2626; font-weight: 500; }
.date-icon { font-size: 11px; line-height: 1; }

/* ========== Bulk action bar ========== */
.bulkbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #f3f0ff, #ffffff);
  border: 1px solid #ddd1ff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(124,92,255,0.08);
  animation: bulkIn 0.18s ease;
}
@keyframes bulkIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.bulk-left { display: flex; align-items: center; gap: 10px; }
.bulk-count { font-size: 12.5px; color: var(--text); }
.bulk-count b { color: var(--violet); font-weight: 600; }
.bulk-link {
  font-size: 11.5px; color: var(--text-mute);
  padding: 2px 6px; border-radius: 4px;
}
.bulk-link:hover { color: var(--violet); background: #fff; }
.bulk-right { display: flex; gap: 6px; align-items: center; }
.bulk-select select {
  appearance: none;
  padding: 5px 24px 5px 10px;
  border: 1px solid var(--border);
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%2394a3b8' stroke-width='1.3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 8px center;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.btn-ghost.danger { color: #dc2626; }
.btn-ghost.danger:hover { background: #fef2f2; border-color: #fecaca; }

/* Row menu */
.menu-wrap { position: relative; display: inline-block; }
.row-menu {
  position: absolute;
  top: 100%; right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 160px;
  z-index: 10;
  animation: menuIn 0.12s ease;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.row-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  font-size: 12px;
  color: var(--text);
  border-radius: 4px;
}
.row-menu-item:hover { background: #f1f5f9; }
.row-menu-item.danger { color: #dc2626; }
.row-menu-item.danger:hover { background: #fef2f2; }
.rm-icon { font-size: 11px; color: var(--text-mute); width: 12px; display: inline-flex; justify-content: center; }
.row-menu-sep { height: 1px; background: var(--border-soft); margin: 4px 2px; }
.lead-row.is-checked { background: #faf8ff; }
.lead-row.is-checked:hover { background: #f3f0ff; }
.row-act {
  padding: 2px 6px; border-radius: 4px; color: var(--text-mute); font-size: 14px;
}
.row-act:hover { background: #f1f5f9; color: var(--text); }

.table-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
  background: #fafbfc;
  font-size: 11.5px;
  color: var(--text-mute);
}
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid var(--border); background: #fff;
  color: var(--text-soft);
}
.pg-cur {
  display: inline-block;
  min-width: 22px; text-align: center;
  padding: 2px 6px;
  background: var(--violet-soft);
  color: var(--violet);
  border-radius: 4px;
  font-weight: 500;
}
.empty { padding: 40px; text-align: center; color: var(--text-mute); }

/* ========== Drawer ========== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(2px);
  z-index: 50;
  animation: fadeIn 0.16s ease;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: calc(100vw - 248px - (100vw - 248px) * 0.5);
  width: 50%;
  max-width: 880px;
  min-width: 620px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 51;
  display: flex; flex-direction: column;
  animation: slideIn 0.22s ease;
  border-left: 1px solid var(--border);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: 48px;
}
.dh-left, .dh-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 5px;
  display: grid; place-items: center;
  color: var(--text-soft);
  transition: background 0.1s;
}
.icon-btn:hover { background: #f1f5f9; color: var(--text); }
.lead-id {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text-mute);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
}
.score-inline {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-soft);
  font-size: 11.5px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

.drawer-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 260px;
  overflow: hidden;
}
.drawer-left {
  overflow-y: auto;
  padding: 20px 24px 40px;
  border-right: 1px solid var(--border-soft);
}
.drawer-right {
  overflow-y: auto;
  padding: 20px 18px 40px;
  background: #fafbfc;
  display: flex; flex-direction: column; gap: 12px;
}

.lead-hero {
  display: flex; gap: 14px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 20px;
}
.hero-avatar {
  width: 52px; height: 52px; border-radius: 12px;
  background: linear-gradient(135deg, #7c5cff, #4f2fdb);
  color: #fff; display: grid; place-items: center;
  font-size: 22px; font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(124, 92, 255, 0.3);
}
.hero-name { font-size: 19px; margin: 0 0 4px; font-weight: 600; letter-spacing: -0.2px; }
.hero-sub { color: var(--text-soft); font-size: 12.5px; margin-bottom: 10px; }
.hero-sub .sep { margin: 0 6px; color: var(--text-mute); }
.hero-company { color: var(--text); font-weight: 500; }
.hero-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-chip {
  font-size: 11px;
  color: var(--text-soft);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
}

.block {
  margin-bottom: 22px;
}
.block-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: 0.2px;
  display: flex; align-items: center; gap: 8px;
}
.block-body {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.block.accent .block-body {
  background: linear-gradient(180deg, #faf8ff, #fff);
  border-color: #e8dfff;
}

.ai-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  background: var(--violet);
  color: #fff;
  border-radius: 3px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}
.kv { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv-label { font-size: 11px; color: var(--text-mute); }
.kv-value { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-link { color: var(--violet); }
.kv-link:hover { text-decoration: underline; }
.kv-mono {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--text-soft);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* AI */
.ai-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #e8dfff;
  margin-bottom: 14px;
}
.ai-score {
  text-align: center;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--violet), #4f2fdb);
  color: #fff;
  border-radius: 8px;
  flex-shrink: 0;
  min-width: 74px;
  box-shadow: 0 6px 16px rgba(124,92,255,0.3);
}
.ai-score-num { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; }
.ai-score-label { font-size: 10px; opacity: 0.85; margin-top: 4px; letter-spacing: 0.5px; }
.ai-score-bar {
  margin-top: 8px;
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  overflow: hidden;
}
.ai-score-bar-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
}
.priority-tag {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 8px;
  background: var(--violet);
  color: #fff;
  border-radius: 10px;
  margin-bottom: 6px;
  font-weight: 500;
}
.ai-summary {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
  margin: 4px 0 0;
  text-wrap: pretty;
}
.ai-sub-title {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.spark { color: var(--violet); }
.ai-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; flex-direction: column; gap: 7px;
}
.ai-list li {
  display: flex; gap: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
}
.ai-bullet {
  flex-shrink: 0;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 10.5px;
  font-weight: 600;
  display: grid; place-items: center;
  margin-top: 1px;
}
.ai-empty {
  text-align: center;
  padding: 26px 10px;
}
.ai-empty-icon {
  font-size: 22px;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.ai-empty-title { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.ai-empty-sub { font-size: 11.5px; color: var(--text-mute); margin-top: 4px; }
.btn-ai {
  margin-top: 12px;
  padding: 5px 14px;
  font-size: 11.5px;
  border-radius: 6px;
  background: var(--violet-soft);
  color: var(--violet);
  font-weight: 500;
}
.btn-ai:hover { background: #e7dfff; }

/* AI empty state with dashed frame */
.ai-empty-dashed {
  border: 1.5px dashed #ddd1ff;
  border-radius: 8px;
  padding: 22px 18px;
  text-align: center;
  background: #fafafe;
}
.ai-empty-dashed .ai-empty-icon {
  font-size: 20px;
  color: var(--violet);
  opacity: 0.5;
  margin-bottom: 8px;
}
.ai-empty-dashed .ai-empty-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.ai-empty-dashed .ai-empty-sub {
  font-size: 11.5px;
  color: var(--text-mute);
  line-height: 1.6;
  max-width: 360px;
  margin: 0 auto 14px;
  text-wrap: pretty;
}
.btn-ai-dashed {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px;
  border: 1.5px dashed var(--violet);
  background: #fff;
  color: var(--violet);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s;
}
.btn-ai-dashed:hover {
  background: var(--violet-soft);
  border-style: solid;
}

/* ========== New Lead Modal ========== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(3px);
  z-index: 100;
  animation: fadeIn 0.16s ease;
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  max-width: calc(100vw - 32px);
  max-height: 88vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 101;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal-title {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
}
.modal-sub {
  font-size: 11.5px;
  color: var(--text-mute);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 4px;
}
.form-section { margin-bottom: 18px; }
.form-section-label {
  font-size: 10.5px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
  margin-bottom: 10px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1 / -1; }
.field-label {
  font-size: 11.5px;
  color: var(--text-soft);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 3px;
}
.req-star { color: #EF4444; font-weight: 600; }
.form-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 12.5px;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.form-input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}
.form-input::placeholder { color: var(--text-mute); }
select.form-input { appearance: none; background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%2394a3b8' stroke-width='1.3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 10px center; padding-right: 26px; cursor: pointer; }

.modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  background: #fafbfc;
}
.modal-foot-hint { font-size: 11px; color: var(--text-mute); }
.modal-actions { display: flex; gap: 8px; }

/* ========== Responsive ========== */
@media (max-width: 860px) {
  .app { grid-template-columns: 0 1fr; }
  .sidebar { display: none; }
  .main-header { padding: 10px 14px; }
  .page-body { padding: 14px 12px 40px; }
  .page-title { font-size: 18px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 22px; }
  .stat-spark { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search-wrap { width: 100%; }
  .filters { flex-wrap: wrap; }
  .view-tabs { display: none; }
  .header-actions .btn-ghost { display: none; }

  /* Hide 产品意向 / 负责人 / 跟进日期 — keep 姓名/公司, 国家, 评分, 状态 */
  .leads-table .col-product,
  .leads-table .col-date,
  .leads-table .col-owner { display: none; }
  .leads-table thead th, .leads-table tbody td { padding: 10px 8px; }
  .score-bar { max-width: 40px; }
  .n-secondary { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .drawer { width: 100%; min-width: 0; max-width: none; }
  .drawer-body { grid-template-columns: 1fr; }
  .drawer-right { border-top: 1px solid var(--border); }
  .bulkbar { flex-direction: column; gap: 8px; align-items: stretch; }
  .bulk-right { flex-wrap: wrap; }
}


/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  top: 16px; bottom: 10px; left: 13px;
  width: 1px;
  background: var(--border);
}
.tl-item {
  display: flex; gap: 12px;
  padding: 10px 0;
  position: relative;
}
.tl-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 13px;
  flex-shrink: 0;
  z-index: 1;
}
.tl-body { flex: 1; }
.tl-meta {
  display: flex; gap: 8px; align-items: baseline;
  margin-bottom: 3px;
}
.tl-author { font-weight: 500; font-size: 12px; }
.tl-time { font-size: 10.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.tl-text { font-size: 12.5px; line-height: 1.55; color: var(--text-soft); text-wrap: pretty; }

/* Right action panel */
.action-group { display: flex; flex-direction: column; gap: 5px; }
.action-label { font-size: 11px; color: var(--text-mute); font-weight: 500; }
.action-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  appearance: auto;
}
.action-select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,92,255,0.15); }
.tag-stack { display: flex; gap: 4px; flex-wrap: wrap; }
.sm-tag {
  font-size: 11px;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-soft);
}
.sm-tag.add { border-style: dashed; color: var(--text-mute); }
.sm-tag.add:hover { color: var(--violet); border-color: var(--violet); }

.divider-label {
  margin-top: 12px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}
.note-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  resize: vertical;
  background: #fff;
  line-height: 1.5;
}
.note-input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,92,255,0.15); }
.note-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: -4px;
}
.note-tools { display: flex; gap: 2px; }
.note-tools button {
  width: 26px; height: 26px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-mute);
}
.note-tools button:hover { background: #eef1f5; color: var(--text); }
