/* Admin shell: desktop sidebar, tablet/phone drawer, phone bottom bar, compact topbar.
   Desktop >= 1100px · tablet 768–1099px · phone < 768px. */

/* Radzen dialogs (Users/Roles pages): above the shell layers (topbar 1010, drawer 1100/1200), below PmSheet 1600 and confirm 2000. */
:root { --rz-dialog-mask-zindex: 1300; --rz-dialog-zindex: 1301; }

/* ── Sidebar (desktop: sticky column) ── */
.pm-sidebar {
  position: sticky; top: 0; align-self: flex-start; height: 100dvh; overflow-y: auto;
  overscroll-behavior: contain;
}
.pm-sidebar-brand { position: relative; }
.pm-drawer-close { display: none; }
.pm-nav-group { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.5rem; }
.pm-nav-group-label {
  font-size: 0.7rem !important; letter-spacing: 0.08em; text-transform: uppercase;
  color: #8a8a85; padding: 0.6rem 0.75rem 0.2rem; font-weight: 600;
}
.pm-nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: none; cursor: pointer; font-family: inherit; text-align: left;
}
.pm-nav-group-toggle .material-symbols-outlined { font-size: 1rem; }
.pm-sidebar-footer .pm-nav-item { width: 100%; font-family: inherit; text-align: left; }
.pm-drawer-scrim { display: none; }

/* ── Topbar ── */
/* z-index 1010: sticky makes the topbar its own stacking context; this just keeps it above the
   phone bottom nav (1000) yet below the legacy modals (1050) and the drawer scrim (1100). The avatar
   menu renders in the popover top layer, so it does not depend on this value. */
.pm-topbar {
  position: sticky; top: 0; z-index: 1010;
  justify-content: flex-start; gap: 0.5rem; min-height: 56px;
  padding: 0.5rem var(--pm-gutter-right, 2rem) 0.5rem var(--pm-gutter-left, 2rem);
}
.pm-topbar-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pm-topbar-title { overflow: hidden; text-overflow: ellipsis; }
.pm-topbar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 0.5rem; flex-shrink: 0;
  background: none; border: none; color: var(--pm-text-secondary); cursor: pointer; text-decoration: none;
}
.pm-topbar-btn:hover { background: var(--pm-card); color: var(--pm-text); }
.pm-topbar-menu { display: none; }
.pm-topbar .pm-menu-trigger { padding: 0; }

/* ── Bottom bar (phone only) ── */
.pm-bottom-nav { display: none; }

/* ── Tablet and phone: sidebar becomes a drawer ── */
@media (max-width: 1099.98px) {
  .pm-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 1200; height: 100dvh;
    width: min(300px, 85vw); transform: translateX(-100%);
    visibility: hidden; transition: transform 0.2s ease, visibility 0s linear 0.2s; box-shadow: none;
  }
  .pm-drawer-open .pm-sidebar {
    transform: translateX(0); visibility: visible; transition: transform 0.2s ease, visibility 0s;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
  }
  .pm-drawer-open .pm-drawer-scrim {
    display: block; position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,0.6);
  }
  .pm-drawer-close {
    display: inline-flex; margin-left: auto; width: 44px; height: 44px; align-items: center; justify-content: center;
    background: none; border: none; color: var(--pm-text-secondary); cursor: pointer; border-radius: 0.5rem;
  }
  .pm-nav-item { min-height: 44px; }
  .pm-topbar-menu { display: inline-flex; }
  .pm-topbar-btn { width: 44px; height: 44px; }
}

@media (max-width: 767.98px) {
  .pm-topbar-menu { display: none; } /* phone uses the bottom bar's More */
  .pm-topbar-subtitle { display: none; }
  .pm-topbar-title { font-size: 1.05rem; color: var(--pm-text); }

  .pm-bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--pm-surface); border-top: 1px solid var(--pm-border);
  }
  .pm-bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 44px; background: none; border: none; font: inherit; font-size: 0.7rem !important;
    color: var(--pm-text-secondary); text-decoration: none; cursor: pointer;
  }
  .pm-bottom-nav-item .material-symbols-outlined { font-size: 1.35rem; }
  .pm-bottom-nav-active { color: var(--pm-accent) !important; }
  .pm-content { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
}

/* Toasts must stay visible above sheets (1600), confirms (2000) and phone modals. The Blazor error bar is
   raised to 2200 in site.css (it loads after this file, so the override has to live there). */
.rz-notification { z-index: 2100; }

@media (prefers-reduced-motion: reduce) {
  .pm-sidebar { transition: none !important; }
}
