/* ===== Variables =====
   Shared standalone forms (apply, affiliate, recipient, etc.) */
:root {
  color-scheme: light;
  --blue: #003c70;
  --blue-dark: #001b33;
  --orange: #f18700;
  --orange-hover: #c56e00;
  --coral: #ee8844;
  --coral-hover: #e07835;
  --btn-muted: #9e9e9e;
  --grey-bg: #ededed;
  --white: #fff;
  --text-dark: #121212;
  --text-med: #626262;
  --text-light: #888;
  --border: #e9e9e9;
  --border-focus: var(--coral);
  --error: #d32f2f;
  --success: #70b62c;
  --radius: 4px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --content-max: 470px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--grey-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ===== Utility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden { display: none !important; }

/* ===== Header ===== */
.forms-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  min-height: 72px;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 90px;
}

.header-inner .step-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.forms-logo img {
  height: 60px;
  width: auto;
  display: block;
}

.forms-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.forms-close svg {
  display: block;
  width: 24px;
  height: 24px;
}

.forms-close:hover { opacity: 1; text-decoration: none; }

/* ===== Step Indicator ===== */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 24px;
}

.step-indicator .ind-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
  font-size: 16px;
  font-weight: 400;
  white-space: nowrap;
  transition: color 0.2s;
}

.step-indicator .ind-step.active { color: var(--text-dark); }
.step-indicator .ind-step.completed { color: var(--text-med); }

.step-indicator .ind-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 400;
  background: rgba(0, 0, 0, 0.15);
  color: var(--white);
  transition: background 0.2s, color 0.2s;
}

.step-indicator .ind-step.active .ind-num {
  background: var(--orange);
  color: var(--white);
}

.step-indicator .ind-step.completed .ind-num {
  background: var(--orange);
  color: var(--white);
}

/* ===== Main Layout ===== */
.forms-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 60px 20px 40px;
}

/* ===== Steps ===== */
.step { display: none; }
.step.active { display: block; }

/* Step titles — centred, dark, normal weight */
.forms-main > h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 400;
  color: var(--text-dark);
  margin: 0 0 15px;
  line-height: 36px;
}

.step > h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 400;
  color: var(--text-dark);
  margin: 0 0 15px;
  line-height: 36px;
}

.step-subtitle {
  text-align: center;
  color: var(--text-dark);
  font-size: 16px;
  font-weight: 400;
  margin: 0 0 24px;
  line-height: 24px;
}

.section-divider {
  margin-top: 40px;
}

/* ===== Account Type Selection (Step 0) ===== */
.type-options {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 24px auto;
  max-width: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.type-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  user-select: none;
}

.type-option + .type-option {
  border-top: 1px solid var(--border);
}

.type-option:hover { background: #f9f9f9; }

.type-icon {
  flex-shrink: 0;
  fill: var(--orange);
}

.type-label {
  flex: 1;
  font-size: 18px;
  font-weight: 400;
}

.radio-dot {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s;
}

.radio-dot::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  transform: scale(0);
  transition: transform 0.15s;
}

.type-option input:checked ~ .radio-dot {
  border-color: var(--orange);
}

.type-option input:checked ~ .radio-dot::after {
  transform: scale(1);
}

#btnSelectType {
  display: block;
  margin: 0 auto;
  max-width: 400px;
  width: 100%;
}

/* ===== Form Card ===== */
.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  margin-bottom: 24px;
}

.form-card h3 {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dark);
  margin: 24px 0 15px;
  line-height: 24px;
}

.form-card h3:first-child { margin-top: 0; }

/* Recipient details — steps 1–2 match other forms; step 3 stays wider for beneficiary fields */
.recipient-form {
  max-width: var(--content-max);
}

.recipient-form:has(#step3.active) {
  max-width: 600px;
}

.recipient-form .form-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 24px;
  box-shadow: none;
}

.recipient-form textarea.form-textarea {
  background: var(--white);
}

/* Dynamic beneficiary labels — same typography as .form-card h3 on apply forms */
.recipient-form .recipient-field-label {
  display: block;
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dark);
  margin: 0 0 5px;
  line-height: 24px;
}

.recipient-form .recipient-field-label .recipient-label-hint {
  font-weight: 400;
  color: var(--text-light);
}

/* Recipient step 3: more air under page title; recap reads as the lead-in to the fields */
.recipient-form.forms-main > h2 {
  margin-bottom: 36px;
}

.recipient-form #step3 #dynamicFields {
  margin-top: 4px;
}

.recipient-step3-recap {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid #dbdbdb;
}

