/* ==========================================================================
   Mazon 1.29.0 — custom-size form & collection buy panel
   Two deliberate layers:
     · phone  — one column, sticky action bar, big inputs, everything thumb-sized
     · wide   — measurement cards in a grid + a live summary rail
   The markup is the same; the layout and the "feel" are not.
   ========================================================================== */

.mz-sf,
.mz-buy {
	--sf-ink: var(--mz-ink, #1b1712);
	--sf-soft: var(--mz-muted, #6b6157);
	--sf-line: var(--mz-line, #e4d9c8);
	--sf-gold: var(--mz-accent, #b8873f);
	--sf-paper: var(--mz-card, #fff);
	--sf-bg: var(--mz-surface, #f8f4ec);
	--sf-ok: #1a7f37;
	--sf-warn: #b45309;
	--sf-err: #b32d2e;
	--sf-radius: 18px;
	direction: rtl;
}

/* ------------------------------------------------------------------- shell */
.mz-sf {
	position: relative;
	background: var(--sf-paper);
	border: 1px solid var(--sf-line);
	border-radius: var(--sf-radius);
	padding: 18px;
	margin: 0;
	color: var(--sf-ink);
}

.mz-sf[hidden] {
	display: none !important;
}

.mz-sf__head {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	justify-content: space-between;
	flex-wrap: wrap;
}

.mz-sf__head-main {
	flex: 1 1 260px;
	min-width: 0;
}

.mz-sf__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--sf-gold);
}

.mz-sf__title {
	margin: 6px 0 4px;
	font-size: 19px;
	line-height: 1.4;
	letter-spacing: -.01em;
}

.mz-sf__intro {
	margin: 0;
	font-size: 13px;
	line-height: 1.9;
	color: var(--sf-soft);
}

/* unit toggle */
.mz-sf__unit {
	display: inline-flex;
	padding: 3px;
	background: var(--sf-bg);
	border: 1px solid var(--sf-line);
	border-radius: 999px;
	flex: 0 0 auto;
}

.mz-sf__unit button {
	appearance: none;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 11.5px;
	font-weight: 700;
	color: var(--sf-soft);
	padding: 6px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background .18s ease, color .18s ease;
}

.mz-sf__unit button.is-on {
	background: var(--sf-ink);
	color: #fff;
}

/* progress */
.mz-sf__meter {
	height: 4px;
	background: var(--sf-bg);
	border-radius: 999px;
	overflow: hidden;
	margin: 14px 0 16px;
}

.mz-sf__meter > i {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--sf-gold), #d9a85f);
	border-radius: inherit;
	transition: width .3s ease;
}

/* ------------------------------------------------------------------ layout */
.mz-sf__layout {
	display: block;
}

.mz-sf__group {
	border: 0;
	margin: 0 0 14px;
	padding: 0;
	min-width: 0;
}

.mz-sf__legend {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	font-weight: 800;
	padding: 0;
	margin-bottom: 10px;
}

.mz-sf__num {
	display: inline-grid;
	place-items: center;
	width: 22px;
	height: 22px;
	border-radius: 7px;
	background: var(--sf-ink);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
}

.mz-sf__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

/* ------------------------------------------------------------------- field */
.mz-sf__field {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	background: #fff;
	border: 1px solid var(--sf-line);
	border-radius: 14px;
	padding: 11px 12px 12px;
	transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.mz-sf__field:focus-within {
	border-color: var(--sf-gold);
	box-shadow: 0 0 0 3px rgba(184, 135, 63, .14);
}

.mz-sf__field.is-invalid {
	border-color: var(--sf-err);
	box-shadow: 0 0 0 3px rgba(179, 45, 46, .12);
}

.mz-sf__field.is-done::after {
	content: "✓";
	position: absolute;
	top: 9px;
	left: 10px;
	width: 18px;
	height: 18px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--sf-ok);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
}

.mz-sf__field-label {
	font-size: 12.5px;
	font-weight: 700;
	display: flex;
	align-items: center;
	gap: 4px;
	line-height: 1.5;
}

.mz-sf__req {
	color: var(--sf-err);
	font-size: 12px;
}

.mz-sf__control {
	position: relative;
	display: flex;
	align-items: center;
}

.mz-sf__input {
	width: 100%;
	font: inherit;
	font-size: 16px; /* iOS keeps its zoom out of this form */
	font-weight: 700;
	color: var(--sf-ink);
	background: var(--sf-bg);
	border: 1px solid transparent;
	border-radius: 11px;
	padding: 11px 12px;
	min-height: 48px;
	appearance: none;
	direction: ltr;
	text-align: right;
}

.mz-sf__input:focus {
	outline: 0;
	background: #fff;
	border-color: var(--sf-gold);
}

.mz-sf__field--textarea .mz-sf__input,
.mz-sf__input--area {
	min-height: 92px;
	line-height: 1.8;
	direction: rtl;
	text-align: right;
	font-size: 14px;
	font-weight: 500;
	resize: vertical;
}

.mz-sf__field--select .mz-sf__input {
	direction: rtl;
}

.mz-sf__suffix {
	position: absolute;
	inset-inline-start: 8px;
	font-size: 11px;
	font-weight: 700;
	color: var(--sf-soft);
	background: #fff;
	border: 1px solid var(--sf-line);
	border-radius: 7px;
	padding: 2px 7px;
	pointer-events: none;
}

.mz-sf__hint {
	font-size: 11px;
	line-height: 1.75;
	color: var(--sf-soft);
}

.mz-sf__err {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--sf-err);
}

/* plausible-range bar: a quiet visual answer to «آیا این عدد درست است؟» */
.mz-sf__fit {
	position: relative;
	height: 14px;
	margin-top: 2px;
	display: block;
}

.mz-sf__fit > i {
	position: absolute;
	inset-inline-start: 0;
	top: 5px;
	height: 4px;
	width: 0;
	background: var(--sf-gold);
	border-radius: 999px;
	transition: width .25s ease, background .25s ease;
}

.mz-sf__fit::before {
	content: "";
	position: absolute;
	top: 5px;
	height: 4px;
	inset-inline-start: 0;
	width: 100%;
	background: repeating-linear-gradient(90deg, var(--sf-line) 0 3px, transparent 3px 6px);
	border-radius: 999px;
}

.mz-sf__fit > b {
	position: absolute;
	inset-inline-end: 0;
	top: -6px;
	font-size: 9.5px;
	font-weight: 600;
	color: var(--sf-soft);
	opacity: 0;
	transition: opacity .2s ease;
}

.mz-sf__field.is-done .mz-sf__fit > b {
	opacity: 1;
}

.mz-sf__field.is-out .mz-sf__fit > i {
	background: var(--sf-warn);
}

/* radio chips */
.mz-sf__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.mz-sf__chip {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.mz-sf__chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.mz-sf__chip > span {
	display: inline-flex;
	align-items: center;
	padding: 9px 14px;
	font-size: 12.5px;
	font-weight: 700;
	border: 1px solid var(--sf-line);
	border-radius: 999px;
	background: #fff;
	transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.mz-sf__chip input:checked + span {
	background: var(--sf-ink);
	color: #fff;
	border-color: var(--sf-ink);
}

.mz-sf__check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 12.5px;
	line-height: 1.8;
	cursor: pointer;
}

.mz-sf__check input {
	width: 20px;
	height: 20px;
	margin-top: 1px;
	accent-color: var(--sf-gold);
	flex: 0 0 auto;
}

/* wide fields (notes) */
.mz-sf__field.is-wide {
	grid-column: 1 / -1;
}

/* -------------------------------------------------------------------- aside */
.mz-sf__aside {
	display: none;
}

/* --------------------------------------------------------------------- foot */
.mz-sf__foot {
	position: sticky;
	bottom: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 14px -18px -18px;
	padding: 12px 18px calc(12px + var(--mz-safe-bottom, 0px));
	background: rgba(255, 255, 255, .94);
	backdrop-filter: blur(10px);
	border-top: 1px solid var(--sf-line);
	border-radius: 0 0 var(--sf-radius) var(--sf-radius);
}

.mz-sf__foot-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.mz-sf__count {
	font-size: 12px;
	font-weight: 800;
	color: var(--sf-ink);
}

.mz-sf__count.is-complete {
	color: var(--sf-ok);
}

.mz-sf__note {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 10.5px;
	color: var(--sf-soft);
	line-height: 1.6;
}

.mz-sf__submit {
	flex: 0 0 auto;
}

.mz-sf__errors {
	margin-top: 12px;
	border-radius: 12px;
	background: #fdf2f2;
	border: 1px solid #f3c6c6;
	color: var(--sf-err);
	font-size: 12px;
	font-weight: 600;
	padding: 10px 12px;
	line-height: 1.8;
}

.mz-sf__read {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 300px;
	overflow: auto;
}

.mz-sf__read li {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	font-size: 12px;
	padding-bottom: 5px;
	border-bottom: 1px dashed var(--sf-line);
}

.mz-sf__read li b {
	font-weight: 700;
}

.mz-sf__read li em {
	font-style: normal;
	color: var(--sf-gold);
	font-weight: 800;
	direction: ltr;
}

.mz-sf__read-empty {
	color: var(--sf-soft);
	font-size: 11.5px;
	border-bottom: 0 !important;
	line-height: 1.8;
}




/* ==========================================================================
   BUY PANEL
   ========================================================================== */
.mz-buy {
	background: var(--sf-bg);
	border: 1px solid var(--sf-line);
	border-radius: 22px;
	padding: 18px;
}

.mz-buy__title {
	margin: 6px 0 4px;
	font-size: 21px;
	letter-spacing: -.01em;
}

.mz-buy__sub {
	margin: 0 0 16px;
	font-size: 13px;
	line-height: 1.9;
	color: var(--sf-soft);
}

.mz-buy__block {
	border: 0;
	padding: 0;
	margin: 0 0 16px;
}

.mz-buy__legend {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 800;
	padding: 0;
	margin-bottom: 10px;
}

.mz-buy__step {
	display: inline-grid;
	place-items: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--sf-gold);
	color: #1b1712;
	font-size: 11px;
	font-weight: 800;
}

.mz-buy__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.mz-buy__chip {
	position: relative;
	cursor: pointer;
}

.mz-buy__chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.mz-buy__chip > span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 52px;
	justify-content: center;
	padding: 11px 16px;
	min-height: 46px;
	font-size: 13px;
	font-weight: 800;
	background: var(--sf-paper);
	border: 1px solid var(--sf-line);
	border-radius: 12px;
	transition: background .16s, color .16s, border-color .16s, transform .12s;
}

.mz-buy__chip:active > span {
	transform: scale(.97);
}

.mz-buy__chip input:checked + span {
	background: var(--sf-ink);
	border-color: var(--sf-ink);
	color: #fff;
}

.mz-buy__chip--custom {
	flex: 1 1 100%;
}

.mz-buy__chip--custom > span {
	width: 100%;
	justify-content: flex-start;
	gap: 8px;
	background: #fffdf7;
	border-style: dashed;
	color: var(--sf-ink);
}

.mz-buy__chip--custom input:checked + span {
	background: var(--sf-gold);
	border-color: var(--sf-gold);
	border-style: solid;
	color: #1b1712;
}

.mz-buy__custom {
	margin: 0 0 16px;
	animation: mz-buy-in .28s ease both;
}

@keyframes mz-buy-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

.mz-buy__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	padding-top: 14px;
	border-top: 1px solid var(--sf-line);
}

