<x-mail::message>
# System Health Digest

@php
    $cpu = (int) ($stats['cpu'] ?? 0);
    $ram = (int) ($stats['ram']['percentage'] ?? 0);
    $cpuLabel = $cpu >= 85 ? '🔴 Critical' : ($cpu >= 65 ? '🟡 Elevated' : '🟢 Healthy');
    $ramLabel = $ram >= 85 ? '🔴 Critical' : ($ram >= 65 ? '🟡 Elevated' : '🟢 Healthy');
@endphp

Dear System Administrator,

Please find enclosed the automated system performance and health report for **{{ config('app.name') }}**, generated on {{ now()->format('d M Y, H:i T') }}.

<x-mail::table>
| Metric                         | Value                                                                       | Status     |
|:-------------------------------|:----------------------------------------------------------------------------|:-----------|
| CPU load                       | {{ $cpu }}%                                                                 | {{ $cpuLabel }} |
| Memory usage                   | {{ $stats['ram']['used'] ?? 'n/a' }} / {{ $stats['ram']['total'] ?? 'n/a' }} ({{ $ram }}%) | {{ $ramLabel }} |
| Active sessions                | {{ $stats['users'] ?? 0 }}                                                  | —          |
| Queue backlog                  | {{ $stats['queues']['pending'] ?? 0 }} pending                              | —          |
| Database size                  | {{ $stats['db_stats']['size'] ?? 'n/a' }}                                   | —          |
</x-mail::table>

## Diagnostic Analysis Summary

{{ $analysis }}

<x-mail::button :url="config('app.url') . '/monitoring'" color="primary">
Open Monitoring Dashboard
</x-mail::button>

This is an automated administrative notification. You are receiving this communication because your account holds the necessary privileges (`view health and logs`) to monitor system diagnostics. To manage your communication preferences, please navigate to **System Settings → Notifications**.

Sincerely,
**{{ config('app.name') }} IT Operations**
</x-mail::message>
