/* زبردست — مودال خریدهای مشتری برتر
 * همه‌ی قواعد زیر #iim-tcm قفل شده‌اند تا استایل قالب (hover دکمه، رنگ لینک، فاصله‌ی تیترها…) به مودال نشت نکند.
 */

/* ---------- ردیف قابل کلیک در لیست مشتریان برتر ---------- */
.iim-top-customer.is-clickable { cursor: pointer; position: relative; outline: none; -webkit-tap-highlight-color: transparent; }
.iim-top-customer.is-clickable:focus-visible { box-shadow: 0 0 0 3px color-mix( in srgb, var( --iim-button-color, #1135d4 ) 28%, transparent ); background: #fff; }
.iim-top-customer.is-clickable:active { transform: scale( 0.985 ); }
.iim-top-customer.is-loading { pointer-events: none; }
.iim-top-customer.is-loading .iim-top-customer-go { animation: iim-tcm-spin 0.8s linear infinite; }
.iim-top-customer-go {
	display: inline-flex; align-items: center; justify-content: center; flex: none;
	width: 28px; height: 28px; border-radius: 9px;
	color: var( --iim-button-color, #1135d4 );
	background: color-mix( in srgb, var( --iim-button-color, #1135d4 ) 8%, transparent );
	transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.iim-top-customer-go svg { width: 15px; height: 15px; }
.iim-top-customer.is-clickable:hover .iim-top-customer-go { background: var( --iim-button-color, #1135d4 ); color: #fff; transform: translateX( -2px ); }

/* ---------- سپر در برابر قالب ---------- */
#iim-tcm :where( div, span, p, h2, h3, h4, ul, ol, li, a, button, img, strong, small, b, i, em, bdi, section, header, nav ) {
	all: revert;
	box-sizing: border-box;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
}
#iim-tcm :where( button, a ) {
	-webkit-appearance: none; appearance: none;
	color: inherit; font: inherit; text-decoration: none;
	background: none; border: 0; margin: 0; padding: 0;
	box-shadow: none; min-height: 0; min-width: 0; width: auto; height: auto;
	cursor: pointer; transition: none;
}
#iim-tcm :where( li )::marker { content: none; }
#iim-tcm :where( svg ) { display: block; flex: none; fill: none; max-width: none; }
#iim-tcm [hidden] { display: none !important; }

/* ---------- توکن‌ها ---------- */
#iim-tcm {
	--p: var( --iim-button-color, #1135d4 );
	--p-ink: var( --iim-button-text-color, #ffffff );
	--ink: #111827;
	--ink-2: #374151;
	--muted: #6b7280;
	--faint: #9ca3af;
	--line: #eceef3;
	--wash: #f6f7fa;
	--card: #ffffff;
	--p-wash: color-mix( in srgb, var( --p ) 7%, #ffffff );
	--p-soft: color-mix( in srgb, var( --p ) 14%, #ffffff );
	--ease: cubic-bezier( 0.2, 0.9, 0.25, 1 );

	position: fixed; inset: 0; z-index: 100050;
	display: flex; align-items: center; justify-content: center;
	padding: 24px;
	font-family: var( --iim-font-family, "Vazir", Tahoma, sans-serif );
	font-size: 14px; line-height: 1.7; font-weight: 400;
	color: var( --ink );
	direction: rtl; text-align: right;
	-webkit-font-smoothing: antialiased;
}
#iim-tcm[hidden] { display: none !important; }

#iim-tcm .iim-tcm-backdrop {
	position: absolute; inset: 0; display: block;
	background: rgba( 17, 24, 39, 0.46 );
	-webkit-backdrop-filter: blur( 4px ); backdrop-filter: blur( 4px );
	opacity: 0; transition: opacity 0.28s ease;
}
#iim-tcm.is-in .iim-tcm-backdrop { opacity: 1; }

#iim-tcm .iim-tcm-sheet {
	position: relative;
	width: min( 720px, 100% );
	max-height: min( 88vh, 840px );
	display: flex; flex-direction: column;
	background: var( --card );
	border-radius: 24px;
	overflow: hidden;
	box-shadow: 0 32px 80px -24px rgba( 17, 24, 39, 0.45 ), 0 0 0 1px rgba( 17, 24, 39, 0.05 );
	opacity: 0;
	transform: translateY( 18px ) scale( 0.98 );
	transition: opacity 0.24s ease, transform 0.4s var( --ease );
}
#iim-tcm.is-in .iim-tcm-sheet { opacity: 1; transform: none; }
#iim-tcm.is-out .iim-tcm-sheet { transition-duration: 0.18s; transition-timing-function: ease-in; }

/* ---------- سربرگ ---------- */
#iim-tcm .iim-tcm-head { display: block; flex: none; position: relative; padding: 22px 24px 0; }
#iim-tcm .iim-tcm-grip { display: none; }
#iim-tcm .iim-tcm-top { display: flex; align-items: center; gap: 14px; }

#iim-tcm .iim-tcm-avatar {
	flex: none; width: 52px; height: 52px; border-radius: 16px;
	display: inline-flex; align-items: center; justify-content: center;
	background: var( --p-soft ); color: var( --p );
	font-size: 19px; font-weight: 700; line-height: 1;
}
#iim-tcm .iim-tcm-id { display: block; flex: 1; min-width: 0; }
#iim-tcm .iim-tcm-titlerow { display: flex; align-items: center; gap: 8px; min-width: 0; }
#iim-tcm .iim-tcm-title {
	display: block; margin: 0; padding: 0;
	font-size: 20px; font-weight: 700; line-height: 1.45; color: var( --ink );
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
#iim-tcm .iim-tcm-rank {
	flex: none; display: inline-flex; align-items: center; gap: 4px;
	height: 24px; padding: 0 9px; border-radius: 999px;
	font-size: 12px; font-weight: 700; line-height: 1;
	background: var( --wash ); color: var( --ink-2 );
}
#iim-tcm .iim-tcm-rank svg { width: 13px; height: 13px; }
#iim-tcm .iim-tcm-rank[data-r="1"] { background: #fff4d6; color: #92600a; }
#iim-tcm .iim-tcm-rank[data-r="2"] { background: #eef1f5; color: #475569; }
#iim-tcm .iim-tcm-rank[data-r="3"] { background: #fbeee2; color: #9a4a12; }
#iim-tcm .iim-tcm-sub { display: block; margin: 2px 0 0; padding: 0; font-size: 13px; font-weight: 500; color: var( --muted ); line-height: 1.6; }

#iim-tcm .iim-tcm-close {
	flex: none; align-self: flex-start;
	width: 38px; height: 38px; border-radius: 12px;
	display: inline-flex; align-items: center; justify-content: center;
	background: var( --wash ); color: var( --muted );
	transition: background-color 0.18s ease, color 0.18s ease;
}
#iim-tcm .iim-tcm-close:hover,
#iim-tcm .iim-tcm-close:focus { background: #eceef3; color: var( --ink ); }
#iim-tcm .iim-tcm-close:focus-visible { outline: 2px solid var( --p ); outline-offset: 2px; }
#iim-tcm .iim-tcm-close svg { width: 17px; height: 17px; }

#iim-tcm .iim-tcm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
#iim-tcm .iim-tcm-chip {
	display: inline-flex; align-items: center; gap: 6px;
	height: 30px; padding: 0 11px; border-radius: 999px;
	background: var( --card ); border: 1px solid var( --line );
	color: var( --ink-2 ); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
	max-width: 100%; overflow: hidden; text-overflow: ellipsis;
	transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
#iim-tcm a.iim-tcm-chip:hover,
#iim-tcm a.iim-tcm-chip:focus { border-color: color-mix( in srgb, var( --p ) 35%, transparent ); color: var( --p ); background: var( --p-wash ); }
#iim-tcm a.iim-tcm-chip:focus-visible { outline: 2px solid var( --p ); outline-offset: 1px; }
#iim-tcm .iim-tcm-chip svg { width: 14px; height: 14px; color: var( --faint ); transition: color 0.18s ease; }
#iim-tcm a.iim-tcm-chip:hover svg { color: var( --p ); }
#iim-tcm .iim-tcm-chip [dir="ltr"] { direction: ltr; unicode-bidi: isolate; }

/* ---------- خلاصه: یک عدد اصلی + سه عدد کمکی ---------- */
#iim-tcm .iim-tcm-summary {
	flex: none; position: relative; overflow: hidden;
	display: grid; grid-template-columns: minmax( 0, 1fr ) minmax( 0, 1.5fr ); align-items: center; gap: 18px;
	margin: 18px 24px 0; padding: 18px 20px;
	border-radius: 20px;
	background: var( --p ); color: var( --p-ink );
	background-image: radial-gradient( 140% 120% at 100% 0%, rgba( 255, 255, 255, 0.18 ), transparent 55% );
}
#iim-tcm .iim-tcm-total { display: block; min-width: 0; }
#iim-tcm .iim-tcm-total-label { display: block; font-size: 13px; font-weight: 500; opacity: 0.82; line-height: 1.5; }
#iim-tcm .iim-tcm-total-val { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; white-space: nowrap; min-width: 0; }
#iim-tcm .iim-tcm-total-val strong { display: block; font-size: 30px; font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
#iim-tcm .iim-tcm-total-val small { display: block; font-size: 14px; font-weight: 500; opacity: 0.8; }

#iim-tcm .iim-tcm-mini { display: grid; grid-template-columns: minmax( 0, 0.75fr ) minmax( 0, 0.75fr ) minmax( 0, 1.5fr ); gap: 6px; margin: 0; padding: 0; list-style: none; }
#iim-tcm .iim-tcm-mini li {
	display: block; min-width: 0; margin: 0; padding: 10px 12px; border-radius: 14px;
	background: rgba( 255, 255, 255, 0.14 );
}
#iim-tcm .iim-tcm-mini span { display: block; font-size: 12px; font-weight: 500; opacity: 0.8; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#iim-tcm .iim-tcm-mini strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#iim-tcm .iim-tcm-mini strong small { font-size: 12px; font-weight: 500; opacity: 0.8; margin-inline-start: 3px; }

/* ---------- تب‌ها (زیرخط‌دار) ---------- */
#iim-tcm .iim-tcm-tabs {
	flex: none; position: relative;
	display: flex; gap: 22px;
	margin: 16px 24px 0; padding: 0;
	border-bottom: 1px solid var( --line );
}
#iim-tcm .iim-tcm-tab {
	position: relative;
	display: inline-flex; align-items: center; gap: 7px;
	height: 44px; padding: 0 2px;
	background: transparent; color: var( --muted );
	font-size: 14px; font-weight: 600; line-height: 1;
	transition: color 0.18s ease;
}
#iim-tcm .iim-tcm-tab:hover,
#iim-tcm .iim-tcm-tab:focus { background: transparent; color: var( --ink ); }
#iim-tcm .iim-tcm-tab.is-on { color: var( --ink ); }
#iim-tcm .iim-tcm-tab:focus-visible { outline: 2px solid var( --p ); outline-offset: 2px; border-radius: 6px; }
#iim-tcm .iim-tcm-tab b {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
	background: var( --wash ); color: var( --muted );
	font-size: 12px; font-weight: 700; line-height: 1;
	transition: background-color 0.2s ease, color 0.2s ease;
}
#iim-tcm .iim-tcm-tab.is-on b { background: var( --p-soft ); color: var( --p ); }
#iim-tcm .iim-tcm-tabbar {
	position: absolute; bottom: -1px; right: 0; display: block;
	height: 2.5px; border-radius: 3px 3px 0 0; background: var( --p );
	width: var( --w, 0px ); transform: translateX( var( --x, 0px ) );
	transition: transform 0.34s var( --ease ), width 0.34s var( --ease );
}

