@php($auditLogs = $auditLogs ?? collect())

<div class="table-responsive">
    <table class="table table-hover align-middle mb-0">
        <thead>
            <tr>
                <th>Date</th>
                <th>Action</th>
                <th>User</th>
                <th>Details</th>
            </tr>
        </thead>
        <tbody>
            @forelse($auditLogs as $log)
                <tr>
                    <td>{{ app_datetime($log->created_at) ?? '-' }}</td>
                    <td><span class="badge text-bg-light text-dark">{{ str_replace('_', ' ', ucfirst($log->action)) }}</span></td>
                    <td>{{ $log->user?->name ?? 'System' }}</td>
                    <td>{{ $log->description ?: '-' }}</td>
                </tr>
            @empty
                <tr><td colspan="4" class="text-center text-muted py-4">No audit activity yet.</td></tr>
            @endforelse
        </tbody>
    </table>
</div>
