<header class="sticky top-0 z-30 flex items-center justify-between h-16 px-6 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 shadow-sm">
    <div class="flex items-center gap-4">
        <button type="button" id="sidebar-toggle" class="lg:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700" aria-label="Toggle sidebar">
            <i class="bx bx-menu text-2xl"></i>
        </button>
        <h1 class="text-lg font-semibold hidden sm:block">Dashboard</h1>
    </div>
    <div class="flex items-center gap-3">
        <?php if (!empty($user)): ?>
            <span class="text-sm text-gray-600 dark:text-gray-400"><?= esc($user['name']) ?></span>
            <form id="logout-form" method="post" action="<?= base_url('logout') ?>" class="inline">
                <?= csrf_field() ?>
                <button type="submit" class="inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:opacity-90 focus:ring-2 focus:ring-primary/20">
                    <i class="bx bx-log-out"></i> Logout
                </button>
            </form>
        <?php endif; ?>
    </div>
</header>
