/**
 * PSB-PORTAL-RAIL-CONTINUITY-001 — rail izquierdo continuo hasta el borde inferior del viewport.
 * Complementa psb-pres-portal-rail-sticky-hotfix-001.
 *
 * Altura: 100vh (no 100vh−header). Con top:0 sticky, el rail arranca bajo la cabecera
 * en flujo normal y cubre el resto del viewport; al hacer scroll queda pegado a pantalla completa.
 */

body.psb-pres-portal-shell .psb-pres-panel__grid.psb-pres-panel__grid--shell3 {
	--psb-portal-rail-w-min: 260px;
	--psb-portal-rail-w-max: 300px;
	--psb-portal-rail-separator: rgba(28, 25, 23, 0.1);
	gap: 0 !important;
	row-gap: 0 !important;
	column-gap: 0 !important;
	grid-gap: 0 !important;
}

@media (min-width: 768px) {
	/* —— Columna rail: superficie continua a altura de pantalla —— */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__nav,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail {
		align-self: start !important;
		position: sticky !important;
		top: 0 !important;
		z-index: 2;
		background: #ffffff !important;
		border: none !important;
		border-right: none !important;
		box-shadow: inset -1px 0 0 var(--psb-portal-rail-separator) !important;
		border-radius: 0 !important;
		min-height: 100vh !important;
		max-height: 100vh !important;
		box-sizing: border-box;
		margin: 0 !important;
		padding: 0 !important;
		width: 100% !important;
		max-width: none !important;
		min-width: 0 !important;
	}

	/* Anula sombra lateral gestion-ui (creaba ~20px de “gap” visual) */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d--premium.psb-shell-rail {
		box-shadow: inset -1px 0 0 var(--psb-portal-rail-separator) !important;
	}

	body.psb-pres-portal-shell.admin-bar .psb-pres-panel__grid--shell3 > .psb-pres-panel__nav,
	body.psb-pres-portal-shell.admin-bar .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d,
	body.psb-pres-portal-shell.admin-bar .psb-pres-panel__grid--shell3 > .psb-shell-rail {
		top: 32px !important;
		height: calc(100vh - 32px) !important;
		min-height: calc(100vh - 32px) !important;
		max-height: calc(100vh - 32px) !important;
	}

	/* Capa de respaldo: pinta la columna 1 del grid si el aside no cubre */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 {
		position: relative;
		isolation: isolate;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3::before {
		content: "";
		position: absolute;
		top: 0;
		left: 0;
		width: min(var(--psb-portal-rail-w-max), 100%);
		height: 100%;
		min-height: 100vh;
		background: #ffffff;
		box-shadow: inset -1px 0 0 var(--psb-portal-rail-separator);
		z-index: 0;
		pointer-events: none;
	}

	body.psb-pres-portal-shell.admin-bar .psb-pres-panel__grid--shell3::before {
		min-height: calc(100vh - 32px);
	}

	/* Anula tarjeta premium / gris corto de cliente.css */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d--premium,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__nav.psb-pres-rail-d1d--premium,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail {
		overflow: hidden;
	}

	/* Rail CRM: flex + scroll interno */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail {
		display: flex !important;
		flex-direction: column !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d:not(.psb-shell-rail),
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__nav:not(.psb-shell-rail) {
		overflow-x: hidden;
		overflow-y: auto;
		scrollbar-width: thin;
		-webkit-overflow-scrolling: touch;
	}

	/* Wrappers internos sin cajas que corten */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail .psb-shell-rail__brand,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail .psb-shell-rail__body,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d .psb-pres-rail-d1d__block {
		background: transparent !important;
		box-shadow: none !important;
		border-radius: 0 !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail .psb-shell-rail__brand {
		border-bottom: 1px solid #f0f0ee !important;
		flex-shrink: 0;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail .psb-shell-rail__brand-mark {
		background: transparent !important;
		border-radius: 0 !important;
		padding: 0.35rem 0 !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail .psb-shell-rail__body {
		flex: 1 1 auto;
		min-height: 0;
		overflow: auto;
		scrollbar-width: thin;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail .psb-pres-rail-d1d__block--primary,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d .psb-pres-rail-d1d__block--primary {
		background: transparent !important;
		border-bottom: 1px solid #f0f0ee !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d .psb-pres-rail-d1d__block {
		border-bottom: 1px solid #f0f0ee !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d .psb-pres-rail-d1d__block:last-child {
		border-bottom: none !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail .psb-pres-rail-d1d__block--nav {
		border-bottom: none !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__aside {
		position: relative;
		z-index: 1;
	}

	/* Bloque central pegado al rail: solo la línea de 1px, sin column-gap ni padding-left */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main {
		padding-top: 1.35rem !important;
		padding-right: 1.5rem !important;
		padding-bottom: 2rem !important;
		padding-left: 0 !important;
		margin-left: 0 !important;
		border-left: none !important;
	}

	/* Aire interno del contenido, no entre columnas del grid */
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main > .psb-pres-portal-card,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main > .psb-pres-panel__form-card,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main > .psb-pres-panel__unified-card,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main > .psb-pres-panel-home-card,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main > .psb-pres-form2026,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__main > form {
		padding-left: 1.25rem;
		padding-right: 1.5rem;
		box-sizing: border-box;
	}
}

/* —— Rail más ancho: casi rozando el bloque central —— */
@media (min-width: 1024px) {
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3:not(.psb-pres-panel__grid--no-aside):not(.psb-pres-panel__grid--visual-inner) {
		grid-template-columns: minmax(var(--psb-portal-rail-w-min), var(--psb-portal-rail-w-max)) minmax(0, 1fr) minmax(248px, 300px) !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3.psb-pres-panel__grid--no-aside,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3.psb-pres-panel__grid--visual-inner {
		grid-template-columns: minmax(var(--psb-portal-rail-w-min), var(--psb-portal-rail-w-max)) minmax(0, 1fr) !important;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 {
		--psb-portal-rail-w-min: 220px;
		--psb-portal-rail-w-max: 248px;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3:not(.psb-pres-panel__grid--no-aside):not(.psb-pres-panel__grid--visual-inner) {
		grid-template-columns: minmax(var(--psb-portal-rail-w-min), var(--psb-portal-rail-w-max)) minmax(0, 1fr) !important;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3.psb-pres-panel__grid--no-aside,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3.psb-pres-panel__grid--visual-inner {
		grid-template-columns: minmax(var(--psb-portal-rail-w-min), var(--psb-portal-rail-w-max)) minmax(0, 1fr) !important;
	}
}

@media (max-width: 767px) {
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3::before {
		content: none;
		display: none;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-panel__nav,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-pres-rail-d1d,
	body.psb-pres-portal-shell .psb-pres-panel__grid--shell3 > .psb-shell-rail {
		position: static !important;
		top: auto !important;
		height: auto !important;
		min-height: auto !important;
		max-height: none !important;
		overflow: visible !important;
	}
}
