/*
 * Responsive corrections verified against the Galaxy S25 Ultra walkthrough.
 * Page-specific selectors are intentionally scoped so existing desktop layouts remain unchanged.
 */

.sidebar-backdrop {
	display: none;
}

html,
body {
	max-width: 100%;
	overflow-x: clip !important;
}

body .wrapper,
body #content,
body #content > .container-fluid {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
}

/*
 * Keep the desktop sidebar's sticky containing block free of scrolling.
 * `hidden` creates a scroll container even on the horizontal axis, which
 * stops position: sticky from following the document scroll. `clip` still
 * prevents horizontal overflow without becoming that containing block.
 */
body .wrapper {
	overflow-x: clip;
}

body #content {
	/* Clip horizontal spill without creating a second vertical scroll container. */
	overflow-x: clip;
}

@media (max-width: 991px) {
	body.login-bg .login-page {
		align-content: center;
	}
}

@media (max-width: 640px) {
	body.login-bg .login-page {
		align-content: start;
		gap: 26px;
	}

	body.login-bg .login-hero {
		width: 100%;
		text-align: center;
	}

	body.login-bg .login-brand {
		display: flex;
		width: min(100%, 360px);
		margin: 0 auto 24px;
	}

	body.login-bg .login-feature-grid {
		max-width: 360px;
		margin-right: auto;
		margin-left: auto;
	}
}

@media (max-width: 768px) {
	body #sidebar {
		position: fixed;
		z-index: 1060;
		top: 0;
		bottom: 0;
		left: 0;
		min-width: min(82vw, 300px);
		max-width: min(82vw, 300px);
		width: min(82vw, 300px);
		margin-left: 0;
		box-shadow: 18px 0 44px rgba(20, 39, 51, 0.22);
		transform: translateX(-100%);
		transition: transform 0.24s ease;
	}

	body #sidebar.active {
		min-width: min(82vw, 300px);
		max-width: min(82vw, 300px);
		width: min(82vw, 300px);
		margin-left: 0;
		transform: translateX(0);
	}

	body #sidebar.active .sidebar-header {
		padding: 22px 22px 18px;
	}

	body #sidebar.active .logo .nav-link {
		justify-content: flex-start;
	}

	body #sidebar.active .sidebar-logo-full,
	body #sidebar.active .menu-text,
	body #sidebar.active .dropdown-toggle::after {
		display: block !important;
	}

	body #sidebar.active ul ul.collapse.show {
		display: block !important;
	}

	body #sidebar.active ul ul.collapse:not(.show) {
		display: none !important;
	}

	body #sidebar.active .sidebar-logo-icon {
		display: none;
	}

	body #sidebar.active ul.components {
		padding: 18px 16px 16px;
	}

	body #sidebar.active ul.components > li {
		margin-bottom: 8px;
	}

	body #sidebar.active ul li a,
	body #sidebar.active .nav-link {
		justify-content: flex-start;
		padding: 12px 14px;
	}

	body #sidebar.active ul li a i,
	body #sidebar.active .nav-link i {
		margin-right: 12px;
	}

	body #sidebar.active ul ul a {
		padding: 8px 14px 8px 44px !important;
	}

	body #sidebar.active .sidebar-user-card {
		justify-content: flex-start;
		margin: 16px;
		padding: 14px 12px;
	}

	body #sidebar.active .sidebar-user-meta {
		display: flex;
	}

	body #sidebar.active .sidebar-user-menu {
		display: inline-block;
	}

	body #sidebar.active .sidebar-user-arrow {
		display: none;
	}

	.sidebar-backdrop {
		position: fixed;
		z-index: 1050;
		inset: 0;
		display: block;
		padding: 0;
		border: 0;
		background: rgba(20, 39, 51, 0.42);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease;
	}

	.sidebar-backdrop.is-visible {
		opacity: 1;
		pointer-events: auto;
	}

	body.mobile-sidebar-open {
		overflow: hidden;
	}

	body .dashboard_header {
		padding-right: 12px;
		padding-left: 12px;
	}

	body .header-actions {
		min-width: 0;
		gap: 10px;
	}

	body #navbarSupportedContent,
	body .header-company,
	body .header-user {
		min-width: 0;
	}

	body .header-company .nav-link span {
		max-width: 104px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	body .header-user .nav-link span {
		max-width: 110px;
	}
}

@media (max-width: 520px) {
	body #sidebarCollapse {
		flex: 0 0 38px;
		width: 38px;
		height: 38px;
	}

	body .header-actions {
		gap: 8px;
	}

	body .header-company .nav-link span,
	body .header-user .nav-link > span:not(.header-profile-avatar),
	body .header-user-caret {
		display: none;
	}

	body .header-company .dropdown-menu,
	body .header-user .dropdown-menu {
		position: fixed !important;
		top: 58px !important;
		right: 12px !important;
		left: 12px !important;
		width: auto;
		min-width: 0;
		transform: none !important;
	}
}

body .modern-dashboard {
	max-width: calc(100% + 16px);
	min-width: 0;
}

body .dashboard-person-name {
	white-space: nowrap;
}

