/**
 * APE Configurator — UI wizard (prefisso .ape-cfg).
 * Restyling APEDOC: palette brand, look premium/tecnico; tutto sotto .ape-cfg.ape-cfg--root.
 */

@keyframes ape-cfg-shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

@keyframes ape-cfg-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Ombra step attivo: statica, discreta (no pulse invadente) */
@keyframes ape-cfg-progress-pulse {
	0%,
	100% {
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
	}
	50% {
		box-shadow: 0 3px 14px rgba(186, 162, 76, 0.22);
	}
}

@keyframes ape-cfg-screen-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------- Root / token APEDOC + mappa semantica esistente ---------- */
.ape-cfg.ape-cfg--root {
	/* Brand (obbligatori) */
	--apedoc-gold: #baa24c;
	--apedoc-dark: #151515;
	--apedoc-bronze: #8b7958;
	--apedoc-shadow: rgba(0, 0, 0, 0.05);
	/* Derivate coerenti */
	--apedoc-gold-hover: #c9b25d;
	--apedoc-gold-pressed: #a08e42;
	--apedoc-ink: #2a2a2a;
	--apedoc-cream: #f8f7f3;
	--apedoc-cream-deep: #f3efe6;
	--apedoc-line: rgba(139, 121, 88, 0.22);
	--apedoc-line-strong: rgba(21, 21, 21, 0.08);

	--ape-cfg-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--ape-cfg-radius: 16px;
	--ape-cfg-radius-sm: 10px;
	--ape-cfg-border: 1px solid var(--apedoc-shadow);
	--ape-cfg-bg-page: var(--apedoc-cream);
	--ape-cfg-surface: #ffffff;
	--ape-cfg-text: var(--apedoc-ink);
	--ape-cfg-muted: rgba(21, 21, 21, 0.55);
	--ape-cfg-accent: var(--apedoc-gold);
	--ape-cfg-accent-soft: rgba(186, 162, 76, 0.14);
	--ape-cfg-accent-hover: var(--apedoc-gold-pressed);
	--ape-cfg-focus: 0 0 0 2px #ffffff, 0 0 0 3px rgba(186, 162, 76, 0.45);
	--ape-cfg-shadow: 0 1px 2px var(--apedoc-shadow), 0 10px 36px rgba(0, 0, 0, 0.06);
	--ape-cfg-shadow-sm: 0 1px 2px var(--apedoc-shadow);
	--ape-cfg-shadow-card-hover: 0 6px 24px rgba(0, 0, 0, 0.07);
	/* Pulsante primario: contrasto forte su fondo chiaro */
	--ape-cfg-btn-primary-bg: var(--apedoc-dark);
	--ape-cfg-btn-primary-hover: #2a2a2a;
	--ape-cfg-btn-primary-fg: #ffffff;

	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	width: 90vw;
	max-width: none;
	margin-left: auto;
	margin-right: auto;
	padding: clamp(1.25rem, 3vw, 2rem) clamp(0.85rem, 2.2vw, 1.5rem) clamp(1.75rem, 3.5vw, 2.75rem);
	box-sizing: border-box;
	color: var(--ape-cfg-text);
	font-family: var(--ape-cfg-font);
	font-size: 1rem;
	line-height: 1.6;
	background: var(--ape-cfg-bg-page);
	border-radius: var(--ape-cfg-radius);
	border: 1px solid var(--apedoc-shadow);
	box-shadow: var(--ape-cfg-shadow-sm);
}

.ape-cfg.ape-cfg--root *,
.ape-cfg.ape-cfg--root *::before,
.ape-cfg.ape-cfg--root *::after {
	box-sizing: border-box;
}

/* ---------- Top / titolo ---------- */
.ape-cfg__top {
	margin-bottom: clamp(0.75rem, 2vw, 1.5rem);
	text-align: center;
	max-width: 42rem;
	margin-left: auto;
	margin-right: auto;
}

.ape-cfg__title {
	font-size: clamp(1.375rem, 3.5vw, 1.75rem);
	font-weight: 600;
	margin: 0 0 clamp(0.65rem, 2vw, 1.25rem);
	letter-spacing: -0.025em;
	line-height: 1.25;
	color: var(--ape-cfg-text);
}

/* ---------- Progress circolare ---------- */
.ape-cfg__progress {
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	padding: 0.25rem 0 0.5rem;
	-webkit-overflow-scrolling: touch;
	position: relative;
}

.ape-cfg__progress-list {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	list-style: none;
	margin: 0 auto;
	padding: 0;
	max-width: 720px;
	gap: 0;
}

.ape-cfg__progress-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	min-width: 0;
	position: relative;
}

.ape-cfg__progress-dot-wrap {
	display: flex;
	align-items: center;
	width: 100%;
	position: relative;
}

.ape-cfg__progress-dot {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 50%;
	background: var(--ape-cfg-surface);
	border: 2px solid var(--apedoc-line);
	color: var(--ape-cfg-muted);
	font-weight: 700;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	flex-shrink: 0;
	transition:
		border-color 0.22s ease,
		background 0.22s ease,
		color 0.22s ease,
		box-shadow 0.22s ease,
		transform 0.22s ease;
	z-index: 1;
}

.ape-cfg__progress-dot.is-active {
	border-color: var(--apedoc-gold);
	background: var(--apedoc-gold);
	color: var(--apedoc-dark);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	animation: ape-cfg-progress-pulse 3.5s ease-in-out infinite;
}

.ape-cfg__progress-dot.is-done {
	border-color: rgba(139, 121, 88, 0.55);
	background: rgba(186, 162, 76, 0.12);
	color: var(--apedoc-bronze);
}

.ape-cfg__progress-line {
	flex: 1;
	height: 2px;
	border-radius: 2px;
	background: var(--apedoc-line-strong);
	margin: 0 -0.45rem;
	align-self: center;
	min-width: 10px;
	transition:
		background 0.28s ease,
		height 0.28s ease;
}

.ape-cfg__progress-line.is-done {
	background: linear-gradient(90deg, rgba(139, 121, 88, 0.55), var(--apedoc-gold));
	height: 2px;
}

.ape-cfg__progress-item:last-child .ape-cfg__progress-line {
	display: none;
}

.ape-cfg__progress-caption {
	display: block;
	margin-top: 0.65rem;
	font-size: 0.6875rem;
	font-weight: 500;
	color: var(--ape-cfg-muted);
	line-height: 1.3;
	padding: 0 0.15rem;
	max-width: 6.75rem;
	transition: color 0.2s ease, font-weight 0.2s ease;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.ape-cfg__progress-item:has(.ape-cfg__progress-dot.is-active) .ape-cfg__progress-caption {
	color: var(--ape-cfg-text);
	font-weight: 600;
}

@media (min-width: 640px) {
	.ape-cfg__progress-caption {
		font-size: 0.75rem;
		max-width: none;
	}
}

/* ---------- Shell: nav | card | summary ---------- */
.ape-cfg__shell {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	align-items: flex-start;
}

/* Colonna: larghezza piena senza stretch verticale tra colonne */
.ape-cfg__shell > .ape-cfg__sidenav,
.ape-cfg__shell > .ape-cfg__card-wrap,
.ape-cfg__shell > .ape-cfg__summary-aside {
	min-width: 0;
}

@media (min-width: 1201px) {
	.ape-cfg.ape-cfg--root {
		max-width: 1240px;
	}

	.ape-cfg__shell {
		display: grid;
		grid-template-columns: 220px minmax(0, 1fr) minmax(260px, 300px);
		gap: 1.75rem;
		align-items: start;
	}

	/* Nessuna equal-height tra colonne: ogni colonna ha altezza del proprio contenuto */
	.ape-cfg__shell > .ape-cfg__sidenav,
	.ape-cfg__shell > .ape-cfg__card-wrap,
	.ape-cfg__shell > .ape-cfg__summary-aside {
		align-self: start;
		justify-self: stretch;
		min-height: 0;
		height: auto;
	}
}

/* Tablet / mobile: colonna singola — progress (header) → nav → card → riepilogo */
@media (max-width: 1200px) {
	.ape-cfg__shell > .ape-cfg__sidenav,
	.ape-cfg__shell > .ape-cfg__card-wrap,
	.ape-cfg__shell > .ape-cfg__summary-aside {
		width: 100%;
		max-width: 100%;
		align-self: stretch;
	}

	.ape-cfg__sidenav {
		order: 0;
	}
	.ape-cfg__card-wrap {
		order: 1;
	}
	.ape-cfg__summary-aside {
		order: 2;
	}
}

/* ---------- Nav sinistra ---------- */
.ape-cfg__sidenav {
	background: var(--ape-cfg-surface);
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius);
	padding: 1rem 0.75rem;
	box-shadow: var(--ape-cfg-shadow-sm);
}

