* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --sidebar-width: 280px;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 28px 60px rgba(15, 23, 42, 0.14);
  --shadow-pop: 0 32px 90px rgba(63, 81, 181, 0.28);
  --color-bg: #eef1f9;
  --color-gradient-soft: radial-gradient(circle at 8% 12%, rgba(99, 102, 241, 0.12), transparent 55%),
    radial-gradient(circle at 70% 20%, rgba(16, 185, 129, 0.12), transparent 45%),
    linear-gradient(160deg, #e9edff 0%, #f9fbff 100%);
  --color-surface: rgba(255, 255, 255, 0.82);
  --color-surface-strong: rgba(255, 255, 255, 0.95);
  --color-border: rgba(148, 163, 184, 0.25);
  --color-border-strong: rgba(99, 102, 241, 0.18);
  --color-text: #1b2430;
  --color-text-soft: #6b7280;
  --color-text-inverse: #f8fafc;
  --color-accent: #6366f1;
  --color-accent-strong: #4f46e5;
  --color-accent-soft: rgba(99, 102, 241, 0.16);
  --color-sidebar: linear-gradient(178deg, #1f2a44 0%, #131c31 100%);
  --color-sidebar-highlight: rgba(99, 102, 241, 0.18);
  --color-wizard-complete: rgba(34, 197, 94, 0.16);
  --color-wizard-current: rgba(99, 102, 241, 0.16);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #0f1729;
  --color-gradient-soft: radial-gradient(circle at 12% 18%, rgba(79, 70, 229, 0.35), transparent 52%),
    radial-gradient(circle at 68% 22%, rgba(45, 212, 191, 0.18), transparent 45%),
    linear-gradient(145deg, #0f172a 0%, #111827 100%);
  --color-surface: rgba(17, 24, 39, 0.68);
  --color-surface-strong: rgba(30, 41, 59, 0.9);
  --color-border: rgba(71, 85, 105, 0.48);
  --color-border-strong: rgba(99, 102, 241, 0.32);
  --color-text: #f8fafc;
  --color-text-soft: #94a3b8;
  --color-text-inverse: #0f172a;
  --color-accent: #8b5cf6;
  --color-accent-strong: #7c3aed;
  --color-accent-soft: rgba(139, 92, 246, 0.22);
  --color-sidebar: linear-gradient(178deg, #0f172a 0%, #0b1120 100%);
  --color-sidebar-highlight: rgba(139, 92, 246, 0.22);
  --color-wizard-complete: rgba(16, 185, 129, 0.22);
  --color-wizard-current: rgba(139, 92, 246, 0.22);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  background: var(--color-gradient-soft);
  color: var(--color-text);
  display: flex;
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.badge.text-bg-warning,
.badge.text-bg-danger {
  color: #111827 !important;
}

.badge.accessible-success {
  background-color: #0f766e !important;
  color: #f8fafc !important;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-surface-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:focus {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 4px;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.12);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}

.stat-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--color-text-soft);
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
}

.stat-trend {
  font-size: 0.9rem;
  color: var(--color-text-soft);
}

.filter-bar {
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.25rem;
}

.filter-bar .form-label {
  font-weight: 600;
}

.filter-bar .btn-primary {
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.25);
}

.table:hover tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.08);
}

tbody tr:focus-within {
  outline: 2px solid rgba(59, 130, 246, 0.6);
  outline-offset: -2px;
}

.btn:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(250, 204, 21, 0.75);
  outline-offset: 3px;
}

.table.contact-table tbody tr {
  transition: transform 0.15s ease, background 0.15s ease;
}

.table.contact-table tbody tr:hover {
  transform: translateY(-2px);
  background: rgba(99, 102, 241, 0.08);
}

.table.contact-table tbody tr.table-danger:hover {
  background: rgba(248, 113, 113, 0.18);
}

.contact-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.contact-card {
  background: var(--color-surface-strong);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 55px rgba(15, 23, 42, 0.12);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 230px;
}

