/* Moazen Pre-Invoice v1.0.0 */
.mpi {
	--mpi-accent: #f6b400;
	--mpi-ink: #16181d;
	--mpi-muted: #6b7280;
	--mpi-faint: #9aa0aa;
	--mpi-line: #ececef;
	--mpi-soft: #f6f6f8;
	--mpi-danger: #c0263b;
	--mpi-ok: #12805c;
	max-width: 1200px;
	margin: 0 auto;
	padding: 28px 24px 72px;
	color: var(--mpi-ink);
	direction: rtl;
	text-align: right;
	font-family: inherit;
	box-sizing: border-box;
}
.mpi *, .mpi *::before, .mpi *::after { box-sizing: border-box; }
.mpi svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Steps */
.mpi-steps { display: flex; gap: 8px; list-style: none; margin: 0 0 28px; padding: 0; counter-reset: s; font-size: 13px; }
.mpi-steps li { flex: 1; position: relative; padding-top: 14px; color: var(--mpi-faint); counter-increment: s; }
.mpi-steps li::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 4px; border-radius: 4px; background: var(--mpi-line); }
.mpi-steps li.is-done::before, .mpi-steps li.is-current::before { background: var(--mpi-accent); }
.mpi-steps li.is-current { color: var(--mpi-ink); font-weight: 700; }
.mpi-steps a { color: inherit; text-decoration: none; }

