-- Add Admin role with tenant and admin management permissions
INSERT INTO roles_permissions (role, tenant_id, branch_id, inheritedFrom, permissions, updatedAt, createdBy)
SELECT 'Admin', NULL, NULL, NULL,
       '{"tenants": ["*"], "admins": ["*"], "theme": ["current"], "users": ["me"], "ui_modals": ["*"]}',
       NOW(),
       1
WHERE NOT EXISTS (SELECT 1 FROM roles_permissions WHERE role = 'Admin');
