<?php use App\Core\Csrf; $name=$identity['raison_sociale'] ?: trim(($identity['nom']??'').' '.($identity['prenom']??'')); ?>
<link rel="stylesheet" href="/public/assets/css/axiom-ui.css">
<link rel="stylesheet" href="/public/assets/css/axiom-identity.css">
<main class="axiom-identity">
 <div class="axiom-page-nav"><div class="axiom-page-nav__trail"><a href="/public/administration/axiom">AXIOM Studio</a><span>›</span><a href="/public/administration/axiom/identites">Identity Engine</a><span>›</span><strong><?= htmlspecialchars($name) ?></strong></div><div class="axiom-page-nav__actions"><a class="axiom-btn-back" href="/public/administration/axiom/identites">← Retour aux identités</a></div></div>
 <header class="identity-hero compact"><div><span class="identity-kicker"><?= htmlspecialchars((string)$identity['type_identite']) ?></span><h2><?= htmlspecialchars($name) ?></h2><p><?= htmlspecialchars((string)($identity['identifiant_externe']??'')) ?></p></div><div class="identity-actions"><a class="btn-back" href="/public/administration/axiom/identites">← Retour</a></div></header>
 <section class="identity-detail-grid">
  <article class="identity-panel"><h3>Identité</h3><dl><div><dt>Nom</dt><dd><?= htmlspecialchars((string)$identity['nom']) ?></dd></div><div><dt>Prénom</dt><dd><?= htmlspecialchars((string)($identity['prenom']??'—')) ?></dd></div><div><dt>Naissance</dt><dd><?= htmlspecialchars((string)($identity['date_naissance']??'—')) ?></dd></div><div><dt>Statut</dt><dd><?= htmlspecialchars((string)$identity['statut']) ?></dd></div></dl></article>
  <article class="identity-panel"><h3>Rôles</h3><div class="chip-list"><?php foreach($identity['roles'] as $r): ?><span><?= htmlspecialchars((string)$r['role_label']) ?></span><?php endforeach; ?><?php if(!$identity['roles']): ?><em>Aucun rôle</em><?php endif; ?></div></article>
  <article class="identity-panel"><h3>Coordonnées</h3><?php foreach($identity['contacts'] as $c): ?><p><strong><?= htmlspecialchars((string)$c['type_contact']) ?> :</strong> <?= htmlspecialchars((string)$c['valeur']) ?></p><?php endforeach; ?><?php foreach($identity['addresses'] as $a): ?><p><?= htmlspecialchars(trim(($a['ligne1']??'').' '.($a['ligne2']??'').' '.($a['code_postal']??'').' '.($a['ville']??''))) ?></p><?php endforeach; ?><?php if(!$identity['contacts']&&!$identity['addresses']): ?><em>Aucune coordonnée</em><?php endif; ?></article>
  <article class="identity-panel"><h3>Relations</h3><?php foreach($identity['relations'] as $r): ?><p><strong><?= htmlspecialchars((string)$r['relation_label']) ?></strong> → <?= htmlspecialchars((string)($r['target_raison_sociale'] ?: trim(($r['target_nom']??'').' '.($r['target_prenom']??'')))) ?></p><?php endforeach; ?><?php if(!$identity['relations']): ?><em>Aucune relation</em><?php endif; ?></article>
 </section>
 <form method="post" action="/public/administration/axiom/identites/archiver" onsubmit="return confirm('Archiver cette identité ?')"><?= Csrf::field() ?><input type="hidden" name="id" value="<?= (int)$identity['id'] ?>"><button class="btn-danger">Archiver l’identité</button></form>
</main>
