/**
 * PSB-FORMULARIOS-2026-RESPONSIVE-003 — móvil real, panel acabados debajo.
 */

/* —— Breakpoints ——
 * móvil:  max 767px  → rail debajo, formulario ancho útil
 * tablet: 768–1023px → columna lateral si cabe
 * desktop: ≥1024px  → layout actual
 */

@media (max-width: 767px) {
	/* Contenedor principal: una columna, rail debajo */
	body.psb-pres-portal-shell .psb-pres-panel__grid:not(.psb-pres-panel__grid--solo-main):not(.psb-pres-panel__grid--shell3) {
		display: flex;
		flex-direction: column;
		gap: 20px;
		width: 100%;
		max-width: 100%;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid .psb-pres-panel__main {
		order: 1;
		width: 100%;
		max-width: 100%;
		min-width: 0;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid:not(.psb-pres-panel__grid--shell3) .psb-pres-panel__main {
		order: 1;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid .psb-pres-rail-d1d {
		order: 2;
		width: 100%;
		max-width: 100%;
		min-width: 0;
		position: static;
		top: auto;
		align-self: stretch;
		margin-top: 0;
		border-radius: 12px;
	}

	body.psb-pres-portal-shell .psb-pres-panel__surface--form {
		padding: 16px 14px 14px;
		border-radius: 12px;
	}

	body.psb-pres-portal-shell .psb-pres-cfg-2026-shell.psb-pres-panel__form-card,
	body.psb-pres-portal-shell .psb-pres-cfg-mother-shell.psb-pres-panel__form-card {
		padding: 0.85rem 0.75rem 0.9rem;
	}

	/* Workrow: campos → precio (orden DOM, sin order negativo) */
	body.psb-pres-portal-shell .psb-pres-cfg-mother__workrow,
	body.psb-pres-portal-shell .psb-pres-cfg-2026__workrow,
	body.psb-pres-portal-shell .psb-pres-config-workrow {
		display: flex;
		flex-direction: column;
		gap: 1rem;
		width: 100%;
		max-width: 100%;
	}

	body.psb-pres-portal-shell .psb-pres-cfg-mother__main,
	body.psb-pres-portal-shell .psb-pres-cfg-2026__main,
	body.psb-pres-portal-shell .psb-pres-config-workrow__fields {
		order: 1;
		width: 100%;
		max-width: 100%;
		min-width: 0;
	}

	body.psb-pres-portal-shell .psb-pres-live-price,
	body.psb-pres-portal-shell .psb-pres-form2026__price {
		order: 2;
		width: 100%;
		max-width: 100%;
		min-width: 0;
		position: static;
		top: auto;
		margin-top: 0;
	}

	/* Formulario ancho útil */
	body.psb-pres-portal-shell .psb-pres-form2026 {
		width: 100%;
		max-width: 100%;
	}

	body.psb-pres-portal-shell .psb-pres-portal-input--title,
	body.psb-pres-portal-shell .psb-pres-portal-input--medium,
	body.psb-pres-portal-shell .psb-pres-form2026-form .psb-pres-cfg-input {
		max-width: 100%;
		width: 100%;
	}

	body.psb-pres-portal-shell .psb-pres-portal-input--short,
	body.psb-pres-portal-shell .psb-pres-form2026-form .psb-pres-fp-medidas-field__input,
	body.psb-pres-portal-shell .psb-pres-form2026-form .psb-pres-rega-field__input:not(.psb-pres-rega-date-wrap__input) {
		max-width: min(150px, 100%);
	}

	body.psb-pres-portal-shell .psb-pres-form2026__grid--2,
	body.psb-pres-portal-shell .psb-pres-form2026__grid--3,
	body.psb-pres-portal-shell .psb-pres-form2026--rega .psb-pres-rega-grid--2,
	body.psb-pres-portal-shell .psb-pres-form2026--rega .psb-pres-rega-grid--3,
	body.psb-pres-portal-shell .psb-pres-form2026--rega .psb-pres-rega-grid--4 {
		grid-template-columns: 1fr;
		width: 100%;
	}

	body.psb-pres-portal-shell .psb-pres-form2026__grid--medidas {
		flex-direction: column;
		align-items: stretch;
	}

	body.psb-pres-portal-shell .psb-pres-form2026 .psb-pres-fp-medidas-x {
		display: none;
	}

	/* Tarjetas tocables */
	body.psb-pres-portal-shell .psb-pres-form2026__cards .psb-pres-pl-radio-grid,
	body.psb-pres-portal-shell .psb-pres-form2026__cards .psb-pres-fp-caras-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	body.psb-pres-portal-shell .psb-pres-pl-radio-card__inner {
		min-height: 88px;
	}

	/* Rail móvil — bloque secundario, no columna encogida */
	body.psb-pres-portal-shell .psb-pres-panel__grid .psb-pres-rail-d1d {
		border-left: 0;
		padding-left: 0;
		border-top: 1px solid #e7e5e4;
		padding-top: 0;
	}

	body.psb-pres-portal-shell .psb-pres-rail-d1d--premium .psb-pres-rail-d1d__list--nav .psb-pres-rail-d1d__link {
		display: block;
		padding: 12px 14px;
		border-radius: 8px;
	}

	body.psb-pres-portal-shell .psb-pres-rail-d1d__block {
		padding: 14px 16px 16px;
	}

	body.psb-pres-portal-shell .psb-pres-panel--home .psb-pres-panel__quick-grid,
	body.psb-pres-portal-shell .psb-pres-panel--armonizado .psb-pres-panel__quick-grid {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	body.psb-pres-portal-shell .psb-pres-ut-medidas-layout {
		flex-direction: column;
	}

	body.psb-pres-portal-shell .psb-pres-ut-medidas-layout__diagram {
		max-width: 100%;
	}
}

@media (max-width: 480px) {
	body.psb-pres-portal-shell .psb-pres-form2026__cards .psb-pres-pl-radio-grid,
	body.psb-pres-portal-shell .psb-pres-form2026__cards .psb-pres-fp-caras-grid {
		grid-template-columns: 1fr;
	}
}

/* Tablet: mantener lateral si cabe (restaura 2 cols frente a stack 960px legacy) */
@media (min-width: 768px) and (max-width: 1023px) {
	body.psb-pres-portal-shell .psb-pres-panel__grid:not(.psb-pres-panel__grid--solo-main):not(.psb-pres-panel__grid--shell3) {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(168px, 220px);
		gap: 24px 28px;
		align-items: start;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid .psb-pres-panel__main {
		order: unset;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid .psb-pres-rail-d1d {
		order: unset;
		position: sticky;
		top: 20px;
		width: auto;
		max-width: none;
	}

	body.psb-pres-portal-shell .psb-pres-panel__grid .psb-pres-rail-d1d {
		border-left: 1px solid #e7e5e4;
		padding-left: 1rem;
		border-top: 0;
		padding-top: 6px;
	}
}

/* Anular order:-1 del precio en layouts apilados (tablet estrecha / móvil) */
@media (max-width: 1023px) {
	body.psb-pres-portal-shell .psb-pres-cfg-mother__workrow,
	body.psb-pres-portal-shell .psb-pres-cfg-2026__workrow {
		grid-template-columns: 1fr;
	}

	body.psb-pres-portal-shell .psb-pres-cfg-mother .psb-pres-live-price,
	body.psb-pres-portal-shell .psb-pres-cfg-2026 .psb-pres-live-price,
	body.psb-pres-portal-shell .psb-pres-form2026__price {
		order: 2;
		position: static;
		top: auto;
	}

	body.psb-pres-portal-shell .psb-pres-cfg-mother__main,
	body.psb-pres-portal-shell .psb-pres-cfg-2026__main {
		order: 1;
	}
}
