/* === UPGRADE MODAL (Tier Selection) === */
.upgrade-modal {
  position: fixed;
  inset: 0;
  display: none; /* hidden by default; shown via JS */
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2200;
}

.upgrade-modal.is-open {
  display: flex;
}

.upgrade-modal .upgrade-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 22px 22px 18px;
  position: relative;
  border: 1px solid rgba(15, 23, 42, 0.08);
  animation: slideDown 0.3s ease-out;
  max-height: 90vh;
  overflow: auto;
  font-family: var(--font-sans);
}

.upgrade-modal .upgrade-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.upgrade-modal .upgrade-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transform: translateY(-1px);
}

.upgrade-modal .upgrade-modal-close:active {
  transform: translateY(0);
}

.upgrade-modal .upgrade-modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.upgrade-modal .upgrade-modal-header {
  padding-right: 44px; /* keep text clear of close button */
}

.upgrade-modal .upgrade-modal-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.upgrade-modal .upgrade-modal-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Pro badge */
.upgrade-modal .upgrade-modal-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

/* Feature checklist - 3 rows × 2 columns */
.upgrade-modal .upgrade-modal-features {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 14px;
}

.upgrade-modal .upgrade-modal-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}
.upgrade-modal .upgrade-modal-feature.hidden {
  display: none;
}

.upgrade-modal .upgrade-modal-feature-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upgrade-modal .upgrade-modal-feature-icon svg {
  width: 11px;
  height: 11px;
}

.upgrade-modal .upgrade-modal-feature-highlight {
  color: var(--primary-text);
  font-weight: var(--weight-bold);
}

/* Divider */
.upgrade-modal .upgrade-modal-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
  margin: 14px 0 12px;
}

/* Volume header - label + billing tabs on one row */
.upgrade-modal .upgrade-modal-volume-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* Plan selector - 3-column tile grid */
.upgrade-modal .upgrade-modal-volume-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 0;
}

.upgrade-modal .upgrade-modal-error {
  display: none; /* hidden by default; toggled via JS */
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--danger-subtle);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger-text);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.upgrade-modal .upgrade-modal-error.is-visible {
  display: block;
}

.upgrade-modal .upgrade-modal-options {
  margin-top: 0;
}

.upgrade-modal .upgrade-modal-options.is-hidden {
  display: none;
}

/* Volume tier - compact square tile */
.upgrade-modal .upgrade-modal-tier {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(15, 23, 42, 0.10);
  background: var(--bg-elevated);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.upgrade-modal .upgrade-modal-tier:hover {
  border-color: rgba(99, 102, 241, 0.30);
  background: rgba(99, 102, 241, 0.03);
}

.upgrade-modal .upgrade-modal-tier:active {
  background: rgba(99, 102, 241, 0.06);
}

.upgrade-modal .upgrade-modal-tier:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.upgrade-modal .upgrade-modal-tier.is-selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12);
}

/* Floating "Popular" badge above tile top border */
.upgrade-modal .upgrade-modal-tier-popular {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: var(--text-3xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-family: var(--font-sans);
}

.upgrade-modal .upgrade-modal-tier-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.upgrade-modal .upgrade-modal-tier.is-selected .upgrade-modal-tier-name {
  color: var(--primary-dark);
}

/* Volume label */
.upgrade-modal .upgrade-modal-tier-vol {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-align: center;
}

.upgrade-modal .upgrade-modal-tier.is-selected .upgrade-modal-tier-vol {
  color: var(--text-primary);
}

/* Price inside tile */
.upgrade-modal .upgrade-modal-tier-price {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-tertiary);
  line-height: 1;
  margin-top: 2px;
}

.upgrade-modal .upgrade-modal-tier.is-selected .upgrade-modal-tier-price {
  color: var(--primary);
}

.upgrade-modal .upgrade-modal-tier-price-mo {
  font-weight: var(--weight-medium);
  font-size: 0.9em;
}

/* Current plan badge for Pro users (injected by JS) */
.upgrade-modal .upgrade-modal-tier-current-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.22);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

/* Locked tier tile (current plan or lower - shown when Pro user upgrades) */
.upgrade-modal .upgrade-modal-tier.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* CTA button - full width */
.upgrade-modal .upgrade-modal-cta-btn {
  width: 100%;
  margin-top: 12px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.upgrade-modal .upgrade-modal-cta-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.upgrade-modal .upgrade-modal-cta-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.upgrade-modal .upgrade-modal-cta-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25), 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Trust signal */
