/* Airlend Flow v21 — borrower onboarding, commercial deal fields, worksheet and Monergise bridge */

.af-borrower-grid--onboarding {
  align-items: start;
}

.af-onboarding-form {
  overflow: visible;
}

.af-onboarding-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 20px;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  background: rgba(248, 250, 252, .85);
}

.af-onboarding-steps button {
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(15, 23, 42, .58);
  padding: 10px 8px;
  font-weight: 850;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.af-onboarding-steps button span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, .08);
  color: #1d4ed8;
}

.af-onboarding-steps button.is-active,
.af-onboarding-steps button.is-done {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 12px 24px rgba(15, 23, 42, .08);
}

.af-onboarding-steps button.is-active span,
.af-onboarding-steps button.is-done span {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
}

.af-onboarding-panel {
  display: none;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 20px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .06);
}

.af-onboarding-panel.is-active {
  display: block;
}

.af-section-headline {
  margin-bottom: 16px;
}

.af-section-headline h3 {
  margin: 4px 0 0;
  font-size: 18px;
  letter-spacing: -.02em;
}

.af-entity-panel {
  display: none;
}

.af-entity-panel.is-active {
  display: block;
}

.af-repeater-group {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  padding: 14px;
  background: rgba(248, 250, 252, .7);
  margin-bottom: 14px;
}

.af-repeater-group.is-hidden {
  display: none;
}

.af-repeater-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.af-repeater-head strong {
  display: block;
  font-size: 14px;
}

.af-repeater-head small {
  display: block;
  color: rgba(15, 23, 42, .58);
  font-size: 12px;
  margin-top: 2px;
}

.af-repeater-row {
  position: relative;
  border: 1px solid rgba(37, 99, 235, .12);
  border-radius: 16px;
  padding: 14px 42px 14px 14px;
  background: #fff;
  margin-top: 10px;
}

.af-repeater-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(239, 68, 68, .09);
  color: #b91c1c;
}

.af-onboarding-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.af-onboarding-errors {
  margin-top: 14px;
  border: 1px solid rgba(220, 38, 38, .24);
  background: rgba(254, 242, 242, .9);
  color: #991b1b;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 750;
}

.af-confirm-card {
  display: flex;
  gap: 14px;
  border: 1px solid rgba(37, 99, 235, .14);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(37, 99, 235, .06), rgba(255, 255, 255, .94));
  margin-bottom: 16px;
}

.af-confirm-card i {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #fff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .12);
}

.af-confirm-card strong {
  display: block;
  color: #0f172a;
  margin-bottom: 4px;
}

.af-confirm-card p {
  margin: 0;
  color: rgba(15, 23, 42, .66);
  line-height: 1.45;
}

.af-field-grid--four {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.af-field--span {
  grid-column: span 2;
}

.af-commercial-panel,
.af-worksheet-panel {
  background-image: linear-gradient(180deg, rgba(37, 99, 235, .025), rgba(255, 255, 255, 0) 180px);
}

.af-commercial-form,
.af-worksheet-form {
  display: block;
}

.af-json-details {
  margin-top: 14px;
  border: 1px dashed rgba(15, 23, 42, .16);
  border-radius: 16px;
  padding: 12px;
  background: rgba(248, 250, 252, .8);
}

.af-json-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  color: rgba(15, 23, 42, .74);
}

.af-json-details[open] summary {
  margin-bottom: 12px;
}

.af-form-actions--end {
  justify-content: flex-end;
}

.af-worksheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.af-subcard {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, .88);
}

.af-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 800;
  color: rgba(15, 23, 42, .7);
}

.af-monergise-result,
.af-worksheet-list {
  margin-top: 14px;
  border-radius: 14px;
  padding: 12px;
  background: rgba(248, 250, 252, .88);
  color: rgba(15, 23, 42, .68);
  font-size: 13px;
}

.af-worksheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgba(15, 23, 42, .08);
}

.af-worksheet-row:first-child {
  border-top: 0;
}

.af-worksheet-row strong {
  display: block;
  color: #0f172a;
}

.af-worksheet-row small {
  color: rgba(15, 23, 42, .58);
}

@media (max-width: 980px) {
  .af-onboarding-steps,
  .af-field-grid--four,
  .af-worksheet-grid {
    grid-template-columns: 1fr;
  }

  .af-field--span {
    grid-column: span 1;
  }
}

@media (max-width: 680px) {
  .af-onboarding-steps button {
    justify-content: flex-start;
  }

  .af-repeater-head,
  .af-onboarding-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* v21.1 — Workspace layout + multiple securities */
.af-page--workspace .af-workspace-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: start !important;
}

.af-page--workspace .af-workspace-grid > .af-card {
  grid-column: 1 / -1 !important;
  width: 100%;
}

.af-page--workspace .af-card--snapshot {
  min-height: 0 !important;
}

.af-page--workspace .af-fact-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.af-page--workspace .af-fact-grid dt small,
.af-borrower-facts dt small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .06em;
  color: rgba(15, 23, 42, .48);
}

.af-card-subcopy {
  margin: 6px 0 0;
  color: rgba(15, 23, 42, .62);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 650;
}

.af-commercial-loan-grid {
  margin-bottom: 18px;
}

.af-security-builder {
  margin-top: 18px;
  border: 1px solid rgba(37, 99, 235, .12);
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(37, 99, 235, .035), rgba(248, 250, 252, .72));
}

.af-security-builder-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.af-security-builder-head h3 {
  margin: 4px 0 4px;
  font-size: 18px;
  letter-spacing: -.02em;
  color: #0f172a;
}

.af-security-builder-head small {
  color: rgba(15, 23, 42, .60);
  font-size: 13px;
  font-weight: 650;
}

.af-security-row-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.af-security-row {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .055);
}

.af-security-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.af-security-row-top strong {
  font-size: 13px;
  letter-spacing: .02em;
  color: #0f172a;
  text-transform: uppercase;
}

.af-security-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(239, 68, 68, .09);
  color: #b91c1c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.af-security-remove:hover {
  background: rgba(239, 68, 68, .14);
}

.af-security-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(160px, .85fr) repeat(4, minmax(130px, .7fr));
  gap: 12px;
  align-items: end;
}

.af-security-fields .af-field--address {
  min-width: 0;
}

.af-security-row .af-input,
.af-security-row .af-textarea {
  background: #fff;
}

@media (max-width: 1180px) {
  .af-security-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .af-page--workspace .af-fact-grid,
  .af-field-grid--four,
  .af-security-fields,
  .af-worksheet-grid {
    grid-template-columns: 1fr !important;
  }

  .af-field--span {
    grid-column: span 1;
  }

  .af-security-builder-head {
    flex-direction: column;
  }
}
