/* ==========================================================================
   Campaign Manager Styles - AdOpsDoctor Design System
   ========================================================================== */

/* --- Module Layout & Navigation --- */
.cm-module-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* Header Tabs & Widget Visibility in Campaign Manager */
body.in-campaign-manager #nav-btn-home,
body.in-campaign-manager .tools-dropdown-wrapper,
body.in-campaign-manager #feedback-widget,
body.in-campaign-manager #chatbot-widget {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.in-campaign-manager #cm-header-nav-tabs {
  display: inline-flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.cm-header-nav-tabs {
  display: none;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 99px;
  border: 1px solid #cbd5e1;
}

.cm-header-tab-btn {
  padding: 7px 18px;
  font-size: 0.86rem;
  font-weight: 700;
  border-radius: 99px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.cm-header-tab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.65);
}

.cm-header-tab-btn.active {
  background: #ffffff;
  color: #4f46e5;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12), 0 1px 2px rgba(0, 0, 0, 0.05);
  font-weight: 800;
}

#cm-header-nav-home {
  color: #3b82f6;
  font-weight: 700;
}
#cm-header-nav-home:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

/* --- Pacing Executive KPI Summary Cards --- */
.cm-pacing-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 4px;
}

.cm-pacing-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cm-pacing-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.cm-pacing-stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cm-pacing-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.cm-pacing-stat-subtext {
  font-size: 0.76rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cm-top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.cm-nav-tabs {
  display: flex;
  gap: 8px;
}

.cm-nav-tab-btn {
  padding: 10px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 10px 10px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.cm-nav-tab-btn:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.cm-nav-tab-btn.active {
  color: #4f46e5;
  background: #ffffff;
  border-color: #cbd5e1;
  border-bottom: 2px solid #ffffff;
  margin-bottom: -2px;
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.04);
}

.cm-nav-tab-btn.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 10px 10px 0 0;
}

/* --- Header Section --- */
.cm-header-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 24px 28px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.cm-header-info h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cm-header-info p {
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 680px;
}

.cm-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cm-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.cm-btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.28);
}

.cm-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.38);
}

