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

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

document.getElementById("userName").innerText =
  data.nickname || data.first_name;

document.getElementById("greetingText").innerText =
  new Date().getHours() < 12 ? "Good morning" :
  new Date().getHours() < 18 ? "Good afternoon" :
  "Good evening";

if (data.kyc_level >= 2) {
  document.getElementById("kycBanner").style.display = "none";
}

function goTo(page) {
  location.href = page;
}

function blocked() {
  alert("Complete ID verification to unlock this feature.");
}