.upgrade-modal .upgrade-modal-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
}

.upgrade-modal .upgrade-modal-loading {
  display: none; /* hidden by default; toggled via JS */
  margin-top: 18px;
  padding: 20px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(99, 102, 241, 0.25);
  background: rgba(248, 250, 252, 0.95);
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: left;
}

.upgrade-modal .upgrade-modal-loading.is-active {
  display: flex;
}

@keyframes upgrade-loading-pulse {
  0%, 100% {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: var(--shadow-sm);
  }
  50% {
    border-color: rgba(99, 102, 241, 0.40);
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.10), var(--shadow-sm);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .upgrade-modal .upgrade-modal-loading.is-active {
    animation: upgrade-loading-pulse 1.8s ease-in-out infinite;
  }
}

.upgrade-modal .upgrade-modal-spinner {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  border: 3px solid rgba(99, 102, 241, 0.18);
  border-top-color: var(--primary);
  animation: spinning 1s linear infinite;
  flex-shrink: 0;
}

.upgrade-modal .upgrade-modal-loading-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-modal .upgrade-modal-loading-title {
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  font-size: var(--text-md);
  letter-spacing: -0.02em;
}

.upgrade-modal .upgrade-modal-loading-subtitle {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

/* Onboarding: "Continue with Free" button */
.upgrade-modal .upgrade-modal-footer-actions {
  display: flex;
  justify-content: center;
  width: 100%;
}
.upgrade-modal .upgrade-modal-continue-free {
  width: 100%;
  margin-top: 10px;
  height: 46px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1.5px solid rgba(15, 23, 42, 0.13);
  color: var(--text-primary);
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.upgrade-modal .upgrade-modal-continue-free:hover {
  background: var(--bg-secondary);
  border-color: rgba(15, 23, 42, 0.18);
  box-shadow: var(--shadow-sm);
}
.upgrade-modal .upgrade-modal-continue-free:active {
  background: var(--bg-tertiary);
  box-shadow: none;
}
.upgrade-modal .upgrade-modal-continue-free:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* Onboarding variant styling */
.upgrade-modal[data-context="onboarding"] .upgrade-modal-card {
  border-color: rgba(99, 102, 241, 0.22);
  box-shadow: 0 18px 52px rgba(99, 102, 241, 0.16), var(--shadow-xl);
}

@media (max-width: 480px) {
  .upgrade-modal {
    padding: 12px;
  }
  .upgrade-modal .upgrade-modal-card {
    padding: 20px 16px 16px;
    border-radius: 16px;
  }
  .upgrade-modal .upgrade-modal-features {
    grid-template-columns: 1fr;
  }
  .upgrade-modal .upgrade-modal-volume-selector {
    grid-template-columns: 1fr;
  }
  .upgrade-modal .upgrade-modal-tier-vol {
    font-size: var(--text-xl);
  }
}

/* === LIMIT MODAL (Plan Limits) === */
.limit-modal {
  position: fixed;
  inset: 0;
  display: none; /* hidden by default; shown via JS */
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2250;
}

.limit-modal.is-open {
  display: flex;
}

.limit-modal .limit-modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-elevated);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  padding: 28px;
  position: relative;
  border: 1px solid rgba(15, 23, 42, 0.08);
  animation: slideDown 0.3s ease-out;
  max-height: 85vh;
  overflow: auto;
  text-align: center;
}

.limit-modal .limit-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.limit-modal .limit-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transform: translateY(-1px);
}

.limit-modal .limit-modal-close:active {
  transform: translateY(0);
}

.limit-modal .limit-modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22);
}

.limit-modal .limit-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-border) 100%);
  border: 1px solid rgba(245, 158, 11, 0.28);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.16);
  color: var(--warning-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 14px;
}

.limit-modal .limit-modal-icon svg {
  width: 30px;
  height: 30px;
}

@keyframes limit-icon-pulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(245, 158, 11, 0.16); }
  50% { box-shadow: 0 14px 34px rgba(245, 158, 11, 0.22); }
}

