<?php
/**
 * System Admin layout header and sidebar
 * Separate interface for system administrators (system maintenance only)
 */
if (!isset($pageTitle)) {
    $pageTitle = 'System Admin';
}
$currentPage = $currentPage ?? '';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= htmlspecialchars($pageTitle) ?> - System Admin</title>
    <link rel="icon" href="<?= BASE_PATH ?>/public/img/logo.png" type="image/png">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="<?= BASE_PATH ?>/public/css/style.css">
</head>
<body class="theme-system">
    <div class="layout">
        <div class="system-sidebar-backdrop" id="system-sidebar-backdrop" hidden></div>
        <aside class="sidebar" id="system-sidebar" aria-label="System administration menu">
            <div class="sidebar-brand">
                <img src="<?= BASE_PATH ?>/public/img/logo.png" alt="" class="sidebar-logo">
                <p class="sidebar-name"><?= htmlspecialchars(SITE_FULL_NAME) ?></p>
                <p style="font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; font-weight: 400;">System Administration</p>
            </div>
            <nav>
                <a href="<?= BASE_PATH ?>/system" class="<?= $currentPage === 'system' && ($route_action ?? '') === '' ? 'active' : '' ?>">Dashboard</a>
                <a href="<?= BASE_PATH ?>/system/health" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'health' ? 'active' : '' ?>">System Health</a>
                <a href="<?= BASE_PATH ?>/system/security" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'security' ? 'active' : '' ?>">Security</a>
                <a href="<?= BASE_PATH ?>/system/activity" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'activity' ? 'active' : '' ?>">Activity Logs</a>
                <a href="<?= BASE_PATH ?>/system/settings" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'settings' ? 'active' : '' ?>">Settings</a>
                <a href="<?= BASE_PATH ?>/system/database" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'database' ? 'active' : '' ?>">Database</a>
                <a href="<?= BASE_PATH ?>/system/logs" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'logs' ? 'active' : '' ?>">Logs</a>
                <a href="<?= BASE_PATH ?>/system/backup" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'backup' ? 'active' : '' ?>">Backup</a>
                <a href="<?= BASE_PATH ?>/system/users" class="<?= $currentPage === 'system' && ($route_action ?? '') === 'users' ? 'active' : '' ?>">System Users</a>
                <a href="<?= BASE_PATH ?>/logout" class="sidebar-bottom">Logout</a>
            </nav>
        </aside>
        <main class="main">
            <div class="system-mobile-bar">
                <button type="button" class="system-nav-toggle" id="system-nav-toggle" aria-expanded="false" aria-controls="system-sidebar" aria-label="Open menu">
                    <svg class="system-nav-toggle-icon" width="22" height="22" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
                    </svg>
                </button>
                <span class="system-mobile-bar-title">System Admin</span>
            </div>
            <div class="container">