.contact-card:focus {
  outline: 3px solid rgba(59, 130, 246, 0.4);
  outline-offset: 4px;
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 32px 70px rgba(15, 23, 42, 0.18);
}

.contact-card.is-unsubscribed {
  border-color: rgba(248, 113, 113, 0.35);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.08), rgba(255, 255, 255, 0.9));
}

.contact-card__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.contact-card__email {
  font-size: 0.9rem;
  color: var(--color-accent-strong);
}

.contact-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-soft);
}

.meta-value {
  font-weight: 600;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.contact-card__actions .btn {
  flex: 1 0 auto;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.group-card {
  background: var(--color-surface-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 24px 55px rgba(15, 23, 42, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.group-card:focus {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 4px;
}

.group-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.16);
}

.group-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.metric {
  display: flex;
  flex-direction: column;
  min-width: 110px;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-soft);
}

.metric-value {
  font-size: 1.2rem;
  font-weight: 600;
}

.group-card-progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  overflow: hidden;
}

.group-card-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, #6366f1 0%, #22d3ee 100%);
}

.group-card-actions .btn {
  flex: 1 0 auto;
}

@media (max-width: 576px) {
  .group-card-actions {
    flex-direction: column;
  }
}

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

.template-card {
  background: var(--color-surface-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 24px 55px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.template-card:focus {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 4px;
}

.template-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 34px 75px rgba(15, 23, 42, 0.18);
}

.template-card-preview {
  position: relative;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  min-height: 160px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02);
}

.template-card-preview .preview-html {
  transform: scale(0.8);
  transform-origin: top left;
  width: 125%;
  pointer-events: none;
  line-height: 1.35;
  color: inherit;
}

.template-card-preview .preview-html * {
  max-width: 100% !important;
}

.template-card-preview .preview-mask {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32px;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

.template-card .preview-text {
  font-size: 0.85rem;
  color: var(--color-text-soft);
}

.template-card-actions .btn {
  flex: 1 0 auto;
}

.template-preview-frame {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.template-source {
  background: #0f172a;
  border-radius: var(--radius-md);
  color: #f8fafc;
  padding: 1rem;
  overflow: auto;
  max-height: 600px;
}

.template-source pre {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.limit-gauge {
  background: rgba(99, 102, 241, 0.15);
  border-radius: 999px;
  height: 12px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.limit-gauge__bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, #22c55e 0%, #2563eb 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.campaign-stepper {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  background: var(--color-surface-strong);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.campaign-stepper__item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  opacity: 0.45;
}

.campaign-stepper__item.completed,
.campaign-stepper__item.current {
  opacity: 1;
}

.campaign-stepper__index {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(99, 102, 241, 0.18);
  font-weight: 600;
  color: var(--color-text);
}

.campaign-stepper__item.completed .campaign-stepper__index {
  background: rgba(34, 197, 94, 0.28);
}

.campaign-stepper__item.current .campaign-stepper__index {
  background: rgba(59, 130, 246, 0.45);
}

.campaign-stepper__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.campaign-stepper__title {
  font-weight: 600;
}

.campaign-stepper__caption {
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.campaign-summary {
  border: 1px solid var(--color-border);
}

.sticky-card {
  position: sticky;
  top: 92px;
}

.dashboard-hero {
  padding: 2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(16, 185, 129, 0.12));
  color: var(--color-text);
}

.dashboard-hero__content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.kpi-pill {
  background: rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid rgba(99, 102, 241, 0.18);
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.12);
}

.kpi-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 600;
}

.activity-chart {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.85rem;
  padding: 0;
  margin: 0;
  height: 180px;
  align-items: end;
}

.activity-chart li {
  position: relative;
}

.activity-chart .bar {
  display: block;
  width: 100%;
  border-radius: 12px 12px 4px 4px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.85) 0%, rgba(79, 70, 229, 0.65) 100%);
}

.activity-tooltip {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -0.75rem);
  background: var(--color-surface-strong);
  color: var(--color-text);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 140px;
  transition: opacity 0.15s ease;
  font-size: 0.8rem;
}