/* Tablet: nav orizzontale compatta (stesso pattern di prima, solo 768–1200) */
@media (min-width: 768px) and (max-width: 1200px) {
	.ape-cfg__sidenav {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		padding: 0.75rem;
	}

	.ape-cfg__nav-tree {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		gap: 0.5rem;
		min-width: min-content;
	}

	.ape-cfg__nav-block {
		flex: 0 0 auto;
	}

	.ape-cfg__nav-block-title {
		display: none;
	}

	.ape-cfg__nav-sub {
		display: flex;
		flex-direction: row;
		gap: 0.35rem;
	}

	.ape-cfg__nav-link--single {
		white-space: nowrap;
	}

	.ape-cfg__nav-rail {
		flex: 0 0 auto;
	}

	.ape-cfg__nav-rail-scroll {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: stretch;
		gap: 0.5rem;
	}
}

/* Rail macro 2–5: colonna su desktop, riga su tablet/mobile */
.ape-cfg__nav-rail-scroll {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
}

.ape-cfg__nav-rail .ape-cfg__nav-link--single {
	margin-bottom: 0;
}

.ape-cfg__nav-tree {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ape-cfg__nav-block {
	margin-bottom: 1rem;
}

.ape-cfg__nav-block:last-child {
	margin-bottom: 0;
}

.ape-cfg__nav-block-title {
	display: block;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--ape-cfg-muted);
	margin-bottom: 0.5rem;
	padding-left: 0.35rem;
}

.ape-cfg__nav-sub {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ape-cfg__nav-link {
	display: block;
	width: 100%;
	text-align: left;
	padding: 0.5rem 0.65rem;
	margin-bottom: 0.2rem;
	border: none;
	border-radius: var(--ape-cfg-radius-sm);
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.ape-cfg__nav-link:hover:not(:disabled) {
	background: var(--apedoc-cream-deep);
}

.ape-cfg__nav-link:focus {
	outline: none;
}

.ape-cfg__nav-link:focus-visible {
	box-shadow: var(--ape-cfg-focus);
}

.ape-cfg__nav-link:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.ape-cfg__nav-link.is-active {
	background: var(--ape-cfg-accent-soft);
	color: var(--ape-cfg-accent);
	font-weight: 600;
}

.ape-cfg__nav-link.is-complete:not(.is-active) {
	color: var(--ape-cfg-muted);
}

.ape-cfg__nav-link.is-complete:not(.is-active)::before {
	content: "✓ ";
	color: var(--ape-cfg-accent);
	font-size: 0.75em;
}

.ape-cfg__nav-link.ape-cfg__nav-link--needs-work:not(.is-active) {
	border: 1px solid rgba(217, 119, 6, 0.35);
	background: rgba(254, 243, 199, 0.35);
}

.ape-cfg__nav-link.ape-cfg__nav-link--forward-locked {
	opacity: 0.72;
	cursor: default;
}

.ape-cfg__nav-link.ape-cfg__nav-link--forward-locked:hover {
	background: transparent;
}

/* ---------- Card centrale ---------- */
.ape-cfg__card-wrap {
	position: relative;
	background: var(--ape-cfg-surface);
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius);
	padding: clamp(1.35rem, 3vw, 1.85rem) clamp(1.15rem, 2.5vw, 2rem) clamp(1.35rem, 3vw, 1.65rem);
	box-shadow: var(--ape-cfg-shadow);
	min-height: 0;
}

@media (min-width: 768px) {
	.ape-cfg__card-wrap {
		padding: 2rem 2.25rem 1.75rem;
	}
}

.ape-cfg__validation {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 1rem 1.15rem;
	border-radius: var(--ape-cfg-radius-sm);
	background: #fdf5f4;
	border: 1px solid rgba(185, 28, 28, 0.22);
	border-left: 3px solid #b91c1c;
	color: #7f1d1d;
	font-size: 0.9375rem;
	line-height: 1.5;
	margin-bottom: 1.35rem;
	box-shadow: 0 1px 3px var(--apedoc-shadow);
}

.ape-cfg__validation-icon {
	flex-shrink: 0;
	width: 1.35rem;
	height: 1.35rem;
	margin-top: 0.1rem;
	border-radius: 50%;
	background: rgba(185, 28, 28, 0.12);
	position: relative;
}

.ape-cfg__validation-icon::after {
	content: "!";
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -52%);
	font-weight: 800;
	font-size: 0.8125rem;
	font-family: var(--ape-cfg-font);
	color: #b91c1c;
	line-height: 1;
}

.ape-cfg__validation-msg {
	margin: 0;
	flex: 1;
	min-width: 0;
	font-weight: 500;
}

.ape-cfg__validation--hidden {
	display: none !important;
}

.ape-cfg__form {
	margin: 0;
	min-height: 0;
}

.ape-cfg__hiddens {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

/* Step: un solo pannello nel flusso (gli altri hanno [hidden], niente stacking grid che massimizza l’altezza) */
.ape-cfg__screens {
	display: block;
	min-height: 0;
}

.ape-cfg__screen[hidden] {
	display: none !important;
}

.ape-cfg__screen {
	outline: none;
}

.ape-cfg__screen:not([hidden]) {
	display: block;
	animation: ape-cfg-screen-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.ape-cfg__screen--active {
	position: relative;
	z-index: 1;
}

.ape-cfg__screen-title {
	font-size: clamp(1.125rem, 2.5vw, 1.3125rem);
	font-weight: 600;
	margin: 0 0 0.5rem;
	letter-spacing: -0.02em;
	line-height: 1.3;
	color: var(--ape-cfg-text);
}

.ape-cfg__screen-lead {
	color: var(--ape-cfg-muted);
	font-size: 0.9375rem;
	margin: 0 0 clamp(1rem, 2.5vw, 1.4rem);
	line-height: 1.55;
	max-width: 36rem;
}

/* ---------- Choice cards ---------- */
.ape-cfg__choice-grid {
	display: grid;
	gap: 0.75rem;
}

.ape-cfg__choice-grid--motivo {
	grid-template-columns: 1fr;
}

@media (min-width: 520px) {
	.ape-cfg__choice-grid--motivo {
		grid-template-columns: repeat(2, 1fr);
	}
}

.ape-cfg__choice-grid--superficie {
	grid-template-columns: 1fr;
}

@media (min-width: 480px) {
	.ape-cfg__choice-grid--superficie {
		grid-template-columns: repeat(2, 1fr);
	}
}

.ape-cfg__choice-grid--copie {
	grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 520px) {
	.ape-cfg__choice-grid--copie {
		grid-template-columns: repeat(3, 1fr);
	}
}

.ape-cfg__choice-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
}

@media (min-width: 480px) {
	.ape-cfg__choice-row:not(.ape-cfg__choice-row--stack) {
		grid-template-columns: 1fr 1fr;
	}
}

.ape-cfg__choice-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	text-align: left;
	padding: 1.05rem 1.2rem;
	min-height: 3rem;
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius-sm);
	background: var(--ape-cfg-surface);
	color: inherit;
	font: inherit;
	cursor: pointer;
	transition:
		border-color 0.2s ease,
		box-shadow 0.22s ease,
		background 0.22s ease,
		transform 0.22s ease;
	box-shadow: var(--ape-cfg-shadow-sm);
	position: relative;
}

