/* ============================================
   ADMIN LAYOUT - Shared Sidebar, Topbar & Layout
   ============================================ */

:root {
  --sidebar-width: 280px;
  --topbar-height: 72px;
}

body {
  background: var(--bn-gray-100);
  min-height: 100vh;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bn-dark);
  z-index: var(--z-fixed);
  display: flex;
  flex-direction: column;
  box-shadow: var(--bn-shadow-xl);
  transition: transform var(--bn-transition-base);
}

.sidebar-header {
  padding: var(--bn-space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  /* Row so the mobile close control can sit opposite the logo. With the close
     button hidden (desktop) the logo is the only child, so space-between
     leaves it exactly where it was. */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bn-space-3);
}

/* Drawer close control — hidden on desktop, where there is no drawer to
   close. See the note in nav_sql.js: the topbar burger is painted over by the
   open drawer, so this is the in-drawer way back out. */
.sidebar-close {
  display: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--bn-radius-lg);
  background: rgba(255, 255, 255, 0.08);
  color: var(--bn-white);
  cursor: pointer;
  transition: background var(--bn-transition-fast);
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-close svg {
  width: 20px;
  height: 20px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--bn-space-3);
  text-decoration: none;
  border-radius: var(--bn-radius-lg);
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--bn-gradient-accent);
  border-radius: var(--bn-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--bn-shadow-glow);
}

.sidebar-logo-icon svg {
  width: 22px;
  height: 22px;
  color: var(--bn-dark);
}

.sidebar-logo-text {
  font-size: var(--bn-text-lg);
  font-weight: 800;
  color: var(--bn-white);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--bn-space-4) var(--bn-space-3);
  overflow-y: auto;
}

.sidebar-nav-section {
  margin-bottom: var(--bn-space-6);
}

.sidebar-nav-label {
  font-size: var(--bn-text-xs);
  font-weight: 600;
  color: var(--bn-gray);
  text-transform: uppercase;
  letter-spacing: var(--bn-tracking-wider);
  padding: var(--bn-space-3) var(--bn-space-4);
  margin-bottom: var(--bn-space-1);
}

/* Grouping heading in the sidebar. Not a link and not focusable — it exists to
   break fourteen destinations into scannable groups. */
.sidebar-nav-section {
  padding: var(--bn-space-4) var(--bn-space-4) var(--bn-space-2);
  font-size: var(--bn-text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bn-gray-400);
  opacity: 0.75;
  pointer-events: none;
  user-select: none;
}

/* No dead space above the first heading — it already follows the header. */
.sidebar-nav > .sidebar-nav-section:first-child {
  padding-top: var(--bn-space-2);
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--bn-space-3);
  min-height: 44px;
  padding: var(--bn-space-3) var(--bn-space-4);
  font-size: var(--bn-text-sm);
  font-weight: 500;
  color: var(--bn-gray-400);
  text-decoration: none;
  border-radius: var(--bn-radius-lg);
  transition: background var(--bn-transition-fast), color var(--bn-transition-fast);
  margin-bottom: var(--bn-space-1);
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--bn-white);
}

.sidebar-nav-item.active {
  background: rgba(201, 162, 39, 0.15);
  color: var(--bn-accent);
  font-weight: 600;
}

.sidebar-nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: var(--bn-radius-full);
  background: var(--bn-accent);
}

.sidebar-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-nav-item:focus-visible,
.sidebar-logo:focus-visible,
.sidebar-user:focus-visible,
.user-menu-item:focus-visible {
  outline: 2px solid var(--bn-accent);
  outline-offset: 2px;
}

.sidebar-nav-badge {
  margin-left: auto;
  background: var(--bn-danger);
  color: var(--bn-white);
  font-size: var(--bn-text-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--bn-radius-full);
  min-width: 20px;
  text-align: center;
}

/* ── Sidebar quick-actions slot ──────────────────────────────────────────
   An empty landing area rendered inside .sidebar-nav. On mobile the page
   may relocate its own action buttons in here (user_dashboard moves its
   hero Quick Actions), so the drawer carries the page's actions instead of
   the hero having to stack nine buttons on a phone screen. Collapses to
   nothing when the page puts nothing in it. */
