#terms-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--terms-overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: termsOverlayIn 0.18s ease;
}

#terms-overlay[hidden] {
  display: none;
}

.terms-modal {
  background: var(--terms-surface);
  border-radius: 10px;
  overflow: hidden;
  width: min(100%, 440px);
  box-shadow:
    0 24px 80px var(--terms-shadow-strong),
    0 2px 8px var(--terms-shadow-soft);
  animation: termsModalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.terms-modal-accent {
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--terms-gold) 20%,
    var(--terms-gold-light) 50%,
    var(--terms-gold) 80%,
    transparent
  );
}

.terms-modal-body {
  padding: 28px 28px 24px;
}

.terms-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--terms-icon-bg);
  border: 1.5px solid var(--terms-icon-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.terms-modal-icon svg {
  width: 20px;
  height: 20px;
  color: var(--terms-navy);
}

.terms-modal-body h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--terms-ink);
  letter-spacing: 0;
}

.terms-modal-body p {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--terms-muted);
  line-height: 1.6;
}

.terms-modal-body a {
  color: var(--terms-navy);
  font-weight: 600;
}

.terms-check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--terms-soft-bg);
  border: 1px solid var(--terms-row-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 20px;
  cursor: pointer;
}

#terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"],
body.pricing-page #terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"] {
  all: unset;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box !important;
  margin: 1px 0 0 !important;
  flex: 0 0 16px !important;
  accent-color: var(--terms-navy);
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: inline-grid !important;
  place-items: center;
  border: 1.25px solid var(--terms-check-border);
  border-radius: 4px;
  background: var(--terms-surface);
  cursor: pointer;
  line-height: 1;
}

#terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]::after,
body.pricing-page #terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid var(--terms-surface);
  border-bottom: 2px solid var(--terms-surface);
  opacity: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

#terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]:checked,
body.pricing-page #terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]:checked {
  border-color: var(--terms-navy);
  background: var(--terms-navy);
}

#terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]:checked::after,
body.pricing-page #terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]:checked::after {
  opacity: 1;
}

#terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]:focus-visible,
body.pricing-page #terms-overlay .terms-check-row > .terms-checkbox[type="checkbox"]:focus-visible {
  outline: 3px solid var(--terms-focus-ring);
  outline-offset: 2px;
}

.terms-check-label {
  font-size: 13px;
  color: var(--terms-navy);
  line-height: 1.5;
  cursor: pointer;
}

.terms-check-label a {
  color: var(--terms-gold);
}

.terms-modal-actions {
  display: flex;
  gap: 8px;
}

.terms-btn-primary {
  flex: 1;
  height: 46px;
  background: linear-gradient(135deg, var(--terms-gold), var(--terms-gold-mid) 50%, var(--terms-gold));
  background-size: 200% 100%;
  color: var(--terms-ink);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition:
    background-position 0.3s,
    opacity 0.15s;
}

.terms-btn-primary:hover {
  background-position: 100% 0;
}

.terms-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.terms-btn-primary.is-loading,
.terms-btn-primary.is-loading:disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  opacity: 1;
  cursor: wait;
  background-position: 100% 0;
}

.terms-btn-spinner {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 2px solid rgba(13, 27, 42, 0.24);
  border: 2px solid color-mix(in srgb, var(--terms-ink) 24%, transparent);
  border-top-color: var(--terms-ink);
  border-radius: 50%;
  animation: termsSpinner 0.72s linear infinite;
}

.terms-btn-loading-label {
  white-space: nowrap;
}

.terms-btn-ghost {
  height: 46px;
  padding: 0 18px;
  background: none;
  border: 1px solid var(--terms-ghost-border);
  border-radius: 8px;
  color: var(--terms-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.terms-btn-ghost:hover {
  background: var(--terms-ghost-hover);
}

.terms-btn-ghost:disabled,
#terms-overlay[data-pending="true"] .terms-check-row {
  opacity: 0.55;
  cursor: wait;
}

@keyframes termsSpinner {
  to {
    transform: rotate(360deg);
  }
}

@keyframes termsOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terms-btn-spinner {
    animation-duration: 1.4s;
  }
}

@keyframes termsModalIn {
  from {
    transform: scale(0.94) translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
