document.getElementById("submitKycBtn").addEventListener("click", () => {
  const docType = document.getElementById("docType").value;
  const front   = document.getElementById("docFront").files[0];
  const back    = document.getElementById("docBack").files[0];
  const selfie  = document.getElementById("selfie").files[0];

  if (!docType || !front || !back || !selfie) {
    alert("Please complete all KYC steps.");
    return;
  }

  const onboarding = JSON.parse(localStorage.getItem("flowpesa_onboarding"));

  onboarding.kyc = {
    level: 1,
    status: "pending",
    document_type: docType,
    submitted_at: new Date().toISOString()
  };

  localStorage.setItem("flowpesa_onboarding", JSON.stringify(onboarding));

  alert("KYC submitted successfully. Verification in progress.");

  window.location.href = "dashboard.html";
});