.sidebar-quick-actions {
  margin-top: var(--bn-space-4);
  padding-top: var(--bn-space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-quick-actions:empty {
  display: none;
  margin: 0;
  padding: 0;
  border-top: none;
}

/* Uniform 2-up grid. Every tile is the same size whatever its label length,
   so the block reads as one set rather than a ragged column of pills. */
.sidebar-quick-actions-label {
  font-size: var(--bn-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: var(--bn-space-2);
  padding-inline: var(--bn-space-2);
}

.sidebar-quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--bn-space-2);
}

.sidebar-quick-action {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* 44px floor: these are the primary touch targets on a phone. */
  min-height: 44px;
  padding: var(--bn-space-2);
  border-radius: var(--bn-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.88);
  font-size: var(--bn-text-xs);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.sidebar-quick-action:hover,
.sidebar-quick-action:focus-visible {
  background: rgba(255, 255, 255, 0.10);
  border-color: var(--bn-accent);
  color: var(--bn-white);
}

.sidebar-quick-action:focus-visible {
  outline: 2px solid var(--bn-accent);
  outline-offset: 2px;
}

/* Desktop keeps its actions where the page put them. */
@media (min-width: 1025px) {
  .sidebar-quick-actions {
    display: none;
  }
}

.sidebar-footer {
  padding: var(--bn-space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--bn-space-2) var(--bn-space-3);
  padding: var(--bn-space-3);
  border-radius: var(--bn-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: background var(--bn-transition-fast);
  position: relative;
}

/* Logout is a flex child of .sidebar-user; drop it to its own full-width
   row below the avatar/name so it reads as a footer action, not a squeezed
   third column. */
.sidebar-user > .user-menu-item.danger {
  width: 100%;
  justify-content: center;
  margin-top: var(--bn-space-1);
  padding: var(--bn-space-3) var(--bn-space-4);
  min-height: 44px;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--bn-radius-md, 8px);
  color: var(--bn-gray-400);
}

.sidebar-user > .user-menu-item.danger:hover {
  color: var(--bn-danger);
  background: rgba(220, 38, 38, 0.1);
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--bn-radius-full);
  background: var(--bn-gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--bn-text-sm);
  color: var(--bn-dark);
  flex-shrink: 0;
  position: relative;
  /* Now a <label for="navProfilePictureInput"> that opens the hidden file
     input below — kill the underline it no longer needs, keep the pointer
     cursor a link got for free, and keep a visible focus ring since it is
     tabindex="0" and keyboard-activatable.
     No `overflow: hidden` here on purpose: the ::before tap-target expander
     below deliberately extends past this box's edge, and a host with
     overflow: hidden clips its own pseudo-element exactly like the
     .bn-info-toggle bug this pattern is copied from. The circular clip is
     done on the <img> itself instead (see .sidebar-user-avatar img). */
  text-decoration: none;
  cursor: pointer;
}

/* Visual size stays 40px (matches the sidebar user block); the TAP target
   becomes 44×44 via an invisible expander, same trick as .bn-info-toggle.
   Inset -2px on a 40px box = 44px. Absolutely positioned so it adds no
   layout width and cannot push the name/role block or Logout row. */
.sidebar-user-avatar::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
}

.sidebar-user-avatar:hover {
  box-shadow: 0 0 0 2px var(--bn-accent);
}

.sidebar-user-avatar:focus-visible {
  outline: 2px solid var(--bn-accent);
  outline-offset: 2px;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Circular clip lives here, not on the parent's overflow — see comment
     above. Sized identically to its 40×40 parent so nothing bleeds past
     the rounded corners. */
  border-radius: var(--bn-radius-full);
}

/* Hidden file input — the label's for= still opens it; display:none keeps
   it out of the tab order (the label itself carries the tabindex/focus
   ring) and off-screen, matching .profile-picture-input on settings.html. */
