<?php $h=static fn($v):string=>htmlspecialchars((string)$v,ENT_QUOTES,'UTF-8'); ?>
<style>body{font-family:Arial,sans-serif;color:#172033}main{max-width:1000px;margin:30px auto;padding:24px}.card{border:1px solid #ccd6e3;border-radius:12px;padding:18px;margin:14px 0}table{width:100%;border-collapse:collapse}th,td{padding:8px;border-bottom:1px solid #ddd;text-align:left}@media print{button{display:none}}</style>
<main><button onclick="window.print()">Imprimer / PDF</button><h1>Rapport d’incident SOC</h1><div class="card"><strong><?= $h($incident['title']) ?></strong><p>UUID : <?= $h($incident['incident_uuid']) ?></p><p>Statut : <?= $h($incident['status']) ?> · Gravité : <?= $h($incident['severity']) ?> · Score : <?= (int)$incident['risk_score'] ?>/100</p><p>Module : <?= $h($incident['module'] ?: '—') ?> · Du <?= $h($incident['first_event_at']) ?> au <?= $h($incident['last_event_at']) ?></p><p>Affecté à : <?= (int)($incident['assigned_to']??0) ?: 'Non affecté' ?></p><p>Motif de clôture : <?= $h($incident['closed_reason']??'') ?></p></div><div class="card"><h2>Actions de réponse</h2><table><tr><th>Date</th><th>Type</th><th>Compte rendu</th></tr><?php foreach($incident['actions'] as $a):?><tr><td><?= $h($a['created_at']) ?></td><td><?= $h($a['action_type']) ?></td><td><?= nl2br($h($a['content'])) ?></td></tr><?php endforeach?></table></div><div class="card"><h2>Événements corrélés</h2><table><tr><th>Date</th><th>Événement</th><th>Résultat</th></tr><?php foreach($incident['events'] as $e):?><tr><td><?= $h($e['occurred_at']) ?></td><td><?= $h($e['category'].'.'.$e['action']) ?></td><td><?= $h($e['result']) ?></td></tr><?php endforeach?></table></div></main>