/* ---------- بدنه ---------- */
#iim-tcm .iim-tcm-body {
	display: block; flex: 1 1 auto; min-height: 0;
	overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
	padding: 14px 24px 22px; scrollbar-width: thin; scrollbar-color: #d6dae2 transparent;
}
#iim-tcm .iim-tcm-panel { display: block; animation: iim-tcm-fade 0.26s ease both; }
@keyframes iim-tcm-fade { from { opacity: 0; transform: translateY( 4px ); } to { opacity: 1; transform: none; } }

#iim-tcm .iim-tcm-hint { display: block; margin: 0 0 10px; font-size: 12.5px; font-weight: 500; color: var( --muted ); line-height: 1.6; }

/* سفارش‌ها */
#iim-tcm .iim-tcm-orders { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
#iim-tcm .iim-tcm-order {
	display: block; margin: 0; padding: 0;
	border-radius: 16px; background: var( --card ); border: 1px solid var( --line );
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	opacity: 0; transform: translateY( 6px );
	animation: iim-tcm-rise 0.4s var( --ease ) forwards;
	animation-delay: calc( min( var( --i, 0 ), 10 ) * 0.035s );
}
#iim-tcm .iim-tcm-order:hover { border-color: #dfe2e9; }
#iim-tcm .iim-tcm-order.is-open { border-color: color-mix( in srgb, var( --p ) 28%, var( --line ) ); box-shadow: 0 14px 30px -24px color-mix( in srgb, var( --p ) 70%, transparent ); }
@keyframes iim-tcm-rise { to { opacity: 1; transform: none; } }

