/* ==========================================================================
   Customer 360 Theme
   Inspired by the GN Hearing Customer 360 Dashboard
   ========================================================================== */

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary-color: #ea7200;
  --primary-hover: #d06500;
  /* Darker orange (same hue as --primary-color) — login hero, etc. */
  --primary-dark: #6e3400;
  --primary-light: #e8c3aa;
  --secondary-color: #1f3157;
  --secondary-500: #a2adb6;
  --secondary-200: #ecf4f7;

  /* Feedback */
  --success-color: #3e7a5c;
  --success-light: #9ccdb5;
  --warning-color: #f59e0b;
  --danger-color: #c72522;
  --danger-light: #e9b2b7;
  --info-color: #0078ea;

  /* Surfaces */
  --light-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --border-color-active: #ea7200;

  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #9ca3af;

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.06);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.06);

  /* Radii */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;

  /* Data-viz palette */
  --compare-1: #1f3157;
  --compare-2: #ea7200;
  --compare-3: #0078ea;
  --growth: #35684e;
  --risk: #c72225;

  /* Chart colors */
  --lead-500: #81C784;
  --lead-600: #66BB6A;
  --lead-700: #43A047;
  --contact-500: #0078ea;
  --contact-600: #1E88E5;
  --contact-700: #1565C0;
  --existing-lead-500: #A2ADB6;
  --existing-lead-600: #90A4AE;
  --duplicate-500: #FFB74D;
  --duplicate-600: #FF9800;
  --error-500: #E53935;
  --neutral-500: #9E9E9E;

  /* FormBuilder */
  --drop-dash: #cbd5e1;
  --editing-bg: #f1f5f9;
  --editing-bd: #94a3b8;
  --indicator: #94a3b8;
}

/* ─── Global Typography ──────────────────────────────────────────────────── */
body {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--light-bg);
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Page Layout ────────────────────────────────────────────────────────── */
main {
  padding: 0.75rem !important;
  background: var(--light-bg);
  min-height: 100vh;
}

/* ─── Page Header ────────────────────────────────────────────────────────── */
.page-header {
  background: var(--light-bg);
  border-bottom: none;
  padding: 0.75rem 0;
  margin-bottom: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  padding-left: 0;
}

.page-title i {
  margin-right: 0.25rem;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.page-title + small,
.page-title + p {
  padding-left: 0;
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.page-badge {
  background: var(--primary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
}

.step-indicator {
  display: inline-block;
  min-width: 48px;
  text-align: center;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ─── Form Controls ──────────────────────────────────────────────────────── */
.form-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.form-control, .form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color 0.15s ease;
  background: var(--card-bg);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(234, 114, 0, 0.15);
  outline: none;
}

.form-control:hover, .form-select:hover {
  border-color: var(--primary-color);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  transition: all 0.15s ease;
  border: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #346c50;
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--secondary-500);
  color: white;
}

.btn-outline-primary {
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--primary-color);
  color: white;
}

.btn-outline-secondary {
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: transparent;
}

.btn-outline-secondary:hover {
  background: var(--light-bg);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--card-bg);
  transition: box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-body {
  padding: 0.75rem;
}

.card-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

/* ─── KPI / Stat Cards  (compact, centred, orange value) ─────────────────── */
.stats-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
  min-height: 70px;
  height: 100%;
}

.stats-card:hover {
  box-shadow: var(--shadow-md);
}

.stats-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-bottom: 0.25rem;
}

.stats-content {
  flex: 1;
  text-align: center;
}

.stats-number {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
  color: var(--primary-color);
}

.stats-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
}

/* ─── Nav Tabs (horizontal sub-nav) ──────────────────────────────────────── */
.nav-tabs {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0.25rem;
  box-shadow: none;
  border-bottom: 1px solid transparent;
}

.nav-tabs .nav-link {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: all 0.15s ease;
  font-size: 0.8rem;
  border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.03);
  border-bottom-color: var(--secondary-500);
}

.nav-tabs .nav-link.active {
  background: var(--card-bg);
  color: var(--primary-color);
  font-weight: 700;
  border-bottom-color: var(--primary-color);
  box-shadow: none;
}

/* ─── Tables (compact, data-dense) ───────────────────────────────────────── */
.table {
  font-size: 0.8rem;
  margin-bottom: 0;
}