@media (prefers-reduced-motion: no-preference) {
  #limit-modal.is-open .limit-modal-icon {
    animation: limit-icon-pulse 2.8s ease-in-out infinite;
  }
}

.limit-modal .limit-modal-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold); /* Space Grotesk display caps at 700 */
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.limit-modal .limit-modal-message {
  color: var(--text-secondary);
  font-size: var(--text-md);
  line-height: 1.55;
  margin: 0;
}

.limit-modal .limit-modal-usage {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.92);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.limit-modal .limit-modal-usage-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.limit-modal .limit-modal-usage-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.limit-modal .limit-modal-usage-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
}

.limit-modal .limit-modal-progress {
  margin-top: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.limit-modal .limit-modal-progress-bar {
  height: 100%;
  width: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.18);
}

/* === CHECKOUT SUCCESS MODAL === */
.cs-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10010;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cs-modal.is-open {
  display: flex;
}
.cs-modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  padding: 32px 28px 28px;
  text-align: center;
  animation: cs-card-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes cs-card-enter {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.cs-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.cs-modal-close:hover { background: var(--bg-secondary); color: var(--text-secondary); transform: translateY(-1px); }
.cs-modal-close:active { transform: translateY(0); }
.cs-modal-close:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22); }

/* Icon circle */
.cs-modal-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.cs-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--success-subtle) 0%, var(--success-border) 100%);
  border: 1px solid rgba(16, 185, 129, 0.28);
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.16);
  color: var(--success);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}
.cs-modal-icon svg { width: 28px; height: 28px; }

/* Activating state: pulsing icon */
.cs-modal[data-state="activating"] .cs-modal-icon {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(79, 70, 229, 0.08) 100%);
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.16);
  color: var(--primary);
}
@keyframes cs-icon-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 24px rgba(99, 102, 241, 0.16); }
  50%      { transform: scale(1.06); box-shadow: 0 14px 32px rgba(99, 102, 241, 0.24); }
}
@media (prefers-reduced-motion: no-preference) {
  .cs-modal[data-state="activating"] .cs-modal-icon {
    animation: cs-icon-pulse 2s ease-in-out infinite;
  }
}

/* Active state: celebration bloom */
@keyframes cs-icon-bloom {
  0%   { transform: scale(0.9); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: no-preference) {
  .cs-modal[data-state="active"] .cs-modal-icon {
    animation: cs-icon-bloom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
}

/* Header */
.cs-modal-header { padding: 0; }
.cs-modal-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.cs-modal-pro-badge svg { width: 10px; height: 10px; }
.cs-modal-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold); /* Space Grotesk display caps at 700 */
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.cs-modal-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-md);
  line-height: 1.55;
  margin: 0;
}

/* Spinner / activating state */
.cs-modal-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px 0 4px;
  padding: 16px;
  border-radius: 14px;
  border: 1px dashed rgba(99, 102, 241, 0.25);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(79, 70, 229, 0.03) 100%);
}
.cs-modal-spinner {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  border: 3px solid rgba(99, 102, 241, 0.18);
  border-top-color: var(--primary);
  animation: cs-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }
.cs-modal-spinner-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
}

/* Feature grid */
.cs-modal-features {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  text-align: left;
}
.cs-modal-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  padding: 6px 0;
}
.cs-modal-feature-icon {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-modal-feature-icon svg { width: 11px; height: 11px; }
.cs-modal-feature-hl {
  color: var(--primary);
  font-weight: var(--weight-bold);
}

/* Staggered feature entrance */
@keyframes cs-feature-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .cs-modal[data-state="active"] .cs-modal-features li {
    opacity: 0;
    animation: cs-feature-in 0.3s ease-out forwards;
  }
  .cs-modal[data-state="active"] .cs-modal-features li:nth-child(1) { animation-delay: 0.08s; }
  .cs-modal[data-state="active"] .cs-modal-features li:nth-child(2) { animation-delay: 0.14s; }
  .cs-modal[data-state="active"] .cs-modal-features li:nth-child(3) { animation-delay: 0.20s; }
  .cs-modal[data-state="active"] .cs-modal-features li:nth-child(4) { animation-delay: 0.26s; }
  .cs-modal[data-state="active"] .cs-modal-features li:nth-child(5) { animation-delay: 0.32s; }
  .cs-modal[data-state="active"] .cs-modal-features li:nth-child(6) { animation-delay: 0.38s; }
}

