<?php
// panel/element/generate_csrf.php
session_start();
header('Content-Type: application/json');

if (empty($_SESSION['login_csrf_token'])) {
    $_SESSION['login_csrf_token'] = bin2hex(random_bytes(32));
}

echo json_encode(['token' => $_SESSION['login_csrf_token']]);
?>