.ape-cfg__choice-card:hover {
	border-color: rgba(139, 121, 88, 0.35);
	box-shadow: var(--ape-cfg-shadow-card-hover);
	transform: translateY(-1px);
}

.ape-cfg__choice-card:active {
	transform: translateY(0);
}

.ape-cfg__choice-card:focus {
	outline: none;
}

.ape-cfg__choice-card:focus-visible {
	box-shadow: var(--ape-cfg-focus);
	border-color: rgba(186, 162, 76, 0.55);
}

.ape-cfg__choice-card.is-selected {
	border-color: var(--apedoc-gold);
	background: linear-gradient(160deg, rgba(186, 162, 76, 0.1) 0%, rgba(248, 247, 243, 0.95) 100%);
	box-shadow:
		0 0 0 1px var(--apedoc-gold),
		0 4px 18px rgba(0, 0, 0, 0.06);
	transform: translateY(-1px);
}

.ape-cfg__choice-card.is-selected::after {
	content: "";
	position: absolute;
	top: 0.65rem;
	right: 0.65rem;
	width: 1.15rem;
	height: 1.15rem;
	border-radius: 50%;
	background: var(--apedoc-dark);
	opacity: 1;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10' fill='none'%3E%3Cpath stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 5l3.5 3.5L11 1'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 60% auto;
}

.ape-cfg__choice-card-text {
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1.4;
	padding-right: 1.5rem;
}

.ape-cfg__choice-card-note {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--ape-cfg-accent);
}

.ape-cfg__choice-card-price {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ape-cfg-muted);
}

.ape-cfg__choice-card-sub {
	display: block;
	margin-top: 0.45rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--ape-cfg-accent);
	line-height: 1.35;
}

.ape-cfg__choice-grid--copie .ape-cfg__choice-card-addon {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.75rem;
	font-weight: 600;
	color: #141414 !important;
	line-height: 1.35;
}

.ape-cfg__choice-card--superficie-quote {
	grid-column: 1 / -1;
	border-style: dashed;
	border-color: rgba(139, 121, 88, 0.45);
	background: linear-gradient(135deg, rgba(186, 162, 76, 0.07) 0%, rgba(248, 247, 243, 0.6) 100%);
}

@media (min-width: 480px) {
	.ape-cfg__choice-grid--superficie .ape-cfg__choice-card--superficie-quote {
		grid-column: 1 / -1;
	}
}

.ape-cfg__choice-card--superficie-quote.is-selected {
	border-style: solid;
}

.ape-cfg__choice-grid--doc-catastale {
	grid-template-columns: 1fr;
}

@media (min-width: 560px) {
	.ape-cfg__choice-grid--doc-catastale {
		grid-template-columns: repeat(2, 1fr);
	}
}

.ape-cfg__step-panel {
	margin-bottom: clamp(1.25rem, 3vw, 1.75rem);
	padding: clamp(1rem, 2.5vw, 1.25rem) clamp(1rem, 2.5vw, 1.35rem);
	background: var(--ape-cfg-surface);
	border: 1px solid var(--apedoc-shadow);
	border-radius: var(--ape-cfg-radius-sm);
	box-shadow: var(--ape-cfg-shadow-sm);
}

.ape-cfg__step-panel:last-of-type {
	margin-bottom: 0;
}

.ape-cfg__step-panel-title {
	margin: 0 0 0.85rem;
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--ape-cfg-text);
	letter-spacing: 0.02em;
}

.ape-cfg__fieldset-plain--flush {
	margin: 0;
	padding: 0;
	border: 0;
}

.ape-cfg__green-grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: 1fr;
}

@media (min-width: 560px) {
	.ape-cfg__green-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

.ape-cfg__green-grid .ape-cfg__choice-card[data-ape-green-exclusive] {
	grid-column: 1 / -1;
}

/* ---------- Campi form standard ---------- */
.ape-cfg__fieldset-plain {
	border: none;
	margin: 0 0 1.5rem;
	padding: 0;
}

.ape-cfg__legend {
	font-weight: 700;
	font-size: 0.9rem;
	margin-bottom: 0.65rem;
	padding: 0;
}

.ape-cfg__field {
	margin-bottom: 1.15rem;
}

@media (min-width: 480px) {
	.ape-cfg__field--inline {
		display: inline-block;
		width: calc(50% - 0.5rem);
		margin-right: 1rem;
		vertical-align: top;
	}
	.ape-cfg__field--inline:last-of-type {
		margin-right: 0;
	}
}

.ape-cfg__label {
	display: block;
	font-weight: 600;
	font-size: 0.875rem;
	margin-bottom: 0.4rem;
}

.ape-cfg__hint {
	font-size: 0.875rem;
	color: var(--ape-cfg-muted);
	margin: 0 0 1rem;
}

.ape-cfg__hint--muted {
	color: var(--ape-cfg-accent);
	font-weight: 500;
}

.ape-cfg__hint--region {
	color: var(--ape-cfg-accent);
	font-weight: 600;
	margin-bottom: 0.65rem;
}

.ape-cfg__link-btn {
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ape-cfg-accent);
	text-decoration: underline;
	cursor: pointer;
}

.ape-cfg__link-btn:hover {
	color: var(--ape-cfg-text);
}

.ape-cfg__input,
.ape-cfg__select,
.ape-cfg__textarea {
	width: 100%;
	min-height: 3rem;
	padding: 0.85rem 1.05rem;
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius-sm);
	font: inherit;
	font-size: 1rem;
	background: var(--apedoc-cream);
	transition:
		border-color 0.18s ease,
		box-shadow 0.18s ease,
		background 0.18s ease;
}

.ape-cfg__input::placeholder,
.ape-cfg__textarea::placeholder {
	color: rgba(21, 21, 21, 0.38);
}

.ape-cfg__input:hover:not(:disabled),
.ape-cfg__select:hover:not(:disabled),
.ape-cfg__textarea:hover:not(:disabled) {
	border-color: rgba(139, 121, 88, 0.35);
	background: var(--ape-cfg-surface);
}

.ape-cfg__input:focus,
.ape-cfg__select:focus,
.ape-cfg__textarea:focus {
	outline: none;
}

.ape-cfg__input:focus-visible,
.ape-cfg__select:focus-visible,
.ape-cfg__textarea:focus-visible {
	border-color: var(--ape-cfg-accent);
	box-shadow: var(--ape-cfg-focus);
	background: var(--ape-cfg-surface);
}

.ape-cfg__textarea {
	resize: vertical;
	min-height: 110px;
}

.ape-cfg__file {
	padding: 0.5rem 0;
	border: none;
	background: transparent;
}

.ape-cfg__field--comune {
	position: relative;
}