.sidebar-user-avatar-input {
  display: none;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--bn-text-sm);
  font-weight: 600;
  color: var(--bn-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--bn-text-xs);
  color: var(--bn-gray);
}

/* User Menu Dropdown */
.user-menu-dropdown {
  position: absolute;
  bottom: calc(100% + var(--bn-space-2));
  left: 0;
  right: 0;
  background: var(--bn-white);
  border-radius: var(--bn-radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--bn-gray-lighter);
  overflow: hidden;
  z-index: 1000;
  display: none;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-menu-dropdown.show {
  display: block;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--bn-space-3);
  padding: var(--bn-space-3) var(--bn-space-4);
  color: var(--bn-dark);
  text-decoration: none;
  font-size: var(--bn-text-sm);
  font-weight: 500;
  transition: background var(--bn-transition-fast);
  border: none;
  width: 100%;
  text-align: left;
  background: none;
  cursor: pointer;
}

.user-menu-item:hover {
  background: var(--bn-gray-100);
}

.user-menu-item.danger {
  color: var(--bn-danger);
  border-top: 1px solid var(--bn-gray-lighter);
}

.user-menu-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ============================================
   TOP BAR
   ============================================ */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bn-gray-lighter);
  z-index: var(--z-sticky);
  padding: 0 var(--bn-space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bn-space-6);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--bn-space-6);
  flex: 1;
  min-width: 0;
}

.topbar-title-wrapper {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.topbar-title {
  font-size: var(--bn-text-xl);
  font-weight: 700;
  color: var(--bn-dark);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-search {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.topbar-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bn-gray);
  pointer-events: none;
}

.topbar-search-input {
  width: 100%;
  padding: var(--bn-space-3) var(--bn-space-4) var(--bn-space-3) 42px;
  background: var(--bn-gray-100);
  border: 1px solid transparent;
  border-radius: var(--bn-radius-full);
  font-size: var(--bn-text-sm);
  color: var(--bn-dark);
  transition: all var(--bn-transition-fast);
}

.topbar-search-input:focus {
  outline: none;
  border-color: var(--bn-accent);
  background: var(--bn-white);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--bn-space-3);
  flex-shrink: 0;
}

.topbar-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--bn-radius-lg);
  background: transparent;
  border: none;
  color: var(--bn-gray-700);
  cursor: pointer;
  transition: all var(--bn-transition-fast);
}

.topbar-switch {
  display: flex;
  align-items: center;
  gap: var(--bn-space-2);
  height: 40px;
  min-height: 40px;
  padding: 0 var(--bn-space-3);
  border-radius: var(--bn-radius-lg);
  background: var(--bn-gray-100);
  border: 1px solid var(--bn-gray-lighter);
  color: var(--bn-dark);
  font-weight: 600;
  font-size: var(--bn-text-sm);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--bn-transition-fast);
}

.topbar-switch svg {
  flex-shrink: 0;
}

.topbar-switch:hover {
  background: var(--bn-gray-200, var(--bn-gray-100));
  color: var(--bn-accent);
}

.topbar-btn:hover {
  background: var(--bn-gray-100);
  color: var(--bn-dark);
}

.topbar-btn-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: var(--bn-danger);
  color: var(--bn-white);
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--bn-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bn-white);
}

.topbar-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--bn-radius-full);
  background: var(--bn-gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--bn-text-sm);
  color: var(--bn-dark);
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow var(--bn-transition-fast);
}

.topbar-avatar:hover {
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2);
}

.topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: var(--bn-space-2);
  padding: var(--bn-space-1);
  background: var(--bn-gray-100);
  border-radius: var(--bn-radius-full);
}

.view-toggle-label {
  display: none;
}

.view-toggle-btn {
  padding: var(--bn-space-2) var(--bn-space-4);
  border: none;
  background: transparent;
  border-radius: var(--bn-radius-full);
  font-size: var(--bn-text-xs);
  font-weight: 600;
  color: var(--bn-gray);
  cursor: pointer;
  transition: all var(--bn-transition-fast);
}

