:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-canvas: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  --border-color: #e2e8f0;
  --border-dark: #334155;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --sidebar-width: 260px;
  --header-height: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Auth Page Layout */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 2.25rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Dashboard & App Shell */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-canvas);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-primary);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.95);
  flex-shrink: 0;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  flex-shrink: 0;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sidebar-header-badge {
  flex-shrink: 0;
}

.tenant-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  color: #cbd5e1;
  display: inline-block;
  white-space: nowrap;
}

.tenant-badge.super-admin {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.18s ease;
  min-height: 44px;
  text-decoration: none;
}

.nav-icon {
  flex-shrink: 0;
  color: #94a3b8;
  transition: color 0.18s ease, transform 0.18s ease;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  text-decoration: none;
}

.nav-link:hover .nav-icon {
  color: #ffffff;
  transform: translateX(1px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.9) 0%, rgba(99, 102, 241, 0.85) 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  font-weight: 600;
}

.nav-link.active .nav-icon {
  color: #ffffff;
}

.sidebar-footer {
  padding: 0.875rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  flex-shrink: 0;
}

.user-card-wrap {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}

.user-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.6875rem;
  color: #94a3b8;
  text-transform: capitalize;
}

.sidebar-logout-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-bar {
  height: var(--header-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.topbar-title-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  min-width: 0;
}

.topbar-title-section h1,
.topbar-title-section h2,
.topbar-title-section .topbar-heading,
.topbar-title-section .page-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-main);
  cursor: pointer;
  min-height: 40px;
  min-width: 40px;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topbar-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #065f46;
  white-space: nowrap;
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.2fa-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.2fa-pill:hover {
  text-decoration: none;
  opacity: 0.9;
}

.topbar-user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.5rem 0.2rem 0.2rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
}

.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  padding-right: 0.25rem;
  white-space: nowrap;
}

.page-container {
  padding: 2rem 1.5rem;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Cards & Grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-card);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

.stat-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.5rem;
}

.stat-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.375rem;
}

.form-control, .form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  min-height: 44px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.w-auto {
  width: auto !important;
  min-width: 160px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  text-decoration: none;
}

.btn-secondary {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  text-decoration: none;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #dc2626;
  text-decoration: none;
}

.btn-block {
  width: 100%;
}

/* Alert Banners */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.alert-success {
  background-color: var(--success-light);
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-warning {
  background-color: var(--warning-light);
  color: #92400e;
  border-color: #fde68a;
}

.alert-danger {
  background-color: var(--danger-light);
  color: #991b1b;
  border-color: #fecaca;
}

.alert-info {
  background-color: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.info-banner {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1.25rem;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary-light);
  text-decoration: none;
}

.auth-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-link {
  padding: 0.75rem 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.tab-link:hover {
  color: var(--primary);
  text-decoration: none;
}

.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: capitalize;
  line-height: 1.25;
  letter-spacing: 0.025em;
}

.badge-success {
  background-color: var(--success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background-color: var(--warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-danger {
  background-color: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.badge-secondary, .badge-neutral {
  background-color: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Tables */
.table-responsive, .table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.bulk-action-bar + .table-container,
.bulk-action-bar + .table-responsive {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

.checkbox-col {
  width: 48px;
  text-align: center;
  padding-left: 1rem !important;
  padding-right: 0.5rem !important;
}

.checkbox-input {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: var(--primary);
  vertical-align: middle;
}

/* 2FA & Security Elements */
.qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

.secret-code-display {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  background-color: #f1f5f9;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  text-align: center;
  user-select: all;
  margin-bottom: 1.5rem;
}

.recovery-code-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.recovery-code-item {
  font-family: monospace;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  background-color: #f8fafc;
  border: 1px dashed var(--border-color);
  border-radius: 0.375rem;
  text-align: center;
}

.toggle-link-container {
  text-align: center;
  margin-top: 1.25rem;
}

.card-narrow-center {
  max-width: 600px;
  margin: 0 auto;
}

.alert-heading {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.alert-body {
  margin-bottom: 1rem;
}

.setup-instruction {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.grid-split-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto 1.5rem auto;
}

.text-right {
  text-align: right;
}

.filter-input-wrapper {
  margin-bottom: 0;
  flex: 1;
}

.code-detail {
  font-size: 0.75rem;
  font-family: monospace;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 2rem 0;
}

/* Contact Management & Import Styles */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.filter-item {
  flex: 1 1 200px;
  min-width: 180px;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.justify-end {
  justify-content: flex-end;
}

.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}

.bulk-action-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.625rem;
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: 9999px;
}

.tag-pill-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* List Card Styles */
.list-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.list-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease;
}

.list-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

.list-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.list-card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-main);
}

.list-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.list-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* Google Auth & Email Account Card Components */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-google:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  transition: box-shadow 0.2s ease;
}

.account-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

.account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.account-provider-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.provider-icon {
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.provider-icon-gmail {
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.provider-icon-smtp {
  background-color: #e0e7ff;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
}

.account-details {
  display: flex;
  flex-direction: column;
}

.account-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-main);
}

.account-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-family: monospace;
}

.account-security-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  background-color: #f1f5f9;
  color: #475569;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color);
  margin-right: 0.375rem;
}

.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background-color: #f8fafc;
  padding: 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  text-align: center;
  margin-bottom: 1rem;
}

.stat-metric {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.test-send-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 0.75rem;
}

.account-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background-color: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
}

.upload-dropzone:hover {
  border-color: var(--primary);
  background-color: #f1f5f9;
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.upload-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.upload-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

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

@media (max-width: 1024px) {
  .grid-split-2 {
    grid-template-columns: 1fr;
  }
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 35;
}

.sidebar-backdrop.active {
  display: block;
}

.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.w-auto { width: auto; }
.justify-end { justify-content: flex-end; }
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  min-height: 32px;
}

.hidden {
  display: none !important;
}

.upload-dropzone.drag-active {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.upload-selected-file {
  margin-top: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.875rem;
}

.checkbox-col {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.checkbox-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 44px;
}

.tab-link:hover {
  color: var(--primary);
  text-decoration: none;
}

.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.list-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.list-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.list-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.list-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.list-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex: 1;
}

.list-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.list-member-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.list-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.875rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.account-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07);
}

.account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.account-provider-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.provider-icon {
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.provider-icon-gmail {
  background-color: #fee2e2;
  color: #ea4335;
  border: 1px solid #fca5a5;
}

.provider-icon-smtp {
  background-color: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.account-details {
  min-width: 0;
}

.account-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-family: monospace;
  word-break: break-all;
}

.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0.875rem;
  background-color: #f8fafc;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  margin: 1rem 0;
  text-align: center;
}

.stat-metric {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.125rem;
}

.account-security-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #047857;
  background-color: #ecfdf5;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid #a7f3d0;
  font-weight: 600;
}

.account-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background-color: #ffffff;
  color: #3c4043;
  border: 1px solid #dadce0;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.15s ease;
  min-height: 44px;
}

.btn-google:hover {
  background-color: #f8f9fa;
  border-color: #c6c6c6;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}

.test-send-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.875rem;
  margin-top: 0.75rem;
}

/* Template Management & Sanitization Engine */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  border-color: #cbd5e1;
}