.ape-cfg__autocomplete {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 20;
	margin: 0.25rem 0 0;
	padding: 0.35rem 0;
	list-style: none;
	background: var(--ape-cfg-surface);
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius-sm);
	box-shadow: var(--ape-cfg-shadow);
	max-height: 220px;
	overflow-y: auto;
}

.ape-cfg__autocomplete[hidden] {
	display: none !important;
}

.ape-cfg__autocomplete-item {
	padding: 0.55rem 1rem;
	cursor: pointer;
	font-size: 0.9rem;
	transition: background 0.12s;
}

.ape-cfg__autocomplete-item:hover,
.ape-cfg__autocomplete-item.is-highlighted {
	background: var(--ape-cfg-accent-soft);
}

.ape-cfg__autocomplete-item:focus {
	outline: none;
}

.ape-cfg__autocomplete-item:focus-visible {
	box-shadow: inset 0 0 0 2px var(--ape-cfg-accent);
	background: var(--ape-cfg-accent-soft);
}

.ape-cfg__callout {
	padding: 1rem 1.15rem;
	border-radius: var(--ape-cfg-radius-sm);
	font-size: 0.9rem;
	line-height: 1.5;
	margin-top: 1rem;
}

.ape-cfg__callout--info {
	background: var(--apedoc-cream-deep);
	border: 1px solid rgba(139, 121, 88, 0.28);
	color: var(--apedoc-ink);
}

/* ---------- Footer navigazione ---------- */
.ape-cfg__footer-nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 0.85rem 1rem;
	margin-top: clamp(1rem, 3vw, 1.65rem);
	padding-top: 1.15rem;
	border-top: 1px solid var(--apedoc-shadow);
}

.ape-cfg__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	min-width: 7.5rem;
	padding: 0 1.35rem;
	border-radius: var(--ape-cfg-radius-sm);
	font: inherit;
	font-weight: 600;
	font-size: 0.9375rem;
	letter-spacing: 0.01em;
	cursor: pointer;
	border: var(--ape-cfg-border);
	transition:
		background 0.2s ease,
		border-color 0.2s ease,
		box-shadow 0.2s ease,
		opacity 0.2s ease,
		transform 0.15s ease;
}

.ape-cfg__btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.ape-cfg__btn:focus {
	outline: none;
}

.ape-cfg__btn:focus-visible {
	box-shadow: var(--ape-cfg-focus);
}

.ape-cfg__btn--primary {
	background: var(--ape-cfg-btn-primary-bg);
	border-color: transparent;
	color: var(--ape-cfg-btn-primary-fg);
	box-shadow: 0 1px 2px var(--apedoc-shadow);
}

.ape-cfg__btn--primary:hover:not(:disabled) {
	background: var(--ape-cfg-btn-primary-hover);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	transform: translateY(-1px);
}

.ape-cfg__btn--primary:active:not(:disabled) {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.ape-cfg__btn--primary.is-busy {
	color: transparent;
	pointer-events: none;
	position: relative;
}

.ape-cfg__btn--primary.is-busy::after {
	content: "";
	position: absolute;
	width: 1.2rem;
	height: 1.2rem;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ape-cfg-spin 0.65s linear infinite;
}

.ape-cfg__btn--ghost {
	background: transparent;
	border-color: transparent;
	color: var(--ape-cfg-muted);
}

.ape-cfg__btn--ghost:hover:not(:disabled) {
	background: var(--apedoc-cream-deep);
	color: var(--ape-cfg-text);
}

.ape-cfg__btn--ghost:active:not(:disabled) {
	background: #e5e0d8;
}

.ape-cfg__btn--outline {
	background: var(--ape-cfg-surface);
	border: 1px solid rgba(139, 121, 88, 0.45);
	color: var(--apedoc-dark);
}

.ape-cfg__btn--outline:hover:not(:disabled) {
	background: var(--apedoc-cream-deep);
	border-color: var(--apedoc-bronze);
	color: var(--apedoc-dark);
}

.ape-cfg__btn--outline:active:not(:disabled) {
	transform: translateY(0);
}

.ape-cfg__btn.is-quote-blocked {
	opacity: 0.48;
	cursor: not-allowed;
}

.ape-cfg__actions--final {
	margin-top: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* ---------- Sidebar: contenitore ad altezza naturale; sticky sull’inner (desktop) ---------- */
.ape-cfg__summary-aside {
	position: static;
	width: 100%;
	height: auto;
	min-height: 0;
}

.ape-cfg__summary-sticky {
	display: block;
	min-height: 0;
}

@media (min-width: 1201px) {
	.ape-cfg__summary-aside {
		align-self: start;
		z-index: 2;
		overflow: visible;
	}

	.ape-cfg__summary-sticky {
		position: sticky;
		top: 1rem;
		max-height: min(880px, calc(100vh - 2rem));
		overflow-y: auto;
		overflow-x: hidden;
		overscroll-behavior: contain;
	}
}

.ape-cfg__sidebar-card.ape-cfg__summary-card,
.ape-cfg__summary-card {
	background: var(--ape-cfg-surface);
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius);
	padding: 0;
	box-shadow: var(--ape-cfg-shadow);
	overflow: hidden;
	position: relative;
	display: flex;
	flex-direction: column;
}

.ape-cfg__summary-card::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 3px;
	background: linear-gradient(180deg, var(--apedoc-gold), var(--apedoc-bronze));
	opacity: 0.9;
	pointer-events: none;
}

.ape-cfg__sidebar-media {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	max-height: 140px;
	background: linear-gradient(145deg, var(--apedoc-cream-deep) 0%, #ebe6de 100%);
	border-bottom: 1px solid var(--apedoc-shadow);
	overflow: hidden;
	flex: 0 0 auto;
}

.ape-cfg__sidebar-media-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ape-cfg__sidebar-media-placeholder {
	width: 100%;
	height: 100%;
	min-height: 100px;
	background: linear-gradient(135deg, rgba(186, 162, 76, 0.1) 0%, rgba(248, 247, 243, 0.9) 100%);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 120 80'%3E%3Cpath stroke='%238b7958' stroke-opacity='0.35' stroke-width='1.5' d='M8 72V28l20-16 24 20 20-12 32 20v32H8z'/%3E%3Ccircle cx='32' cy='22' r='6' stroke='%23baa24c' stroke-opacity='0.4' stroke-width='1.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 48% auto;
}

.ape-cfg__sidebar-title {
	font-size: 1.05rem;
	font-weight: 700;
	margin: 0;
	padding: 1.15rem 1.25rem 0.75rem;
	letter-spacing: -0.02em;
	position: relative;
	z-index: 1;
}

.ape-cfg__sidebar-section {
	padding: 0 1.25rem 1rem;
}

.ape-cfg__sidebar-section--pricing {
	padding-top: 0.35rem;
	padding-bottom: 1.2rem;
	border-top: 1px solid var(--apedoc-shadow);
	background: linear-gradient(180deg, var(--apedoc-cream) 0%, var(--apedoc-cream-deep) 100%);
}

.ape-cfg__sidebar-field {
	display: grid;
	grid-template-columns: minmax(0, 42%) 1fr;
	gap: 0.35rem 0.75rem;
	align-items: start;
	font-size: 0.8125rem;
	padding: 0.55rem 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ape-cfg__sidebar-field:last-child {
	border-bottom: none;
}

.ape-cfg__sidebar-field-label {
	font-weight: 600;
	color: var(--ape-cfg-muted);
}

.ape-cfg__sidebar-field-value {
	text-align: right;
	word-break: break-word;
	line-height: 1.35;
}

.ape-cfg__sidebar-ph {
	color: var(--ape-cfg-muted);
	font-style: italic;
	font-weight: 400;
}

.ape-cfg__sidebar-pricing-head {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--ape-cfg-muted);
	margin: 0 0 0.65rem;
}

.ape-cfg__sidebar-price-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.75rem;
	font-size: 0.875rem;
	margin-bottom: 0.4rem;
}

