*{box-sizing:border-box} [hidden]{display:none!important}
:root{font-family:"Segoe UI",Tahoma,sans-serif;color:#2c2522;background:#f5f2ed}
body{margin:0} header{height:80px;background:#fff;border-bottom:1px solid #e7dfd6;display:flex;align-items:center;gap:21px;padding-inline:clamp(18px,5vw,75px)}
header img{width:150px} h1{border-inline-start:1px solid #e7dfd6;padding-inline-start:21px;font-size:1.25rem} h2{font-size:1.03rem;margin:0}
main{max-width:1300px;margin:auto;padding:28px;display:grid;grid-template-columns:minmax(310px,385px) minmax(0,1fr);gap:25px;align-items:start}
form,.preview{background:#fff;border:1px solid #e7dfd6;border-radius:14px;padding:22px} form h2{margin-bottom:20px}
label{display:grid;gap:7px;margin:0 0 13px;font-weight:600;font-size:.87rem}
input,select,textarea,button{font:inherit} input,select,textarea{width:100%;padding:9px 10px;border:1px solid #cbbfb3;border-radius:7px;background:white;color:#2c2522} textarea{resize:vertical}
:focus-visible{outline:2px solid #896334;outline-offset:2px}
.row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.row:has([hidden]){grid-template-columns:1fr}
button{cursor:pointer;border:1px solid #d9cdbf;border-radius:7px;color:#4b3624;background:#faf7f2;padding:8px 11px;font-weight:600;font-size:.85rem}
button:hover{background:#f0e6d8}.primary{width:100%;background:#57243a;color:white;border-color:#57243a;padding:12px}.primary:hover{background:#743650}
p{font-size:.85rem;line-height:1.6;margin:9px 0} p:empty{display:none} #catalog-status{color:#554534} #errors,#discount-status{color:#a21d2a}
.preview{background:#eae5de}.preview-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.preview-head span{font-size:.79rem;color:#51473d}
#sheet{max-width:500px;margin:auto;box-shadow:0 8px 27px #48362625;container-type:inline-size}
#card{width:100%;aspect-ratio:148/210;position:relative;overflow:hidden;background:#fff;color:#0a0a0a;--accent:#762347;--gold:#b78f4c;font-family:Arial,Tahoma,sans-serif}
#card[data-template=special]{--accent:#153f70}
#card>*{position:absolute;margin:0}.original{inset:0;width:100%;height:100%;display:none}
.brand{top:6%;left:24%;width:52%}.brand img{width:100%;display:block}
.headline{top:23%;left:9%;width:82%;text-align:center;color:var(--accent);border-block:1px solid var(--gold);padding:2.8cqw 0;display:grid;gap:1.4cqw}
.headline strong{font-size:8.5cqw;line-height:1.15}.headline small{font-size:2.5cqw;color:var(--accent);font-weight:bold;letter-spacing:.17em}
.product{top:43%;left:10%;width:80%;text-align:center;line-height:1.15;font-size:5.4cqw;overflow-wrap:anywhere}
.product>*{display:block}.product b{font-size:.87em}
.amount{top:59%;width:88%;left:6%;display:flex;justify-content:center;align-items:baseline;gap:2.5cqw;color:#b91f2a;font-size:13.5cqw;line-height:1}
.currency{display:inline-flex;align-self:center;font-size:.48em}.currency svg{width:1em;height:1.05em;fill:currentColor}
.meta{top:74%;width:100%;text-align:center;font-size:3.6cqw;line-height:1.02}
.barcode{top:78%;left:18%;width:64%;height:8%;text-align:center;direction:ltr}
.barcode svg{display:block;width:100%;height:74%}.barcode span{display:block;font-size:2.9cqw;line-height:1.05;letter-spacing:.08em}
.footer{bottom:5%;width:100%;text-align:center;line-height:1.35;font-size:3cqw;color:#302822;display:grid;gap:.8cqw}
.footer b{font-size:2.7cqw}.footer span{letter-spacing:.12em}
.percent,.was,.unit,.meta time{display:none}
[data-template=discount] .original,[data-template=discount] .meta time{display:block}
[data-template=discount] :is(.brand,.headline,.footer){display:none}
[data-template=discount] .meta{top:25.7%;right:14%;width:auto;text-align:right;font-size:3.65cqw;font-weight:700;line-height:.98}
[data-template=discount] .percent:not(:empty){display:block;top:25.7%;left:16.7%;background:#d00000;color:#fff;border-radius:1.15cqw;padding:1.25cqw 1.05cqw;font-size:7.1cqw;font-weight:800;line-height:1.14}
[data-template=discount] .was:has(s:not(:empty)){display:block;top:33.5%;right:14%;font-weight:600;font-size:4.05cqw}
[data-template=discount] .amount{width:auto;left:auto;right:14%;top:41.8%;color:#000;font-size:10.6cqw;gap:3cqw}
[data-template=discount] .amount .currency{font-size:.8em}
[data-template=discount] .product{top:53.4%;right:14%;left:auto;width:70%;text-align:right;font-size:4.3cqw;line-height:1}
[data-template=discount] .unit{display:block;top:61.3%;right:14%;font-weight:700;font-size:3.6cqw}
[data-template=discount] .barcode{top:65.8%;left:31%;width:41%;height:8%}
@media(max-width:760px){main{grid-template-columns:1fr;padding:14px;gap:14px} header{height:65px} header img{width:113px}}
@media print{
  :root{background:white}
  html,body,main,.preview{margin:0!important;padding:0!important;display:block!important;background:#fff;border:0;max-width:none}
  header,form,.preview-head{display:none!important}
  #sheet{max-width:none;box-shadow:none;margin:0}
  #card{aspect-ratio:auto;width:100%;height:var(--height);print-color-adjust:exact;-webkit-print-color-adjust:exact}
}
#card .product strong{font-family:"Segoe UI",Tahoma,Arial,sans-serif}
#card[data-template=discount] .product{top:52.8%}
#card[data-template=discount] .unit{top:62.6%}
#card[data-template=discount] .barcode{top:66.5%}
#card[data-template=last] .product:has(strong:not(:empty))::before{
  content:"آخر حبة";display:table;margin:0 auto 1.25cqw;color:#523132;
  background:#f5ead7;padding:.45cqw 2cqw;font-size:2.5cqw;font-weight:700
}
@media print{#sheet{width:var(--width)}}

