<?php $currentUser = \App\Core\Auth::user(); $initial = strtoupper(substr((string) ($currentUser['full_name'] ?? 'U'), 0, 1)); ?>
<header class="topbar">
    <div class="topbar-brand">
        <button class="icon-button mobile-menu-toggle" type="button" aria-label="Open navigation" data-mobile-nav-toggle>☰</button>
        <a href="/crm/public/" class="brand-link"><span class="brand-mark">GT</span><span>Grow Tool Therapies</span></a>
    </div>
    <div class="topbar-actions">
        <button class="icon-button" type="button" aria-label="Notifications">🔔</button>
        <a class="user-menu user-menu-link" href="/crm/public/profile"><span class="user-avatar"><?= htmlspecialchars($initial, ENT_QUOTES, 'UTF-8') ?></span><span class="user-meta"><strong><?= htmlspecialchars((string) ($currentUser['full_name'] ?? 'User'), ENT_QUOTES, 'UTF-8') ?></strong><small><?= htmlspecialchars(implode(', ', array_column($currentUser['roles'] ?? [], 'display_name')), ENT_QUOTES, 'UTF-8') ?></small></span></a>
        <form method="post" action="/crm/public/logout" class="inline-form"><input type="hidden" name="_csrf" value="<?= htmlspecialchars(\App\Core\Csrf::token(), ENT_QUOTES, 'UTF-8') ?>"><button class="btn btn-secondary btn-small" type="submit">Logout</button></form>
    </div>
</header>
