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

if (!user || user.account_status !== "active") {
  location.href = "index.html";
}

// Profile info
document.getElementById("fullName").innerText =
  user.first_name + " " + user.last_name;

document.getElementById("phone").innerText = user.phone;
document.getElementById("email").innerText = user.email;

// KYC status
const kycStatusEl = document.getElementById("kycStatus");

if (user.kyc_level >= 2) {
  kycStatusEl.innerText = "Verified";
  kycStatusEl.className = "kyc-pill approved";
} else {
  kycStatusEl.innerText = "Pending Verification";
  kycStatusEl.className = "kyc-pill pending";
}

// Limits (mocked)
document.getElementById("sendLimit").innerText =
  user.kyc_level >= 2 ? "UGX 500,000" : "Locked";

document.getElementById("withdrawLimit").innerText =
  user.kyc_level >= 2 ? "UGX 300,000" : "Locked";

function goToKYC() {
  location.href = "kyc.html";
}
