<div class="container-fluid">

<h2 class="fw-bold mb-4">
User Access Intelligence Center
</h2>

<div class="row g-3 mb-4">

<?php

$cards = [
    'Users' => $stats['users'],
    'Active Users' => $stats['active_users'],
    'Dormant Users' => $stats['dormant_users'],
    'Users Without Role' => $stats['users_without_role'],
    'Conference Role Links' => $stats['conference_users'],
];

foreach ($cards as $label => $value):

?>

<div class="col-md-2">
<div class="card border-0 shadow-sm">
<div class="card-body text-center">
<div class="text-muted">
<?= htmlspecialchars($label) ?>
</div>
<h3>
<?= (int)$value ?>
</h3>
</div>
</div>
</div>

<?php endforeach; ?>

</div>

<div class="card border-0 shadow-sm">

<div class="card-header fw-bold">
Access Review List
</div>

<div class="table-responsive">

<table class="table table-striped align-middle">

<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Last Login</th>
</tr>
</thead>

<tbody>

<?php foreach ($rows as $r): ?>

<tr>
<td><?= (int)$r['id'] ?></td>
<td><?= htmlspecialchars($r['full_name'] ?? '') ?></td>
<td><?= htmlspecialchars($r['email'] ?? '') ?></td>
<td><?= htmlspecialchars($r['role_code'] ?? '') ?></td>
<td><?= htmlspecialchars($r['last_login_at'] ?? '') ?></td>
</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>
