/* Align the requested-week label with its input on tablet and desktop. */
@media (min-width: 768px) {
	body.woocommerce-checkout #wunschtermin_kalenderwoche_field > label {
		box-sizing: border-box !important;
		margin-bottom: 0 !important;
		padding: 12px 24px 0 0 !important;
	}
}

/* Phone checkout: align the visible previous/current steps on one baseline. */
@media (max-width: 767px) {
	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top {
		align-items: stretch !important;
		display: flex !important;
		flex-direction: column !important;
		gap: 0 !important;
		margin: 22px 0 30px !important;
		width: 100% !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top::before {
		content: none !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top > li.thwmsc-tab {
		margin: 0 !important;
		width: 100% !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top li.thwmsc-tab > a {
		display: block !important;
		line-height: normal !important;
		margin: 0 !important;
		min-height: 0 !important;
		padding: 0 !important;
		width: 100% !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top li.thwmsc-tab > a .thwmsc-tab-label {
		align-items: baseline !important;
		display: grid !important;
		font-size: 32px !important;
		gap: 0 14px !important;
		grid-template-columns: 32px minmax(0, 1fr) !important;
		letter-spacing: 0 !important;
		line-height: 1.15 !important;
		margin: 0 !important;
		padding: 8px 0 !important;
		text-align: left !important;
		text-transform: none !important;
		width: 100% !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top li.thwmsc-tab > a .thwmsc-index,
	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top li.thwmsc-tab > a.active .thwmsc-index {
		display: block !important;
		font-size: 32px !important;
		height: auto !important;
		line-height: 1.15 !important;
		margin: 0 !important;
		padding: 0 !important;
		text-align: center !important;
		width: 32px !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs.thwmsc-tabs-mobile-top .thwmsc-tab-label .dashicons {
		display: none !important;
	}

	/* Keep the requested-week label, input and following building section distinct. */
	body.woocommerce-checkout #wunschtermin_kalenderwoche_field {
		align-items: stretch !important;
		clear: both !important;
		display: flex !important;
		flex-direction: column !important;
		float: none !important;
		gap: 12px !important;
		margin: 24px 0 26px !important;
		width: 100% !important;
	}

	body.woocommerce-checkout #wunschtermin_kalenderwoche_field > label,
	body.woocommerce-checkout #wunschtermin_kalenderwoche_field > .woocommerce-input-wrapper {
		display: block !important;
		margin: 0 !important;
		width: 100% !important;
	}

	body.woocommerce-checkout #wunschtermin_kalenderwoche_field #wunschtermin_kalenderwoche {
		box-sizing: border-box !important;
		margin: 0 !important;
		max-width: none !important;
		width: 100% !important;
	}

	body.woocommerce-checkout #gebaeudetyp_field {
		margin-top: 0 !important;
	}

	/* Keep postcode and city fields separated in every checkout address group. */
	body.woocommerce-checkout #billing_postcode_field,
	body.woocommerce-checkout #brief_plz_field,
	body.woocommerce-checkout #plz_field {
		box-sizing: border-box !important;
		clear: none !important;
		margin-right: 0 !important;
		padding-right: 8px !important;
		width: 36% !important;
	}

	body.woocommerce-checkout #billing_city_field,
	body.woocommerce-checkout #brief_ort_field,
	body.woocommerce-checkout #ort_field {
		box-sizing: border-box !important;
		clear: none !important;
		margin-right: 0 !important;
		padding-left: 8px !important;
		width: 64% !important;
	}
}

/* Final checkout actions: keep Back and Place order on one stable row. */
body.woocommerce-checkout #thwmsc_wrapper .thwmsc-buttons.zad-final-actions-source {
	display: none !important;
}

body.woocommerce-checkout .zad-final-checkout-actions {
	align-items: stretch !important;
	display: grid !important;
	gap: 32px !important;
	grid-template-columns: repeat(2, minmax(0, 400px)) !important;
	justify-content: space-between !important;
	margin-bottom: 70px !important;
	width: 100% !important;
}