#iim-tcm .iim-tcm-ohead {
	display: grid; grid-template-columns: minmax( 0, 1fr ) auto auto; align-items: center; gap: 14px;
	width: 100%; padding: 13px 16px; border-radius: 16px;
	background: transparent; color: inherit; text-align: right;
}
#iim-tcm .iim-tcm-ohead:hover,
#iim-tcm .iim-tcm-ohead:focus { background: transparent; color: inherit; }
#iim-tcm .iim-tcm-ohead:focus-visible { outline: 2px solid var( --p ); outline-offset: -2px; }
#iim-tcm .iim-tcm-ometa { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#iim-tcm .iim-tcm-onum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14.5px; font-weight: 700; color: var( --ink ); line-height: 1.6; }
#iim-tcm .iim-tcm-status {
	display: inline-flex; align-items: center; gap: 5px;
	height: 22px; padding: 0 8px; border-radius: 999px;
	font-size: 12px; font-weight: 600; line-height: 1;
	background: color-mix( in srgb, var( --sc, #6b7280 ) 11%, #ffffff );
	color: color-mix( in srgb, var( --sc, #6b7280 ) 80%, #000000 );
}
#iim-tcm .iim-tcm-status::before { content: ""; display: block; width: 6px; height: 6px; border-radius: 50%; background: var( --sc, #6b7280 ); }
#iim-tcm .iim-tcm-odate { display: block; font-size: 12.5px; color: var( --muted ); font-weight: 400; line-height: 1.6; }
#iim-tcm .iim-tcm-osum { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
#iim-tcm .iim-tcm-osum strong { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; color: var( --ink ); line-height: 1.6; }
#iim-tcm .iim-tcm-osum small { display: block; font-size: 12.5px; color: var( --muted ); white-space: nowrap; line-height: 1.6; }
#iim-tcm .iim-tcm-chev {
	display: inline-flex; align-items: center; justify-content: center;
	width: 28px; height: 28px; border-radius: 9px;
	color: var( --faint );
	transition: transform 0.3s var( --ease ), color 0.2s ease, background-color 0.2s ease;
}
#iim-tcm .iim-tcm-chev svg { width: 16px; height: 16px; }
#iim-tcm .iim-tcm-order:hover .iim-tcm-chev { color: var( --ink-2 ); background: var( --wash ); }
#iim-tcm .iim-tcm-order.is-open .iim-tcm-chev { transform: rotate( 180deg ); color: var( --p ); background: var( --p-wash ); }

#iim-tcm .iim-tcm-obody { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.32s var( --ease ); }
#iim-tcm .iim-tcm-order.is-open .iim-tcm-obody { grid-template-rows: 1fr; }
#iim-tcm .iim-tcm-obody > div { display: block; overflow: hidden; min-height: 0; }
#iim-tcm .iim-tcm-oinner { display: block; margin: 0 16px; padding: 4px 0 16px; border-top: 1px solid var( --line ); }

/* اقلام سفارش: سه ستون ثابت — عکس | نام و برچسب‌ها | مبلغ */
#iim-tcm .iim-tcm-items { display: block; margin: 0; padding: 0; list-style: none; }
#iim-tcm .iim-tcm-item {
	display: grid; grid-template-columns: 52px minmax( 0, 1fr ) auto; align-items: center; column-gap: 14px;
	margin: 0; padding: 12px 0;
	border-bottom: 1px solid var( --line );
}
#iim-tcm .iim-tcm-item:last-child { border-bottom: 0; }
#iim-tcm .iim-tcm-thumb {
	position: relative; display: block; flex: none;
	width: 52px; height: 52px; border-radius: 12px; overflow: hidden;
	background: var( --wash ); box-shadow: inset 0 0 0 1px rgba( 17, 24, 39, 0.06 );
}
#iim-tcm .iim-tcm-thumb img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; border: 0; border-radius: 0; box-shadow: none; margin: 0; padding: 0; }
#iim-tcm .iim-tcm-thumb.is-custom { display: inline-flex; align-items: center; justify-content: center; background: var( --p-wash ); color: var( --p ); }
#iim-tcm .iim-tcm-thumb.is-custom svg { width: 19px; height: 19px; }
#iim-tcm .iim-tcm-imain { display: block; min-width: 0; }
#iim-tcm .iim-tcm-iname { display: -webkit-box; margin: 0; padding: 0; font-size: 14px; font-weight: 600; color: var( --ink ); line-height: 1.7; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#iim-tcm .iim-tcm-imeta { display: block; margin: 1px 0 0; padding: 0; font-size: 12.5px; color: var( --muted ); line-height: 1.6; }
#iim-tcm .iim-tcm-imeta em { font-style: normal; display: inline-block; padding: 0 7px; border-radius: 6px; background: var( --wash ); color: var( --ink-2 ); font-size: 12px; font-weight: 500; }
#iim-tcm .iim-tcm-itags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; }
#iim-tcm .iim-tcm-tag {
	display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px;
	background: var( --wash ); color: var( --ink-2 );
	font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
}
#iim-tcm .iim-tcm-tag.is-qty { background: var( --p-wash ); color: var( --p ); font-weight: 600; }
#iim-tcm .iim-tcm-tag.is-many { background: var( --p ); color: var( --p-ink ); }
#iim-tcm .iim-tcm-tag.is-custom { background: #fff7e6; color: #92600a; }
#iim-tcm .iim-tcm-iprice {
	display: flex; flex-direction: column; align-items: flex-end; gap: 0;
	min-width: 0; text-align: left; white-space: nowrap;
}
#iim-tcm .iim-tcm-iqty { display: none; }
#iim-tcm .iim-tcm-imoney { display: flex; align-items: baseline; gap: 4px; order: 1; }
#iim-tcm .iim-tcm-imoney strong { display: inline; font-size: 15px; font-weight: 700; line-height: 1.6; color: var( --ink ); }
#iim-tcm .iim-tcm-imoney small { display: inline; font-size: 12px; font-weight: 500; color: var( --muted ); line-height: 1.6; }
#iim-tcm .iim-tcm-iunit { display: block; order: 2; font-size: 12px; color: var( --muted ); line-height: 1.6; }