.recipient-step3-recap__text {
  margin: 0;
  max-width: 36em;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text-dark);
  letter-spacing: -0.01em;
}

.recipient-step3-recap__text strong {
  color: var(--text-dark);
  font-weight: 600;
}

/* ===== Form Layout ===== */
.form-row {
  margin-bottom: 15px;
}

.form-row:last-child { margin-bottom: 0; }

.form-group { width: 100%; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

/* ===== Inputs & Selects ===== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"] {
  width: 100%;
  height: 54px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 52px;
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}

select {
  width: 100%;
  height: 54px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: normal;
  font-family: var(--font);
  color: var(--text-dark);
  background-color: var(--white);
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23626262' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 36px;
}

input:hover,
select:hover,
input:focus,
select:focus {
  border-color: var(--border-focus);
}

input::placeholder { color: var(--text-light); }

input:disabled, select:disabled {
  background: #f5f5f5;
  color: var(--text-light);
  cursor: not-allowed;
}

/* Validation error state */
input.field-error, select.field-error {
  border-color: var(--error);
}

.field-error-msg {
  color: var(--error);
  font-size: 15px;
  line-height: 1.45;
  margin-top: 6px;
}

/* Recipient form: routing vs BIC composite requirement (shown between bank fields and notes) */
.recipient-routing-bic-banner__text {
  margin: 0;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--error);
  background: #fff8f8;
  border: 1px solid rgba(211, 47, 47, 0.35);
  border-radius: var(--radius);
}

/* ===== Address Search ===== */
.address-search-row { position: relative; }

.address-search {
  padding-right: 14px !important;
}

.link-manual-address {
  display: inline-block;
  font-size: 13px;
  margin-top: 6px;
  color: var(--orange);
  cursor: pointer;
}

.address-fields {
  margin-top: 12px;
}

/* Google Places Autocomplete dropdown styling */
.pac-container {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-top: 4px;
  font-family: var(--font);
}

/* Places API (New) programmatic suggestions (apply form) */
.address-suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 40;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 14px;
}

.address-suggest-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.address-suggest-item:last-child {
  border-bottom: none;
}

.address-suggest-item:hover {
  background: #f5f5f5;
}

.address-suggest-attrib {
  padding: 8px 14px;
  font-size: 11px;
  color: #70757a;
  cursor: default;
  border-top: 1px solid var(--border);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  padding: 0 32px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 400;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.15s;
  text-decoration: none;
  box-shadow: none;
}

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

.btn-primary {
  background: var(--coral);
  border-color: var(--coral);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) {
  background: var(--coral-hover);
  border-color: var(--coral-hover);
}

.btn-secondary {
  background: var(--btn-muted);
  border-color: var(--btn-muted);
  color: var(--white);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--coral);
  border-color: var(--coral);
}

.btn-back-top {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
  margin-bottom: 8px;
}
.btn-back-top:hover {
  text-decoration: underline;
}

.btn-add {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
  width: 100%;
  margin-bottom: 24px;
}
.btn-add:hover:not(:disabled) {
  background: var(--coral);
  border-color: var(--coral);
}

.btn-remove {
  background: none;
  border: none;
  color: var(--error);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
}
.btn-remove:hover { color: #b71c1c; }

/* Step navigation buttons */
.step-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
}

.step-buttons .btn {
  min-width: 140px;
}

/* ===== Person Entry (signatories, shareholders, parties) ===== */
.entries-container {
  margin-bottom: 16px;
}

.person-entry {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.person-entry legend { display: none; }

.person-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.person-legend {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dark);
  display: block !important;
  float: none;
  width: auto;
  line-height: 24px;
}

.person-entry h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 16px 0 10px;
}

.person-entry h4:first-of-type { margin-top: 0; }

.person-entry .form-row { margin-bottom: 10px; }

.person-entry .three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

/* ===== Checkbox ===== */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  margin: 20px 0;
  text-align: center;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--coral);
}

.checkbox-label a { color: var(--orange); }

/* ===== Turnstile ===== */
.turnstile-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  min-height: 0;
  /* No min-height: interaction-only widgets often leave no visible UI; reserve no gap. */
}

/* ===== Form Errors ===== */
.form-error-banner {
  background: #fce4e4;
  border: 1px solid var(--error);
  border-radius: var(--radius);
  color: var(--error);
  padding: 12px 16px;
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 20px;
  text-align: center;
}

/* ===== Loading ===== */
.btn-submit.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-submit.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  margin-left: 8px;
  animation: spin 0.6s linear infinite;
}

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

