/**
 * سیستم طراحی میخریم — روشن، مینیمال، پستلی.
 * راست‌چین به‌صورت ذاتی نوشته شده (خصوصیت‌های منطقی: inline-start/inline-end).
 */

.mkh {
	/* سطوح */
	--bg: #ffffff;
	--surface: #f7f9fc;
	--surface-2: #edf1f7;
	--border: #e1e7f0;

	/* برند — برگرفته از لوگو */
	--primary: #2a5caa;
	--primary-soft: #e4ecf9;
	--primary-deep: #0e3170;
	--accent: #f59300;
	--accent-soft: #fff1dc;
	--accent-deep: #8a5200;

	/* متن */
	--text: #14181f;
	--muted: #5f6875;

	/* وضعیت */
	--success: #1e7a55;
	--success-soft: #d9f0e4;
	--warning: #8a6209;
	--warning-soft: #fdf0d3;
	--danger: #b03c33;
	--danger-soft: #f9dedb;
	--info: #2a5caa;
	--info-soft: #e4ecf9;
	--teal-soft: #d6ecef;
	--purple-soft: #e6e3f5;

	/* شکل */
	--r-card: 14px;
	--r-control: 10px;
	--shadow: 0 1px 2px rgba(27, 28, 30, .04), 0 8px 24px rgba(27, 28, 30, .05);

	direction: rtl;
	color: var(--text);
	font-family: Vazirmatn, "IRANSans", system-ui, sans-serif;
	line-height: 1.9;
	min-width: 0;
	max-width: 100%;
}

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

/* کلاس‌های ما display صریح دارند و بر [hidden] مرورگر غلبه می‌کنند. */
.mkh [hidden], .mkh[hidden] { display: none !important; }

.mkh-narrow { max-width: 460px; margin-inline: auto; }

/* ───────────────────────────── تایپوگرافی ───────────────────────────── */

.mkh-h1 { font-size: clamp(1.35rem, 3.4vw, 1.7rem); font-weight: 700; line-height: 1.5; margin: 0 0 4px; }
.mkh-h2 { font-size: 1.2rem; font-weight: 700; line-height: 1.5; margin: 0 0 6px; }
.mkh-h3 { font-size: 1.02rem; font-weight: 700; line-height: 1.6; margin: 0 0 12px; }
.mkh-muted { color: var(--muted); font-size: .92rem; margin: 0 0 16px; }
.mkh-hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.mkh-fineprint { color: var(--muted); font-size: .8rem; text-align: center; margin: 18px 0 0; }
.mkh-sr {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ───────────────────────────── کارت ───────────────────────────── */

.mkh-card {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--r-card);
	box-shadow: var(--shadow);
	padding: 26px;
	margin-bottom: 20px;
}

.mkh-card__head + * { margin-top: 0; }

.mkh-card--center { text-align: center; }
.mkh-card--flush { padding: 0; overflow: hidden; }
.mkh-card--accent { background: var(--accent-soft); border-color: #f6dfb8; }
.mkh-card--accent .mkh-h3 { color: var(--accent-deep); }

.mkh-card__head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 12px; margin-bottom: 12px;
}

/* ───────────────────────────── دکمه ───────────────────────────── */

.mkh-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 11px 22px;
	font: inherit; font-weight: 600; font-size: .95rem;
	border: 1px solid transparent;
	border-radius: var(--r-control);
	cursor: pointer;
	text-decoration: none;
	transition: background-color .15s ease, border-color .15s ease, transform .06s ease;
}

.mkh-btn:active { transform: translateY(1px); }
.mkh-btn[disabled], .mkh-btn.is-busy { opacity: .6; pointer-events: none; }

