html,body{max-width:100%;overflow-x:clip}
/* Um Alaa: extra bits for the printed reports (they reuse po.css for the sheet,
   the header and the A4 rules). */
#actions{flex-wrap:wrap;max-width:100%}
.f{font-size:12.5px;color:#5d4450;display:inline-flex;align-items:center;gap:6px}
.f input{border:2px solid #e2d3da;border-radius:8px;padding:7px 8px;font-family:inherit;font-size:13px}
h2.rp{font-size:14px;color:var(--wine);margin:7mm 0 2.5mm;padding-bottom:1mm;border-bottom:1px solid #e6dbe0}
h2.rp:first-child{margin-top:0}
.stats-row{display:flex;flex-wrap:wrap;gap:3mm;margin-bottom:2mm}
.stats-row div{border:1px solid var(--line);border-radius:6px;padding:2.5mm 4mm;min-width:38mm;background:#fcfafb}
.stats-row b{display:block;font-size:15px;color:var(--wine)}
.stats-row span{font-size:11px;color:#7b6670}
table.rp{font-size:11.5px}
table.rp td,table.rp th{padding:1.8mm 2mm}
table.rp td.num,table.rp th.num{font-variant-numeric:tabular-nums}
table.rp tfoot td{background:#f4eef1;color:var(--wine);font-weight:700}
table.rp td.right{text-align:right}
/* تقرير المشتريات: ورقة كاملة لكل فاتورة، بنفس شكل باقي مستندات المحل */
body.docmode .sheet > .head,
body.docmode .sheet > h1.title,
body.docmode .sheet > .meta,
body.docmode .sheet > .foot{display:none}
.pdoc{padding-bottom:4mm}
.pdoc + .pdoc{page-break-before:always;padding-top:2mm}
.pdoc .head{padding-bottom:3mm;border-bottom:2px solid var(--line);margin-bottom:5mm}
.pdoc .title{margin:4mm 0}
.pdoc-totals{width:72mm;margin-inline-end:auto;margin-top:5mm;font-size:12.5px}
.pdoc-totals div{display:flex;justify-content:space-between;gap:6mm;padding:1.8mm 0;border-bottom:1px dotted var(--line)}
.pdoc-totals div.grand{border-top:2px solid var(--wine);border-bottom:0;margin-top:1mm;font-weight:700;color:var(--wine);font-size:14.5px}
.pdoc-foot{margin-top:12mm;text-align:center;font-size:12.5px;font-weight:700;color:var(--wine);border-top:1px solid var(--line);padding-top:3mm}
@media print{
  #filters{display:none !important}
  .pdoc + .pdoc{page-break-before:always}
  h2.rp{page-break-after:avoid}
  table.rp{page-break-inside:auto}
}

/* إجمالي الفترة أسفل صفحات فواتير الشراء */
.pdoc-sum{display:flex;justify-content:space-between;align-items:center;gap:6mm;margin-top:6mm;padding:3mm 4mm;border:2px solid var(--wine);border-radius:6px;background:#fbf5f8;font-size:13.5px;font-weight:700;color:var(--wine)}
.pdoc-sum b{font-size:16px}

/* الورقة اللي بتتنزل PDF/Excel للمورد: نسخة من غير أي مبالغ.
   الأسعار بتفضل ظاهرة على الشاشة بس. */
#printbody{display:none}
@media print{
  body.docmode #body{display:none !important}
  body.docmode #printbody{display:block}
}

/* رسالة قصيرة تحت الشاشة بعد التنزيل أو المشاركة */
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:18px;z-index:80;background:#3d1a2c;color:#fff;
  font-size:13.5px;padding:11px 16px;border-radius:12px;opacity:0;transition:opacity .18s;pointer-events:none;
  max-width:90vw;text-align:center}
.toast.on{opacity:1}

/* خط القاهرة محفوظ مع الموقع نفسه: الملف بيتعمل من غيره نت، والـPDF بيطلع بنفس الخط */
@font-face{font-family:Cairo;font-style:normal;font-weight:400;font-display:swap;src:url(vendor/fonts/cairo-400-ar.woff2) format('woff2');unicode-range:U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;}
@font-face{font-family:Cairo;font-style:normal;font-weight:400;font-display:swap;src:url(vendor/fonts/cairo-400-x.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:Cairo;font-style:normal;font-weight:400;font-display:swap;src:url(vendor/fonts/cairo-400-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:Cairo;font-style:normal;font-weight:700;font-display:swap;src:url(vendor/fonts/cairo-700-ar.woff2) format('woff2');unicode-range:U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;}
@font-face{font-family:Cairo;font-style:normal;font-weight:700;font-display:swap;src:url(vendor/fonts/cairo-700-x.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:Cairo;font-style:normal;font-weight:700;font-display:swap;src:url(vendor/fonts/cairo-700-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}

/* على الموبايل الورقة تفضل في عرض الشاشة، والجدول لو احتاج يتزحلق يتزحلق جوه الورقة بس */
@media screen{
  .sheet{max-width:100%;overflow-x:auto}
  .toolbar{max-width:100%;flex-wrap:wrap}
}

/* موبايل: كل حاجة تفضل جوه عرض الشاشة */
@media screen and (max-width:900px){
  #filters{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;align-items:center}
  #filters .f{display:flex;min-width:0;font-size:12px}
  #filters .f input{width:100%;min-width:0}
  #filters .btn{min-width:0;padding:9px 10px;font-size:13px}
  table.rp{font-size:11px}
  table.rp th,table.rp td{padding:1.4mm 1.2mm}
}

/* شريط الفلاتر: التاريخ في سطر، والأزرار في سطر، كله جوه عرض الشاشة */
#filters{display:flex;flex-wrap:wrap;gap:8px}
#filters .fdates{display:flex;flex-wrap:wrap;gap:8px;flex:1 1 100%;min-width:0}
#filters .fbtns{display:flex;flex-wrap:wrap;gap:8px;min-width:0}
@media screen and (max-width:900px){
  #filters .fdates{flex:1 1 100%}
  #filters .f{flex:1 1 0;min-width:0}
  #filters .f input{width:100%;min-width:0}
  #filters .btn{padding:9px 12px;font-size:13px}
}

/* رسم بياني بالأعمدة — حركة المتجر */
.chart{margin:2mm 0 3mm;overflow:hidden}
.chart .bars{display:flex;align-items:flex-end;gap:1mm;height:42mm;border-bottom:1px solid #d8cfc2;padding-top:5mm}
.chart .b{flex:1 1 0;min-width:2px;background:#8a1c3b;border-radius:2px 2px 0 0;position:relative}
.chart .b i{position:absolute;top:-4.5mm;right:-2mm;left:-2mm;text-align:center;font-size:8px;color:#6b5b63;font-style:normal;white-space:nowrap}
.chart .x{display:flex;gap:1mm;margin-top:1mm}
.chart .x span{flex:1 1 0;min-width:0;font-size:8px;text-align:center;color:#7a6f60;overflow:hidden}
.qnote-line{font-size:10px;color:#7b6670;background:#faf6ef;border:1px solid #e6dccb;border-radius:6px;padding:2mm 3mm;margin:0 0 2mm}

/* اختيار العميل جوه شريط الفترة */
.fparty{max-width:100%;min-width:0}
.fparty .f{width:100%}
.fparty select{border:2px solid #e2d3da;border-radius:8px;padding:7px 8px;font-family:inherit;font-size:13px;max-width:100%;min-width:0;background:#fff}
#p-party{grid-column:1/-1;font-weight:700;color:var(--wine)}

table.rp tfoot td{white-space:nowrap}

bdi{unicode-bidi:isolate;direction:ltr;white-space:nowrap}

/* on a phone the report tables were squeezing the أصناف column to nothing.
   Let the sheet scroll sideways instead; the printed A4 stays as it is. */
@media screen{
  .sheet{overflow-x:auto;-webkit-overflow-scrolling:touch}
  table.rp{min-width:760px}
  table.rp td,table.rp th{white-space:nowrap}
  table.rp td.right{white-space:normal}
}
.pchip{font-weight:700;border-radius:999px;padding:1px 7px;font-size:10.5px;display:inline-block}
.pchip.paid{background:#e8f6ee;color:#1c7a4a}
.pchip.partial{background:#fff4e0;color:#9a6100}
.pchip.unpaid{background:#fdeaea;color:#a11f1f}