.ape-cfg__sidebar-price-row--extra {
	color: var(--ape-cfg-muted);
	font-size: 0.8125rem;
}

.ape-cfg__sidebar-price-row--total {
	margin-top: 0.65rem;
	padding-top: 0.65rem;
	border-top: 1px solid rgba(139, 121, 88, 0.22);
	font-weight: 700;
	font-size: 1rem;
	color: var(--apedoc-dark);
}

.ape-cfg__sidebar-price-row--custom-quote {
	margin-top: 0.75rem;
	padding-top: 0.65rem;
	border-top: 1px dashed rgba(139, 121, 88, 0.35);
	font-weight: 600;
}

.ape-cfg__sidebar-price-num--muted {
	color: var(--ape-cfg-muted);
	font-weight: 600;
}

.ape-cfg__sidebar-price-num {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ape-cfg__sidebar-price-row--total .ape-cfg__sidebar-price-num {
	color: var(--apedoc-gold);
	font-weight: 800;
}

.ape-cfg__sidebar-pricing-hint {
	font-size: 0.8125rem;
	color: var(--ape-cfg-muted);
	margin: 0;
	line-height: 1.45;
}

.ape-cfg__sidebar-cta {
	padding: 0 1.25rem 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.ape-cfg__btn--block {
	width: 100%;
}

.ape-cfg__summary-foot {
	padding: 0 1.25rem 1.15rem;
	margin: 0;
	font-size: 0.78rem;
	color: var(--ape-cfg-muted);
	border-top: 1px solid var(--apedoc-shadow);
	padding-top: 0.85rem;
}

/* Step 5 — banner preventivo (superficie > 2500 mq) */

.ape-cfg__quote-banner {
	position: relative;
	margin-bottom: 1.5rem;
	border-radius: var(--ape-cfg-radius-sm);
	overflow: hidden;
	background: var(--ape-cfg-surface);
	border: 1px solid rgba(186, 162, 76, 0.22);
	box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.ape-cfg__quote-banner__accent {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: linear-gradient(180deg, var(--apedoc-gold), var(--apedoc-bronze));
}

.ape-cfg__quote-banner__body {
	padding: 1.25rem 1.35rem 1.25rem 1.5rem;
}

.ape-cfg__quote-banner__title {
	margin: 0 0 0.5rem;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--ape-cfg-text);
}

.ape-cfg__quote-banner__text {
	margin: 0 0 1.1rem;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--ape-cfg-muted);
	max-width: 40rem;
}

.ape-cfg__quote-banner__actions {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

@media (min-width: 520px) {
	.ape-cfg__quote-banner__actions {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
	}
}

.ape-cfg__s5-pricing-wrap {
	margin-bottom: 0;
}

/* Modulo richiesta preventivo (superficie > 2.500 mq) */
.ape-cfg__quote-lead-panel {
	margin: 1.25rem 0 1.5rem;
	padding: 1.35rem 1.4rem 1.45rem;
	background: linear-gradient(165deg, rgba(186, 162, 76, 0.06) 0%, var(--apedoc-cream) 55%);
	border: 1px solid rgba(139, 121, 88, 0.22);
	border-radius: var(--ape-cfg-radius-sm);
	box-shadow: var(--ape-cfg-shadow-sm);
}

.ape-cfg__quote-lead-panel__title {
	margin: 0 0 0.45rem;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--ape-cfg-text);
}

.ape-cfg__quote-lead-panel__lead {
	margin: 0 0 1.1rem;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--ape-cfg-muted);
	max-width: 42rem;
}

.ape-cfg__recap--quote-inline {
	margin-bottom: 1rem;
}

.ape-cfg__quote-files-card {
	margin-bottom: 1.25rem;
	padding: 1rem 1.1rem;
	background: var(--ape-cfg-surface);
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius-sm);
}

.ape-cfg__quote-files-card__title {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ape-cfg-muted);
}

.ape-cfg__quote-file-line {
	margin: 0 0 0.35rem;
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--ape-cfg-text);
}

.ape-cfg__quote-file-line:last-child {
	margin-bottom: 0;
}

.ape-cfg__quote-lead-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.85rem 1rem;
	margin-bottom: 0.85rem;
}

@media (max-width: 520px) {
	.ape-cfg__quote-lead-grid {
		grid-template-columns: 1fr;
	}
}

.ape-cfg__quote-lead-grid .ape-cfg__field--span2 {
	grid-column: 1 / -1;
}

.ape-cfg__quote-lead-success {
	margin-top: 1rem;
	padding: 1rem 1.15rem;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--apedoc-ink);
	background: var(--apedoc-cream-deep);
	border: 1px solid rgba(186, 162, 76, 0.35);
	border-radius: var(--ape-cfg-radius-sm);
	border-left-width: 4px;
	border-left-color: var(--apedoc-gold);
}

.ape-cfg__quote-lead-success--hidden {
	display: none !important;
}

.ape-cfg__actions--quote-submit {
	margin-top: 0.5rem;
}

.ape-cfg__quote-post-success {
	margin: 1rem 0 0;
}

.ape-cfg__quote-post-success-card {
	max-width: 640px;
	margin: 0 auto;
	padding: 1.1rem 1.2rem;
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius-sm);
	background: var(--apedoc-cream-deep);
	box-shadow: var(--ape-cfg-shadow-sm);
}

.ape-cfg__quote-post-success-msg {
	margin: 0;
	font-size: 1rem;
	line-height: 1.5;
	font-weight: 600;
	color: var(--apedoc-ink);
}

.ape-cfg__quote-post-success-actions {
	margin-top: 1rem;
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.ape-cfg__quote-post-success-actions .ape-cfg__btn {
	min-width: 210px;
	text-align: center;
}

.ape-cfg--quote-sent [data-ape-screen="s5"] > * {
	display: none !important;
}

.ape-cfg--quote-sent [data-ape-screen="s5"] > [data-ape-quote-post-success] {
	display: block !important;
}

@media (max-width: 640px) {
	.ape-cfg__quote-post-success-actions {
		flex-direction: column;
	}
	.ape-cfg__quote-post-success-actions .ape-cfg__btn {
		width: 100%;
		min-width: 0;
	}
}

/* Blocchi prezzo nel corpo step 5 — importi solo da JS */

.ape-cfg__pricing-detail {
	margin-bottom: 1.5rem;
	padding: 1.2rem 1.3rem;
	background: linear-gradient(165deg, var(--apedoc-cream) 0%, var(--apedoc-cream-deep) 100%);
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius-sm);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.ape-cfg__pricing-title {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--ape-cfg-muted);
	margin: 0 0 0.75rem;
}

.ape-cfg__pricing-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	font-size: 0.875rem;
	margin-bottom: 0.45rem;
}

.ape-cfg__pricing-row--extra {
	color: var(--ape-cfg-muted);
}

.ape-cfg__pricing-row--total {
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	border-top: 1px solid rgba(139, 121, 88, 0.22);
	font-weight: 700;
	font-size: 1.05rem;
	color: var(--apedoc-dark);
}

.ape-cfg__pricing-placeholder {
	font-size: 0.875rem;
	color: var(--ape-cfg-muted);
	margin: 0;
	line-height: 1.45;
}