.activity-chart li:hover .activity-tooltip,
.activity-chart li:focus-within .activity-tooltip {
  opacity: 1;
  visibility: visible;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.notification-item i {
  font-size: 1.1rem;
  margin-top: 0.2rem;
}

.notification-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.notifications-body {
  max-height: 320px;
  overflow-y: auto;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dashboard-hero .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.2);
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: #0f172a;
  color: #f8fafc;
  z-index: 1000;
  border-radius: 999px;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 3px solid #fbbf24;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--color-gradient-soft);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px circle at -10% -5%, rgba(255, 255, 255, 0.65), transparent 60%),
    radial-gradient(1000px circle at 120% 0%, rgba(99, 102, 241, 0.18), transparent 60%);
  z-index: -1;
  opacity: 0.9;
}

body[data-theme="dark"]::after {
  background: radial-gradient(900px circle at -10% -5%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(1100px circle at 120% -10%, rgba(236, 72, 153, 0.18), transparent 65%);
  opacity: 0.65;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  gap: 0;
  position: relative;
  padding-left: var(--sidebar-width);
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: #f8fbff;
  padding: 2.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 18px 45px rgba(2, 6, 23, 0.45);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 20;
  transition: transform 0.32s ease, box-shadow 0.32s ease;
  scrollbar-width: thin;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.app-sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.12), transparent),
    linear-gradient(210deg, rgba(16, 185, 129, 0.08), transparent);
  opacity: 0.6;
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.25rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.brand-tagline {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.6;
}

.sidebar-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  display: none;
  padding: 0.25rem;
  cursor: pointer;
}

.sidebar-progress {
  position: relative;
  z-index: 2;
  background: rgba(15, 23, 42, 0.32);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.24);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.progress-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  opacity: 0.6;
}

.progress-bar {
  margin-top: 0.75rem;
  width: 100%;
  height: 8px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
  overflow: hidden;
}

.progress-meter {
  height: 100%;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.9), rgba(59, 130, 246, 0.95));
  border-radius: inherit;
  transition: width 0.4s ease;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  z-index: 2;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  color: rgba(248, 250, 252, 0.84);
  font-weight: 500;
  transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-link i {
  font-size: 1rem;
}

.sidebar-link:hover {
  background: rgba(148, 163, 184, 0.16);
  transform: translateX(6px);
}

.sidebar-link.is-active {
  background: rgba(99, 102, 241, 0.28);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.sidebar-footer {
  margin-top: auto;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-cta {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  background: rgba(99, 102, 241, 0.22);
  border-radius: var(--radius-md);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.25);
}

.sidebar-note {
  font-size: 0.8rem;
  line-height: 1.5;
  opacity: 0.6;
  margin: 0;
}

.app-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  width: 100%;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 3rem 1.5rem;
  background: var(--color-surface-strong);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 25;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.app-topbar.is-scrolled {
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
  background: var(--color-surface);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.18);
  border-color: var(--color-border-strong);
}

.topbar-page {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.page-context {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--color-text-soft);
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.page-lead {
  max-width: 580px;
  color: var(--color-text-soft);
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.primary-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.28);
  transition: transform 0.2s ease;
}

primary-chip:hover {
  transform: translateY(-2px);
}

.wizard-surface {
  padding: 0 3rem 1.5rem;
}

.wizard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.wizard-label {
  letter-spacing: 0.18em;
  font-size: 0.75rem;
}

.wizard-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
  position: relative;
}

.wizard-step::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.wizard-step.is-current::after {
  border-color: var(--color-border-strong);
  background: var(--color-wizard-current);
}

.wizard-surface.is-collapsed .wizard-flow {
  display: none;
}

body.wizard-collapsed .wizard-surface {
  padding-bottom: 0;
}

.app-content {
  flex: 1 1 auto;
  padding: 0 3rem 3rem;
  position: relative;
  z-index: 1;
  display: flex;
}