/* Action buttons */
.cs-modal-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.cs-modal-cta {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}
.cs-modal-cta:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45); }
.cs-modal-cta:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3); }
.cs-modal-cta:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25), 0 4px 14px rgba(99, 102, 241, 0.35); }

.cs-modal-billing-btn {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.cs-modal-billing-btn:hover { background: var(--bg-secondary); border-color: rgba(15, 23, 42, 0.18); color: var(--primary-dark); box-shadow: var(--shadow-sm); }
.cs-modal-billing-btn:active { background: var(--bg-tertiary); box-shadow: none; }
.cs-modal-billing-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); }

/* Responsive */
@media (max-width: 480px) {
  .cs-modal { padding: 16px; }
  .cs-modal-card { padding: 24px 18px 20px; border-radius: 16px; }
  .cs-modal-features { grid-template-columns: 1fr; }
}

.limit-modal .limit-modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.limit-modal .limit-modal-primary,
.limit-modal .limit-modal-secondary {
  height: 46px;
  border-radius: var(--radius-pill);
  padding: 0 18px;
  font-size: var(--text-md);
}

.limit-modal .limit-modal-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  box-shadow: none;
  font-weight: var(--weight-bold);
}

.limit-modal .limit-modal-secondary:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--primary-dark);
}

.limit-modal .limit-modal-secondary:active:not(:disabled) {
  background: var(--bg-tertiary);
}

.limit-modal .limit-modal-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

@media (prefers-reduced-motion: no-preference) {
  .limit-modal .limit-modal-primary--pulse {
    position: relative;
    z-index: 0;
  }

  .limit-modal .limit-modal-primary--pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: var(--radius-pill);
    z-index: -1;
    pointer-events: none;
    animation: btn-pulse-loop 2.2s infinite;
  }
}

@media (max-width: 480px) {
  .limit-modal {
    padding: 16px;
  }
  .limit-modal .limit-modal-card {
    padding: 22px 18px;
    border-radius: 14px;
  }
  .limit-modal .limit-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .limit-modal .limit-modal-primary,
  .limit-modal .limit-modal-secondary {
    width: 100%;
  }
}

/* ── Legal notices (auth, upgrade) ── */
.auth-legal-notice,
.upgrade-modal-legal-notice {
  margin: 12px 0 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-tertiary);
  text-align: center;
}
.auth-legal-notice a,
.upgrade-modal-legal-notice a {
  color: var(--primary);
  text-decoration: none;
}
.auth-legal-notice a:hover,
.upgrade-modal-legal-notice a:hover {
  text-decoration: underline;
}
.upgrade-modal-legal-notice {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* Delete account (Settings danger zone): keep red on hover */
#delete-account-trigger:hover {
  color: var(--danger);
  text-decoration: none;
}

