:root {
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
}

* { font-family: 'DM Sans', sans-serif; }
h1, h2 { font-family: 'DM Serif Display', serif; }

body {
  background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 50%, #e0f2fe 100%);
  min-height: 100vh;
}

/* Floating Label */
.field-wrap {
  position: relative;
  margin-bottom: 0;
}
.field-wrap input,
.field-wrap select {
  width: 100%;
  padding: 1.375rem 0.875rem 0.5rem;
  border: 1.5px solid #c7d2fe;
  border-radius: 0.625rem;
  background: white;
  font-size: 0.9375rem;
  color: #1e1b4b;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.field-wrap input:focus,
.field-wrap select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.field-wrap label {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9375rem;
  color: #818cf8;
  pointer-events: none;
  transition: all 0.2s;
  background: transparent;
}
.field-wrap input:focus ~ label,
.field-wrap input:not(:placeholder-shown) ~ label,
.field-wrap select:focus ~ label,
.field-wrap select.has-value ~ label {
  top: 0.55rem;
  transform: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #6366f1;
  text-transform: uppercase;
}
.field-wrap input::placeholder { color: transparent; }
.field-wrap select { color: transparent; cursor: pointer; }
.field-wrap select.has-value { color: #1e1b4b; }
.field-wrap select option { color: #1e1b4b; }

/* Section card */
.section-card {
  background: white;
  border-radius: 1.25rem;
  border: 1px solid rgba(99,102,241,0.12);
  box-shadow: 0 2px 20px rgba(99,102,241,0.07);
  padding: 2rem;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.75rem;
}
.section-badge {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Toggle buttons */
.toggle-group {
  display: flex;
  border: 1.5px solid #c7d2fe;
  border-radius: 0.625rem;
  overflow: hidden;
  background: white;
}
.toggle-group input[type="radio"] { display: none; }
.toggle-group label {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.5rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6366f1;
  transition: all 0.18s;
  border-right: 1px solid #c7d2fe;
  user-select: none;
}
.toggle-group label:last-of-type { border-right: none; }
.toggle-group input[type="radio"]:checked + label {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: white;
}
.toggle-group label:hover:not(:has(+ input:checked)) {
  background: #eef2ff;
}

/* Checkbox */
.check-wrap { display: flex; align-items: center; gap: 0.625rem; }
.check-wrap input[type="checkbox"] {
  width: 1.1rem; height: 1.1rem;
  accent-color: #6366f1;
  cursor: pointer;
  flex-shrink: 0;
}
.check-wrap label { font-size: 0.875rem; color: #4338ca; font-weight: 500; cursor: pointer; }

/* Sliding mailing panel */
.mailing-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.3s;
  opacity: 0;
}
.mailing-panel.open {
  max-height: 800px;
  opacity: 1;
}

/* Add borrower button */
.add-btn {
  border: 2px dashed #a5b4fc;
  border-radius: 0.75rem;
  padding: 0.875rem;
  width: 100%;
  background: #f5f3ff;
  color: #6366f1;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.add-btn:hover { background: #eef2ff; border-color: #6366f1; }

/* Submit button */
.submit-btn {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
  color: white;
  border: none;
  padding: 1.125rem 3rem;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
  letter-spacing: 0.02em;
  width: 100%;
}
.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(99,102,241,0.5);
}
.submit-btn:active { transform: translateY(0); }

/* Divider */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #c7d2fe, transparent);
  margin: 1.5rem 0;
}

/* SSN mask */


/* Hide native number spinners */
input[type=number].no-spinner::-webkit-inner-spin-button,
input[type=number].no-spinner::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number].no-spinner { -moz-appearance: textfield; }

/* Custom stacked spinner */
.spin-wrap {
  position: relative;
}
.spin-wrap input {
  padding-right: 2.25rem !important;
}
.spin-wrap input:focus ~ label,
.spin-wrap input:not(:placeholder-shown) ~ label {
  top: 0.55rem;
  transform: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #6366f1;
  text-transform: uppercase;
}
.spin-buttons {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2rem;
  display: flex;
  flex-direction: column;
  border-left: 1.5px solid #a5b4fc;
  border-radius: 0 0.625rem 0.625rem 0;
  overflow: hidden;
}
.spin-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f3ff;
  border: none;
  cursor: pointer;
  color: #6366f1;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.spin-btn:first-child {
  border-bottom: 1.5px solid #a5b4fc;
}
.spin-btn:hover {
  background: #e0e7ff;
  color: #4338ca;
}
.spin-btn:active {
  background: #c7d2fe;
}
/* Keep border radius in sync when input is focused */
.spin-wrap input:focus ~ .spin-buttons {
  border-left-color: #6366f1;
}
.spin-wrap input:focus ~ .spin-buttons .spin-btn:first-child {
  border-bottom-color: #6366f1;
}

/* Borrowers 2, 3, 4 hidden by default */
#borrower2-section, #borrower3-section, #borrower4-section { display: none; }
#borrower2-section.visible, #borrower3-section.visible, #borrower4-section.visible { display: block; }

/* Remove borrower btn */
.remove-btn {
  color: #f87171;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
.remove-btn:hover { color: #ef4444; text-decoration: underline; }

/* Format currency */
.currency-prefix {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6366f1;
  font-weight: 600;
  pointer-events: none;
  font-size: 0.9375rem;
  z-index: 2;
  transition: top 0.2s;
}
.field-wrap input:focus ~ .currency-prefix,
.field-wrap input:not(:placeholder-shown) ~ .currency-prefix {
  top: 63%;
}
.currency-field { padding-left: 1.5rem !important; }

/* Small field label above */
.field-sublabel {
  font-size: 0.72rem;
  color: #6366f1;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}