/* Um Alaa: the printed purchase order (طلب شراء).
   Screen: a sheet on a grey desk with a small toolbar.
   Print: only the sheet, A4, 12mm margins, no browser furniture. */
:root{
  --wine:#73284a; --ink:#241016; --line:#b9a3ac; --soft:#f4eef1;
}
*{box-sizing:border-box}
html,body{margin:0;background:#e9e3e6;color:var(--ink);
  font-family:"Cairo",Marhey,"Segoe UI",Tahoma,system-ui,sans-serif}
body{padding:18px 10px 60px}

.toolbar{max-width:210mm;margin:0 auto 14px;display:flex;gap:8px;justify-content:flex-start}
.btn{border:0;border-radius:10px;padding:10px 16px;background:var(--wine);color:#ffd23f;
  font-family:inherit;font-size:14px;font-weight:700;cursor:pointer;text-decoration:none;display:inline-block}
.btn.line{background:#fff;color:var(--wine);border:2px solid #e2d3da}
.note{max-width:210mm;margin:0 auto 14px;background:#fff6d8;border:1px solid #e8d79a;border-radius:10px;
  padding:10px 12px;font-size:13px;line-height:1.7}

/* ------------------------------------------------------------------ sheet */
.sheet{
  width:210mm;min-height:297mm;margin:0 auto;background:#fff;padding:12mm;
  box-shadow:0 10px 30px rgba(40,8,22,.18);
  display:flex;flex-direction:column;
}
.head{display:flex;justify-content:space-between;align-items:flex-start;gap:10mm;
  border-bottom:2px solid var(--wine);padding-bottom:4mm}
.head .shop{font-size:22px;font-weight:700;color:var(--wine);line-height:1.2}
.head .tag{font-size:11.5px;color:#5d4450;margin-top:2mm}
.head .side{text-align:left;font-size:11.5px;line-height:1.9;color:#3d2a33;min-width:60mm}
.head .side b{color:var(--wine)}

h1.title{font-size:20px;text-align:center;margin:6mm 0 5mm;letter-spacing:.5px;color:var(--wine)}
h1.title span{display:block;font-size:10.5px;color:#7b6670;font-weight:400;letter-spacing:0;margin-top:1mm}

.meta{display:flex;flex-wrap:wrap;gap:3mm 8mm;font-size:12px;margin-bottom:4mm}
.meta div{min-width:48mm}
.meta .name{font-weight:700}
.meta b{color:var(--wine);font-weight:700}
.meta .fill{border-bottom:1px dotted var(--line);padding:0 2mm;min-width:26mm;display:inline-block}

table{width:100%;border-collapse:collapse;font-size:12px}
th,td{border:1px solid var(--line);padding:2.2mm 2mm;text-align:center}
thead th{background:var(--soft);color:var(--wine);font-size:12px;font-weight:700}
td.name{text-align:right;font-weight:600}
td.num{font-variant-numeric:tabular-nums}
tbody tr:nth-child(even) td{background:#fcfafb}
tfoot td{font-weight:700;background:#fff}

.totals{margin-top:4mm;display:flex;justify-content:flex-start}
.totals table{width:78mm;font-size:12.5px}
.totals td{padding:2mm 3mm;text-align:right}
.totals td.v{text-align:left;font-variant-numeric:tabular-nums;width:30mm}
.totals tr.grand td{background:var(--soft);color:var(--wine);font-size:14px;font-weight:700}

.foot{margin-top:auto;padding-top:6mm}
.foot .hand{border-top:1px solid var(--line);padding-top:3mm;font-size:12px;display:flex;
  justify-content:space-between;gap:10mm}
.foot .hand .sig{color:#5d4450}
.foot .thanks{margin-top:4mm;text-align:center;font-size:11px;color:#7b6670}

/* ------------------------------------------------------------------ print */
@page{size:A4 portrait;margin:12mm}
@media print{
  html,body{background:#fff;padding:0;margin:0}
  .toolbar,.note{display:none !important}
  /* A4 minus the 12mm margins, so the signature line sits at the foot of the page */
  .sheet{width:auto;min-height:calc(297mm - 24mm);margin:0;padding:0;box-shadow:none}
  thead{display:table-header-group}
  tr,img{page-break-inside:avoid}
  /* margin-top:auto from the sheet's flex column puts the signatures at the foot */
  .foot{margin-top:auto}
}
@media screen and (max-width:900px){
  .sheet{width:100%;min-height:0;padding:14px}
  .head{flex-direction:column;gap:6px}
  .head .side{text-align:right}
  .totals table{width:100%}
}