.view-toggle-btn.active {
  background: var(--bn-white);
  color: var(--bn-dark);
  box-shadow: var(--bn-shadow-sm);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--bn-radius-lg);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px;
  flex-shrink: 0;
}

.mobile-menu-btn span {
  width: 20px;
  height: 2px;
  background: var(--bn-dark);
  border-radius: 2px;
  transition: all var(--bn-transition-fast);
}

/* ============================================
   DASHBOARD CONTENT
   ============================================ */
.dashboard-content {
  padding: var(--bn-space-6) var(--bn-space-8);
  position: relative;
  /* Capped and centred so content doesn't stretch to absurd line lengths on a
     wide monitor. admin_dashboard.html previously set this on its own, which
     made it the ONLY page with a measure — every other page ran full-bleed.
     Promoted here so all pages share one content width. */
  max-width: 1400px;
  margin-inline: auto;
  width: 100%;
}

/* ============================================
   MOBILE BOTTOM NAVIGATION
   ============================================ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bn-white);
  border-top: 1px solid var(--bn-gray-lighter);
  padding: var(--bn-space-2) var(--bn-space-4);
  z-index: var(--z-fixed);
}

/* Fills the bar and caps itself — see the long note in unified-mobile-nav.css,
   which carries the !important copy of these declarations. Kept in sync here
   so the bar is not dependent on that override sheet being loaded. */
.mobile-nav-items {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  justify-content: space-evenly;
  align-items: stretch;
  box-sizing: border-box;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--bn-space-2);
  text-decoration: none;
  color: var(--bn-gray);
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--bn-radius-md);
  transition: color var(--bn-transition-fast);
  border: none;
  background: none;
  cursor: pointer;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: var(--bn-accent);
}

.mobile-nav-icon {
  font-size: 20px;
  line-height: 1;
}

/* ============================================
   SIDEBAR OVERLAY
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.5);
  z-index: calc(var(--z-fixed) - 1);
}

/* ============================================
   TOAST CONTAINER (minimal overrides only)
   Toast base styles live in design-system.css
   ============================================ */

/* ============================================
   SPINNER OVERLAY
   Base .spinner-overlay / .spinner / .hidden come from design-system.css
   so the page-level #spinner matches user_dashboard.html exactly.
   ============================================ */

/* Section-level spinners inside the admin layout stay FIXED TO THE VIEWPORT, so
   the loader always lands in the middle of the screen. It was `absolute`, which
   stretched the overlay to the full height of the content column and pushed the
   flex-centred loader roughly 1100px down the page — usually off screen.
   Loads here are short and blocking, so covering the chrome while one runs is
   the honest signal; a loader you cannot see is not. */
.main-content .spinner-overlay,
.dashboard-content .spinner-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.main-content {
  position: relative;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    /* The drawer must sit ABOVE the fixed bottom nav. Both used to be
       z-index: var(--z-fixed), and .mobile-nav is appended to <body> after
       the sidebar, so the bar won the tie and painted over the bottom of the
       open drawer — hiding the user block and the logout button. The overlay
       goes between the two so tapping the (dimmed) bar closes the drawer
       instead of navigating away. */
    z-index: calc(var(--z-fixed) + 20);
    /* .sidebar-nav is already the flex:1 scroll area; this just stops a
       flick inside the drawer from scrolling the page behind it. */
    overscroll-behavior: contain;
    width: min(var(--sidebar-width), 86vw);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
    flex-shrink: 0;
  }

  /* Only reachable affordance to close the drawer at these widths — the
     burger that opened it is underneath the drawer. */
  .sidebar-close {
    display: flex;
  }

  .topbar-search {
    display: none;
  }

  .topbar-left {
    gap: var(--bn-space-2);
    flex: 1;
    min-width: 0;
  }

  .topbar-title {
    font-size: var(--bn-text-sm);
    line-height: 1.3;
  }

  #currentDate {
    font-size: 10px !important;
    margin-top: 1px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-overlay {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Above the bottom nav, below the drawer — see the .sidebar note above. */
    z-index: calc(var(--z-fixed) + 10);
    transition: opacity var(--bn-transition-base), visibility var(--bn-transition-base);
  }

  .sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Scoped INSIDE the media query on purpose: if the drawer is open at 390px
     and the viewport is then widened past 1024, the burger and drawer both
     leave the layout while body still carries the class — a lock that could
     never be released. Above this breakpoint the rule simply stops applying. */
  body.bn-drawer-open {
    overflow: hidden;
  }

  /* flex, not block: the bar's only child (.mobile-nav-items) has to be a
     flex item for its flex:1 to mean anything. */
  .mobile-nav {
    display: flex;
    justify-content: center;
    align-items: stretch;
  }

  .dashboard-content {
    padding-bottom: calc(var(--bn-space-8) + 80px);
  }
}

