<?php
require __DIR__ . '/backend/config/database.php';
$db   = getDB();
$hash = password_hash('admin123', PASSWORD_BCRYPT);
$db->prepare("UPDATE users SET email = 'admin@stileenergy.com', password = ?, is_active = 1 WHERE role = 'admin' OR id = 'admin-001' OR LOWER(email) IN ('admin@stilenergy.com','admin@stileenergy.com')")->execute([$hash]);
$stored = $db->query("SELECT password FROM users WHERE role = 'admin' OR id = 'admin-001' OR LOWER(email)='admin@stileenergy.com' LIMIT 1")->fetchColumn();
$ok     = password_verify('admin123', $stored);
echo $ok ? "✅ Admin password fixed! Login with admin123\n" : "❌ Something went wrong\n";
