/* TradeMail PWA Dashboard - Redesigned */
:root {
  --bg: #f8fafc;
  --surface: #fff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0ea5e9;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --sidebar-w: 300px;
  --detail-w: 380px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  line-height: 1.5;
}

/* ── Header ── */
.app-header {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 22px;
}

.app-header .spacer { flex: 1; }

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-header .status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
}

.app-header .status-text { font-size: 12px; color: var(--text-muted); }

.app-header .btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-header .btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

.app-header .btn-sync {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.app-header .btn-sync:hover { background: var(--primary-dark); }

.app-header .btn-settings {
  padding: 6px 10px;
  font-size: 16px;
}

/* ── Tab Navigation ── */
.tab-nav { display: flex; gap: 4px; padding: 0 8px; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}

.tab-btn:hover { background: var(--bg); color: var(--text); }

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.tab-icon { font-size: 14px; }

/* ── Dashboard Layout ── */
.dashboard {
  display: flex;
  height: calc(100% - 56px);
  overflow: hidden;
}

/* ── Tab Content ── */
.tab-content { display: none; }
.tab-content.active { display: flex; flex: 1; overflow: hidden; }

/* ═══════════════════════════════════════════════
   HOME TAB
   ═══════════════════════════════════════════════ */
.home-layout {
  display: flex;
  flex: 1;
  gap: 24px;
  padding: 24px;
  overflow: hidden;
}

.home-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
  min-width: 0;
}

.home-right {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

/* ── Quick Stats ── */
.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-urgent .stat-number { color: var(--danger); }
.stat-followup .stat-number { color: var(--warning); }
.stat-total .stat-number { color: var(--primary); }
.stat-emails .stat-number { color: var(--success); }

/* ── Home Sections ── */
.home-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}

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

.section-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.section-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* ── Task List ── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  border-left: 3px solid transparent;
}

.task-item:hover { background: var(--primary-light); }

.task-item.urgent { border-left-color: var(--danger); }
.task-item.followup { border-left-color: var(--warning); }
.task-item.info { border-left-color: var(--info); }

.task-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.task-body { flex: 1; min-width: 0; }

.task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.task-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.task-action {
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Activity List ── */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background .15s;
}

.activity-item:hover { background: var(--bg); }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-dot.sync { background: var(--success); }
.activity-dot.email { background: var(--info); }
.activity-dot.stage { background: var(--warning); }
.activity-dot.draft { background: var(--primary); }

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Pipeline Overview ── */
.pipeline-overview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipeline-mini-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pipeline-mini-stage {
  flex: 1;
  text-align: center;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: transform .15s;
}

.pipeline-mini-stage:hover { transform: scale(1.02); }

.pipeline-mini-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.pipeline-mini-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Quick Actions ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
}

.action-card:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.action-icon { font-size: 24px; }

.action-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Empty States ── */
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 32px; margin-bottom: 8px; }
.empty-text { font-size: 13px; }

/* ═══════════════════════════════════════════════
   COMPANIES TAB (3-Column)
   ═══════════════════════════════════════════════ */
.column {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.column-right { border-right: none; border-left: 1px solid var(--border); }
.column-left { width: var(--sidebar-w); min-width: 260px; }
.column-right { width: var(--detail-w); min-width: 320px; }
.column-main { flex: 1; min-width: 0; border-right: none; background: var(--bg); padding: 16px; overflow-y: auto; }

/* ── Column Header ── */
.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.col-header h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.col-header .count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ── Search ── */
.search-box {
  padding: 10px 12px;
  flex-shrink: 0;
}

.search-box input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}

.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* ── Sort ── */
.sort-row {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
  flex-shrink: 0;
}

.sort-btn {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  text-align: center;
  transition: all .15s;
}

.sort-btn:hover { border-color: var(--primary); color: var(--primary); }
.sort-btn.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ── Scroll Area ── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}

/* ── Customer Card ── */
.customer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  margin: 2px 0;
}