.cm-btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cm-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.cm-btn-subtle {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

.cm-btn-subtle:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.cm-btn-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.cm-btn-danger:hover {
  background: #fecaca;
  color: #b91c1c;
}

/* --- Filter & Search Bar --- */
.cm-controls-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cm-search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.cm-search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.cm-search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.cm-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 0.86rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.cm-search-input:focus {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.cm-group-select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-select-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.cm-select {
  padding: 9px 12px;
  font-size: 0.84rem;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #ffffff;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.cm-select:focus {
  border-color: #6366f1;
}

.cm-filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.cm-filter-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cm-filter-item label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cm-filter-item input,
.cm-filter-item select {
  padding: 7px 10px;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  outline: none;
  font-family: inherit;
}

.cm-clear-filters-btn {
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 1px;
}

.cm-clear-filters-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* --- Status Badges --- */
.cm-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 0.74rem;
  font-weight: 800;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cm-status-live {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.cm-status-live .cm-badge-dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: cm-pulse 1.8s infinite;
}

.cm-status-upcoming {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.cm-status-upcoming .cm-badge-dot {
  background: #3b82f6;
}

.cm-status-completed {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.cm-status-completed .cm-badge-dot {
  background: #64748b;
}

.cm-status-paused {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.cm-status-paused .cm-badge-dot {
  background: #f59e0b;
}

.cm-status-draft {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.cm-status-draft .cm-badge-dot {
  background: #8b5cf6;
}

.cm-status-cancelled {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.cm-status-cancelled .cm-badge-dot {
  background: #ef4444;
}

.cm-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

@keyframes cm-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* --- Campaign Table --- */
.cm-table-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  position: relative;
}

.cm-table-responsive {
  width: 100%;
  overflow-x: auto;
  max-height: 680px;
}

.cm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.83rem;
  text-align: left;
}

.cm-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 2px solid #e2e8f0;
  z-index: 10;
  white-space: nowrap;
  user-select: none;
}

.cm-table th.sortable {
  cursor: pointer;
}

.cm-table th.sortable:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.cm-sort-icon {
  margin-left: 4px;
  font-size: 0.75rem;
  opacity: 0.6;
}

.cm-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
  transition: background 0.15s ease;
}

.cm-table tr:hover td {
  background: #f8faff;
}

.cm-campaign-name-cell {
  font-weight: 700;
  color: #0f172a;
}

.cm-campaign-id-pill {
  font-family: monospace;
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.cm-metric-cell {
  font-weight: 700;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.cm-kpi-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eef2ff;
  color: #4338ca;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.76rem;
  border: 1px solid #c7d2fe;
}

/* Action Icons */
.cm-actions-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.cm-action-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.cm-action-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.cm-action-btn.delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* --- Table Footer / Pagination --- */
.cm-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: 10px;
}

.cm-pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cm-page-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  color: #334155;
}

.cm-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cm-page-btn:not(:disabled):hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* --- Grouping Accordion View --- */
.cm-group-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.cm-group-header {
  padding: 14px 20px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.cm-group-header:hover {
  background: #f1f5f9;
}

.cm-group-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cm-group-count-badge {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.cm-group-metrics {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.8rem;
  color: #64748b;
}

.cm-group-metrics strong {
  color: #0f172a;
}

.cm-group-toggle-icon {
  font-size: 0.85rem;
  color: #64748b;
  transition: transform 0.2s ease;
}

.cm-group-section.collapsed .cm-group-toggle-icon {
  transform: rotate(-90deg);
}

.cm-group-section.collapsed .cm-group-content {
  display: none;
}

/* --- Drawer / Modal for Campaign Entry --- */
.cm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  justify-content: flex-end; /* Drawer style */
  animation: cm-fade-in 0.2s ease;
}

.cm-modal-overlay.center-mode {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.cm-drawer {
  width: 100%;
  max-width: 680px;
  background: #ffffff;
  height: 100vh;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  animation: cm-slide-left 0.25s ease;
}

.cm-center-modal {
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cm-pop-in 0.2s ease;
}

.cm-modal-header {
  padding: 20px 26px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.cm-modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.cm-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.cm-modal-close-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.cm-modal-body {
  padding: 24px 26px;
  overflow-y: auto;
  flex: 1;
}

.cm-modal-footer {
  padding: 16px 26px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Form Styles */
.cm-form-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #f1f5f9;
}

.cm-form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cm-form-section-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

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

.cm-form-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #374151;
}

.cm-form-field label span.req {
  color: #ef4444;
  margin-left: 2px;
}

.cm-form-field input,
.cm-form-field select,
.cm-form-field textarea {
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 0.86rem;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
  background: #ffffff;
}

.cm-form-field input:focus,
.cm-form-field select:focus,
.cm-form-field textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.cm-field-helper {
  font-size: 0.74rem;
  color: #64748b;
}

.cm-duration-callout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  color: #4338ca;
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 4px;
}

/* KPI Dynamic List */
.cm-kpi-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 10px 14px;
  border-radius: 10px;
}

.cm-kpi-item-row .kpi-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
}

.cm-kpi-item-row.is-primary .kpi-tag {
  background: #4f46e5;
  color: #ffffff;
}

/* Additional Details Collapsible */
.cm-collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 0;
  color: #4338ca;
  font-weight: 700;
  font-size: 0.84rem;
}

.cm-collapsible-content {
  margin-top: 10px;
}

.cm-collapsible-content.hidden {
  display: none;
}

/* --- Bulk Upload Styles --- */
.cm-upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 36px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cm-upload-dropzone:hover,
.cm-upload-dropzone.drag-over {
  border-color: #6366f1;
  background: #eef2ff;
}

.cm-upload-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
}

.cm-step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.cm-step-pill {
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}

.cm-step-pill.active {
  background: #4f46e5;
  color: #ffffff;
}

.cm-step-pill.done {
  background: #ecfdf5;
  color: #059669;
}

.cm-preview-table-wrapper {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 14px;
}

.cm-preview-table {
  width: 100%;
  font-size: 0.75rem;
  border-collapse: collapse;
}

.cm-preview-table th {
  background: #f8fafc;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-weight: 700;
}

.cm-preview-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
}

.cm-preview-table tr.has-error td {
  background: #fff1f2;
}

.cm-row-error-badge {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-block;
}

/* Mapping Grid */
.cm-mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.cm-mapping-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.cm-mapping-target {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e293b;
}

