/* ============================================================
   سوبرماركت السلط — تصميم عصري
   ============================================================ */
*{box-sizing:border-box;margin:0;padding:0;}
:root{
  --brand:#0f766e; --brand-d:#115e59; --brand-l:#ccfbf1;
  --bg:#f3f5f8; --card:#ffffff; --ink:#0f172a; --muted:#64748b; --line:#e6ebf1;
  --blue:#2563eb; --purple:#7c3aed; --red:#e11d48; --amber:#e08600; --ok:#059669;
  --shadow:0 1px 2px rgba(15,23,42,.04), 0 6px 20px rgba(15,23,42,.06);
  --shadow-lg:0 18px 50px rgba(15,23,42,.16);
  --r:14px;
}
html,body{height:100%;}
body{
  font-family:"Segoe UI","Cairo",Tahoma,Arial,sans-serif;
  background:var(--bg); color:var(--ink); -webkit-font-smoothing:antialiased;
}
.hidden{display:none !important;}
button{font-family:inherit;cursor:pointer;border:none;border-radius:11px;font-size:15px;transition:transform .06s ease, background .15s ease, box-shadow .15s ease;}
button:active{transform:translateY(1px);}
input,select{font-family:inherit;font-size:15px;padding:12px 14px;border:1.5px solid var(--line);border-radius:11px;background:#fff;color:var(--ink);width:100%;transition:border .15s, box-shadow .15s;}
input:focus,select:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-l);}
.muted{color:var(--muted);}
.error{color:var(--red);min-height:18px;font-size:13px;margin-top:2px;}

