/* =====================================================================
   Responsive layout fixes. The app shell is a 280px sidebar + content
   grid; below 1100px the sidebar used to stack on top of the content and
   break the layout. Here it becomes an off-canvas drawer toggled by the
   hamburger button, so the app stays usable at any window size.
   Loaded after main.css.
   ===================================================================== */

/* The off-canvas sidebar sits just off the right edge; never let that create
   a horizontal scrollbar. */
body { overflow-x: hidden; }

/* --- Desktop (> 1100px): keep the existing collapsible sidebar --- */
@media (min-width: 1101px) {
	.panel-body .app.nav-collapsed {
		grid-template-columns: 1fr;
	}
	.panel-body .app.nav-collapsed .sidebar {
		display: none;
	}
}

/* --- Tablet / phone / small app window (<= 1100px): drawer --- */
@media (max-width: 1100px) {
	.panel-body .app {
		grid-template-columns: 1fr;
	}
	.panel-body .sidebar {
		position: fixed;
		top: 0;
		right: 0;
		height: 100vh;
		width: 280px;
		max-width: 85vw;
		z-index: 1200;
		transform: translateX(100%);
		transition: transform 0.25s ease;
		overflow-y: auto;
		border-left: none;
		border-right: 1px solid var(--pe-border);
	}
	.panel-body .app.nav-open .sidebar {
		transform: translateX(0);
		box-shadow: -12px 0 32px rgba(0, 0, 0, 0.4);
	}
	/* Dim the content behind an open drawer (tap to close, handled in JS). */
	.panel-body .app.nav-open::before {
		content: '';
		position: fixed;
		inset: 0;
		z-index: 1100;
		background: rgba(0, 0, 0, 0.45);
	}
	.panel-body .main {
		padding: 18px;
	}
	/* Wide tables scroll horizontally instead of stretching the page. */
	.panel-body .table-responsive,
	.panel-body .table {
		display: block;
		width: 100%;
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* Fluid summary/stat rows: let cards wrap instead of overflowing. */
.panel-body .d-flex.flex-wrap > .panel {
	min-width: 0;
}