body .modern-dashboard .dashboard-actions {
	grid-template-columns: repeat(2, minmax(0, 140px));
	min-width: 0;
}

body .modern-dashboard .ranking-columns p {
	min-width: 0;
	padding-right: 8px;
}

body .modern-dashboard .ranking-columns p b {
	flex: 0 0 auto;
	white-space: nowrap;
}

@media (max-width: 520px) {
	body .modern-dashboard {
		width: 100%;
		max-width: 100%;
		margin: 0;
	}

	body .modern-dashboard .dashboard-welcome,
	body .modern-dashboard .metric-grid,
	body .modern-dashboard .dashboard-grid,
	body .modern-dashboard .dash-panel {
		width: 100%;
		max-width: 100%;
		min-width: 0;
	}

	body .modern-dashboard .dash-panel {
		overflow-x: hidden;
	}

	body .modern-dashboard .table-responsive,
	body .modern-dashboard .chart-canvas-wrap,
	body .modern-dashboard canvas {
		max-width: 100% !important;
	}

	body .modern-dashboard .insight-row table {
		table-layout: fixed;
	}

	/*
	 * Keep dashboard tables inside the mobile layout viewport. A fixed 820px
	 * table caused Chromium to widen the page's layout viewport even though the
	 * table wrapper itself was scrollable, leaving a blank horizontal canvas.
	 */
	body .modern-dashboard .today-activity-table,
	body .modern-dashboard .recent-panel table {
		min-width: 0 !important;
		width: 100% !important;
		table-layout: fixed;
	}

	body .modern-dashboard .today-activity-table th,
	body .modern-dashboard .today-activity-table td,
	body .modern-dashboard .recent-panel th,
	body .modern-dashboard .recent-panel td {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	body .modern-dashboard .today-activity-table th:nth-child(1) { width: 72px; }
	body .modern-dashboard .today-activity-table th:nth-child(2) { width: 78px; }
	body .modern-dashboard .today-activity-table th:nth-child(3) { width: auto; }
	body .modern-dashboard .today-activity-table th:nth-child(6) { width: 54px; }
	body .modern-dashboard .today-activity-table th:nth-child(4),
	body .modern-dashboard .today-activity-table td:nth-child(4),
	body .modern-dashboard .today-activity-table th:nth-child(5),
	body .modern-dashboard .today-activity-table td:nth-child(5) {
		display: none;
	}

	body .modern-dashboard .recent-panel th:nth-child(1) { width: 74px; }
	body .modern-dashboard .recent-panel th:nth-child(2) { width: 78px; }
	body .modern-dashboard .recent-panel th:nth-child(3) { width: auto; }
	body .modern-dashboard .recent-panel th:nth-child(8) { width: 72px; }
	body .modern-dashboard .recent-panel th:nth-child(4),
	body .modern-dashboard .recent-panel td:nth-child(4),
	body .modern-dashboard .recent-panel th:nth-child(5),
	body .modern-dashboard .recent-panel td:nth-child(5),
	body .modern-dashboard .recent-panel th:nth-child(6),
	body .modern-dashboard .recent-panel td:nth-child(6),
	body .modern-dashboard .recent-panel th:nth-child(7),
	body .modern-dashboard .recent-panel td:nth-child(7) {
		display: none;
	}

	body .modern-dashboard .insight-row th,
	body .modern-dashboard .insight-row td {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	body .modern-dashboard .dashboard-actions {
		width: 100%;
	}

	body .modern-dashboard .ranking-panel,
	body .modern-dashboard .geo-panel {
		overflow: hidden;
	}

	body .modern-dashboard .ranking-columns p {
		gap: 6px;
		padding-right: 10px;
	}

	body .modern-dashboard .ranking-columns span {
		min-width: 0;
	}

	body .modern-dashboard .geo-grid > div {
		min-width: 0;
		padding-right: 0;
		padding-left: 0;
	}

	body .modern-dashboard .geo-row {
		grid-template-columns: 18px minmax(0, 1fr) minmax(34px, .55fr) minmax(64px, auto);
		gap: 5px;
		min-width: 0;
	}

	body .modern-dashboard .geo-row span {
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	body .modern-dashboard .geo-row b {
		max-width: 76px;
		overflow: hidden;
		font-size: 11px;
		text-overflow: ellipsis;
	}

	body .modern-dashboard .geo-row b small {
		font-size: 10px;
	}
}

body .collab-form,
body .collab-form > * {
	min-width: 0;
}

body .collab-form input,
body .collab-form textarea {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
	width: 100%;
}

@media (max-width: 900px) {
	body .collab-form {
		grid-template-columns: minmax(0, 1fr);
	}

	body .collab-form button {
		box-sizing: border-box;
		max-width: 100%;
		width: 100%;
	}
}

body .client-rate-form .money-input input {
	width: 110px;
}

@media (max-width: 760px) {
	body .client-rate-form {
		min-width: 220px;
	}
}

@media (max-width: 520px) {
	body .client-rate-form {
		min-width: 190px;
	}

	body .client-rate-form .money-input {
		flex: 0 1 118px;
	}

	body .client-rate-form .money-input input {
		width: 88px;
	}
}