/* جمع‌بندی سفارش (فاکتوری) */
#iim-tcm .iim-tcm-ofoot {
	display: block; margin: 4px 0 0; padding: 12px 14px;
	border-radius: 14px; background: var( --wash );
}
#iim-tcm .iim-tcm-fact {
	display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
	padding: 3px 0; font-size: 13px; line-height: 1.7; color: var( --muted );
}
#iim-tcm .iim-tcm-fact > span { display: block; font-weight: 500; white-space: nowrap; }
#iim-tcm .iim-tcm-fact > b { display: flex; align-items: baseline; gap: 4px; min-width: 0; font-weight: 600; color: var( --ink-2 ); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#iim-tcm .iim-tcm-fact > b strong { display: inline; font-weight: inherit; color: inherit; }
#iim-tcm .iim-tcm-fact > b small { display: inline; font-size: 12px; font-weight: 500; color: var( --muted ); }
#iim-tcm .iim-tcm-fact.is-off > b { color: #047857; }
#iim-tcm .iim-tcm-fact.is-ref > b { color: #b91c1c; }
#iim-tcm .iim-tcm-fact.is-total { margin-top: 6px; padding-top: 9px; border-top: 1px dashed #d9dde5; }
#iim-tcm .iim-tcm-fact.is-total > span { color: var( --ink ); font-weight: 700; }
#iim-tcm .iim-tcm-fact.is-total > b { color: var( --ink ); font-size: 15.5px; font-weight: 800; }
#iim-tcm .iim-tcm-view {
	display: flex; align-items: center; justify-content: center; gap: 6px;
	width: 100%; height: 38px; margin: 10px 0 0; padding: 0 14px; border-radius: 11px;
	background: var( --card ); color: var( --p );
	box-shadow: inset 0 0 0 1px color-mix( in srgb, var( --p ) 22%, transparent );
	font-size: 13px; font-weight: 600; line-height: 1;
	transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