/* ===== Terms scroll ===== */
.terms-card {
  padding-bottom: 20px;
}

.terms-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--grey-bg);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-med);
}

.terms-scroll h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 20px 0 8px;
}

.terms-scroll h4:first-child { margin-top: 0; }

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

.terms-scroll ul {
  margin: 0 0 10px;
  padding-left: 20px;
}

.terms-scroll li {
  margin-bottom: 6px;
}

.terms-scroll ul ul {
  margin-top: 6px;
}

/* ===== Field help (recipient / dynamic fields) ===== */
.field-help {
  font-size: 12px;
  color: var(--text-med);
  margin-top: 4px;
  line-height: 1.35;
}

/* ===== Step back button ===== */
.step-buttons--split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.step-back.btn-secondary {
  min-width: auto;
  padding: 0 20px;
  height: 60px;
}

/* ===== Combobox (forms pages, searchable select) ===== */
.combobox-wrap {
  position: relative;
  width: 100%;
}

.combobox-input-wrap {
  position: relative;
}

.combobox-input {
  width: 100%;
  height: 54px;
  padding: 0 40px 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 52px;
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}

.combobox-input:hover,
.combobox-input:focus {
  border-color: var(--border-focus);
}

.combobox-input.field-error {
  border-color: var(--error);
}

.combobox-toggle {
  position: absolute;
  right: 0;
  top: 0;
  width: 40px;
  height: 54px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  padding: 0;
}

.combobox-toggle::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-light);
  transition: transform 0.15s;
}

.combobox-wrap.is-open .combobox-toggle::after {
  transform: rotate(180deg);
}

.combobox-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 50;
  display: none;
}

.combobox-wrap.is-open .combobox-list {
  display: block;
}

.combobox-list li {
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text-dark);
  cursor: pointer;
  line-height: 1.35;
}

.combobox-list li:hover,
.combobox-list li.is-highlighted,
.combobox-list li.is-active {
  background: var(--grey-bg);
}

.combobox-list li[hidden] {
  display: none;
}

.combobox-list .combobox-empty {
  color: var(--text-light);
  cursor: default;
  font-size: 14px;
}

.combobox-list .combobox-empty:hover {
  background: transparent;
}

.recipient-notice {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-med);
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--grey-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.recipient-notice strong {
  color: var(--text-dark);
}

.recipient-notice__phone {
  margin-top: 10px;
  margin-bottom: 0;
}

.recipient-notice--before-actions {
  margin-top: 0;
  margin-bottom: 16px;
}

/* Prominent callout (recipient security reminder) */
.recipient-notice--prominent {
  padding: 16px 18px 18px;
  background: #fff8e6;
  border: 1px solid rgba(241, 135, 0, 0.35);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-dark);
}

.recipient-notice--prominent .recipient-notice__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.recipient-notice--prominent .recipient-notice__icon {
  flex-shrink: 0;
  color: var(--orange);
}

.recipient-notice--prominent .recipient-notice__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-dark);
}

.recipient-notice--prominent .recipient-notice__body {
  margin: 0;
  color: var(--text-dark);
}

.recipient-notice--prominent .recipient-notice__body strong {
  font-weight: 600;
  color: var(--text-dark);
}

.recipient-notice--prominent .recipient-notice__phone {
  color: var(--text-dark);
}

.recipient-notice--prominent .recipient-notice__phone strong {
  font-weight: 600;
}

textarea.form-textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: var(--font);
  color: var(--text-dark);
  resize: vertical;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
}

textarea.form-textarea:hover,
textarea.form-textarea:focus {
  border-color: var(--border-focus);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .step-indicator { gap: 12px; }
  .step-indicator .ind-step { font-size: 14px; gap: 6px; }
  .step-indicator .ind-num { width: 26px; height: 26px; font-size: 14px; }
}

@media (max-width: 640px) {
  .header-inner { padding: 0 16px; }

  .forms-logo img { height: 48px; }

  .step-indicator .ind-label { display: none; }
  .step-indicator { gap: 8px; }

  .forms-main { padding: 24px 16px 40px; }

  .forms-main > h2,
  .step > h2 { font-size: 20px; }

  .form-card { padding: 20px 16px; }

  .recipient-form .form-card {
    padding: 0;
  }

  .two-col { grid-template-columns: 1fr; }

  .step-buttons { flex-direction: column-reverse; }
  .step-buttons .btn { width: 100%; min-width: auto; }

  .person-entry { padding: 16px; }
}

@media (max-width: 400px) {
  .three-col { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
}
