:root {
  --blue-dark: #0a2a5e;
  --blue-mid:  #1a4fb5;
  --blue-btn:  #1565c0;
  --accent:    #00c6ff;
  --green:     #00897b;
  --red:       #e53935;
  --bg:        #f0f4fa;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  font-family: 'Segoe UI', sans-serif;
  color: #1a1a2e;
}

/* ── TOP NAV BAR ── */
.topbar {
  background: var(--blue-dark);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar .brand {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-decoration: none;
}
.topbar .brand span { color: var(--accent); }
.back-btn {
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: .82rem;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
  margin-left: auto;
}
.back-btn:hover { background: rgba(255,255,255,.22); color: #fff; }

/* ── PAGE HEADER ── */
.page-header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  padding: 36px 20px 28px;
  text-align: center;
  color: #fff;
}
.page-header .badge-pill {
  display: inline-block;
  background: rgba(0,198,255,.18);
  border: 1px solid rgba(0,198,255,.4);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 30px;
  padding: 5px 16px;
  margin-bottom: 14px;
}
.page-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 8px;
}
.page-header p {
  color: rgba(255,255,255,.72);
  font-size: .9rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── STEP INDICATOR ── */
.steps-wrap {
  background: #fff;
  padding: 18px 20px;
  border-bottom: 1px solid #e0e8f5;
}
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 500px;
  margin: 0 auto;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}
.step-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e0e8f5;
  color: #888;
  font-weight: 800;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #d0daf0;
  transition: all .3s;
}
.step.active .step-dot {
  background: var(--blue-mid);
  color: #fff;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 4px rgba(26,79,181,.18);
}
.step.done .step-dot {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.step-label { font-size: .7rem; font-weight: 600; color: #888; text-align: center; }
.step.active .step-label { color: var(--blue-mid); }
.step.done .step-label { color: var(--green); }
.step-line {
  flex: 1;
  height: 2px;
  background: #e0e8f5;
  margin-top: -20px;
  max-width: 60px;
}

/* ── MAIN CONTAINER ── */
.main-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* ── SECTION CARD ── */
.form-section {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 20px rgba(10,42,94,.09);
  margin-bottom: 24px;
  overflow: hidden;
}
.section-head {
  background: var(--blue-dark);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-head i { font-size: 1.1rem; color: var(--accent); }
.section-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.section-head .badge-count {
  margin-left: auto;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .75rem;
  font-weight: 700;
}
.section-body { padding: 24px; }

/* ── FORM ELEMENTS ── */
.form-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 5px;
  letter-spacing: .2px;
}
.form-label .req { color: var(--red); margin-left: 2px; }
.form-label .opt {
  color: #aaa;
  font-weight: 500;
  font-size: .75rem;
  margin-left: 4px;
}
.form-control, .form-select {
  border: 1.5px solid #dce6f5;
  border-radius: 8px;
  font-size: .88rem;
  padding: 10px 14px;
  color: #1a1a2e;
  transition: border-color .2s, box-shadow .2s;
  background: #fafdff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(26,79,181,.1);
  background: #fff;
}
.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--red);
}
.invalid-feedback { font-size: .77rem; }

/* DOB + AGE ROW */
.dob-age-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.dob-age-row .dob-wrap { flex: 1; }
.age-badge {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 86px;
  text-align: center;
  line-height: 1.2;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.age-badge i { font-size: .75rem; opacity: .8; }

/* ── FAMILY MEMBER CARD ── */
.member-card {
  border: 1.5px solid #dce6f5;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow .25s;
  animation: slideIn .35s ease;
}
.member-card:hover { box-shadow: 0 4px 18px rgba(10,42,94,.1); }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.member-head {
  background: linear-gradient(90deg, #e8f0fd, #f4f7fd);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1.5px solid #dce6f5;
}
.member-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-mid);
  color: #fff;
  font-weight: 800;
  font-size: .82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.member-head h3 { font-size: .9rem; font-weight: 700; color: var(--blue-dark); margin: 0; }
.remove-btn {
  margin-left: auto;
  background: none;
  border: 1.5px solid #ffcdd2;
  color: var(--red);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .2s;
}
.remove-btn:hover { background: #ffebee; }
.member-body { padding: 18px; background: #fff; }

/* ── ADD FAMILY BUTTON ── */
.add-family-wrap { text-align: center; padding: 8px 0 4px; }
.add-family-btn {
  background: none;
  border: 2px dashed var(--blue-mid);
  color: var(--blue-mid);
  border-radius: 10px;
  padding: 14px 28px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  transition: background .2s, color .2s;
}
.add-family-btn:hover:not(:disabled) {
  background: rgba(26,79,181,.07);
}
.add-family-btn:disabled {
  border-color: #ccc;
  color: #aaa;
  cursor: not-allowed;
}
.add-family-btn .plus-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-mid);
  color: #fff;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.add-family-btn:disabled .plus-icon { background: #ccc; }
.family-limit-note {
  font-size: .76rem;
  color: #999;
  margin-top: 8px;
}

/* ── SUBMIT SECTION ── */
.submit-section {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 20px rgba(10,42,94,.09);
  padding: 28px 24px;
  text-align: center;
}
.submit-section p {
  font-size: .82rem;
  color: #666;
  margin-bottom: 20px;
}
.submit-section p i { color: var(--green); margin-right: 4px; }
.btn-submit {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 48px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .5px;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn-submit:hover { opacity: .9; transform: translateY(-1px); }
.btn-reset {
  background: none;
  border: 1.5px solid #dce6f5;
  color: #888;
  border-radius: 8px;
  padding: 13px 28px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 12px;
  transition: background .2s;
}
.btn-reset:hover { background: #f4f7fb; }

/* ── SUCCESS TOAST ── */
.toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: none;
}
.toast-box {
  background: var(--green);
  color: #fff;
  border-radius: 10px;
  padding: 16px 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 24px rgba(0,137,123,.3);
  animation: toastIn .35s ease;
}
@keyframes toastIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── MOBILE ── */
@media (max-width: 575px) {
  .section-body { padding: 16px; }
  .member-body  { padding: 14px; }
  .btn-submit { width: 100%; justify-content: center; margin-bottom: 10px; }
  .btn-reset  { width: 100%; }
  .dob-age-row { flex-direction: column; }
  .age-badge { width: 100%; }
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spinner {
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

.phone-checking {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
}

.phone-exists-warning {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
}

.is-invalid {
    border-color: #dc3545 !important;
}