/* ===== CRM 客户记录 ===== */

.crm-page {
  padding: 18px 20px 32px;
}

/* 顶部标题栏 */
.crm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.crm-title-en {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.crm-title-zh {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
}

.crm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 指标卡 */
.crm-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.crm-metric-card {
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
}

.crm-metric-label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.crm-metric-label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.crm-metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 6px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.crm-metric-foot {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 4px;
}

/* 筛选栏 */
.crm-filter-wrap {
  margin-bottom: 14px;
}

.crm-filters {
  display: grid;
  grid-template-columns: 1.8fr 160px 160px auto;
  align-items: center;
  gap: 12px;
}

.crm-filter-search {
  position: relative;
}

.crm-filter-search .crm-filter-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.7;
}

.crm-filter-search input {
  padding-left: 32px;
}

.crm-filter-amount {
  position: relative;
}

.crm-amount-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 100;
}

.crm-amount-pop label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* 表格 */
.crm-table-wrap {
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.crm-table {
  font-size: 13px;
}

.crm-table th {
  background: var(--bg-soft);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.crm-table td {
  vertical-align: middle;
  color: var(--ink-soft);
}

.crm-table tbody tr {
  cursor: pointer;
}

.crm-table tbody tr:hover td {
  background: rgba(255,255,255,0.03);
}

.crm-customer .crm-company {
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}

.crm-customer .crm-contact {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-country {
  background: var(--tag-bg);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.crm-amount {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* 优先级 */
.crm-priority-urgent {
  background: rgba(0, 221, 136, 0.15);
  color: var(--brand);
}

.crm-priority-today {
  background: rgba(92, 180, 255, 0.15);
  color: #5cb4ff;
}

.crm-priority-normal {
  background: var(--tag-bg);
  color: var(--muted);
}

.crm-priority-overdue {
  background: rgba(255, 90, 90, 0.15);
  color: #ff5a5a;
}

/* 概率条 */
.crm-prob {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 70px;
}

.crm-prob-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.crm-prob-bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.crm-prob-fill {
  height: 100%;
  border-radius: 2px;
}

.crm-prob-fill.ok { background: var(--ok); }
.crm-prob-fill.warn { background: var(--warn); }
.crm-prob-fill.muted { background: var(--muted-2); }

/* 表单（弹窗内） */
.modal-lg {
  max-width: 720px;
}

.crm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.crm-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.crm-form-field.full {
  grid-column: 1 / -1;
}

.crm-form-field label {
  font-size: 12px;
  color: var(--muted);
}

.crm-form-field input,
.crm-form-field textarea,
.crm-form-field select {
  background: var(--bg-soft);
}

/* AI 录入 */
.crm-ai-intro {
  background: rgba(0, 221, 136, 0.08);
  border: 1px solid rgba(0, 221, 136, 0.2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.crm-ai-intro strong {
  color: var(--brand);
}

.crm-ai-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0 12px;
}

.crm-ai-divider::before,
.crm-ai-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* 空状态 */
.crm-table-wrap .empty-state {
  padding: 64px 24px;
}

/* 响应式 */
@media (max-width: 1200px) {
  .crm-metrics { grid-template-columns: repeat(3, 1fr); }
  .crm-filters { grid-template-columns: 1fr 1fr; }
  .crm-amount-pop { right: auto; left: 0; }
}

@media (max-width: 768px) {
  .crm-toolbar { flex-direction: column; align-items: flex-start; }
  .crm-metrics { grid-template-columns: repeat(2, 1fr); }
  .crm-filters { grid-template-columns: 1fr; }
  .crm-table th,
  .crm-table td { padding: 8px; font-size: 12px; }
}
