/* ============================================
   HiToc 海外AI智能拓客平台 — 全局样式
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f5;
  --bg-input: #f8f9fb;
  --border: #e2e8f0;
  --border-focus: #6366f1;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-dim: rgba(99, 102, 241, 0.08);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.08);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.08);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.08);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: width 0.2s ease;
}

.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.sidebar-logo .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 0 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--accent-dim);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.main-content {
  flex: 1;
  margin-left: 220px;
  padding: 24px 32px;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

/* ===== Trial notice banner ===== */
.trial-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 1px 2px rgba(154, 52, 18, 0.08);
}
.trial-notice-inline {
  width: 400px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
}
.trial-notice-fixed {
  position: fixed;
  top: 0;
  left: 220px;
  right: 0;
  z-index: 180;
  border-width: 0 0 1px;
}
body.trial-active .main-content { padding-top: 64px; }
body.trial-active .impersonate-banner { top: 36px; }
body.trial-active.impersonate-active {
  padding-top: 0;
}
body.trial-active.impersonate-active .main-content { padding-top: 108px; }
html.sidebar-collapsed .trial-notice-fixed { left: 60px; }

/* ===== Impersonate sticky banner ===== */
body.impersonate-active { padding-top: 44px; }
.impersonate-banner {
  position: fixed;
  top: 0;
  left: 220px;        /* 让出 sidebar 宽度 */
  right: 0;
  height: 44px;
  z-index: 200;       /* 高于 sidebar (100) */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--red-dim);
  border-bottom: 1px solid var(--red);
  color: var(--red);
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.08);
}
html.sidebar-collapsed .impersonate-banner { left: 60px; }
.impersonate-banner .imp-icon { font-size: 16px; line-height: 1; }
.impersonate-banner .imp-actor {
  font-weight: 700;
  color: var(--red);
}
.impersonate-banner .imp-real {
  font-size: 12px;
  color: var(--text-muted);
}
.impersonate-banner .imp-spacer { flex: 1; }
.impersonate-banner .imp-exit-btn {
  padding: 4px 12px;
  border: 1px solid var(--red);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.impersonate-banner .imp-exit-btn:hover {
  background: var(--red);
  color: #fff;
}
@media (max-width: 768px) {
  .impersonate-banner { left: 60px; padding: 0 12px; gap: 8px; }
  .impersonate-banner .imp-real { display: none; }
}

/* ===== Sidebar collapse toggle ===== */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 8px 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: var(--accent-dim); color: var(--text-primary); }
.sidebar-toggle .toggle-arrow { font-size: 11px; line-height: 1; }

/* 折叠态：整站加 html.sidebar-collapsed 类，覆盖默认布局 */
html.sidebar-collapsed .sidebar { width: 60px; }
html.sidebar-collapsed .sidebar .nav-text,
html.sidebar-collapsed .sidebar-logo .subtitle,
html.sidebar-collapsed .sidebar-footer,
html.sidebar-collapsed .sidebar-toggle .toggle-label { display: none; }
html.sidebar-collapsed .sidebar-logo { padding: 0 12px 20px; }
html.sidebar-collapsed .sidebar-logo h1 { font-size: 14px; text-align: center; }
html.sidebar-collapsed .nav-item { padding: 10px 0; justify-content: center; gap: 0; }
html.sidebar-collapsed .nav-item .icon { margin: 0; }
html.sidebar-collapsed .sidebar-toggle { margin: 0 8px 12px; padding: 8px 0; }
html.sidebar-collapsed .main-content { margin-left: 60px; }

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header .desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  border-color: #6366f1;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.2);
}

/* ===== Status Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-new { background: var(--blue-dim); color: var(--blue); }
.badge-contacted { background: var(--yellow-dim); color: var(--yellow); }
.badge-replied { background: var(--green-dim); color: var(--green); }
.badge-negotiating { background: var(--accent-dim); color: var(--accent); }
.badge-ordered { background: var(--green-dim); color: var(--green); }
.badge-lost { background: var(--red-dim); color: var(--red); }

/* ===== Email Output ===== */
.email-output {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-sans);
  color: var(--text-primary);
  max-height: 500px;
  overflow-y: auto;
}

