/**
 * SMC shared modals V2 — `review/purchase-journey.html` §9 (Edit bag, 599-632)
 * and §12 (upsell modal, 787-837 + 842-845).
 *
 * Everything is scoped under `.smc-modal` (the prototype's `.modal`), so the
 * sheet is page-agnostic: bag, checkout, order confirmation. The two trigger
 * buttons (`.upsell-link`, `.edit-bag`) sit outside the dialog, so they are
 * scoped by the opt-in `data-smc-modal-open` attribute instead — they only
 * exist where the shared partial is used.
 *
 * V2 changes (fixed filename — the CDN ignores `?ver`, AGENTS.md §1):
 *  - Edit-bag row rebuilt as a card: thumb | copy | price, with the qty stepper
 *    and Remove/Undo on their own line. Mobile no longer crushes five things
 *    into one line; the price sits top-right, baseline-aligned with the name.
 *  - Removed state collapses the row to a slim struck-through strip with an
 *    Undo button (fade + slide out, then the height collapses).
 *  - Footer: "New subtotal" and the amount are one balanced row.
 *  - Mobile sheet: 12px side + bottom inset, 20px radius on all corners,
 *    ~88vh cap with the body scrolling inside, safe-area aware.
 *
 * Consumed by `templates/parts/smc-modal.php`
 * (smc_edit_modal(), smc_upsell_modal()).
 */

.smc-modal {
	--ink: #0a0a0a;
	--ink-2: #3d4046;
	--muted: #5f6368;
	--faint: #6b7280;
	--page: #f9f9fa;
	--line: #e7e8ea;
	--line-2: #f1f2f4;
	--green: #047857;
	--green-2: #065f46;
	--green-soft: #f2f8f4;
	--green-line: #dcebe2;
	--danger: #b42318;
	--r-sm: 8px;
	--r-lg: 16px;

	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}

.smc-modal *,
.smc-modal *::before,
.smc-modal *::after {
	box-sizing: border-box;
}

.smc-modal [hidden] {
	display: none !important;
}

/* The root is hidden with the `hidden` attribute; `display:grid` below would
   otherwise win on pages that do not wrap the dialog in `.smc-bag`. */
.smc-modal[hidden] {
	display: none !important;
}

.smc-modal h2,
.smc-modal p {
	margin: 0;
}

.smc-modal a {
	color: inherit;
}

/* ---------- dialog shell ---------- */

.smc-modal {
	position: fixed;
	inset: 0;
	z-index: 220;
	display: grid;
	place-items: center;
	padding: 24px;
}

.smc-modal .modal-scrim {
	position: absolute;
	inset: 0;
	z-index: 1;
	border: 0;
	padding: 0;
	background: transparent;
	cursor: default;
}

.smc-modal .veil {
	position: fixed;
	inset: 0;
	z-index: 0;
	background: rgba(10, 10, 10, .44);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.smc-modal .dialog {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	width: min(660px, 100%);
	max-height: 86vh;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .4);
	overflow: hidden;
	animation: smcDialogIn .22s cubic-bezier(.16, 1, .3, 1);
}

@keyframes smcDialogIn {
	from {
		opacity: 0;
		transform: translateY(8px) scale(.99);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.smc-modal .dialog-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 22px 24px 18px;
	border-bottom: 1px solid var(--line);
}

.smc-modal .dialog-head h2 {
	font-size: 20px;
	font-weight: 600;
	letter-spacing: -.02em;
}

.smc-modal .dialog-head p {
	margin-top: 4px;
	font-size: 11.5px;
	color: var(--muted);
}

.smc-modal .dialog-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 4px 24px;
	overscroll-behavior: contain;
}

.smc-modal .dialog-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
	border-top: 1px solid var(--line);
	background: #fcfcfd;
}

.smc-modal .dialog-close {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid rgba(15, 15, 17, .12);
	border-radius: 50%;
	background: #fff;
	color: var(--ink);
	display: grid;
	place-items: center;
	flex: none;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(15, 15, 17, .06);
	transition: background .18s ease, color .18s ease, border-color .18s ease, transform .24s cubic-bezier(.16, 1, .3, 1);
}

