:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --sidebar-bg: #ffffff;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

.sidebar {
  min-height: calc(100vh - 56px);
  position: sticky; top: 56px;
}
.sidebar .nav-link {
  color: #475569;
  border-radius: .5rem;
  padding: .5rem .75rem;
  margin-bottom: 2px;
  font-size: .95rem;
}
.sidebar .nav-link:hover { background: #eff6ff; color: var(--brand-dark); }
.sidebar .nav-link i { width: 22px; }
.sidebar-section {
  font-size: .7rem; text-transform: uppercase; color: #94a3b8;
  margin: 1rem .75rem .25rem; letter-spacing: .05em;
}

.stat-card { transition: transform .15s ease; }
.stat-card:hover { transform: translateY(-2px); }

.auth-bg {
  background:
    radial-gradient(at 10% 20%, rgba(37,99,235,.15), transparent 40%),
    radial-gradient(at 90% 80%, rgba(245,158,11,.15), transparent 40%),
    #f1f5f9;
}

.table > :not(caption) > * > * { vertical-align: middle; }

.badge { font-weight: 500; }

/* Drawer user + logout block — mobile only */
.drawer-user-block {
  border-top: 1px solid #e2e8f0;
  padding: 1rem 1.25rem 1.5rem;
  background: #f8fafc;
}
.drawer-user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #334155;
}
.drawer-user-info i {
  color: #64748b;
}

/* ------------------------------------------------------------------
   Mobile sidebar drawer — everything below 992px only.
   Desktop is untouched.
   ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
  /* Neutralise the desktop .sidebar rules inside the drawer scope.
     These are the ones preventing the body from scrolling. */
  #appSidebar.sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    min-height: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100vw !important;
    max-width: 100vw !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden;
  }

  /* Header stays pinned at the top of the drawer */
  #appSidebar .offcanvas-header {
    flex: 0 0 auto;
    padding: 1rem 1.25rem;
    background: #212529;
    color: #fff;
    border-bottom: 1px solid #000;
  }
  #appSidebar .offcanvas-header .offcanvas-title {
    color: #fff;
    font-weight: 600;
  }
  #appSidebar .offcanvas-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: .9;
  }

  /* Body is the scrollable region between header and logout block */
  #appSidebar .offcanvas-body {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  #appSidebar .offcanvas-body > nav {
    flex: 0 0 auto;
  }

  /* Logout block sits at the bottom of the scrollable region */
  #appSidebar .drawer-user-block {
    margin-top: auto;
    flex: 0 0 auto;
  }

  /* Touch-friendly nav links */
  #appSidebar .nav-link {
    padding: .75rem .9rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
  }
  #appSidebar .nav-link i {
    font-size: 1.1rem;
    width: 24px;
  }
}