/* Contenteditable state: subtle hover + clear focus state, no default outline */
.email-output[contenteditable="true"] {
  cursor: text;
  transition: border-color 0.12s, background 0.12s;
}
.email-output[contenteditable="true"]:hover {
  border-color: var(--accent);
}
.email-output[contenteditable="true"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-panel, #fff);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.email-output .subject-line {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===== Customer Table ===== */
.customer-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.customer-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.customer-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.customer-table tr:hover td {
  background: var(--bg-card-hover);
}

.customer-name {
  font-weight: 600;
  color: var(--text-primary);
}

.customer-email {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ===== Analysis Result ===== */
.analysis-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.analysis-item {
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.analysis-item .label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analysis-item .value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== Loading ===== */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow);
}

.toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #10b981; }
.toast-error { background: #fef2f2; color: #7f1d1d; border: 1px solid #ef4444; }
.toast-info { background: #eff6ff; color: #1e3a5f; border: 1px solid #3b82f6; }

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.batch-send-modal {
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.batch-send-modal .modal-body {
  flex: 1;
  overflow-y: auto;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state .title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state .desc {
  font-size: 13px;
  line-height: 1.6;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-text, .sidebar-logo .subtitle, .sidebar-footer,
  .sidebar-toggle .toggle-label { display: none; }
  .sidebar-logo h1 { font-size: 14px; }
  .nav-item { padding: 10px 0; justify-content: center; gap: 0; }
  .sidebar-toggle { padding: 8px 0; }
  .main-content { margin-left: 60px; padding: 16px; }
  .form-row, .form-row-3, .stats-grid, .analysis-result { grid-template-columns: 1fr; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Tab ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  width: fit-content;
}

.tab-item {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-sans);
  transition: all 0.15s;
}

.tab-item:hover { color: var(--text-primary); }
.tab-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-spacer { flex: 1; }

/* ===== Copy Button ===== */
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* ===== Search Step Bar ===== */
.search-steps {
  margin: 16px 0;
}

.step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}

.step-item.active .step-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.step-item.active {
  color: var(--accent);
  font-weight: 600;
}

.step-item.done .step-dot {
  background: var(--green);
}

.step-item.done {
  color: var(--green);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
  min-width: 20px;
}

/* ===== Search Progress (per-domain detail) ===== */
.search-progress {
  margin: 12px 0 16px;
  padding: 14px 16px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
}
.search-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.search-progress-header .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.search-progress-header .stats {
  font-size: 12px;
  color: var(--text-muted);
}
.search-progress-header .percent {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent, #6366f1);
}
.search-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-input, #f3f4f6);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.search-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #3b82f6 100%);
  border-radius: 999px;
  transition: width .3s ease;
  width: 0%;
}
.search-task-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}
.search-task-list-header {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.search-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  background: transparent;
}
.search-task-item.in-progress {
  color: var(--text-primary);
}
.search-task-item.done {
  color: var(--text-muted);
  opacity: 0.7;
}
.search-task-item .task-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.search-task-item .task-domain {
  font-weight: 500;
  flex-shrink: 0;
  min-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-task-item .task-status {
  color: var(--text-muted);
  font-size: 11px;
}
.search-task-item.in-progress .task-status {
  color: var(--accent, #6366f1);
}

/* ===== Prospect Cards ===== */
.prospect-card {
  transition: border-color 0.15s;
}

.prospect-card:hover {
  border-color: var(--accent);
}

.prospect-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}

.prospect-info { flex: 1; }

.prospect-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prospect-research,
.prospect-research-block {
  margin: 8px 0 10px;
  padding: 10px 12px;
  background: var(--bg-input, #f8f9fd);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
}
.research-block-header {
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 6px;
}
.research-summary {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 12.5px;
  line-height: 1.6;
}
.research-chips {
  margin-bottom: 6px;
}
.prospect-research .research-chip,
.prospect-research-block .research-chip {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 4px;
  margin-bottom: 4px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.prospect-research .research-line,
.prospect-research-block .research-line {
  color: var(--text-secondary);
}
.prospect-research .research-label,
.prospect-research-block .research-label {
  display: inline-block;
  min-width: 60px;
  color: var(--text-muted);
  font-size: 11px;
}

.prospect-seq {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.prospect-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.prospect-title-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.prospect-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ====== Clearable input (✕ button inside) ====== */
.input-clearable {
  position: relative;
  display: flex;
  align-items: center;
}
.input-clearable .form-input,
.input-clearable .search-input-lg {
  padding-right: 40px;
}
.input-clearable .input-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: var(--text-muted, #9ca3af);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.input-clearable .input-clear:hover {
  background: var(--red, #dc2626);
}

/* ====== Searchable country combobox ====== */
.country-combo {
  position: relative;
  width: 100%;
}
.country-combo .combo-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-input, #f8f9fd);
  line-height: 1.4;
}
.country-combo .combo-display {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.country-combo .combo-caret {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}
.country-combo .combo-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-panel, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 420px;
  flex-direction: column;
  overflow: hidden;
}
.country-combo .combo-panel.open {
  display: flex;
}
.country-combo .combo-search {
  margin: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  outline: none;
}
.country-combo .combo-search:focus {
  border-color: var(--accent);
}
.country-combo .combo-list {
  overflow-y: auto;
  flex: 1;
  border-top: 1px solid var(--border);
}
.country-combo .combo-group {
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-input, #f8f9fd);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
.country-combo .combo-option {
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}
.country-combo .combo-option.highlighted {
  background: var(--accent);
  color: white;
}
.country-combo .combo-option.selected {
  font-weight: 600;
}
.country-combo .combo-option.selected:not(.highlighted) {
  background: var(--bg-input, #f8f9fd);
}

.prospect-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
}

.prospect-link:hover { text-decoration: underline; }

.prospect-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 10px;
}

/* Match Score */
.match-score {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.score-num {
  font-size: 18px;
  font-weight: 800;
}

.score-reason {
  color: var(--text-secondary);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-score.score-high {
  background: var(--green-dim);
  color: var(--green);
}

.match-score.score-mid {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.match-score.score-low {
  background: var(--red-dim);
  color: var(--red);
}

/* Prospect Emails — flow inline, wrap as needed */
.prospect-emails {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin: 8px 0 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.prospect-email {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.prospect-email.in-crm { opacity: 0.6; }

.email-addr {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 500;
}

.email-name {
  color: var(--text-secondary);
}

.email-pos {
  color: var(--text-muted);
  font-style: italic;
}

/* Draft Tabs & Content */
.draft-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.draft-content {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.draft-subject {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.draft-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.draft-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ===== Dashboard Funnel ===== */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.funnel-label {
  width: 90px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.funnel-bar-bg {
  flex: 1;
  height: 24px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.funnel-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.5s ease;
  min-width: 0;
}

.funnel-count {
  width: 36px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  flex-shrink: 0;
}

/* ===== Follow-up List ===== */
.followup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.followup-item:last-child { border-bottom: none; }

.followup-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.followup-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.followup-days {
  font-size: 12px;
  color: var(--red);
  font-weight: 500;
}

/* ===== Search Panel ===== */
.search-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 32px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.search-panel-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.search-field-product {
  width: 100%;
}
.search-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.search-input-lg {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.search-input-lg:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.10);
  background: var(--bg-card);
}
.search-input-lg::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}
.search-filters-row {
  display: flex;
  gap: 24px;
  align-items: stretch;
}
.search-filter-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.search-filter-col-region {
  flex: 1;
}
.search-filter-col-num {
  flex: 0 0 100px;
}
.search-filter-col-num .form-select {
  height: 38px;
  padding-top: 0;
  padding-bottom: 0;
}

/* 目标地区：快捷按钮 + 下拉框同一行 */
.region-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.size-checkboxes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}
.region-inline .region-quick-btns {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  margin-bottom: 0;
}
.region-inline .region-combo-wrap {
  flex: 0 0 160px;
}
.region-inline .region-combo-wrap .country-combo .combo-button {
  padding: 7px 12px;
  font-size: 13px;
  height: 38px;
  box-sizing: border-box;
}
.region-inline .region-tags {
  width: 100%;
}
.region-inline .region-tags:empty {
  display: none;
}

.search-panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.btn-search-go {
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  gap: 6px;
}
.btn-search-go .btn-search-icon {
  font-size: 16px;
}
.btn-search-reset {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.btn-search-reset:hover {
  color: var(--text-primary);
}
.search-status-text {
  font-size: 12px;
  color: var(--text-muted);
}

.chip-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 14px;
  height: 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  background: var(--bg-primary);
  color: var(--text-secondary);
}
.chip-check:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-dim);
}
.chip-check input { display: none; }
.chip-check:has(input:checked) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
}

/* Chip tag (multi-select region tags) */
.chip-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(99,102,241,0.15);
  color: var(--accent);
  font-weight: 500;
}
.chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--accent);
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.chip-remove:hover { opacity: 1; color: var(--red, #dc2626); }

/* Region quick-select buttons */
.region-quick-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.region-quick-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  height: 38px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.region-quick-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.region-quick-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.region-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

@media (max-width: 768px) {
  .search-filters-row {
    flex-direction: column;
    gap: 16px;
  }
  .search-filter-col-num {
    flex: 0 0 auto;
  }
  .region-inline .region-quick-btns {
    flex-wrap: wrap;
  }
  .search-panel {
    padding: 20px 16px 16px;
  }
}

/* Search result filter bar */
.search-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 10px;
  font-size: 12px;
  flex-wrap: wrap;
}
.search-filter-bar label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* Supplier warning badge */
.badge-supplier {
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}
.badge-region-mismatch {
  background: #fee2e2;
  color: #991b1b;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}
/* Email type badges */
.badge-email-personal {
  background: #d1fae5;
  color: #065f46;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
}
.badge-email-generic {
  background: #f3f4f6;
  color: #6b7280;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
}