@media (max-width: 768px) {
  .dashboard-content {
    padding: var(--bn-space-4);
    padding-bottom: calc(var(--bn-space-8) + 80px);
  }

  .topbar {
    padding: 0 var(--bn-space-4);
  }

  .topbar-left {
    gap: var(--bn-space-2);
    flex: 1;
    min-width: 0;
  }

  .topbar-title {
    font-size: var(--bn-text-sm);
    line-height: 1.3;
  }

  #currentDate {
    font-size: 10px !important;
    margin-top: 1px !important;
  }

  #selectGroupBtn,
  #currencySelector {
    display: none !important;
  }

  .view-toggle {
    display: none;
  }

  .topbar-right {
    gap: var(--bn-space-2);
  }

  .topbar-switch {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .topbar-switch-label {
    display: none;
  }
}

/* ============================================
   PAGE CONTENT SHARED STYLES
   (Migrated from pages.css equivalents)
   ============================================ */
.content-section {
  background: var(--bn-white);
  border-radius: var(--bn-radius-xl);
  padding: var(--bn-space-6);
  box-shadow: var(--bn-shadow-sm);
  border: 1px solid var(--bn-gray-lighter);
  margin-bottom: var(--bn-space-6);
  transition: box-shadow var(--bn-transition-base), border-color var(--bn-transition-base);
}

.content-section:hover {
  box-shadow: var(--bn-shadow-md);
  border-color: var(--bn-gray-light);
}

.content-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--bn-space-5);
  flex-wrap: wrap;
  gap: var(--bn-space-3);
}

.content-section h2 {
  font-size: var(--bn-text-lg);
  font-weight: 700;
  color: var(--bn-dark);
  display: flex;
  align-items: center;
  gap: var(--bn-space-2);
}

.page-stats-bar {
  display: flex;
  gap: var(--bn-space-4);
  margin-bottom: var(--bn-space-6);
  overflow-x: auto;
  padding-bottom: var(--bn-space-2);
}

.page-stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--bn-white);
  border-radius: var(--bn-radius-lg);
  padding: var(--bn-space-4) var(--bn-space-5);
  box-shadow: var(--bn-shadow-sm);
  border: 1px solid var(--bn-gray-lighter);
  transition: box-shadow var(--bn-transition-base), transform var(--bn-transition-base), border-color var(--bn-transition-base);
}

.page-stat-card:hover {
  box-shadow: var(--bn-shadow-md);
  border-color: var(--bn-gray-light);
  transform: translateY(-2px);
}

.page-stat-value {
  font-size: var(--bn-text-xl);
  font-weight: 800;
  color: var(--bn-dark);
  margin-bottom: var(--bn-space-1);
  font-feature-settings: 'tnum' 1;
  white-space: nowrap;
  letter-spacing: var(--bn-tracking-tight);
}

.page-stat-label {
  font-size: var(--bn-text-xs);
  color: var(--bn-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--bn-space-12) var(--bn-space-6);
}

/* ============================================
   PAGE-GROUP-SELECTOR & PAGE-STATS OVERRIDES
   (Restyle for light dashboard background -
    originally designed for dark page-header)
   ============================================ */