/* Summary Box */
.cm-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.cm-summary-stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.cm-summary-stat-box .num {
  font-size: 1.4rem;
  font-weight: 900;
  color: #0f172a;
}

.cm-summary-stat-box .lbl {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.cm-summary-stat-box.success .num { color: #059669; }
.cm-summary-stat-box.failed .num { color: #dc2626; }
.cm-summary-stat-box.updated .num { color: #2563eb; }

/* --- Pacing Dashboard Placeholder --- */
.cm-placeholder-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 48px 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  max-width: 820px;
  margin: 20px auto;
}

.cm-placeholder-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: inline-block;
  animation: cm-bounce 2s infinite ease-in-out;
}

.cm-placeholder-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
}

.cm-placeholder-card p {
  color: #64748b;
  font-size: 0.95rem;
  max-width: 580px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

.cm-placeholder-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 24px;
  text-align: left;
}

.cm-feature-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
}

.cm-feature-item h4 {
  font-size: 0.84rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}

.cm-feature-item p {
  font-size: 0.76rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

/* Animations */
@keyframes cm-slide-left {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes cm-pop-in {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes cm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cm-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Toast notification */
.cm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 99999;
  animation: cm-fade-in 0.2s ease;
}

.cm-toast.success {
  background: #065f46;
  border: 1px solid #10b981;
}

.cm-toast.error {
  background: #991b1b;
  border: 1px solid #ef4444;
}

/* ==========================================================================
   Pacing Dashboard Premium Styles
   ========================================================================== */

.cm-pacing-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Pacing KPI Cards Grid */
.cm-pacing-kpis-grid {
  display: none !important;
}

.cm-pacing-kpi-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cm-pacing-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}

.cm-pacing-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #cbd5e1;
}