.mz-buy__price {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.mz-buy__price-label {
	font-size: 10.5px;
	color: var(--sf-soft);
}

.mz-buy__price-value {
	font-size: 19px;
	font-weight: 900;
	letter-spacing: -.01em;
}

.mz-buy__save {
	font-size: 10.5px;
	font-weight: 700;
	color: var(--sf-ok);
}

.mz-buy__submit {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	justify-content: center;
	min-height: 52px;
}

.mz-buy__meta {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 12px 0 0;
	font-size: 10.5px;
	line-height: 1.7;
	color: var(--sf-soft);
}

.mz-buy__errors {
	margin-top: 12px;
	border-radius: 12px;
	background: #fdf2f2;
	border: 1px solid #f3c6c6;
	color: var(--sf-err);
	font-size: 12px;
	padding: 10px 12px;
}

/* ==========================================================================
   LAYER 2 — tablet & desktop
   ========================================================================== */
@media (min-width: 700px) {
	.mz-sf {
		padding: 26px;
	}

	.mz-sf__title {
		font-size: 23px;
	}

	.mz-sf__intro {
		font-size: 13.5px;
		max-width: 62ch;
	}

	.mz-sf__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.mz-sf__field {
		padding: 13px 14px 14px;
	}

	.mz-sf__foot {
		margin: 18px -26px -26px;
		padding: 14px 26px;
		border-radius: 0 0 var(--sf-radius) var(--sf-radius);
	}

	.mz-buy {
		padding: 26px;
	}

	.mz-buy__chip--custom {
		flex: 0 1 auto;
	}

	.mz-buy__chip--custom > span {
		width: auto;
	}

	.mz-buy__submit {
		flex: 0 0 auto;
		min-width: 260px;
	}
}

@media (min-width: 1000px) {
	.mz-sf__layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 300px;
		gap: 22px;
		align-items: start;
	}

	.mz-sf__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.mz-sf__aside {
		display: block;
		position: sticky;
		top: 96px;
	}

	.mz-sf__card {
		border: 1px solid var(--sf-line);
		border-radius: 16px;
		background: var(--sf-bg);
		padding: 14px;
	}

	.mz-sf__card-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		font-size: 12.5px;
	}

	.mz-sf__card-head b {
		font-weight: 800;
	}

	.mz-sf__clear {
		appearance: none;
		border: 0;
		background: transparent;
		font: inherit;
		font-size: 11px;
		font-weight: 700;
		color: var(--sf-gold);
		cursor: pointer;
		padding: 4px;
	}

	.mz-sf__card-foot {
		display: flex;
		align-items: baseline;
		gap: 6px;
		margin-top: 10px;
		padding-top: 10px;
		border-top: 1px solid var(--sf-line);
	}

	.mz-sf__count-label {
		font-size: 10.5px;
		color: var(--sf-soft);
	}

	.mz-sf__guide {
		margin-top: 12px;
		border: 1px solid var(--sf-line);
		border-radius: 14px;
		background: #fff;
		padding: 0 14px;
	}

	.mz-sf__guide summary {
		cursor: pointer;
		font-size: 12px;
		font-weight: 700;
		padding: 12px 0;
		list-style: none;
	}

	.mz-sf__guide summary::-webkit-details-marker {
		display: none;
	}

	.mz-sf__guide summary::before {
		content: "؟";
		display: inline-grid;
		place-items: center;
		width: 18px;
		height: 18px;
		margin-inline-end: 7px;
		border-radius: 50%;
		background: var(--sf-ink);
		color: #fff;
		font-size: 11px;
	}

	.mz-sf__guide ol {
		margin: 0 0 12px;
		padding-inline-start: 18px;
		font-size: 11.5px;
		line-height: 1.9;
		color: var(--sf-soft);
	}

	/* the desktop foot is not sticky — the rail already anchors the eye */
	.mz-sf__foot {
		position: static;
		margin: 20px -26px -26px;
		background: var(--sf-bg);
		backdrop-filter: none;
	}
}

/* ==========================================================================
   Invoice button + invoice blocks used inside the theme
   ========================================================================== */
.mz-inv-btn-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin: 14px 0;
}

.mz-inv-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}

.mz-inv-btn__no {
	font-size: 11.5px;
	color: var(--mz-muted, #6b6157);
}

@media (prefers-reduced-motion: reduce) {
	.mz-sf *,
	.mz-buy * {
		animation-duration: .001ms !important;
		transition-duration: .001ms !important;
	}
}
