:root {
  --fp-accent: #078A42;
  --fp-accent-light: #099547;
  --fp-focus: #078A42;
  --fp-error: #dc3545;

  --fp-radius: 12px;
  --fp-radius-lg: 18px;
  --fp-transition: 180ms ease;

  --fp-input-bg: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  --fp-accent-rgba-08: rgba(7, 138, 66, 0.08);
  --fp-accent-rgba-10: rgba(7, 138, 66, 0.10);

  --fp-text: #1f2937;
  --fp-muted: rgba(0,0,0,0.55);
  --fp-border: rgba(0,0,0,0.08);
  --fp-shadow: 0 2px 8px rgba(16,24,40,0.03);
  --fp-card-bg: #ffffff;
}

.fp-shortcode-root,
.fp-shortcode-root * {
  box-sizing: border-box;
}

.fp-shortcode-root {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.fp-form-container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0;
  font-family: inherit;
  color: inherit;
}

.fp-form-container.fp-success-mode {
  width: 100%;
  max-width: 980px;
}

.fp-fidelity-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

/* Step indicator */
.fp-step-indicator {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.fp-step-indicator [data-step] {
  width: 100%;
  text-align: center;
  padding: 10px 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.04);
  transition: all var(--fp-transition);
  line-height: 1.2;
}

.fp-step-indicator [data-step].active,
.fp-step-indicator [data-step].is-active {
  background: linear-gradient(90deg, var(--fp-accent), var(--fp-accent-light));
  color: #fff;
  box-shadow: 0 8px 24px var(--fp-accent-rgba-08);
}

/* Panels and cards */
.fp-step-panel {
  display: none;
  width: 100%;
}

.fp-step-panel.is-active {
  display: block;
}

.fp-step-card {
  width: 100%;
  background: var(--fp-card-bg);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--fp-radius-lg);
  box-shadow: 0 14px 36px rgba(16,24,40,0.06);
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.fp-step-header {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 2px;
}

.fp-step-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fp-text);
  line-height: 1.25;
}

.fp-step-subtext {
  font-size: 0.95rem;
  color: var(--fp-muted);
  line-height: 1.55;
  max-width: 720px;
}

/* Form groups */
.fp-form-group {
  margin-bottom: 0;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fp-form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fp-text);
  line-height: 1.4;
  margin: 0;
}

.fp-form-group input[type="text"],
.fp-form-group input[type="email"],
.fp-form-group input[type="tel"],
.fp-form-group input[type="search"],
.fp-form-group select,
.fp-form-group textarea {
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--fp-radius);
  border: 1px solid var(--fp-border);
  background: var(--fp-input-bg);
  box-shadow: var(--fp-shadow);
  transition:
    box-shadow var(--fp-transition),
    border-color var(--fp-transition),
    transform var(--fp-transition),
    background-color var(--fp-transition);
  font-size: 0.95rem;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  color: var(--fp-text);
  max-width: 100%;
  font: inherit;
  line-height: 1.35;
}

.fp-form-group input:hover,
.fp-form-group select:hover,
.fp-form-group textarea:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16,24,40,0.06);
}

.fp-form-group input:focus,
.fp-form-group select:focus,
.fp-form-group textarea:focus {
  border-color: var(--fp-focus);
  box-shadow: 0 8px 30px var(--fp-accent-rgba-10);
  transform: translateY(-1px);
}

