/* قالب الفاتورة الجديد (A4، عربي RTL). مصمَّم على عرض 794px (= A4 على 96dpi) ويُصغَّر على الشاشات الصغيرة
   بـ zoom على الغلاف .inv2-fit (لا على الورقة نفسها، فتبقى الطباعة والتصوير بالمقاس الحقيقي).
   اللون الرئيسي (الذهبي) من --accent. لا نستعمل color-mix ولا inset shadow لأن html2canvas لا يدعمهما. */

@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url(vendor/fonts/tajawal-400-arabic.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url(vendor/fonts/tajawal-400-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap; src: url(vendor/fonts/tajawal-500-arabic.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap; src: url(vendor/fonts/tajawal-500-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url(vendor/fonts/tajawal-700-arabic.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url(vendor/fonts/tajawal-700-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }
@font-face { font-family: "Tajawal"; font-weight: 800; font-display: swap; src: url(vendor/fonts/tajawal-800-arabic.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Tajawal"; font-weight: 800; font-display: swap; src: url(vendor/fonts/tajawal-800-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }

.inv2-fit { width: 794px; max-width: none; margin: 12px auto 0; }

.inv2 {
  --accent: #AC7C4C;
  --on-accent: #ffffff;
  --dark: #212428;
  --bg: #F6F2ED;
  --surface: #F3ECE6;
  --line: #E5DED8;
  --ink: #1B1B1B;
  width: 794px;
  min-height: 1123px;
  display: flex;
  flex-direction: column;
  direction: rtl;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.inv2, .inv2 * { box-sizing: border-box; }
.inv2 h1, .inv2 h2, .inv2 p, .inv2 ul { margin: 0; padding: 0; }
.inv2 svg.ic { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.inv2 .ltr { direction: ltr; unicode-bidi: embed; }

/* ---------- الترويسة ---------- */
.inv2-head { display: flex; align-items: flex-start; gap: 20px; padding: 0 29px; min-height: 244px; }
.inv2-meta { flex: none; width: 150px; padding-top: 44px; display: flex; flex-direction: column; gap: 17px; }
.inv2-meta-row { display: flex; align-items: center; gap: 10px; }
.inv2-meta-row svg.ic { font-size: 27px; color: var(--accent); }
.inv2-meta-row .l { display: block; font-size: 15px; font-weight: 500; }
.inv2-meta-row .v { display: block; font-size: 16px; text-align: right; direction: ltr; }
.inv2-vr { flex: none; width: 1px; height: 167px; margin-top: 45px; background: #D9D0C7; }
.inv2-title { flex: 1; min-width: 0; padding-top: 50px; text-align: center; }
.inv2-title h1 { font-size: 82px; line-height: 1.05; font-weight: 800; color: #111; }
.inv2-title .en { margin-top: 8px; font-size: 26px; font-weight: 500; color: var(--accent); letter-spacing: .45em; padding-inline-start: .45em; direction: ltr; }
.inv2-rule { position: relative; width: 222px; height: 9px; margin: 14px auto 0; }
.inv2-rule::before { content: ""; position: absolute; inset-inline: 0; top: 4px; height: 1px; background: var(--accent); }
.inv2-rule::after { content: ""; position: absolute; top: 0; left: 50%; margin-left: -4px; width: 8px; height: 8px; transform: rotate(45deg); background: var(--bg); border: 1px solid var(--accent); }
.inv2-badge {
  flex: none; width: 211px; height: 242px; padding: 16px 16px 24px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--dark); border: 3px solid var(--accent); border-top: 0; border-radius: 0 0 92px 92px;
  color: var(--accent); text-align: center; font-size: 30px; font-weight: 800; line-height: 1.2;
}
.inv2-badge img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

/* ---------- الجسم ---------- */
.inv2-body { flex: 1; display: flex; flex-direction: column; gap: 17px; padding: 17px 29px 24px; }
.inv2-sec { break-inside: avoid; }
.inv2-box { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }

.inv2-parties { display: flex; align-items: stretch; gap: 23px; }
.inv2-parties > * { flex: 1; min-width: 0; }
.inv2-cust-head { display: flex; align-items: stretch; height: 36px; background: var(--dark); color: #fff; }
.inv2-cust-head .tab { width: 50px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); font-size: 21px; }
.inv2-cust-head .t { flex: 1; display: flex; align-items: center; padding-inline: 12px; font-size: 17px; font-weight: 700; }
.inv2-field { display: flex; align-items: center; gap: 10px; height: 43px; padding-inline: 14px; border-top: 1px solid var(--line); }
.inv2-field:first-of-type { border-top: 0; }
.inv2-field svg.ic { font-size: 21px; color: var(--accent); }
.inv2-field .l { width: 82px; flex: none; font-size: 13.5px; font-weight: 500; }
.inv2-field .v { flex: 1; min-width: 0; font-size: 13.5px; text-align: right; overflow-wrap: anywhere; }
.inv2-thanks { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 14px; text-align: center; }
.inv2-thanks .ring { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--dark); color: var(--accent); font-size: 30px; margin-bottom: 6px; }
.inv2-thanks h2 { font-size: 23px; font-weight: 700; }
.inv2-thanks p { font-size: 20px; }
.inv2-thanks .bar { width: 78px; height: 3px; margin-top: 8px; background: var(--accent); border-radius: 2px; }

.inv2-items { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--surface); }
.inv2-items table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.inv2-items th { height: 40px; padding: 0 10px; background: var(--dark); color: #fff; font-size: 15px; font-weight: 700; text-align: center; border-inline-start: 1px solid rgba(255, 255, 255, .13); }
.inv2-items th:first-child, .inv2-items td:first-child { border-inline-start: 0; }
.inv2-items td { height: 34px; padding: 0 10px; font-size: 14.5px; text-align: center; border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); overflow-wrap: anywhere; }
.inv2-items tbody tr:nth-child(odd) td { background: #F9F6F2; }
.inv2-items tbody tr:nth-child(even) td { background: #F3ECE6; }
.inv2-items tr { break-inside: avoid; page-break-inside: avoid; }
.inv2-items thead { display: table-header-group; }
.inv2-items .c-name { text-align: right; }
.inv2-items td.n { direction: ltr; font-variant-numeric: tabular-nums; }
.inv2-items .w-no { width: 9%; } .inv2-items .w-qty { width: 16%; } .inv2-items .w-price { width: 22%; } .inv2-items .w-total { width: 20%; }

.inv2-summary { display: flex; align-items: flex-start; gap: 23px; }
.inv2-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.inv2-totals { flex: none; width: 348px; }
.inv2-trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 41px; padding-inline: 16px; border-top: 1px solid var(--line); font-size: 15.5px; }
.inv2-trow:first-child { border-top: 0; }
.inv2-trow .l { font-weight: 700; }
.inv2-trow .v { direction: ltr; font-variant-numeric: tabular-nums; }
.inv2-trow.is-total { height: 39px; background: var(--dark); color: #fff; }
.inv2-trow.is-remaining { height: 51px; background: var(--accent); color: var(--on-accent); font-size: 22px; }
.inv2-trow.is-remaining .v { font-size: 23px; font-weight: 700; }
.inv2-trow .cur { font-size: 12px; font-weight: 400; margin-inline-start: 4px; }

.inv2-pay { display: flex; }
.inv2-pay > div { flex: 1; min-width: 0; padding: 10px 14px; }
.inv2-pay > div + div { border-inline-start: 1px solid var(--line); }
.inv2-ptitle { display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.inv2-ptitle svg.ic { font-size: 20px; }
.inv2-opt { display: flex; align-items: center; gap: 8px; font-size: 13.5px; line-height: 1.5; }
.inv2-opt .rd { position: relative; flex: none; width: 13px; height: 13px; border: 1.5px solid #8A8178; border-radius: 50%; }
.inv2-opt.on .rd { border-color: var(--dark); }
.inv2-opt.on .rd::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--dark); }
.inv2-count { text-align: center; }
.inv2-count .n { display: block; font-size: 18px; font-weight: 500; line-height: 1.2; }
.inv2-count .u { font-size: 13.5px; }

.inv2-notes { position: relative; padding: 10px 14px 14px; }
.inv2-notes::after { content: ""; position: absolute; inset-inline: 10px; bottom: 6px; border-bottom: 1px dashed #D2B99C; }
.inv2-notes ul { list-style: none; }
.inv2-notes li { position: relative; padding-inline-start: 14px; font-size: 13px; line-height: 1.55; }
.inv2-notes li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--dark); }

/* ---------- الشريط السفلي ---------- */
.inv2-foot {
  margin-top: auto; display: flex; align-items: center; min-height: 95px; padding: 18px 29px 12px;
  background: var(--dark); color: #fff;
  border-top: 3px solid var(--accent); border-radius: 55% 45% 0 0 / 14px 7px 0 0;
}
.inv2-fg { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding-inline: 18px; min-height: 58px; font-size: 13.5px; }
.inv2-fg + .inv2-fg { border-inline-start: 1px solid rgba(255, 255, 255, .22); }
.inv2-fg:first-child { padding-inline-start: 0; }
.inv2-fg:last-child { padding-inline-end: 0; }
.inv2-fg svg.ic { font-size: 20px; color: var(--accent); }
.inv2-fg .col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.inv2-fg .row { display: flex; align-items: center; gap: 8px; }
.inv2-fg .row .ltr { text-align: left; overflow-wrap: anywhere; }
.inv2-addr { overflow-wrap: anywhere; line-height: 1.5; }
.inv2-qr { flex: none; width: 62px; height: 62px; padding: 3px; background: #fff; border-radius: 6px; }
.inv2-qr img { width: 100%; height: 100%; display: block; }
.inv2-social { display: flex; gap: 8px; }
.inv2-social span { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 15px; }
.inv2-web { color: var(--accent); font-size: 14px; direction: ltr; text-align: left; }

/* ---------- صورة المشاركة والطباعة ---------- */
.inv2.capture { box-shadow: none; }

@page { size: A4; margin: 0; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; min-height: 0 !important; height: auto !important; }
  .inv-page, .page { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .inv2-fit { zoom: 1 !important; width: 210mm; margin: 0; }
  .inv2 { width: 210mm; min-height: 296mm; box-shadow: none; }
  .inv2, .inv2 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- كشف الحساب ---------- */
.inv2-title h1.md { font-size: 52px; line-height: 1.15; }
.inv2-title h1.md + .en { font-size: 19px; letter-spacing: .32em; padding-inline-start: .32em; }
.inv2-title .per { margin-top: 10px; font-size: 13px; color: #5b524a; }

.inv2-kpis { display: flex; flex: 1.25; }
.inv2-kpis .k { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px 6px; text-align: center; }
.inv2-kpis .k + .k { border-inline-start: 1px solid var(--line); }
.inv2-kpis .k svg.ic { font-size: 31px; color: var(--accent); margin-bottom: 4px; }
.inv2-kpis .kl { font-size: 12.5px; font-weight: 500; line-height: 1.3; min-height: 2.6em; display: flex; align-items: center; }
.inv2-kpis .kv { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.inv2-kpis .kc { font-size: 11.5px; }
.inv2-kpis .gold .kl, .inv2-kpis .gold .kv { color: var(--accent); }

.inv2-stmt td { height: 30px; font-size: 13px; padding: 0 8px; }
.inv2-stmt th { font-size: 13.5px; padding: 0 6px; }
.inv2-stmt .w-no { width: 6%; } .inv2-stmt .w-date { width: 15%; } .inv2-stmt .w-dc { width: 17%; } .inv2-stmt .w-bal { width: 16%; }

/* ---------- وصل القبض (حجم ~A5) ---------- */
.inv2-rcpt { width: 560px; min-height: 0; }
.inv2-head.sm { min-height: 176px; gap: 14px; padding: 0 22px; }
.inv2-head.sm .inv2-meta { width: 140px; padding-top: 34px; gap: 12px; }
.inv2-head.sm .inv2-meta-row svg.ic { font-size: 22px; }
.inv2-head.sm .inv2-meta-row .l { font-size: 12.5px; }
.inv2-head.sm .inv2-meta-row .v { font-size: 13.5px; }
.inv2-head.sm .inv2-vr { height: 110px; margin-top: 34px; }
.inv2-head.sm .inv2-title { padding-top: 36px; }
.inv2-title h1.sm { font-size: 42px; line-height: 1.15; }
.inv2-title h1.sm + .en { font-size: 14px; letter-spacing: .3em; padding-inline-start: .3em; margin-top: 4px; }
.inv2-head.sm .inv2-rule { width: 150px; margin-top: 10px; }
.inv2-head.sm .inv2-badge { width: 130px; height: 158px; padding: 10px 10px 16px; border-radius: 0 0 58px 58px; font-size: 20px; }
.inv2-rcpt .inv2-body { padding: 16px 22px 20px; gap: 14px; }
.inv2-rcpt .inv2-totals { width: auto; }
.inv2-sign { display: flex; gap: 28px; margin-top: 8px; }
.inv2-sign > div { flex: 1; text-align: center; font-size: 13px; color: #4a433c; }
.inv2-sign i { display: block; margin-top: 34px; border-top: 1px solid #5b524a; }
.inv2-rnote { text-align: center; font-size: 13px; font-weight: 700; color: var(--accent); }
.inv2-rcpt .inv2-foot { min-height: 80px; padding: 14px 22px 10px; border-radius: 55% 45% 0 0 / 12px 6px 0 0; }
.inv2-rcpt .inv2-fg { padding-inline: 12px; font-size: 12px; }
.inv2-rcpt .inv2-qr { width: 52px; height: 52px; }

@media print {
  .inv2.inv2-rcpt { width: 148mm; min-height: 0; margin: 0 auto; }
}

.inv2-title h1 { white-space: nowrap; }
.inv2-head.wm .inv2-meta { width: 188px; }
.inv2-title h1.md { font-size: 40px; }
.inv2-title h1.sm { font-size: 36px; }

.inv2-title h1.md { font-size: 33px; }

.inv2-kpis .k { padding-inline: 10px; }
.inv2-kpis .kv { white-space: nowrap; max-width: 100%; }

/* المبالغ مع العملة: الرقم ثم الرمز بترتيب القراءة العربي (955,000 د.ع) */
.inv2 .v.money { direction: rtl; unicode-bidi: isolate; }
