<div class="card">
  <div class="table-wrap">
    <table class="table">
      <thead><tr><th>When</th><th>User</th><th>Action</th><th>Entity</th><th>Details</th></tr></thead>
      <tbody>
      <?php foreach ($logs as $l) : ?>
        <tr>
          <td class="text-sm"><?= fmt_dt($l['created_at']) ?></td>
          <td><?= e($l['user_name'] ?? 'System') ?></td>
          <td><span class="badge badge-outline"><?= e($l['action']) ?></span></td>
          <td class="text-sm"><?= e($l['entity']) ?> <?= $l['entity_id'] ? '#' . $l['entity_id'] : '' ?></td>
          <td class="text-sm"><?= e($l['details']) ?></td>
        </tr>
      <?php endforeach; ?>
      <?php if (empty($logs)) : ?><tr><td colspan="5" class="text-faint">No configuration changes recorded yet.</td></tr><?php endif; ?>
      </tbody>
    </table>
  </div>
</div>