.fp-form-group select {
  background-image:
    linear-gradient(45deg, transparent 50%, #555 50%),
    linear-gradient(135deg, #555 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(1em + 2px),
    calc(100% - 13px) calc(1em + 2px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.fp-form-group select:hover,
.fp-form-group select:focus {
  border-color: var(--fp-accent);
  box-shadow: 0 10px 28px var(--fp-accent-rgba-08);
}

.fp-hint {
  font-size: 0.86rem;
  color: var(--fp-muted);
  margin-top: 2px;
  display: block;
  line-height: 1.5;
}

.fp-span-2 {
  grid-column: 1 / -1;
}

.fp-form-group select option:hover {
  background: var(--fp-accent);
  color: #ffffff;
}

.fp-form-group select option:checked,
.fp-form-group select option[selected] {
  background: var(--fp-accent);
  color: #ffffff;
}

/* Errors */
.fp-error-message {
  color: var(--fp-error);
  font-size: 0.86rem;
  display: block;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--fp-transition), transform var(--fp-transition);
  min-height: 1.1em;
  overflow-wrap: anywhere;
  line-height: 1.45;
  margin-top: 0;
}

.fp-form-group.fp-has-error .fp-error-message {
  opacity: 1;
  transform: translateY(0);
}

.fp-field-error {
  border-color: rgba(220,53,69,0.95) !important;
  box-shadow: 0 8px 20px rgba(220,53,69,0.08) !important;
  background: linear-gradient(180deg, rgba(220,53,69,0.02), rgba(255,255,255,0.01));
  animation: fp-shake 380ms ease;
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px 20px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='%23dc3545'/><text x='12' y='16' font-size='12' text-anchor='middle' fill='%23ffffff' font-family='Arial' font-weight='700'>!</text></svg>");
}

@keyframes fp-shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* Messages */
.fp-message {
  margin-top: 2px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fp-message.success {
  color: #0f5132;
  border: 1px solid rgba(40,167,69,0.15);
  background: rgba(40,167,69,0.04);
}

.fp-message.error {
  color: var(--fp-error);
  border: 1px solid rgba(220,53,69,0.08);
  background: rgba(220,53,69,0.04);
}

.fp-general-error {
  border-left: 3px solid var(--fp-error);
  padding-left: 10px;
}

/* Buttons */
.fp-submit-btn,
.fp-btn-primary,
.fp-btn-secondary,
.fp-distributor-card-btn,
.fp-distributor-option,
.fp-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  transition:
    transform var(--fp-transition),
    box-shadow var(--fp-transition),
    opacity var(--fp-transition),
    background var(--fp-transition),
    border-color var(--fp-transition);
  font: inherit;
}

.fp-submit-btn {
  padding: 11px 18px;
  box-shadow: 0 8px 24px var(--fp-accent-rgba-08);
  background: linear-gradient(90deg, var(--fp-accent), var(--fp-accent-light));
  color: #fff;
}

.fp-submit-btn:hover,
.fp-btn-primary:hover {
  transform: translateY(-1px);
}

.fp-submit-btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.fp-btn-secondary {
  padding: 11px 18px;
  background: #e5e7eb;
  color: #111827;
}

.fp-btn-secondary:hover {
  background: #d1d5db;
  transform: translateY(-1px);
}

.fp-btn-primary {
  background: linear-gradient(90deg, var(--fp-accent), var(--fp-accent-light));
  color: #fff;
  padding: 11px 18px;
  box-shadow: 0 8px 24px var(--fp-accent-rgba-08);
}

.fp-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

.fp-step-actions > * {
  min-width: 180px;
}

.fp-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  animation: fp-spin 900ms linear infinite;
}

@keyframes fp-spin {
  to { transform: rotate(360deg); }
}

/* Distributor cards */
.fp-distributor-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 10px 0 4px;
}

.fp-distributor-card {
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(16,24,40,0.04);
  transition:
    transform var(--fp-transition),
    border-color var(--fp-transition),
    box-shadow var(--fp-transition),
    background var(--fp-transition);
}

.fp-distributor-card:hover {
  transform: translateY(-2px);
  border-color: var(--fp-accent);
  box-shadow: 0 10px 24px rgba(7,138,66,0.10);
}

.fp-distributor-card.is-selected {
  border-color: var(--fp-accent);
  background: rgba(7,138,66,0.04);
}

.fp-distributor-card-title {
  font-weight: 700;
  color: var(--fp-text);
  margin-bottom: 8px;
  line-height: 1.35;
}

.fp-distributor-card-value {
  min-height: 24px;
  color: rgba(0,0,0,0.65);
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.fp-distributor-card-btn {
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--fp-accent), var(--fp-accent-light));
  color: #fff;
  width: 100%;
  box-shadow: 0 8px 20px var(--fp-accent-rgba-08);
}