.content-inner {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

body.sidebar-open {
  overflow: hidden;
}

/* Template workspace */
.template-workspace {
  overflow: hidden;
}

.template-workspace-grid {
  min-height: 70vh;
}

.template-pane {
  display: flex;
  flex-direction: column;
}

.template-pane--editor .template-toolbar {
  flex-shrink: 0;
}

.template-pane--editor .template-editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.template-code-area {
  flex: 1;
  min-height: 60vh;
  font-family: ui-monospace, SFMono-Regular, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.template-pane--preview {
  padding: 0;
}

.template-preview-shell {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 2rem;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.08) 0%, rgba(148, 163, 184, 0.04) 100%);
  overflow: auto;
}

.template-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 60vh;
  border: 0;
  border-radius: 1rem;
  background-color: #ffffff;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
  transition: max-width 0.2s ease;
}

.template-preview-shell.preview-desktop .template-preview-frame {
  max-width: 720px;
}

.template-preview-shell.preview-tablet .template-preview-frame {
  max-width: 540px;
}

.template-preview-shell.preview-mobile .template-preview-frame {
  max-width: 375px;
}

@media (max-width: 991.98px) {
  .template-workspace-grid,
  .template-preview-frame {
    min-height: 60vh;
  }

  .template-preview-shell {
    padding: 1.5rem;
  }
}

/* Audience selection tables */
.selection-table {
  max-height: 320px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  overflow: auto;
  background: var(--color-surface, #ffffff);
}

.selection-table table {
  margin-bottom: 0;
}

.selection-table tbody tr {
  transition: background-color 0.2s ease;
}

.selection-table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.06);
}

.selection-table--contacts {
  max-height: 420px;
}

.selection-table .form-check-label {
  cursor: pointer;
}

.selection-table .form-check-input {
  cursor: pointer;
}

.audience-summary-card {
  background: var(--color-surface-strong);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.audience-summary-card.is-loading {
  opacity: 0.6;
}

.audience-summary-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.audience-summary-grid {
  margin-top: 0 !important;
}

.audience-summary-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-text-soft);
  margin-bottom: 0.5rem;
}

.audience-summary-list {
  font-size: 0.9rem;
  color: var(--color-text);
}

.audience-summary-card.is-empty {
  border: 1px dashed var(--color-border);
}

.audience-breakdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.audience-breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
}

.audience-breakdown li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.summary-card {
  background: var(--color-surface-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-text-soft);
}

.summary-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.summary-caption {
  font-size: 0.85rem;
}

.progress-sm {
  height: 6px;
  border-radius: 999px;
  background-color: rgba(148, 163, 184, 0.3);
  overflow: hidden;
}

.progress-sm .progress-bar {
  height: 100%;
  transition: width 0.3s ease;
}

.contact-picker .list-group {
  max-height: 220px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.selected-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.selected-contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-strong);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.selected-contact-chip .chip-body {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.selected-contact-chip .chip-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.selected-contact-chip .chip-meta {
  font-size: 0.75rem;
  color: var(--color-text-soft);
}

.selected-contact-chip .btn-close {
  width: 0.65rem;
  height: 0.65rem;
  opacity: 0.6;
}

.selected-contact-chip .btn-close:hover {
  opacity: 1;
}

@media (max-width: 991.98px) {
  .app-shell {
    padding-left: 0;
  }

  .app-sidebar {
    width: min(var(--sidebar-width), 82vw);
    transform: translateX(-110%);
    box-shadow: 0 28px 60px rgba(2, 6, 23, 0.55);
  }

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

  .sidebar-close {
    display: block;
  }

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

  .app-topbar {
    padding: 1.5rem 1.75rem 1.25rem;
  }

  .wizard-surface {
    padding: 0 1.75rem 1.5rem;
  }

  .app-content {
    padding: 0 1.75rem 2.5rem;
  }
}

@media (min-width: 992px) {
  .app-sidebar {
    transform: none !important;
  }

  #sidebarToggle {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .template-preview-shell {
    padding: 1rem;
  }

  .template-preview-frame {
    border-radius: 0.75rem;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  }
}

w... (truncated for brevity)