.template-card-preview {
  height: 180px;
  background-color: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-card-iframe {
  width: 200%;
  height: 200%;
  transform: scale(0.5);
  transform-origin: top left;
  border: none;
  pointer-events: none;
  background: #ffffff;
}

.template-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.template-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.template-card-subject {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.template-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Template Editor Workspace */
.template-editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

.editor-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.editor-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.5rem;
  width: fit-content;
}

.editor-tab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.editor-tab-btn:hover {
  color: var(--text-main);
}

.editor-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.editor-pane {
  display: none;
}

.editor-pane.active {
  display: block;
}

.template-code-textarea {
  width: 100%;
  min-height: 480px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  background-color: #0f172a;
  color: #f8fafc;
  border: 1px solid var(--border-dark);
  border-radius: 0.5rem;
  padding: 1rem;
  resize: vertical;
  tab-size: 2;
  box-sizing: border-box;
}

.template-code-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.plain-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.plain-pane-header .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.template-plain-textarea {
  width: 100%;
  min-height: 380px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  resize: vertical;
  box-sizing: border-box;
}

.template-plain-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Variable Chips Drawer / Sidebar */
.variable-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.variable-group {
  margin-bottom: 1.25rem;
}

.variable-group:last-child {
  margin-bottom: 0;
}

.variable-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.variable-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.variable-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: 0.375rem;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
}

.variable-chip:hover {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Compliance Card */
.compliance-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 1rem;
}

.compliance-box-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.compliance-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

.compliance-status-pill.valid {
  background-color: var(--success-light);
  color: var(--success);
}

.compliance-status-pill.warning {
  background-color: var(--warning-light);
  color: var(--warning);
}

.preview-container {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 500px;
}

.preview-frame-wrapper {
  background: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  max-width: 680px;
  margin: 0 auto;
  min-height: 480px;
}

.preview-frame {
  width: 100%;
  min-height: 520px;
  border: none;
  display: block;
}

.plain-preview-box {
  background: #ffffff;
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  white-space: pre-wrap;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-main);
}

.preview-viewport-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.viewport-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-muted);
  border-radius: 0.375rem;
  cursor: pointer;
  min-height: 38px;
}

.viewport-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Campaign Engine & 7-Step Wizard Styles */
.wizard-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  gap: 0.5rem;
}

.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 44px;
}

.wizard-step-item:hover:not(.disabled) {
  text-decoration: none;
  color: var(--primary);
}

.wizard-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background-color: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.wizard-step-item.active {
  color: var(--primary);
  font-weight: 700;
}