.fp-distributor-card-btn:hover {
  transform: translateY(-1px);
}

/* Delegate */
#fp_delegate_wrapper {
  margin-top: 2px;
  animation: fp-fade-in 180ms ease;
}

@keyframes fp-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Terms */
.fp-terms-box {
  padding: 14px;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  background: #fff;
}

.fp-terms-scroll {
  max-height: 260px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 8px;
  margin-bottom: 12px;
  color: #374151;
  line-height: 1.65;
  font-size: 0.95rem;
}

.fp-terms-scroll p {
  margin: 0 0 12px;
}

.fp-terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  line-height: 1.45;
}

.fp-terms-check input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--fp-accent);
  flex: 0 0 auto;
}

/* Modal */
.fp-modal {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15,23,42,.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  padding: 12px;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.fp-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.fp-modal-content {
  width: min(820px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 22px;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.18);
  transform: translateY(10px) scale(.99);
  transition: transform 180ms ease;
}

.fp-modal.is-open .fp-modal-content {
  transform: translateY(0) scale(1);
}

.fp-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.fp-modal-content h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.25;
  color: var(--fp-text);
}

.fp-modal-subtitle {
  margin-top: 4px;
  font-size: 0.92rem;
  color: var(--fp-muted);
  line-height: 1.5;
}

.fp-modal-close {
  width: 40px !important;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #f3f4f6;
  color: #111827;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: all 0.2s ease;
}

.fp-modal-close:hover {
  background: #e5e7eb;
  transform: scale(1.05);
}

.fp-modal-close:active {
  transform: scale(0.95);
}

.fp-modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(7,138,66,0.25);
}

.fp-modal-search {
  margin-bottom: 12px;
}

.fp-modal-search input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  outline: none;
  font: inherit;
}

.fp-modal-search input:focus {
  border-color: var(--fp-focus);
  box-shadow: 0 0 0 4px rgba(7,138,66,.08);
}

.fp-modal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--fp-muted);
  gap: 8px;
}

.fp-modal-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
  padding-bottom: 2px;
}

.fp-distributor-option {
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f9fafb;
  cursor: pointer;
  transition: all .18s ease;
  justify-content: space-between;
  text-align: left;
  width: 100%;
  min-width: 0;
}

.fp-distributor-option:hover {
  border-color: var(--fp-accent);
  background: rgba(7,138,66,.05);
  transform: translateY(-1px);
}

.fp-distributor-option.is-current {
  border-color: var(--fp-accent);
  background: rgba(7,138,66,.08);
}

.fp-distributor-option-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fp-distributor-option-badge {
  font-size: .78rem;
  font-weight: 700;
  color: var(--fp-accent);
  flex: 0 0 auto;
}

.fp-distributor-option.is-hidden {
  display: none !important;
}

.fp-modal-empty {
  margin-top: 10px;
  padding: 14px;
  border-radius: 12px;
  background: #f9fafb;
  color: var(--fp-muted);
  text-align: center;
  line-height: 1.5;
}

.fp-modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.fp-modal-actions .fp-btn-secondary {
  min-width: 140px;
}

/* Success */
.fp-success-panel {
  display: none;
}

.fp-hidden-fields {
  display: none !important;
}

.fp-hidden-fields input {
  display: none !important;
}

.fp-muted {
  color: var(--fp-muted);
}

.fp-final-success {
  width: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fp-final-success-card {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(16,24,40,0.08);
  padding: 28px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.fp-final-success-icon {
  flex: 0 0 auto;
  color: #0f5132;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(40,167,69,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fp-final-success-text {
  min-width: 0;
}

.fp-final-success-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--fp-text);
  line-height: 1.2;
  margin-bottom: 8px;
}

.fp-final-success-message {
  font-size: 1rem;
  line-height: 1.7;
  color: #374151;
  overflow-wrap: anywhere;
}

.fp-final-success-note {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--fp-muted);
  line-height: 1.55;
}

.fp-locked {
  pointer-events: none;
  user-select: none;
}