.table thead th,
.table thead td {
  background: transparent;
  color: var(--text-primary);
  font-weight: 700;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.74rem;
  white-space: nowrap;
  vertical-align: bottom;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.1s ease;
}

.table tbody tr:hover {
  background: rgba(0, 0, 0, 0.04);
}

.table tbody td {
  padding: 0.25rem 0.4rem;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Total / summary row style */
.table tbody tr:first-child td,
.table tbody tr.total-row td {
  font-weight: 700;
  background: var(--light-bg);
  border-bottom: 1px solid var(--secondary-500);
}

.table-responsive {
  font-size: 0.8rem;
}

/* Sortable column highlight */
.table thead td.sorted,
.table thead th.sorted {
  background: var(--light-bg);
}

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-weight: 500;
  font-size: 0.8rem;
  box-shadow: none;
  border-left: 3px solid;
}

.alert-danger {
  background: #fef2f2;
  color: var(--danger-color);
  border-left-color: var(--danger-color);
}

.alert-warning {
  background: #fffbeb;
  color: #d97706;
  border-left-color: var(--warning-color);
}

.alert-info {
  background: #f0f9ff;
  color: #0284c7;
  border-left-color: var(--info-color);
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border-left-color: var(--success-color);
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  font-weight: 500;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.bg-primary {
  background: var(--primary-color) !important;
}

.bg-secondary {
  background: var(--secondary-500) !important;
}

.bg-success {
  background: var(--success-color) !important;
}

.bg-warning {
  background: var(--warning-color) !important;
}

.bg-danger {
  background: var(--danger-color) !important;
}

.bg-info {
  background: var(--info-color) !important;
}

/* ─── List Groups ────────────────────────────────────────────────────────── */
.list-group-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md) !important;
  margin-bottom: 0.25rem;
  transition: all 0.15s ease;
  background: var(--card-bg);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.list-group-item:hover {
  background: var(--light-bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.list-group-item-action {
  text-decoration: none;
  color: var(--text-primary);
}

/* ─── Search Results ─────────────────────────────────────────────────────── */
.search-result-item {
  transition: all 0.15s ease;
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-weight: 500;
}

.search-result-item:hover {
  background: var(--card-bg);
  cursor: pointer;
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.search-result-item.active {
  background: rgba(234, 114, 0, 0.1);
  border-left: 3px solid var(--primary-color);
  color: var(--text-primary) !important;
  font-weight: 600;
}

.search-result-item small {
  color: var(--text-secondary);
  font-weight: 400;
}

/* ─── Dropdown menus (match theme) ───────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
}

.dropdown-item {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  transition: background 0.1s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
  background: var(--light-bg);
  color: var(--primary-color);
}

/* ─── Dashboard Specific ─────────────────────────────────────────────────── */
.dashboard-stats {
  transition: transform 0.15s ease;
}

.dashboard-stats:hover {
  transform: translateY(-2px);
}

.dashboard-card {
  transition: all 0.15s ease;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.dashboard-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-icon {
  transition: transform 0.2s ease;
}

.dashboard-card:hover .tool-icon {
  transform: scale(1.05);
}

.welcome-badge {
  background: var(--primary-color);
  color: white;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.activity-card {
  background: var(--light-bg);
  border: 1px solid var(--border-color);
}

/* ─── Auto-delete Controls ───────────────────────────────────────────────── */
.auto-delete-container {
  background: var(--light-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.25rem;
}

.form-range {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  margin: 0.5rem 0;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}

.form-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ─── Name Preview ───────────────────────────────────────────────────────── */
.name-preview {
  background: var(--light-bg);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

/* ─── Spinner ────────────────────────────────────────────────────────────── */
.spinner-border {
  color: var(--primary-color);
}

/* ─── FormBuilder: Drag & Drop ───────────────────────────────────────────── */
.drop-block {
  min-height: 200px;
  border: 2px dashed var(--drop-dash);
  background: var(--light-bg);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all 0.15s ease;
}

.drop-block:hover {
  border-color: var(--primary-color);
  background: #f8fafc;
}

.drop-block p.placeholder {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0;
}

.drop-indicator {
  height: 6px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  margin: 6px 4px;
}

/* ─── FormBuilder: Field Cards ───────────────────────────────────────────── */
.field-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.field-card.dragging {
  opacity: 0.6;
  box-shadow: none;
  transform: rotate(2deg);
}

.field-card.editing {
  background: var(--editing-bg);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.field-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.orig-tag {
  position: absolute;
  top: -6px;
  left: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.field-toolbar {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

.icon-btn {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
}

.icon-btn:hover {
  background: var(--light-bg);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.field-title {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-weight: 600;
}

.field-title .badge-hidden {
  margin-left: 0.25rem;
  font-size: 0.6rem;
  border: 1px solid #fecaca;
  color: #dc2626;
  background: #fef2f2;
  padding: 1px 4px;
  border-radius: 999px;
  vertical-align: middle;
}

.config-panel {
  border-top: 1px dashed var(--border-color);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.config-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.config-row .form-label {
  margin-bottom: 0.125rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.config-col-label {
  flex: 1 1 60%;
  min-width: 180px;
}

.config-col-type {
  flex: 1 1 40%;
  min-width: 140px;
}

#fieldList .list-group-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  background: var(--card-bg);
}

#fieldList .list-group-item:hover {
  background: var(--light-bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

#fieldList .hint {
  color: var(--text-muted);
}

.draggable-field {
  cursor: move;
}

/* ─── Step Indicator Badges ──────────────────────────────────────────────── */
.list-group-item .badge {
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  min-width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.list-group-item {
  align-items: flex-start !important;
  padding: 0.5rem 0.75rem;
}

.list-group-item .badge {
  margin-right: 0.5rem;
  margin-top: 0.125rem;
}

.list-group-item div {
  flex: 1;
  min-width: 0;
}

/* ─── Utility Classes ────────────────────────────────────────────────────── */
.color-lead { color: var(--lead-500) !important; }
.bg-lead { background: var(--lead-500) !important; }
.color-contact { color: var(--contact-500) !important; }
.bg-contact { background: var(--contact-500) !important; }
.color-existing-lead { color: var(--existing-lead-500) !important; }
.bg-existing-lead { background: var(--existing-lead-500) !important; }
.color-duplicate { color: var(--duplicate-500) !important; }
.bg-duplicate { background: var(--duplicate-500) !important; }
.color-error { color: var(--error-500) !important; }
.bg-error { background: var(--error-500) !important; }
.color-neutral { color: var(--neutral-500) !important; }
.bg-neutral { background: var(--neutral-500) !important; }

.text-gradient {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-hover {
  transition: box-shadow 0.15s ease;
}

.shadow-hover:hover {
  box-shadow: var(--shadow-lg);
}

/* ─── Campaign Members ───────────────────────────────────────────────────── */
.modern-member-item {
  transition: all 0.15s ease;
  border-radius: var(--radius-md) !important;
  margin-bottom: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  width: 100%;
  display: flex;
  flex-direction: column;
}

.modern-member-item:hover {
  background: var(--light-bg) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.member-info { min-width: 0; flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.member-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; line-height: 1.3; word-break: break-word; }
.member-email { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 2px; word-break: break-all; line-height: 1.4; }
.member-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--light-bg);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-top: 1px;
}

.member-id a { color: var(--primary-color) !important; text-decoration: none !important; }
.member-id a:hover { color: var(--primary-hover) !important; }
.member-id a i { font-size: 0.65rem; margin-left: 2px; }

.member-actions { flex-shrink: 0; width: auto; min-width: 28px; }

.action-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  text-decoration: none;
}

.action-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* ─── Section Headers ────────────────────────────────────────────────────── */
.modern-section-header {
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  box-shadow: var(--shadow-sm);
  background: var(--light-bg) !important;
}

.section-icon { flex-shrink: 0; }
.section-info h5 { font-size: 1rem; letter-spacing: -0.025em; color: var(--text-primary); margin-bottom: 0.15rem; }
.section-info p { font-size: 0.8rem; opacity: 0.8; color: var(--text-secondary); margin: 0; }

/* ─── Enhanced Card Headers / Section Headers ────────────────────────────── */
.card-header {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

.card-header h1, .card-header h2, .card-header h3,
.card-header h4, .card-header h5, .card-header h6 {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.card-header h1 i, .card-header h2 i, .card-header h3 i,
.card-header h4 i, .card-header h5 i, .card-header h6 i {
  color: var(--primary-color);
  font-size: 1em;
}

.section-header { padding-left: 0; margin-bottom: 0.5rem; }
.section-header h1, .section-header h2, .section-header h3,
.section-header h4, .section-header h5, .section-header h6 {
  display: flex; align-items: center; gap: 0.5rem; margin-left: 0; font-size: 0.9rem;
}
.section-header i { color: var(--primary-color); font-size: 1em; }

.bg-white h1, .bg-white h2, .bg-white h3,
.bg-white h4, .bg-white h5, .bg-white h6 {
  padding-left: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bg-white h1 i, .bg-white h2 i, .bg-white h3 i,
.bg-white h4 i, .bg-white h5 i, .bg-white h6 i {
  color: var(--primary-color);
  font-size: 1em;
  margin-right: 0.25rem;
}

/* ─── Import Summary ─────────────────────────────────────────────────────── */
.import-summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

.import-summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--success-color) 0%, var(--primary-color) 100%);
}

.import-summary-header { background: var(--light-bg); padding: 1rem; border-bottom: 1px solid var(--border-color); }
.import-summary-icon { width: 48px; height: 48px; background: var(--success-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: white; box-shadow: var(--shadow-sm); }
.import-summary-title { font-size: 1.25rem; font-weight: 700; color: var(--primary-color); margin-bottom: 0.25rem; }
.import-summary-subtitle { color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; margin: 0; }
.import-summary-content { padding: 1rem; }
.import-campaign-name { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.5rem; }
.import-campaign-id {
  background: var(--light-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: inline-block;
}
.import-campaign-id:hover { background: var(--card-bg); border-color: var(--primary-color); color: var(--text-primary); }

.import-status-badge {
  background: var(--success-color);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.import-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.import-action-btn {
  background: var(--secondary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.import-action-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); color: white; }

.import-chart-container { background: transparent; border: none; padding: 0; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 200px; }
.import-chart-container > div { width: 100% !important; height: 100% !important; min-height: 200px; }

.import-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin-top: 1rem; }

.import-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: center;
  transition: all 0.15s ease;
  position: relative;
}

.import-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
}

.import-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-color); }
.import-stat-number { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); margin-bottom: 0.25rem; line-height: 1; }
.import-stat-label { font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin: 0; }

/* ─── Login Page ─────────────────────────────────────────────────────────── */
body.login-page {
  /* Theme orange → darker orange; hex fallbacks if custom properties are missing */
  background-color: var(--primary-dark, #6e3400) !important;
  background-image: linear-gradient(
    135deg,
    var(--primary-color, #ea7200) 0%,
    var(--primary-dark, #6e3400) 100%
  ) !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.login-container {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border-color);
}

.login-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  color: white;
  font-size: 1.25rem;
}

.btn-login {
  background: var(--primary-color);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 1.5rem;
  font-weight: 600;
  color: white;
  width: 100%;
  transition: all 0.15s ease;
}

.btn-login:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: white;
}

.demo-credentials {
  background: var(--light-bg);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.75rem;
  border: 1px solid var(--border-color);
}

.demo-credentials h6 { color: var(--text-secondary); margin-bottom: 0.35rem; }
.demo-credentials code { background: var(--border-color); padding: 0.15rem 0.35rem; border-radius: var(--radius-sm); font-size: 0.75rem; color: var(--text-primary); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .page-title { font-size: 1rem; }
  main { padding: 0.5rem !important; }
}

@media (max-width: 992px) {
  .page-title { font-size: 0.95rem; }
}

@media (max-width: 991.98px) {
  .page-title { font-size: 0.9rem; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  main { padding: 0.5rem !important; margin-top: 0.5rem !important; padding-top: 0.75rem !important; }
  .card { margin-bottom: 0.5rem; }
  .card-body { padding: 0.5rem !important; }
  .card-header { padding: 0.5rem !important; }
  .form-control, .form-select { padding: 0.4rem; font-size: 0.85rem; }
  .btn { padding: 0.4rem 0.75rem; font-size: 0.8rem; width: 100%; margin-bottom: 0.25rem; }
  .btn-group .btn { width: auto; margin-bottom: 0; }
  .table th, .table td { padding: 0.2rem 0.3rem; font-size: 0.75rem; }
  .stats-card { padding: 0.5rem; gap: 0; }
  .stats-number { font-size: 1rem; }
  .stats-label { font-size: 0.7rem; }
  .modern-member-item { padding: 0.5rem !important; margin-bottom: 0.25rem; }
  .member-name { font-size: 0.8rem; }
  .member-email { font-size: 0.75rem; }
  .import-summary-header { padding: 0.75rem; }
  .import-summary-content { padding: 0.75rem; }
  .import-stats-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.5rem; }
}

@media (max-width: 576px) {
  .page-title { font-size: 0.85rem; }
  main { margin-top: 0.5rem !important; padding-top: 0.5rem !important; }
  .stats-number { font-size: 0.9rem; }
  .table th, .table td { padding: 0.15rem 0.25rem; font-size: 0.7rem; }
  .import-stats-grid { grid-template-columns: 1fr; }
}

/* ─── Shell: sidebar & mobile bar (orange accent vs default blue) ─────────
   Sidebar markup/styles ship in sidebar.php; these overrides apply only when
   Customer 360 theme is active ([data-theme] on <html>). */

/*
 * Warm charcoal shell (no slate / blue-gray). !important beats sidebar.php’s
 * in-body <style> and any cascade order; html[data-theme] bumps specificity.
 */
html[data-theme="customer360"] aside.modern-sidebar {
  background: linear-gradient(
    180deg,
    #2e241e 0%,
    #1c1613 36%,
    #12100e 68%,
    #0a0807 100%
  ) !important;
  border-right: 1px solid rgba(234, 114, 0, 0.18) !important;
  box-shadow:
    4px 0 24px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(234, 114, 0, 0.06) !important;
}

html[data-theme="customer360"] .sidebar-header {
  background: linear-gradient(
    180deg,
    rgba(234, 114, 0, 0.12) 0%,
    rgba(24, 19, 16, 0.94) 100%
  ) !important;
  border-bottom-color: rgba(234, 114, 0, 0.2) !important;
}

html[data-theme="customer360"] .sidebar-theme-selector {
  border-top-color: rgba(234, 114, 0, 0.18) !important;
  background: rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="customer360"] .sidebar-footer {
  border-top-color: rgba(234, 114, 0, 0.18) !important;
  background: linear-gradient(
    180deg,
    rgba(14, 11, 9, 0.98) 0%,
    rgba(234, 114, 0, 0.07) 100%
  ) !important;
}

[data-theme="customer360"] .modern-sidebar .user-profile:hover {
  background: rgba(234, 114, 0, 0.08);
}

[data-theme="customer360"] .modern-sidebar .nav-items::-webkit-scrollbar-thumb {
  background: rgba(234, 114, 0, 0.28);
}

[data-theme="customer360"] .modern-sidebar .nav-items::-webkit-scrollbar-thumb:hover {
  background: rgba(234, 114, 0, 0.42);
}

/* Inline slate gradient on mobile header — replace for C360 */
html[data-theme="customer360"] .mobile-header {
  background: linear-gradient(135deg, #2a221c 0%, #1a1512 55%, #0f0c0a 100%) !important;
  border-bottom: 1px solid rgba(234, 114, 0, 0.2) !important;
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(234, 114, 0, 0.07) !important;
}

[data-theme="customer360"] .mobile-header .mobile-menu-toggle {
  border-color: rgba(234, 114, 0, 0.24) !important;
  background: rgba(234, 114, 0, 0.09) !important;
}

[data-theme="customer360"] .mobile-overlay {
  background: rgba(10, 7, 5, 0.55) !important;
}

[data-theme="customer360"] .sidebar-logo-stage::before {
  background:
    radial-gradient(ellipse 50% 85% at 20% 50%, rgba(234, 114, 0, 0.32) 0%, transparent 62%),
    radial-gradient(ellipse 35% 70% at 38% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 58%),
    conic-gradient(from 210deg at 22% 50%, transparent 0deg, rgba(234, 114, 0, 0.14) 38deg, transparent 76deg);
}

[data-theme="customer360"] .sidebar-logo-stage::after {
  background:
    linear-gradient(
      118deg,
      transparent 0%,
      rgba(255, 255, 255, 0) 34%,
      rgba(255, 255, 255, 0.32) 48%,
      rgba(255, 200, 150, 0.18) 51%,
      rgba(255, 255, 255, 0) 64%,
      transparent 100%
    ),
    linear-gradient(
      102deg,
      transparent 0%,
      rgba(255, 255, 255, 0) 40%,
      rgba(255, 255, 255, 0.12) 50%,
      rgba(255, 255, 255, 0) 58%,
      transparent 100%
    );
}

[data-theme="customer360"] .modern-sidebar .nav-section-header i {
  color: var(--primary-color);
}

[data-theme="customer360"] .modern-sidebar .nav-item-icon {
  color: var(--primary-light);
}

[data-theme="customer360"] .modern-sidebar .nav-item:hover {
  background: rgba(234, 114, 0, 0.12);
  color: #ffc266 !important;
  border-color: rgba(234, 114, 0, 0.35);
}

[data-theme="customer360"] .modern-sidebar .nav-item:hover .nav-item-title {
  color: #ffc266 !important;
}

[data-theme="customer360"] .modern-sidebar .nav-item:hover .nav-item-desc {
  color: rgba(255, 220, 180, 0.85) !important;
}

[data-theme="customer360"] .modern-sidebar .nav-item.active {
  background: linear-gradient(135deg, rgba(234, 114, 0, 0.2) 0%, rgba(180, 70, 0, 0.12) 100%);
  color: #ffb347 !important;
  border-color: rgba(234, 114, 0, 0.45);
  box-shadow: 0 2px 10px rgba(234, 114, 0, 0.22);
}

[data-theme="customer360"] .modern-sidebar .nav-item.active .nav-item-title {
  color: #ffb347 !important;
}

[data-theme="customer360"] .modern-sidebar .nav-item.active .nav-item-desc {
  color: rgba(255, 210, 170, 0.9) !important;
}

[data-theme="customer360"] .modern-sidebar .nav-item:hover .nav-item-icon,
[data-theme="customer360"] .modern-sidebar .nav-item.active .nav-item-icon {
  background: rgba(234, 114, 0, 0.28);
  color: #fff;
}

[data-theme="customer360"] .modern-sidebar .theme-option.active {
  background: linear-gradient(135deg, rgba(234, 114, 0, 0.2) 0%, rgba(180, 70, 0, 0.12) 100%);
  color: #ffb347 !important;
  border-color: rgba(234, 114, 0, 0.45);
  box-shadow: 0 2px 10px rgba(234, 114, 0, 0.22);
}

[data-theme="customer360"] .modern-sidebar .user-avatar {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 55%, var(--primary-dark) 100%);
  box-shadow: 0 4px 14px rgba(234, 114, 0, 0.4);
}

[data-theme="customer360"] .modern-sidebar .dropdown-item i.text-primary,
[data-theme="customer360"] .modern-sidebar .dropdown-item:not(.text-danger) i {
  color: var(--primary-color);
}

[data-theme="customer360"] .modern-sidebar .btn-link.text-light:hover,
[data-theme="customer360"] .modern-sidebar .btn-link.text-light:focus {
  color: var(--primary-light) !important;
}

/* Mobile top bar: match accent on menu control */
[data-theme="customer360"] .mobile-header .mobile-menu-toggle:hover,
[data-theme="customer360"] .mobile-header .mobile-menu-toggle:focus {
  border-color: rgba(234, 114, 0, 0.45) !important;
  background: rgba(234, 114, 0, 0.15) !important;
  color: #ffc266 !important;
}

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .modern-sidebar, .btn, .nav-tabs, .pagination { display: none !important; }
  .page-header { background: none !important; border-bottom: 1px solid #000 !important; }
  .card { border: 1px solid #000 !important; box-shadow: none !important; }
  .table { border-collapse: collapse !important; }
  .table th, .table td { border: 1px solid #000 !important; }
  .modern-member-item { break-inside: avoid; box-shadow: none !important; border: 1px solid #000 !important; }
}

/* ─── Spacing overrides (more compact than default Bootstrap) ────────────── */
.mb-4 { margin-bottom: 0.75rem !important; }
.mt-4 { margin-top: 0.75rem !important; }
.py-4 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }

/* ─── Campaign Members Layout ────────────────────────────────────────────── */
.campaign-members-container { display: flex; flex-direction: column; gap: 0.75rem; }

@media (min-width: 992px) {
  .campaign-members-container { flex-direction: row; gap: 1rem; }
  .campaign-members-container > .col-lg-6 { flex: 1; min-width: 0; }
}

.list-group { width: 100%; }
.list-group-item { width: 100%; display: block; }
.modern-member-item { width: 100% !important; display: flex !important; flex-direction: column !important; }
.modern-member-item > div { width: 100%; }
.modern-member-item .d-flex { width: 100% !important; min-width: 100% !important; }
.modern-member-item .member-info { flex: 1 1 auto !important; min-width: 0 !important; max-width: calc(100% - 36px) !important; }
.modern-member-item .member-name,
.modern-member-item .member-email,
.modern-member-item .member-id { width: 100% !important; max-width: 100% !important; }
