<?php
// Minimal topbar. Expects $currentUser (string) and $logoutUrl.
$currentUser = $currentUser ?? ($_SESSION[$authVar] ?? 'user');
$logoutUrl = $logoutUrl ?? 'logout.php';
?>
<header class="navbar navbar-expand-md navbar-dark d-print-none">
  <div class="container-xl">
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
      <a href="dashboard.php">OnePanel</a>
    </h1>

    <div class="navbar-nav flex-row order-md-last">
      <div class="nav-item dropdown">
        <a href="#" class="nav-link d-flex lh-1 text-reset p-0" data-bs-toggle="dropdown" aria-label="Open user menu">
          <span class="avatar avatar-sm" aria-hidden="true"></span>
          <div class="d-none d-xl-block ps-2">
            <div><?php echo htmlspecialchars($currentUser, ENT_QUOTES, 'UTF-8'); ?></div>
            <div class="mt-1 small text-muted">Admin</div>
          </div>
        </a>
        <div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
<!-- removed PRO/paid -->
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="<?php echo htmlspecialchars($logoutUrl, ENT_QUOTES, 'UTF-8'); ?>">Logout</a>
        </div>
      </div>
    </div>
  </div>
</header>