#iim-tcm .iim-tcm-view:hover,
#iim-tcm .iim-tcm-view:focus { background: var( --p ); color: var( --p-ink ); box-shadow: none; }
#iim-tcm .iim-tcm-view:focus-visible { outline: 2px solid var( --p ); outline-offset: 2px; }
#iim-tcm .iim-tcm-view svg { width: 15px; height: 15px; }

/* اقلام خریداری‌شده */
#iim-tcm .iim-tcm-prods { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
#iim-tcm .iim-tcm-prod {
	display: grid; grid-template-columns: 22px 44px minmax( 0, 1fr ) auto; align-items: center; gap: 12px;
	margin: 0; padding: 10px 4px; border-bottom: 1px solid var( --line );
	opacity: 0; transform: translateY( 6px );
	animation: iim-tcm-rise 0.4s var( --ease ) forwards;
	animation-delay: calc( min( var( --i, 0 ), 10 ) * 0.03s );
}
#iim-tcm .iim-tcm-prod:last-child { border-bottom: 0; }
#iim-tcm .iim-tcm-prod .iim-tcm-thumb { width: 44px; height: 44px; }
#iim-tcm .iim-tcm-prank { display: block; font-size: 13px; font-weight: 700; color: var( --faint ); text-align: center; line-height: 1; }
#iim-tcm .iim-tcm-prod:nth-child( 1 ) .iim-tcm-prank { color: #b7791f; }
#iim-tcm .iim-tcm-pbar { display: block; margin-top: 7px; height: 5px; border-radius: 999px; background: var( --wash ); overflow: hidden; }
#iim-tcm .iim-tcm-pbar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var( --p ); transition: width 0.8s var( --ease ); }
#iim-tcm .iim-tcm-pqty { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
#iim-tcm .iim-tcm-pqty strong { display: block; font-size: 15px; font-weight: 700; color: var( --ink ); white-space: nowrap; line-height: 1.6; }
#iim-tcm .iim-tcm-pqty strong small { font-size: 12px; font-weight: 500; color: var( --muted ); margin-inline-start: 3px; }
#iim-tcm .iim-tcm-pqty > small { display: block; font-size: 12.5px; color: var( --muted ); white-space: nowrap; line-height: 1.6; }