.ape-cfg__summary {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.ape-cfg__summary-row {
	display: grid;
	grid-template-columns: minmax(0, 38%) 1fr;
	gap: 0.35rem 0.65rem;
	font-size: 0.8125rem;
	padding-bottom: 0.65rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ape-cfg__summary-row:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.ape-cfg__summary-dt {
	font-weight: 600;
	color: var(--ape-cfg-muted);
	margin: 0;
}

.ape-cfg__summary-dd {
	margin: 0;
	word-break: break-word;
}

.ape-cfg__summary-preview {
	font-size: 0.9rem;
	line-height: 1.55;
}

.ape-cfg__sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Validazione campi step 2 / 4 ---------- */
.ape-cfg__req {
	color: var(--ape-cfg-accent);
	font-weight: 700;
}

.ape-cfg__field--ux-invalid .ape-cfg__input,
.ape-cfg__field--ux-invalid .ape-cfg__select,
.ape-cfg__field--ux-invalid .ape-cfg__textarea {
	border-color: #e57373;
	box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.18);
}

.ape-cfg__field--invalid .ape-cfg__input,
.ape-cfg__field--invalid .ape-cfg__select,
.ape-cfg__field--invalid .ape-cfg__textarea {
	border-color: #dc2626;
	box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2);
}

.ape-cfg__field-error {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #b91c1c;
	line-height: 1.35;
	padding-left: 0.1rem;
}

.ape-cfg__input--mono {
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* ---------- Upload drag & drop (step 3) ---------- */
.ape-cfg__upload-grid {
	display: grid;
	gap: 1.25rem;
	margin-top: 0.5rem;
}

@media (min-width: 640px) {
	.ape-cfg__upload-grid {
		grid-template-columns: 1fr 1fr;
	}
}

.ape-cfg__upload-label {
	display: block;
	font-weight: 700;
	font-size: 0.875rem;
	margin-bottom: 0.5rem;
}

.ape-cfg__dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	min-height: 8rem;
	padding: 1.35rem 1rem;
	border: 2px dashed rgba(139, 121, 88, 0.35);
	border-radius: var(--ape-cfg-radius-sm);
	background: var(--apedoc-cream);
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
	text-align: center;
}

.ape-cfg__dropzone:hover {
	border-color: rgba(186, 162, 76, 0.55);
	background: var(--apedoc-cream-deep);
}

.ape-cfg__dropzone:focus {
	outline: none;
}

.ape-cfg__dropzone:focus-visible {
	border-color: var(--ape-cfg-accent);
	background: var(--ape-cfg-accent-soft);
	box-shadow: var(--ape-cfg-focus);
}

.ape-cfg__dropzone--active {
	border-color: var(--ape-cfg-accent);
	background: var(--ape-cfg-accent-soft);
}

