<style>
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

  :root {
    --green-400: #16a34a;
    --green-500: #15803d;
    --green-600: #166534;
    --green-700: #14532d;

    --green-glow:   rgba(22, 163, 74, 0.10);
    --green-border: rgba(22, 163, 74, 0.25);

    --surface:   #f8fafb;
    --surface-1: #ffffff;
    --surface-2: #f1f5f2;
    --surface-3: #e6f0e9;

    --text-primary:   #111827;
    --text-secondary: #374151;
    --text-muted:     #6b7280;
    --sidebar-w: 240px;
    --topbar-h:  60px;
  }

  body {
    background-color: var(--surface) !important;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
  }

  .sidebar, .topbar, .content {
    font-family: 'DM Sans', sans-serif;
    box-sizing: border-box;
  }

  /* ════════ OVERLAY UNTUK MOBILE ════════ */
  .sidebar-overlay-mgr {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay-mgr.show {
    opacity: 1;
    pointer-events: all;
  }

  /* ════════ SIDEBAR ════════ */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface-1);
    border-right: 1px solid var(--green-border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
  }

  .sidebar-brand-manager {
    padding: 22px 18px 20px;
    border-bottom: 1px solid var(--green-border);
    text-align: center;
    position: relative;
    flex-shrink: 0;
    background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  }
  .sidebar-brand-manager h4 {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--green-400);
    margin: 0 0 4px 0;
  }
  .sidebar-brand-manager small {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    font-family: 'Space Mono', monospace;
    text-transform: uppercase;
  }

  /* Tombol Close Sidebar (Hanya Muncul di HP) */
  .sidebar-close-mgr {
    display: none;
    position: absolute;
    top: 16px; right: 12px;
    width: 28px; height: 28px;
    border-radius: 6px;
    background: var(--surface-3);
    border: 1px solid var(--green-border);
    color: var(--green-500);
    font-size: 12px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
  }

  .sidebar-nav-manager {
    padding: 14px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
  }
  .sidebar-nav-manager a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.17s, color 0.17s, padding-left 0.17s;
    position: relative;
    white-space: nowrap;
  }
  .sidebar-nav-manager a:hover {
    background: var(--green-glow);
    color: var(--green-400);
    padding-left: 18px;
  }
  .sidebar-nav-manager a.active {
    background: linear-gradient(90deg, rgba(22,163,74,0.12), rgba(22,163,74,0.04));
    color: var(--green-500);
    border: 1px solid var(--green-border);
    font-weight: 600;
  }
  .sidebar-nav-manager a.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--green-400);
  }

  .nav-divider-manager {
    height: 1px;
    background: var(--green-border);
    margin: 8px 0;
  }

  .sidebar-nav-manager a.logout-btn {
    color: rgba(239, 68, 68, 0.75);
  }
  .sidebar-nav-manager a.logout-btn:hover {
    background: rgba(239, 68, 68, 0.07);
    color: #dc2626;
    padding-left: 18px;
    border: none;
  }

  /* ════════ CONTENT & TOPBAR ════════ */
  .content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    background: var(--surface);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .topbar {
    height: var(--topbar-h);
    background: var(--surface-1);
    border-bottom: 1px solid var(--green-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  }

  .topbar-left-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  /* Tombol Hamburger (Hanya Muncul di HP) */
  .topbar-toggle-mgr {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--green-border);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
  }
  .topbar-toggle-mgr:hover {
    color: var(--green-400);
    border-color: var(--green-400);
    background: var(--green-glow);
  }

  .topbar h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-user-tag {
    font-size: 0.8rem;
    font-weight: 600;
    background: #f0fdf4;
    border: 1px solid var(--green-border);
    padding: 5px 12px;
    border-radius: 999px;
    color: var(--green-500);
    font-family: 'Space Mono', monospace;
    white-space: nowrap;
  }

  /* ════════ MEDIA QUERIES (RESPONSIF MOBILE) ════════ */
  @media (max-width: 768px) {
    .sidebar {
      transform: translateX(calc(-1 * var(--sidebar-w)));
    }
    .sidebar.open {
      transform: translateX(0);
      box-shadow: 6px 0 24px rgba(0, 0, 0, 0.15);
    }
    .sidebar-close-mgr {
      display: flex;
    }
    .content {
      margin-left: 0;
    }
    .topbar-toggle-mgr {
      display: flex;
    }
    .topbar h5 {
      font-size: 0.85rem;
    }
    .topbar-user-tag {
      font-size: 0.72rem;
      padding: 4px 10px;
    }
  }
</style>

<div class="sidebar-overlay-mgr" id="sidebarOverlayMgr"></div>

<div class="sidebar" id="sidebarMgr">
    <div class="sidebar-brand-manager">
        <h4>STORE MANAGER</h4>
        <small>Checklist Harian</small>
        <button class="sidebar-close-mgr" id="sidebarCloseMgr">✕</button>
    </div>

    <nav class="sidebar-nav-manager">
        <a href="dashboard.php" class="<?= ($menu=='dashboard') ? 'active' : '' ?>">
            🏠 Dashboard
        </a>
        <a href="checklist_daily.php" class="<?= ($menu=='daily') ? 'active' : '' ?>">
            📅 Daily
        </a>
        <a href="checklist_weekly.php" class="<?= ($menu=='weekly') ? 'active' : '' ?>">
            📆 Weekly
        </a>
        <a href="checklist_monthly.php" class="<?= ($menu=='monthly') ? 'active' : '' ?>">
            🗓 Monthly
        </a>

        <a href="mod.php" class="nav-link <?= $menu==='mod' ? 'active' : '' ?>">
            📋 Jadwal Shift (MOD)
        </a>

        <a href="riwayat_checklist.php" class="<?= ($menu == 'riwayat') ? 'active' : '' ?>">
            📋 Riwayat
        </a>
        <a href="pengajuan_checklist.php"
          class="<?= $menu=='pengajuan' ? 'active' : '' ?>">

            <span class="nav-icon">📋</span>

            Pengajuan Checklist

        </a>
        <a href="/checklist_harian_harita/sm/urgent_list.php">
            🚨 Urgent
        </a>
        <div class="nav-divider-manager"></div>
        <a href="../logout.php" class="logout-btn">
            🚪 Logout
        </a>
    </nav>
</div>

<div class="content">
    <div class="topbar px-3 px-md-4">
        <div class="topbar-left-wrapper">
            <button class="topbar-toggle-mgr" id="sidebarToggleMgr">☰</button>
            <h5><?= isset($judul) ? $judul : 'Store Manager Panel' ?></h5>
        </div>
        <div class="topbar-user-tag">👤 <?= $_SESSION['nama'] ?></div>
    </div>

    <div class="container-fluid p-3 p-md-4">

<script>
document.addEventListener("DOMContentLoaded", function() {
    var sidebar   = document.getElementById('sidebarMgr');
    var overlay   = document.getElementById('sidebarOverlayMgr');
    var toggleBtn = document.getElementById('sidebarToggleMgr');
    var closeBtn  = document.getElementById('sidebarCloseMgr');

    function openSidebar() {
        sidebar.classList.add('open');
        overlay.classList.add('show');
        document.body.style.overflow = 'hidden';
    }

    function closeSidebar() {
        sidebar.classList.remove('open');
        overlay.classList.remove('show');
        document.body.style.overflow = '';
    }

    if(toggleBtn) toggleBtn.addEventListener('click', openSidebar);
    if(closeBtn)  closeBtn.addEventListener('click', closeSidebar);
    if(overlay)   overlay.addEventListener('click', closeSidebar);
});
</script>