/* CRM Pipeline & Kanban Styles */
.crm-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--sa-text);
  box-sizing: border-box;
}

.crm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}

.crm-header__title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-header__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--sa-text);
  letter-spacing: -0.02em;
  margin: 0;
}

.crm-header__subtitle {
  font-size: 14px;
  color: var(--sa-text-secondary);
  margin: 0;
}

.crm-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* KPI Summary Cards Grid Container */
.crm-kpi-wrapper {
  margin-bottom: 24px;
}

/* Filter Toolbar */
.crm-toolbar {
  background: var(--sa-surface-raised);
  border: 1px solid var(--sa-border);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.crm-toolbar__left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  flex: 1;
}

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

.crm-search-wrapper {
  min-width: 240px;
  flex: 1;
  max-width: 360px;
}

.crm-filter-select-wrapper {
  min-width: 170px;
  flex-shrink: 0;
}

/* Kanban Board Layout */
.crm-kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(280px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 24px;
  min-height: 500px;
  align-items: flex-start;
}

.crm-kanban-col {
  background: var(--sa-surface);
  border-radius: 16px;
  border: 1px solid var(--sa-border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.crm-kanban-col__header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sa-border);
}

.crm-kanban-col__title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-kanban-col__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.crm-kanban-col__dot--lead { background: var(--sa-text-muted); }
.crm-kanban-col__dot--contacted { background: #3b82f6; }
.crm-kanban-col__dot--in_negotiation { background: #f59e0b; }
.crm-kanban-col__dot--approved { background: #a855f7; }
.crm-kanban-col__dot--review { background: #ef4444; }
.crm-kanban-col__dot--published { background: #22c55e; }

.crm-kanban-col__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sa-text);
}

.crm-kanban-col__badge {
  font-size: 12px;
  font-weight: 600;
  background: var(--sa-surface-raised);
  color: var(--sa-text-secondary);
  border: 1px solid var(--sa-border);
  padding: 2px 8px;
  border-radius: 12px;
}

.crm-kanban-col__cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 120px;
}

.crm-kanban-col__cards .admin-empty-subtext {
  color: var(--sa-text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 8px;
}

/* Kanban Lead Card */
.crm-lead-card {
  background: var(--sa-surface-raised);
  border: 1px solid var(--sa-border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--sa-text);
}

.crm-lead-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  border-color: var(--sa-border-hover);
}

.crm-lead-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.crm-lead-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--sa-text);
  margin: 0;
  line-height: 1.3;
}

.crm-lead-card__details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--sa-text-secondary);
}

.crm-lead-card__row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-lead-card__offer-badge {
  background: var(--sa-success-bg);
  color: var(--sa-success-text);
  border: 1px solid var(--sa-success-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.crm-lead-card__offer-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-lead-card__offer-count {
  margin-left: auto;
  background: color-mix(in srgb, var(--sa-success-text) 15%, transparent);
  border: 1px solid var(--sa-success-border);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sa-success-text);
}

.crm-lead-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--sa-border);
  padding-top: 10px;
  font-size: 12px;
  color: var(--sa-text-secondary);
}

.crm-lead-card__agent {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.crm-lead-card__followup {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.crm-lead-card__followup--overdue {
  color: var(--sa-danger);
  font-weight: 600;
}

/* Duplicate Checker Bar */
.crm-dup-alert {
  background: var(--sa-warning-bg);
  border: 1px solid var(--sa-warning-border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sa-warning-text);
  font-size: 13px;
}

.crm-dup-alert__icon {
  flex-shrink: 0;
  display: flex;
}

.crm-dup-matches {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Inline status banner */
.crm-inline-message {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-inline-message--success {
  background: var(--sa-success-bg);
  color: var(--sa-success-text);
  border: 1px solid var(--sa-success-border);
}

.crm-inline-message--error {
  background: var(--sa-danger-bg);
  color: var(--sa-danger-text);
  border: 1px solid var(--sa-danger-border);
}

/* Modal Form Specifics */
.crm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .crm-kanban {
    grid-template-columns: repeat(6, minmax(260px, 1fr));
  }
}

@media (max-width: 768px) {
  .crm-form-grid {
    grid-template-columns: 1fr;
  }
}