.fp-locked .fp-success-panel,
.fp-locked #fp-success-box {
  pointer-events: auto;
}

.fp-shortcode-root > p,
.fp-form-container > p,
.fp-form-container p {
  margin: 0 !important;
  display: contents;
}

.fp-shortcode-root > br,
.fp-form-container > br,
.fp-form-container p:empty,
.fp-form-container br {
  display: none !important;
}

.fp-form-container p > button {
  width: 100%;
}

body.fp-modal-open {
  overflow: hidden;
}

.fp-terms-scroll p {
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.fp-terms-scroll p strong {
  display: block;
  margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 991px) {
  .fp-step-card {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .fp-step-actions {
    flex-direction: column;
  }

  .fp-step-actions > * {
    width: 100%;
    min-width: 0;
  }

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

  .fp-modal-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .fp-fidelity-form {
    gap: 14px;
  }

  .fp-step-indicator {
    gap: 6px;
  }

  .fp-step-indicator [data-step] {
    font-size: 0.8rem;
    padding: 9px 8px;
    border-radius: 999px;
  }

  .fp-step-card {
    padding: 18px 14px;
    border-radius: 16px;
    gap: 12px;
    box-shadow: 0 10px 24px rgba(16,24,40,0.06);
  }

  .fp-step-title {
    font-size: 1.08rem;
  }

  .fp-step-subtext {
    font-size: 0.9rem;
  }

  .fp-form-group input,
  .fp-form-group select,
  .fp-form-group textarea {
    padding: 13px 14px;
    font-size: 0.95rem;
    border-radius: 10px;
    transform: none;
  }

  .fp-form-group input,
  .fp-form-group select {
    padding-right: 14px !important;
    background-image: none !important;
  }

  .fp-modal {
    padding: 10px;
  }

  .fp-modal-content {
    width: 100%;
    max-height: 90vh;
    border-radius: 18px;
    padding: 16px;
  }

  .fp-modal-head {
    gap: 12px;
    margin-bottom: 12px;
  }

  .fp-modal-content h3 {
    font-size: 1.12rem;
  }

  .fp-distributor-option {
    padding: 12px;
    font-size: 0.92rem;
  }

  .fp-modal-search input {
    padding: 12px;
  }

  .fp-terms-scroll {
    max-height: 180px;
    font-size: 0.9rem;
  }

  .fp-final-success {
    min-height: 260px;
  }

  .fp-final-success-card {
    padding: 20px;
    border-radius: 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .fp-final-success-icon {
    width: 44px;
    height: 44px;
  }

  .fp-final-success-title {
    font-size: 1.18rem;
  }
}

@media (max-width: 560px) {
  .fp-step-indicator {
    grid-template-columns: 1fr;
  }

  .fp-step-indicator [data-step] {
    width: 100%;
    min-width: 0;
  }

  .fp-step-card {
    padding: 16px 12px;
    border-radius: 14px;
  }

  .fp-final-success-note {
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .fp-step-card {
    padding: 14px 10px;
  }

  .fp-modal {
    padding: 8px;
  }

  .fp-modal-content {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
}

@media (hover: none) and (pointer: coarse) {
  .fp-form-group input:hover,
  .fp-form-group select:hover,
  .fp-form-group textarea:hover,
  .fp-submit-btn:hover,
  .fp-btn-primary:hover,
  .fp-btn-secondary:hover,
  .fp-distributor-card:hover,
  .fp-distributor-card-btn:hover,
  .fp-distributor-option:hover {
    transform: none;
  }
}
/* WordPress shortcode cleanup */
.fp-form-container p {
  margin: 0 !important;
  display: contents;
}

.fp-form-container p:empty {
  display: none !important;
}

.fp-form-container br {
  display: none !important;
}

.fp-form-container p > button {
  width: 100%;
}

body.fp-modal-open {
  overflow: hidden;
}

.fp-terms-scroll p {
    margin: 0 0 12px 0; /* space between lines */
    line-height: 1.5;
}

.fp-terms-scroll p strong {
    display: block;     /* puts the title on its own line */
    margin-bottom: 4px; /* space between title and text */
}