/* Evidenziazione UX step 1 (gruppi) */
.ape-cfg__choice-grid--ux-invalid {
	border-radius: var(--ape-cfg-radius-sm);
	padding: 0.35rem;
	box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.ape-cfg__green-grid--ux-invalid {
	border-radius: var(--ape-cfg-radius-sm);
	padding: 0.35rem;
	box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.ape-cfg__choice-row--ux-invalid {
	border-radius: var(--ape-cfg-radius-sm);
	padding: 0.35rem;
	box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.ape-cfg__doc-row--ux-invalid {
	border-radius: var(--ape-cfg-radius-sm);
	padding: 0.35rem;
	box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.ape-cfg__dropzone-text {
	font-size: 0.875rem;
	color: var(--ape-cfg-muted);
	max-width: 16rem;
	line-height: 1.45;
}

.ape-cfg__dropzone-browse {
	margin-top: 0.15rem;
	font-size: 0.85rem;
	min-height: 2.25rem;
	padding: 0 1rem;
}

.ape-cfg__dropzone-icon {
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 10px;
	background: linear-gradient(135deg, rgba(139, 121, 88, 0.15), rgba(139, 121, 88, 0.05));
	border: 1px solid rgba(139, 121, 88, 0.2);
}

.ape-cfg__dropzone-icon--stack {
	background: linear-gradient(
		135deg,
		rgba(139, 121, 88, 0.12) 0%,
		rgba(139, 121, 88, 0.12) 45%,
		rgba(139, 121, 88, 0.22) 45%,
		rgba(139, 121, 88, 0.08) 100%
	);
}

.ape-cfg__file-list {
	list-style: none;
	margin: 0.65rem 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.ape-cfg__file-chip {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	padding: 0.45rem 0.65rem;
	border-radius: var(--ape-cfg-radius-sm);
	background: var(--apedoc-cream-deep);
	border: var(--ape-cfg-border);
	font-size: 0.8125rem;
}

.ape-cfg__file-thumb-wrap {
	flex-shrink: 0;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 6px;
	overflow: hidden;
	background: rgba(139, 121, 88, 0.15);
}

.ape-cfg__file-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ape-cfg__file-chip-name {
	flex: 1;
	min-width: 0;
	word-break: break-word;
}

.ape-cfg__file-chip-remove {
	flex-shrink: 0;
	width: 1.75rem;
	height: 1.75rem;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--ape-cfg-muted);
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.ape-cfg__file-chip-remove:hover {
	background: #fee2e2;
	color: #b91c1c;
}

.ape-cfg__upload-msg {
	margin-top: 1rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: #b91c1c;
}

.ape-cfg__upload-msg[hidden] {
	display: none !important;
}

/* ---------- Riepilogo step 5 ---------- */
.ape-cfg__recap {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin: 1.25rem 0 1.5rem;
}

.ape-cfg__recap-block {
	padding: 1rem 1.15rem;
	border: var(--ape-cfg-border);
	border-radius: var(--ape-cfg-radius-sm);
	background: var(--ape-cfg-surface);
	box-shadow: var(--ape-cfg-shadow-sm);
	transition:
		box-shadow 0.2s ease,
		border-color 0.2s ease;
}

@media (hover: hover) {
	.ape-cfg__recap-block:hover {
		border-color: rgba(139, 121, 88, 0.28);
		box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
	}
}

.ape-cfg__recap-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.45rem 0.65rem;
	margin-bottom: 0.65rem;
}

.ape-cfg__recap-title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	flex: 1 1 12rem;
	min-width: 0;
}

.ape-cfg__recap-status {
	flex-shrink: 0;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
	line-height: 1.2;
}

.ape-cfg__recap-status--ok {
	color: var(--ape-cfg-accent);
	background: var(--ape-cfg-accent-soft);
}

.ape-cfg__recap-status--incomplete {
	color: #9a3412;
	background: rgba(254, 215, 170, 0.55);
	border: 1px solid rgba(234, 88, 12, 0.25);
}

.ape-cfg__recap-block--incomplete {
	border-color: rgba(234, 88, 12, 0.35);
	background: rgba(255, 251, 245, 0.95);
}

.ape-cfg__recap-edit {
	flex-shrink: 0;
	min-height: 2.25rem;
	padding: 0 0.75rem;
	font-size: 0.8125rem;
	margin-left: auto;
}

.ape-cfg__recap-dl {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.ape-cfg__recap-row {
	display: grid;
	grid-template-columns: minmax(0, 38%) 1fr;
	gap: 0.25rem 0.65rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	font-size: 0.8125rem;
}

.ape-cfg__recap-row:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.ape-cfg__recap-dt {
	margin: 0;
	font-weight: 600;
	color: var(--ape-cfg-muted);
}

.ape-cfg__recap-dd {
	margin: 0;
	word-break: break-word;
	line-height: 1.4;
}

.ape-cfg__recap-meta {
	color: var(--ape-cfg-muted);
	font-weight: 500;
	font-size: 0.78rem;
}

/* Privacy / termini */
.ape-cfg__legal-block {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	margin: 0 0 1.25rem;
	padding: 1rem 1.15rem;
	border-radius: var(--ape-cfg-radius-sm);
	background: var(--apedoc-cream);
	border: var(--ape-cfg-border);
}

.ape-cfg__check {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	cursor: pointer;
	font-size: 0.875rem;
	line-height: 1.5;
	padding: 0.35rem 0;
	border-radius: 8px;
	transition: background 0.15s ease;
}

.ape-cfg__check:hover {
	background: rgba(186, 162, 76, 0.06);
}

.ape-cfg__check input {
	margin-top: 0.2rem;
	width: 1.2rem;
	height: 1.2rem;
	min-width: 1.2rem;
	min-height: 1.2rem;
	accent-color: var(--apedoc-gold);
	flex-shrink: 0;
	border-radius: 4px;
}

.ape-cfg__check-text {
	color: var(--ape-cfg-text);
}

/* ---------- Caricamento comuni (dati JSON) ---------- */
.ape-cfg[data-ape-comuni="loading"] .ape-cfg__field--comune .ape-cfg__input {
	pointer-events: none;
	color: transparent;
	caret-color: transparent;
	border-color: rgba(139, 121, 88, 0.2);
	background: linear-gradient(
		110deg,
		#ebe6de 0%,
		var(--apedoc-cream) 35%,
		#ffffff 50%,
		var(--apedoc-cream) 65%,
		#ebe6de 100%
	);
	background-size: 220% 100%;
	animation: ape-cfg-shimmer 1.15s ease-in-out infinite;
}

/* ---------- Scheletro riquadri (estensioni future) ---------- */
.ape-cfg__skeleton {
	border-radius: var(--ape-cfg-radius-sm);
	background: linear-gradient(
		110deg,
		var(--apedoc-cream-deep) 0%,
		#e5e0d8 40%,
		var(--apedoc-cream) 55%,
		#e5e0d8 70%,
		var(--apedoc-cream-deep) 100%
	);
	background-size: 220% 100%;
	animation: ape-cfg-shimmer 1.2s ease-in-out infinite;
	min-height: 0.75rem;
}

/* ---------- Layout responsive (solo struttura / spazi — no colori) ----------
   Breakpoint: desktop >1200px | tablet 768–1200px | mobile ≤767px | small ≤480px
----------------------------------------------------------------------------- */

@media (max-width: 1200px) {
	.ape-cfg.ape-cfg--root {
		width: 90vw;
		max-width: none;
		overflow-x: clip;
	}

	.ape-cfg__shell {
		gap: 1rem;
	}

	.ape-cfg__summary-aside {
		width: 100%;
		max-width: 100%;
	}

	.ape-cfg__sidebar-card.ape-cfg__summary-card {
		max-width: 100%;
	}
}

@media (min-width: 768px) and (max-width: 1200px) {
	.ape-cfg__shell {
		gap: 1.25rem;
	}

	.ape-cfg__card-wrap {
		padding: 1.25rem 1.15rem 1.15rem;
	}
}

@media (min-width: 992px) and (max-width: 1199px) {
	.ape-cfg__shell {
		grid-template-columns: minmax(0, 1fr);
	}
	.ape-cfg__sidenav,
	.ape-cfg__card-wrap,
	.ape-cfg__summary-aside {
		width: 100%;
		max-width: 100%;
	}
}

@media (min-width: 768px) and (max-width: 991px) {
	.ape-cfg__card-wrap {
		padding: 1.1rem 1rem 1rem;
	}
	.ape-cfg__sidenav {
		padding: 0.65rem 0.7rem;
	}
}

@media (max-width: 767px) {
	.ape-cfg.ape-cfg--root {
		width: calc(100% - 24px);
		max-width: none;
		padding: 12px 12px 20px;
		border-radius: 12px;
	}

	.ape-cfg__top {
		margin-bottom: 12px;
		text-align: left;
		max-width: none;
		margin-left: 0;
		margin-right: 0;
	}

	.ape-cfg__title {
		margin-bottom: 12px;
	}

	/* Progress: scroll orizzontale controllato, niente compressione eccessiva */
	.ape-cfg__progress {
		overflow-x: auto;
		overflow-y: hidden;
		padding: 6px 0 10px;
		margin-left: 0;
		margin-right: 0;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		-ms-overflow-style: none;
		scroll-snap-type: x proximity;
	}
	.ape-cfg__progress::-webkit-scrollbar {
		height: 0;
		display: none;
	}
	.ape-cfg__progress::before,
	.ape-cfg__progress::after {
		content: "";
		position: sticky;
		top: 0;
		width: 14px;
		height: 100%;
		pointer-events: none;
		z-index: 2;
	}
	.ape-cfg__progress::before {
		left: 0;
		float: left;
		background: linear-gradient(90deg, var(--ape-cfg-bg-page) 15%, rgba(248, 247, 243, 0));
	}
	.ape-cfg__progress::after {
		right: 0;
		float: right;
		background: linear-gradient(270deg, var(--ape-cfg-bg-page) 15%, rgba(248, 247, 243, 0));
	}

	.ape-cfg__progress-list {
		justify-content: flex-start;
		max-width: none;
		width: fit-content;
		min-width: 0;
		padding: 0 10px 4px;
		gap: 0;
	}

	.ape-cfg__progress-item {
		flex: 0 0 auto;
		min-width: 4.65rem;
		scroll-snap-align: start;
	}

	.ape-cfg__progress-dot {
		width: 2.35rem;
		height: 2.35rem;
		font-size: 0.8125rem;
	}

	.ape-cfg__progress-dot-wrap {
		justify-content: center;
	}

	.ape-cfg__progress-line {
		margin: 0 -0.2rem;
		min-width: 18px;
	}

	.ape-cfg__progress-caption {
		font-size: 0.6875rem;
		max-width: 5.9rem;
		margin-top: 6px;
		line-height: 1.3;
		padding: 0 0.18rem;
		text-wrap: balance;
	}

	.ape-cfg__sidenav {
		padding: 10px 10px;
		overflow-x: visible;
	}

	.ape-cfg__nav-link {
		min-height: 48px;
		padding: 10px 12px;
		display: inline-flex;
		align-items: center;
	}

	.ape-cfg__card-wrap {
		padding: 16px 14px 14px;
	}

	.ape-cfg__validation {
		margin-bottom: 12px;
		padding: 12px;
	}

	.ape-cfg__choice-grid--motivo,
	.ape-cfg__choice-grid--superficie {
		grid-template-columns: 1fr;
	}

	.ape-cfg__choice-card {
		width: 100%;
		min-height: 48px;
		padding: 14px 14px;
	}

	.ape-cfg__footer-nav {
		margin-top: 12px;
		padding-top: 10px;
		gap: 10px;
		flex-direction: column;
		align-items: stretch;
	}

	.ape-cfg__footer-nav .ape-cfg__btn {
		width: 100%;
		max-width: 100%;
		min-width: 0;
		min-height: 48px;
		justify-content: center;
	}

	.ape-cfg__actions--final {
		margin-top: 12px;
		gap: 10px;
	}

	.ape-cfg__actions--final .ape-cfg__btn {
		min-height: 48px;
		width: 100%;
	}

	/* Riepilogo sidebar come blocco compatto sotto */
	.ape-cfg__sidebar-title {
		padding: 12px 14px 8px;
		font-size: 1rem;
	}

	.ape-cfg__sidebar-section {
		padding: 0 14px 10px;
	}

	.ape-cfg__sidebar-section--pricing {
		padding-top: 6px;
		padding-bottom: 10px;
	}

	.ape-cfg__sidebar-field {
		padding: 8px 0;
		font-size: 0.8125rem;
		gap: 6px 10px;
	}

	.ape-cfg__sidebar-cta,
	.ape-cfg__summary-foot {
		padding: 0 14px 12px;
	}

	.ape-cfg__sidebar-media {
		max-height: 100px;
	}

	.ape-cfg__sidebar-media-placeholder {
		min-height: 72px;
	}

	.ape-cfg__recap {
		margin: 12px 0 16px;
		gap: 10px;
	}

	.ape-cfg__recap-block {
		padding: 12px 12px;
	}

	.ape-cfg__recap-row {
		padding: 8px 0;
		font-size: 0.8125rem;
	}

	.ape-cfg__legal-block {
		margin-bottom: 12px;
		padding: 12px;
		gap: 10px;
	}

	.ape-cfg__quote-lead-panel {
		margin: 12px 0 16px;
		padding: 14px 12px 14px;
	}

	.ape-cfg__quote-files-card {
		padding: 10px 10px;
		margin-bottom: 12px;
	}

	.ape-cfg__pricing-detail {
		margin-bottom: 12px;
		padding: 12px;
	}

	.ape-cfg__dropzone {
		min-height: 7.5rem;
		padding: 16px 12px;
	}

	.ape-cfg__textarea {
		min-height: 100px;
	}

	.ape-cfg__step-panel {
		margin-bottom: 16px;
		padding: 12px 12px;
	}

	.ape-cfg__screen-title {
		margin-bottom: 8px;
	}

	.ape-cfg__btn {
		min-height: 48px;
	}

	.ape-cfg__shell {
		gap: 12px;
	}

	.ape-cfg__summary-aside {
		position: static;
		top: auto;
		max-height: none;
		overflow-y: visible;
	}

	.ape-cfg__summary-sticky {
		position: static;
		max-height: none;
		overflow: visible;
	}

	.ape-cfg__nav-tree {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
		width: 100%;
		min-width: 0;
	}

	.ape-cfg__nav-block {
		margin-bottom: 0;
		flex: 0 0 auto;
		width: 100%;
	}

	/* 1. Calcola il prezzo — titolo compatto + pill scrollabili */
	.ape-cfg__nav-block--macro1 .ape-cfg__nav-block-title {
		display: block;
		font-size: 0.65rem;
		margin: 0 0 6px;
		padding-left: 2px;
		line-height: 1.2;
	}

	.ape-cfg__nav-block--macro1 .ape-cfg__nav-sub {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		gap: 8px;
		overflow-x: auto;
		overflow-y: hidden;
		padding: 2px 10px 10px;
		margin: 0 -10px;
		width: 100%;
		min-width: 0;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		-ms-overflow-style: none;
		scroll-snap-type: x proximity;
	}

	.ape-cfg__nav-block--macro1 .ape-cfg__nav-sub::-webkit-scrollbar {
		height: 0;
		display: none;
	}

	.ape-cfg__nav-block--macro1 .ape-cfg__nav-sub > li {
		flex: 0 0 auto;
		list-style: none;
		scroll-snap-align: start;
	}

	.ape-cfg__nav-block--macro1 .ape-cfg__nav-link {
		width: auto;
		white-space: nowrap;
		margin-bottom: 0;
		border-radius: 999px;
		padding: 10px 13px;
		min-height: 44px;
		min-width: 128px;
		border: 1px solid rgba(139, 121, 88, 0.28);
		box-sizing: border-box;
		background: var(--ape-cfg-surface);
		font-size: 0.8125rem;
		line-height: 1.2;
		justify-content: center;
		text-align: center;
	}

	.ape-cfg__nav-block--macro1 .ape-cfg__nav-link.is-active {
		border-color: transparent;
	}

	.ape-cfg__nav-block--macro1 .ape-cfg__nav-link.is-complete:not(.is-active) {
		border-color: rgba(139, 121, 88, 0.2);
	}

	/* Step 2–5: barra orizzontale scrollabile */
	.ape-cfg__nav-rail-scroll {
		flex-direction: row;
		flex-wrap: nowrap;
		gap: 8px;
		overflow-x: auto;
		overflow-y: hidden;
		padding: 2px 10px 10px;
		margin: 0 -10px;
		width: 100%;
		min-width: 0;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		-ms-overflow-style: none;
		scroll-snap-type: x proximity;
	}

	.ape-cfg__nav-rail-scroll::-webkit-scrollbar {
		height: 0;
		display: none;
	}

	.ape-cfg__nav-rail .ape-cfg__nav-link--single {
		flex: 0 0 auto;
		width: auto;
		min-width: 138px;
		white-space: nowrap;
		border-radius: 999px;
		border: 1px solid rgba(139, 121, 88, 0.28);
		box-sizing: border-box;
		background: var(--ape-cfg-surface);
		font-size: 0.8125rem;
		justify-content: center;
		text-align: center;
		scroll-snap-align: start;
	}

	.ape-cfg__nav-rail .ape-cfg__nav-link--single.is-active {
		border-color: transparent;
	}

	.ape-cfg__screen-lead {
		margin-bottom: 14px;
	}

	/* Summary card: evita sovrapposizione immagine decorativa e titolo */
	.ape-cfg__sidebar-media {
		max-height: 76px;
		min-height: 64px;
		position: relative;
		z-index: 0;
	}
	.ape-cfg__sidebar-media-img,
	.ape-cfg__sidebar-media-placeholder {
		position: static;
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
	.ape-cfg__sidebar-media-placeholder {
		background-size: 36% auto;
		min-height: 64px;
	}
}

@media (max-width: 480px) {
	.ape-cfg__shell {
		gap: 8px;
	}

	.ape-cfg__progress-dot {
		width: 2.2rem;
		height: 2.2rem;
		font-size: 0.75rem;
	}

	.ape-cfg__choice-grid--copie {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.ape-cfg__nav-link {
		font-size: 0.8125rem;
		padding: 8px 10px;
	}

	.ape-cfg__nav-block--macro1 .ape-cfg__nav-link,
	.ape-cfg__nav-rail .ape-cfg__nav-link--single {
		padding: 9px 12px;
		min-height: 46px;
		font-size: 0.78rem;
		min-width: 122px;
	}

	.ape-cfg__sidebar-media {
		display: none;
	}
}

@media (max-width: 480px) and (min-width: 400px) {
	.ape-cfg__choice-grid--copie {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------- Hover solo su puntatori fini (meno “app”, meglio mobile) ---------- */
@media (hover: none) {
	.ape-cfg__choice-card:hover {
		transform: none;
		box-shadow: var(--ape-cfg-shadow-sm);
	}

	.ape-cfg__choice-card.is-selected {
		transform: none;
	}

	.ape-cfg__btn--primary:hover:not(:disabled) {
		transform: none;
	}
}

/* ---------- Accessibilità: riduzione movimento ---------- */
@media (prefers-reduced-motion: reduce) {
	.ape-cfg__screen:not([hidden]) {
		animation: none;
	}

	.ape-cfg__choice-card,
	.ape-cfg__btn--primary,
	.ape-cfg__progress-dot {
		transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
	}

	.ape-cfg__choice-card:hover,
	.ape-cfg__choice-card.is-selected,
	.ape-cfg__btn--primary:hover:not(:disabled) {
		transform: none;
	}

	.ape-cfg__progress-dot.is-active {
		animation: none;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
	}

	.ape-cfg__btn--primary.is-busy::after {
		animation: none;
		border-color: rgba(255, 255, 255, 0.25);
		border-top-color: #fff;
		opacity: 0.9;
	}

	.ape-cfg[data-ape-comuni="loading"] .ape-cfg__field--comune .ape-cfg__input,
	.ape-cfg__skeleton {
		animation: none;
		background: #e5e0d8;
	}
}