/* ── Confirm modals (account delete; mirrors team dashboard) ── */
.es-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.es-confirm-modal.hidden {
  display: none;
}
.es-confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.es-confirm-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  background: var(--bg-elevated);
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-xl);
  animation: esConfirmModalIn 0.22s ease-out;
}
@keyframes esConfirmModalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.es-confirm-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--text-2xl);
  line-height: 1;
  cursor: pointer;
}
.es-confirm-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.es-confirm-modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.es-confirm-modal-icon svg { width: 24px; height: 24px; }
.es-confirm-modal-icon--danger,
.es-confirm-modal-icon--error {
  color: var(--danger-dark);
  background: var(--danger-subtle);
}
.es-confirm-modal-icon--warning {
  color: var(--warning-amber);
  background: var(--warning-subtle);
}
.es-confirm-modal-icon--info {
  color: var(--icon-info);
  background: var(--primary-subtle);
}
.es-confirm-modal-icon--success {
  color: var(--success-dark);
  background: var(--success-subtle);
}
.es-confirm-modal-title {
  margin: 0 0 12px;
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text-primary);
}
.es-confirm-modal-message {
  margin: 0 0 18px;
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--text-secondary);
  text-align: left;
}
.es-confirm-modal-message p {
  margin: 0 0 10px;
  text-align: center;
}
.es-confirm-modal-message ul {
  margin: 0;
  padding-left: 1.25rem;
}
.es-confirm-modal-message li {
  margin-bottom: 0.5rem;
}
.es-confirm-modal-message li.hidden {
  display: none;
}
.es-confirm-modal-message strong {
  color: var(--text-primary);
}
.es-confirm-modal-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.es-confirm-modal-checkbox input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.es-confirm-modal-error {
  margin: -8px 0 14px;
  font-size: var(--text-base);
  color: var(--danger-text);
  text-align: center;
}
.es-confirm-modal-error.hidden {
  display: none;
}
.es-confirm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.es-confirm-modal-actions .btn {
  min-width: 120px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Shared overlays, modals, form utilities (token-based; replaces inline HTML)
   ═══════════════════════════════════════════════════════════════════════════ */

.es-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.es-overlay--light { background: var(--overlay-light); }
.es-overlay--dark {
  background: var(--overlay-dark);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.es-overlay--darker {
  background: var(--overlay-darker);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2500;
}
.es-overlay--z-auth { z-index: 2000; }
.es-overlay--z-feedback { z-index: 9999; }

.es-modal-panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--spacing-lg);
  max-height: 90vh;
  overflow-y: auto;
  width: 92%;
  box-sizing: border-box;
}
.es-modal-panel--sm { max-width: 360px; padding: var(--spacing-lg); }
.es-modal-panel--md { max-width: 440px; }
.es-modal-panel--auth { max-width: 424px; padding: var(--spacing-xl); position: relative; animation: slideDown 0.3s ease-out; }
.es-modal-panel--lg { max-width: 600px; }
.es-modal-panel--brand { max-width: 420px; width: 90%; }
.es-modal-panel--history {
  max-width: 800px;
  padding: var(--spacing-xl);
  position: relative;
  animation: slideDown 0.3s ease-out;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateZ(0);
  will-change: scroll-position;
  -webkit-overflow-scrolling: touch;
}
.es-modal-panel--feedback {
  max-width: 440px;
  padding: 0;
  overflow: hidden;
  animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.es-modal-panel--limit {
  max-width: 440px;
  padding: var(--spacing-xl);
  position: relative;
  animation: slideDown 0.3s ease-out;
  text-align: center;
}

.es-modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--spacing-xs) 0;
}
/* Primary modal titles (h2: auth/limit) use bold; secondary modal titles (h3) stay semibold. */
h2.es-modal-title {
  font-weight: var(--weight-bold);
}
.es-modal-title--lg {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}
.es-modal-title--center {
  text-align: center;
  margin-bottom: var(--spacing-sm);
}
.es-modal-subtitle {
  font-size: var(--text-md);
  color: var(--text-secondary);
  margin: 0 0 var(--spacing-md) 0;
  line-height: 1.6;
}
.es-modal-intro {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}
.es-modal-intro strong { color: var(--text-primary); }
.es-modal-footnote {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--spacing-md);
}
.es-modal-actions {
  display: flex;
  gap: var(--spacing-xs);
  justify-content: flex-end;
}
.es-modal-actions--stack {
  flex-direction: column;
  gap: var(--spacing-sm);
}
.es-modal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--spacing-xs);
}
.es-modal-close--inline {
  position: static;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}
.es-modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}
.es-modal-header-row--border {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border);
}
.es-modal-body-pad { padding: var(--spacing-lg); }

/* Form utilities */
.es-form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.es-form-label-hint {
  font-weight: var(--weight-normal);
  color: var(--text-tertiary);
}
.brand-modal-dirty {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--warning-amber);
}
.brand-modal-dirty.is-visible { display: inline-flex; }
.brand-modal-dirty::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning-icon);
  flex-shrink: 0;
}

.es-form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  font-size: var(--text-md);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-elevated);
  outline: none;
}
.es-form-input--code {
  font-size: var(--text-xl);
  letter-spacing: 0.3em;
  text-align: center;
}
.es-form-input:focus {
  border-color: var(--primary);
  outline: none;
}
.es-form-error {
  display: none;
  margin-top: var(--spacing-md);
  padding: 10px;
  background: var(--danger-subtle);
  color: var(--danger-dark);
  font-size: var(--text-sm);
  border-radius: var(--radius-base);
  text-align: center;
}
.es-form-error--inline {
  display: none;
  color: var(--danger);
  font-size: var(--text-sm);
  margin-bottom: var(--spacing-sm);
}
.es-form-stack { display: flex; flex-direction: column; gap: var(--spacing-md); }
.es-form-actions-row { display: flex; gap: var(--spacing-sm); }
.es-form-actions-row .btn { flex: 1; }
.es-form-actions-row .btn-primary { flex: 2; }