/* Request page */
.mpi-request__grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }
.mpi-card { background: #fff; border: 1px solid var(--mpi-line); border-radius: 18px; padding: 28px; }
.mpi-title { margin: 0 0 8px; font-size: 24px; font-weight: 800; line-height: 1.4; color: var(--mpi-ink); }
.mpi-lead { margin: 0 0 24px; font-size: 14px; line-height: 2; color: var(--mpi-muted); }
.mpi-alert { margin-bottom: 20px; padding: 12px 16px; border-radius: 12px; background: #fdecee; color: var(--mpi-danger); font-size: 14px; }
.mpi-alert p { margin: 2px 0; }
.mpi-form { margin: 0; }
.mpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mpi-field { display: block; margin-bottom: 18px; }
.mpi-field > span { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.mpi-field b { color: var(--mpi-danger); font-weight: 400; }
.mpi-field small { color: var(--mpi-faint); font-weight: 400; }
.mpi-field input, .mpi-field textarea {
	width: 100%; min-height: 48px; padding: 12px 14px; margin: 0;
	border: 1px solid #dcdee3; border-radius: 12px; background: #fff;
	font: inherit; font-size: 15px; color: var(--mpi-ink); box-shadow: none; transition: border-color .15s, box-shadow .15s;
}
.mpi-field input[dir=ltr] { text-align: left; }
.mpi-field input:focus, .mpi-field textarea:focus { outline: none; border-color: var(--mpi-ink); box-shadow: 0 0 0 3px rgba(22,24,29,.08); }
.mpi-field input.is-invalid { border-color: var(--mpi-danger); }
.mpi-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.mpi-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	height: 50px; padding: 0 22px; border-radius: 12px; border: 1px solid var(--mpi-line);
	background: #fff; color: var(--mpi-ink); font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer;
	transition: transform .1s, box-shadow .2s, background .2s;
}
.mpi-btn:hover { box-shadow: 0 6px 18px rgba(16,24,40,.08); }
.mpi-btn:active { transform: translateY(1px); }
.mpi-btn--primary { background: var(--mpi-ink); border-color: var(--mpi-ink); color: #fff; }
.mpi-btn--primary:hover { color: #fff; }
.mpi-btn--ghost { border-color: transparent; background: transparent; color: var(--mpi-muted); }
.mpi-btn--block { width: 100%; margin-top: 6px; }
.mpi-btn[disabled] { opacity: .6; pointer-events: none; }

/* Summary */
.mpi-summary { position: sticky; top: 24px; padding: 24px; }
.mpi-summary__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mpi-summary__head h2 { margin: 0; font-size: 17px; font-weight: 800; color: var(--mpi-ink); }
.mpi-summary__head a { font-size: 13px; color: var(--mpi-muted); }
.mpi-items { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; }
.mpi-items li { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--mpi-line); }
.mpi-items__img img { width: 56px !important; height: 56px !important; object-fit: contain; border-radius: 10px; background: var(--mpi-soft); }
.mpi-items__name { font-size: 13px; line-height: 1.8; }
.mpi-items__name small { display: block; color: var(--mpi-faint); font-size: 12px; }
.mpi-items__total { font-size: 14px; font-weight: 700; white-space: nowrap; }
.mpi-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 4px; }
.mpi-total span { font-size: 14px; color: var(--mpi-muted); }
.mpi-total strong { font-size: 20px; font-weight: 800; }
.mpi-total small { font-size: 12px; font-weight: 400; color: var(--mpi-muted); }
.mpi-note { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: #fff8e1; font-size: 12.5px; line-height: 2; color: #6b5000; }

/* Invoice page */
.mpi-success { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; padding: 18px 20px; border-radius: 16px; background: #e9f7f1; color: #0b5d43; }
.mpi-success svg { width: 28px; height: 28px; color: var(--mpi-ok); }
.mpi-success strong { display: block; font-size: 16px; }
.mpi-success p { margin: 4px 0 0; font-size: 14px; }
.mpi-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.mpi-paper-wrap { overflow-x: auto; padding: 4px; }

/* A4 sheet (794 × 1123 px @96dpi) */
.mpi-paper {
	width: 794px; min-height: 1123px; margin: 0 auto; padding: 48px 52px 40px;
	background: #fff; color: #16181d; direction: rtl; text-align: right;
	box-shadow: 0 2px 24px rgba(16,24,40,.08); border-radius: 4px;
	display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.9;
}
.mpi-paper, .mpi-paper *, .mpi-paper *::before, .mpi-paper *::after { box-sizing: border-box; }
.mpi-paper * { letter-spacing: 0 !important; }
.mpi-paper svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mpi-paper__head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 20px; border-bottom: 3px solid var(--mpi-accent); }
.mpi-paper__brand { display: flex; flex-direction: column; gap: 6px; }
.mpi-paper__brand img { max-width: 170px; max-height: 64px; width: auto; height: auto; object-fit: contain; }
.mpi-paper__brand span { font-size: 13px; color: #6b7280; }
.mpi-paper__title { text-align: left; }
.mpi-paper__title h2 { margin: 0 0 6px; font-size: 26px; font-weight: 800; line-height: 1.3; color: #16181d; text-align: left; }
.mpi-paper__title dl { margin: 0; }
.mpi-paper__title dl div { display: flex; justify-content: flex-end; gap: 10px; font-size: 12.5px; }
.mpi-paper__title dt { color: #6b7280; }
.mpi-paper__title dd { margin: 0; font-weight: 700; min-width: 80px; text-align: left; }

.mpi-paper__callout { display: flex; align-items: center; gap: 10px; margin: 20px 0; padding: 12px 16px; border-radius: 10px; background: #16181d; color: #fff; font-size: 14px; font-weight: 700; }
.mpi-paper__callout svg { width: 18px; height: 18px; color: var(--mpi-accent); }

.mpi-paper__parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.mpi-paper__parties section { padding: 12px 16px; border: 1px solid #ececef; border-radius: 10px; }
.mpi-paper__parties h3 { margin: 0 0 4px; font-size: 11.5px; font-weight: 700; color: #9aa0aa; }
.mpi-paper__parties p { margin: 0; }

.mpi-paper__table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 12px; }
.mpi-paper__table th { padding: 10px 8px; background: #f6f6f8; border-top: 1px solid #ececef; border-bottom: 1px solid #ececef; font-weight: 700; text-align: right; white-space: nowrap; color: #16181d; }
.mpi-paper__table th small { display: block; font-weight: 400; color: #9aa0aa; font-size: 10.5px; line-height: 1.4; }
.mpi-paper__table td { padding: 10px 8px; border-bottom: 1px solid #ececef; vertical-align: top; }
.mpi-paper__table tr { page-break-inside: avoid; break-inside: avoid; }
.mpi-paper__table .c-n { width: 40px; text-align: center; color: #9aa0aa; }
.mpi-paper__table .c-sku { width: 72px; }
.mpi-paper__table .c-name small { display: block; color: #6b7280; font-size: 11px; }
.mpi-paper__table .c-q { width: 52px; text-align: center; }
.mpi-paper__table .c-p, .mpi-paper__table .c-t { width: 110px; text-align: left; white-space: nowrap; }
.mpi-paper__table td.c-t { font-weight: 700; }

.mpi-paper__bottom { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; page-break-inside: avoid; break-inside: avoid; }
.mpi-paper__notes p { margin: 0 0 8px; font-size: 12px; color: #4b5160; }
.mpi-paper__warn { padding: 10px 14px; border-radius: 10px; background: #fff8e1; border-right: 3px solid var(--mpi-accent); color: #5a4300 !important; }
.mpi-paper__totals { margin: 0; border: 1px solid #ececef; border-radius: 10px; overflow: hidden; }
.mpi-paper__totals div { display: flex; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid #ececef; }
.mpi-paper__totals div:last-child { border-bottom: 0; }
.mpi-paper__totals dt { color: #6b7280; }
.mpi-paper__totals dd { margin: 0; font-weight: 700; }
.mpi-paper__totals .is-grand { background: #16181d; color: #fff; }
.mpi-paper__totals .is-grand dt { color: rgba(255,255,255,.75); }
.mpi-paper__totals .is-grand dd { font-size: 15px; }
.mpi-paper__totals small { font-size: 10.5px; font-weight: 400; opacity: .8; }

.mpi-paper__foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 18px; border-top: 1px solid #ececef; font-size: 11px; color: #9aa0aa; }

/* Responsive */
@media (max-width: 960px) {
	.mpi { padding: 18px 16px 56px; }
	.mpi-request__grid { grid-template-columns: 1fr; }
	.mpi-summary { position: static; order: -1; }
	.mpi-card { padding: 20px; border-radius: 16px; }
}
@media (max-width: 560px) {
	.mpi-row { grid-template-columns: 1fr; gap: 0; }
	.mpi-actions .mpi-btn { flex: 1 1 100%; }
	.mpi-steps { font-size: 12px; }
}

/* Print: only the sheet */
@media print {
	@page { size: A4; margin: 0; }
	body * { visibility: hidden !important; }
	.mpi-paper, .mpi-paper * { visibility: visible !important; }
	.mpi-paper { position: absolute; top: 0; right: 0; left: 0; box-shadow: none; border-radius: 0; margin: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Theme overrides (some themes style dl/dt/dd/h2/h3 globally) */
.mpi .mpi-paper dl, .mpi .mpi-paper dt, .mpi .mpi-paper dd { font-size: 12.5px; line-height: 1.9; margin: 0; padding: 0; float: none; width: auto; }
.mpi .mpi-paper .mpi-paper__title dt { color: #6b7280; font-weight: 400; }
.mpi .mpi-paper .mpi-paper__totals dt { font-weight: 400; }
.mpi .mpi-paper .mpi-paper__totals .is-grand dd { font-size: 15px; }
.mpi .mpi-paper h2 { font-size: 26px; letter-spacing: 0; }
.mpi .mpi-paper h3 { font-size: 11.5px; letter-spacing: 0; }
.mpi-paper dl, .mpi-paper dt, .mpi-paper dd { font-size: 12.5px; line-height: 1.9; margin: 0; padding: 0; }