.wizard-step-item.active .wizard-step-number {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.wizard-step-item.completed {
  color: var(--success);
}

.wizard-step-item.completed .wizard-step-number {
  background-color: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.wizard-step-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.wizard-step-arrow {
  color: #cbd5e1;
  font-size: 0.75rem;
  user-select: none;
}

.wizard-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Preflight Verification Engine Components */
.preflight-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.preflight-banner {
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.preflight-banner.pass {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.preflight-banner.warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.preflight-banner.fail {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.preflight-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.preflight-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
}

.preflight-stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.preflight-stat-number.net {
  color: var(--primary);
}

.preflight-stat-number.deducted {
  color: var(--danger);
}

.preflight-stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.preflight-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preflight-check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  transition: border-color 0.15s ease;
}

.preflight-check-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.preflight-check-icon.pass {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.preflight-check-icon.warning {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.preflight-check-icon.fail {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.preflight-check-content {
  flex: 1;
}

.preflight-check-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.preflight-check-message {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Campaign State Badges */
.badge-draft {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-scheduled {
  background-color: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
}

.badge-queued {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.badge-sending {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.badge-paused {
  background-color: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.badge-completed {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
}

.badge-cancelled {
  background-color: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.badge-failed {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* Campaign Metrics Cards Row */
.stats-counters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.counter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
}

.counter-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.counter-lbl {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Campaign Summary Review Grid */
.campaign-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.summary-spec-group {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
}

.summary-spec-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.summary-spec-val {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .template-editor-layout {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .campaign-summary-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }
}

@media (max-width: 480px) {
  .grid-cards {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }

  .stats-counters-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .preflight-stats-grid {
    grid-template-columns: 1fr;
  }

  .campaign-summary-grid {
    grid-template-columns: 1fr;
  }

  .wizard-stepper {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.75rem;
    -webkit-overflow-scrolling: touch;
  }

  .wizard-navigation {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .wizard-navigation .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .editor-header-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-tabs {
    width: 100%;
    display: flex;
    justify-content: stretch;
  }

  .editor-tab-btn {
    flex: 1;
    min-height: 44px;
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
  }

  .variable-chip {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
  }

  .template-code-textarea {
    min-height: 320px;
    font-size: 0.8125rem;
  }

  .page-container {
    padding: 1rem 0.75rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .card {
    padding: 1rem;
  }

  .health-alert-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .timeframe-selector {
    width: 100%;
    justify-content: space-between;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .provider-grid {
    grid-template-columns: 1fr;
  }

  .privacy-option-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Phase 10: SaaS Dashboard, Health Alerts, Performance Charts, & Privacy Styles
   ========================================================================== */

/* Security & Deliverability Health Alerts */
.health-alerts-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.health-alert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
}

.health-alert-warning {
  border: 1px solid #fde047;
  background-color: #fefce8;
  color: #713f12;
}

.health-alert-danger {
  border: 1px solid #fca5a5;
  background-color: #fef2f2;
  color: #991b1b;
}

.health-alert-content {
  flex: 1;
}

.health-alert-title {
  font-weight: 700;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.health-alert-desc {
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0.9;
}

.health-alert-btn {
  white-space: nowrap;
  min-height: 44px;
}

/* Timeframe Selector */
.timeframe-selector {
  display: flex;
  gap: 0.25rem;
  background-color: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.timeframe-btn {
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.timeframe-btn:hover {
  color: var(--text-color);
}

.timeframe-btn.active {
  background-color: #ffffff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* Rates & Metric Badges */
.metric-rate-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.375rem;
}

.badge-rate-success {
  background-color: #dcfce7;
  color: #166534;
}

.badge-rate-neutral {
  background-color: #f1f5f9;
  color: #475569;
}

.badge-rate-warning {
  background-color: #fef9c3;
  color: #854d0e;
}

.badge-rate-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Responsive SVG Performance Chart */
.chart-card {
  margin-bottom: 2rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.chart-legend {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8125rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-sent { background-color: #3b82f6; }
.dot-delivered { background-color: #10b981; }
.dot-opens { background-color: #8b5cf6; }
.dot-clicks { background-color: #f59e0b; }
.dot-bounces { background-color: #ef4444; }

.chart-svg-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.svg-performance-chart {
  width: 100%;
  min-width: 520px;
  height: auto;
  max-height: 280px;
  display: block;
}

/* Provider Status Cards */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.provider-card {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.provider-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.provider-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-color);
}

.provider-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  word-break: break-all;
}

.quota-meter-container {
  margin-top: 1rem;
}

.quota-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.quota-progress-meter {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 9999px;
  background-color: #e2e8f0;
  overflow: hidden;
}

.quota-progress-meter::-webkit-progress-bar {
  background-color: #e2e8f0;
  border-radius: 9999px;
}

.quota-progress-meter.quota-normal::-webkit-progress-value {
  background-color: #10b981;
}

.quota-progress-meter.quota-warning::-webkit-progress-value {
  background-color: #f59e0b;
}

.quota-progress-meter.quota-critical::-webkit-progress-value {
  background-color: #ef4444;
}

.quota-progress-meter.quota-normal::-moz-progress-bar {
  background-color: #10b981;
}

.quota-progress-meter.quota-warning::-moz-progress-bar {
  background-color: #f59e0b;
}

.quota-progress-meter.quota-critical::-moz-progress-bar {
  background-color: #ef4444;
}

/* Privacy Settings Form & Toggles */
.privacy-options-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.privacy-option-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.privacy-option-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.privacy-info {
  flex: 1;
}

.privacy-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.privacy-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Custom CSS Toggle Switch */
.custom-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.custom-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s ease;
  border-radius: 34px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.2s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.custom-switch input:checked + .switch-slider {
  background-color: var(--primary-color);
}

.custom-switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Quick Demo Credentials Box */
.demo-credentials-card {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background-color: var(--bg-hover, #f8fafc);
  border: 1px dashed var(--border-color, #cbd5e1);
  border-radius: 0.5rem;
}

.demo-credentials-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.demo-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.demo-fill-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  background-color: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-main, #0f172a);
  transition: all 0.15s ease-in-out;
  text-align: left;
}

.demo-fill-btn:hover {
  background-color: #eff6ff;
  border-color: var(--primary-color, #2563eb);
}

.demo-fill-email {
  font-weight: 600;
  color: var(--text-main, #0f172a);
}

.demo-role-badge {
  font-size: 0.6875rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 0.25rem;
  background-color: #f1f5f9;
  color: #475569;
  font-weight: 600;
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-container {
  background-color: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--text-main, #0f172a);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
  background-color: var(--bg-canvas, #f8fafc);
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  min-height: 36px;
}

.toggle-card-box {
  background-color: var(--bg-canvas, #f8fafc);
  border: 1px dashed var(--border-color, #cbd5e1);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 0.75rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main, #0f172a);
  cursor: pointer;
  user-select: none;
}

.hidden {
  display: none !important;
}

.filter-bar-grid {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-bar-grid .form-input,
.filter-bar-grid .form-select {
  flex: 1 1 160px;
  min-width: 130px;
}

.filter-bar-grid .btn {
  flex-shrink: 0;
  min-height: 42px;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   WYSIWYG Visual Template & Email Composer Suite
   ========================================================================== */
.wysiwyg-editor-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wysiwyg-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  user-select: none;
}

.wysiwyg-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.125rem 0.25rem;
  border-right: 1px solid #e2e8f0;
  margin-right: 0.25rem;
}

.wysiwyg-tool-group:last-child {
  border-right: none;
  margin-right: 0;
}

.wysiwyg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.375rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  color: var(--text-main, #334155);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.wysiwyg-btn:hover {
  background-color: #e2e8f0;
  color: var(--primary, #4f46e5);
}

.wysiwyg-btn:active,
.wysiwyg-btn.active {
  background-color: #e0e7ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.wysiwyg-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.wysiwyg-select {
  height: 34px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-main, #334155);
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.wysiwyg-select:focus {
  border-color: var(--primary, #4f46e5);
}

.wysiwyg-color-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.wysiwyg-color-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.wysiwyg-color-indicator {
  display: block;
  width: 16px;
  height: 3px;
  background-color: currentColor;
  margin-top: 2px;
  border-radius: 1px;
}

.wysiwyg-canvas-workspace {
  background-color: #f1f5f9;
  padding: 1.5rem 1rem;
  min-height: 480px;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

.wysiwyg-canvas {
  width: 100%;
  max-width: 650px;
  min-height: 460px;
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 2rem;
  font-family: Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

.wysiwyg-canvas:focus {
  border-color: #94a3b8;
}

.wysiwyg-canvas p {
  margin: 0 0 1rem 0;
}

.wysiwyg-canvas h1,
.wysiwyg-canvas h2,
.wysiwyg-canvas h3 {
  margin: 1rem 0 0.75rem 0;
  color: #0f172a;
  line-height: 1.3;
}

.wysiwyg-canvas img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5rem 0;
}

.wysiwyg-canvas blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--primary, #4f46e5);
  background-color: #f8fafc;
  color: #475569;
}

.wysiwyg-canvas ul,
.wysiwyg-canvas ol {
  margin: 0 0 1rem 1.5rem;
}

.wysiwyg-canvas a {
  color: var(--primary, #4f46e5);
  text-decoration: underline;
}

/* Modal Dialog for Link & Image Insert */
/* ==========================================================================
   Gmail-Style Email Composer Layout & WYSIWYG Suite
   ========================================================================== */

.gmail-composer-container {
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  position: relative;
  margin-bottom: 1.5rem;
}

.gmail-composer-body {
  flex: 1;
  min-height: 380px;
  max-height: 650px;
  overflow-y: auto;
  background-color: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
}

.gmail-composer-canvas {
  flex: 1;
  min-height: 380px;
  padding: 1.5rem;
  color: #1e293b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  box-sizing: border-box;
  word-break: break-word;
  direction: ltr !important;
  text-align: left;
  unicode-bidi: isolate;
  display: block;
}

.gmail-composer-canvas p,
.gmail-composer-canvas div,
.gmail-composer-canvas h1,
.gmail-composer-canvas h2,
.gmail-composer-canvas h3,
.gmail-composer-canvas h4 {
  direction: ltr;
}

.gmail-composer-canvas:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
  display: block;
}

.gmail-composer-canvas p {
  margin: 0 0 1rem 0;
}

.gmail-composer-canvas h1,
.gmail-composer-canvas h2,
.gmail-composer-canvas h3 {
  margin: 1.25rem 0 0.75rem 0;
  color: #0f172a;
  line-height: 1.3;
}

.gmail-composer-canvas img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5rem 0;
  display: inline-block;
  cursor: pointer;
  transition: outline 0.15s ease;
}

.gmail-composer-canvas img:hover,
.gmail-composer-canvas img.selected {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.gmail-composer-canvas blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 4px solid #6366f1;
  background-color: #f8fafc;
  color: #475569;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.gmail-composer-canvas ul,
.gmail-composer-canvas ol {
  margin: 0 0 1rem 1.75rem;
  padding: 0;
}

.gmail-composer-canvas a {
  color: #4f46e5;
  text-decoration: underline;
}

.gmail-composer-source {
  padding: 1rem;
  background-color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}

.gmail-composer-source textarea {
  width: 100%;
  min-height: 360px;
  background-color: transparent;
  color: #f1f5f9;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  border: none;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
}

/* Docked Formatting Toolbar (Above Bottom Action Bar) */
.gmail-composer-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background-color: #ffffff;
  border-top: 1px solid #edf2f7;
  border-bottom: 1px solid #edf2f7;
  transition: all 0.2s ease;
}

.gmail-composer-toolbar.collapsed {
  display: none;
}

.gmail-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  position: relative;
}

.gmail-tool-group + .gmail-tool-group:before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 18px;
  background-color: #e2e8f0;
  margin: 0 0.25rem;
}

.gmail-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.gmail-tool-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.gmail-tool-btn.active,
.gmail-tool-btn:active {
  background-color: #ede9fe;
  color: #6366f1;
  border-color: #ddd6fe;
}

.gmail-tool-select {
  height: 30px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #334155;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

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

/* Color Dropdown Popover */
.gmail-color-picker-wrap {
  position: relative;
  display: inline-block;
}

.gmail-color-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  padding: 0.75rem;
  min-width: 220px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.color-dropdown-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.color-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.gmail-color-input {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

/* Bottom Action Bar (Matching screenshot perfectly) */
.gmail-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  position: relative;
  gap: 0.75rem;
}

.gmail-action-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gmail-action-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

/* Purple Send / Save Pill with Split Dropdown */
.gmail-send-group {
  display: inline-flex;
  align-items: stretch;
  background-color: #6d28d9;
  border-radius: 9999px;
  overflow: visible;
  position: relative;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gmail-send-group:hover {
  background-color: #5b21b6;
  box-shadow: 0 4px 10px rgba(91, 33, 182, 0.4);
}

.gmail-send-btn {
  background: transparent;
  color: #ffffff;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  outline: none;
  border-top-left-radius: 9999px;
  border-bottom-left-radius: 9999px;
}

.gmail-send-split-btn {
  background: transparent;
  color: #ffffff;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
  border-top-right-radius: 9999px;
  border-bottom-right-radius: 9999px;
  transition: background-color 0.15s ease;
}

.gmail-send-split-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.gmail-send-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 100;
  overflow: hidden;
  padding: 0.25rem 0;
}

.gmail-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  font-size: 0.8125rem;
  color: #334155;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.gmail-menu-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

/* Icon Buttons on Action Bar */
.gmail-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: #475569;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.gmail-action-icon-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.gmail-action-icon-btn.active {
  background-color: #ede9fe;
  color: #6d28d9;
}

.gmail-action-icon-btn.highlight {
  color: #6d28d9;
}

.gmail-action-icon-btn.danger:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

.action-icon-a {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: serif;
}

/* Personalization Tokens Popover */
.gmail-token-popover-wrap {
  position: relative;
  display: inline-block;
}

.gmail-token-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  min-width: 240px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  padding: 0.35rem 0;
}

.token-dropdown-header {
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f1f5f9;
}

.token-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.85rem;
  background: transparent;
  border: none;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: #4f46e5;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.token-dropdown-item span {
  font-family: var(--font-sans, sans-serif);
  font-size: 0.75rem;
  color: #64748b;
}

.token-dropdown-item:hover {
  background-color: #f1f5f9;
  color: #4338ca;
}

.gmail-save-status {
  font-size: 0.8125rem;
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s ease;
  user-select: none;
}

.gmail-save-status:hover {
  color: #0f172a;
}

/* ================= Modal Dialogs for Link & Image Insert ================= */
.wysiwyg-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wysiwyg-modal-content {
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 500px;
  padding: 1.5rem;
  box-sizing: border-box;
}

.wysiwyg-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.wysiwyg-modal-header h3,
.wysiwyg-modal-header .modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.wysiwyg-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.15s ease;
}

.wysiwyg-modal-close:hover {
  color: #0f172a;
}

.modal-tab-group {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.modal-tab {
  background: transparent;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.modal-tab.active {
  background-color: #ede9fe;
  color: #6d28d9;
}

.wysiwyg-image-preview-box {
  min-height: 120px;
  max-height: 240px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  background-color: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
}

.wysiwyg-image-preview-box img {
  max-height: 180px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.wysiwyg-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

/* ================= Interactive Crop Modal Styles ================= */
.wysiwyg-crop-modal-content {
  max-width: 680px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.crop-aspect-ratio-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.crop-bar-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin-right: 0.25rem;
}

.crop-ratio-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.crop-ratio-btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.crop-ratio-btn.active {
  background-color: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
}

.crop-stage-container {
  position: relative;
  width: 100%;
  height: 350px;
  background-color: #0f172a;
  border-radius: 0.5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.crop-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.crop-box {
  position: absolute;
  border: 2px dashed #818cf8;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.6);
  cursor: move;
  box-sizing: border-box;
  touch-action: none;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: #ffffff;
  border: 2px solid #6366f1;
  border-radius: 2px;
  box-sizing: border-box;
}

.crop-handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.crop-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.crop-zoom-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.crop-zoom-slider {
  flex: 1;
  max-width: 200px;
  accent-color: #4f46e5;
}

/* ================= Floating Image Toolbar ================= */
.wysiwyg-floating-image-toolbar {
  position: absolute;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background-color: #0f172a;
  color: #f8fafc;
  padding: 0.35rem 0.55rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  font-size: 0.8125rem;
  pointer-events: auto;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.image-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.image-toolbar-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 0.2rem;
}

.image-toolbar-btn {
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
  line-height: 1;
}

.image-toolbar-btn:hover {
  background-color: #334155;
  color: #ffffff;
}

.image-toolbar-btn.active {
  background-color: #4f46e5;
  color: #ffffff;
}

.image-toolbar-btn.danger:hover {
  background-color: #dc2626;
  color: #ffffff;
}

.image-toolbar-separator {
  width: 1px;
  height: 18px;
  background-color: #334155;
  margin: 0 0.2rem;
}

/* ================= Floating Link Toolbar ================= */
.wysiwyg-floating-link-toolbar {
  position: absolute;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.4rem 0.7rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  font-size: 0.8125rem;
  pointer-events: auto;
}

.link-toolbar-preview {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #94a3b8;
}

.floating-link-url {
  color: #818cf8;
  text-decoration: underline;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}

.floating-link-url:hover {
  color: #a5b4fc;
}

.link-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border-left: 1px solid #334155;
  padding-left: 0.5rem;
}

.link-toolbar-btn {
  background-color: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.link-toolbar-btn:hover {
  background-color: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
}

/* Additional Admin Layout & Dashboard Components */
.action-buttons, .action-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.timeframe-selector {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  gap: 0.25rem;
}

.timeframe-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 0.375rem;
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.timeframe-btn:hover {
  color: var(--text-main);
  text-decoration: none;
}

.timeframe-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.health-alerts-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.health-alert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 0.625rem;
  border: 1px solid transparent;
}

.health-alert-danger {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.health-alert-warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.health-alert-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.health-alert-title {
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.health-alert-desc {
  font-size: 0.8125rem;
  opacity: 0.9;
}

.health-alert-btn {
  white-space: nowrap;
}

.metric-rate-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  margin-top: 0.5rem;
}

.badge-rate-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-rate-neutral {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.stats-counters-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.counter-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.counter-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.counter-val {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.counter-lbl {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

.filter-form {
  width: 100%;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1 1 240px;
}

.filter-bar-grid {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-bar-grid .form-input,
.filter-bar-grid .form-select {
  flex: 1 1 180px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-container {
  background: #ffffff;
  border-radius: 0.875rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.375rem;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background-color: #f1f5f9;
}

/* Campaign Creation Wizard Stepper */
.wizard-container {
  width: 100%;
}

.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  min-height: 40px;
}

.wizard-step-item:hover {
  text-decoration: none;
  color: var(--text-main);
  background: #f8fafc;
}

.wizard-step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-step-item.active {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
}

.wizard-step-item.active .wizard-step-number {
  background: var(--primary);
  color: #ffffff;
}

.wizard-step-item.completed {
  color: #065f46;
}

.wizard-step-item.completed .wizard-step-number {
  background: #10b981;
  color: #ffffff;
}

.wizard-step-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.wizard-step-arrow {
  color: #cbd5e1;
  font-size: 0.875rem;
}

.wizard-body {
  padding: 1.75rem;
}

/* Template Editor Page Layout */
.template-editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

.template-editor-main {
  min-width: 0;
}

.template-editor-sidebar {
  min-width: 0;
}

.editor-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  background-color: #f8fafc;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.editor-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: #e2e8f0;
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.editor-tab-btn {
  border: none;
  background: transparent;
  padding: 0.4rem 0.875rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
  white-space: nowrap;
}

.editor-tab-btn:hover {
  color: var(--text-main);
}

.editor-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.editor-actions-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.editor-pane {
  display: none;
}

.editor-pane.active {
  display: block;
}

/* Variable Chips & Compliance Guide Sidebar */
.variable-panel {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.variable-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.variable-group {
  margin-bottom: 1.25rem;
}

.variable-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.variable-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.variable-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.variable-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.compliance-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  padding: 1rem;
  margin-top: 1rem;
}

.compliance-box-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.compliance-status-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compliance-status-pill.valid {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.compliance-status-pill.warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Live Preview Frame & Viewport Controls */
.preview-viewport-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
}

.viewport-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  padding: 0.35rem 0.875rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
}

.viewport-btn:hover {
  color: var(--text-main);
  border-color: #94a3b8;
}

.viewport-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}

.preview-container {
  padding: 1.5rem;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-frame-wrapper {
  width: 100%;
  max-width: 680px;
  background: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-radius 0.3s ease;
}

.preview-frame-wrapper.mobile-viewport {
  max-width: 375px;
  border-radius: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.04), 0 0 0 6px #e2e8f0;
}

.preview-frame {
  width: 100%;
  height: 540px;
  border: none;
  display: block;
  transition: height 0.3s ease;
}

.preview-frame-wrapper.mobile-viewport .preview-frame {
  height: 667px;
}

.plain-preview-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #334155;
  max-height: 250px;
  overflow-y: auto;
}

/* Role Preview & Permissions Matrix Components */
.tab-pane {
  display: block;
}

.tab-pane.hidden {
  display: none !important;
}

.role-preview-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  padding: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 1.25rem;
  transition: all 0.2s ease;
}

.role-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.role-preview-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-main);
}

.role-preview-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.75rem;
}

.role-preview-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.role-preview-list-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.role-preview-ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.role-oversight-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: #4f46e5;
  font-weight: 500;
  line-height: 1.4;
}

.role-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.role-info-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.role-info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.role-info-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.role-info-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.role-info-card-summary {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.875rem;
}

.role-capabilities-box {
  background: #f8fafc;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.role-capability-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.75rem;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.role-capability-list.restricted {
  color: #94a3b8;
}

.role-capability-list li span {
  font-weight: 700;
  margin-right: 0.25rem;
}

.role-oversight-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Comprehensive Responsive Breakpoints (Mobile, Tablet, Desktop)
   ========================================================================== */

/* Tablet & Mobile Breakpoint (<= 1024px) */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-split-2 {
    grid-template-columns: 1fr;
  }

  .template-editor-layout {
    grid-template-columns: 1fr;
  }

  .stats-counters-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Small Tablet & Large Mobile (<= 768px) */
@media (max-width: 768px) {
  .top-bar {
    padding: 0 1rem;
  }

  .page-container {
    padding: 1.25rem 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.875rem;
  }

  .page-header .action-buttons,
  .page-header .action-buttons-group,
  .page-header .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row .flex-1,
  .form-row .form-group,
  .form-row .btn {
    width: 100%;
  }

  .filter-bar-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar-grid .form-input,
  .filter-bar-grid .form-select,
  .filter-bar-grid .btn {
    width: 100%;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }

  .stats-counters-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .health-alert-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .health-alert-btn {
    width: 100%;
    text-align: center;
  }

  .gmail-action-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .gmail-action-left {
    width: 100%;
    justify-content: flex-start;
    gap: 0.25rem;
  }

  .gmail-action-right {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
  }

  .gmail-composer-toolbar {
    gap: 0.25rem;
    padding: 0.4rem;
  }

  .gmail-tool-btn,
  .gmail-action-icon-btn {
    min-width: 38px;
    min-height: 38px;
  }

  .gmail-tool-select {
    max-width: 100px;
    font-size: 0.75rem;
  }

  .gmail-composer-canvas {
    padding: 1rem;
    min-height: 300px;
  }
}

/* Mobile Screens (<= 480px) */
@media (max-width: 480px) {
  .grid-cards {
    grid-template-columns: 1fr;
  }

  .stats-counters-row {
    grid-template-columns: 1fr;
  }

  .recovery-code-grid {
    grid-template-columns: 1fr;
  }

  .role-preview-lists {
    grid-template-columns: 1fr;
  }

  .role-cards-grid {
    grid-template-columns: 1fr;
  }

  .topbar-user-name {
    display: none;
  }

  .topbar-status-indicator .status-pulse-text {
    display: none;
  }

  .topbar-status-indicator {
    padding: 0.35rem;
  }

  .timeframe-selector {
    width: 100%;
    justify-content: space-between;
  }

  .timeframe-btn {
    flex: 1;
    justify-content: center;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
  }

  .account-stats-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    min-height: 44px;
    font-size: 0.8125rem;
  }

  .gmail-tool-group + .gmail-tool-group:before {
    display: none;
  }

  .gmail-composer-toolbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 0.5rem 0.25rem;
    scrollbar-width: thin;
  }

  .gmail-tool-select {
    max-width: 85px;
  }

  .gmail-send-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
  }

  .plain-pane-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .plain-pane-header .btn {
    width: 100%;
  }

  .crop-stage-container {
    height: 240px;
  }

  .wysiwyg-floating-image-toolbar {
    flex-wrap: wrap;
    max-width: calc(100vw - 32px);
    padding: 0.35rem;
  }

  .image-toolbar-btn {
    min-height: 44px;
    padding: 0.4rem 0.6rem;
  }

  .wysiwyg-floating-link-toolbar {
    flex-wrap: wrap;
    max-width: calc(100vw - 32px);
  }

  .link-toolbar-btn {
    min-height: 44px;
    padding: 0.4rem 0.6rem;
  }
}

/* ==========================================================================
   Dashboard Modules Operational Hub & Quick Actions
   ========================================================================== */
.dashboard-quick-hub {
  padding: 0.875rem 1.25rem;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
}

.dashboard-quick-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.625rem;
}

.dashboard-quick-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #64748b);
}

.dashboard-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 500;
  min-height: 38px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.quick-action-btn:hover {
  background: #eef2ff;
  border-color: var(--primary, #4f46e5);
  color: var(--primary, #4f46e5);
  text-decoration: none;
}

.queue-sync-btn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.queue-sync-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

/* Modules Hub 5-Card Grid */
.module-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.module-hub-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.module-hub-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.module-hub-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.module-hub-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}

.icon-contacts {
  background: #e0e7ff;
  color: #4f46e5;
}

.icon-campaigns {
  background: #ecfdf5;
  color: #059669;
}

.icon-templates {
  background: #fef3c7;
  color: #d97706;
}

.icon-providers {
  background: #f3e8ff;
  color: #7c3aed;
}

.icon-staff {
  background: #e0f2fe;
  color: #0284c7;
}

.module-hub-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
}

.module-hub-count {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  line-height: 1.2;
}

.module-hub-meta {
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.75rem;
  flex-grow: 1;
}

.module-hub-footer {
  border-top: 1px solid var(--border-color, #e2e8f0);
  padding-top: 0.5rem;
}

.module-hub-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary, #4f46e5);
}

.module-hub-link:hover {
  text-decoration: underline;
}

/* Compact Providers & Templates */
.provider-compact-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.provider-compact-item {
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
}

.recent-templates-hub-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.template-hub-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
}

.template-hub-info {
  flex: 1;
  min-width: 0;
  padding-right: 0.5rem;
}

.template-hub-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-hub-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 768px) {
  .module-hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .module-hub-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-quick-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-action-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .template-hub-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .template-hub-actions {
    width: 100%;
    justify-content: flex-end;
  }
}


/* ==========================================================================
   Polish layer: consistent spacing, depth and responsive grids.
   Loaded last so it refines the base styles above without rewriting them.
   ========================================================================== */

:root {
  --bg-canvas: #f5f7fb;
  --border-color: #e6e9f0;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 10px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.22);
  --radius-card: 0.875rem;
}

body {
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- Sidebar brand: subtitle on one line, tenant badge on its own row --------------- */
.sidebar-header {
  height: auto;
  min-height: var(--header-height);
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.25rem;
}

.brand-subtitle {
  white-space: nowrap;
  font-size: 0.625rem;
  letter-spacing: 0.06em;
}

.sidebar-header-badge {
  flex-basis: 100%;
}

.tenant-badge {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0.5rem;
  padding: 0.35rem 0.625rem;
  font-size: 0.75rem;
}

.nav-link {
  min-height: 40px;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

/* ---- Top bar ------------------------------------------------------------------------- */
.top-bar {
  background-color: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  box-shadow: var(--shadow-xs);
}

/* ---- Cards ------------------------------------------------------------------------- */
.card,
.template-card,
.account-card,
.counter-card,
.table-responsive,
.table-container {
  border-radius: var(--radius-card);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.template-card,
.account-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.template-card:hover,
.account-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d5dae6;
  transform: translateY(-1px);
}

.stat-value {
  font-size: 2rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-title {
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

/* Six KPI tiles: 6 / 3 / 2 columns instead of a ragged 4 + 2 */
.grid-cards-kpi {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.grid-cards-kpi .card {
  padding: 1.25rem;
}

@media (max-width: 1280px) {
  .grid-cards-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .grid-cards-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Counter rows adapt to however many counters a page shows (5 on campaign detail, 6 on index) */
.stats-counters-row {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.counter-card {
  font-variant-numeric: tabular-nums;
}

/* ---- Buttons ----------------------------------------------------------------------- */
.btn {
  letter-spacing: 0.005em;
  box-shadow: var(--shadow-xs);
}

.btn-primary {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
}

.btn:focus-visible,
.nav-link:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  min-height: 34px;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: 0.4375rem;
}

.btn-danger-outline {
  background-color: #ffffff;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger-outline:hover {
  background-color: var(--danger-light);
  border-color: #fca5a5;
  color: #b91c1c;
  text-decoration: none;
}

/* Action rows wrap with even gaps instead of stacking one button per line */
.filter-actions,
.action-buttons-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.action-buttons-group form,
.filter-actions form {
  margin: 0;
}

.account-footer-actions {
  align-items: flex-start;
}

/* ---- Forms ------------------------------------------------------------------------- */
.form-input,
.form-select,
select.form-input,
textarea.form-input {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
  outline: none;
}

.form-row-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ---- Tables ------------------------------------------------------------------------ */
.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: #f8fafc;
}

.data-table td {
  padding: 0.875rem 1rem;
}

.data-table tbody tr {
  transition: background-color 0.12s ease;
}

.data-table tbody tr:hover {
  background-color: #f8faff;
}

/* ---- Template thumbnails: show the top of the email, not a centred fragment ---------- */
.template-card-preview {
  display: block;
  height: 200px;
  background: #ffffff;
}

.template-card-iframe {
  position: absolute;
  top: 0;
  left: 0;
}

.template-card-preview::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 48px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95));
  pointer-events: none;
}

/* ---- Chart ----------------------------------------------------------------------------- */
.svg-performance-chart text {
  font-family: var(--font-sans);
}

/* ---- Auth screens -------------------------------------------------------------------- */
.auth-wrapper {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(124, 58, 237, 0.3), transparent 60%),
    #0b1024;
}

.auth-card {
  box-shadow: 0 24px 60px -12px rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.auth-link {
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.auth-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.auth-footer-actions {
  text-align: center;
}

/* ---- Small screens ------------------------------------------------------------------- */
@media (max-width: 768px) {
  .page-container {
    padding: 1.25rem 1rem;
  }

  .page-header {
    margin-bottom: 1.25rem;
  }

  .stat-value {
    font-size: 1.625rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem;
  }
}

/* Tab bars scroll horizontally on narrow screens instead of widening the page */
.tabs-nav,
.editor-tabs {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}

.tabs-nav .tab-link,
.editor-tabs .editor-tab-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.main-wrapper,
.page-container {
  min-width: 0;
}

/* Inline search field + button */
.search-input-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.search-input-group > .form-control,
.search-input-group > .form-input {
  flex: 1 1 260px;
  min-width: 0;
}

/* Grid/flex children must be allowed to shrink so wide tables scroll inside their card
   instead of stretching the whole page on small screens */
.grid-split-2 > *,
.grid-cards > *,
.page-container > .card,
.card > .table-container,
.card > .table-responsive {
  min-width: 0;
}

@media (max-width: 768px) {
  /* Stacked filter rows: items keep their natural height (flex-basis would otherwise become height) */
  .form-row > .flex-1,
  .form-row > .form-group,
  .form-row > .btn {
    flex: 0 0 auto;
  }

  /* Keep the primary column readable; the table scrolls horizontally inside its card */
  .data-table td:first-child,
  .data-table th:first-child {
    min-width: 180px;
  }

  .data-table td:first-child.checkbox-col,
  .data-table th:first-child.checkbox-col {
    min-width: 0;
  }
}

/* Aliases for variable names used by older component styles (previously undefined) */
:root {
  --primary-color: var(--primary);
  --text-color: var(--text-main);
  --bg-hover: #f8fafc;
}

/* Branded error pages */
.error-card {
  text-align: center;
}

.error-code {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 1rem 0 0.5rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.error-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
  margin-top: 1.5rem;
}

/* ==========================================================================
   Paced Dispatch Engine Banner & Live Delivery Runner
   ========================================================================== */
.pacing-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  color: #f8fafc;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3), 0 8px 10px -6px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.pacing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

.pacing-header-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.pacing-pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pacingPulse 2s infinite;
}

@keyframes pacingPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.pacing-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
}

.pacing-gap-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(165, 180, 252, 0.3);
}

.pacing-progress-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: #cbd5e1;
}

.pacing-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.pacing-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

.pacing-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.pacing-info-block {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pacing-countdown-label {
  font-size: 0.875rem;
  color: #94a3b8;
}

.pacing-countdown-timer {
  font-size: 1.75rem;
  font-weight: 700;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pacing-next-target {
  font-size: 0.875rem;
  color: #cbd5e1;
}

.pacing-next-target strong {
  color: #ffffff;
}

.pacing-actions-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pacing-action-form {
  margin: 0;
  display: inline;
}

.pacing-btn {
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pacing-gap-quick-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pacing-quick-label {
  font-size: 0.8125rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
}

.pacing-select-input {
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pacing-select-input:hover,
.pacing-select-input:focus {
  border-color: #818cf8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.pacing-pulse-indicator.paused {
  background-color: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: none;
}

@media (max-width: 768px) {
  .pacing-banner {
    padding: 1rem;
  }

  .pacing-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .pacing-body {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .pacing-actions-block {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .pacing-gap-quick-selector {
    justify-content: space-between;
    width: 100%;
  }

  .pacing-select-input {
    flex: 1;
  }

  .pacing-btn {
    width: 100%;
  }

  .pacing-info-block {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .pacing-countdown-timer {
    font-size: 1.5rem;
  }

  .pacing-action-form,
  .pacing-btn {
    width: 100%;
  }
}

/* ==========================================================================
   Campaign Step 3: Dual Audience Scope & Contact List Selection Cards
   ========================================================================== */
.audience-scope-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.audience-option-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.125rem 1.25rem;
  background: var(--bg-card, #ffffff);
  border: 2px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
}

.audience-option-card:hover {
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.audience-option-card.active,
.audience-option-card:has(input[type="radio"]:checked) {
  border-color: var(--primary, #4f46e5);
  background: #f8faff;
  box-shadow: 0 0 0 1px var(--primary, #4f46e5), 0 4px 14px rgba(79, 70, 229, 0.12);
}

.audience-option-card input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.2rem;
  accent-color: var(--primary, #4f46e5);
  cursor: pointer;
  flex-shrink: 0;
}

.audience-option-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.audience-option-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main, #0f172a);
}

.audience-option-desc {
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
  line-height: 1.45;
  margin: 0;
}

.audience-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.audience-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.875rem;
}

.contact-list-item-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.625rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  min-height: 52px;
  user-select: none;
}

.contact-list-item-card:hover {
  border-color: var(--primary, #4f46e5);
  background: #fbfcfe;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.contact-list-item-card.selected,
.contact-list-item-card:has(input[type="checkbox"]:checked) {
  border-color: var(--primary, #4f46e5);
  background: #f5f7ff;
  box-shadow: 0 0 0 1px var(--primary, #4f46e5);
}

.contact-list-item-card input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.15rem;
  accent-color: var(--primary, #4f46e5);
  cursor: pointer;
  flex-shrink: 0;
}

.contact-list-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.contact-list-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-main, #0f172a);
  word-break: break-word;
}

.contact-list-sub {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.contact-list-desc {
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .audience-scope-options {
    grid-template-columns: 1fr;
  }

  .audience-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .audience-quick-actions {
    width: 100%;
  }

  .audience-quick-actions .btn {
    flex: 1;
    min-height: 44px;
    justify-content: center;
  }

  .list-selection-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Contacts & Audience Management: CSV Dropzone & Bulk Action Bar
   ========================================================================== */
.upload-dropzone {
  border: 2px dashed var(--border-color, #cbd5e1);
  border-radius: 0.75rem;
  background-color: var(--bg-canvas, #f8fafc);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  margin-bottom: 1.25rem;
}

.upload-dropzone:hover,
.upload-dropzone:focus-within {
  border-color: var(--primary, #4f46e5);
  background-color: rgba(79, 70, 229, 0.04);
}

.upload-dropzone.drag-over {
  border-color: var(--primary, #4f46e5);
  background-color: rgba(79, 70, 229, 0.08);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.upload-dropzone .upload-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main, #0f172a);
  margin-bottom: 0.35rem;
}

.upload-dropzone .upload-desc {
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
}

.upload-selected-file {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary, #4f46e5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.upload-selected-file::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: bold;
}

/* Bulk Action Toolbar */
.bulk-action-bar {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 0.625rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.bulk-action-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.bulk-action-controls .form-select {
  min-height: 40px;
}

#selectedCountBadge {
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.35rem 0.65rem;
}

@media (max-width: 640px) {
  .bulk-action-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .bulk-action-controls .form-select,
  .bulk-action-controls .btn {
    width: 100%;
    min-height: 44px;
  }
}

/* Radio & Checkbox Card Selection Elements */
.radio-card,
.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

.radio-card:hover,
.checkbox-card:hover {
  border-color: var(--primary);
  background: var(--bg-subtle, rgba(99, 102, 241, 0.03));
}

.radio-card input[type="radio"],
.checkbox-card input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.form-row {
  display: flex;
  gap: 1rem;
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .radio-card,
  .checkbox-card {
    width: 100%;
  }
}

/* ==========================================================================
   Text Color Utilities
   ========================================================================== */
.text-success {
  color: var(--success, #10b981) !important;
}

.text-warning {
  color: var(--warning, #f59e0b) !important;
}

.text-danger {
  color: var(--danger, #ef4444) !important;
}

.text-primary {
  color: var(--primary, #4f46e5) !important;
}

/* ==========================================================================
   Bulk Action Toolbar Info & Responsive Pagination
   ========================================================================== */
.bulk-action-pagination-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .bulk-action-pagination-info {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
  }
}

/* Platform Pagination Design System */
.pagination-wrapper {
  margin-top: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
}

.platform-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background-color: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pagination-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
}

.pagination-summary-text {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pagination-summary-text strong,
.pagination-summary-text .font-semibold {
  color: var(--text-main, #0f172a);
  font-weight: 600;
}

.pagination-page-badge {
  display: inline-block;
  background-color: var(--primary-light, #eef2ff);
  color: var(--primary, #4f46e5);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  margin-left: 0.35rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main, #0f172a);
  background-color: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background-color: var(--bg-canvas, #f8fafc);
  border-color: var(--primary, #4f46e5);
  color: var(--primary, #4f46e5);
  text-decoration: none;
}

.pagination-btn.active {
  background-color: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
  color: #ffffff;
  font-weight: 600;
  cursor: default;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.pagination-btn.disabled {
  color: var(--text-muted, #94a3b8);
  background-color: #f8fafc;
  border-color: var(--border-color, #e2e8f0);
  cursor: not-allowed;
  opacity: 0.6;
}

.pagination-nav-btn {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  font-weight: 500;
}

.pagination-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2.5rem;
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
  user-select: none;
}

@media (max-width: 768px) {
  .platform-pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
  }

  .pagination-summary {
    justify-content: center;
    text-align: center;
  }

  .pagination-controls {
    justify-content: center;
    width: 100%;
  }

  .pagination-numbers {
    max-width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .pagination-btn {
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
  }

  .pagination-nav-btn {
    padding: 0.25rem 0.5rem;
  }
}

/* ==========================================================================
   Contact Lists Dispatched Template & Message History
   ========================================================================== */

.list-campaign-history {
  margin: 1rem 0 0.875rem 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.list-campaign-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid #e2e8f0;
}

.list-campaign-history-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1e293b;
}

.list-campaign-history-title .history-icon {
  color: var(--primary, #4f46e5);
  flex-shrink: 0;
}

.list-campaign-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.5rem;
  font-size: 0.8125rem;
  color: #64748b;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
}

.list-campaign-empty svg {
  color: #94a3b8;
  flex-shrink: 0;
}

.list-campaign-items-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.list-campaign-items-scroll::-webkit-scrollbar {
  width: 5px;
}

.list-campaign-items-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.list-campaign-items-scroll::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
}

.list-campaign-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.list-campaign-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.list-campaign-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.list-campaign-template-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  max-width: 100%;
  word-break: break-word;
}

.list-campaign-template-pill svg {
  color: #6366f1;
  flex-shrink: 0;
}

.list-campaign-subject-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem;
}

.list-campaign-subject {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  word-break: break-word;
  transition: color 0.15s ease;
}

.list-campaign-subject:hover {
  color: var(--primary, #4f46e5);
  text-decoration: underline;
}

.list-campaign-name {
  font-size: 0.75rem;
  color: #64748b;
  font-style: italic;
}

.list-campaign-meta-grid {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.45rem 0;
  border-top: 1px dashed #e2e8f0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.75rem;
}

.list-campaign-meta-col {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.list-campaign-meta-label {
  font-weight: 600;
  color: #64748b;
  flex-shrink: 0;
}

.list-campaign-meta-val {
  color: #1e293b;
  word-break: break-word;
}

.list-campaign-meta-sub {
  color: #64748b;
  font-size: 0.6875rem;
}

.list-campaign-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 0.25rem;
}

.list-campaign-view-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary, #4f46e5);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  min-height: 36px;
  transition: background-color 0.15s ease;
  text-decoration: none;
}

.list-campaign-view-link:hover {
  background-color: #eef2ff;
  text-decoration: none;
}

/* Detail page dispatch history card */
.list-dispatch-history-card {
  margin-bottom: 1.5rem;
}

.list-dispatch-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.list-dispatch-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.contact-sent-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contact-sent-template {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.contact-sent-subject {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  text-decoration: none;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-sent-subject:hover {
  color: var(--primary, #4f46e5);
  text-decoration: underline;
}

.contact-sent-details {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* Media Queries for full responsiveness */
@media (max-width: 768px) {
  .list-campaign-items-scroll {
    max-height: 320px;
  }

  .list-campaign-meta-col {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
  }
}

@media (max-width: 480px) {
  .list-campaign-history {
    padding: 0.625rem;
  }

  .list-campaign-item {
    padding: 0.625rem;
  }

  .list-campaign-item-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .list-campaign-view-link {
    width: 100%;
    justify-content: center;
    background-color: #f1f5f9;
  }
}

/* ==========================================================================
   Super Admin PuTTY & SSH Command Center
   ========================================================================== */
.putty-command-center {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.putty-center-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.putty-header-left {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.putty-terminal-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.625rem;
  background: #0f172a;
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.2);
}

.putty-header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.putty-header-desc {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  line-height: 1.45;
}

.putty-root-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #334155;
}

.putty-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.putty-search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 380px;
}

.putty-search-input {
  width: 100%;
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.15s ease;
}

.putty-search-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.putty-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.putty-pills-list {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.putty-pill-btn {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  padding: 0.375rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 32px;
}

.putty-pill-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.putty-pill-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 4px -1px rgba(15, 23, 42, 0.2);
}

.putty-group {
  margin-bottom: 2rem;
}

.putty-group:last-child {
  margin-bottom: 0;
}

.putty-group-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.875rem;
}

.putty-group-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.putty-group-count {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 1rem;
  font-weight: 600;
}

.putty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 1rem;
}

.putty-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.putty-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

.putty-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.putty-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
}

.putty-card-desc {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0;
  line-height: 1.45;
}

.putty-safety-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.putty-safety-safe {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.putty-safety-maint {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.putty-safety-deploy {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.putty-safety-diag {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.putty-code-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.putty-code-text {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  color: #38bdf8;
  word-break: break-all;
  user-select: all;
  line-height: 1.4;
}

.putty-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.putty-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  background: #0284c7;
  border: 1px solid #38bdf8;
  border-radius: 0.375rem;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  min-height: 28px;
}

.putty-run-btn:hover {
  background: #0369a1;
  border-color: #7dd3fc;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.putty-run-btn:active {
  transform: scale(0.97);
}

.putty-run-btn.running {
  background: #d97706 !important;
  border-color: #fcd34d !important;
  color: #ffffff !important;
  cursor: wait;
}

.putty-run-btn.success {
  background: #16a34a !important;
  border-color: #86efac !important;
  color: #ffffff !important;
}

.putty-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  color: #f1f5f9;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  min-height: 28px;
}

.putty-copy-btn:hover {
  background: #334155;
  color: #38bdf8;
  border-color: #475569;
}

/* Interactive PuTTY Terminal Deck */
.putty-terminal-deck {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.putty-terminal-topbar {
  background: #0f172a;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #1e293b;
  user-select: none;
}

.putty-terminal-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.putty-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.putty-dot:hover {
  opacity: 0.8;
}

.putty-dot.dot-red {
  background: #ef4444;
}

.putty-dot.dot-yellow {
  background: #f59e0b;
}

.putty-dot.dot-green {
  background: #10b981;
}

.putty-terminal-title {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.8125rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.putty-terminal-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.6rem;
  background: #1e293b;
  border-radius: 9999px;
  border: 1px solid #334155;
  white-space: nowrap;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator-dot.idle {
  background: #64748b;
}

.status-indicator-dot.running {
  background: #facc15;
  box-shadow: 0 0 6px #facc15;
  animation: pulseDot 1s infinite alternate;
}

.status-indicator-dot.success {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.status-indicator-dot.error {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

@keyframes pulseDot {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Quick Runner Toolbar */
.putty-runner-bar {
  background: #0b1120;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid #1e293b;
  flex-wrap: wrap;
}

.putty-runner-select-wrap {
  flex: 1;
  min-width: 260px;
}

.putty-select {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  color: #f1f5f9;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-family: 'JetBrains Mono', Consolas, monospace;
  min-height: 38px;
  outline: none;
}

.putty-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.putty-runner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.putty-exec-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  min-height: 38px;
  padding: 0 1rem;
}

/* Terminal Body Screen */
.putty-terminal-body {
  padding: 1.125rem;
  max-height: 380px;
  overflow-y: auto;
  background: #040711;
  border-bottom: 1px solid #1e293b;
}

.putty-terminal-deck.minimized .putty-terminal-body,
.putty-terminal-deck.minimized .putty-runner-bar,
.putty-terminal-deck.minimized .putty-terminal-footer {
  display: none;
}

.putty-terminal-pre {
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
}

.term-success {
  color: #4ade80;
  font-weight: 600;
}

.term-error {
  color: #f87171;
  font-weight: 600;
}

.term-warn {
  color: #fbbf24;
}

.term-info {
  color: #38bdf8;
}

.term-dim {
  color: #64748b;
}

.term-cursor {
  color: #38bdf8;
  font-weight: bold;
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.putty-terminal-footer {
  background: #0f172a;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  color: #64748b;
}

.putty-meta-tag {
  color: #94a3b8;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

.putty-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: -0.25rem;
}

.putty-empty-state {
  display: none;
  text-align: center;
  padding: 2.5rem 1rem;
  color: #64748b;
}

.putty-empty-state.visible {
  display: block;
}

/* Responsiveness across Mobile & Tablet */
@media (max-width: 992px) {
  .putty-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .putty-command-center {
    padding: 1rem;
  }

  .putty-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .putty-search-box {
    max-width: 100%;
  }

  .putty-code-box {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .putty-btn-group {
    justify-content: flex-end;
  }

  .putty-runner-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .putty-runner-actions {
    justify-content: flex-start;
  }

  .putty-terminal-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .putty-card {
    padding: 0.75rem;
  }

  .putty-code-text {
    font-size: 0.75rem;
  }

  .putty-pills-list {
    overflow-x: auto;
    padding-bottom: 0.25rem;
    flex-wrap: nowrap;
  }

  .putty-run-btn,
  .putty-copy-btn {
    min-height: 44px; /* Tap target accessibility */
    padding: 0.5rem 0.75rem;
  }

  .putty-exec-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Subscription Expiration & Renewal Styles */
.alert-content-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  flex-wrap: wrap;
}

.alert-action-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.renewal-history-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.875rem;
  margin-top: 1rem;
}

.data-table-sm th,
.data-table-sm td {
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.org-notice-banner {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  .alert-content-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .alert-action-btn {
    width: 100%;
    text-align: center;
  }
}


