<div class="panel" style="padding:0;overflow-x:auto;">
<table class="data-table">
<thead><tr><th>Role</th><th>Description</th><th>Staff Count</th><th></th></tr></thead>
<tbody>
<?php foreach ($roles as $r): ?>
<tr>
    <td><?= e($r['role_name']) ?><?= $r['is_system'] ? ' <span class="badge badge-gray">System</span>' : '' ?></td>
    <td><?= e($r['description'] ?? '—') ?></td>
    <td><?= (int) $r['user_count'] ?></td>
    <td>
        <a href="<?= Router::url('admin/roles/permissions?role_id=' . $r['id']) ?>" class="btn btn-secondary" style="padding:5px 12px;font-size:12px;">
            <i class="fa-solid <?= $r['is_system'] ? 'fa-eye' : 'fa-pen' ?>"></i> <?= $r['is_system'] ? 'View Permissions' : 'Edit Permissions' ?>
        </a>
    </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
