<div class="container-fluid">

<h2 class="fw-bold mb-4">
Platform Security Operations Center
</h2>

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

<?php

$cards = [

'Users'
=> $stats['users'],

'Roles'
=> $stats['roles'],

'Permissions'
=> $stats['permissions'],

'Dormant Users'
=> $stats['dormant_users'],

'Orphan Permissions'
=> $stats['orphan_permissions'],

'Track Chairs'
=> $stats['track_chairs']

];

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 mb-4">

<div class="card-body text-center">

<h6>
Platform Security Score
</h6>

<?php

$cls =
$stats['security_score'] >= 80
? 'success'
:
(
$stats['security_score'] >= 50
? 'warning'
: 'danger'
);

?>

<h1 class="text-<?= $cls ?>">
<?= (int)$stats['security_score'] ?>%
</h1>

</div>

</div>

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

<div class="card-header fw-bold">
Role Permission Matrix
</div>

<div class="table-responsive">

<table class="table table-striped">

<thead>

<tr>
<th>ID</th>
<th>Role</th>
<th>Code</th>
<th>Permissions</th>
</tr>

</thead>

<tbody>

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

<tr>

<td>
<?= (int)$r['id'] ?>
</td>

<td>
<?= htmlspecialchars($r['name']) ?>
</td>

<td>
<?= htmlspecialchars($r['code']) ?>
</td>

<td>
<?= (int)$r['permission_count'] ?>
</td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>
