/* Panel layout — fix double sidebar offset + fill width + balanced dashboard cards */

/* Fixed sidebar must not reserve flex space (was ~260px + margin-left = huge left gap) */
.app-layout {
  display: block !important;
  min-height: 100vh;
}

.sidebar {
  position: fixed !important;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.main-content {
  margin-left: var(--sidebar-width) !important;
  width: calc(100% - var(--sidebar-width)) !important;
  max-width: none !important;
  flex: none !important;
  min-height: 100vh;
  box-sizing: border-box;
}

.main-header {
  width: 100%;
  padding: 0 1.25rem !important;
  box-sizing: border-box;
}

.page-content {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 1.25rem 1.5rem 2rem !important;
  box-sizing: border-box;
}

/* Sidebar: compact nav, footer follows items (less dead space) */
.sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 0 1 auto !important;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0 !important;
  min-height: 0;
}

.sidebar-footer {
  margin-top: 0.75rem !important;
  flex-shrink: 0;
}

.nav-section {
  margin-bottom: 0.2rem !important;
}

.nav-section-title {
  padding: 0.5rem 0.75rem 0.2rem !important;
}

.nav-item {
  margin-bottom: 0.1rem !important;
  padding: 0.5rem 0.75rem !important;
}

/* Dashboard grids */
.stats-grid {
  margin-bottom: 1rem !important;
}

.grid-2 {
  align-items: stretch;
  gap: 1rem !important;
}

.grid-2 > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.grid-2 > .card .card-header {
  flex-shrink: 0;
}

.grid-2 > .card .card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Charts: fill paired column height, distribute bars evenly */
.card-body .chart-bar-container {
  flex: 1 1 auto;
  justify-content: space-evenly;
  min-height: 0;
}

.chart-bar-item {
  flex-shrink: 0;
}

/* Business metrics: stay top-aligned inside stretched card */
.card-body > div[style*="grid-template-columns"] {
  align-self: flex-start;
  width: 100%;
}

/* Tables in grid cards */
.grid-2 > .card .card-body.no-padding {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .page-content {
    padding: 1rem !important;
  }
}

/* Profile page ??? never use dashboard grid-2 equal-height card stretch */
.profile-page .profile-stack > .card {
  display: block !important;
  height: auto !important;
  flex: 0 0 auto !important;
}

.profile-page .profile-stack > .card > .card-body {
  flex: none !important;
  display: block !important;
  min-height: 0 !important;
}
