/* ============================================================
   Customer CRM — Custom Styles
   ============================================================ */

* { box-sizing: border-box; }

body { font-family: 'Inter', system-ui, sans-serif; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Sidebar */
#sidebar { overflow: hidden; overflow-y: auto; }
#sidebar.collapsed { width: 64px !important; }
#sidebar.collapsed .sidebar-label,
#sidebar.collapsed .sidebar-section-label,
#sidebar.collapsed .sidebar-profile-text,
#sidebar.collapsed .sidebar-app-name { display: none !important; }
#sidebar.collapsed .sidebar-nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
#sidebar.collapsed .sidebar-icon { margin: 0; }

/* Mobile sidebar */
@media (max-width: 768px) {
  #sidebar { position: fixed; left: -240px; top: 0; bottom: 0; z-index: 30; transition: left 0.3s ease; width: 240px !important; }
  #sidebar.mobile-open { left: 0; }
  #sidebar-backdrop.show { display: block; }
}

/* Nav item */
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.15s;
  text-decoration: none;
  margin: 1px 8px;
}
.sidebar-nav-item:hover { background: #f3f4f6; color: #111827; }
.sidebar-nav-item.active { background: #eff6ff; color: #2563eb; }
.sidebar-nav-item.active .sidebar-icon svg { stroke: #2563eb; }
.sidebar-icon { flex-shrink: 0; display: flex; align-items: center; }

/* Cards */
.card { background: white; border: 1px solid #e5e7eb; border-radius: 12px; }
.card-sm { background: white; border: 1px solid #e5e7eb; border-radius: 8px; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: #2563eb; color: white; font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: white; color: #374151; font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: 8px; border: 1px solid #e5e7eb; cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: #f9fafb; }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  background: #dc2626; color: white; font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: #b91c1c; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #6b7280; font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: #f3f4f6; color: #111827; }
.btn-sm { padding: 6px 12px !important; font-size: 13px !important; }
.btn-xs { padding: 4px 10px !important; font-size: 12px !important; }

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #92400e; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-orange { background: #fed7aa; color: #c2410c; }

/* Status dots */
.dot-green { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; }
.dot-yellow { width: 8px; height: 8px; border-radius: 50%; background: #eab308; display: inline-block; }
.dot-red { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; display: inline-block; }
.dot-gray { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; display: inline-block; }
.dot-blue { width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; display: inline-block; }

/* Form inputs */
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 14px; font-family: inherit; color: #111827;
  background: white; outline: none; transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-input.error, .form-select.error, .form-textarea.error { border-color: #ef4444; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 4px; }
.form-error { font-size: 12px; color: #ef4444; margin-top: 3px; }
.form-group { margin-bottom: 16px; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 12px; font-weight: 600; color: #6b7280;
  padding: 10px 14px; background: #f9fafb;
  border-bottom: 1px solid #e5e7eb; white-space: nowrap;
}
.data-table td {
  padding: 12px 14px; font-size: 14px; color: #374151;
  border-bottom: 1px solid #f3f4f6; vertical-align: middle;
}
.data-table tr:hover td { background: #f9fafb; }
.data-table tr:last-child td { border-bottom: none; }

/* Progress bar */
.progress-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: #2563eb; border-radius: 4px; transition: width 0.5s; }

/* Checklist item */
.checklist-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: 10px;
  border: 1px solid #e5e7eb; background: white;
  cursor: pointer; transition: all 0.15s;
}
.checklist-item:hover { border-color: #bfdbfe; background: #f8faff; }
.checklist-item.done { opacity: 0.6; }

/* KPI Card */
.kpi-card {
  background: white; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 20px; display: flex; flex-direction: column; gap: 8px;
}
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }

/* Toast */
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-size: 14px; font-weight: 500;
  pointer-events: auto; min-width: 280px; max-width: 380px;
  animation: slideInRight 0.3s ease;
}
.toast-success { background: #fff; border-left: 4px solid #22c55e; color: #166534; }
.toast-error { background: #fff; border-left: 4px solid #ef4444; color: #991b1b; }
.toast-info { background: #fff; border-left: 4px solid #3b82f6; color: #1e40af; }
.toast-warning { background: #fff; border-left: 4px solid #f59e0b; color: #92400e; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

/* Modal */
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px 24px; flex: 1; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #e5e7eb; display: flex; gap: 10px; justify-content: flex-end; }

/* Tabs */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid #e5e7eb; }
.tab-item {
  padding: 10px 16px; font-size: 14px; font-weight: 500; color: #6b7280;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.15s; white-space: nowrap;
}
.tab-item:hover { color: #374151; }
.tab-item.active { color: #2563eb; border-bottom-color: #2563eb; }

/* Kanban */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col { flex-shrink: 0; width: 240px; background: #f3f4f6; border-radius: 12px; padding: 12px; }
.kanban-col-header { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.kanban-card { background: white; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s; }
.kanban-card:hover { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(37,99,235,0.1); }

/* Lead score */
.lead-score { display: inline-flex; align-items: center; gap: 4px; }
.lead-score-bar { width: 40px; height: 5px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.lead-score-fill { height: 100%; border-radius: 3px; }
.score-high .lead-score-fill { background: #22c55e; }
.score-mid .lead-score-fill { background: #f59e0b; }
.score-low .lead-score-fill { background: #ef4444; }

/* Workflow nodes */
.wf-node { background: white; border: 2px solid #e5e7eb; border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.wf-node.trigger { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.wf-node.action { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.wf-node.condition { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.wf-node.delay { border-color: #c4b5fd; background: #f5f3ff; color: #6d28d9; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Page padding */
.page-content { padding: 28px 32px; max-width: 1400px; }
@media (max-width: 768px) { .page-content { padding: 16px; } }

/* Avatar */
.avatar { display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar-xl { width: 56px; height: 56px; font-size: 20px; }

/* Activity timeline */
.timeline-item { display: flex; gap: 12px; position: relative; }
.timeline-line { position: absolute; left: 15px; top: 30px; bottom: 0; width: 1px; background: #e5e7eb; }
.timeline-dot { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; z-index: 1; }

/* Checkbox */
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrap input[type="checkbox"] { width: 16px; height: 16px; border-radius: 4px; cursor: pointer; }

/* Insights */
.insight-card { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; }
.churn-risk-high { background: #fee2e2; border-color: #fca5a5; }
.churn-risk-mid { background: #fef9c3; border-color: #fde047; }
.churn-risk-low { background: #dcfce7; border-color: #86efac; }

/* Animation helpers */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.slide-up { animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Calendar */
.cal-day { min-height: 90px; border: 1px solid #e5e7eb; padding: 6px; background: white; cursor: pointer; transition: background 0.1s; }
.cal-day:hover { background: #f9fafb; }
.cal-day.today { background: #eff6ff; border-color: #93c5fd; }
.cal-day.other-month { background: #fafafa; color: #d1d5db; }
.cal-event { font-size: 11px; font-weight: 500; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-event-meeting { background: #dbeafe; color: #1d4ed8; }
.cal-event-task { background: #dcfce7; color: #15803d; }
.cal-event-followup { background: #fef9c3; color: #92400e; }
.cal-event-post { background: #ede9fe; color: #6d28d9; }

/* Draggable */
.dragging { opacity: 0.5; }
.drop-target { border: 2px dashed #93c5fd !important; }

/* Responsive table wrapper */
.table-wrapper { overflow-x: auto; }

/* Pagination */
.page-btn { width: 32px; height: 32px; border-radius: 6px; border: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; font-weight: 500; color: #6b7280; transition: all 0.15s; }
.page-btn:hover { background: #f3f4f6; }
.page-btn.active { background: #2563eb; color: white; border-color: #2563eb; }

/* Pill tabs for analytics */
.pill-tab { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer; color: #6b7280; transition: all 0.15s; }
.pill-tab.active { background: #2563eb; color: white; }
.pill-tab:hover:not(.active) { background: #f3f4f6; }

/* Integration card */
.integration-card { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: all 0.15s; }
.integration-card:hover { border-color: #bfdbfe; box-shadow: 0 2px 12px rgba(37,99,235,0.08); }
.integration-card.connected { border-color: #86efac; }

/* Social platform */
.platform-card { background: white; border: 2px solid #e5e7eb; border-radius: 14px; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; transition: all 0.15s; }
.platform-card:hover { border-color: #93c5fd; }
.platform-card.connected { border-color: #22c55e; background: #f0fdf4; }

/* Automation feature cards */
.feature-box { background: #f8faff; border: 1px solid #dbeafe; border-radius: 10px; padding: 14px; }
.automation-action-card { background: white; border: 1px solid #e5e7eb; border-radius: 14px; padding: 24px; transition: all 0.15s; }
.automation-action-card:hover { border-color: #93c5fd; box-shadow: 0 2px 12px rgba(37,99,235,0.08); }

/* Help */
.faq-item { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.faq-question { padding: 14px 16px; font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: space-between; background: white; }
.faq-answer { padding: 14px 16px; font-size: 14px; color: #6b7280; background: #f9fafb; border-top: 1px solid #e5e7eb; display: none; }
.faq-item.open .faq-answer { display: block; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-chevron { transition: transform 0.2s; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; }

/* Deal stage colors */
.stage-new { background: #dbeafe; color: #1d4ed8; }
.stage-contacted { background: #e0e7ff; color: #4338ca; }
.stage-qualified { background: #ede9fe; color: #6d28d9; }
.stage-proposal { background: #fae8ff; color: #86198f; }
.stage-negotiation { background: #fce7f3; color: #9d174d; }
.stage-won { background: #dcfce7; color: #15803d; }
.stage-lost { background: #fee2e2; color: #991b1b; }

/* Scheduling */
.time-slot { padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; cursor: pointer; text-align: center; transition: all 0.15s; }
.time-slot:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.time-slot.selected { background: #2563eb; color: white; border-color: #2563eb; }
.time-slot.unavailable { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }

/* Admin */
.admin-section { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.admin-section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