#iim-tcm .iim-tcm-note { display: block; margin: 12px 0 0; padding: 0; font-size: 13px; color: var( --muted ); text-align: center; line-height: 1.8; }
#iim-tcm .iim-tcm-empty { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 14px; border-radius: 12px; background: var( --wash ); font-size: 13px; color: var( --muted ); line-height: 1.6; }

/* ---------- بارگذاری / خطا ---------- */
#iim-tcm .iim-tcm-skel { display: block; border-radius: 8px; background: linear-gradient( 100deg, #eff1f5 30%, #f8f9fb 50%, #eff1f5 70% ); background-size: 200% 100%; animation: iim-tcm-sweep 1.15s ease-in-out infinite; }
#iim-tcm .iim-tcm-summary .iim-tcm-skel { background: linear-gradient( 100deg, rgba( 255, 255, 255, 0.16 ) 30%, rgba( 255, 255, 255, 0.3 ) 50%, rgba( 255, 255, 255, 0.16 ) 70% ); background-size: 200% 100%; }
@keyframes iim-tcm-sweep { 0% { background-position: 180% 0; } 100% { background-position: -80% 0; } }
@keyframes iim-tcm-spin { to { transform: rotate( 360deg ); } }

#iim-tcm .iim-tcm-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 16px 28px; text-align: center; }
#iim-tcm .iim-tcm-state-ico { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 16px; background: #fef2f2; color: #dc2626; }
#iim-tcm .iim-tcm-state-ico svg { width: 24px; height: 24px; }
#iim-tcm .iim-tcm-state p { display: block; margin: 0; font-size: 14px; font-weight: 500; color: var( --ink-2 ); line-height: 1.9; }
#iim-tcm .iim-tcm-retry { display: inline-flex; align-items: center; height: 40px; padding: 0 20px; border-radius: 12px; background: var( --p ); color: var( --p-ink ); font-size: 13.5px; font-weight: 600; line-height: 1; }
#iim-tcm .iim-tcm-retry:hover,
#iim-tcm .iim-tcm-retry:focus { background: color-mix( in srgb, var( --p ) 88%, #000000 ); color: var( --p-ink ); }