.cm-pacing-kpi-card.primary::before { background: linear-gradient(90deg, #4f46e5, #6366f1); }
.cm-pacing-kpi-card.success::before { background: linear-gradient(90deg, #10b981, #059669); }
.cm-pacing-kpi-card.warning::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.cm-pacing-kpi-card.danger::before { background: linear-gradient(90deg, #ef4444, #dc2626); }
.cm-pacing-kpi-card.info::before { background: linear-gradient(90deg, #0ea5e9, #2563eb); }

.cm-pacing-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cm-pacing-kpi-label {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.cm-pacing-kpi-icon {
  font-size: 1.25rem;
}

.cm-pacing-kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.cm-pacing-kpi-sub {
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Pacing Table Styling */
.cm-pacing-table th {
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
}

.cm-pacing-table td {
  padding: 14px;
  vertical-align: middle;
  font-size: 0.85rem;
}

/* Frozen / Sticky First Column (Campaign / Line Item) on Horizontal Scroll */
.cm-pacing-table .cm-sticky-col {
  position: sticky;
  left: 0;
  z-index: 6;
  background: #ffffff;
  border-right: 2px solid #e2e8f0 !important;
  box-shadow: 4px 0 10px -2px rgba(15, 23, 42, 0.08);
}

.cm-pacing-table th.cm-sticky-col {
  z-index: 25;
  background: #f8fafc;
  border-right: 2px solid #cbd5e1 !important;
}

.cm-pacing-table tr:hover td.cm-sticky-col {
  background: #f8faff;
}

/* Pacing Status Badges */
.cm-pacing-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cm-pacing-badge.on-track {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.cm-pacing-badge.ahead {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.cm-pacing-badge.underpacing {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.cm-pacing-badge.critical {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.cm-pacing-badge.upcoming {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.cm-pacing-badge.completed {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}

/* Remaining Days Badges */
.cm-days-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.cm-days-badge.urgent {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.cm-days-badge.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.cm-days-badge.safe {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.cm-days-badge.ended {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Mini Progress Bar */
.cm-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}

.cm-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.cm-progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.cm-progress-bar-fill.green { background: linear-gradient(90deg, #10b981, #059669); }
.cm-progress-bar-fill.blue { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.cm-progress-bar-fill.amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.cm-progress-bar-fill.red { background: linear-gradient(90deg, #ef4444, #dc2626); }
.cm-progress-bar-fill.slate { background: #94a3b8; }

.cm-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

/* Log Stats Modal */
.cm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: cm-fade-in 0.2s ease;
}

.cm-delivery-modal {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  animation: cm-pop-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cm-delivery-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: #f8fafc;
}

.cm-delivery-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 75vh;
  overflow-y: auto;
}

.cm-delivery-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* --- Expandable Pacing Details & Projections --- */
.cm-pacing-row-expanded td {
  background: #f8fafc !important;
  border-bottom: none !important;
}

.cm-pacing-detail-row td {
  background: #f8fafc !important;
  border-top: none !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

.cm-row-toggle-btn {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cm-row-toggle-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  transform: scale(1.08);
}

.cm-proj-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cm-proj-badge.success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.cm-proj-badge.danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.cm-proj-badge.info {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.cm-pacing-expanded-panel {
  animation: cm-fade-in 0.2s ease;
}

.cm-billing-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ==========================================================================
   Campaign Analyzer Styles
   ========================================================================== */
.cm-analyze-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* Upload Drop Card */
.cm-analyze-upload-card {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.cm-analyze-upload-card:hover {
  border-color: #6366f1;
  background: #eef2ff;
}

.cm-analyze-upload-card.drag-active {
  border-color: #4f46e5;
  background: #e0e7ff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.cm-upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

/* Drag & Drop Builder Card */
.cm-builder-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cm-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.cm-builder-summary-pill {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 5px 14px;
  border-radius: 99px;
  border: 1px solid #cbd5e1;
}

.cm-builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 16px;
}

@media (max-width: 1080px) {
  .cm-builder-grid {
    grid-template-columns: 1fr;
  }
}

.cm-dropzone-column {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cm-dropzone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
}

.cm-dropzone-count {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
}

.cm-dropzone-box {
  min-height: 84px;
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  transition: all 0.2s ease;
}

.cm-dropzone-box.dragover {
  border-color: #4f46e5;
  background: #eef2ff;
}

.cm-dropzone-placeholder {
  width: 100%;
  height: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  color: #94a3b8;
  font-style: italic;
  text-align: center;
}

/* Active Chips */
.cm-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cm-active-chip:active {
  cursor: grabbing;
}

.cm-active-chip.dimension {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.cm-active-chip.metric {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.cm-active-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.07);
}

.cm-chip-drag-handle {
  opacity: 0.45;
  font-size: 0.72rem;
  cursor: grab;
}

.cm-chip-remove-btn {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  transition: opacity 0.15s, color 0.15s;
}

.cm-chip-remove-btn:hover {
  opacity: 1;
  color: #ef4444;
}

.cm-chip-agg-select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #334155;
  padding: 2px 4px;
  margin-left: 2px;
  cursor: pointer;
}

/* Available Bank */
.cm-available-bank {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.cm-bank-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cm-chip-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 94px;
  overflow-y: auto;
  padding: 2px;
}

.cm-bank-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.cm-bank-chip.dimension {
  color: #2563eb;
}

.cm-bank-chip.dimension:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.cm-bank-chip.metric {
  color: #7c3aed;
}

.cm-bank-chip.metric:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
}

/* KPI Formulas Zone */
.cm-kpi-toggles-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.cm-kpi-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: #1e293b;
  cursor: pointer;
  user-select: none;
}

.cm-kpi-checkbox input[type="checkbox"] {
  accent-color: #4f46e5;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.cm-kpi-checkbox small {
  color: #64748b;
  font-size: 0.68rem;
}

/* Smart Executive AI Insights Card */
.cm-smart-insights-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-left: 4px solid #4f46e5;
  border-radius: 12px;
  padding: 18px 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cm-insights-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.cm-insights-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .cm-insights-stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

.cm-mini-stat {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cm-mini-stat .label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cm-mini-stat .val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.cm-insights-bullets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 860px) {
  .cm-insights-bullets-grid {
    grid-template-columns: 1fr;
  }
}

.cm-insight-bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  color: #334155;
  line-height: 1.4;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.cm-insight-bullet-item .icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Visual Chart Card */
.cm-chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cm-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.cm-chart-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.cm-chart-control-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.cm-chart-control-item .cm-select {
  padding: 5px 10px;
  font-size: 0.78rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
}

/* Pivot Table */
.cm-pivot-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.cm-pivot-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.cm-pivot-table th.sortable:hover {
  background: #f1f5f9;
}

.cm-sort-icon {
  display: inline-block;
  font-size: 0.68rem;
  color: #94a3b8;
  margin-left: 3px;
}


