:root {
  --ax-primary: #593a27;
  --ax-promo-bg: #593a27;
  --ax-sheet-bg: #ffffff;
  --ax-text: #1a1a1a;
  --ax-muted: #8a8a8a;
  --ax-border: #e2e2e2;
  --ax-error: #c0392b;
  --ax-font: 'Montserrat', system-ui, -apple-system, sans-serif;
  --ax-modal-radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: transparent;
  font-family: var(--ax-font);
  color: var(--ax-text);
  -webkit-font-smoothing: antialiased;
}

/* Center the card in the iframe viewport */
.ax-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px 24px;
}

/* Single unified modal card */
.ax-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  border-radius: var(--ax-modal-radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
}

.ax-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #555;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, color 0.15s;
}

.ax-close:hover {
  background: #fff;
  color: #1a1a1a;
}

/* Loader overlay — only covers the popup card */
.ax-card-loader {
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: var(--ax-modal-radius);
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.ax-card-loader[hidden] {
  display: none !important;
}

.ax-spinner {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  color: var(--ax-primary);
  animation: ax-spin 0.9s linear infinite;
}

.ax-spinner circle {
  stroke-linecap: round;
  animation: ax-dash 1.2s ease-in-out infinite;
}

@keyframes ax-spin {
  100% { transform: rotate(360deg); }
}

@keyframes ax-dash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

#ax-card-loader-text {
  margin: 0;
  font-size: 14px;
  color: #555;
  line-height: 1.45;
  max-width: 260px;
}

.ax-card-loader ~ .ax-close {
  z-index: 21;
}

/* ── Brown promo top (inside card) ── */
.ax-modal-promo {
  background: var(--ax-promo-bg);
  color: #fff;
  text-align: center;
  padding: 28px 20px 36px;
  flex-shrink: 0;
}

.ax-logo {
  max-height: 52px;
  max-width: 160px;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
}

.ax-logo[hidden] { display: none !important; }

.ax-promo-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ax-promo-sub {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  opacity: 0.92;
  line-height: 1.4;
}

/* ── White form sheet (bottom of card) ── */
.ax-modal-sheet {
  background: var(--ax-sheet-bg);
  border-radius: var(--ax-modal-radius) var(--ax-modal-radius) 0 0;
  margin-top: -18px;
  padding: 22px 22px 16px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.ax-step { display: none; }
.ax-step.ax-active { display: block; }

.ax-sheet-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  text-align: left;
  line-height: 1.25;
}

.ax-sheet-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--ax-muted);
  text-align: left;
  line-height: 1.45;
}

.ax-form-group { margin-bottom: 14px; }

.ax-label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  font-weight: 500;
  color: #444;
}

.ax-label[hidden] { display: none !important; }

.ax-required { color: var(--ax-error); }

/* Phone input row — FlexyPe style */
.ax-phone-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.ax-cc {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  background: #fafafa;
  border-right: 1px solid var(--ax-border);
  flex-shrink: 0;
}

.ax-input {
  width: 100%;
  padding: 13px 12px;
  font-size: 15px;
  font-family: var(--ax-font);
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  outline: none;
  color: #1a1a1a;
  background: #fff;
}

.ax-input::placeholder { color: #b0b0b0; }

.ax-input:focus { border-color: #999; }

.ax-phone-row .ax-input {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;
}

.ax-input-email[hidden],
.ax-input-phone[hidden] { display: none !important; }

.ax-chk {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #555;
  margin-bottom: 16px;
  line-height: 1.4;
  cursor: pointer;
}

.ax-chk input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--ax-primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ax-btn {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--ax-font);
  cursor: pointer;
  transition: opacity 0.15s;
}

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

.ax-btn-primary:hover { opacity: 0.92; }

.ax-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ax-divider {
  display: flex;
  align-items: center;
  margin: 14px 0;
  color: #bbb;
  font-size: 12px;
}

.ax-divider::before,
.ax-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #eee;
}

.ax-divider span { padding: 0 8px; }

.ax-divider[hidden],
.ax-link-btn[hidden],
#social-logins[hidden] { display: none !important; }

.ax-link-btn {
  display: block;
  width: 100%;
  border: none;
  background: none;
  color: var(--ax-primary);
  font-size: 13px;
  font-family: var(--ax-font);
  cursor: pointer;
  text-align: center;
  padding: 4px;
}

.ax-back {
  border: none;
  background: none;
  color: var(--ax-primary);
  font-size: 13px;
  font-family: var(--ax-font);
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  font-weight: 500;
}

.ax-error-box,
.ax-success-box {
  display: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.ax-error-box {
  background: rgba(192, 57, 43, 0.08);
  color: var(--ax-error);
}

.ax-success-box {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}

/* OTP */
.ax-otp-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 14px 0;
}

.ax-otp-digit {
  width: 38px;
  height: 46px;
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  background: #fff;
}

.ax-otp-digit.ax-active {
  border-color: var(--ax-primary);
  box-shadow: 0 0 0 2px rgba(89, 58, 39, 0.12);
}

.ax-otp-autofill {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  border: none;
  font-size: 16px;
}

.ax-otp-timer {
  text-align: center;
  font-size: 12px;
  color: var(--ax-muted);
  margin-bottom: 8px;
}

.ax-resend {
  text-align: center;
  font-size: 12px;
  color: var(--ax-muted);
  margin: 10px 0 0;
}

.ax-email-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.ax-email-item {
  padding: 12px;
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  background: #fff;
  font-family: var(--ax-font);
}

.ax-email-item:hover {
  border-color: var(--ax-primary);
  background: rgba(89, 58, 39, 0.04);
}

/* Footer — T&C left, Secured right */
.ax-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 4px;
}

.ax-legal {
  font-size: 11px;
  color: #b0b0b0;
  letter-spacing: 0.01em;
}

.ax-secured {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #b0b0b0;
}

.ax-secured img {
  height: 10px;
  display: block;
}

.ax-social-logins {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ax-btn-social {
  width: 42px;
  height: 42px;
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

#password-field-group[hidden] { display: none !important; }

@media (max-width: 380px) {
  .ax-promo-title { font-size: 22px; }
  .ax-modal-sheet { padding: 18px 16px 14px; }
  .ax-otp-digit { width: 34px; height: 42px; font-size: 16px; }
}