/* ---------- تسجيل الدخول ---------- */
.login-view{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:16px;
  background:radial-gradient(1200px 600px at 50% -10%, #14b8a6 0%, #0d9488 40%, #0b6b64 100%);}
.login-card{background:var(--card);padding:34px 30px;border-radius:22px;box-shadow:var(--shadow-lg);width:100%;max-width:370px;display:flex;flex-direction:column;gap:13px;}
.login-card h1{font-size:24px;text-align:center;color:var(--brand-d);letter-spacing:-.3px;}
.login-card button[type=submit]{background:var(--brand);color:#fff;padding:14px;font-weight:800;font-size:16px;box-shadow:0 8px 20px rgba(13,148,136,.28);}
.login-card button[type=submit]:hover{background:var(--brand-d);}
.hint{font-size:12px;color:var(--muted);text-align:center;}

/* ---------- الشريط العلوي ---------- */
.topbar{display:flex;align-items:center;gap:14px;background:#fff;padding:10px 18px;box-shadow:var(--shadow);position:sticky;top:0;z-index:5;}
.brand{font-weight:800;font-size:18px;color:var(--brand-d);white-space:nowrap;letter-spacing:-.3px;}
.tabs{display:flex;gap:6px;overflow-x:auto;flex:1;padding:3px;scrollbar-width:thin;}
.tabs::-webkit-scrollbar{height:6px;} .tabs::-webkit-scrollbar-thumb{background:var(--line);border-radius:6px;}
.tab{background:transparent;color:var(--muted);padding:9px 15px;font-weight:600;font-size:13.5px;white-space:nowrap;border-radius:999px;}
.tab:hover{background:var(--bg);color:var(--ink);}
.tab.active{background:var(--brand);color:#fff;box-shadow:0 4px 12px rgba(13,148,136,.3);}
.user-box{display:flex;align-items:center;gap:10px;font-size:13px;white-space:nowrap;}
.shift-btn{background:var(--brand-l);color:var(--brand-d);padding:8px 13px;font-weight:800;font-size:13px;}
.shift-btn:hover{background:#bff3ea;}
.link{background:none;color:var(--muted);text-decoration:none;padding:5px 7px;font-weight:600;}
.link:hover{color:var(--ink);}
.link.del{color:var(--red);}

/* ---------- عام ---------- */
.view{padding:20px 18px;}

/* ---------- البيع ---------- */
.pos-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;max-width:1150px;margin:0 auto;}
.scan-row{display:flex;gap:8px;}
.scan-row button{background:var(--brand);color:#fff;padding:0 20px;font-weight:700;}
.scan-row button:hover{background:var(--brand-d);}
#scanInput{font-size:17px;}
.search-results{margin-top:12px;display:flex;flex-direction:column;gap:7px;max-height:60vh;overflow:auto;}
.result{display:flex;justify-content:space-between;align-items:center;background:#fff;border:1.5px solid var(--line);padding:14px 16px;text-align:right;border-radius:12px;font-weight:600;}
.result:hover{border-color:var(--brand);background:#f8fffe;}
.result.new{border-style:dashed;border-color:var(--brand);color:var(--brand-d);justify-content:center;}
.r-price{color:var(--muted);font-size:13px;font-weight:500;}
.pad{padding:14px;}

.held-bar{display:flex;gap:8px;margin-bottom:12px;}
.held-b{flex:1;background:#fff;color:var(--ink);border:1.5px solid var(--line);padding:11px;font-weight:700;font-size:13.5px;}
.held-b:hover{border-color:var(--brand);color:var(--brand-d);}

.cart-table,.prod-table{width:100%;border-collapse:separate;border-spacing:0;background:#fff;border-radius:var(--r);overflow:hidden;box-shadow:var(--shadow);}
.cart-table th,.cart-table td,.prod-table th,.prod-table td{padding:12px 12px;border-bottom:1px solid var(--line);text-align:right;font-size:14px;}
.cart-table th,.prod-table th{background:#f7f9fb;color:var(--muted);font-weight:700;font-size:12.5px;text-transform:none;}
.prod-table tbody tr:hover,.cart-table tbody tr:hover{background:#f9fbfc;}
.cart-table .empty td,.prod-table .empty td{text-align:center;color:var(--muted);padding:26px;}
.qty{white-space:nowrap;}
.qty button{width:32px;height:32px;background:var(--bg);font-weight:800;font-size:18px;color:var(--ink);border-radius:9px;}
.qty button:hover{background:#e2e8f0;}
.qty span{display:inline-block;min-width:28px;text-align:center;font-weight:700;}
.rm{background:none;font-size:16px;padding:4px;}
.totals{margin:14px 0;}
.grand{font-size:26px;font-weight:800;text-align:left;letter-spacing:-.5px;}
.pay-row{display:grid;grid-template-columns:1fr 1fr;gap:11px;}
.pay{padding:17px;font-weight:800;font-size:17px;color:#fff;box-shadow:0 6px 16px rgba(15,23,42,.1);}
.pay:hover{filter:brightness(1.05);}
.pay.cash{background:var(--brand);} .pay.card{background:var(--blue);} .pay.qr{background:var(--purple);}
.pay.debt{background:var(--amber);} .pay.clear{background:var(--red);}
.today{margin-top:14px;text-align:center;color:var(--muted);font-size:14px;background:#fff;padding:12px;border-radius:12px;box-shadow:var(--shadow);}

/* ---------- الأصناف / موردين / إلخ ---------- */
.products-head,.recv-head,.exp-head{display:flex;gap:10px;align-items:center;flex-wrap:wrap;max-width:1050px;margin:0 auto 14px;}
.products-head #newProdBtn,.exp-head #addExpBtn,.products-head #newSupplierBtn2,.products-head #newUserBtn,.products-head #newCustBtn{background:var(--brand);color:#fff;padding:0 18px;white-space:nowrap;font-weight:700;height:46px;}
.products-head #newProdBtn:hover,.exp-head #addExpBtn:hover{background:var(--brand-d);}
.btn-sm{background:var(--brand);color:#fff;padding:0 14px;white-space:nowrap;height:46px;}
.btn-waste{background:var(--amber);color:#fff;padding:0 16px;white-space:nowrap;font-weight:700;height:46px;}
.prod-table{max-width:1050px;margin:0 auto;}
.prod-table td.low{color:var(--red);font-weight:800;}
.recv-head{max-width:1150px;} .recv-head select{max-width:260px;}
.pay-toggle{display:flex;gap:10px;align-items:center;}
.pay-toggle label{display:flex;align-items:center;gap:6px;background:#fff;border:1.5px solid var(--line);padding:9px 13px;border-radius:11px;cursor:pointer;font-weight:600;font-size:14px;}
.pay-toggle input[type=date]{width:auto;}
#receiveView,#suppliersView,#expensesView,#reportsView,#invoicesView,#customersView,#settingsView{max-width:1150px;margin:0 auto;}
#receiveView .grand{margin:14px 0;}
.cell-inp{width:92px;padding:7px;text-align:center;}

/* ---------- التقارير ---------- */
.rep-period,.aud-filter{display:flex;gap:8px;justify-content:center;margin-bottom:16px;flex-wrap:wrap;}
.per,.iper,.aud{background:#fff;border:1.5px solid var(--line);padding:9px 22px;font-weight:700;color:var(--muted);}
.per.active,.iper.active,.aud.active{background:var(--brand);color:#fff;border-color:var(--brand);}
.rep-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:10px;}
.rcard{background:#fff;border-radius:var(--r);padding:18px;text-align:center;box-shadow:var(--shadow);}
.rcard.core{background:linear-gradient(135deg,#0d9488,#0f766e);color:#fff;}
.rcard.core .rc-label{color:#d1faf3;}
.rc-label{color:var(--muted);font-size:13px;margin-bottom:8px;font-weight:600;}
.rc-val{font-size:24px;font-weight:800;letter-spacing:-.5px;}
.rep-h{margin:20px 0 9px;color:var(--brand-d);font-size:16px;font-weight:800;}
.dukhan-box{background:linear-gradient(135deg,#fff7e6,#fdefcf);border:1.5px solid #f0c674;border-radius:var(--r);padding:15px;text-align:center;margin-bottom:8px;font-weight:700;color:#8a5a00;}

/* ---------- الفواتير ---------- */
.ret td{background:#fff1f4;}
.paid{color:var(--ok);font-weight:800;}

/* ---------- المودالات ---------- */
.modal{position:fixed;inset:0;background:rgba(15,23,42,.5);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;padding:16px;z-index:35;}/* 0.4.74: فوق الشريط العلوي لشاشة البيع (z 25، كان يغطي عنوان النافذة) وشريط التنقل (30)، وتحت التنبيه flash (40) والقوائم والنوافذ الرقمية (50–60) */
.modal-card{background:#fff;padding:24px;border-radius:20px;width:100%;max-width:440px;display:flex;flex-direction:column;gap:11px;box-shadow:var(--shadow-lg);max-height:92vh;overflow:auto;}
.modal-card h3{color:var(--brand-d);font-size:18px;}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.modal-actions{display:flex;justify-content:flex-start;gap:10px;margin-top:6px;align-items:center;}
.modal-actions>button:first-child{background:var(--brand);color:#fff;padding:12px 26px;font-weight:800;}
.modal-actions>button:first-child:hover{background:var(--brand-d);}
.chk{display:flex;align-items:center;gap:7px;cursor:pointer;font-size:14px;}
.chk input{width:auto;}
.pay small,.pos-funcs small{opacity:.55;font-size:11px;font-weight:700;}
.perm-title{font-size:13px;font-weight:700;color:var(--muted);margin-top:4px;}
.perm-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;background:var(--bg);padding:12px;border-radius:12px;}
.perm-grid .chk{font-size:13px;}

/* ---------- الإعدادات ---------- */
.set-card{max-width:720px;margin:0 auto 14px;background:#fff;border-radius:var(--r);padding:24px;display:flex;flex-direction:column;gap:13px;box-shadow:var(--shadow);}
.set-card h3{color:var(--brand-d);}
.set-row{font-size:14px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.mono{font-family:Consolas,monospace;font-size:12px;color:var(--muted);word-break:break-all;}
.set-actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;}
#saveLocalSet,#backupNowBtn,#saveTg{background:var(--brand);color:#fff;padding:12px 22px;font-weight:800;}
#saveLocalSet:hover,#backupNowBtn:hover,#saveTg:hover{background:var(--brand-d);}
.danger-btn{background:var(--red);color:#fff;padding:12px 22px;font-weight:800;max-width:300px;}

/* ---------- إشعار ---------- */
.flash{position:fixed;bottom:22px;left:50%;transform:translateX(-50%) translateY(90px);background:#0f172a;color:#fff;padding:14px 24px;border-radius:14px;opacity:0;transition:.28s cubic-bezier(.2,.8,.2,1);z-index:40;font-weight:700;box-shadow:var(--shadow-lg);}
.flash.show{transform:translateX(-50%) translateY(0);opacity:1;}
.flash.ok{background:var(--brand-d);} .flash.err{background:var(--red);}

/* ---------- المستندات المطبوعة — قالب واحد لكل ما يُطبع ---------- */
/* كل مستند يُبنى في ‎#receipt‎ بنفس الترويسة (docHeader في app.js): إيصال حراري بعرض 72mm (فاتورة/مرتجع/طلب موقع/ورقة تجهيز/تقرير شفت)
   أو مستند بعرض الصفحة A4 مع ‎body.print-wide‎ (إقفال اليوم/تقرير الفترة/كشف حساب العميل).
   هامش الصفحة صفر على الإيصال: لا يطبع المتصفح ترويسته/تذييله (التاريخ والرابط)، ولا يضيع عرض الورق الحراري. */
#receipt{display:none;}
@page{margin:0;}
/* مستند بعرض الصفحة: هوامش عادية، وترقيم الصفحات من عندنا بدل ترويسة/تذييل المتصفح (التاريخ والرابط).
   لا نفرض مقاس الورق: يُؤخذ من الطابعة المختارة (A4 عادةً). المقاسات نسبية (vw/auto-fit) فيبقى التقرير مقروءًا حتى على ورق الطابعة الحرارية. */
@page wide{margin:11mm 9mm 13mm;@top-center{content:"";}@bottom-center{content:"صفحة " counter(page) " من " counter(pages);font:10px Tahoma,Arial,sans-serif;color:#000;}}
@media print{
  /* dir="rtl" على <html> لا يكفي دائمًا لمحرك الطباعة (خصوصًا طابعات الإيصال الحرارية) — نفرض RTL صراحة هنا
     حتى لا ينعكس ترتيب الأعمدة (الصنف/الكمية/المبلغ) أو يلتبس نص عربي مجاور لأرقام LTR. */
  html,body{background:#fff !important;margin:0 !important;padding:0 !important;height:auto !important;min-height:0 !important;min-width:0 !important;overflow:visible !important;}
  body > *:not(#receipt){display:none !important;}
  #receipt{display:block;direction:rtl;unicode-bidi:embed;box-sizing:border-box;width:var(--receipt-width,44mm);max-width:100%;margin:0 auto;position:relative;left:var(--receipt-offset,0mm);padding:2mm 0 7mm;color:#000;font:11px/1.45 Tahoma,'Segoe UI',Arial,sans-serif;-webkit-print-color-adjust:exact;print-color-adjust:exact;}
  #receipt *{box-sizing:border-box;color:#000;}
  #receipt table{width:100%;margin:0;border:0;border-collapse:collapse;border-radius:0;background:none;box-shadow:none;direction:rtl;}
  /* تصفير تنسيقات جداول الشاشة (خلفيات رمادية/حدود فاتحة) — الطابعة الحرارية أبيض وأسود فقط */
  #receipt th,#receipt td{border:0;background:none;box-shadow:none;font-size:inherit;}
  #receipt tr{break-inside:avoid;background:none;}
  /* الترويسة الموحّدة */
  #receipt .rc-head{padding-bottom:2mm;border-bottom:2px solid #000;text-align:center;}
  #receipt .rc-name{font-size:21px;font-weight:800;line-height:1.25;}
  #receipt .rc-latin{direction:ltr;font-size:9.5px;font-weight:700;letter-spacing:3.5px;}
  #receipt .rc-contact{margin-top:1mm;font-size:10px;}
  #receipt .rc-contact>span{display:block;}
  #receipt .rc-title{width:fit-content;min-width:62%;margin:2.5mm auto 1mm;padding:1mm 4mm;border:1.5px solid #000;border-radius:2mm;text-align:center;font-size:13px;font-weight:800;}
  #receipt .rc-sub{margin-bottom:1mm;text-align:center;font-size:10.5px;font-weight:700;}
  /* صفوف «البيان ← القيمة» */
  #receipt .rc-rows{margin-top:1.5mm;}
  #receipt .rc-rows td{padding:.55mm 0;vertical-align:top;text-align:right;}
  #receipt .rc-rows td:first-child{padding-inline-end:3mm;white-space:nowrap;}
  #receipt .rc-rows td:last-child{text-align:left;font-weight:700;}
  #receipt .rc-lined td{padding:.9mm 0;}
  #receipt .rc-lined tr{border-bottom:1px dotted #000;}
  #receipt .rc-rows tr.rc-strong td{font-size:13px;font-weight:800;}
  /* جدول الأصناف */
  #receipt .rc-items{margin-top:2mm;border-top:1.5px solid #000;}
  #receipt .rc-items thead tr{border-bottom:1px solid #000;}
  #receipt .rc-items tbody tr{border-bottom:1px dotted #000;}
  #receipt .rc-items tbody tr:last-child{border-bottom:1.5px solid #000;}
  #receipt .rc-items th{padding:1mm .6mm;font-size:10px;font-weight:800;text-align:right;}
  #receipt .rc-items td{padding:1mm .6mm;vertical-align:top;text-align:right;overflow-wrap:anywhere;}
  #receipt .rc-items th:nth-child(n+2),#receipt .rc-items td:nth-child(n+2){width:1%;padding-inline:1.4mm;text-align:center;white-space:nowrap;}
  #receipt .rc-items th:last-child,#receipt .rc-items td:last-child{padding-inline-end:0;text-align:left;}
  #receipt .rc-items td:last-child{font-weight:700;}
  #receipt .rc-items small{display:block;direction:ltr;text-align:right;font-size:9px;}
  /* ورقة التجهيز: مربع تأشير · اسم الصنف (يأخذ العرض) · الكمية */
  #receipt .rc-pick th:first-child,#receipt .rc-pick td:first-child{width:1%;padding-inline-end:2mm;}
  #receipt .rc-pick th:nth-child(2),#receipt .rc-pick td:nth-child(2){width:auto;padding-inline:.6mm;text-align:right;white-space:normal;}
  #receipt .rc-pick td:last-child{font-size:13px;}
  #receipt .rc-box{display:inline-block;width:3.6mm;height:3.6mm;border:1.2px solid #000;vertical-align:middle;}
  #receipt .rc-count{margin:1.2mm 0 0;text-align:center;font-size:10px;}
  /* الإجمالي والدفع */
  #receipt .rc-total{display:flex;align-items:baseline;justify-content:space-between;gap:3mm;margin:2mm 0 1mm;padding:1.4mm 2.5mm;border:2px solid #000;border-radius:2mm;font-size:17px;font-weight:800;line-height:1.3;}
  #receipt .rc-flag{margin:2mm 0 0;padding:1.2mm 2mm;border:1.5px dashed #000;border-radius:2mm;text-align:center;font-size:12px;font-weight:800;}
  #receipt .rc-note{margin-top:2mm;padding-top:1.2mm;border-top:1px dashed #000;font-size:10.5px;}
  #receipt .rc-foot{margin-top:3mm;padding-top:2mm;border-top:1px dashed #000;text-align:center;font-size:11.5px;font-weight:700;}
  #receipt .rc-foot small{display:block;margin-top:.6mm;font-size:9.5px;font-weight:400;}
  #receipt .rc-sign{display:flex;justify-content:space-between;gap:7mm;margin-top:11mm;font-size:10px;}
  #receipt .rc-sign span{flex:1;padding-top:1mm;border-top:1px solid #000;text-align:center;}
  #receipt .rc-num{display:inline-block;direction:ltr;unicode-bidi:isolate;}
  /* مستند بعرض الصفحة */
  body.print-wide #receipt{page:wide;width:auto;max-width:none;margin:0;padding:0;font-size:clamp(9.5px,1.75vw,12px);line-height:1.55;}
  body.print-wide #receipt .rc-head{padding-bottom:3mm;}
  body.print-wide #receipt .rc-name{font-size:clamp(20px,3.5vw,25px);}
  body.print-wide #receipt .rc-latin{font-size:clamp(9.5px,1.55vw,11px);letter-spacing:clamp(3.5px,.7vw,5px);}
  body.print-wide #receipt .rc-contact{font-size:clamp(10px,1.65vw,11.5px);}
  body.print-wide #receipt .rc-title{min-width:0;margin-top:4mm;padding:1.5mm clamp(4mm,4.5vw,9mm);font-size:clamp(13px,2.3vw,16px);}
  body.print-wide #receipt .rc-sub{font-size:clamp(10.5px,1.75vw,12px);}
  body.print-wide #receipt .rc-body{margin-top:3mm;}
  body.print-wide #receipt .rc-body table{margin:2mm 0 4mm;}
  body.print-wide #receipt .rc-body th,body.print-wide #receipt .rc-body td{padding:1.2mm clamp(.8mm,1.3vw,2.5mm);border:1px solid #777;text-align:right;overflow-wrap:anywhere;}
  body.print-wide #receipt .rc-body th{background:#e9e9e9;font-weight:800;}
  body.print-wide #receipt thead{display:table-header-group;}
  body.print-wide #receipt h1,body.print-wide #receipt h2,body.print-wide #receipt h3,body.print-wide #receipt h4{margin:4mm 0 1.5mm;break-after:avoid;font-size:clamp(11.5px,2vw,14px);}
  body.print-wide #receipt p{margin:1mm 0;}
  body.print-wide #receipt button,body.print-wide #receipt summary,body.print-wide #receipt input,body.print-wide #receipt select{display:none !important;}
  body.print-wide #receipt .panel,body.print-wide #receipt details{margin:2mm 0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;}
  body.print-wide #receipt .table-scroll{overflow:visible;}
  body.print-wide #receipt .metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(max(27mm,22%),1fr));gap:2mm;margin:2mm 0 3mm;}
  body.print-wide #receipt .metrics article{padding:1.6mm 2.5mm;border:1px solid #777;border-radius:1.5mm;background:none;break-inside:avoid;}
  body.print-wide #receipt .metrics span{display:block;margin:0 0 .6mm;font-size:clamp(9px,1.5vw,10.5px);}
  body.print-wide #receipt .metrics b{display:block;font-size:clamp(12px,2.1vw,15px);}
  body.print-wide #receipt .rc-totals{width:max(62%,min(100%,56mm));margin-inline-start:auto;}
  body.print-wide #receipt .rc-totals td:last-child{font-weight:800;text-align:left;white-space:nowrap;}
  body.print-wide #receipt .rc-totals th:last-child{text-align:left;white-space:nowrap;}
  body.print-wide #receipt .rc-printed{margin-top:1mm;font-size:10px;text-align:center;}
}

@media(max-width:820px){
  .pos-grid{grid-template-columns:1fr;}
  .rep-cards{grid-template-columns:repeat(2,1fr);}
  .topbar{flex-wrap:wrap;}
}
/* ---------- استلام: Modal التغليف (لمس/هاتف) ---------- */
.recv-seg{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0;}
.recv-seg .recv-unit{min-width:90px;padding:12px 14px;font-weight:700;}
.recv-field{display:flex;flex-direction:column;gap:4px;}
.recv-field input{min-height:44px;font-size:1.05rem;}
.recv-bonus{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:10px 0;}
.recv-bonus-btn{min-width:64px;}
.recv-extra{display:flex;flex-wrap:wrap;gap:14px;align-items:center;margin:8px 0;}
.recv-summary{background:var(--bg,#eef3f8);border-radius:12px;padding:14px;margin:12px 0;font-size:1.1rem;line-height:1.9;}
.attach-box{border:1px dashed var(--line,#cbd5e1);border-radius:12px;padding:12px;margin:12px 0;}
.attach-thumb{margin:8px 0;}
/* تسوية فاتورة الشراء + سياق المورد */
.context-chip{display:inline-flex;align-items:center;gap:8px;background:var(--brand-l);color:var(--brand-d);border-radius:999px;padding:7px 14px;font-weight:700;margin-bottom:10px;}
.context-chip .link{color:var(--brand-d);}
.settle-options{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:8px 0;}
.settle-opt{display:flex;flex-direction:column;align-items:flex-start;gap:3px;text-align:right;background:#fff;border:1.5px solid var(--line);padding:14px 16px;border-radius:14px;min-height:64px;}
.settle-opt b{font-size:1rem;}
.settle-opt small{color:var(--muted);font-weight:600;font-size:.8rem;line-height:1.4;}
.settle-opt.primary small{color:rgba(255,255,255,.9);}
.settle-extra{margin:12px 0;background:var(--bg);border-radius:12px;padding:8px 14px;}
.settle-extra summary{cursor:pointer;font-weight:700;color:var(--muted);padding:6px 0;}
.settle-extra[open] summary{margin-bottom:8px;}
@media(max-width:520px){.settle-options{grid-template-columns:1fr;}}

.perm-section{margin:4px 0;}
.perm-section h4{margin:8px 0 4px;color:var(--muted);font-size:13px;}
/* منتجات الموقع — أداة التصوير وقائمة «بحاجة إلى صورة» */
.online-prod{display:flex;align-items:center;gap:12px}
.op-thumb{width:56px;height:56px;flex:0 0 56px;border-radius:10px;overflow:hidden;background:var(--bg);display:grid;place-items:center}
.op-thumb img{width:100%;height:100%;object-fit:cover}
.op-noimg{font-size:10px;color:var(--muted);text-align:center;line-height:1.3}
.op-info{flex:1;min-width:0}
.op-info b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.op-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.photo-preview{max-width:100%;max-height:320px;border-radius:12px;display:block;margin:8px auto}
#onlineTabs{flex-wrap:wrap;margin-bottom:10px}
@media print {
 body.receipt-narrow:not(.print-wide) #receipt .rc-name { font-size: 18px; }
 body.receipt-narrow:not(.print-wide) #receipt .rc-items { table-layout: fixed; }
 body.receipt-narrow:not(.print-wide) #receipt .rc-items th:first-child, body.receipt-narrow:not(.print-wide) #receipt .rc-items td:first-child { width: 40%; white-space: normal; overflow-wrap: anywhere; }
 body.receipt-narrow:not(.print-wide) #receipt .rc-items th:nth-child(n+2), body.receipt-narrow:not(.print-wide) #receipt .rc-items td:nth-child(n+2) { width: auto; padding-inline: .4mm; font-size: 10px; white-space: normal; overflow-wrap: anywhere; }
 body.receipt-narrow:not(.print-wide) #receipt .rc-items small { font-size: 8px; }
 body.receipt-narrow:not(.print-wide) #receipt .rc-latin { letter-spacing: 1px; }
 body.receipt-narrow:not(.print-wide) #receipt .rc-total { font-size: 15px; padding-inline: 1mm; gap: 1mm; }
 body.receipt-narrow:not(.print-wide) #receipt .rc-rows td:first-child { white-space: nowrap; padding-inline-end: 1.5mm; font-size: 10px; }
body.receipt-narrow:not(.print-wide) #receipt .rc-rows td:last-child { font-size: 10px; overflow-wrap: anywhere; }
}

#settingsView h4{margin:12px 0 0;padding-top:14px;border-top:1px solid #dbe2ea;}
#connectionUpdateCard{border:2px solid #166534;}
#desktopUpdateActions[hidden]{display:none;}
#settingsView button{min-height:46px;}
/* 0.4.47 — every user starts on the sale screen; without «البيع» it is locked with a clear note and the user's own sections */
#posView.pos-locked > :not(#posLockedNote){display:none !important}
.pos-locked-note{display:flex;justify-content:center;align-items:flex-start;flex:1;width:100%;padding:32px 16px}
.pos-locked-card{max-width:520px;width:100%;background:#fff;border:1px solid #e6ebf1;border-radius:16px;padding:22px;text-align:center;box-shadow:0 6px 24px rgba(15,23,42,.06)}
.pos-locked-card h2{margin:0 0 8px}.pos-locked-card p{color:#475569;margin:0 0 14px}
.pos-locked-links{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.pos-locked-links button{min-height:44px;padding:8px 16px;border-radius:10px;border:1px solid #d6dde6;background:#f8fafc;font-weight:700;cursor:pointer}
/* 0.4.47 — reports refresh as soon as a filter changes */
#rangeReport.report-loading{opacity:.55;transition:opacity .15s;pointer-events:none}
.range-hint{margin:8px 0 0;color:#b45309}
.delivery-unset{background:#fff7e6;border:1px solid #f0c96b;color:#7a4b00}

/* 0.4.77 — أصناف الفاتورة على الورق الضيق بسطرين (الاسم، ثم الكمية × السعر والمبلغ) بلا كسر للأرقام؛ العريض كما هو */
@media print {
 #receipt .rc-items{border-bottom:1.5px solid #000;}
 #receipt .rc-items .rc-n-name,#receipt .rc-items .rc-n-nums,#receipt .rc-items .rc-cols-narrow{display:none;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items{table-layout:auto;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items .rc-wide,body.receipt-narrow:not(.print-wide) #receipt .rc-items .rc-cols{display:none;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items .rc-n-name,body.receipt-narrow:not(.print-wide) #receipt .rc-items .rc-n-nums,body.receipt-narrow:not(.print-wide) #receipt .rc-items .rc-cols-narrow{display:table-row;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items .rc-cols-narrow th{width:auto;padding:1mm 0;font-size:9.5px;white-space:nowrap;text-align:right;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items .rc-cols-narrow th:last-child{text-align:left;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items tr.rc-n-name{border-bottom:0;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items tr.rc-n-name td{width:auto;padding:1mm 0 .3mm;text-align:right;white-space:normal;overflow-wrap:anywhere;font-size:inherit;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items tr.rc-n-nums td{width:auto;padding:0 0 1mm;text-align:right;white-space:nowrap!important;overflow-wrap:normal!important;font-size:10.5px;}
 body.receipt-narrow:not(.print-wide) #receipt .rc-items tr.rc-n-nums td:last-child{text-align:left;font-weight:700;}
}