/* Auth modal */
#auth-modal { align-items: center; justify-content: center; }
.auth-modal-header { text-align: center; margin-bottom: var(--spacing-md); }
.es-modal-panel--auth .es-modal-title { letter-spacing: -0.02em; }
.auth-modal-oauth { margin-bottom: 20px; }
.auth-modal-divider {
  display: flex;
  align-items: center;
  margin: var(--spacing-md) 0;
}
.auth-modal-divider::before,
.auth-modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-modal-divider span {
  padding: 0 10px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--spacing-lg);
}
.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -2px;
}
.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.auth-forgot-link {
  display: block;
  text-align: right;
  font-size: var(--text-sm);
  color: var(--primary);
  margin-bottom: var(--spacing-sm);
  text-decoration: none;
}
.auth-submit-btn { width: 100%; height: 44px; margin-top: var(--spacing-xs); }

/* Anonymous warning banner */
#anon-warning-banner {
  display: none;
  position: relative;
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-border) 100%);
  border-bottom: 1px solid var(--warning-icon);
  padding: var(--spacing-sm) 20px;
  z-index: 1500;
  box-shadow: var(--shadow-sm);
}
.anon-warning-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}
.anon-warning-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
}
.anon-warning-icon { stroke: var(--warning-amber); flex-shrink: 0; }
.anon-warning-text {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--warning-text);
}
.anon-warning-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}
.anon-warning-signup {
  background: var(--warning-icon);
  color: var(--surface-white);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all 0.2s;
}
.anon-warning-dismiss {
  background: none;
  border: none;
  color: var(--warning-text);
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.anon-warning-dismiss:hover { opacity: 1; }

/* Profile dropdown */
#profile-dropdown-content {
  position: absolute;
  top: 110%;
  right: 0;
  width: 260px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-hairline-strong);
  padding: var(--spacing-xs);
  z-index: 100;
}
.profile-dropdown-user {
  padding: var(--spacing-xs) 8px var(--spacing-sm);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--spacing-sm);
}
.profile-dropdown-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}
.profile-dropdown-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text-secondary);
  color: var(--surface-white);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  line-height: 1;
  user-select: none;
}
.profile-dropdown-identity-text {
  min-width: 0;
  flex: 1;
}
.profile-dropdown-name {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-size: var(--text-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-dropdown-email-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.profile-dropdown-email {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Name line: name + (pro-only) plan pill share a row so the email below
   keeps the full dropdown width. */
.profile-dropdown-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.dropdown-plan-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  color: var(--primary);
  background: var(--primary-subtle);
  white-space: nowrap;
}
/* Compact exports meter in the profile dropdown — no divider below it, the
   one above (from .profile-dropdown-user) is enough. */
.profile-dropdown-stats {
  padding: 0 var(--spacing-sm) var(--spacing-sm);
}
.profile-dropdown-stats .usage-stat-label {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  line-height: 1.3;
}
/* Exports: metered hero stat with a usage bar (Settings → Plan & Billing) */
.usage-stat-meter {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.usage-stat-bar {
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--border);
  overflow: hidden;
}
.usage-stat-bar.hidden {
  display: none;
}
.usage-stat-bar-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  transition: width 0.3s ease, background 0.2s ease;
}
.usage-stat-bar-fill.is-warn {
  background: var(--warning-icon);
}
.usage-stat-bar-fill.is-danger {
  background: var(--danger);
}

/* Secondary totals: de-emphasized, neutral (no accent colour) */
.usage-stat-totals {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.usage-stat-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.usage-stat-total-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.usage-stat-total-value {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

#profile-dropdown-content .dropdown-item {
  width: 100%;
  text-align: left;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  text-decoration: none;
}

/* Klaviyo send modal */
#klaviyo-send-modal { align-items: center; justify-content: center; }
/* Optional alt text: slim single-row strip above the modal actions */
#klaviyo-send-alt-text-panel {
  display: none; /* JS toggles to flex when slices exist */
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-sizing: border-box;
  margin-bottom: var(--spacing-sm);
  padding: 7px 11px;
  background: var(--surface-canvas);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
}
.klaviyo-send-alt-text-title {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
}
#klaviyo-send-alt-text-message {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.3;
  min-width: 0;
}
#klaviyo-send-alt-text-panel[data-tone="warning"] { border-left-color: var(--warning-icon); }
#klaviyo-send-alt-text-panel[data-tone="success"] { border-left-color: var(--success-border); }
#klaviyo-send-alt-text-panel[data-tone="warning"] #klaviyo-send-alt-text-message { color: var(--warning-amber); }
#klaviyo-send-alt-text-panel[data-tone="success"] #klaviyo-send-alt-text-message { color: var(--success-dark); }
#klaviyo-send-alt-text-auto-wrap { margin-left: auto; }
#klaviyo-send-alt-text-action {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
}
.klaviyo-send-mode-cards { margin-bottom: var(--spacing-md); }
.klaviyo-send-mode-card {
  text-align: left;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.klaviyo-send-mode-card[data-mode="campaign"] {
  width: 100%;
  padding: var(--spacing-md);
}
.klaviyo-send-mode-card[data-mode="template"],
.klaviyo-send-mode-card[data-mode="images"] {
  padding: 10px 11px;
  border-radius: var(--radius-md);
  min-height: 100%;
}
.klaviyo-send-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}
.klaviyo-send-mode-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  margin: 0.75rem 0 var(--spacing-xs);
  letter-spacing: 0.02em;
}
.klaviyo-send-mode-title {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
.klaviyo-send-mode-card[data-mode="campaign"] .klaviyo-send-mode-title {
  margin-bottom: 6px;
  font-size: var(--text-lg);
}
.klaviyo-send-mode-desc {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.klaviyo-send-mode-card:not([data-mode="campaign"]) .klaviyo-send-mode-desc {
  font-size: var(--text-sm);
  line-height: 1.4;
}
/* Campaign progress strip: 3 labelled segments + one live caption */
#klaviyo-progress-strip { margin: 0 4px var(--spacing-md); }
.klaviyo-progress-labels,
.klaviyo-progress-track {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.klaviyo-progress-labels { margin-bottom: 5px; }
.klaviyo-progress-labels span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  line-height: 1.2;
}
.klaviyo-progress-labels span:nth-child(2) { justify-content: center; }
.klaviyo-progress-labels span:nth-child(3) { justify-content: flex-end; }
.klaviyo-progress-labels span.is-active { color: var(--icon-info); }
.klaviyo-progress-labels span.is-done { color: var(--success-dark); }
.klaviyo-progress-labels span.is-error { color: var(--danger-text); }
.klaviyo-step-check { display: none; flex-shrink: 0; }
.klaviyo-progress-labels span.is-done .klaviyo-step-check { display: inline-block; }
.klaviyo-progress-track [data-klaviyo-step-seg] {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--border);
}
[data-klaviyo-step-seg].is-done { background: var(--icon-success); }
[data-klaviyo-step-seg].is-error { background: var(--icon-error); }
[data-klaviyo-step-seg].is-turn {
  background: var(--primary);
  animation: klaviyoSegPulse 1.5s ease-in-out infinite;
}
[data-klaviyo-step-seg].is-work {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
  background-size: 200% 100%;
  animation: klaviyoSegShimmer 1.15s linear infinite;
}
@keyframes klaviyoSegShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes klaviyoSegPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  [data-klaviyo-step-seg].is-turn,
  [data-klaviyo-step-seg].is-work { animation: none; }
}
.klaviyo-progress-caption-wrap { text-align: center; margin-top: 9px; }
#klaviyo-send-template-status {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}
#klaviyo-send-campaign-fields {
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
}
.klaviyo-send-field { display: block; margin-bottom: 8px; }
.klaviyo-send-field:last-child { margin-bottom: 0; }
.klaviyo-send-field-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: 4px;
}
#klaviyo-send-to-audiences-list,
#klaviyo-dont-send-to-audiences-list {
  width: 100%;
  box-sizing: border-box;
  position: relative;
  font-size: var(--text-sm);
}
.klaviyo-audience-loading {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
#klaviyo-send-audience-status {
  display: none;
  margin-top: 5px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
#klaviyo-send-audience-retry {
  display: none;
  margin-top: var(--spacing-xs);
  border: var(--border-subtle);
  padding: 6px 10px;
  font-size: var(--text-sm);
}
.klaviyo-send-field-hint {
  display: block;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
/* Compact inputs within the Send to Klaviyo modal */
#klaviyo-send-modal .es-form-input { font-size: var(--text-base); padding: 8px 11px; }
#klaviyo-send-modal .klaviyo-send-field-label { font-size: var(--text-xs); margin-bottom: 3px; }

/* Campaign send: editable CTA link + saved-links dropdown */
.cta-link-wrap { position: relative; }
.cta-link-input-field { padding-right: 38px; }
.cta-link-dropdown-btn {
  display: none; position: absolute; top: 0; right: 0; height: 100%; width: 36px;
  align-items: center; justify-content: center; background: none; border: none;
  cursor: pointer; color: var(--text-secondary);
}
.cta-link-dropdown-btn:hover { color: var(--text-primary); }
.cta-link-dropdown-btn svg { transition: transform 0.2s; }
.cta-link-wrap.menu-open .cta-link-dropdown-btn svg { transform: rotate(180deg); }
.cta-link-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
  padding: 6px; z-index: 60; max-height: 220px; overflow-y: auto;
}
.cta-link-menu.opens-up { top: auto; bottom: calc(100% + 4px); }
.cta-link-hint-row { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-xs); margin-top: 5px; }
.cta-link-save-btn {
  flex-shrink: 0; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--primary);
  background: none; border: none; cursor: pointer; padding: 0; white-space: nowrap;
}
.cta-link-empty { padding: var(--spacing-xs); font-size: var(--text-sm); color: var(--text-tertiary); }
.cta-link-row { display: flex; align-items: center; gap: 6px; padding: 1px; border-radius: var(--radius-sm); }
.cta-link-row:hover { background: var(--surface-canvas); }
.cta-link-row.editing { background: var(--surface-canvas); flex-wrap: nowrap; padding: 4px 6px; gap: 6px; }
.cta-link-select {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; text-align: left;
  background: none; border: none; cursor: pointer; padding: 6px var(--spacing-xs); border-radius: var(--radius-sm); color: var(--text-primary);
}
.cta-link-star { flex-shrink: 0; color: var(--primary); font-size: var(--text-xs); width: 12px; text-align: center; }
.cta-link-text { flex: 1; min-width: 0; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cta-link-edit {
  flex-shrink: 0; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--primary);
  background: none; border: none; cursor: pointer; padding: 6px var(--spacing-xs); border-radius: var(--radius-sm);
}
.cta-link-edit:hover { background: var(--primary-subtle); }
.cta-link-edit-input {
  flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--primary); border-radius: var(--radius-sm);
  font-size: var(--text-sm); box-sizing: border-box;
}
.cta-link-apply, .cta-link-cancel {
  flex-shrink: 0; width: 30px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); cursor: pointer;
}
.cta-link-apply { color: var(--surface-white); background: var(--primary); border: none; }
.cta-link-cancel { color: var(--text-secondary); background: none; border: 1px solid var(--border); }
.cta-link-cancel:hover { background: var(--bg-tertiary); }

/* Info modal */
#info-modal {
  background: var(--overlay-light);
  backdrop-filter: blur(2px);
}
.info-modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
}
.info-modal-header {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}
.info-modal-header .es-modal-title { flex: 1; margin: 0; }
.info-modal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: var(--text-md);
}
.info-modal-list li {
  padding: 0.5rem 0;
  display: flex;
  align-items: start;
  gap: 0.75rem;
}
.info-modal-list .info-step-num {
  color: var(--primary);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
}

/* Anon limit modal */
.anon-limit-icon-wrap {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--warning), var(--warning-border));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.anon-limit-icon { stroke: var(--warning-icon); }
.anon-limit-signup-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--surface-white);
  border: none;
  padding: 14px var(--spacing-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(var(--primary-tint-rgb), 0.3);
}
.anon-limit-dismiss-btn {
  width: 100%;
  background: var(--border);
  color: var(--text-secondary);
  border: none;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all 0.2s;
}