.smc-modal .dialog-close svg {
	width: 14px;
	height: 14px;
}

.smc-modal .dialog-close:hover {
	background: #111113;
	border-color: #111113;
	color: #fff;
	transform: rotate(90deg);
}

/* ---------- buttons (prototype §6) ---------- */

.smc-modal .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 46px;
	padding: 0 18px;
	border: 1px solid transparent;
	border-radius: 9px;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	letter-spacing: -.005em;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background .14s ease, color .14s ease, border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}

.smc-modal .btn-primary {
	background: var(--ink);
	color: #fff;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

.smc-modal .btn-primary:hover {
	background: #000;
	transform: translateY(-1px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 8px 20px -8px rgba(0, 0, 0, .45);
	color: #fff;
}

.smc-modal .btn-primary[disabled] {
	background: #2b2c2f;
	opacity: .45;
	cursor: default;
	transform: none;
	box-shadow: none;
}

.smc-modal .btn-primary[disabled]:hover {
	background: #2b2c2f;
	transform: none;
	box-shadow: none;
}

.smc-modal .btn-secondary {
	background: #fff;
	border-color: var(--line);
	color: var(--ink-2);
}

.smc-modal .btn-secondary:hover {
	background: var(--page);
	border-color: #cfd2d6;
	color: var(--ink);
}

/* ---------- quantity stepper (prototype §6, needed by the edit rows) ---------- */

.smc-modal .qty {
	display: inline-flex;
	align-items: center;
	height: 36px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	flex: none;
}

.smc-modal .qty button {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ink-2);
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background .12s ease, color .12s ease;
}

.smc-modal .qty button:hover {
	background: var(--line-2);
	color: var(--ink);
}

.smc-modal .qty button[disabled] {
	opacity: .35;
	cursor: default;
}

.smc-modal .qty .qty-remove {
	color: var(--faint);
}

.smc-modal .qty .qty-remove:hover {
	background: #fdf1f0;
	color: var(--danger);
}

.smc-modal .qty button svg {
	width: 12px;
	height: 12px;
}

.smc-modal .qty .qty-remove svg {
	width: 15px;
	height: 15px;
}

.smc-modal .qty output {
	min-width: 26px;
	text-align: center;
	font-size: 12.5px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* ---------- edit bag: rows ---------- */

.smc-modal .edit-rows {
	display: block;
}

/* Each row is a two-track grid: the card (1fr) and the removed strip (0fr).
   Toggling `.is-removed` swaps the tracks, so the row really shrinks — the
   list visibly changes instead of merely dimming. */
.smc-modal .edit-row {
	display: grid;
	grid-template-rows: 1fr 0fr;
	border-bottom: 1px solid var(--line-2);
	transition: grid-template-rows .2s cubic-bezier(.2, 0, 0, 1);
}

.smc-modal .edit-row:last-child {
	border-bottom: 0;
}

.smc-modal .edit-content {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr) auto;
	grid-template-areas:
		"thumb copy price"
		"thumb copy acts";
	column-gap: 16px;
	row-gap: 6px;
	align-items: start;
	min-height: 0;
	min-width: 0;
	padding: 16px 0;
	overflow: hidden;
	transition: opacity .18s ease, transform .18s ease, padding .2s cubic-bezier(.2, 0, 0, 1), visibility 0s linear 0s;
}

.smc-modal .edit-thumb {
	grid-area: thumb;
	width: 72px;
	height: 72px;
	border-radius: 10px;
	background: linear-gradient(165deg, #f7f7f8, #efeff1);
	display: grid;
	place-items: center;
	padding: 6px;
	align-self: start;
}

.smc-modal .edit-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.smc-modal .edit-copy {
	grid-area: copy;
	align-self: start;
	min-width: 0;
}

.smc-modal .edit-name {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--ink);
	line-height: 1.35;
	/* Two lines max, then ellipsis — on the phone the name shares the top line
	   with the price and must never push it out of the row. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.smc-modal .edit-var {
	margin-top: 2px;
	font-size: 11px;
	line-height: 1.35;
	color: var(--faint);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Price sits at the top-right of the row, its first line on the name's
   baseline (same grid row + `align-items:start`). */
.smc-modal .edit-price {
	grid-area: price;
	justify-self: end;
	align-self: start;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.smc-modal .edit-line {
	display: block;
	margin-top: 2px;
	font-size: 10px;
	font-weight: 450;
	color: var(--faint);
}

.smc-modal .edit-row-actions {
	grid-area: acts;
	justify-self: end;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 4px 10px;
	min-width: 0;
}

/* Neutral limit state under the quantity. No red, not a live region; the
   dialog is already a focus trap, so no toast is raised here. */
.smc-modal .edit-note {
	order: 2;
	flex: 1 0 100%;
	margin: 0;
	text-align: right;
	font-size: 10.5px;
	line-height: 1.3;
	font-weight: 500;
	color: #6b7280;
}

.smc-modal .edit-note[hidden] {
	display: none;
}

.smc-modal .edit-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	padding: 0 10px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	font-family: inherit;
	font-size: 11.5px;
	font-weight: 550;
	color: var(--faint);
	white-space: nowrap;
	cursor: pointer;
	transition: background .14s ease, color .14s ease;
}

.smc-modal .edit-remove:hover {
	background: #fdf1f0;
	color: var(--danger);
}

/* ---------- edit bag: removed state ---------- */

.smc-modal .edit-strip {
	min-height: 0;
	overflow: hidden;
	visibility: hidden;
	transition: visibility 0s linear .2s;
}

.smc-modal .edit-strip-in {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 6px 0;
	padding: 6px 8px 6px 12px;
	border-radius: 10px;
	background: #f6f7f8;
}

.smc-modal .edit-strip-name {
	min-width: 0;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--muted);
	text-decoration: line-through;
	text-decoration-thickness: 1px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.smc-modal .edit-undo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 30px;
	padding: 0 12px;
	border: 1px solid #d9dce1;
	border-radius: 8px;
	background: #fff;
	font-family: inherit;
	font-size: 11.5px;
	font-weight: 600;
	color: var(--green);
	white-space: nowrap;
	flex: none;
	cursor: pointer;
	transition: border-color .14s ease, background .14s ease, color .14s ease;
}

.smc-modal .edit-undo:hover {
	background: var(--green-soft);
	border-color: var(--green-line);
	color: var(--green-2);
}

.smc-modal .edit-row.is-removed {
	grid-template-rows: 0fr 1fr;
	/* The 50ms lead lets the fade read before the collapse starts. */
	transition: grid-template-rows .2s cubic-bezier(.2, 0, 0, 1) .05s;
}

.smc-modal .edit-row.is-removed .edit-content {
	opacity: 0;
	transform: translateY(-4px);
	/* The padding has to collapse too: a `0fr` track still keeps an item's
	   padding, which would leave a 24-32px gap above the strip. */
	padding-top: 0;
	padding-bottom: 0;
	visibility: hidden;
	transition: opacity .18s ease, transform .18s ease, padding .2s cubic-bezier(.2, 0, 0, 1), visibility 0s linear .2s;
}

.smc-modal .edit-row.is-removed .edit-strip {
	visibility: visible;
	transition-delay: 0s;
}

/* ---------- edit bag: nothing to save ---------- */

.smc-modal .edit-nothing {
	display: grid;
	justify-items: center;
	gap: 6px;
	padding: 44px 8px 40px;
	text-align: center;
}

.smc-modal .edit-nothing-title {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--ink);
}