.dashboard-content .page-group-selector {
  background: var(--bn-white);
  border: 1px solid var(--bn-gray-lighter);
  border-radius: var(--bn-radius-lg);
  padding: var(--bn-space-3) var(--bn-space-4);
  margin-bottom: var(--bn-space-5);
  box-shadow: var(--bn-shadow-sm);
}

.dashboard-content .page-group-selector select {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--bn-dark);
  font-size: var(--bn-text-sm);
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.dashboard-content .page-group-selector select option {
  background: var(--bn-white);
  color: var(--bn-dark);
}

.dashboard-content .page-stats {
  /* A WRAPPING GRID, NOT A HORIZONTAL SCROLLER.
     As a flex row with `overflow-x: auto` this strip put tiles off the side of
     the screen: on manage_payments at 417px the fourth tile ("Contributions
     Owed") sat at x=412–532, entirely outside the viewport, and a tap could
     never reach it — measured, not assumed. Nothing indicated the strip
     scrolled, so it read as "the cards do not work".
     auto-fit wraps them instead: two per row on a phone, four across on a
     desktop, every tile always on screen and tappable.
     Dropping `overflow-x` also retires the clipping problem that rule caused —
     CSS computes the other axis to `auto` alongside it, so the box used to
     slice the "i" toggles that overhang each card's top-right corner. The
     padding below is kept because card_info.js reserves the same gutter and
     the two agreeing costs nothing. */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--bn-space-3);
  margin-bottom: var(--bn-space-5);
  padding-bottom: var(--bn-space-2);
  padding-top: 16px;
  padding-right: 16px;
  min-width: 0;
}

.dashboard-content .page-stat {
  min-width: 0;
  text-align: center;
  background: var(--bn-white);
  border-radius: var(--bn-radius-lg);
  padding: var(--bn-space-3) var(--bn-space-4);
  box-shadow: var(--bn-shadow-sm);
  border: 1px solid var(--bn-gray-lighter);
  transition: box-shadow var(--bn-transition-base), transform var(--bn-transition-base), border-color var(--bn-transition-base);
}

.dashboard-content .page-stat:hover {
  box-shadow: var(--bn-shadow-md);
  border-color: var(--bn-gray-light);
  transform: translateY(-2px);
}

.dashboard-content .page-stat-value {
  font-size: var(--bn-text-lg);
  font-weight: 800;
  color: var(--bn-dark);
  font-feature-settings: 'tnum' 1;
  white-space: nowrap;
  letter-spacing: var(--bn-tracking-tight);
}

.dashboard-content .page-stat-value.success { color: var(--bn-success); }
.dashboard-content .page-stat-value.warning { color: var(--bn-warning); }
.dashboard-content .page-stat-value.danger { color: var(--bn-danger); }
.dashboard-content .page-stat-value.info { color: var(--bn-primary); }

.dashboard-content .page-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--bn-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--bn-space-1);
}

/* Page filters & tabs inside dashboard */
.dashboard-content .page-filters {
  display: flex;
  gap: var(--bn-space-3);
  margin-bottom: var(--bn-space-5);
  flex-wrap: wrap;
}

.dashboard-content .page-tabs {
  display: flex;
  gap: var(--bn-space-2);
  margin-bottom: var(--bn-space-5);
  overflow-x: auto;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--bn-space-4);
  opacity: 0.4;
}

.empty-state-text {
  font-size: var(--bn-text-sm);
  color: var(--bn-gray);
}

@media (max-width: 768px) {
  .page-stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--bn-space-3);
  }

  .page-stat-card {
    min-width: auto;
    padding: var(--bn-space-3) var(--bn-space-4);
  }

  .page-stat-value {
    font-size: var(--bn-text-lg);
  }
}

/* ============================================
   SPA LOADING BAR
   ============================================ */
.spa-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 100;
  overflow: hidden;
  border-radius: 0 0 2px 2px;
  background: var(--bn-gray-200, #e5e7eb);
}
.spa-loading-bar::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: var(--bn-primary, #2563eb);
  border-radius: 2px;
  animation: spaLoadSlide 0.8s ease-in-out infinite;
}
@keyframes spaLoadSlide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