.customer-card:hover { background: var(--bg); }
.customer-card.selected { background: var(--primary-light); border-left: 3px solid var(--primary); padding-left: 9px; }

.customer-card .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff; flex-shrink: 0;
}

.customer-card .info { flex: 1; min-width: 0; }

.customer-card .name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.customer-card .email { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.customer-card .meta {
  display: flex; gap: 6px; font-size: 11px; color: var(--text-secondary);
  margin-top: 4px;
  align-items: center;
}

.customer-card .stars { font-size: 11px; flex-shrink: 0; }

/* ── Tags ── */
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag {
  display: inline-block;
  padding: 2px 6px; border-radius: 8px; font-size: 10px;
  background: var(--bg); color: var(--text-secondary);
}
.tag.active-tag { background: #f0fdf4; color: #16a34a; }
.tag.hot-tag { background: #fffbeb; color: #f59e0b; }
.tag.new-tag { background: #eff6ff; color: #2563eb; }
.tag.cold-tag { background: #f1f5f9; color: #94a3b8; }

/* ── Pipeline ── */
.pipeline-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pipeline-stage {
  flex: 1 1 0;
  min-width: 80px;
  text-align: center;
  padding: 16px 8px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  color: var(--text-muted);
  transition: transform .15s;
}

.pipeline-stage:hover { transform: scale(1.02); }
.pipeline-stage.has-count { color: #fff; }
.pipeline-stage .stage-num { font-size: 24px; font-weight: 700; }
.pipeline-stage .stage-name { font-size: 11px; margin-top: 4px; font-weight: 500; }
.pipeline-arrow { display: flex; align-items: center; color: #cbd5e1; flex-shrink: 0; font-size: 14px; }

/* ── Panel Card ── */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
}

.panel h4 {
  font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

/* ── Todo Items ── */
.todo-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; background: var(--bg);
  border-radius: var(--radius-sm); margin-bottom: 6px;
}

.todo-bullet {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--primary); margin-top: 2px; flex-shrink: 0;
}

.todo-bullet.urgent { border-color: var(--danger); }

.todo-body { flex: 1; min-width: 0; }
.todo-text { font-size: 12px; color: var(--text); line-height: 1.5; }
.todo-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.todo-meta .urgent-label { color: var(--danger); font-weight: 600; }

/* ── Detail Panel ── */
.customer-detail { padding: 12px; }

.detail-header {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

.detail-header .avatar { width: 44px; height: 44px; font-size: 18px; }
.detail-header h3 { font-size: 16px; color: var(--text); }
.detail-header .email { font-size: 12px; color: var(--text-muted); }

.detail-stats {
  display: flex; gap: 8px; padding: 12px 0;
}

.stat-box {
  flex: 1; text-align: center;
  padding: 10px; background: var(--bg);
  border-radius: var(--radius-sm);
}

.stat-box .val { font-size: 18px; font-weight: 700; color: var(--primary); }
.stat-box .lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Email Timeline ── */
.email-row {
  padding: 8px 12px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
  font-size: 12px;
  cursor: pointer;
}

.email-row:hover { border-left-color: var(--primary); background: var(--bg); }
.email-row .subj { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.email-row .meta-row { color: var(--text-muted); font-size: 11px; }

/* ── Settings ── */
.settings-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.settings-overlay.show { display: flex; }

.settings-panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 460px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.settings-panel h3 { margin-bottom: 20px; font-size: 18px; }

.settings-panel label {
  display: block; font-size: 12px; color: var(--text-secondary);
  margin-bottom: 6px; margin-top: 14px; font-weight: 500;
}

.settings-panel input, .settings-panel select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px;
  transition: border-color .15s;
}

.settings-panel input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.settings-panel .btn-row {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 10px 24px; border-radius: 24px;
  background: #0f172a; color: #fff; font-size: 13px;
  z-index: 200; opacity: 0; transition: opacity .2s;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; }

/* ── Data Table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 12px; background: var(--bg); border-bottom: 2px solid var(--border); color: var(--text-secondary); font-weight: 600; position: sticky; top: 0; z-index: 1; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tr:hover td { background: rgba(37,99,235,.03); }
.table-wrap { overflow-y: auto; max-height: calc(100vh - 180px); border: 1px solid var(--border); border-radius: var(--radius); }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 300;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.show { display: flex; }

.modal-panel {
  background: var(--surface);
  border-radius: 16px;
  width: 540px;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}

.modal-header h3 { margin: 0; font-size: 18px; }

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

.modal-body label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

.modal-body input, .modal-body select, .modal-body textarea {
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
}

.modal-body textarea { resize: vertical; min-height: 70px; }

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

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-buyer { background: #eff6ff; color: #2563eb; }
.badge-supplier { background: #fffbeb; color: #f59e0b; }
.badge-high { background: #f0fdf4; color: #16a34a; }
.badge-medium { background: #fffbeb; color: #f59e0b; }
.badge-low { background: #f1f5f9; color: #94a3b8; }

/* ── Tag Row ── */
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-item { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }

/* ── Panel Toolbar ── */
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-toolbar h4 { margin: 0; }

/* ── Additional Tag Colors ── */
.tag.problem { background: #fef2f2; color: #dc2626; }
.tag.vip { background: #fdf2f8; color: #db2777; }
.tag.loyal { background: #f0fdf4; color: #16a34a; }

/* ── Follow-up Area ── */
.followup-area {
  padding: 0 12px 6px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.followup-area.collapsed .followup-list,
.followup-area.collapsed .followup-toggle { display: none; }

.followup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
}

.followup-toggle { font-size: 10px; color: var(--text-muted); }
.followup-list { max-height: 160px; overflow-y: auto; }

.followup-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  border-left: 3px solid var(--warning);
  background: #fffbeb;
  transition: background .15s;
}

.followup-item:hover { background: #fef3c7; }

.followup-item.overdue {
  border-left-color: var(--danger);
  background: #fef2f2;
}

.followup-item .fw-name { font-weight: 600; color: var(--text); flex: 1; }
.followup-item .fw-days { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.followup-item .fw-desc { font-size: 11px; color: var(--text-secondary); }

/* ── Customer Card Overdue ── */
.customer-card.overdue {
  border-left: 3px solid var(--warning);
  background: #fffbeb;
}

.customer-card.overdue.selected {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
}

/* ── Editable Fields ── */
.editable-field { margin-bottom: 10px; }

.editable-field label {
  display: block; font-size: 11px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 4px;
}

.editable-field input,
.editable-field textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px;
  font-family: inherit; outline: none;
}

.editable-field input:focus,
.editable-field textarea:focus { border-color: var(--primary); }

.editable-field textarea { resize: vertical; min-height: 60px; }

/* ── Review Panel ── */
.review-panel .review-header {
  cursor: pointer;
  user-select: none;
}

.review-panel.collapsed .review-body { display: none; }
.review-body { font-size: 12px; color: var(--text-secondary); line-height: 1.8; }

.review-body .review-stat {
  display: flex; justify-content: space-between; padding: 4px 0;
}

.review-body .review-stat .rv-label { color: var(--text-muted); }
.review-body .review-stat .rv-val { font-weight: 600; color: var(--text); }

.review-body .review-stage-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
}

.review-body .review-stage-tag {
  padding: 3px 10px; border-radius: 10px; font-size: 11px;
  background: var(--bg); color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
   PIPELINE KANBAN
   ═══════════════════════════════════════════════ */
.kanban-board {
  display: flex;
  gap: 12px;
  height: 100%;
  padding: 16px;
  overflow-x: auto;
  background: var(--bg);
  border-radius: var(--radius);
}

.kanban-column {
  flex: 1 1 0;
  min-width: 180px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.kanban-column-header {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-header .col-count {
  background: rgba(255,255,255,0.3);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.kanban-column-body.drag-over {
  background: rgba(37,99,235,.03);
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
  border-radius: 4px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: box-shadow .15s, transform .15s;
  user-select: none;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.kanban-card .kc-name {
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px;
}

.kanban-card .kc-contact {
  font-size: 12px; color: var(--text-secondary); margin-bottom: 6px;
}

.kanban-card .kc-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--text-muted); margin-top: 6px;
}

.kanban-card .kc-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
}

/* ═══════════════════════════════════════════════
   TIMELINE
   ═══════════════════════════════════════════════ */
.timeline {
  position: relative;
  padding: 8px 0 8px 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
}

.timeline-item.type-email::before { border-color: var(--info); background: var(--info); }
.timeline-item.type-stage::before { border-color: var(--warning); background: var(--warning); }
.timeline-item.type-note::before { border-color: var(--success); background: var(--success); }
.timeline-item.type-task::before { border-color: var(--danger); background: var(--danger); }
.timeline-item.type-followup::before { border-color: var(--primary); background: var(--primary); }

.timeline-item .tl-time {
  font-size: 11px; color: var(--text-muted); margin-bottom: 4px;
}

.timeline-item .tl-title {
  font-weight: 600; color: var(--text); margin-bottom: 2px;
}

.timeline-item .tl-detail { color: var(--text-secondary); }

.timeline-item .tl-badge {
  display: inline-block; padding: 1px 6px;
  border-radius: 6px; font-size: 10px; margin-right: 4px; font-weight: 500;
}

/* ── Company Contact Row ── */
.company-contact-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; transition: background .15s;
}

.company-contact-row:hover { background: var(--bg); }

/* ── Drafts ── */
.drafts-layout {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

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

.drafts-header h3 { font-size: 18px; font-weight: 600; }

.drafts-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.draft-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: box-shadow .15s;
}

.draft-card:hover { box-shadow: var(--shadow-md); }

.draft-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px;
}

.draft-recipient { font-weight: 600; color: var(--text); }

.draft-subject { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }

.draft-body-preview {
  font-size: 13px; color: var(--text); line-height: 1.6;
  max-height: 120px; overflow: hidden; position: relative;
  margin-bottom: 14px; white-space: pre-wrap;
}

.draft-body-preview::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 40px; background: linear-gradient(transparent, var(--surface));
}

.draft-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

.draft-actions { display: flex; gap: 10px; }

.draft-actions .btn-approve {
  background: var(--success); color: #fff; border: none;
  padding: 8px 20px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 500;
}

.draft-actions .btn-approve:hover { background: #15803d; }

.draft-actions .btn-reject {
  background: var(--surface); color: var(--danger);
  border: 1px solid var(--danger);
  padding: 8px 20px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 500;
}

.draft-actions .btn-reject:hover { background: #fef2f2; }

.draft-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 14px;
}

/* ── Inbox Review ── */
.btn-review {
  background: var(--primary); color: #fff; border: none;
  padding: 10px 24px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background .15s;
}

.btn-review:hover { background: var(--primary-dark); }
.btn-review:disabled { opacity: 0.6; cursor: not-allowed; }

.inbox-review-status { font-size: 13px; color: var(--text-secondary); }

/* ── Rules ── */
.rules-layout {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

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

.rules-header h3 { font-size: 18px; font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .home-right { width: 300px; }
}

@media (max-width: 900px) {
  .home-layout { flex-direction: column; }
  .home-right { width: 100%; }
  .column-left, .column-right { width: 100%; min-width: 0; }
  .dashboard { flex-direction: column; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════
   ONBOARDING
   ═══════════════════════════════════════════════ */
.onboarding-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.onboarding-overlay.show { display: flex; }

.onboarding-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px;
  width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
  text-align: center;
}

.onboarding-logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
}

.onboarding-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.onboarding-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.onboarding-step {
  display: none;
  text-align: left;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: all .2s;
}

.onboarding-step.active {
  display: block;
  border-color: var(--primary);
  background: var(--primary-light);
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.onboarding-step h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.onboarding-step p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onboarding-form input,
.onboarding-form select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color .15s;
}

.onboarding-form input:focus,
.onboarding-form select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.onboarding-sync-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Role Compare Cards (Onboarding Step 1) ── */
.role-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.role-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
}
.role-card:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-light); }
.role-card.selected { border-color: var(--primary) !important; background: var(--primary-light); }
.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.role-badge-seller {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
  text-transform: uppercase;
}
.role-badge-buyer {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fef3c7;
  color: #b45309;
  text-transform: uppercase;
}
.role-icon-big { font-size: 28px; }
.role-card h4 { margin: 0 0 4px 0; font-size: 14px; color: var(--text); }
.role-desc { font-size: 11px; color: var(--text-muted); margin: 0 0 8px 0; }
.role-features {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.role-features li { padding: 1px 0; }

.role-both-row {
  text-align: center;
}
.role-both-toggle {
  display: inline-block;
  padding: 8px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.role-both-toggle:hover { border-color: var(--primary); }
.role-both-toggle.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.sync-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.onboarding-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-item {
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.btn-lg {
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

/* ── Region Tips ── */
.region-tips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.region-tip-item {
  padding: 10px 12px;
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.btn-text:hover { color: var(--text); }

/* ═══════════════════════════════════════════════
   INBOX TAB — Email List + Detail + Quick Reply
   ═══════════════════════════════════════════════ */
.inbox-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left: Email list */
.inbox-left {
  width: 340px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.inbox-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.inbox-toolbar input {
  flex: 1;
  min-width: 100px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
}

.inbox-toolbar input:focus { border-color: var(--primary); }

.inbox-toolbar select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  background: var(--surface);
  color: var(--text-secondary);
}

.inbox-toolbar .btn-refresh {
  padding: 6px 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.inbox-toolbar .btn-refresh:hover { background: var(--primary-dark); }

.inbox-count {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Email list scroll */
.email-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Email item */
.email-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}

.email-item:hover { background: var(--bg); }

.email-item.selected {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding-left: 9px;
}

.email-item.unread { border-left: 3px solid var(--primary); }
.email-item.unread.selected { padding-left: 9px; }

.email-checkbox {
  margin-top: 3px;
  flex-shrink: 0;
  cursor: pointer;
}

.email-star {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #d1d5db;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
}

.email-star.starred { color: #f59e0b; }

.email-content { flex: 1; min-width: 0; }

.email-subject {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.email-item.read .email-subject { font-weight: 400; color: var(--text-secondary); }

.email-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.email-from { color: var(--primary); font-weight: 500; }

.email-preview {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Email categories */
.email-category {
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.cat-inquiry { background: #2563eb; }
.cat-quotation { background: #ea580c; }
.cat-order { background: #16a34a; }
.cat-sample { background: #7c3aed; }
.cat-payment { background: #db2777; }
.cat-logistics { background: #0891b2; }
.cat-complaint { background: #dc2626; }
.cat-other { background: #94a3b8; }

/* Batch action bar */
.batch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--primary-light);
  border-top: 1px solid var(--primary);
  flex-shrink: 0;
}

.batch-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  flex: 1;
}

.batch-btn {
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.batch-btn.ai { background: var(--primary); color: #fff; }
.batch-btn.send { background: var(--success); color: #fff; }
.batch-btn.followup { background: var(--warning); color: #fff; }
.batch-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Right: Email detail + quick reply */
.inbox-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.inbox-right .empty-state {
  margin: auto;
}

/* Email detail view */
.email-detail {
  flex: 0 0 auto;
  max-height: 45%;
  overflow-y: auto;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.email-detail h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.detail-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Related emails */
.related-emails {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

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

.related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: all .15s;
}

.related-item:hover { background: var(--primary-light); }

.related-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.related-subject {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.related-date {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Quick reply area */
.quick-reply {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  padding: 12px 20px;
  min-height: 200px;
}

.quick-reply-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  flex-shrink: 0;
}

/* Template capsules */
.quick-capsules {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.quick-capsule {
  padding: 5px 14px;
  border: none;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}

.quick-capsule:hover { opacity: 0.85; }

.capsule-inquiry  { background: #2563eb; }
.capsule-quote    { background: #16a34a; }
.capsule-followup { background: #f59e0b; }
.capsule-payment  { background: #db2777; }
.capsule-thanks   { background: #7c3aed; }

/* Quick reply editor */
.quick-reply-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-reply-editor textarea {
  flex: 1;
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}

.quick-reply-editor textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.quick-reply-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-copy {
  padding: 8px 20px;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.btn-copy:hover { background: var(--border); }

.btn-ai-draft {
  padding: 8px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.btn-ai-draft:hover { opacity: 0.9; }

.quick-reply-status {
  font-size: 11px;
  color: var(--text-muted);
  min-height: 16px;
}

/* ═══════════════════════════════════════════════
   PRODUCTS / ORDERS / LOGISTICS TABS
   ═══════════════════════════════════════════════ */
.products-layout,
.orders-layout,
.logistics-layout {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

.products-layout .panel-toolbar,
.orders-layout .panel-toolbar,
.logistics-layout .panel-toolbar {
  margin-bottom: 16px;
}

.products-layout .panel-toolbar h4,
.orders-layout .panel-toolbar h4,
.logistics-layout .panel-toolbar h4 {
  margin: 0;
  font-size: 16px;
}

.products-layout .panel-toolbar input,
.orders-layout .panel-toolbar input,
.logistics-layout .panel-toolbar input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  width: 200px;
  outline: none;
}

.products-layout .panel-toolbar input:focus,
.orders-layout .panel-toolbar input:focus,
.logistics-layout .panel-toolbar input:focus {
  border-color: var(--primary);
}

/* Stage badge for orders/logistics */
.stage-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.stage-new { background: #e6f7ff; color: #1890ff; }
.stage-negotiating { background: #fff7e6; color: #fa8c16; }
.stage-confirmed { background: #f6ffed; color: #52c41a; }
.stage-shipped { background: #f0f5ff; color: #2f54eb; }
.stage-delivered { background: #e6fffb; color: #13c2c2; }
.stage-cancelled { background: #fff1f0; color: #ff4d4f; }
.stage-pending { background: #fffbe6; color: #faad14; }

/* ============================================================
 *  Leads Tab (黄页库)
 * ============================================================ */
.leads-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.leads-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  gap: 16px;
  flex-wrap: wrap;
}

.leads-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.leads-filter-row input,
.leads-filter-row select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.leads-filter-row input { width: 240px; }
.leads-filter-row select { min-width: 120px; }
.leads-filter-row input:focus,
.leads-filter-row select:focus { border-color: var(--primary); }

.leads-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.leads-actions {
  display: flex;
  gap: 8px;
}

.leads-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lead-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: box-shadow .15s, border-color .15s;
  gap: 12px;
}

.lead-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.lead-card-main {
  flex: 1;
  min-width: 0;
}

.lead-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.lead-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.lead-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
}

.lead-tag-country { background: #e6f7ff; color: #1890ff; }
.lead-tag-industry { background: #f6ffed; color: #52c41a; }
.lead-tag-source { background: #fff7e6; color: #fa8c16; }

.lead-contact {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.lead-email { color: var(--primary); }
.lead-website { color: var(--text-muted); text-decoration: none; }
.lead-website:hover { text-decoration: underline; }

.lead-card-actions {
  flex-shrink: 0;
}

/* ============================================================
 *  Compose Modal (写开发信 / 回复编辑器)
 * ============================================================ */
.compose-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 2000;
  justify-content: center;
  align-items: flex-start;
  padding-top: 5vh;
}

.compose-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 720px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.compose-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.compose-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compose-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.compose-field input,
.compose-field select,
.compose-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.compose-field input:focus,
.compose-field select:focus,
.compose-field textarea:focus {
  border-color: var(--primary);
}

.compose-field textarea {
  resize: vertical;
  min-height: 180px;
}

.compose-ai-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.compose-ai-row select,
.compose-ai-row input {
  width: auto;
  min-width: 100px;
}

.compose-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.compose-char-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
}