.smc-modal .edit-nothing-note {
	max-width: 34ch;
	font-size: 12px;
	line-height: 1.5;
	color: var(--muted);
}

.smc-modal .edit-nothing .btn {
	height: 40px;
	margin-top: 12px;
	padding: 0 16px;
	font-size: 12.5px;
}

.smc-modal .edit-empty {
	padding: 40px 8px;
	text-align: center;
}

.smc-modal .edit-empty p {
	font-size: 12.5px;
	color: var(--muted);
}

/* ---------- edit bag: footer ---------- */

.smc-modal .edit-total {
	display: flex;
	align-items: baseline;
	gap: 10px;
	min-width: 0;
}

.smc-modal .edit-total-label {
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: var(--faint);
	white-space: nowrap;
}

.smc-modal .edit-total b {
	font-size: 18px;
	font-weight: 600;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.smc-modal .edit-actions {
	display: flex;
	gap: 9px;
	flex: none;
}

.smc-modal .edit-actions .btn {
	height: 42px;
	font-size: 12.5px;
	padding: 0 16px;
}

/* ---------- trigger buttons (shared component opt-in) ---------- */

.upsell-link[data-smc-modal-open] {
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
	margin-top: 16px;
	padding: 10px 12px;
	border: 1px solid #dcebe2;
	border-radius: 10px;
	background: #f2f8f4;
	font-family: inherit;
	font-size: 11.5px;
	font-weight: 600;
	color: #065f46;
	text-align: left;
	cursor: pointer;
	transition: background .14s ease, border-color .14s ease;
}

.upsell-link[data-smc-modal-open] .plus {
	width: 18px;
	height: 18px;
	border-radius: 5px;
	background: #fff;
	display: grid;
	place-items: center;
	flex: none;
	box-shadow: inset 0 0 0 1px #dcebe2;
}

.upsell-link[data-smc-modal-open] .plus svg {
	width: 10px;
	height: 10px;
}

.upsell-link[data-smc-modal-open]:hover {
	background: #eafaf2;
	border-color: #047857;
}

.edit-bag[data-smc-modal-open] {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 30px;
	padding: 0 11px;
	border: 1px solid #e7e8ea;
	border-radius: 8px;
	background: #fff;
	font-family: inherit;
	font-size: 11px;
	font-weight: 550;
	color: #047857;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color .14s ease, background .14s ease, color .14s ease;
}

.edit-bag[data-smc-modal-open] svg {
	width: 12px;
	height: 12px;
}

.edit-bag[data-smc-modal-open]:hover {
	background: #f2f8f4;
	border-color: #dcebe2;
	color: #065f46;
}

/* ---------- upsell dialog ---------- */

.smc-modal .dialog-upsell {
	width: min(680px, 100%);
	border: 1px solid rgba(17, 18, 20, .06);
	box-shadow: 0 50px 120px -40px rgba(0, 0, 0, .55), 0 10px 30px rgba(0, 0, 0, .1);
	animation: smcUpsellIn .26s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes smcUpsellIn {
	from {
		opacity: .35;
		transform: translateY(8px) scale(.995);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.smc-modal .dialog-upsell.is-closing {
	animation: smcUpsellOut .17s ease both;
}

@keyframes smcUpsellOut {
	to {
		opacity: 0;
		transform: translateY(10px) scale(.995);
	}
}

.smc-modal .dialog-upsell .dialog-head {
	padding: 26px 30px 23px;
	align-items: center;
	border-bottom: 1px solid var(--line-2);
	background: linear-gradient(180deg, #fff, #fcfdfc);
}

.smc-modal .upsell-head {
	display: flex;
	align-items: center;
	gap: 13px;
	min-width: 0;
	flex: 1;
}

.smc-modal .upsell-icon {
	width: 46px;
	height: 46px;
	border-radius: 14px;
	background: linear-gradient(180deg, #eefaf3, #e2f5ea);
	border: 1px solid #d5eee0;
	color: var(--green-2);
	display: grid;
	place-items: center;
	flex: none;
	box-shadow: 0 2px 8px rgba(6, 95, 70, .07);
}

.smc-modal .upsell-icon svg {
	width: 22px;
	height: 22px;
}

.smc-modal .upsell-head-copy {
	min-width: 0;
	flex: 1;
}

.smc-modal .dialog-upsell .dialog-head h2 {
	font-size: 19px;
	font-weight: 600;
	letter-spacing: -.02em;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.smc-modal .upsell-kicker {
	margin-top: 3px;
	font-size: 12.5px;
	font-weight: 500;
	letter-spacing: -.005em;
	color: var(--green-2);
}

.smc-modal .dialog-upsell .dialog-body {
	padding: 24px 30px 14px;
}

.smc-modal .upsell-lead {
	margin: 0 0 16px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--muted);
	max-width: 56ch;
}

.smc-modal .upsell-lead b {
	color: var(--ink);
	font-weight: 600;
}

.smc-modal .ucarousel {
	position: relative;
	margin: 0 -30px;
	padding: 0 30px;
}

.smc-modal .ucarousel::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 40px;
	background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 82%);
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease;
}

.smc-modal .ucarousel.is-more::after {
	opacity: 1;
}

.smc-modal .utrack {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding: 2px 0 6px;
	scroll-padding-left: 30px;
}

.smc-modal .utrack.is-filled .ucard {
	flex: 1 1 0;
	min-width: 0;
}

.smc-modal .utrack::-webkit-scrollbar {
	display: none;
}

.smc-modal .ucard {
	position: relative;
	flex: 0 0 176px;
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 8px 8px 12px;
	border: 1px solid var(--line);
	border-radius: 15px;
	background: #fff;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(17, 18, 20, .03);
	transition: border-color .16s ease, transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.smc-modal .ucard:hover {
	border-color: #d2d5d9;
	transform: translateY(-1px);
	box-shadow: 0 8px 20px -16px rgba(17, 18, 20, .35);
}

.smc-modal .ucard.is-on {
	border-color: var(--green);
	box-shadow: inset 0 0 0 1px var(--green), 0 10px 24px -18px rgba(4, 120, 87, .45);
}

.smc-modal .ucard-media {
	position: relative;
	display: grid;
	place-items: center;
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	overflow: hidden;
	background: radial-gradient(95% 70% at 50% 8%, #fff 0%, rgba(255, 255, 255, 0) 62%), linear-gradient(165deg, #f5f5f7, #ececef);
}

.smc-modal .ucard-media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 9%;
}

.smc-modal .ucard-body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 10px 2px 0;
}

.smc-modal .ucard-name {
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: -.005em;
	color: var(--ink);
	min-height: 2.7em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.smc-modal .ucard-var {
	margin-top: 3px;
	font-size: 10px;
	color: var(--faint);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Variable products need a real choice: the native select borrows the
   variant line's type so the card still reads as one object. */
.smc-modal select.ucard-var {
	display: block;
	width: 100%;
	height: 20px;
	margin-top: 3px;
	padding: 0 12px 0 0;
	border: 0;
	background-color: transparent;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0 center;
	background-size: 8px 6px;
	font-family: inherit;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
}

.smc-modal .ucard-price {
	margin-top: auto;
	padding-top: 8px;
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: -.01em;
	font-variant-numeric: tabular-nums;
}

.smc-modal .ucard input {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	appearance: none;
	-webkit-appearance: none;
	width: 20px;
	height: 20px;
	margin: 0;
	border: 1.4px solid rgba(15, 15, 17, .16);
	border-radius: 6px;
	background: rgba(255, 255, 255, .96);
	box-shadow: 0 1px 3px rgba(15, 15, 17, .1);
	cursor: pointer;
	transition: background .14s ease, border-color .14s ease;
}

.smc-modal .ucard input:checked {
	background: var(--green);
	border-color: var(--green);
}

.smc-modal .ucard input:checked::after {
	content: "";
	position: absolute;
	left: 6.5px;
	top: 2.5px;
	width: 4.5px;
	height: 9px;
	border: solid #fff;
	border-width: 0 1.9px 1.9px 0;
	transform: rotate(45deg);
}

.smc-modal .ucard input:focus-visible {
	outline: 2px solid var(--green);
	outline-offset: 2px;
}

.smc-modal .ucard input:disabled {
	opacity: .35;
	cursor: not-allowed;
}

.smc-modal .ufoot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	margin-top: 12px;
}

.smc-modal .ubar {
	flex: 0 0 120px;
	width: 120px;
	height: 2px;
	border-radius: 2px;
	background: #e9eaec;
	overflow: hidden;
}

.smc-modal .ubar i {
	display: block;
	height: 100%;
	width: 14%;
	border-radius: 2px;
	background: var(--ink);
	transition: width .18s ease;
}

.smc-modal .ufoot .rail-arrow {
	width: 30px;
	height: 30px;
	border-radius: 7px;
}

.smc-modal .ufoot .rail-arrow svg {
	width: 12px;
	height: 12px;
}

.smc-modal .rail-arrows {
	display: flex;
	gap: 8px;
}

.smc-modal .rail-arrow {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid #d9dce1;
	border-radius: 7px;
	background: #fff;
	color: var(--ink);
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.smc-modal .rail-arrow:hover {
	background: #111113;
	border-color: #111113;
	color: #fff;
}

.smc-modal .rail-arrow[disabled] {
	opacity: .35;
	cursor: default;
}

.smc-modal .rail-arrow[disabled]:hover {
	background: #fff;
	border-color: #d9dce1;
	color: var(--ink);
}

.smc-modal .dialog-upsell .dialog-foot {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	padding: 18px 30px 22px;
	border-top: 1px solid var(--line-2);
	background: linear-gradient(180deg, #fff, #fbfcfb);
}

.smc-modal .upsell-selected {
	margin-right: auto;
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--muted);
}

.smc-modal .upsell-selected b {
	font-weight: 600;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
}

.smc-modal .upsell-selected.is-empty {
	color: var(--faint);
}

.smc-modal .upsell-dismiss {
	height: 42px;
	padding: 0 18px;
	font-size: 12.5px;
	font-weight: 550;
}

.smc-modal .dialog-upsell .dialog-foot .btn-primary {
	height: 42px;
	min-width: 156px;
	padding: 0 18px;
	font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce) {
	.smc-modal .dialog,
	.smc-modal .dialog-upsell,
	.smc-modal .dialog-upsell.is-closing {
		animation: none;
	}

	.smc-modal .dialog-close,
	.smc-modal .ucard,
	.smc-modal .ubar i,
	.smc-modal .edit-row,
	.smc-modal .edit-content,
	.smc-modal .edit-strip {
		transition: none;
	}

	.smc-modal .dialog-close:hover,
	.smc-modal .ucard:hover {
		transform: none;
	}

	.smc-modal .edit-row.is-removed .edit-content {
		transform: none;
	}
}

/* ---------- responsive (prototype 1046-1067, 1137, 1172-1189) ---------- */

@media (max-width: 760px) {
	/* A real sheet: inset from the sides and the bottom, four rounded
	   corners, safe-area aware, body scrolling inside. */
	.smc-modal {
		place-items: end center;
		padding: 12px;
		padding-bottom: calc(12px + env(safe-area-inset-bottom));
	}

	.smc-modal .dialog {
		width: 100%;
		max-width: 100%;
		max-height: 88vh;
		border-radius: 20px;
	}

	.smc-modal .dialog-head {
		padding: 18px 18px 14px;
		background: #fff;
		position: relative;
		z-index: 1;
		box-shadow: 0 10px 14px -14px rgba(0, 0, 0, .35);
	}

	.smc-modal .dialog-close {
		width: 38px;
		height: 38px;
	}

	.smc-modal .dialog-body {
		padding: 2px 18px;
		min-height: 0;
	}

	/* ---- rows: copy on top, price top-right, actions on their own line ---- */

	.smc-modal .edit-content {
		grid-template-columns: 56px minmax(0, 1fr) auto;
		grid-template-areas:
			"thumb copy price"
			"acts acts acts";
		column-gap: 12px;
		row-gap: 12px;
		padding: 14px 0;
	}

	.smc-modal .edit-thumb {
		width: 56px;
		height: 56px;
		padding: 4px;
	}

	.smc-modal .edit-name {
		font-size: 13px;
	}

	.smc-modal .edit-price {
		font-size: 13px;
	}

	.smc-modal .edit-row-actions {
		justify-self: stretch;
		justify-content: space-between;
		gap: 10px;
	}

	.smc-modal .edit-note {
		text-align: left;
		font-size: 11px;
	}

	.smc-modal .edit-remove {
		min-height: 40px;
		padding: 0 12px;
		font-size: 12px;
	}

	.smc-modal .edit-strip-in {
		margin: 5px 0;
	}

	.smc-modal .edit-undo {
		min-height: 38px;
	}

	/* ---- footer: totals row, then Cancel / Save ---- */

	.smc-modal .dialog-foot {
		padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
		flex-wrap: wrap;
	}

	.smc-modal .dialog-edit .dialog-foot {
		row-gap: 10px;
		column-gap: 10px;
		padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
	}

	.smc-modal .dialog-edit .edit-total {
		flex: 1 1 100%;
		justify-content: space-between;
		gap: 12px;
	}

	.smc-modal .dialog-edit .edit-total b {
		font-size: 17px;
	}

	.smc-modal .dialog-edit .edit-actions {
		flex: 1 1 100%;
		justify-content: flex-end;
		gap: 10px;
	}

	.smc-modal .dialog-edit .edit-actions .btn {
		height: 46px;
		flex: 0 0 auto;
		padding: 0 18px;
	}

	.smc-modal .dialog-edit .edit-actions .btn-primary {
		flex: 1 1 auto;
	}

	.smc-modal .dialog-upsell .dialog-head {
		padding: 20px 18px 18px;
	}

	.smc-modal .dialog-upsell .dialog-body {
		padding: 20px 18px 12px;
	}

	/* Existing order kept: dismiss left, primary right, whole row filled. */
	.smc-modal .dialog-upsell .dialog-foot {
		padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
		flex-wrap: wrap;
		gap: 10px;
	}

	.smc-modal .upsell-selected {
		flex-basis: 100%;
		margin-right: 0;
		order: 0;
	}

	.smc-modal .upsell-dismiss {
		order: 1;
		flex: 0 0 auto;
		height: 46px;
		padding: 0 16px;
	}

	.smc-modal .dialog-upsell .dialog-foot .btn-primary {
		order: 2;
		flex: 1;
		min-width: 0;
		height: 46px;
	}

	.smc-modal .upsell-icon {
		width: 40px;
		height: 40px;
		border-radius: 12px;
	}

	.smc-modal .upsell-icon svg {
		width: 19px;
		height: 19px;
	}

	.smc-modal .dialog-upsell .dialog-head h2 {
		font-size: 17px;
	}

	.smc-modal .upsell-lead {
		font-size: 12px;
		margin-bottom: 18px;
	}

	.smc-modal .ucarousel {
		margin: 0 -18px;
		padding: 0 18px;
	}

	.smc-modal .utrack {
		scroll-padding-left: 18px;
	}

	.smc-modal .ucard {
		flex-basis: 160px;
		padding: 8px 8px 12px;
	}

	.smc-modal .ucard-name {
		font-size: 11px;
	}

	.smc-modal .ucard input {
		top: 12px;
		right: 12px;
	}

	.smc-modal .ufoot {
		margin-top: 16px;
	}

	.smc-modal .ufoot .rail-arrow {
		width: 28px;
		height: 28px;
	}

	.upsell-link[data-smc-modal-open] {
		font-size: 10.5px;
	}
}

@media (max-width: 400px) {
	/* 390px and below: 48px thumb, 40px touch targets, still no overflow. */
	.smc-modal .edit-content {
		grid-template-columns: 48px minmax(0, 1fr) auto;
		column-gap: 10px;
		row-gap: 10px;
		padding: 12px 0;
	}

	.smc-modal .edit-thumb {
		width: 48px;
		height: 48px;
		padding: 3px;
		border-radius: 8px;
	}

	.smc-modal .edit-name {
		font-size: 12.5px;
	}

	.smc-modal .edit-price {
		font-size: 12.5px;
	}

	.smc-modal .qty {
		height: 40px;
	}

	.smc-modal .qty button {
		width: 38px;
		height: 38px;
	}

	.smc-modal .edit-remove {
		min-height: 40px;
		padding: 0 8px;
	}

	.smc-modal .edit-undo {
		min-height: 40px;
	}

	.smc-modal .edit-strip-name {
		font-size: 12px;
	}

	.smc-modal .dialog-edit .edit-actions .btn {
		padding: 0 14px;
	}
}

@media (max-width: 380px) {
	.smc-modal .dialog-upsell .dialog-head h2 {
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
		line-height: 1.2;
	}
}

@media (max-width: 359px) {
	.smc-modal .ucard {
		flex-basis: 146px;
	}
}
