<div class="rounded-3xl border border-slate-200 bg-white shadow-soft">
  <div class="border-b border-slate-100 p-5"><h2 class="text-lg font-bold text-slate-900">Recent Audit Logs</h2><p class="text-sm text-slate-500">Latest 25 audit events with target tenant and IP details.</p></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">Target Tenant</th><th class="px-5 py-3">IP</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 whitespace-nowrap">{{ 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.target_tenant_id or '-' }}</td><td class="px-5 py-3">{{ log.ip_address or '-' }}</td><td class="px-5 py-3"><span class="rounded-full bg-slate-100 px-2 py-1 text-xs font-semibold text-slate-700">{{ log.status }}</span></td></tr>
        {% else %}
        <tr><td colspan="7" class="px-5 py-8 text-center text-slate-500">No audit logs found.</td></tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>