document.addEventListener("DOMContentLoaded", () => {
  document.querySelectorAll("[data-permission]").forEach(el => {
    const perm = el.dataset.permission;
    if (!hasPermission(perm)) {
      el.style.display = "none";
    }
  });

  document.querySelectorAll("[data-permission-any]").forEach(el => {
    const perms = el.dataset.permissionAny.split(",").map(p => p.trim());
    if (!hasAnyPermission(perms)) {
      el.style.display = "none";
    }
  });

  document.querySelectorAll("[data-permission-all]").forEach(el => {
    const perms = el.dataset.permissionAll.split(",").map(p => p.trim());
    if (!hasAllPermissions(perms)) {
      el.style.display = "none";
    }
  });
});