body.woocommerce-checkout .zad-final-checkout-actions .woocommerce-terms-and-conditions-wrapper {
	grid-column: 1 / -1 !important;
	width: 100% !important;
}

body.woocommerce-checkout .zad-final-checkout-actions .zad-final-back-button,
body.woocommerce-checkout .zad-final-checkout-actions #place_order {
	align-self: stretch !important;
	height: 100% !important;
	margin: 0 !important;
	max-width: 400px !important;
	min-height: 42px !important;
	width: 100% !important;
}

body.woocommerce-checkout .zad-final-checkout-actions .zad-final-back-button {
	background: #fff !important;
	border: 2px solid #31afd7 !important;
	border-radius: 20px !important;
	color: #31afd7 !important;
	font-family: "fs_untitled-medium" !important;
	font-size: 20px !important;
	font-weight: 400 !important;
	grid-column: 1 !important;
	justify-self: start !important;
	line-height: 30px !important;
	padding: 6px 20px 2px !important;
	text-transform: capitalize !important;
}

body.woocommerce-checkout .zad-final-checkout-actions .zad-final-back-button:hover,
body.woocommerce-checkout .zad-final-checkout-actions .zad-final-back-button:focus-visible {
	background: #31afd7 !important;
	color: #fff !important;
}

body.woocommerce-checkout .zad-final-checkout-actions #place_order {
	float: none !important;
	grid-column: 2 !important;
	justify-self: end !important;
}

@media (max-width: 767px) {
	body.woocommerce-checkout .zad-final-checkout-actions {
		gap: 12px !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		margin-bottom: 40px !important;
	}

	body.woocommerce-checkout .zad-final-checkout-actions .zad-final-back-button,
	body.woocommerce-checkout .zad-final-checkout-actions #place_order {
		font-size: 14px !important;
		line-height: 18px !important;
		max-width: none !important;
		min-height: 48px !important;
		padding: 6px 8px 4px !important;
		white-space: normal !important;
	}
}

/* Tablet checkout: keep all five steps visible in a compact, stable row. */
@media (min-width: 768px) and (max-width: 991px) {
	body #thwmsc_wrapper #thwmsc-tabs {
		align-items: start !important;
		display: grid !important;
		gap: 12px !important;
		grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
		justify-content: initial !important;
		margin: 24px 0 34px !important;
		position: relative !important;
		width: 100% !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs::before {
		content: '' !important;
		height: 1px !important;
		left: 10% !important;
		position: absolute !important;
		top: 18px !important;
		transform: none !important;
		width: 80% !important;
		z-index: 0 !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs > li.thwmsc-tab,
	body #thwmsc_wrapper #thwmsc-tabs > li.thwmsc-tab.zad-mobile-step-future-source {
		display: block !important;
		margin: 0 !important;
		min-width: 0 !important;
		width: auto !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs li.thwmsc-tab > a {
		display: block !important;
		min-height: 72px !important;
		min-width: 0 !important;
		padding: 0 !important;
		position: relative !important;
		text-align: center !important;
		width: 100% !important;
		z-index: 1 !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs li.thwmsc-tab > a .thwmsc-tab-label {
		align-items: center !important;
		display: flex !important;
		flex-direction: column !important;
		font-size: 14px !important;
		gap: 8px !important;
		justify-content: flex-start !important;
		letter-spacing: 0 !important;
		line-height: 18px !important;
		min-width: 0 !important;
		padding: 0 !important;
		text-align: center !important;
		text-transform: none !important;
		white-space: normal !important;
		width: 100% !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs li.thwmsc-tab > a .thwmsc-index {
		align-items: center !important;
		background: #fff !important;
		color: #000 !important;
		display: flex !important;
		font-size: 22px !important;
		height: 36px !important;
		justify-content: center !important;
		line-height: 36px !important;
		margin: 0 !important;
		padding: 0 !important;
		width: 36px !important;
	}

	body #thwmsc_wrapper #thwmsc-tabs li.thwmsc-tab > a.active .thwmsc-index {
		color: #31AFD7 !important;
	}

	body .zad-mobile-future-steps {
		display: none !important;
	}
}
