/* R109 crm.css */
.crm-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid #E5E7EB; background: var(--card); position: sticky; top: 0; z-index: 10;
}
.crm-header h2 { flex: 1; font-size: 18px; }
.back-btn { background: none; border: none; font-size: 24px; cursor: pointer; min-width: 44px; min-height: 44px; color: var(--text); }
.crm-toolbar { padding: 12px 16px; background: var(--card); border-bottom: 1px solid #E5E7EB; }
.crm-filters { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; }
.filter-chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 20px; border: 1px solid #E5E7EB;
  background: var(--card); font-size: 12px; cursor: pointer; min-height: 36px;
}
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.crm-list { padding: 12px 16px 100px; }
.crm-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid #E5E7EB; border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; cursor: pointer; transition: box-shadow 0.2s;
  animation: fadeInUp 0.3s ease;
}
.crm-card:active { box-shadow: var(--shadow); }
.crm-card-main strong { display: block; font-size: 15px; }
.crm-phone { font-size: 13px; color: var(--text-light); }
.crm-meta { font-size: 11px; color: var(--text-light); display: block; margin-top: 2px; }
.crm-status { font-size: 11px; padding: 4px 10px; border-radius: 12px; font-weight: 600; white-space: nowrap; }
.crm-empty { text-align: center; color: var(--text-light); padding: 48px 16px; }
.crm-detail { padding: 16px 16px 100px; }
.detail-actions { display: flex; gap: 10px; margin: 16px 0; }
.detail-actions button { flex: 1; }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.status-chip {
  padding: 8px 14px; border-radius: 20px; border: 2px solid #E5E7EB;
  background: var(--card); font-size: 12px; cursor: pointer; min-height: 40px;
}
.status-chip.active { font-weight: 700; background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.detail-fields { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.detail-field { margin-bottom: 12px; }
.detail-field label { font-size: 12px; color: var(--text-light); display: block; margin-bottom: 4px; }
.detail-field p { font-size: 15px; }
.detail-img { max-width: 100%; border-radius: 8px; margin-top: 4px; max-height: 160px; }
.follow-section { background: var(--card); border-radius: var(--radius); padding: 16px; }
.follow-section h4 { margin-bottom: 10px; font-size: 14px; }
.follow-section .btn-sm { margin-top: 8px; }
.follow-timeline { margin-top: 16px; border-left: 2px solid #E5E7EB; padding-left: 16px; }
.timeline-item { margin-bottom: 12px; }
.timeline-time { font-size: 11px; color: var(--text-light); }
.timeline-item p { font-size: 14px; margin-top: 2px; }

/* P1 — CRM 工具栏 */
.crm-toolbar-row { display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; background: var(--card); border-bottom: 1px solid #E5E7EB; }
.toolbar-btn {
  flex: 0 0 auto; padding: 8px 12px; border-radius: 20px; border: 1px solid #E5E7EB;
  background: var(--card); font-size: 12px; cursor: pointer; min-height: 36px;
}

/* P1 — 仪表盘 */
.dash-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 16px; }
.dash-stat { background: var(--card); border-radius: var(--radius); padding: 12px 8px; text-align: center; border: 1px solid #E5E7EB; }
.dash-stat strong { display: block; font-size: 18px; color: var(--primary); }
.dash-stat small { font-size: 10px; color: var(--text-light); }
.dash-chart { height: 220px; margin: 8px 16px 16px; background: var(--card); border-radius: var(--radius); border: 1px solid #E5E7EB; }
.channel-table { padding: 0 16px 80px; }
.channel-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #E5E7EB; font-size: 14px; }

/* P1 — AI 面板 */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 250;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-overlay[hidden] { display: none !important; }
.sheet-body {
  background: var(--card); width: 100%; max-width: 640px; max-height: 85dvh;
  border-radius: 16px 16px 0 0; padding: 20px; overflow-y: auto; position: relative;
}
.sheet-close { position: absolute; top: 8px; right: 12px; }
.ai-fields-panel h4 { margin-bottom: 8px; }
.ai-match-card { background: color-mix(in srgb, var(--primary) 8%, var(--card)); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
.ai-conf { font-size: 12px; color: var(--primary); margin-left: 8px; }
.ai-alt { display: block; width: 100%; margin-top: 8px; padding: 10px; border: 1px dashed #E5E7EB; border-radius: 8px; background: var(--card); cursor: pointer; }
.ai-divider { border: none; border-top: 1px solid #E5E7EB; margin: 16px 0; }
.extra-field-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.extra-check { font-size: 14px; display: flex; align-items: center; gap: 8px; min-height: 36px; }

/* P1 — 签名 */
.signature-canvas {
  width: 100%; height: 160px; border: 2px dashed #E5E7EB; border-radius: var(--radius);
  background: #FAFAFA; touch-action: none;
}
.signature-actions { margin-top: 8px; }

/* P1 — 日历 */
.cal-hint { padding: 12px 16px 0; }
.conflict-banner { margin: 12px 16px; padding: 10px 14px; background: #FEF3C7; color: #92400E; border-radius: 8px; font-size: 13px; }
.calendar-list { padding: 0 16px 80px; }
.cal-day { background: var(--card); border: 1px solid #E5E7EB; border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.cal-day.conflict { border-color: #F59E0B; background: #FFFBEB; }
.cal-item { font-size: 13px; padding: 6px 0; border-top: 1px solid #E5E7EB; cursor: pointer; color: var(--primary); }

@media (max-width: 480px) {
  .dash-summary { grid-template-columns: repeat(2, 1fr); }
  .detail-actions { flex-wrap: wrap; }
  .detail-actions button { min-width: calc(50% - 5px); }
}