body.iim-tcm-lock { overflow: hidden !important; }

/* ---------- تبلت ---------- */
@media ( max-width: 760px ) {
	#iim-tcm .iim-tcm-summary { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- موبایل: باتم‌شیت ---------- */
@media ( max-width: 640px ) {
	#iim-tcm { padding: 0; align-items: flex-end; }
	#iim-tcm .iim-tcm-sheet {
		width: 100%;
		max-height: calc( 100vh - 24px );
		border-radius: 24px 24px 0 0;
		transform: translateY( 100% ); opacity: 1;
		transition: transform 0.42s cubic-bezier( 0.22, 0.95, 0.3, 1 );
		padding-bottom: env( safe-area-inset-bottom, 0px );
	}
	@supports ( height: 100dvh ) { #iim-tcm .iim-tcm-sheet { max-height: calc( 100dvh - 24px ); } }
	#iim-tcm.is-in .iim-tcm-sheet { transform: translateY( var( --drag, 0px ) ); }
	#iim-tcm.is-dragging .iim-tcm-sheet { transition: none; }
	#iim-tcm.is-out .iim-tcm-sheet { transform: translateY( 100% ); transition-duration: 0.24s; }

	#iim-tcm .iim-tcm-grip { display: block; width: 40px; height: 4px; margin: -10px auto 14px; border-radius: 999px; background: #dfe2e8; }
	#iim-tcm .iim-tcm-head { padding: 18px 16px 0; touch-action: none; }
	#iim-tcm .iim-tcm-avatar { width: 46px; height: 46px; border-radius: 14px; font-size: 17px; }
	#iim-tcm .iim-tcm-title { font-size: 17px; }
	#iim-tcm .iim-tcm-close { width: 36px; height: 36px; }
	#iim-tcm .iim-tcm-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 0 16px; }
	#iim-tcm .iim-tcm-chips::-webkit-scrollbar { display: none; }
	#iim-tcm .iim-tcm-chip { flex: none; }

	#iim-tcm .iim-tcm-summary { margin: 14px 16px 0; padding: 16px; border-radius: 18px; }
	#iim-tcm .iim-tcm-total-val strong { font-size: 26px; }
	#iim-tcm .iim-tcm-mini li { padding: 8px 10px; border-radius: 12px; }
	#iim-tcm .iim-tcm-mini strong { font-size: 14px; }

	#iim-tcm .iim-tcm-tabs { margin: 12px 16px 0; gap: 18px; }
	#iim-tcm .iim-tcm-body { padding: 12px 16px 18px; }

	#iim-tcm .iim-tcm-ohead { grid-template-columns: minmax( 0, 1fr ) auto; gap: 10px; padding: 12px 13px; }
	#iim-tcm .iim-tcm-chev { display: none; }
	#iim-tcm .iim-tcm-oinner { margin: 0 13px; }
	/* موبایل: ردیف ۱ نام، ردیف ۲ ویژگی‌ها، ردیف ۳ «تعداد» راست و «مبلغ» چپ */
	#iim-tcm .iim-tcm-item { grid-template-columns: 48px minmax( 0, 1fr ); grid-template-rows: auto; column-gap: 12px; row-gap: 6px; align-items: center; padding: 12px 0; }
	#iim-tcm .iim-tcm-imain { display: contents; }
	#iim-tcm .iim-tcm-thumb { grid-column: 1; grid-row: 1 / span 3; align-self: start; width: 48px; height: 48px; }
	#iim-tcm .iim-tcm-iname { grid-column: 2; grid-row: 1; font-size: 13.5px; }
	#iim-tcm .iim-tcm-itags { grid-column: 2; grid-row: 2; margin: 0; }
	#iim-tcm .iim-tcm-tqty { display: none; }
	#iim-tcm .iim-tcm-itags:not( :has( .iim-tcm-tag:not( .iim-tcm-tqty ) ) ) { display: none; }
	#iim-tcm .iim-tcm-iprice { grid-column: 2; grid-row: 3; flex-direction: row; align-items: center; gap: 8px; }
	#iim-tcm .iim-tcm-iqty { display: inline-flex; order: 0; }
	#iim-tcm .iim-tcm-iunit { order: 1; }
	#iim-tcm .iim-tcm-imoney { order: 2; margin-inline-start: auto; }
	#iim-tcm .iim-tcm-imoney strong { font-size: 14.5px; }
	#iim-tcm .iim-tcm-ofoot { padding: 11px 12px; }
	#iim-tcm .iim-tcm-view { height: 40px; }

	#iim-tcm .iim-tcm-prod { grid-template-columns: 18px 42px minmax( 0, 1fr ); gap: 10px; }
	#iim-tcm .iim-tcm-prod .iim-tcm-thumb { width: 42px; height: 42px; }
	#iim-tcm .iim-tcm-pqty { grid-column: 3; flex-direction: row; align-items: baseline; justify-content: space-between; margin-top: -4px; }
}

@media ( prefers-reduced-motion: reduce ) {
	#iim-tcm .iim-tcm-sheet, #iim-tcm .iim-tcm-backdrop, #iim-tcm .iim-tcm-tabbar, #iim-tcm .iim-tcm-obody, #iim-tcm .iim-tcm-pbar i, #iim-tcm .iim-tcm-chev { transition: none !important; }
	#iim-tcm .iim-tcm-order, #iim-tcm .iim-tcm-prod, #iim-tcm .iim-tcm-panel { animation: none !important; opacity: 1 !important; transform: none !important; }
	#iim-tcm .iim-tcm-skel { animation: none !important; }
}
@media print { #iim-tcm { display: none !important; } .iim-top-customer-go { display: none !important; } }
