<div class="rounded-3xl border border-slate-200 bg-white shadow-soft">
  <div class="flex flex-col gap-3 border-b border-slate-100 p-5 md:flex-row md:items-center md:justify-between">
    <div><h2 class="text-lg font-bold text-slate-900">Recent Audit Logs</h2><p class="text-sm text-slate-500">Latest firm-level activity, if audit log model is available.</p></div>
    <a href="/system-settings/audit-logs" class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50">Open Audit Logs</a>
  </div>
  <div class="overflow-x-auto">
    <table class="min-w-full divide-y divide-slate-100 text-sm">
      <thead class="bg-slate-50 text-left text-xs font-semibold uppercase tracking-wide text-slate-500"><tr><th class="px-5 py-3">Time</th><th class="px-5 py-3">User</th><th class="px-5 py-3">Action</th><th class="px-5 py-3">Entity</th><th class="px-5 py-3">Status</th></tr></thead>
      <tbody class="divide-y divide-slate-100">
        {% for log in audit_logs %}
        <tr class="hover:bg-slate-50"><td class="px-5 py-3">{{ log.created_at_utc }}</td><td class="px-5 py-3">{{ log.actor_email or '-' }}</td><td class="px-5 py-3 font-semibold text-slate-900">{{ log.action }}</td><td class="px-5 py-3">{{ log.entity_type }}{% if log.entity_name %} &gt; {{ log.entity_name }}{% endif %}</td><td class="px-5 py-3">{{ log.status or '-' }}</td></tr>
        {% else %}
        <tr><td colspan="5" class="px-5 py-8 text-center text-slate-500">No audit logs found or audit model is not available.</td></tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