.mkh-btn--primary { background: var(--primary-deep); color: #fff; }
.mkh-btn--primary:hover { background: #0a2557; color: #fff; }

.mkh-btn--ghost { background: var(--bg); color: var(--text); border-color: var(--border); }
.mkh-btn--ghost:hover { background: var(--surface-2); }

.mkh-btn--block { width: 100%; }

.mkh-linkbtn {
	background: none; border: 0; padding: 0;
	font: inherit; font-size: .88rem; font-weight: 600;
	color: var(--primary-deep); cursor: pointer; text-decoration: none;
}
.mkh-linkbtn:hover { text-decoration: underline; }
.mkh-linkbtn--danger { color: var(--danger); }

.mkh-iconbtn {
	background: none; border: 0; cursor: pointer;
	font-size: 1.3rem; line-height: 1; color: var(--muted);
	width: 30px; height: 30px; border-radius: 8px;
}
.mkh-iconbtn:hover { background: var(--surface-2); color: var(--danger); }

.mkh-copybtn {
	background: var(--primary-soft); color: var(--primary-deep);
	border: 0; border-radius: 8px; padding: 5px 12px;
	font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.mkh-copybtn:hover { background: #cfddf3; }
.mkh-copybtn.is-done { background: var(--success-soft); color: var(--success); }

.mkh-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.mkh-actions--end { justify-content: flex-end; margin-top: 12px; }

/* ───────────────────────────── فرم ───────────────────────────── */

.mkh-field { display: block; margin-bottom: 16px; }
.mkh-field--grow { flex: 1; margin-bottom: 0; }
.mkh-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 7px; color: #3c4046; }

.mkh-input {
	width: 100%;
	padding: 12px 15px;
	font: inherit; font-size: .95rem;
	color: var(--text);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--r-control);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.mkh-input:hover { border-color: #cfd8e6; }
.mkh-input:focus,
.mkh-input:focus-visible {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-soft);
}
.mkh-input[readonly] { background: var(--surface); color: var(--muted); }
.mkh-input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

textarea.mkh-input { resize: vertical; min-height: 84px; }

.mkh-input--otp {
	text-align: center;
	font-size: 1.6rem; font-weight: 700;
	letter-spacing: .5rem; padding-inline: 0;
}

.mkh-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.mkh-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.mkh-inline { display: flex; gap: 10px; align-items: flex-end; }

.mkh-check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; margin: 8px 0; cursor: pointer; }
.mkh-check input { margin-top: 7px; accent-color: var(--primary-deep); }

.mkh-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mkh-choice {
	display: flex; gap: 10px; align-items: flex-start;
	border: 1px solid var(--border); border-radius: var(--r-control);
	padding: 12px 14px; cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease;
}
.mkh-choice:hover { background: var(--surface); }
.mkh-choice input { margin-top: 6px; accent-color: var(--primary-deep); }
.mkh-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mkh-choice strong { display: block; font-size: .92rem; }
.mkh-choice small { color: var(--muted); font-size: .8rem; }

.mkh-file input[type="file"] {
	width: 100%; padding: 14px;
	background: var(--surface); border: 1px dashed var(--border);
	border-radius: var(--r-control); font: inherit; font-size: .85rem;
}

fieldset.mkh-field { border: 0; padding: 0; margin-inline: 0; }
fieldset.mkh-field legend { padding: 0; }

/* ───────────────────────────── هشدار و بج ───────────────────────────── */

.mkh-alert {
	padding: 12px 16px;
	border-radius: var(--r-control);
	font-size: .88rem;
	background: var(--surface);
	margin: 12px 0;
}
.mkh-alert.tone-success { background: var(--success-soft); color: var(--success); }
.mkh-alert.tone-danger { background: var(--danger-soft); color: var(--danger); }
.mkh-alert.tone-warning { background: var(--warning-soft); color: var(--warning); }
.mkh-alert.tone-info { background: var(--info-soft); color: var(--info); }

.mkh-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 999px;
	font-size: .78rem; font-weight: 600;
	white-space: nowrap;
	background: var(--surface-2); color: #5a6472;
}
.mkh-badge.tone-success { background: var(--success-soft); color: var(--success); }
.mkh-badge.tone-warning { background: var(--warning-soft); color: var(--warning); }
.mkh-badge.tone-danger { background: var(--danger-soft); color: var(--danger); }
.mkh-badge.tone-info { background: var(--info-soft); color: var(--info); }
.mkh-badge.tone-accent { background: var(--accent-soft); color: var(--accent-deep); }
.mkh-badge.tone-teal { background: var(--teal-soft); color: #245c53; }
.mkh-badge.tone-purple { background: var(--purple-soft); color: #4c3a73; }

/* ───────────────────────────── باکس لینک (صفحه اصلی) ───────────────────────────── */

.mkh-linkbox {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 10px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: 12px;
	max-width: 620px;
}
.mkh-linkbox__field { margin: 0; }
.mkh-linkbox .mkh-input { border-color: transparent; background: var(--surface); }
.mkh-linkbox__hint {
	grid-column: 1 / -1;
	margin: 0; padding: 0 6px 4px;
	font-size: .78rem; color: var(--muted);
}

/* ───────────────────────────── مراحل ───────────────────────────── */

.mkh-steps {
	display: flex; gap: 8px; list-style: none;
	margin: 0 0 22px; padding: 0;
	width: 100%; max-width: 100%; min-width: 0;
	overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none;
}
.mkh-steps::-webkit-scrollbar { display: none; }

.mkh-step {
	display: flex; align-items: center; gap: 8px;
	flex: 1; min-width: max-content;
	padding: 10px 14px;
	background: var(--surface);
	border-radius: var(--r-control);
	font-size: .85rem; color: var(--muted);
	white-space: nowrap;
}
.mkh-step span {
	display: grid; place-items: center;
	width: 22px; height: 22px; flex-shrink: 0;
	border-radius: 50%;
	background: var(--surface-2); color: var(--muted);
	font-size: .78rem; font-weight: 700;
}
.mkh-step.is-active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.mkh-step.is-active span { background: var(--primary-deep); color: #fff; }
.mkh-step.is-done span { background: var(--success); color: #fff; }

/* ───────────────────────────── ردیف محصول ───────────────────────────── */

.mkh-item {
	border: 1px solid var(--border);
	border-radius: var(--r-card);
	background: var(--surface);
	padding: 18px;
	margin-bottom: 14px;
}
.mkh-item__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mkh-item__index { font-weight: 700; font-size: .9rem; }
.mkh-item__store {
	font-size: .78rem; color: var(--primary-deep);
	background: var(--primary-soft); border-radius: 999px; padding: 2px 10px;
}
.mkh-item__store:empty { display: none; }
.mkh-item__head .mkh-iconbtn { margin-inline-start: auto; }
.mkh-item .mkh-input { background: var(--bg); }

/* ───────────────────────────── چیدمان پنل ───────────────────────────── */

.mkh-panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 250px;
	gap: 24px;
	align-items: start;
}

/* در RTL ستون دوم سمت چپ می‌افتد؛ منوی پنل همان‌جا می‌نشیند. */
.mkh-main { grid-column: 1; grid-row: 1; min-width: 0; }
.mkh-side { grid-column: 2; grid-row: 1; }

.mkh-side {
	position: sticky; top: 100px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--r-card);
	box-shadow: var(--shadow);
	padding: 18px;
}

.mkh-side__user { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.mkh-side__user strong { display: block; font-size: .92rem; }
.mkh-side__user small { color: var(--muted); font-size: .78rem; }

.mkh-avatar {
	display: grid; place-items: center;
	width: 42px; height: 42px; flex-shrink: 0;
	border-radius: 50%;
	background: var(--primary-soft); color: var(--primary-deep);
	font-weight: 700; font-size: 1.1rem;
}

.mkh-nav { display: flex; flex-direction: column; gap: 2px; }
.mkh-nav__item {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 12px;
	border-radius: var(--r-control);
	color: var(--text); text-decoration: none;
	font-size: .9rem;
	transition: background-color .15s ease;
}
.mkh-nav__item:hover { background: var(--surface); color: var(--text); }
.mkh-nav__item.is-active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.mkh-nav__item--muted { color: var(--muted); margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0; padding-top: 14px; }

.mkh-main__head { margin-bottom: 18px; }
.mkh-main__head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ───────────────────────────── آمار ───────────────────────────── */

.mkh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.mkh-stat {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--r-card);
	padding: 16px;
	text-align: center;
}
.mkh-stat strong { display: block; font-size: 1.5rem; line-height: 1.3; }
.mkh-stat span { font-size: .8rem; color: var(--muted); }
.mkh-stat.tone-accent { background: var(--accent-soft); border-color: #f6dfb8; }
.mkh-stat.tone-success { background: var(--success-soft); border-color: #c2e5d5; }
.mkh-stat.tone-info { background: var(--info-soft); border-color: #cddef7; }

/* ───────────────────────────── جدول ───────────────────────────── */

.mkh-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mkh-table th, .mkh-table td { padding: 14px 18px; text-align: start; }
.mkh-table thead th { background: var(--surface); font-size: .8rem; color: var(--muted); font-weight: 600; }
.mkh-table tbody tr { border-top: 1px solid var(--border); }
.mkh-table tbody tr:hover { background: var(--surface); }

.mkh-orderline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mkh-orderline strong { display: block; }
.mkh-orderline small { color: var(--muted); font-size: .8rem; }
.mkh-orderline .mkh-btn { margin-inline-start: auto; }

/* ───────────────────────────── تایم‌لاین ───────────────────────────── */

.mkh-timeline { list-style: none; margin: 0; padding: 0; }
.mkh-timeline__item {
	display: flex; gap: 14px;
	padding-bottom: 18px;
	position: relative;
}
.mkh-timeline__item::before {
	content: "";
	position: absolute;
	inset-inline-start: 5px; top: 16px; bottom: 0;
	width: 2px; background: var(--border);
}
.mkh-timeline__item:last-child::before { display: none; }
.mkh-timeline__dot {
	width: 12px; height: 12px; flex-shrink: 0;
	margin-top: 7px;
	border-radius: 50%;
	background: var(--surface-2);
	position: relative; z-index: 1;
}
.mkh-timeline__item.is-current .mkh-timeline__dot { box-shadow: 0 0 0 4px var(--primary-soft); background: var(--primary-deep); }
.mkh-timeline strong { display: block; font-size: .92rem; }
.mkh-timeline small { color: var(--muted); font-size: .78rem; }
.mkh-timeline p { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }

/* ───────────────────────────── اقلام و فاکتور ───────────────────────────── */

.mkh-items { list-style: none; margin: 0; padding: 0; }
.mkh-items__row {
	display: flex; justify-content: space-between; align-items: center; gap: 14px;
	padding: 14px 0;
	border-bottom: 1px solid var(--border);
}
.mkh-items__row:last-child { border-bottom: 0; padding-bottom: 0; }
.mkh-items__row small { display: block; color: var(--muted); font-size: .8rem; }
.mkh-items__price { white-space: nowrap; font-weight: 600; font-size: .9rem; }

.mkh-invoice { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mkh-invoice th { text-align: start; font-weight: 400; color: var(--muted); padding: 8px 0; }
.mkh-invoice td { text-align: end; padding: 8px 0; }
.mkh-invoice td:nth-child(2) { text-align: start; }
.mkh-invoice tfoot tr { border-top: 1px solid var(--border); }
.mkh-invoice tfoot th, .mkh-invoice tfoot td { padding-top: 14px; color: var(--text); font-weight: 700; }

.mkh-amount { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mkh-amount strong { font-size: 1.35rem; }

/* ───────────────────────────── شماره حساب ───────────────────────────── */

.mkh-accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.mkh-account {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--r-card);
	padding: 18px;
}
.mkh-account__bank { font-weight: 700; font-size: .98rem; }
.mkh-account__owner { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.mkh-account__row {
	display: flex; align-items: center; gap: 8px;
	padding: 7px 0; flex-wrap: wrap;
}
.mkh-account__row > span { font-size: .78rem; color: var(--muted); min-width: 68px; }
.mkh-account__row code {
	background: var(--bg); border: 1px solid var(--border);
	border-radius: 8px; padding: 4px 10px;
	font-size: .88rem; letter-spacing: .04em;
}

/* ───────────────────────────── آدرس‌ها ───────────────────────────── */

.mkh-addresslist { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.mkh-addresscard p { margin: 8px 0 4px; font-size: .88rem; }
.mkh-address { margin: 0; font-size: .9rem; line-height: 2; }

/* ───────────────────────────── پیگیری ───────────────────────────── */

.mkh-result { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 8px; }
.mkh-result__row {
	display: flex; justify-content: space-between; gap: 12px;
	padding: 10px 0; font-size: .9rem;
	border-bottom: 1px solid var(--border);
}
.mkh-result__row:last-child { border-bottom: 0; }
.mkh-result__row > span:first-child { color: var(--muted); }

/* ───────────────────────────── ورود ───────────────────────────── */

.mkh-auth__head { text-align: center; margin-bottom: 22px; }
.mkh-auth__sent { font-size: .85rem; text-align: center; }
.mkh-auth__resend { text-align: center; font-size: .82rem; color: var(--muted); margin: 14px 0 0; }

/* ───────────────────────────── توست ───────────────────────────── */

.mkh-toast {
	position: fixed;
	inset-block-end: 24px; inset-inline-start: 50%;
	transform: translateX(50%) translateY(12px);
	background: var(--text); color: #fff;
	padding: 11px 22px; border-radius: 999px;
	font-size: .85rem; font-family: Vazirmatn, system-ui, sans-serif;
	z-index: 9999; opacity: 0;
	transition: opacity .2s ease, transform .2s ease;
	pointer-events: none;
}
.mkh-toast.is-visible { opacity: 1; transform: translateX(50%) translateY(0); }

/* ───────────────────────────── ریسپانسیو ───────────────────────────── */

@media (max-width: 900px) {
	.mkh-panel { grid-template-columns: 1fr; }
	.mkh-main, .mkh-side { grid-column: 1; grid-row: auto; }
	.mkh-side { position: static; order: -1; }
	.mkh-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
	.mkh-nav::-webkit-scrollbar { display: none; }
	.mkh-nav__item { white-space: nowrap; }
	.mkh-nav__item--muted { border-top: 0; margin-top: 0; padding-top: 10px; border-radius: var(--r-control); }
	.mkh-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
	.mkh-card { padding: 18px; }
	.mkh-grid2, .mkh-grid3, .mkh-choices { grid-template-columns: 1fr; }
	.mkh-accounts, .mkh-addresslist { grid-template-columns: minmax(0, 1fr); }
	.mkh-card, .mkh-item, .mkh-field, .mkh-inline { min-width: 0; max-width: 100%; }
	.mkh { overflow-wrap: anywhere; }
	.mkh-linkbox { grid-template-columns: 1fr; }
	.mkh-inline { flex-direction: column; align-items: stretch; }
	.mkh-inline .mkh-field--grow { margin-bottom: 10px; }

	/* جدول → کارت */
	.mkh-table thead { display: none; }
	.mkh-table, .mkh-table tbody, .mkh-table tr, .mkh-table td { display: block; width: 100%; }
	.mkh-table tr { padding: 14px 18px; border-top: 1px solid var(--border); }
	.mkh-table td { padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
	.mkh-table td::before {
		content: attr(data-label);
		color: var(--muted); font-size: .8rem;
	}
	.mkh-items__row { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.mkh *, .mkh *::before, .mkh *::after { transition: none !important; animation: none !important; }
}
