    /* v7.05: رؤوس شبكة المزاد تبقى ظاهرة عند التمرير — الجلسة قد
       تبلغ خمسين بيعة، وبلا الرؤوس لا تعرف أيّ عمود أمامك. */
    #aiTable thead th{
      position: sticky; top: 0; z-index: 12;
      background: var(--card, #fff);
      box-shadow: 0 1px 0 var(--line, #e6e0d6);
    }

    /* v6.92: خانة البحث تبقى ظاهرة مهما تحرّكت الصفحة — فحتى لو
       قفز التمرير، الخانة أمامك ولا تبحث عنها. */
    input[id$="Search"], input[id$="search"], input#cr_q {
      position: sticky; top: 0; z-index: 30;
      background: var(--card, #fff);
    }

    /* ═══════════ v6.88 — إيقاف ضبط التمرير التلقائيّ ═══════════
       عند كتابة أوّل حرف في أيّ بحث ينكمش الجدول من عشرات الصفوف إلى
       ثلاثة. فيُعيد المتصفّح (Chrome/Edge) ضبط موضع التمرير تلقائيّاً
       ليُبقي ما «يراه» ثابتاً — فتقفز الصفحة إلى النتائج وتخرج خانة
       البحث عن الشاشة، فتضطرّ للنقر عليها ثانيةً.
       ⚠ السلوك اسمه Scroll Anchoring، مفعَّل افتراضاً، ولا أثر له في
         أيّ كود لأنّه من المتصفّح لا من الصفحة — ولهذا لم تنفع
         المرساة في v6.72: كانت تصحّح بعد القفزة لا تمنعها.
       ⇒ overflow-anchor:none يمنع الحركة من أصلها. */
    html, body { overflow-anchor: none; }
    .wrap, .card, table, table tbody, table tr { overflow-anchor: none; }

  :root{ --bg:#F8F7F5; --card:#ffffff; --line:#ECE6DB; --ink:#2A1216; --mut:#8B7E83;
         --gold:#D4AF37; --gold-soft:#EAD9A6; --maroon:#5B0F1A; --maroon-2:#7A1522;
         --sidebar:#4A0C14; --sidebar-2:#2F0710; --green:#2E7D5B; --red:#B0392E;
         --radius:16px; --shadow:0 1px 3px rgba(43,18,22,.05), 0 10px 30px rgba(43,18,22,.06);
         /* ===== v2.41: نظام Responsive — Safe Area + مسافات مرنة ===== */
         --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px);
         --safe-s:env(safe-area-inset-inline-start,env(safe-area-inset-left,0px));
         --safe-e:env(safe-area-inset-inline-end,env(safe-area-inset-right,0px));
         --drawerX:-100%; --gap-sm:clamp(8px,2vw,14px); --pad-card:clamp(12px,3vw,18px);
         --hdr-h:56px; }
  html[dir="rtl"]{ --drawerX:100%; }
  *{ box-sizing:border-box; }
  html{ height:100%; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  body{ margin:0; font-family:"Segoe UI",Tahoma,Arial,sans-serif; background:var(--bg);
        color:var(--ink); min-height:100vh; min-height:100dvh; }
  body.drawerLock{ overflow:hidden; }
  .wrap{ max-width:1180px; margin:0 auto; padding:16px; padding-inline:max(16px,var(--safe-s)) max(16px,var(--safe-e)); }
  @media(prefers-reduced-motion:reduce){ .side, #sideBackdrop{ transition:none !important; } }
  /* ===== v2.15: شبكة أزرار العملاء ===== */
  .hubGrid{ display:grid; grid-template-columns:repeat(4,1fr); gap:11px; margin-top:12px; }
  @media(max-width:1000px){ .hubGrid{ grid-template-columns:repeat(2,1fr); } }
  @media(max-width:560px){ .hubGrid{ grid-template-columns:1fr; } }
  .hubBtn{ display:flex; flex-direction:column; align-items:flex-start; gap:4px;
    padding:15px 14px; border-radius:14px; border:1.5px solid var(--line); background:#fff;
    cursor:pointer; text-align:start; transition:transform .12s, box-shadow .12s, border-color .12s;
    min-height:96px; justify-content:center; }
  .hubBtn:hover{ transform:translateY(-2px); box-shadow:0 8px 20px rgba(43,18,22,.10); border-color:var(--gold); }
  .hubBtn .hIc{ font-size:20px; line-height:1; }
  .hubBtn .hT{ font-weight:800; font-size:13.5px; color:var(--ink); }
  .hubBtn .hN{ font-size:20px; font-weight:800; color:var(--maroon); line-height:1.1; }
  .hubBtn .hD{ font-size:11px; color:var(--mut); }
  .hubBtn.gold{ background:linear-gradient(180deg,#FFFDF3,#FBF1D6); border-color:var(--gold); }
  .hubBtn.gold .hN{ color:#8a6d14; }
  .hubBtn.red .hN{ color:var(--red); }
  .hubBtn.red{ border-color:rgba(176,57,46,.35); }
  /* زرّ رجوع أنيق */
  .backBtn{ flex:0; white-space:nowrap; display:inline-flex; align-items:center; gap:7px;
    padding:9px 16px; border-radius:999px; font-weight:800; font-size:13px; cursor:pointer;
    background:#fff; color:var(--maroon); border:1.5px solid var(--gold);
    box-shadow:0 1px 3px rgba(43,18,22,.06); transition:background .14s, transform .14s; }
  .backBtn:hover{ background:linear-gradient(180deg,#FFFDF3,#FBF1D6); transform:translateX(2px); }
  .backBtn .ar{ font-size:15px; line-height:1; }
  [dir="rtl"] .backBtn .ar{ transform:scaleX(-1); }
  /* شبكة الدول */
  .geoGrid{ display:grid; grid-template-columns:repeat(4,1fr); gap:11px; margin-top:12px; }
  @media(max-width:1000px){ .geoGrid{ grid-template-columns:repeat(2,1fr); } }
  @media(max-width:560px){ .geoGrid{ grid-template-columns:1fr; } }
  .geoCard{ display:flex; align-items:center; gap:12px; padding:14px;
    border:1.5px solid var(--line); border-radius:14px; background:#fff; cursor:pointer;
    transition:transform .12s, box-shadow .12s, border-color .12s; }
  .geoCard:hover{ transform:translateY(-2px); box-shadow:0 8px 20px rgba(43,18,22,.10); border-color:var(--gold); }
  .geoCard .fl{ font-size:26px; line-height:1; }
  .geoCard .nm{ font-weight:800; font-size:13.5px; }
  .geoCard .cn{ font-size:19px; font-weight:800; color:var(--maroon); line-height:1.1; }
  .geoCard .pc{ font-size:11px; color:var(--mut); }
  .geoBar{ height:5px; border-radius:999px; background:#EFEAE0; margin-top:5px; overflow:hidden; }
  .geoBar i{ display:block; height:100%; background:linear-gradient(90deg,var(--gold),#C9A227); }
  /* ===== v2.14: وضع الشاشة العريضة (يُفعَّل بزرّ ويُحفظ) ===== */
  body.wideMode .wrap{ max-width:1440px; }
  @media(min-width:2200px){ body.wideMode .wrap{ max-width:1760px; } }
  @media(min-width:3000px){ body.wideMode .wrap{ max-width:2000px; } }
  body.wideMode.scr-auction .wrap{ max-width:1760px; }
  @media(min-width:2200px){ body.wideMode.scr-auction .wrap{ max-width:2200px; } }
  .shell{ display:flex; gap:16px; align-items:flex-start; min-inline-size:0; }
  .side{ flex:0 0 220px; background:linear-gradient(180deg,var(--sidebar) 0%,var(--sidebar-2) 100%); border:0; border-radius:var(--radius); padding:12px 10px; position:sticky; top:16px; box-shadow:var(--shadow); }
  /* v9.29 (المالك): القائمة أطول من الشاشة ولا تنزل إلّا مع الصفحة ⟵ تمرير خاصّ بها على الكمبيوتر
     (الهاتف/الآيباد: الدرج تحت 1100px له تمريره أصلاً ويُعاد تعريف الارتفاع هناك) */
  .side{ max-height:calc(100vh - 32px); overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain;
         scrollbar-width:thin; scrollbar-color:rgba(212,175,55,.55) transparent; }
  .side::-webkit-scrollbar{ width:6px; }
  .side::-webkit-scrollbar-track{ background:transparent; }
  .side::-webkit-scrollbar-thumb{ background:rgba(212,175,55,.55); border-radius:6px; }
  .side::-webkit-scrollbar-thumb:hover{ background:rgba(212,175,55,.85); }
  .side .grp{ font-size:10.5px; color:var(--gold); font-weight:800; margin:16px 10px 6px; letter-spacing:.8px; opacity:.85; }
  .side .grp:first-child{ margin-top:4px; }
  .side button{ width:100%; text-align:start; background:transparent; border:0; color:rgba(247,240,232,.82); padding:11px 12px; border-radius:11px; font-size:14px; font-weight:600; transition:background .15s, color .15s; }
  .side button:hover{ background:rgba(255,255,255,.08); color:#fff; }
  .side button.active{ background:linear-gradient(180deg,var(--gold) 0%,#C39A2A 100%); color:#3A0A12; font-weight:800; box-shadow:0 4px 12px rgba(212,175,55,.25); }
  .side button{ display:flex; align-items:center; gap:10px; }
  .side .ic{ flex:0 0 auto; display:inline-flex; }
  .side .ic svg{ width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; display:block; }
  .side .lbl{ white-space:nowrap; overflow:hidden; }
  .side button.side-toggle{ background:rgba(255,255,255,.06); color:var(--gold); justify-content:center; padding:9px; margin-bottom:8px; box-shadow:none; border-radius:10px; }
  .side button.side-toggle:hover{ background:rgba(255,255,255,.12); filter:none; }
  .side button.side-toggle svg{ width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:transform .2s; }
  .side.collapsed{ flex-basis:64px; }
  .side.collapsed .lbl{ display:none; }
  .side.collapsed button{ justify-content:center; padding:11px 0; }
  .side.collapsed .grp{ font-size:0; line-height:0; height:1px; margin:10px 12px; padding:0; background:rgba(212,175,55,.28); }
  .side.collapsed button.side-toggle svg{ transform:rotate(180deg); }
  .content{ flex:1; min-width:0; }
  /* ===== v2.41: Drawer حقيقيّ للقائمة تحت 1100px (هاتف + آيباد) =====
     .side تخرج تماماً من مسار المستند (position:fixed) ولا تحجز أيّ مساحة في .shell،
     مخفيّة افتراضيّاً بالانزلاق (transform)، وتظهر فقط بإضافة class="open" من JS. */
  @media(max-width:1100px){
    .shell{ display:block; }
    .side, .side.collapsed{
      position:fixed; inset-block:0; inset-inline-start:0; z-index:12000;
      width:min(86vw,320px); max-width:320px; flex:none;
      height:100vh; height:100dvh; max-height:none;
      border-radius:0; box-shadow:0 0 40px rgba(0,0,0,.35);
      transform:translateX(var(--drawerX)); transition:transform .25s ease;
      overflow-y:auto; -webkit-overflow-scrolling:touch;
      padding-block:calc(12px + var(--safe-t)) calc(12px + var(--safe-b));
      padding-inline:10px;
    }
    .side.open{ transform:translateX(0); }
    .side button.side-toggle{ display:none; } /* الطيّ خاصّ بالكمبيوتر فقط */
    #drawerCloseBtn{ display:flex !important; }
    .side.collapsed .lbl{ display:inline; }
    .side.collapsed button{ justify-content:flex-start; padding:11px 12px; }
    .side.collapsed .grp{ font-size:11px; line-height:normal; height:auto; margin:12px 8px 4px; padding:0; background:none; }
    .side button{ min-height:44px; }
    #sideBackdrop{ display:block; position:fixed; inset:0; z-index:11500; background:rgba(20,8,10,.5);
      opacity:0; pointer-events:none; transition:opacity .2s ease; }
    #sideBackdrop.show{ opacity:1; pointer-events:auto; }
    #hamburgerBtn{ display:inline-flex; }
    #wideBtn{ display:none; } /* الوضع العريض غير ذي معنى بعرض ضيّق — لا يُحذف، فقط يُخفى بصريّاً */
  }
  /* ===== v2.44: منتقي العملاء — قائمة مخصَّصة ببحث من الخادم ===== */
  #custPicker{ display:none; position:fixed; z-index:10600; background:#fff;
    border:1.5px solid var(--gold); border-radius:12px; box-shadow:0 12px 34px rgba(43,18,22,.28);
    max-height:44vh; overflow-y:auto; -webkit-overflow-scrolling:touch; font-family:inherit; }
  #custPicker .cpItem{ padding:10px 12px; border-bottom:1px solid var(--line); cursor:pointer; min-height:44px; }
  #custPicker .cpItem:last-child{ border-bottom:0; }
  #custPicker .cpItem:hover, #custPicker .cpItem:active{ background:#FBF3E0; }
  #custPicker .cpItem.cpActive{ background:#F3E3BE; outline:2px solid var(--gold); outline-offset:-2px; }
  #custPicker .cpN{ font-weight:700; font-size:14px; color:var(--ink); }
  #custPicker .cpS{ font-size:12px; color:var(--mut); margin-top:2px; }
  #custPicker .cpMsg{ padding:10px 12px; font-size:13px; color:var(--mut); }
  /* v9.23: تجميع الدرجات تحت صنفها (الدفعة) */
  #custPicker .cpItem.cpGrp .cpS{ color:var(--gold); }
  #custPicker .cpItem.cpBack{ background:#FBF3E0; position:sticky; top:0; z-index:1; }
  /* v9.50 (المالك): الصنف الرئيسيّ بلون مختلف — سطر «رجوع» وعناصر الدفعات في القائمة */
  #custPicker .cpItem.cpBack, #custPicker .cpItem.cpBack:hover{ background:#5A2A2F; }
  #custPicker .cpItem.cpBack .cpN{ color:#F3E3BE; }
  #custPicker .cpItem.cpBack .cpS{ color:#FFFFFF; font-weight:700; font-size:13px; }
  #custPicker .cpItem.cpGrp{ background:#F6EBD3; border-inline-start:4px solid var(--gold); }
  #custPicker .cpItem.cpGrp .cpN{ color:#5A2A2F; }
  #custPicker .cpItem.cpOut{ opacity:.5; }

  /* ===== v2.45: كلّ النوافذ المنبثقة على الهاتف والآيباد =====
     ارتفاع يعتمد dvh (يتكيّف مع شريط سفاري ولوحة المفاتيح)، احترام Safe Area،
     جسم النافذة هو الجزء القابل للتمرير، والأزرار تصير عموديّة عند الضيق. */
  @media(max-width:1100px){
    .impModal, #tmOverlay, #dlgOverlay{
      padding:10px !important;
      padding-top:max(10px, var(--safe-t)) !important;
      padding-bottom:max(10px, var(--safe-b)) !important;
      padding-inline:max(10px, var(--safe-s)) max(10px, var(--safe-e)) !important;
      align-items:flex-start !important;
    }
    .impBox{ max-height:calc(100dvh - 20px - var(--safe-t) - var(--safe-b)) !important;
             max-width:100% !important; padding:14px !important; border-radius:14px !important;
             -webkit-overflow-scrolling:touch; }
    /* نافذة «تمّ» — صندوقها الداخليّ */
    #tmOverlay > div{ max-height:calc(100dvh - 20px - var(--safe-t) - var(--safe-b)) !important;
                      overflow-y:auto; -webkit-overflow-scrolling:touch; }
    .dlgBox{ max-width:100% !important; max-height:calc(100dvh - 24px - var(--safe-t) - var(--safe-b)); overflow-y:auto; }
    .dlgFoot{ flex-direction:column; }
    .dlgFoot .no{ flex:1 1 auto !important; min-width:0 !important; width:100%; }
    /* شريط أزرار معاينة الـPDF: عموديّ ولا يغطّي الصورة، مع احترام أسفل الشاشة */
    #pdfOverlay{ padding-bottom:calc(150px + var(--safe-b)) !important; }
    /* ===== v2.48: زرّ إغلاق واضح أعلى معاينة الفاتورة (هاتف/آيباد) =====
       sticky لا fixed — لأنّ الوضع الليليّ يستخدم filter على الصفحة
       فيتغيّر مرجع العناصر الثابتة ويطير الزرّ عند التمرير. */
    #pdfCloseBar{ display:flex; justify-content:flex-end; position:sticky;
                  top:calc(var(--safe-t)); z-index:20; margin-bottom:6px; pointer-events:none; }
    #pdfCloseX{ pointer-events:auto; width:52px; height:52px; min-height:52px; padding:0;
                border-radius:50%; font-size:24px; font-weight:900; line-height:1;
                background:var(--red); color:#fff; border:2.5px solid #fff;
                box-shadow:0 6px 20px rgba(0,0,0,.55); }
    #pdfCloseX:active{ filter:brightness(.85); }
    #pdfImg{ max-width:100% !important; height:auto !important; }
    /* ثلاثة أزرار بصفّ واحد تُقصّ على الهاتف — نجعلها عموديّة كاملة العرض */
    #pdfOverlay .obar{ flex-direction:column; gap:8px; }
    #pdfOverlay .obar button{ width:100%; min-height:48px; font-size:15px; }
    #pdfOverlay .hint{ font-size:12px; line-height:1.7; }
  }
  @media(max-width:520px){
    /* أشرطة أزرار النوافذ تصير عموديّة تماماً حين لا تتّسع */
    .impBox .row > button{ flex:1 1 100% !important; }
  }

  /* ===== v2.45: الشبكات والمؤشّرات وأشرطة الفلاتر على الهاتف ===== */
  @media(max-width:1100px){
    .dashRow{ display:block; }
    .dashRow > .card{ min-width:0 !important; margin-bottom:12px; }
    .card{ padding:var(--pad-card); }
    .row > select, .row > input{ min-width:0 !important; flex:1 1 200px !important; }
    /* حاجز نهائيّ ضدّ انزياح الصفحة أفقيّاً مهما طفح عنصر داخليّ */
    html, body{ max-width:100%; overflow-x:hidden; }
    .wrap, .content, .card{ max-inline-size:100%; }
  }
  @media(max-width:560px){
    .kpiGrid{ grid-template-columns:repeat(2,1fr); }
    .kpi{ padding:11px 12px; }
    .kpi .val{ font-size:18px; }
    .kpi .lab{ font-size:11px; }
    .row > select, .row > input{ flex:1 1 100% !important; }
  }
  @media(max-width:380px){
    /* 320–380: عمودان يقصّان الأرقام الكبيرة — عمود واحد أوضح */
    .kpiGrid{ grid-template-columns:1fr; }
    .wrap{ padding-inline:max(10px,var(--safe-s)) max(10px,var(--safe-e)); }
    .card{ padding:12px; }
    .stepBar{ font-size:11px; padding:7px 9px; }
  }

  /* ===== v2.45: البحث الشامل + معالجة الأنماط المضمَّنة على الهاتف =====
     الملفّ يحوي 94 موضع white-space:nowrap و74 موضع min-width مضمّنة داخل
     الوسوم؛ لا يمكن تعديلها واحداً واحداً بأمان، فنُبطلها بنطاق محكوم على
     العرض الضيّق فقط — مع استثناء قوالب الطباعة وأشرطة الأزرار. */
  @media(max-width:1100px){
    .gsres{ max-height:min(52dvh, 420px); max-inline-size:calc(100vw - 20px); }
    /* الخلايا والحقول: لا تفرض عرضاً أكبر من البطاقة */
    .content td:is([style*="min-width"],.sxMinw), .content th:is([style*="min-width"],.sxMinw),
    .content input:is([style*="min-width"],.sxMinw), .content select:is([style*="min-width"],.sxMinw){ min-width:0 !important; }
    /* النصّ الطويل يلتفّ بدل أن يقصّ — عدا خلايا الأزرار */
    .content td:is([style*="nowrap"],.sxNowrap):not([data-label=""]){ white-space:normal !important; }
    .content .muted:is([style*="nowrap"],.sxNowrap){ white-space:normal !important; }
  }

  /* ===== v2.45: شاشة الدخول + التمرير تحت الرأس اللاصق ===== */
  @media(max-width:1100px){
    /* العنصر الذي ينتقل إليه التركيز لا يختفي خلف الرأس اللاصق */
    input, select, textarea, .card h2, table tr{ scroll-margin-top:120px; }
    #authView{ max-width:100%; margin-top:8px; }
    #authView input{ font-size:16px !important; min-height:48px; }
    #authView button#authBtn{ min-height:50px; font-size:16px; }
    .tabs button{ min-height:44px; }
    /* لوحة المفاتيح تُقلّص المساحة: البطاقة تبقى قابلة للتمرير */
    #authView{ padding-bottom:16px; }
  }

  /* v2.49: بطاقات لوحة التحكّم القابلة للضغط */
  .cashCustRow{ transition:background .12s ease; }
  .cashCustRow:hover{ background:#FBF3E0; }
  .cashCustRow:active{ background:#F3E7C9; }
  #cashCustOverlay .impBox{ max-height:88vh; overflow:auto; }
  /* v2.55: بطاقة البنود غير المسوّاة — لا يجوز أن تفوت */
  .kpi.red.kpiGo{ border:2px solid #B0392E !important; background:#FDECEC !important;
                  animation:unsPulse 2.2s ease-in-out infinite; }
  .kpi.red.kpiGo .lab{ color:#8E2B22 !important; font-weight:800; }
  @keyframes unsPulse{
    0%,100%{ box-shadow:0 0 0 0 rgba(176,57,46,.32); }
    50%    { box-shadow:0 0 0 7px rgba(176,57,46,0); }
  }
  @media(prefers-reduced-motion:reduce){ .kpi.red.kpiGo{ animation:none; } }
  .kpi.kpiGo{ cursor:pointer; transition:transform .12s ease, box-shadow .12s ease; }
  .kpi.kpiGo:hover{ transform:translateY(-2px); box-shadow:0 6px 18px rgba(43,18,22,.13); }
  .kpi.kpiGo:active{ transform:scale(.985); }
  .kpi.kpiGo::after{ content:"›"; position:absolute; inset-inline-end:10px; top:8px;
                     color:var(--mut); font-size:16px; font-weight:800; opacity:.55; }
  .kpi{ position:relative; }

  /* ===== v2.51: الشات العائم ===== */
  #chatWidget{ position:fixed; z-index:11800; inset-block-end:calc(16px + var(--safe-b));
               inset-inline-end:calc(16px + var(--safe-e)); }
  #chatFab{ width:58px; height:58px; min-height:58px; border-radius:50%; border:2px solid #fff;
            background:linear-gradient(180deg,var(--maroon),var(--sidebar-2)); color:#F7EFD6;
            font-size:24px; padding:0; box-shadow:0 8px 26px rgba(43,18,22,.42); cursor:pointer; }
  #chatFab:active{ transform:scale(.94); }
  #chatBadge{ position:absolute; top:-3px; inset-inline-end:-3px; background:#B0392E; color:#fff;
              border:2px solid #fff; border-radius:999px; font-size:11px; font-weight:800;
              min-width:22px; padding:1px 5px; line-height:1.5; }
  #chatPanel{ display:none; position:fixed; z-index:11810; background:#FBFAF8;
              border:1px solid var(--line); border-radius:18px; overflow:hidden;
              box-shadow:0 20px 60px rgba(43,18,22,.34); flex-direction:column;
              inset-block-end:calc(84px + var(--safe-b)); inset-inline-end:calc(16px + var(--safe-e));
              width:min(380px, calc(100vw - 32px)); height:min(560px, 72dvh); }
  #chatPanel.open{ display:flex; }
  #chatHead{ display:flex; align-items:center; gap:8px; padding:11px 12px;
             background:linear-gradient(180deg,var(--sidebar),var(--sidebar-2)); color:#F7EFD6; }
  #chatHead button{ background:transparent; border:0; color:#F7EFD6; font-size:19px;
                    padding:4px 8px; min-height:40px; min-width:40px; cursor:pointer; box-shadow:none; }
  #chatTitle{ font-weight:800; font-size:14.5px; }
  #chatWith{ font-size:11.5px; opacity:.8; margin-top:1px; }
  #chatBackBtn{ display:none; }
  #chatPanel.inConv #chatBackBtn{ display:block; }
  #chatPanel.inConv #chatPeople{ display:none; }
  #chatPanel:not(.inConv) #chatConv{ display:none; }
  #chatWarn{ padding:9px 12px; background:#FDECEC; border-bottom:1.5px solid #E0736A;
             font-size:12px; line-height:1.6; color:#7a2118; }
  #chatPeople{ flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:6px; }
  .chatPerson{ display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:12px;
               cursor:pointer; min-height:56px; }
  .chatPerson:hover{ background:#F3EDE2; }
  .chatPerson.act{ background:#F7EFD6; }
  .chatAv{ position:relative; width:38px; height:38px; border-radius:50%; flex:0 0 auto;
           background:var(--sidebar); color:#F7EFD6; display:flex; align-items:center;
           justify-content:center; font-weight:800; font-size:16px; }
  .chatOn{ position:absolute; inset-block-end:0; inset-inline-end:0; width:11px; height:11px;
           border-radius:50%; border:2px solid #FBFAF8; }
  .chatPN{ font-weight:700; font-size:14px; color:var(--ink); overflow:hidden;
           text-overflow:ellipsis; white-space:nowrap; }
  .chatPS{ font-size:11.5px; margin-top:1px; }
  #chatConv{ flex:1; display:flex; flex-direction:column; min-height:0; }
  #chatBox{ flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:12px; }
  #chatFilePreview{ padding:7px 12px; background:#F7EFD6; border-top:1px solid var(--gold-soft); font-size:12px; }
  #chatBar{ display:flex; gap:6px; align-items:flex-end; padding:8px 10px;
            border-top:1px solid var(--line); background:#fff; }
  #chatBar button{ flex:0 0 auto; min-width:44px; min-height:44px; padding:9px 11px; }
  #chatBar textarea{ flex:1; resize:none; max-height:110px; padding:10px 11px;
                     border:1px solid var(--line); border-radius:12px; font-family:inherit;
                     font-size:15px; background:#FCFBF9; }
  @media(max-width:640px){
    /* على الهاتف: لوح سفليّ بعرض الشاشة كاملاً */
    #chatPanel{ inset-inline:0; inset-block-end:0; width:100%;
                height:min(78dvh, 640px); border-radius:18px 18px 0 0;
                padding-bottom:var(--safe-b); }
    #chatWidget{ inset-block-end:calc(14px + var(--safe-b)); inset-inline-end:calc(14px + var(--safe-e)); }
    #chatFab{ width:54px; height:54px; min-height:54px; font-size:22px; }
  }
  /* ═══ v4.73: محاذاة الخلايا ═══
     كانت الخلايا تُحاذى للأعلى افتراضاً. وصفّ الدفعات عالٍ لأنّ عمود
     الكود يحمل سطرين (الكود + شارة «بلا وزن نظيف»)، فيبدأ زرّ «حذف»
     من أعلى الخليّة بينما بقيّة النصوص في وسطها — فيبدو منزاحاً.
     ⚠ هذا كان قبل تعديلات اليوم، لا من صنعها. */
  table:not(.cardify) td, table:not(.cardify) th{ vertical-align:middle; }
  /* v7.58: جدول الأسعار — جدول واحد يتّسع للجوال */
  table.pbT{ width:100%; border-collapse:collapse; font-size:13.5px; }
  table.pbT th{ font-size:11.5px; padding:6px 6px; white-space:nowrap; text-align:start; }
  table.pbT td{ padding:6px 6px; border-top:1px solid var(--line); white-space:nowrap; }
  table.pbT tr.pbG td{ border-top:2px solid var(--gold); }
  table.pbT td.pbN{ white-space:normal; min-width:90px; vertical-align:top; background:#FBF7EF; }
  table.pbT td.pbN span{ display:block; font-size:10.5px; color:#8a7f73; }
  table:not(.cardify) td button{ vertical-align:middle; }

  /* v4.72: أشرطة الجدول — طبقة خلفيّة تحت الرقم لا تغيّره */
  td.rcNum{ position:relative; }
  td.rcNum .rcBar{ position:absolute; inset-inline-start:0; top:3px; bottom:3px;
    border-radius:4px; z-index:0; opacity:.85; }
  td.rcNum .rcVal{ position:relative; z-index:1; font-weight:700; }
  #rcTable tbody tr:hover td{ background:#FBF8F1; }
  #rcTable thead th{ position:sticky; top:0; background:#F6F1E6; z-index:2; }
  @media print{ td.rcNum .rcBar{ display:none; } }

  @media print{ #chatWidget{ display:none !important; } }

  @media(min-width:1101px){ #sideBackdrop{ display:none; } #hamburgerBtn{ display:none; } #pdfCloseBar{ display:none; } }

  /* ===== v2.41: قواعد تمنع القصّ/التمرير الأفقي — على العرض الضيّق فقط =====
     مقصورة على ≤1100px عمداً: تطبيقها عامّاً قد يمسّ أبعاد الباركود وQR
     على الكمبيوتر. قوالب الطباعة مستثناة صراحةً في الحالتين. */
  @media(max-width:1100px){
    img:not(#invoice img):not(#invRepDoc img):not(#auPickPrint img):not(#stkSheet img),
    svg:not(#invoice svg):not(#invRepDoc svg):not(#auPickPrint svg):not(#stkSheet svg),
    canvas:not(#invoice canvas):not(#stkSheet canvas){ max-inline-size:100%; height:auto; }
  }
  @media(max-width:1100px){
    /* ملاحظة: الأزرار مكتوب عليها flex:0 داخل الوسم؛ السماح لها بالانكماش
       لصفر يجعل نصّها يطفح فوق بعضه — لذا نستثنيها صراحةً ونمنحها عرضاً كافياً. */
    .row, .grid2, .grid3, .kpiGrid, .hubGrid, .geoGrid{ min-inline-size:0; }
    .row > *:not(button), .grid2 > *, .grid3 > *{ min-inline-size:0; }
    .row > button{ flex:1 1 190px !important; white-space:normal; height:auto;
                   min-height:44px; line-height:1.35; padding:10px 12px; font-size:14px; }
  }
  @media(max-width:560px){
    .row > button{ flex:1 1 100% !important; }
  }
  /* v2.47: الأغلفة المكتوب فيها flex:0 والتي تحوي أزراراً كانت تنهار لعرض صفر
     فتطفح أزرارها خارج الشاشة (شريط النسخ الاحتياطيّ مثلاً). */
  @media(max-width:1100px){
    .row > div{ flex-basis:auto; }
    .row > div:has(button){ flex:1 1 100% !important; min-inline-size:0 !important; }
    .row > div:has(button) button{ flex:1 1 auto; }
    /* ضمانة صريحة لا تعتمد على :has — لو لم يدعمها المتصفّح */
    #backupNag .row > div{ flex:1 1 100% !important; min-width:0 !important; }
    #backupNag .row > div:last-child{ display:flex; gap:8px; flex-wrap:wrap; }
    #backupNag .row > div:last-child button{ flex:1 1 140px; }
  }
  @media(max-width:1100px){
    input:not(#invoice input), select:not(#invoice select), textarea:not(#invoice textarea){
      font-size:16px !important; /* يمنع تكبير Safari التلقائي عند التركيز */
      min-height:44px;
    }
    button, .mini{ min-height:44px; }
  }
  .top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--line); }
  #hamburgerBtn{ min-width:44px; min-height:44px; padding:0; font-size:19px; align-items:center; justify-content:center; flex:0 0 auto; order:-2; }
  @media(max-width:1100px){
    .top{ position:sticky; top:0; z-index:800; background:var(--bg); gap:8px;
      flex-wrap:wrap; padding-top:max(10px,var(--safe-t)); margin-inline:calc(-1*max(16px,var(--safe-s))) calc(-1*max(16px,var(--safe-e)));
      padding-inline:max(16px,var(--safe-s)) max(16px,var(--safe-e)); }
    .top .brand{ order:-1; font-size:17px; flex:1 1 auto; min-inline-size:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .top .gswrap{ order:3; flex:1 1 100%; max-width:none; margin:6px 0 0; }
    #darkBtn, #langBtn{ order:2; padding:8px 12px; min-height:40px; }
  }
  @media(max-width:479px){ .top .brand{ font-size:15.5px; } }
  @media(max-width:1100px){
    #companyCard{ padding:10px 14px; margin-bottom:10px; }
    #companyCard #companyLabel{ font-size:15px; }
    #companyCard .muted{ font-size:11px; }
    #companyCard .row{ flex-direction:column; align-items:stretch !important; gap:8px; }
    #companyCard .row > div{ flex:none !important; width:100%; min-inline-size:0; }
    #companyCard .row > div:last-child{ width:auto; align-self:flex-end; }
  }
.gswrap{ position:relative; flex:1; max-width:460px; margin:0 14px; }
.gsinput{ width:100%; padding:9px 14px; border:1px solid var(--line); border-radius:22px; font-family:'Tajawal',Arial; font-size:14px; background:#fff; box-sizing:border-box; }
.gsinput:focus{ outline:none; border-color:var(--gold); }
/* v9.91.1 (المالك): زرّ الكاميرا داخل خانة البحث الشامل — المسح يكتب الكود ويعرض النتائج */
.gsinput{ padding-inline-end:40px; }
.gsCam{ position:absolute; inset-inline-end:5px; top:50%; transform:translateY(-50%); border:0; background:transparent;
  font-size:17px; line-height:1; padding:5px 6px; cursor:pointer; border-radius:50%; z-index:31; min-height:0; }
.gsCam:hover{ background:rgba(0,0,0,.06); }
.gsres{ position:absolute; top:calc(100% + 6px); inset-inline-start:0; inset-inline-end:0; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 10px 40px rgba(43,18,22,.18); max-height:420px; overflow:auto; z-index:8000; padding:6px; }
.gsres .ghead{ font-size:11px; font-weight:800; color:#8A6D14; padding:7px 10px 3px; letter-spacing:.4px; }
.gsres .gitem{ padding:8px 10px; border-radius:8px; cursor:pointer; font-size:13.5px; color:var(--ink,#2b1216); }
.gsres .gitem:hover, .gsres .gitem.sel{ background:#F6EEDD; }
.gsres .gempty{ padding:14px; text-align:center; color:var(--mut); font-size:13px; }
  .brand{ font-size:22px; font-weight:800; color:var(--maroon); letter-spacing:.5px; }
  .card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
         padding:22px; margin-bottom:16px; box-shadow:var(--shadow); }
  h2{ margin:0 0 14px; font-size:18px; font-weight:800; color:var(--maroon); }
  label{ display:block; font-size:13px; color:var(--mut); margin:10px 0 4px; }
  input,select{ width:100%; padding:11px 12px; background:#FCFBF9; border:1px solid var(--line);
         border-radius:11px; color:var(--ink); font-size:15px; font-family:inherit; transition:border-color .15s, box-shadow .15s; }
  input:focus,select:focus{ outline:0; border-color:var(--gold); box-shadow:0 0 0 3px rgba(212,175,55,.18); }
  button{ cursor:pointer; border:0; border-radius:11px; padding:11px 16px; font-size:15px;
          font-weight:700; color:#fff; background:var(--maroon); font-family:inherit; transition:filter .15s, box-shadow .15s, transform .05s; box-shadow:0 2px 8px rgba(91,15,26,.18); }
  button:hover{ filter:brightness(1.08); }
  button:active{ transform:translateY(1px); }
  button.ghost{ background:transparent; border:1px solid var(--line); color:var(--ink); box-shadow:none; }
  button.ghost:hover{ background:#F4EFE9; filter:none; }
  button.green{ background:var(--green); }
  button:disabled{ opacity:.5; cursor:default; }
  .row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
  .row>*{ flex:1; }
  .grid2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
  .muted{ color:var(--mut); font-size:13px; }
  table{ width:100%; border-collapse:collapse; margin-top:8px; font-size:14px; }
  th,td{ text-align:right; padding:10px 8px; border-bottom:1px solid var(--line); }
  th{ color:var(--maroon); font-weight:800; font-size:12px; }
  tbody tr{ transition:background .12s; }
  tbody tr:hover{ background:#FBF8F3; }
  .retResults{ margin-top:6px; border:1px solid var(--line); border-radius:11px; max-height:220px; overflow:auto; display:none; background:#fff; }
  .retResults.show{ display:block; }
  .retResRow{ padding:9px 12px; cursor:pointer; border-bottom:1px solid var(--line); font-size:13.5px; line-height:1.5; }
  .retResRow:last-child{ border-bottom:0; }
  .retResRow:hover{ background:#FBF8F3; }
  .retResRow b{ color:var(--maroon); }
  .retTag{ display:inline-block; font-size:10px; font-weight:800; padding:2px 7px; border-radius:20px; margin-inline-start:5px; vertical-align:middle; white-space:nowrap; }
  .retTag.part{ background:#FBEED0; color:#8A5A00; border:1px solid #E7C878; }
  .retTag.full{ background:#F6D9D5; color:#8E2A20; border:1px solid #E0A69E; }
  .kpiGrid{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
  .kpi{ background:linear-gradient(180deg,#fff,#FCFBF9); border:1px solid var(--line); border-radius:14px; padding:14px 16px; box-shadow:var(--shadow); }
  .kpi .lab{ font-size:12px; color:var(--mut); font-weight:700; margin-bottom:6px; }
  .kpi .val{ font-size:23px; font-weight:800; color:var(--maroon); line-height:1.15; word-break:break-word; }
  .kpi .val small{ font-size:12px; color:var(--mut); font-weight:700; }
  .kpi.gold{ border-color:var(--gold-soft); background:linear-gradient(180deg,#fff,#FBF4DE); }
  .kpi.warn .val{ color:var(--red); }
  /* v7.62: المالك — «لا داعي» للظلّ الداكن خلف النوافذ المنبثقة.
     ⇒ الخلفية شفّافة (الضغط خارج النافذة ما زال يُغلقها)، والنافذة نفسها
       تبرز بظلّ وإطار ذهبيّ بدل تعتيم الشاشة كلّها. */
  :root{ --ovBg: transparent; }
  .impBox, .dlgBox,
  [style*="position: fixed"][style*="inset: 0px"] > .card,
  [style*="position:fixed;inset:0"] > div, .sxFix > div{ box-shadow:0 12px 44px rgba(43,18,22,.30), 0 0 0 1.5px rgba(212,175,55,.85) !important; }
  .impModal{ display:none; position:fixed; inset:0; background:var(--ovBg); z-index:9000; align-items:center; justify-content:center; padding:16px; }
  .impModal.show{ display:flex; }
  .impBox{ background:#fff; border-radius:16px; padding:18px; max-width:720px; width:100%; max-height:88vh; overflow:auto; box-shadow:var(--shadow); }
  /* ===== تقرير المستثمر (حاوية مستقلّة عن الفاتورة) ===== */
  #invRepDoc{ position:absolute; top:-16000px; right:0; width:794px; background:#fff; color:#000;
    font-family:'Tajawal',Arial,sans-serif; padding:34px 44px 26px; direction:rtl; box-sizing:border-box; }
  #invRepDoc .rHead{ display:flex; align-items:center; gap:16px; border-bottom:3px solid #5B0F1A; padding-bottom:14px; margin-bottom:16px; }
  #invRepDoc .rHead img{ width:74px; height:74px; object-fit:contain; }
  #invRepDoc .rHead .t1{ font-size:24px; font-weight:800; color:#5B0F1A; }
  #invRepDoc .rHead .t2{ font-size:14px; color:#7a6a55; margin-top:2px; }
  #invRepDoc .rSub{ display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px; font-size:13px; color:#333; margin-bottom:14px; }
  #invRepDoc .rInfo{ background:#F8F7F5; border:1px solid #E5DED4; border-radius:10px; padding:12px 14px; margin-bottom:16px; display:grid; grid-template-columns:1fr 1fr; gap:8px 22px; font-size:14px; }
  #invRepDoc .rInfo b{ color:#5B0F1A; }
  #invRepDoc .rKpis{ display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:18px; }
  #invRepDoc .rKpi{ border:1.4px solid #D4AF37; border-radius:12px; padding:12px; text-align:center; }
  #invRepDoc .rKpi .lab{ font-size:12px; color:#7a6a55; margin-bottom:4px; }
  #invRepDoc .rKpi .val{ font-size:18px; font-weight:800; color:#5B0F1A; }
  #invRepDoc h3{ color:#5B0F1A; font-size:16px; margin:18px 0 8px; }
  #invRepDoc table{ width:100%; border-collapse:collapse; font-size:13px; }
  #invRepDoc th,#invRepDoc td{ border:1px solid #C9BCA8; padding:7px 9px; text-align:center; }
  #invRepDoc th{ background:#5B0F1A; color:#fff; font-weight:700; }
  #invRepDoc tbody tr:nth-child(even){ background:#FBF9F6; }
  /* v8.30 جدول المنتجات المموّلة المضغوط */
  #invRepDoc table.rWide{ font-size:11px; }
  #invRepDoc table.rWide th,#invRepDoc table.rWide td{ padding:5px 4px; }
  #invRepDoc table.rWide td{ white-space:nowrap; }
  #invRepDoc .rLeft{ text-align:start; }
  #invRepDoc .rNote{ font-size:9.5px; color:#7a6a55; font-weight:400; margin-top:1px; }
  #invRepDoc .rNeg{ color:#B3261E; }
  #invRepDoc tr.rTot td{ background:#F3EBDD; font-weight:800; border-top:2px solid #5B0F1A; }
  #invRepDoc .rLegend{ margin-top:8px; font-size:11px; line-height:1.7; color:#444; background:#F8F7F5; border:1px solid #E5DED4; border-radius:8px; padding:8px 10px; }
  #invRepDoc .rFoot{ margin-top:22px; border-top:1px solid #C9BCA8; padding-top:10px; font-size:11px; color:#7a6a55; text-align:center; line-height:1.6; }
  /* ===== قائمة تجهيز المزاد (v1.47) ===== */
  #auPickPrint{ position:absolute; top:-16000px; right:0; width:794px; background:#fff; color:#000;
    font-family:'Tajawal',Arial,sans-serif; padding:34px 44px 26px; direction:rtl; box-sizing:border-box; }
  #auPickPrint .pHead{ display:flex; align-items:center; gap:12px; border-bottom:2px solid #5B0F1A; padding-bottom:8px; margin-bottom:8px; }
  #auPickPrint .pHead img{ width:48px; height:48px; object-fit:contain; }
  #auPickPrint .pHead .t1{ font-size:23px; font-weight:800; color:#5B0F1A; }
  #auPickPrint .pHead .t2{ font-size:13px; color:#7a6a55; margin-top:2px; }
  #auPickPrint table{ width:100%; border-collapse:collapse; font-size:13.5px; }
  #auPickPrint th,#auPickPrint td{ border:1px solid #C9BCA8; padding:7px 9px; text-align:center; letter-spacing:normal; }
  #auPickPrint th{ background:#5B0F1A; color:#fff; font-weight:700; letter-spacing:normal; }
  /* تظليل متناوب حسب مجموعة الصنف — يعمل بالألوان وبالأبيض/الأسود */
  #auPickPrint tbody tr.g0{ background:#F2EADA; }
  #auPickPrint tbody tr.g1{ background:#FFFFFF; }
  #auPickPrint tbody tr.gend td{ border-bottom:2.2px solid #5B0F1A; }
  #auPickPrint .sub{ font-size:11px; color:#5B0F1A; margin-top:2px; }
  #auPickPrint .qty{ font-weight:800; font-size:15px; color:#5B0F1A; }
  #auPickPrint .buyers{ font-size:11.5px; color:#6b5d48; text-align:start; }
  #auPickPrint .pFoot{ margin-top:20px; border-top:1px solid #C9BCA8; padding-top:10px; font-size:11px; color:#7a6a55; text-align:center; line-height:1.6; }
  /* ===== v2.05: ترقيم مراحل الإدخال ===== */
  .side button[data-step]::before{
    content: attr(data-step); font-size:12.5px; font-weight:800; color:var(--gold);
    margin-inline-end:4px; opacity:.9;
  }
  .side.collapsed button[data-step]::before{ display:none; }
  /* ===== v2.07: شجرة المخزون — إزاحة وخطّ وتصغير طفيف ===== */
  .side button[data-lvl]{ position:relative; }
  .side button[data-lvl="2"]{ margin-inline-start:14px; font-size:13.4px; }
  .side button[data-lvl="3"]{ margin-inline-start:28px; font-size:12.8px; }
  .side button[data-lvl="2"] .ic svg,
  .side button[data-lvl="3"] .ic svg{ width:17px; height:17px; }
  .side button[data-lvl="3"] .ic svg{ width:16px; height:16px; }
  /* الخطّ الواصل: عموديّ من الأب + أفقيّ صغير للابن */
  .side button[data-lvl="2"]::after,
  .side button[data-lvl="3"]::after{
    content:""; position:absolute; inset-inline-start:-10px; top:-6px; bottom:50%;
    width:1.5px; background:rgba(212,175,55,.5);
  }
  .side button[data-lvl="2"] .ic::before,
  .side button[data-lvl="3"] .ic::before{
    content:""; position:absolute; inset-inline-start:-10px; top:50%;
    width:9px; height:1.5px; background:rgba(212,175,55,.5);
  }
  .side button[data-lvl] .ic{ position:relative; }
  /* عند الطيّ: بلا إزاحة ولا خطوط */
  .side.collapsed button[data-lvl]{ margin-inline-start:0; font-size:14px; }
  .side.collapsed button[data-lvl]::after,
  .side.collapsed button[data-lvl] .ic::before{ display:none; }
  @media(max-width:760px){
    .side button[data-lvl]{ margin-inline-start:0 !important; font-size:14px !important; }
    .side button[data-lvl]::after, .side button[data-lvl] .ic::before{ display:none; }
  }
  /* شريط المراحل */
  .stepBar{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin:0 0 12px;
            padding:9px 12px; background:linear-gradient(180deg,#FFFDF3,#FBF1D6);
            border:1.5px solid var(--gold-soft); border-radius:12px; font-size:12.5px; }
  .stepBar .st{ display:flex; align-items:center; gap:5px; color:var(--mut); white-space:nowrap; }
  .stepBar .st b{ font-weight:800; }
  .stepBar .st.on{ color:var(--maroon); background:#fff; border:1.5px solid var(--gold);
                   border-radius:999px; padding:3px 11px; box-shadow:0 1px 4px rgba(212,175,55,.25); }
  .stepBar .st.done{ color:#2E7D5B; }
  .stepBar .sep{ color:var(--gold); font-weight:800; }
  /* زرّ الخطوة التالية */
  .nextStep{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
             margin-top:12px; padding:11px 14px; border:2px solid #2E7D5B; border-radius:12px;
             background:linear-gradient(180deg,#F1FAF4,#E4F3EA); }
  .nextStep .t{ font-weight:800; color:#1a7f3c; font-size:13.5px; }
  .nextStep .d{ font-size:12px; color:#4a6b58; }

  /* ===== v2.05: الشاشات الصغيرة — جداول تتحوّل بطاقات ===== */
  @media(max-width:760px){
    .wrap{ padding-inline:10px; }
    .grid2, .grid3{ grid-template-columns:1fr !important; }
    button, .mini{ min-height:42px; }
    table.cardify:where(:not(.pvTbl)) thead{ display:none; }
    table.cardify:where(:not(.pvTbl)), table.cardify:where(:not(.pvTbl)) tbody, table.cardify:where(:not(.pvTbl)) tr, table.cardify:where(:not(.pvTbl)) td{ display:block; width:100%; }
    table.cardify:where(:not(.pvTbl)) tr{ border:1.5px solid var(--line); border-radius:12px; margin-bottom:10px;
                      padding:8px 10px; background:#fff; box-shadow:0 1px 3px rgba(43,18,22,.05); }
    table.cardify:where(:not(.pvTbl)) td{ border:none !important; text-align:start !important; padding:5px 0 !important; }
    table.cardify:where(:not(.pvTbl)) td::before{ content: attr(data-label); display:block; font-size:10.5px;
                              color:var(--mut); font-weight:700; margin-bottom:2px; }
    table.cardify:where(:not(.pvTbl)) td:empty{ display:none; }

    /* ═══════════ v6.86 — بطاقات الجوّال ═══════════
       كانت كلّ خانة سطرين: العنوان فوق والقيمة تحته — فبطاقة بثلاثة
       عشر حقلاً تصير ستّةً وعشرين سطراً، وتملأ الشاشة لصفّ واحد.
       ⇒ سطر واحد لكلّ حقل: العنوان يميناً والقيمة يساراً.
       ⚠ كلّ ما هنا داخل @media(max-width:760px) — فالويندوز لا يتأثّر. */
    table.cardify:where(:not(.pvTbl)) tr{ padding:10px 12px !important; margin-bottom:8px !important;
                      border-radius:14px !important; }
    table.cardify:where(:not(.pvTbl)) td{
      display:grid !important;
      grid-template-columns: minmax(78px, 38%) 1fr;
      gap:10px; align-items:baseline;
      padding:4px 0 !important;
      border-bottom:1px solid rgba(43,18,22,.05) !important;
      font-size:13.5px; line-height:1.5;
    }
    table.cardify:where(:not(.pvTbl)) td:last-child{ border-bottom:none !important; }
    table.cardify:where(:not(.pvTbl)) td::before{
      display:block; margin:0 !important;
      font-size:11.5px; font-weight:600; color:var(--mut);
      white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    }

    /* الخانة الأولى رأس البطاقة: بلا عنوان · وأكبر */
    table.cardify:where(:not(.pvTbl)) td:first-child{
      display:flex !important; align-items:center; gap:8px;
      font-size:16px; font-weight:800; color:var(--maroon);
      padding:0 0 8px 0 !important;
      border-bottom:1.5px solid var(--line) !important; margin-bottom:6px;
    }
    table.cardify:where(:not(.pvTbl)) td:first-child::before{ display:none; }
    /* وإن كانت خانة تأشير، فالتالية هي الرأس */
    table.cardify:where(:not(.pvTbl)) td:first-child:has(input[type="checkbox"]){
      font-size:13.5px; padding-bottom:4px !important; border-bottom:none !important;
      margin-bottom:0;
    }

    /* صفّ الأزرار: بلا عنوان · وتتوزّع بعرض البطاقة */
    table.cardify:where(:not(.pvTbl)) td:has(button){
      display:flex !important; flex-wrap:wrap; gap:6px;
      padding-top:8px !important; border-bottom:none !important;
    }
    table.cardify:where(:not(.pvTbl)) td:has(button)::before{ display:none; }
    table.cardify:where(:not(.pvTbl)) td button, table.cardify:where(:not(.pvTbl)) td .mini{
      flex:1 1 auto; min-width:86px; min-height:38px; font-size:13px;
    }

    /* سطر المجموع (v6.82) بطاقة مميّزة */
    table.cardify:where(:not(.pvTbl)) tfoot tr{
      border:2px solid var(--gold) !important; background:#fbf6ea !important; }
    table.cardify:where(:not(.pvTbl)) tfoot td{ font-weight:800; }
    table.cardify:where(:not(.pvTbl)) tfoot td:first-child{
      color:var(--maroon); border-bottom:1.5px solid var(--gold) !important; }

    /* شاشة عريضة (فولد مفتوح · جوّال كبير): حقلان في السطر */
    @media(min-width:560px){
      table.cardify:where(:not(.pvTbl)) tr{
        display:grid !important; grid-template-columns:1fr 1fr;
        gap:0 18px; align-items:start; }
      table.cardify:where(:not(.pvTbl)) td:first-child,
      table.cardify:where(:not(.pvTbl)) td:has(button){ grid-column:1 / -1; }
    }

    /* ملاحظة iOS: لا تكبير تلقائيّ للخطّ · ومساحة أسفل الشاشة */
    html{ -webkit-text-size-adjust:100%; }
    .wrap{ padding-bottom:calc(18px + env(safe-area-inset-bottom, 0px)); }
    /* ===== v2.46: حاجز قوالب الطباعة — إصلاح ===== 
       النسخة السابقة استخدمت revert على الحشو والحدود والخلفيّة، وهذا كان
       يمسح أنماط الفاتورة الأصليّة فتختلف عمّا كانت. الآن نعيد بنية الجدول
       فقط بقيم صريحة، ولا نلمس الحشو ولا الحدود ولا الخلفيّات إطلاقاً. */
    #invoice table, #invRepDoc table, #auPickPrint table, #stkSheet table{ display:table !important; }
    #invoice thead, #invRepDoc thead, #auPickPrint thead, #stkSheet thead{ display:table-header-group !important; }
    #invoice tbody, #invRepDoc tbody, #auPickPrint tbody, #stkSheet tbody{ display:table-row-group !important; }
    #invoice tr, #invRepDoc tr, #auPickPrint tr, #stkSheet tr{ display:table-row !important; }
    #invoice td, #invoice th, #invRepDoc td, #invRepDoc th,
    #auPickPrint td, #auPickPrint th, #stkSheet td, #stkSheet th{ display:table-cell !important; }
    #invoice td::before, #invRepDoc td::before, #auPickPrint td::before, #stkSheet td::before{ content:none !important; }
    .stepBar{ font-size:11.5px; }
  }
  /* ===== الوضع الليليّ (v2.30) — قلب ألوان شامل + استثناء مزدوج القلب للفاتورة =====
     (نطاق عامّ، خارج أيّ @media — يعمل على كلّ أحجام الشاشات)
     لماذا القلب لا إعادة تلوين يدويّة: الملفّ يحتوي مئات القيم اللونيّة الصريحة
     (لا عبر متغيّرات CSS فقط) في الأزرار والبطاقات والجداول — إعادة كتابتها كلّها
     يدويّاً عمل ضخم وشديد الخطورة. القلب الكامل آمن، فوريّ، ولا يمسّ سطراً واحداً
     من الأنماط الأصليّة — فقط قواعد إضافيّة جديدة. */
  /* v8.94: القلب على <html> لا <body> — الفلتر على body يجعل كلّ نافذة position:fixed تتموضع نسبةً لأعلى الصفحة
     لا للشاشة، فعلى الهاتف بعد النزول في نموذج طويل تظهر نافذة «سبب التعديل» خارج الشاشة ولا يحدث شيء.
     الجذر <html> مستثنى من هذه القاعدة. الخلفيّة مكتوبة بلونها قبل القلب (#e7e5e2) فتظهر داكنة #1c1a17 كما كانت. */
  html.dark{ filter:invert(1) hue-rotate(180deg); background:#e7e5e2; }   /* يظهر بعد القلب ≈ #1c1a17 */
  body.dark{ background:#e7e5e2; min-height:100vh; }
  /* الفاتورة (PDF) ولوحة معاينتها: قلب ثانٍ يُلغي القلب الأوّل = تبقى بألوانها الطبيعيّة دوماً */
  body.dark #invoice, body.dark #pdfOverlay, body.dark #pdfImg,
  body.dark #stkSheet{ filter:invert(1) hue-rotate(180deg); }
  /* الصور المرفوعة (لا الأيقونات الخطّيّة) تبدو طبيعيّة بعد القلب المزدوج أيضاً */
  body.dark img:not(.wm){ filter:invert(1) hue-rotate(180deg); }
  /* القائمة الجانبيّة عنابيّة داكنة أصلاً — قلبها يجعلها ساطعة مؤذية للعين، فنستثنيها بقلب مزدوج
     (نفس منطق استثناء الفاتورة) لتبقى داكنة كما هي، وهذا يناسب الوضع الليليّ أصلاً بلا تعديل */
  body.dark .side{ filter:invert(1) hue-rotate(180deg); }
  /* v2.80: في الوضع الليليّ القائمة الجانبيّة سوداء بدل العنابيّ (أوضح للعين ليلاً).
     نلغي القلب المزدوج ونفرض تدرّجاً أسود مباشرة. */
  body.dark .side{ filter:none !important; background:linear-gradient(180deg,#111 0%,#000 100%) !important; }
  body.dark .side .navItem, body.dark .side button, body.dark .side .lbl{ color:#EAD9A6 !important; }
  body.dark .side .navItem.active, body.dark .side button.active{ background:linear-gradient(180deg,#2a2a2a,#000) !important; }
  /* رؤوس النوافذ المنبثقة عنابيّة داكنة بنفس المشكلة */
  body.dark .dlgHead{ filter:invert(1) hue-rotate(180deg); }
  #darkBtn{ font-size:15px; }
  body.dark #darkBtn{ filter:invert(1) hue-rotate(180deg); }  /* الزرّ نفسه يبقى مقروءاً */
  /* ===== v2.13: نوافذ الحوار المصمّمة ===== */
  #dlgOverlay{ display:none; position:fixed; inset:0; z-index:11000;
    background:var(--ovBg);
    align-items:center; justify-content:center; padding:18px; }
  #dlgOverlay.show{ display:flex; animation:dlgFade .16s ease; }
  @keyframes dlgFade{ from{ opacity:0 } to{ opacity:1 } }
  @keyframes dlgPop{ from{ opacity:0; transform:translateY(14px) scale(.97) } to{ opacity:1; transform:none } }
  .dlgBox{ background:#fff; border-radius:18px; width:100%; max-width:460px; overflow:hidden;
    box-shadow:0 24px 70px rgba(43,18,22,.35); border:1.5px solid rgba(212,175,55,.45);
    animation:dlgPop .2s cubic-bezier(.2,.9,.3,1.2); }
  .dlgHead{ display:flex; align-items:center; gap:11px; padding:15px 18px 13px;
    background:linear-gradient(180deg,#5B0F1A,#4A0C14); color:#F7F0E8; }
  .dlgHead .ic{ width:34px; height:34px; border-radius:10px; display:flex; align-items:center;
    justify-content:center; font-size:17px; background:rgba(255,255,255,.14); flex:none; }
  .dlgHead .tt{ font-weight:800; font-size:15.5px; letter-spacing:normal; }
  .dlgBody{ padding:16px 18px; font-size:14px; line-height:1.75; color:#2A1216; white-space:pre-line; }
  .dlgFoot{ display:flex; gap:9px; padding:0 18px 16px; }
  .dlgFoot button{ flex:1; min-height:44px; border-radius:11px; font-weight:800; font-size:14px; cursor:pointer; border:1.5px solid transparent; }
  .dlgFoot .ok{ background:linear-gradient(180deg,#5B0F1A,#4A0C14); color:#F7F0E8; }
  .dlgFoot .ok:hover{ filter:brightness(1.12); }
  .dlgFoot .no{ background:#fff; color:#8B7E83; border-color:#ECE6DB; flex:0; min-width:110px; }
  .dlgFoot .no:hover{ background:#F6F3EE; }
  .dlgFoot a.ok{ flex:1; min-height:44px; border-radius:11px; font-weight:800; font-size:14px; display:flex;
                 align-items:center; justify-content:center; text-decoration:none; }   /* v7.67 */
  .dlgBox.warn{ border-color:rgba(176,57,46,.5); }
  .dlgBox.warn .dlgHead{ background:linear-gradient(180deg,#8E2B22,#6E1F18); }
  .dlgBox.warn .dlgFoot .ok{ background:linear-gradient(180deg,#B0392E,#8E2B22); }
  .dlgBox.good .dlgHead{ background:linear-gradient(180deg,#2E7D5B,#226247); }
  .dlgBox.good .dlgFoot .ok{ background:linear-gradient(180deg,#2E7D5B,#226247); }
  @media print{
    body.printPick > *:not(#auPickPrint){ display:none !important; }
    body.printPick #auPickPrint{ display:block !important; position:static !important; top:auto !important; right:auto !important; inset:auto !important; width:auto !important; padding:0 !important; }
  }
  .dashRow{ display:flex; gap:16px; flex-wrap:wrap; }
  .dashRow > .card{ min-width:280px; margin-bottom:0; }
  .lowItem{ display:flex; justify-content:space-between; gap:10px; padding:9px 4px; border-bottom:1px solid var(--line); font-size:14px; }
  .lowItem:last-child{ border-bottom:0; }
  .lowItem .amt{ font-weight:800; color:var(--red); white-space:nowrap; }
  @media(max-width:900px){ .kpiGrid{ grid-template-columns:repeat(2,1fr); } }
  @media(max-width:520px){ .kpi .val{ font-size:20px; } }
  .msg{ padding:10px 12px; border-radius:9px; margin:10px 0; font-size:14px; display:none; }
  .msg.err{ display:block; background:rgba(192,80,77,.15); border:1px solid var(--red); }
  .msg.ok{ display:block; background:rgba(46,125,91,.15); border:1px solid var(--green); }
  .tabs{ display:flex; gap:8px; margin-bottom:14px; }
  .tabs button{ flex:1; background:transparent; border:1px solid var(--line); color:var(--mut); }
  .tabs button.active{ background:var(--maroon); color:#fff; border-color:var(--maroon); }
  .nav{ display:flex; gap:8px; margin-bottom:16px; }
  .nav button{ background:transparent; border:1px solid var(--line); color:var(--mut); flex:0; padding:9px 18px; }
  .nav button.active{ background:var(--maroon); color:#fff; border-color:var(--maroon); }
  .hide{ display:none; }
  #dmgOverlay, #batchEditBanner{ display:none; }
  #dmgOverlay:not(.hide), #batchEditBanner:not(.hide){ display:flex; }
  input.ci{ padding:7px 8px; font-size:14px; }
  .req::after{ content:" ★"; color:var(--red); font-size:12px; }
  /* ===== v1.97: قراءة النصّ الطويل في الخانات الضيّقة ===== */
  /* الخانة تتّسع عند الكتابة فيها وتطفو فوق ما حولها */
  table input.ci:focus, table input[type="text"]:focus, table input:not([type]):focus{
    position:relative; z-index:60;
    min-width:260px !important;
    box-shadow:0 6px 20px rgba(43,18,22,.18);
    border-color:var(--gold) !important;
    background:#FFFDF6;
  }
  /* توسيع خانات التوزيع الضيّقة */
  #gpGrid input.ci{ min-width:120px; }
  #gpGrid input.ci:focus{ min-width:300px !important; }
  /* v2.41: تحت 768px القيد يُلغى — التوسيع يُخرج الحقل عن بطاقة الهاتف الضيّقة */
  @media(max-width:767px){
    table input.ci:focus, table input[type="text"]:focus, table input:not([type]):focus{ min-width:0 !important; width:100%; }
    #gpGrid input.ci:focus{ min-width:0 !important; width:100%; }
  }
  /* الخلايا النصّيّة الطويلة: سطران بدل قصّ بلا رحمة */
  td.cellWrap{ white-space:normal; word-break:break-word; max-width:280px; line-height:1.5; }
  /* v1.90: زرّ الإضافة بلون مميّز واضح في كلّ الشاشات */
  .addBtn{ background:linear-gradient(180deg,#E8C24A,#C9A227) !important; color:#2A1A08 !important;
           border:1.5px solid #A8871B !important; font-weight:800 !important; box-shadow:0 2px 6px rgba(201,162,39,.35); }
  .addBtn:hover{ filter:brightness(1.06); }
  /* v1.51: محاذاة كل خانات شبكة المزاد على مستوى واحد (الأسطر الفرعيّة تنزل تحت) */
  #aiTable td{ vertical-align: top; }
  #aiTable td input, #aiTable td select{ margin-top:0; }
  #gpTable .pcol{ display:none; }
  #gpTable.pieceMode .wcol{ display:none; }
  #gpTable.pieceMode .pcol{ display:table-cell; }
  button.mini{ padding:6px 12px; font-size:13px; background:#fff; border:1px solid var(--line); color:var(--ink); margin-inline-start:4px; box-shadow:none; font-weight:700; }
  button.mini:hover{ background:#F4EFE9; filter:none; border-color:var(--gold); }
  button.mini.danger{ border-color:var(--red); color:var(--red); }
  button.mini.danger:hover{ background:rgba(176,57,46,.08); border-color:var(--red); }
  .lang{ font-size:13px; color:var(--maroon); cursor:pointer; background:#fff; border:1px solid var(--line); border-radius:20px; padding:6px 14px; font-weight:700; box-shadow:none; }
  .lang:hover{ background:#F4EFE9; filter:none; }

  /* ===== قالب فاتورة PDF (مدموج من القالب) ===== */
  /* ============ قالب الفاتورة — مطابق للأصل ============ */
  #invoice{
    position:absolute;top:-13000px;right:0;
    width:794px;min-height:1050px;background:#fff;color:#000;
    font-family:'Tajawal',Arial,sans-serif;padding:28px 46px 20px;direction:rtl;
    overflow:hidden;
  }
  #invoice .wm{
    position:absolute;top:110px;right:50%;transform:translateX(50%);
    width:430px;opacity:.28;z-index:0;pointer-events:none;
  }
  #invoice .z{position:relative;z-index:1}
  .qr-row{display:flex;justify-content:space-between;align-items:flex-start}
  .qr-row .qr{width:112px;text-align:center}
  .qr-row .qr img{width:100%;display:block}
  .qr-row .qr .cap{font-size:9px;font-weight:800;letter-spacing:.5px;margin-top:2px}
  .qr-row .bcmid{width:220px;text-align:center;padding-top:6px}
  .qr-row .bcmid svg{width:100%;height:34px;display:block}
  .qr-row .bcmid .cd{font-size:9.5px;font-weight:800;letter-spacing:1px;margin-top:2px;direction:ltr}
  .inv-title{text-align:center;margin:6px 0 26px}
  .inv-title .ar{font-size:20px;font-weight:800}
  .inv-title .en{font-size:18px;font-weight:800;text-decoration:underline;font-family:Arial,'Tajawal'}
  .meta{margin:0 26px}
  .meta .mrow{display:grid;grid-template-columns:150px 1fr 150px;align-items:center;direction:ltr;margin-bottom:9px;font-size:14px}
  .meta .en-l{text-align:left;font-weight:800;font-family:Arial,'Tajawal'}
  .meta .val{text-align:center;font-weight:800}
  .meta .ar-l{text-align:right;font-weight:800}
  .meta .val.red{color:#E02020}
  .meta .addr-box{border:1.5px solid #000;min-height:96px;display:flex;align-items:center;justify-content:center;font-weight:800;padding:8px}
  .meta .mrow.addr{align-items:flex-start}
  .meta .mrow.addr .en-l,.meta .mrow.addr .ar-l{padding-top:36px}

  table.inv{width:100%;border-collapse:collapse;font-size:13px;margin-top:16px}
  table.inv th,table.inv td{border:1.2px solid #000;padding:4px 6px;text-align:center}
  table.inv th{font-weight:800;line-height:1.25;letter-spacing:normal}
  table.inv th .en{display:block;font-size:11px;font-family:Arial,'Tajawal'}
  table.inv td{height:24px;font-weight:700}
  table.inv td.desc{text-align:right}
  table.inv tr.disc td{background:#E8474F;color:#fff;font-weight:800;border-color:#000}
  table.inv tr.total td{font-weight:800;font-size:15px}
  table.inv tr.total td.lbl-t{text-align:left;font-family:Arial,'Tajawal'}

  .inv-foot{margin-top:56px;text-align:center;font-size:12.5px;font-weight:700;line-height:1.9}
  .inv-foot .en{font-family:Arial,'Tajawal'}
  .wa-line{display:flex;align-items:center;gap:5px;font-size:12px;font-weight:700;margin-top:26px;direction:ltr;justify-content:flex-start;font-family:Arial,'Tajawal'}
  .wa-line img{width:20px;height:20px}

  /* ===== المعاينة ===== */
  #pdfOverlay{display:none;position:fixed;inset:0;z-index:10500;   /* v9.59: was 50 — the sticky top bar (800) covered it on the phone */background:rgba(20,12,5,.93);overflow:auto;padding:16px 12px 130px}
  #pdfOverlay.show{display:block}
  #pdfOverlay{padding-bottom:20px}
  #pdfOverlay .hint{color:#E4C27A;font-size:13px;text-align:center;margin-bottom:10px;font-weight:700}
  #pdfOverlay img{width:100%;border-radius:8px;box-shadow:0 8px 40px rgba(0,0,0,.6);display:block;background:#fff}
  #pdfOverlay .obar{display:flex;gap:10px;margin-top:14px;padding-bottom:calc(90px + env(safe-area-inset-bottom))}
  #pdfOverlay .obar button{flex:1;padding:15px;border-radius:14px;font-family:'Tajawal';font-weight:800;font-size:15px;cursor:pointer}
  #pdfBtnSave{background:#C08A2D;color:#241609;border:none}
  #pdfBtnWa{background:#25D366;color:#0b3d1f;border:none}
  #pdfBtnShare{background:#1f6f8b;color:#fff;border:none}
  #pdfBtnWaFull{background:#25D366;color:#0b3d1f;border:none;font-weight:800}
  #pdfBtnWa{background:#e9e3d6;color:#3a2a15;border:none}
  /* ===== قفل الإجراءات حسب الدور (الطبقة 2c: لكل جدول، مطابق لـRLS) ===== */
  body.no-delete [onclick^="deleteProduct"], body.no-delete [data-click^="deleteProduct"],
  body.no-delete [onclick^="deleteBatch"], body.no-delete [data-click^="deleteBatch"],
  body.no-delete [onclick^="deleteGradeFromList"], body.no-delete [data-click^="deleteGradeFromList"],
  body.no-delete [onclick^="deleteCustomer"], body.no-delete [data-click^="deleteCustomer"],
  body.no-delete [onclick^="deleteInvestor"], body.no-delete [data-click^="deleteInvestor"],
  body.no-delete [onclick^="deleteConsignor"], body.no-delete [data-click^="deleteConsignor"],
  body.no-delete [onclick^="deletePayment"], body.no-delete [data-click^="deletePayment"],
  body.no-delete [onclick^="deleteExpense"], body.no-delete [data-click^="deleteExpense"],
  body.no-delete [onclick^="deleteReturn"], body.no-delete [data-click^="deleteReturn"],
  body.no-delete [onclick^="deleteLedger"], body.no-delete [data-click^="deleteLedger"],
  body.no-delete [onclick^="restoreItem"], body.no-delete [data-click^="restoreItem"]{display:none !important}
  /* v2.98: الشريك مستثنى من no-delete (يحتاج رؤية أزرار الحذف الخمسة كي يعترضها الجافاسكربت
     ويعرض بوب-أب الطلب)، لكن هذه الأزرار الأربعة تبقى مخفية عنه تحديداً — خارج نظام الطلبات أصلاً */
  body.partner-role [onclick^="deleteInvestor"], body.partner-role [data-click^="deleteInvestor"],
  body.partner-role [onclick^="deleteConsignor"], body.partner-role [data-click^="deleteConsignor"],
  body.partner-role [onclick^="deletePayment"], body.partner-role [data-click^="deletePayment"],
  body.partner-role [onclick^="deleteLedger"], body.partner-role [data-click^="deleteLedger"]{display:none !important}
  /* المخزون (منتجات/دفعات/أصناف): مدير + مسجّل بيانات */
  body.cant-write-inventory [onclick^="saveProduct"], body.cant-write-inventory [data-click^="saveProduct"],
  body.cant-write-inventory [onclick^="editProduct"], body.cant-write-inventory [data-click^="editProduct"],
  body.cant-write-inventory [onclick^="saveBatch"], body.cant-write-inventory [data-click^="saveBatch"],
  body.cant-write-inventory [onclick^="editBatch"], body.cant-write-inventory [data-click^="editBatch"],
  body.cant-write-inventory [onclick^="saveAllGrades"], body.cant-write-inventory [data-click^="saveAllGrades"],
  body.cant-write-inventory [onclick^="editGradeFromList"], body.cant-write-inventory [data-click^="editGradeFromList"],
  body.cant-write-inventory [onclick^="addGradeRow"], body.cant-write-inventory [data-click^="addGradeRow"],
  body.cant-write-inventory [onclick^="removeGradeRow"], body.cant-write-inventory [data-click^="removeGradeRow"]{display:none !important}
  /* العملاء: مدير + مبيعات + مسجّل بيانات */
  body.cant-write-customers [onclick^="saveCustomer"], body.cant-write-customers [data-click^="saveCustomer"],
  body.cant-write-customers [onclick^="editCustomer"], body.cant-write-customers [data-click^="editCustomer"],
  body.cant-write-customers [onclick^="saSaveNewCust"], body.cant-write-customers [data-click^="saSaveNewCust"],
  body.cant-write-customers [onclick^="aiSaveNewCust"], body.cant-write-customers [data-click^="aiSaveNewCust"],
  body.cant-write-customers [onclick^="saToggleNewCust"], body.cant-write-customers [data-click^="saToggleNewCust"],
  body.cant-write-customers [onclick^="aiToggleNewCust"], body.cant-write-customers [data-click^="aiToggleNewCust"]{display:none !important}
  /* البيع/المزاد/الدفعات: مدير + مبيعات */
  body.cant-write-sales [onclick^="saveSale"], body.cant-write-sales [data-click^="saveSale"],
  body.cant-write-sales [onclick^="saveSession"], body.cant-write-sales [data-click^="saveSession"],
  body.cant-write-sales [onclick^="saveAllAuction"], body.cant-write-sales [data-click^="saveAllAuction"],
  body.cant-write-sales [onclick^="savePayment"], body.cant-write-sales [data-click^="savePayment"],
  body.cant-write-sales [onclick^="payFull"], body.cant-write-sales [data-click^="payFull"],
  body.cant-write-sales [onclick^="generateInvoices"], body.cant-write-sales [data-click^="generateInvoices"],
  body.cant-write-sales [onclick^="toggleSessionClosed"], body.cant-write-sales [data-click^="toggleSessionClosed"],
  body.cant-write-sales [onclick^="addAuctionRow"], body.cant-write-sales [data-click^="addAuctionRow"],
  body.cant-write-sales [onclick^="addAuctionFreeRow"], body.cant-write-sales [data-click^="addAuctionFreeRow"],
  body.cant-write-sales [onclick^="auRemoveRow"], body.cant-write-sales [data-click^="auRemoveRow"],
  body.cant-write-sales [onclick^="saAddRow"], body.cant-write-sales [data-click^="saAddRow"],
  body.cant-write-sales [onclick^="saAddFreeRow"], body.cant-write-sales [data-click^="saAddFreeRow"],
  body.cant-write-sales [onclick^="saveReturn"], body.cant-write-sales [data-click^="saveReturn"],
  body.cant-write-sales [onclick^="editReturn"], body.cant-write-sales [data-click^="editReturn"]{display:none !important}
  /* المستثمرون/الأصحاب/الخزينة: مدير وحده — الشريك ليس منهم (اطّلاع فقط أو مخفيّة تماماً) */
  body.cant-write-invledger [onclick^="saveInvestor"], body.cant-write-invledger [data-click^="saveInvestor"],
  body.cant-write-invledger [onclick^="editInvestor"], body.cant-write-invledger [data-click^="editInvestor"],
  body.cant-write-invledger [onclick^="saveConsignor"], body.cant-write-invledger [data-click^="saveConsignor"],
  body.cant-write-invledger [onclick^="editConsignor"], body.cant-write-invledger [data-click^="editConsignor"],
  body.cant-write-invledger [onclick^="saveLedger"], body.cant-write-invledger [data-click^="saveLedger"],
  body.cant-write-invledger [onclick^="editLedger"], body.cant-write-invledger [data-click^="editLedger"]{display:none !important}
  /* v7.80: الشريك — إضافة فقط (saveLedger/saveConsignor ظاهرة) */
  body.partner-invledger [onclick^="saveInvestor"], body.partner-invledger [data-click^="saveInvestor"],
  body.partner-invledger [onclick^="editInvestor"], body.partner-invledger [data-click^="editInvestor"],
  body.partner-invledger [onclick^="editConsignor"], body.partner-invledger [data-click^="editConsignor"],
  body.partner-invledger [onclick^="editLedger"], body.partner-invledger [data-click^="editLedger"]{display:none !important}
  /* المصروفات: مدير + شريك (صلاحيّة كاملة) */
  body.cant-write-expense [onclick^="saveExpense"], body.cant-write-expense [data-click^="saveExpense"],
  body.cant-write-expense [onclick^="editExpense"], body.cant-write-expense [data-click^="editExpense"]{display:none !important}
  #pdfBtnClose{background:none;color:#E4C27A;border:1.5px solid #C08A2D}
  #pdfBusy{display:none;position:fixed;inset:0;z-index:10550;   /* v9.59: was 60 */background:rgba(20,12,5,.7);color:#E4C27A;font-weight:800;font-size:16px;align-items:center;justify-content:center}
  #pdfBusy.show{display:flex}
.colbar{ position:relative; display:flex; justify-content:flex-end; margin:0 0 8px; }
.colbtn{ font-size:12.5px; font-weight:800; color:var(--maroon); background:#fff; border:1px solid var(--line); border-radius:20px; padding:6px 13px; cursor:pointer; }
.colbtn:hover{ background:#F6EEDD; }
.colpanel{ position:absolute; top:calc(100% + 6px); inset-inline-end:0; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 44px rgba(43,18,22,.2); z-index:7000; padding:6px; min-width:250px; max-height:380px; overflow:auto; }
.colpanel .coltitle{ font-size:12px; font-weight:800; color:#8A6D14; padding:8px 10px 6px; letter-spacing:.3px; }
.colpanel .colrow{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px; border-radius:8px; font-size:13.5px; cursor:pointer; color:var(--maroon); }
.colpanel .colrow:hover{ background:#F6EEDD; }
.colpanel .colrow input{ width:18px; height:18px; accent-color:var(--maroon); cursor:pointer; flex:0 0 auto; }
.colpanel .colfoot{ margin-top:6px; padding:8px 6px 4px; border-top:1px solid var(--line); }
.colpanel .colfoot button{ width:100%; font-size:12.5px; padding:8px; border-radius:8px; border:1px solid var(--line); background:#fff; cursor:pointer; color:var(--maroon); font-weight:800; }
.colpanel .colfoot button:hover{ background:#F6EEDD; }
@media print {
  /* ═══ v5.32 — 35 ورقة فارغة لفاتورة واحدة ═══
     `visibility:hidden` **يخفي ولا يزيل**: العنصر يحتفظ بمساحته
     كاملةً. فحين يطبع المتصفّح صفحة النظام كلّها (Ctrl+P أو زرّ
     الطابعة في المتصفّح لا زرّ 🖨 في النظام)، تبقى الشاشات الطويلة
     — جداول الفواتير والمزاد بعشرات الصفوف — تشغل ارتفاعها كاملاً
     فيخرج ورق فارغ بعددها، والفاتورة وحدها ظاهرة في أوّلها.
     العلاج: `display:none` على أبناء body مباشرةً — يزيل المساحة
     نفسها فلا يبقى ما يُطبع سوى الفاتورة. */
  body > *:not(#pdfOverlay) { display: none !important; }
  #pdfOverlay:not(.show) { display: none !important; }
  #pdfOverlay.show { display:block !important; position:absolute !important;
                     inset:0 !important; background:#fff !important; padding:0 !important; }
  #pdfOverlay.show * { visibility: visible !important; }
  #pdfOverlay .hint, #pdfOverlay .obar { display:none !important; }
  #pdfImg { max-width:100% !important; height:auto !important; box-shadow:none !important; }
  @page { margin: 8mm; }
}
/* تجميل جدول الأصناف */
#ctbl_grades{ font-variant-numeric:tabular-nums; }
#ctbl_grades tbody tr:nth-child(even){ background:#FBF7EF; }
#ctbl_grades tbody tr:hover{ background:#F4EAD4; }
#ctbl_grades td:first-child{ position:sticky; inset-inline-start:0; z-index:1; background:#fff; font-weight:800; box-shadow:2px 0 0 rgba(0,0,0,.05); }
#ctbl_grades tbody tr:nth-child(even) td:first-child{ background:#FBF7EF; }
#ctbl_grades td:nth-child(7), #ctbl_grades td:nth-child(8), #ctbl_grades td:nth-child(10){ font-weight:800; color:var(--maroon); }
/* ===== المزاد: توسيع على الكمبيوتر ===== */
@media(min-width:1200px){ body.scr-auction .wrap{ max-width:1520px; } }
/* شريط الملخّص الحيّ */
#auSummaryBar{ display:flex; flex-wrap:wrap; gap:10px; margin:6px 0 12px; }
#auSummaryBar .sK{ flex:1; min-width:130px; background:linear-gradient(135deg,#5B0F1A,#7a1f2b); color:#fff; border-radius:12px; padding:10px 14px; box-shadow:var(--shadow); }
#auSummaryBar .sK .lab{ font-size:12px; opacity:.85; }
#auSummaryBar .sK .val{ font-size:20px; font-weight:800; margin-top:2px; }
#auSummaryBar .sK.masked{ cursor:pointer; }
#auSummaryBar .sK.masked .val{ opacity:.75; }
#auPrivBtn, #dashPrivBtn{ background:var(--maroon); color:#fff; border:2px solid var(--gold); border-radius:999px; padding:10px 18px; font-size:15px; font-weight:800; cursor:pointer; font-family:inherit; white-space:nowrap; box-shadow:0 3px 10px rgba(0,0,0,.18); }
  .aiNameWrap{ display:flex; align-items:center; gap:4px; cursor:pointer; border-radius:6px; padding:1px 3px; margin-top:2px; transition:background .12s; }
  .aiNameWrap:hover{ background:#f3ead9; }
  .aiNameWrap .aiCopyIc{ font-size:12px; line-height:1; opacity:.6; }
  .aiNameWrap.copied{ background:#DCF3E3; }
  .aiNameWrap.copied .aiCopyIc{ opacity:1; }
  body.no-profit .col-profit,
  body.no-profit .col-cost{ display:none !important; }
  .homeGrid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
  .homeBtn{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
    min-height:120px; padding:18px; border-radius:16px; border:2px solid var(--line);
    background:var(--card); color:var(--maroon); font-family:inherit; font-size:18px; font-weight:800;
    cursor:pointer; box-shadow:var(--shadow); transition:transform .08s; }
  .homeBtn .hIc{ font-size:34px; line-height:1; }
  .homeBtn:active{ transform:scale(.98); }
  .homeBtn.big{ min-height:175px; font-size:25px; background:var(--maroon); color:#fff; border-color:var(--maroon); }
  .homeBtn.big .hIc{ font-size:48px; }
  .homeBtn.big.gold{ background:var(--gold); color:#241609; border-color:var(--gold); }
  @media (max-width:640px){ .homeGrid{ grid-template-columns:1fr; } .homeBtn.big{ min-height:130px; } }
#auPrivBtn.on, #dashPrivBtn.on{ background:#1a7f3c; border-color:#1a7f3c; }
  body.priv-on .money > .mv{ display:none; }
  body.priv-on .money::after{ content:"✱✱✱✱"; color:var(--mut); font-weight:800; }
  body.priv-on #dashChart{ display:none; }
  #dashChartHidden{ display:none; }
  body.priv-on #dashChartHidden{ display:block; }
/* ===== v2.45: شاشة البيع + نافذة «تمّ» — بطاقات إدخال على الهاتف والآيباد =====
   نفس نمط بطاقات المزاد: العنوان فوق الحقل، والحقل بعرض البطاقة كاملاً. */
@media(max-width:1100px){
  #saTable{ min-width:0 !important; display:block; }
  #saTable thead{ display:none; }
  #saTable tbody{ display:block; }
  #saTable tr{ display:block; border:1px solid var(--line); border-radius:14px; margin-bottom:12px;
               padding:8px 12px; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.05); }
  #saTable tr.saFreeRow{ background:#e7f0fb; }
  #saTable td{ display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center;
               gap:6px 12px; padding:6px 0; border:none !important; text-align:start; white-space:normal; }
  #saTable td:not(:last-child){ border-bottom:1px dashed #eadfce !important; }
  #saTable td::before{ content:attr(data-label); font-weight:800; color:var(--maroon); font-size:12px; flex:0 0 100%; }
  #saTable td[data-label=""]::before{ content:none; }
  #saTable td input, #saTable td select{ flex:1 1 auto; min-width:100px !important; width:auto !important; max-width:100%; }
  #saTable td[data-label=""]{ justify-content:flex-end; gap:8px; }
  #saTable .saName2, #saTable .saShare, #saTable .saAvail{ flex-basis:100%; }
  #saTable td[data-label=""] button{ flex:0 0 auto; }

  /* نافذة «تمّ»: كلّ صفّ عميل يصير بطاقة مستقلّة */
  #tmRows{ display:block; }
  #tmRows tr{ display:block; border:1px solid var(--line); border-radius:12px; margin-bottom:10px;
              padding:8px 10px; background:#fff; }
  #tmRows td{ display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:5px 0;
              border:none !important; text-align:start; white-space:normal; }
  #tmRows td:not(:last-child){ border-bottom:1px dashed #eadfce !important; }
  #tmRows td::before{ content:attr(data-label); font-weight:800; color:var(--maroon); font-size:12px; flex:0 0 100%; }
  #tmRows td[data-label=""]::before{ content:none; }
  #tmRows td input{ flex:1 1 auto; min-width:100px !important; width:auto !important; max-width:100%; }
  #tmRows .tmAddCust{ flex-basis:100%; }
  #tmRows td[data-label=""]{ justify-content:flex-end; }
}
/* ===== v2.49: توزيع الدفعة — بطاقات إدخال على الهاتف والآيباد ===== */
@media(max-width:1100px){
  #gpTable{ min-width:0 !important; display:block; }
  #gpTable thead{ display:none; }
  #gpTable tbody{ display:block; }
  #gpTable tr{ display:block; border:1px solid var(--line); border-radius:14px; margin-bottom:12px;
               padding:8px 12px; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.05); }
  #gpTable td{ display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center;
               gap:6px 12px; padding:6px 0; border:none !important; text-align:start; white-space:normal; }
  #gpTable td:not(:last-child){ border-bottom:1px dashed #eadfce !important; }
  #gpTable td::before{ content:attr(data-label); font-weight:800; color:var(--maroon); font-size:12px; flex:0 0 100%; }
  #gpTable td[data-label=""]::before{ content:none; }
  #gpTable td input{ flex:1 1 auto; min-width:0 !important; width:100% !important; max-width:100%; }
  #gpTable td[data-label=""]{ justify-content:flex-end; }
}
@media(max-width:1100px){
  #aiTable{ min-width:0 !important; display:block; }
  #aiTable thead{ display:none; }
  #aiTable tbody{ display:block; }
  #aiTable tr{ display:block; border:1px solid var(--line); border-radius:14px; margin-bottom:12px; padding:8px 12px; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.05); }
  #aiTable td{ display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:6px 12px; padding:6px 0; border:none !important; text-align:start; white-space:normal; }
  #aiTable td:not(:last-child){ border-bottom:1px dashed #eadfce !important; }
  #aiTable td::before{ content:attr(data-label); font-weight:800; color:var(--maroon); font-size:12px; flex:0 0 100%; }
  #aiTable td[data-label=""]::before{ content:none; }
  #aiTable td input, #aiTable td select{ flex:1 1 auto; min-width:100px !important; width:auto !important; max-width:100%; }
  #aiTable td[data-label=""]{ justify-content:flex-end; }
  #aiTable .aiName, #aiTable .aiShare, #aiTable .aiNameWrap, #aiTable .aiTm{ flex-basis:100%; }
}
/* v7.33 — المزادات التاريخيّة (2…39): لون رَقّ قديم يميّزها في كلّ شاشة */
tr.histRow > td{ background:#F3ECDD !important; }
.histTag{ display:inline-block; background:#E9DDC4; color:#6B4E1E; border:1px solid #CDB88E;
  border-radius:6px; font-size:10.5px; font-weight:700; padding:1px 6px; margin-inline-start:4px;
  white-space:nowrap; vertical-align:middle; }
.aucNo{ display:block; font-size:11px; font-weight:700; color:var(--maroon); margin-top:2px; }

/* v7.54: بيعة مزاد فاتورتها ملغاة */
#aiGrid tr.aiCancelled td, #aiGrid tr.aiCancelled input, #aiGrid tr.aiCancelled select, #aiGrid tr.aiCancelled .aiName{ text-decoration:line-through; color:#C0392B !important; }
#aiGrid tr.aiCancelled .cxTag{ text-decoration:none !important; }
/* ═══════════ v7.67 — الآيفون ═══════════ */
.auSum{ display:none; }
#auFoldBar{ display:none; }
#navLogout{ display:none; }
#tipToast{ position:fixed; inset-inline:12px; bottom:calc(84px + env(safe-area-inset-bottom,0px)); z-index:12000;
  background:#2b1216; color:#fff; padding:11px 14px; border-radius:12px; font-size:14px; line-height:1.6;
  box-shadow:0 6px 22px rgba(0,0,0,.25); display:none; }
#tipToast.show{ display:block; }
@media(max-width:760px){
  body:not([data-scr="dashboard"]):not([data-scr="home"]) #companyCard,
  body:not([data-scr="dashboard"]):not([data-scr="home"]) #backupNag{ display:none !important; }
  #navLogout{ display:flex; }
  .tabs{ flex-wrap:wrap; }
  .tabs button{ flex:1 1 auto; min-width:max-content; }
  .wrap{ padding-bottom:calc(92px + env(safe-area-inset-bottom, 0px)) !important; }
  .invQk{ flex-direction:row !important; gap:6px !important; }
  .invQk > button.mini{ height:auto !important; min-height:38px !important; line-height:1.2 !important;
                        padding:6px 12px !important; font-size:16px !important; }
  #auFoldBar{ display:flex; gap:8px; margin:6px 0 10px; }
  #auFoldBar button{ flex:1; min-height:40px; }
  #aiGrid .auSum{ display:flex; align-items:flex-start; gap:8px; width:100%; cursor:pointer;
                  font-size:14px; line-height:1.5; color:var(--ink); font-weight:600; flex-basis:100%; }
  #aiGrid .auSum .sLot{ color:var(--maroon); font-weight:800; white-space:nowrap; }
  #aiGrid .auSum .sTxt{ flex:1; min-width:0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  #aiGrid tr > td:first-child{ width:auto !important; min-width:0 !important; max-width:none !important; }
  #aiGrid .auSum .sAmt{ font-weight:800; white-space:nowrap; color:var(--maroon); }
  #aiGrid .auSum .sTag{ font-size:11.5px; font-weight:800; margin-inline-start:4px; }
  #aiGrid .auSum .sArr{ color:var(--mut); }
  #aiGrid tr.auFold > td:not(:first-child){ display:none !important; }
  #aiGrid tr.auFold > td:first-child > *:not(.auSum){ display:none !important; }
  #aiGrid tr.auFold > td:first-child::before{ content:none !important; }
  #aiGrid tr.auFold > td:first-child{ border-bottom:none !important; padding:2px 0 !important; }
  #aiGrid tr:not(.auFold) .auSum{ border-bottom:1px solid var(--line); padding-bottom:6px; margin-bottom:4px; }
}

/* v8.02 — أقسام القائمة الجانبيّة قابلة للطيّ */
.side .grpT{ display:flex; align-items:center; gap:6px; cursor:pointer; user-select:none; padding:6px 4px; margin:12px 6px 2px; border-radius:8px; font-size:12px; letter-spacing:.3px; opacity:1; }
.side .grpT:hover{ background:rgba(255,255,255,.06); }
.side .grpT:focus-visible{ outline:2px solid var(--gold); outline-offset:1px; }
.side .grpT .grpName{ flex:1; }
.side .grpT .grpCnt{ font-size:10.5px; font-weight:700; color:rgba(247,240,232,.55); }
.side .grpT .grpChev{ width:7px; height:7px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg); transition:transform .15s; margin-inline-start:4px; }
.side .grpT:not(.open) .grpChev{ transform:rotate(135deg); }
[dir="ltr"] .side .grpT:not(.open) .grpChev{ transform:rotate(-45deg); }
.side button.secHidden{ display:none !important; }
.side .navSep{ height:1px; background:rgba(212,175,55,.28); margin:12px 10px; }
@media (min-width:1101px){
  .side.collapsed .grpT{ font-size:0; line-height:0; height:1px; margin:10px 12px; padding:0; background:rgba(212,175,55,.28); pointer-events:none; }
  .side.collapsed .grpT .grpCnt, .side.collapsed .grpT .grpChev{ display:none; }
  .side.collapsed button.secHidden:not([style*="none"]){ display:flex !important; }
}

/* ═══ v8.02 — القائمة الجانبيّة الفاخرة (اختيار المالك) ═══
   النهار: عنّابيّ مخمليّ + كبسولة ذهبيّة للشاشة المفتوحة.  الليل: أسود وذهبيّ + خطّ ذهبيّ جانبيّ.
   الخطوط من موقعنا (vendor/fonts — رخصة OFL): Amiri للعناوين والشعار، IBM Plex Sans Arabic للأسماء. */
@font-face{font-family:'Amiri';font-style:normal;font-weight:400;font-display:swap;src:url(vendor/fonts/amiri-arabic-400-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-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;}
@font-face{font-family:'Amiri';font-style:normal;font-weight:400;font-display:swap;src:url(vendor/fonts/amiri-latin-400-normal.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:'Amiri';font-style:normal;font-weight:700;font-display:swap;src:url(vendor/fonts/amiri-arabic-700-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-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;}
@font-face{font-family:'Amiri';font-style:normal;font-weight:700;font-display:swap;src:url(vendor/fonts/amiri-latin-700-normal.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:'Plex Arabic';font-style:normal;font-weight:300;font-display:swap;src:url(vendor/fonts/ibm-plex-sans-arabic-arabic-300-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-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;}
@font-face{font-family:'Plex Arabic';font-style:normal;font-weight:300;font-display:swap;src:url(vendor/fonts/ibm-plex-sans-arabic-latin-300-normal.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:'Plex Arabic';font-style:normal;font-weight:400;font-display:swap;src:url(vendor/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-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;}
@font-face{font-family:'Plex Arabic';font-style:normal;font-weight:400;font-display:swap;src:url(vendor/fonts/ibm-plex-sans-arabic-latin-400-normal.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:'Plex Arabic';font-style:normal;font-weight:500;font-display:swap;src:url(vendor/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-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;}
@font-face{font-family:'Plex Arabic';font-style:normal;font-weight:500;font-display:swap;src:url(vendor/fonts/ibm-plex-sans-arabic-latin-500-normal.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;}
#sideNav{ --lx-bg:#2A0910; --lx-bg2:#20060B; --lx-line:#4A1A22; --lx-text:#F3E6D6; --lx-icon:#B08A5A; --lx-gold:#E2C27A; --lx-gold2:#B08A5A;
  background:linear-gradient(180deg,var(--lx-bg) 0%,var(--lx-bg2) 100%); border:1px solid var(--lx-line); font-family:'Plex Arabic',"Segoe UI",Tahoma,sans-serif; }
#sideNav .sideBrand{ text-align:center; padding:6px 0 4px; }
#sideNav .sideBrand .bn{ font-family:'Amiri',serif; font-weight:700; font-size:25px; line-height:1.2; color:var(--lx-gold); letter-spacing:.5px; }
#sideNav .sideBrand .bs{ font-family:'Amiri',serif; font-size:10.5px; letter-spacing:5px; color:var(--lx-gold2); margin-top:1px; }
#sideNav .sideBrand::after{ content:""; display:block; height:1px; margin:12px 8px 6px; background:linear-gradient(90deg,transparent,var(--lx-gold),transparent); opacity:.8; }
#sideNav button{ font-family:inherit; font-weight:400; font-size:14px; color:var(--lx-text); border-radius:22px; letter-spacing:.1px; }
#sideNav button .ic{ color:var(--lx-icon); }
#sideNav .ic svg{ stroke-width:1.4; }
#sideNav button:hover{ background:rgba(226,194,122,.08); color:#fff; }
#sideNav button.active{ background:var(--lx-gold); color:var(--lx-bg); font-weight:500; box-shadow:0 2px 12px rgba(226,194,122,.18); }
#sideNav button.active .ic{ color:var(--lx-bg); }
#sideNav button.side-toggle, #sideNav #drawerCloseBtn{ border-radius:10px; }
#sideNav button[data-step]::before{ color:var(--lx-gold2); font-weight:500; }
#sideNav button.active[data-step]::before{ color:var(--lx-bg); }
#sideNav .grpT{ font-family:'Amiri',serif; font-weight:700; font-size:15px; letter-spacing:0; color:var(--lx-gold); margin:14px 6px 2px; padding:4px 8px; }
#sideNav .grpT:hover{ background:rgba(226,194,122,.06); }
#sideNav .grpT .grpCnt{ font-family:'Plex Arabic',sans-serif; font-weight:400; color:var(--lx-gold2); }
#sideNav .navSep{ background:linear-gradient(90deg,transparent,var(--lx-line),transparent); height:1px; }
#sideNav button[data-lvl="2"]::after, #sideNav button[data-lvl="3"]::after,
#sideNav button[data-lvl="2"] .ic::before, #sideNav button[data-lvl="3"] .ic::before{ background:rgba(176,138,90,.45); }
.side.collapsed .sideBrand .bs, .side.collapsed .sideBrand .bn{ font-size:0; }
.side.collapsed .sideBrand .bn::before{ content:"ع"; font-size:24px; }
@media(max-width:1100px){ .side.collapsed .sideBrand .bn{ font-size:25px; } .side.collapsed .sideBrand .bs{ font-size:10.5px; } .side.collapsed .sideBrand .bn::before{ content:none; } }
/* الليل: الجسم كلّه مقلوب (body.dark) ⟵ قلب مزدوج للقائمة فتظهر ألوانها كما كُتبت هنا */
body.dark #sideNav{ filter:invert(1) hue-rotate(180deg) !important;
  --lx-bg:#0F0D0B; --lx-bg2:#0A0908; --lx-line:#2A2418; --lx-text:#E9E1D0; --lx-icon:#8C7A52; --lx-gold:#C9A75B; --lx-gold2:#8C7A52;
  background:linear-gradient(180deg,var(--lx-bg) 0%,var(--lx-bg2) 100%) !important; }
body.dark #sideNav button, body.dark #sideNav .lbl{ color:var(--lx-text) !important; }
body.dark #sideNav button.active{ background:rgba(201,167,91,.10) !important; color:#E5C77E !important; box-shadow:none;
  border-radius:0; border-inline-start:2px solid var(--lx-gold); }
body.dark #sideNav button.active .ic{ color:#E5C77E; }

/* ═══ v8.03 — اللمسة الفاخرة لكامل البرنامج (طلب المالك) ═══
   نفس روح القائمة: عاجيّ دافئ · ذهبيّ مطفي · عنّابيّ عميق · Amiri للعناوين · IBM Plex Arabic للنصوص.
   طبقة أخيرة تتجاوز الأساس فقط — لا تمسّ مستندات الطباعة/PDF (الفاتورة، تقرير المستثمر، ورقة التجهيز، الملصقات).
   الليل كما هو: قلب الصفحة كاملة (body.dark) ⟵ العاجيّ يصير أسود دافئاً والذهبيّ يبقى ذهبيّاً. */
:root{ --bg:#F6F1E8; --card:#FFFDF9; --line:#E8DDCB; --ink:#2A1216; --mut:#8A7B6E;
       --gold:#B8924A; --gold-soft:#E6D3A8; --maroon:#4A0F1A; --maroon-2:#62182A;
       --radius:18px; --shadow:0 1px 2px rgba(42,9,16,.04), 0 14px 34px rgba(42,9,16,.05); }
body{ font-family:'Plex Arabic',"Segoe UI",Tahoma,Arial,sans-serif; background:var(--bg); letter-spacing:.1px; }
:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet){ font-family:"Segoe UI",Tahoma,Arial,sans-serif; letter-spacing:normal; }
.brand{ font-family:'Amiri',serif; font-weight:700; letter-spacing:.3px; }
.top{ border-bottom:0; background-image:linear-gradient(90deg,transparent,rgba(184,146,74,.55),transparent); background-size:100% 1px; background-repeat:no-repeat; background-position:bottom; }
#sideNav button{ box-shadow:none; }
#sideNav button.active{ box-shadow:0 2px 12px rgba(226,194,122,.18); }
body.dark #sideNav button.active{ box-shadow:none; }
.card{ border-color:var(--line); }
h2:not(:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet) *){ font-family:'Amiri',serif; font-weight:700; font-size:22px; letter-spacing:0; }
h3:not(:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet) *){ font-family:'Amiri',serif; font-weight:700; }
label{ color:var(--mut); font-weight:400; }
input,select,textarea{ font-family:inherit; }
input,select{ background:#FFFEFB; border-color:#E6DACB; border-radius:12px; }
input:focus,select:focus,textarea:focus{ border-color:var(--gold); box-shadow:0 0 0 3px rgba(184,146,74,.16); }
button{ font-weight:500; letter-spacing:.2px; border-radius:12px; background:var(--maroon); color:#F6E9CF;
        box-shadow:inset 0 0 0 1px rgba(226,194,122,.22), 0 2px 10px rgba(74,15,26,.14); }
button:hover{ filter:none; background:var(--maroon-2); }
button.ghost{ background:transparent; color:var(--maroon); border:1px solid #E2D3B8; box-shadow:none; }
button.ghost:hover{ background:#F6EEDD; }
button.mini{ font-weight:500; background:#FFFDF9; border-color:#E6D9C2; color:var(--ink); box-shadow:none; }
button.mini:hover{ background:#F6EEDD; border-color:var(--gold); }
button.green{ background:#2E6B50; box-shadow:inset 0 0 0 1px rgba(255,255,255,.12); }
th:not(:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet) *){ color:#8A6D3B; font-weight:500; font-size:12px; letter-spacing:.3px; border-bottom:1px solid #E2D3B8; }
td:not(:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet) *){ border-bottom-color:#F0E7D8; }
tbody tr:not(:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet) *):hover{ background:#FBF6EC; }
.hubBtn, .geoCard{ border-width:1px; border-color:var(--line); background:#FFFDF9; }
.hubBtn .hT, .geoCard .nm{ font-weight:500; }
.hubBtn .hN, .geoCard .cn{ font-family:'Amiri',serif; font-weight:700; }
.backBtn{ font-weight:500; border-width:1px; }
.gsinput{ font-family:inherit; background:#FFFEFB; }
.dlgHead{ font-family:'Amiri',serif; }
/* الليل: الصفحة مقلوبة ⟵ الزرّ الأساسيّ يُكتب بلون «قبل القلب» ليظهر أسودَ دافئاً بنصّ ذهبيّ (بدل الورديّ الفاتح) */
:where(body.dark) button{ background:#EDE7DF; color:#7A5A18; box-shadow:inset 0 0 0 1px rgba(122,90,24,.45); }
:where(body.dark) button:hover{ background:#E2DACF; }
body.dark .tabs button.active, body.dark .nav button.active{ background:#EDE7DF; color:#7A5A18; border-color:#7A5A18; }
.tabs button.active, .nav button.active{ color:#F6E9CF; }
body.dark h2:not(:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet) *), body.dark h3:not(:where(#invoice,#invRepDoc,#auPickPrint,#stkSheet) *), body.dark .brand{ color:#81631A; }
/* ═══ v8.03 (ملاحظة المالك): الليل أسود وذهبيّ فقط — لا ورديّ ولا ألوان أخرى ═══
   العناصر العنّابيّة الداكنة نهاراً كانت تنقلب ورديّة ليلاً ⟵ قلب مزدوج لها ثمّ أسود دافئ بنصّ ذهبيّ (القيم هنا حقيقيّة) */
body.dark :is(button:is([style*="background:var(--maroon)"],.sxMaroon), #auSummaryBar .sK, .homeBtn.big, #auPrivBtn, #dashPrivBtn, #chatFab, #chatHead, .chatAv, .dlgFoot .ok, .tabs button.active, .nav button.active, div:is([style*="background:var(--maroon);color"],.sxMaroonC)){
  filter:invert(1) hue-rotate(180deg) !important; background:linear-gradient(180deg,#1C1711,#100D0A) !important; color:#E5C77E !important;
  border:1px solid rgba(201,167,91,.55) !important; box-shadow:none !important; }
body.dark #auSummaryBar .sK .lab{ color:#B9A27A; opacity:1; }
/* الأزرار المحدّدة بألوان (بنفسجيّ/أزرق/أخضر/أحمر…) ⟵ ذهبيّ موحّد ليلاً (قيمة «قبل القلب» تظهر ذهبيّة) */
body.dark button.ghost:is([style*="border-color:#"],.sxBdHash), body.dark button.ghost:is([style*="color:#"],.sxClHash){ border-color:#7A5A18 !important; color:#7A5A18 !important; }
body.dark #custBar, body.dark #impBar{ background:#7A5A18 !important; }

/* v8.03: الشعار — حرف «ع» ذهبيّ داخل دائرة رفيعة بدل رمز الخشب (طلب المالك) */
.brandMark{ display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%;
  border:1px solid var(--gold); color:var(--gold); font-family:'Amiri',serif; font-weight:700; font-size:20px; line-height:1;
  margin-inline-end:9px; vertical-align:middle; padding-bottom:3px; box-shadow:inset 0 0 0 3px var(--bg), inset 0 0 0 4px rgba(184,146,74,.35); }
body.dark .brandMark{ border-color:#7A5A18; color:#7A5A18; }
@media(max-width:479px){ .brandMark{ width:28px; height:28px; font-size:17px; margin-inline-end:7px; } }
body.dark #darkBtn{ background:#1C1711 !important; color:#E5C77E !important; border:1px solid rgba(201,167,91,.55) !important; box-shadow:none !important; }
body.dark #hamburgerBtn{ color:#7A5A18 !important; }

/* v8.09 — صفحة تفاصيل كاملة (تحسين الخبير): حين تُفتح بطاقة ملفّ العميل/الفاتورة/المستثمر
   تختفي القائمة وأدواتها من نفس الشاشة فتأخذ البطاقة الصفحة كلّها؛ وعند الإغلاق تعود القائمة كما كانت.
   بلا حالة في JavaScript — تتبع ظهور البطاقة نفسها. */
[id^="screen"]:has(> .dlCard:not(.hide)) > .dlList{ display:none !important; }
/* v8.11 — الجداول الحديثة: كثافة مضغوطة، ورأس يتبع الشاشة (يُزاح بـ transform من tblStickyTick) */
.colbar{ gap:6px; }
table.stickyHead thead{ position:relative; z-index:3; }
table.stickyHead thead th{ background:var(--card); }
table.stickyHead thead.stuck th{ box-shadow:inset 0 -2px 0 var(--gold-soft, #e8d9b0); }
table.dense th, table.dense td{ padding-block:4px; font-size:12.5px; }

/* v8.14 — نُقل من <style> داخل index.html (حماية style-src) — بنفس الترتيب: كان بعد app.css */
      /* v4.16: رؤوس قابلة للترتيب في قائمة الدفعات */
      th.bsort{ cursor:pointer; user-select:none; }
      th.bsort:hover{ background:rgba(0,0,0,.04); }
      .sarr{ font-size:10px; margin-inline-start:4px; opacity:.85; }
    
/* ═══════════ v6.30 — صفوف المزاد متساوية الارتفاع ═══════════
   الصفّ المكوَّد يحمل شارتين وزرّين وسطر تلميح، فيلتفّ «ملصق» إلى
   سطر ثانٍ ويطول عن الصفوف غير المكوَّدة. ⇒ لا التفاف، والاسم يُقصّ. */
/* ═══════════ v6.32 — الفراغ الأصفر ═══════════
   v6.31 أعطت خانة الاسم flex:1 1 auto — فتمدّدت **وهي فارغة** في
   الصفوف بلا كود، ودفعت أيقونة 📋 إلى أقصى الطرف، فبدا الصفّ نصفه
   فراغاً. ⇒ لا تتمدّد إلّا بمحتوى، والصندوق يضيق بما فيه.
   (والقصّ بالنقاط يبقى عاملاً: min-width:0 يكفي لذلك.) */
.aiPrintIc{ white-space:nowrap }
.aiNameWrap{ display:inline-flex !important; width:auto; max-width:300px;
  overflow:hidden; vertical-align:middle }
.aiNameWrap .aiName{ min-width:0; flex:0 1 auto;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
/* اسم فارغ ⟵ لا صندوق ولا أيقونة */
.aiNameWrap:has(.aiName:empty){ display:none !important }
.aiTm{ display:block; max-width:300px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.aiTm:empty{ display:none !important }
#aiTable td:first-child, #aiTable td:nth-child(2){ max-width:320px }

/* ═══════════ v6.33 — العمود الأوّل متساوٍ في كلّ الصفوف ═══════════
   الصفّ المكوَّد يضع خانة الكود في العمود الأوّل، والصفّ بلا كود يضع
   كلمتين قصيرتين. والجدول يوسّع العمود لأعرضهما، فيبقى في الصفّ
   القصير فراغ إلى جانبه. ⇒ الشارة تملأ العمود كما تملؤه الخانة. */
#aiTable td:first-child{ width:190px; min-width:190px }
#aiTable td:first-child > span{
  display:block; width:100%; box-sizing:border-box;
  padding:6px 10px; border-radius:10px;
  background:#F3EAD9; border:1px dashed #d9c9a6;
  text-align:center; font-weight:800; font-size:12px; }
#aiTable tr.aiFreeRow td:first-child > span{
  background:#E8F0FB; border-color:#bcd3ef; }
#aiTable td:first-child input{ width:100% !important; box-sizing:border-box }

/* v8.22: إشعار حقوق الملكية — صغير وهادئ */
.legalNote{ font-size:11px; line-height:1.5; letter-spacing:.2px; text-align:center; color:#8b8078; margin-top:14px; font-weight:500; }
.legalSide{ color:rgba(247,240,232,.42); margin:14px 6px 2px; font-size:10.5px; }
.side.collapsed .legalSide{ display:none; }
@media (max-width:1100px){ .side.collapsed .legalSide{ display:block; } }
.legalCardBody{ font-size:13px; line-height:1.8; }

/* v8.26 — وضع الطوارئ */
.roBanner{ position:sticky; top:0; z-index:9998; background:#B3261E; color:#fff; font-weight:800; font-size:14px; line-height:1.6; padding:10px 16px; text-align:center; }
.roCardBody{ font-size:14px; line-height:1.8; }
.roOn{ color:#B3261E; }
.roOff{ color:#1a7f3c; }
.roHelp{ font-size:12px; margin:6px 0 10px; }

/* v8.32 — صفحات الدفعة/المنتج/الصنف: أشرطة وكشف حساب */
.stBars{ margin:4px 0 14px; }
.stBarRow{ display:flex; justify-content:space-between; gap:10px; font-size:14px; margin-top:6px; }
.stBar{ height:10px; border-radius:6px; background:var(--line); overflow:hidden; margin:5px 0 8px; }
.stBar > i{ display:block; height:100%; border-radius:6px; }
.stBar.stSale > i{ background:var(--green); }
.stBar.stMoney > i{ background:var(--gold); }
.stGrid{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:18px; }
@media (max-width:820px){ .stGrid{ grid-template-columns:minmax(0,1fr); } }
.stGrid h3{ margin:4px 0 6px; font-size:15px; color:var(--maroon); }
table.stmt{ width:100%; border-collapse:collapse; font-size:14px; }
table.stmt td, table.stmt th{ padding:7px 8px; border-bottom:1px solid var(--line); text-align:start; }
table.stmt th{ color:var(--mut); font-weight:600; font-size:13px; }
table.stmt .stN{ text-align:end; font-variant-numeric:tabular-nums; white-space:nowrap; }
table.stmt tr.stTot td{ font-weight:800; border-top:2px solid var(--maroon); background:#FBF7EE; }
table.stmt tr.stSep td{ border-top:1px dashed var(--gold-soft); }
table.stmt tr.stInfo td{ color:var(--mut); font-size:12.5px; }
table.stmt .stNote{ color:var(--mut); font-size:12px; font-weight:400; }
table.stmt .stNeg{ color:var(--red); }
table.stmt .stPos{ color:var(--green); }
table.cardify tr.stTot td{ font-weight:800; border-top:2px solid var(--maroon); background:#FBF7EE; }
.stFoot{ font-size:12.5px; margin-top:6px; line-height:1.8; }

/* v8.35 (445): موظّف المبيعات — لا تصدير/استيراد عملاء، لا توليد فواتير مزاد، لا ربط بنود، لا أصحاب بضاعة */
body.sales-role [data-click^="generateInvoices"], body.sales-role [data-click^="rlOpen"],
body.sales-role [data-click^="custImportPick"], body.sales-role [data-click^="custExport"],
body.sales-role [data-click^="auQuickAddConsignor"], body.sales-role [data-click^="soldOpenForGrade"],
body.sales-role [data-click^="openGradeProfile"], body.sales-role .no-sales{ display:none !important; }
/* v9.41 (فحص الأزرار): تصدير/استيراد العملاء انتقلا إلى لوحة العملاء باسمين آخرين (genExport/genImportPick) فظهرا للبائع
   — «ملفّ إكسل بكلّ الأرقام». نفس قاعدة 445: البائع لا يصدّر ولا يستورد. */
body.sales-role [data-click^="genExport"], body.sales-role [data-click^="genImportPick"]{ display:none !important; }
/* v9.41: المحاسب والمشاهد للقراءة فقط — لا زرّ استيراد (القاعدة ترفضه أصلاً) */
body.cant-write-inventory.cant-write-customers [data-click^="genImportPick"]{ display:none !important; }
/* v9.41: أزرار كتابة تظهر لأدوار القراءة ثمّ ترفضها القاعدة —
   «منتج جديد/دفعة جديدة» (المحاسب والمشاهد) · «تعديل/دفعة» على الفاتورة (من لا يكتب المبيعات) ·
   «إضافة للتوصيل» (التوصيل للمالك والشريك فقط — 474) */
body.cant-write-inventory [data-click^="toggleProdForm"], body.cant-write-inventory [data-click^="toggleBatchForm"],
body.cant-write-sales [data-click^="edOpen"], body.cant-write-sales [data-click^="payOpen"],
body.cant-write-invledger [data-click^="dlAdd"], body.cant-write-invledger #dlInvCode{ display:none !important; }
/* v9.41: أزرار تقول «للمالك وحده» عند الضغط — تُخفى عن الشريك والبائع والمحاسب والمشاهد وإدخال البيانات */
body.not-owner [data-click^="hiOpen"], body.not-owner [data-click^="hoOpen"], body.not-owner [data-click^="hfOpen"],
body.not-owner [data-click^="mvOpen"], body.not-owner [data-click^="gwOpen"], body.not-owner [data-click^="mrgOpen"],
body.not-owner [data-click^="purgeInvoice"], body.not-owner [data-click^="auDeleteSession"], body.not-owner [data-click^="countryAddPrompt"],
body.not-owner [data-click^="backupExport"]{ display:none !important; }

/* v8.43: batches list — sold-out row + remaining % */
tr.bSoldOut > td{background:#F0F0F0;color:#8a8a8a}
tr.bLowLeft > td{background:#FBE3DF}
.bLeftPct{font-size:10px;font-weight:800;margin-top:2px;white-space:nowrap}

/* v8.44: invoice status badge + unpaid age */
.invStBadge{display:inline-block;padding:2px 9px;border-radius:20px;font-size:11px;font-weight:800;white-space:nowrap}
.invAge{font-size:10px;color:#8a8a8a;margin-top:3px;white-space:nowrap}
.invAge.late{color:#a33b2e;font-weight:800}
tr.invLate > td{background:#FDF0EE}

/* v8.44: grades list — no-price rows + filters */
tr.gNoPrice > td{background:#FFF6DD}
.gFilters{display:flex;gap:16px;flex-wrap:wrap;align-items:center;margin:4px 2px 8px;font-size:13px}
.gFilters label{display:inline-flex;align-items:center;gap:5px;cursor:pointer;white-space:nowrap}
.gFilters input[type=checkbox]{width:auto;min-width:0;height:auto;margin:0}

/* v8.48: invoice channel chip */
.chChip{display:inline-block;padding:1px 8px;border-radius:6px;font-size:11px;font-weight:700;white-space:nowrap}
.chChip.au{background:#F3E9FB;color:#5b2a86}
.chChip.of{background:#E8F0FB;color:#1c4e8a}

/* v8.49: dashboard links + sold-out tag in low-stock panel */
.dashLink{cursor:pointer;text-decoration:underline dotted}
.lowItem.gone{opacity:.7}
.goneTag{background:#E2E2E2;color:#555;font-size:10px;padding:1px 7px;margin-inline-start:4px}

/* v8.56: a disabled select looks disabled (returns: refund destination on an unpaid invoice) */
select:disabled{opacity:.55;cursor:not-allowed}
.saCustHint{font-size:12px;font-weight:700;margin-top:4px;min-height:0}
.saCustHint.due{color:#a33b2e}
.saCustHint.cr{color:#7a5200}

/* v8.69 (448): إهداء مقسّم — سطور «لمن + الكمية» والباقي للمشتري */
.agHead{ display:grid; grid-template-columns:1fr 96px 36px; gap:8px; margin:10px 0 4px; font-size:12.5px; font-weight:700; color:#8a6d14; }
.agRow{ display:grid; grid-template-columns:1fr 96px 36px; gap:8px; align-items:center; margin-bottom:6px; }
.agRow .ci{ width:100%; min-width:0; }
.agRow .agDel{ width:36px; min-height:36px; padding:0; }
.agRes{ margin:-2px 0 8px; max-height:240px; overflow:auto; border:1px solid rgba(138,109,20,.35); border-radius:10px; padding:4px; }
.agRes.agHidden{ display:none; }
.agPick{ display:block; width:100%; text-align:start; margin-bottom:4px; }
.agRest{ display:flex; justify-content:space-between; gap:8px; margin:10px 0 4px; padding:10px 12px; border-radius:12px; border:1px solid rgba(138,109,20,.45); font-weight:800; }
.agRest b{ color:#8a6d14; }
.agRest.agOver{ color:#B0392E; border-color:#E0736A; }
.agFoot{ display:flex; gap:10px; margin-top:12px; }
.agFoot .agSave{ flex:1; font-weight:800; }
.agFoot .agClear{ flex:0 0 auto; white-space:nowrap; color:#B0392E; border-color:#E0736A; }
/* v8.70: مقترحات الربط */
.relinkHint{ font-size:12.5px; font-weight:700; color:#8a6d14; margin-top:6px; }

/* v8.71: أرباح الجلسة */
.auProfitOv{ position:fixed; inset:0; z-index:9998; background:var(--ovBg); display:flex; align-items:flex-start; justify-content:center; padding:16px; overflow:auto; }
.auProfitCard{ width:100%; max-width:760px; margin:0; }
.auProfitKv{ width:100%; border-collapse:collapse; margin:6px 0 4px; }
.auProfitKv td{ padding:6px 4px; border-bottom:1px dashed rgba(138,109,20,.25); }
.auProfitKv td.num, .auProfitT td.num{ text-align:end; white-space:nowrap; font-variant-numeric:tabular-nums; }
.auProfitKv tr.auPrTot td{ font-size:1.12em; color:#8a6d14; }
.auProfitKv tr.auPrWarn td{ color:#a33b2e; font-weight:700; }
.auProfitT{ width:100%; border-collapse:collapse; font-size:13px; }
.auProfitT th, .auProfitT td{ padding:5px 4px; border-bottom:1px solid rgba(138,109,20,.18); text-align:start; }
.auPrNote{ margin-top:10px; font-size:12px; }
.tblWrap{ overflow-x:auto; -webkit-overflow-scrolling:touch; }

/* v8.80: صفوف الهدايا المقسّمة مخفيّة تحت البيعة — شارة 🎁 تفتحها */
#aiGrid tr.agKid:not(.agOpen){ display:none !important; }
#aiGrid tr.agKid.agOpen > td{ background:rgba(138,109,20,.06); }
.agChip{ display:inline-block; margin-top:4px; border:1px solid rgba(138,109,20,.5); color:#8a6d14; background:transparent; font-weight:700; white-space:nowrap; }
#aiGrid tr.auFold > td:first-child > .agChip{ display:inline-block !important; }

/* ═══════════ v8.98 — تحسينات المزاد ═══════════ */
/* ② آخر بيعات الصنف — تحت الكود · 👁 يخفي الأرقام */
.acLastPx{ display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; font-size:12px; margin-top:3px; color:#5a4a22; }
.acLastPx:empty{ display:none; }
.acLastPx .lpEye{ min-height:0 !important; width:auto !important; flex:0 0 auto; padding:0 6px; font-size:13px; background:transparent; border:1px solid #E4D9BF; border-radius:8px; color:inherit; cursor:pointer; }
.acLastPx .lpLbl{ font-weight:700; }
.acLastPx .lpItem{ background:#F6F1E6; border:1px solid #E4D9BF; border-radius:8px; padding:1px 7px; font-weight:700; font-variant-numeric:tabular-nums; }
.acLastPx .lpItem small{ font-weight:400; color:var(--mut); }
.acLastPx.lpHidden .lpList, .acLastPx.lpHidden .lpLbl{ display:none; }
/* ㊷ مفضّلات العميل */
.acCustPrefs{ font-size:12px; margin-top:3px; color:#8a6d14; font-weight:700; }
/* ㉝ محوّل السعر */
.acConv{ gap:6px 10px; align-items:center; margin:6px 0 2px; font-size:12.5px; flex-wrap:wrap; }
.acConv .acConvLbl{ font-weight:700; color:#5a4a22; }
.acConv label{ display:flex; align-items:center; gap:4px; margin:0; font-weight:600; flex:0 1 150px; min-width:0; }
.acConv input{ width:100% !important; min-width:0 !important; margin:0; }
.acConv > button{ width:auto !important; }
@media(max-width:760px){
  .acConv .acConvLbl{ flex-basis:100%; }
  .acConv label{ flex:1 1 30%; flex-direction:column; align-items:stretch; gap:2px; }
  .acConv > button{ flex-basis:100%; width:100% !important; }
}
/* ⑭ ملخّص المزاد — نسبة التغيّر */
.sumUp{ color:#1a7f3c; font-weight:800; font-size:.92em; }
.sumDn{ color:#a33b2e; font-weight:800; font-size:.92em; }
.sumCmp{ font-size:12px; margin:4px 0 8px; }
.auCmpLink{ margin:0 0 8px; font-size:12px; }
/* ㉑ الجوّال: أزرار البطاقة شريط ثابت أسفل الشاشة فوق لوحة المفاتيح، بحجم الإبهام */
@media(max-width:760px){
  #auCard .acBtnBar{ position:sticky; bottom:0; z-index:6; background:var(--card, #fff);
    padding:8px 4px calc(8px + env(safe-area-inset-bottom,0px)); margin-inline:-4px;
    box-shadow:0 -4px 12px rgba(43,18,22,.10); border-top:1px solid var(--line); gap:6px; flex-wrap:wrap; }
  #auCard .acBtnBar > button{ flex:1 1 30% !important; width:auto !important; min-width:0 !important; min-height:48px !important; font-size:15px !important; margin:0 !important; }
  #auCard .acBtnBar > #auCardMsg{ flex-basis:100%; }
}
/* v8.99 ① قائمة التحضير */
#auDraftList .drMove{ display:inline-flex; flex-direction:column; gap:2px; }
#auDraftList .drMove button{ min-height:0 !important; width:auto !important; padding:0 6px; font-size:10px; line-height:1.4; }
#auDraftList .drMove button[disabled]{ opacity:.3; }
#auDraftsBar .drNext{ width:auto !important; background:var(--gold); color:#3a2412; border-color:var(--gold); font-weight:800; }
/* ═══════════ v9.00 — الكاشير ═══════════ */
.csCard .csHead{ align-items:baseline; gap:10px; flex-wrap:wrap; }
.csCard .csHead h2{ margin:0; flex:0 0 auto; }
.csScanRow{ gap:8px; margin:8px 0; }
.csScanRow #csScan{ flex:1 1 260px; font-size:18px; min-height:48px; }
.csScanRow > button{ flex:0 0 auto !important; width:auto !important; }
.csTable .csQty{ display:inline-flex; align-items:center; gap:4px; }
.csTable .csQty input{ width:70px; text-align:center; margin:0; }
.csTable .csQty button{ width:auto !important; min-height:36px !important; padding:0 12px; font-size:18px; }
.csTable .csPrice{ width:100px; margin:0; }
.csTable td.num{ white-space:nowrap; font-variant-numeric:tabular-nums; }
.csTotalBar{ text-align:center; font-size:20px; margin:12px 0 8px; color:var(--maroon); }
.csTotalBar b{ font-size:34px; font-variant-numeric:tabular-nums; margin:0 6px; }
.csCustRow{ gap:8px; align-items:center; }
.csCustRow label{ flex:0 0 auto; margin:0; }
.csCustRow input{ flex:1 1 160px; margin:0; }
.csPayRow{ gap:10px; margin-top:10px; }
.csPayRow .csPay{ flex:1 1 30%; min-height:64px; font-size:20px; font-weight:800; border-radius:14px; color:#fff; }
.csPayRow .csCash{ background:#1a7f3c; border-color:#1a7f3c; }
.csPayRow .csKnet{ background:#1b4f8a; border-color:#1b4f8a; }
.csPayRow .csVisa{ background:var(--maroon); border-color:var(--maroon); }
.csPayRow .csPay[disabled]{ opacity:.35; }
.csMsg{ margin-top:8px; font-weight:700; }
.csMsg.csBad{ color:#a33b2e; }
.csDone{ gap:10px; align-items:center; margin-top:6px; background:#F1FAF4; border:1px solid #bfe3cc; border-radius:12px; padding:8px 12px; }
.csDone > button{ flex:0 0 auto !important; width:auto !important; }
.csFoot{ margin-top:8px; }
.csFoot > button{ flex:0 0 auto !important; width:auto !important; }
@media(max-width:760px){ .csPayRow .csPay{ flex-basis:100%; } }
/* ═══════════ v9.01 — حالة التوصيل ═══════════ */
.dlBar{ gap:8px; align-items:center; flex-wrap:wrap; }
.dlBar label{ flex:0 0 auto !important; margin:0; }
.dlBar #dlMonth{ flex:0 0 170px !important; margin:0; }
.dlBar #dlInvCode{ flex:1 1 200px; margin:0; }
.dlBar > button{ flex:0 0 auto !important; width:auto !important; }
.dlTable input, .dlTable select{ margin:0; min-width:0; }
.dlTable select{ min-width:140px; }
.dlTable .dlFee{ width:96px; }
.dlTable td > button{ width:auto !important; }
.dlTable .dlNoAddr{ color:#a33b2e; font-weight:700; font-size:12px; }
.dlTable tr.dl_delivered > td{ background:#F1FAF4; }
.dlTable tr.dl_returned > td{ background:#FBEAE7; }
.dlTable tr.dl_with_driver > td{ background:#FFF8E6; }
.dlSummary{ margin-top:10px; }
.dlChips{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
.dlChip{ border:1px solid var(--line); border-radius:999px; padding:2px 10px; font-size:12.5px; background:#fff; }
.dlChip.dl_delivered{ border-color:#bfe3cc; } .dlChip.dl_returned{ border-color:#E0B4AB; } .dlChip.dl_with_driver{ border-color:#e9d39a; }
.dlTot{ font-size:16px; color:var(--maroon); }
.dlTot b{ font-size:20px; font-variant-numeric:tabular-nums; }
.dlDrv{ font-size:13px; color:var(--mut); margin-top:4px; }
.dlNote{ font-size:12px; margin-top:2px; }
/* v9.25 — التوصيل التلقائيّ · المرتجع للمتابعة */
.dlTable tr.dl_pickup > td{ background:#F4F1FA; }
.dlChip.dl_pickup{ border-color:#cfc3e6; } .dlChip.dlChipWarn{ border-color:#E0B4AB; color:#a33b2e; }
.dlTable .dlFee.dlFeeEmpty{ border-color:#d9a03a; background:#FFF8E6; }
.dlTable .dlName{ font-weight:700; text-decoration:underline dotted; }
.dlCtry{ display:inline-block; font-size:11px; padding:0 6px; border-radius:6px; border:1px solid var(--line); color:var(--mut); }
.dlCtry.dlAbroad{ border-color:#d9a03a; color:#8a5a00; font-weight:700; }
.dlRetList{ font-size:12px; color:#a33b2e; margin-top:3px; }
.dlRetOk{ color:#1f7a44; font-weight:700; }
.dlTable td > button + button{ margin-inline-start:4px; }
.dlRetHint{ font-size:12.5px; color:var(--mut); margin-bottom:8px; white-space:normal; }
.dlRetRow{ display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--line); white-space:normal; }
.dlRetRow input[type=checkbox]{ width:20px; height:20px; flex:0 0 auto; margin:0; }
.dlRetRow .dlRetNm{ flex:1 1 auto; }
.dlRetRow .dlRetQty{ flex:0 0 110px; width:110px; margin:0; }
/* v9.03 — دليل ألوان المزاد (نفس قيم auRecalcRow/auApply*Look) */
.auLegend{ margin:6px 0 10px; border:1px solid var(--line); border-radius:12px; background:#fff; padding:6px 10px; font-size:13px; }
.auLegend > summary{ cursor:pointer; font-weight:800; color:var(--maroon); list-style-position:inside; }
.auLegend .lgList{ display:flex; flex-wrap:wrap; gap:6px 14px; margin-top:8px; }
.auLegend .lgI{ display:inline-flex; align-items:center; gap:6px; }
.auLegend .lgSw{ display:inline-block; width:22px; height:16px; border-radius:5px; border:1px solid rgba(0,0,0,.15); flex:0 0 auto; }
.auLegend .lgOk{ background:#e6f0e8; } .auLegend .lgNone{ background:#fff; }
.auLegend .lgSrc{ background:#C9E4D0; } .auLegend .lgTm{ background:#efe6fb; }
.auLegend .lgFree{ background:#cfe3fa; } .auLegend .lgNc{ background:#F5EBC8; }
.auLegend .lgSb{ background:#FFF3CD; } .auLegend .lgInv{ background:#E3F4E8; border-color:#1a7f3c; }
.auLegend .lgCx{ background:repeating-linear-gradient(135deg,#fff 0 4px,#f2c4bd 4px 6px); border-color:#C0392B; }
@media(max-width:760px){ .auLegend .lgI{ flex:1 1 100%; } }
/* v9.04 — بطاقة الصنف في الكاشير */
.csPreview{ margin:-2px 0 8px; }
.csPreview:empty{ display:none; }
.csPreview.csPvOk, .csPreview.csPvOut, .csPreview.csPvMany{ border:1.5px solid var(--line); border-radius:12px; padding:8px 12px; display:flex; flex-wrap:wrap; align-items:center; gap:4px 12px; }
.csPreview.csPvOk{ background:#F1FAF4; border-color:#bfe3cc; }
.csPreview.csPvOut{ background:#FBEAE7; border-color:#E0B4AB; color:#a33b2e; }
.csPreview.csPvMany{ background:#FFF8E6; border-color:#e9d39a; }
.csPreview .csPvName{ flex:1 1 100%; font-size:15px; }
.csPreview .csPvMeta{ flex:1 1 100%; font-size:13.5px; }
.csPreview .csPvAdd, .csPreview .csPvPick{ flex:0 0 auto !important; width:auto !important; }
/* v9.05 — تقرير المعرض */
.exBar{ gap:8px; align-items:center; flex-wrap:wrap; }
.exBar label{ flex:0 0 auto !important; margin:0; }
.exBar input{ flex:0 0 160px !important; margin:0; }
.exBar > button{ flex:0 0 auto !important; width:auto !important; }
.exBar #exLiveBtn.exOn{ background:#1a7f3c; color:#fff; border-color:#1a7f3c; }
.exKpis{ display:flex; flex-wrap:wrap; gap:10px; margin:10px 0 4px; }
.exKpi{ flex:1 1 140px; border:1px solid var(--line); border-radius:12px; padding:10px 12px; background:#fff; text-align:center; }
.exKpi span{ display:block; font-size:12.5px; color:var(--mut); }
.exKpi b{ font-size:24px; color:var(--maroon); font-variant-numeric:tabular-nums; }
.exUpd{ font-size:11.5px; margin-bottom:6px; }
/* v9.06 — خصم الكاشير · آخر كمية */
.csDiscRow, .csDiscSet{ gap:8px; align-items:center; flex-wrap:wrap; margin-top:6px; }
.csDiscRow label, .csDiscSet label, .csDiscSet > span{ flex:0 0 auto !important; margin:0; }
.csDiscRow #csDiscPct{ flex:0 0 90px !important; margin:0; }
.csDiscRow > button, .csDiscSet > button{ flex:0 0 auto !important; width:auto !important; }
.csDiscSet{ font-size:12.5px; background:#FBF6EC; border:1px dashed #E4D9BF; border-radius:10px; padding:6px 10px; }
.csDiscSet input{ flex:0 0 80px !important; margin:0; }
.csDiscLine{ font-size:13px; color:#1a7f3c; font-weight:700; }
#acCodeInfo.acLowStock{ color:#a33b2e !important; font-weight:800; }
/* v9.07: موقع الكاشير (مكتب/معرض) · بضاعة المعرض · أسعار المعرض */
.csCard .csLocRow{ align-items:center; gap:8px; flex-wrap:wrap; margin:8px 0 4px; }
.csCard .csLocLbl{ flex:0 0 auto; font-weight:700; }
.csCard .csLocBtn{ flex:0 0 auto !important; width:auto !important; background:#fff; color:var(--ink,#222); border:1.5px solid var(--line); font-size:16px; padding:9px 18px; border-radius:12px; }
.csCard .csLocBtn.csLocOn{ background:var(--maroon); color:#fff; border-color:var(--maroon); }
.csCard.csAtBooth .csLocBtn.csLocOn{ background:#B7791F; border-color:#B7791F; }
.csCard .csLocNote{ flex:1 1 220px; font-size:13.5px; color:var(--mut); }
.csCard.csAtBooth{ border:2px solid #E9C46A; box-shadow:0 0 0 3px #FFF6DD; }
.csCard.csAtBooth .csLocNote{ color:#8a5a00; font-weight:700; }
.exTakeBar, .exPxBar{ gap:8px; align-items:center; flex-wrap:wrap; margin:8px 0; }
.exTakeBar input, .exTakeBar select, .exPxBar input{ flex:1 1 110px !important; margin:0; }
.exTakeBar #exTakeCode, .exPxBar #exPxCode{ flex:2 1 160px !important; }
.exTakeBar > button, .exPxBar > button{ flex:0 0 auto !important; width:auto !important; }
.exPxHint{ font-size:13.5px; margin:2px 0 6px; }
.exTakeT tr.exNeg td{ background:#FBEAE7; }
.exTakeRow{ display:flex; align-items:center; gap:6px; font-size:13px; padding:2px 0; }
.exTakeRow button{ flex:0 0 auto !important; width:auto !important; }
/* v9.08 ㊇④ تسجيلات العملاء من الرابط */
#suCard .suHead{ align-items:center; gap:10px; flex-wrap:wrap; }
#suCard .suHead h2{ margin:0; flex:0 1 auto; }
#suCard .suCount{ flex:0 0 auto; }
#suCard .suCount.suHas{ background:#A33B2E; color:#fff; border-radius:999px; padding:1px 10px; font-weight:800; font-size:14px; }
#suCard .suOwner, #suCard .suTokenBox{ align-items:center; gap:8px; flex-wrap:wrap; margin:10px 0 4px; }
#suCard .suOwner > button, #suCard .suTokenBox > button{ flex:0 0 auto !important; width:auto !important; }
#suCard .suState{ flex:0 0 auto; font-weight:700; color:var(--mut); }
#suCard .suState.suOn{ color:#1a7f3c; }
#suCard .suTokenBox input{ flex:1 1 260px !important; margin:0; font-family:monospace; font-size:13px; }
#suCard .suExists{ font-size:12.5px; color:#8a5a00; }
.suBadge{ display:inline-block; min-width:20px; margin-inline-start:6px; padding:0 6px; border-radius:999px; background:#C0392B; color:#fff; font-size:12px; font-weight:800; line-height:20px; text-align:center; }
.homeBtn{ position:relative; }
.homeBtn .suBadge{ position:absolute; top:8px; inset-inline-end:8px; margin:0; font-size:13px; }
#suCard .suNote{ font-size:12.5px; color:var(--ink); margin-top:2px; }
/* v9.09: أسعار الدرجات في نافذة «الأسعار» لدفعة بلا أشكال */
#pricesBox .prGIn{ width:82px; text-align:center; padding:4px 6px; font-weight:700; }
#pricesBox .prGIn[data-dirty]{ border-color:#1a7f3c; background:#F3FAF5; }
#pricesBox .prGUp{ font-size:11px; color:#1c6b3a; font-weight:700; }
#pricesBox .prGDn, #pricesBox .prGNo{ font-size:11px; color:#a33b2e; font-weight:700; }
#pricesBox .prGNa{ font-size:11px; color:var(--mut); }

/* v9.14 (480): شريط الكاشير بلا إنترنت */
.csOffBar{ margin:6px 0 8px; padding:6px 10px; border:1px dashed var(--line, #d9cfc2); border-radius:10px; font-size:13px; line-height:1.9; }
.csOffBar:empty{ display:none; }
.csOffNo{ color:#a33b2e; }
.csOffYes{ color:#2e7d4f; }
.csOffBad{ color:#a33b2e; font-weight:700; margin-top:4px; }
.csOffWarn{ color:#8a5a00; font-weight:700; margin-top:4px; }
.csOffBtn{ padding:4px 12px; border-radius:999px; font-weight:800; border:1.5px solid #a33b2e; color:#a33b2e; background:transparent; cursor:pointer; }
.csOffBtnOn{ background:#a33b2e; color:#fff; }
/* v9.13: «👤 شخصي» بجانب الصاحب في كرت المزاد */
.acPersonalBtn{ padding:1px 8px; font-size:12px; margin-inline-start:6px; }
/* v9.27 — قائمة الربط على شاشات اللمس (بدل select size=9 الذي يظهر زرّاً مغلقاً في iOS) */
.relinkList{ margin-top:8px; flex:1 1 auto; min-height:150px; overflow-y:auto; -webkit-overflow-scrolling:touch;
  border:1px solid var(--line); border-radius:10px; background:#fff; }
.relinkList .relinkRow{ padding:10px 12px; font-size:14px; line-height:1.5; border-bottom:1px solid var(--line); cursor:pointer; }
.relinkList .relinkRow:last-child{ border-bottom:0; }
.relinkList .relinkRow.empty{ color:#a33b2e; }
.relinkList .relinkRow.on{ background:#FBF3E0; box-shadow:inset 4px 0 0 var(--gold); font-weight:700; }
.relinkList .relinkNone{ padding:12px; }
.relinkList .relinkRow.grp{ font-weight:700; background:#FBF8F1; }
.relinkList .relinkRow.back{ color:var(--maroon); font-weight:700; }
/* v9.28 — السطر المرتجع في تفاصيل الفاتورة */
#invDetRows tr.invRetFull > td{ background:#FBEBEB; }
#invDetRows tr.invRetFull > td:nth-child(n+4){ color:#a33b2e; text-decoration:line-through; }
#invDetRows tr.invRetPart > td{ background:#FDF3E6; }
#invDetRows .invRetTag{ display:inline-block; margin-top:3px; font-size:12px; font-weight:700; color:#a33b2e; }
/* v9.31b (المالك): جدول الدفعات أضيق — فراغات أقلّ وأعمدة أكثر في الشاشة
   ① حشوة جانبيّة أصغر ② الوصف يأخذ المساحة الزائدة بسطرين على الأكثر (كان كلمة في كلّ سطر فيطول الصفّ)
   ③ أزرار الإجراءات أصغر: «تعديل/حذف» رمزان مع تلميح بالاسم */
#ctbl_batches th, #ctbl_batches td{ padding-inline:6px; }
#ctbl_batches td:first-child{ white-space:nowrap; }
/* v9.35 (المالك): مربّعات التحديد في عمود واحد — الخليّة كانت محاذاة يميناً (كلّ الجدول) فيتحرّك المربّع
   بطول الكود وعرض الشارات تحته. ⇒ بداية السطر (يسار بالإنجليزيّ · يمين بالعربيّ) */
#ctbl_batches td:first-child, #ctbl_batches th:first-child{ text-align:start; }
/* v9.33: الوصف سطر واحد بعرض محدود (… والنصّ كاملاً عند الوقوف عليه) — كان يأخذ 22٪ من الجدول */
/* v9.34: سطران بعرض ثابت 120px — max-width على خليّة جدول لا يُحترم فكان العمود يتّسع لطول النصّ.
   العرض الآن على المحتوى نفسه، والسطران لا يرفعان الصفّ (خانة «المُباع» سطران أصلاً). */
#ctbl_batches td.bLabel{ white-space:normal; }
#ctbl_batches td.bLabel > span{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  width:120px; font-size:12px; line-height:1.35; word-break:break-word; }
#ctbl_batches td:last-child .mini{ padding:5px 8px; min-width:0; }
#ctbl_batches td:last-child .mini + .mini{ margin-inline-start:3px; }
@media(max-width:760px){ #ctbl_batches td.bLabel > span{ width:auto; display:block; -webkit-line-clamp:unset; } }
/* v9.33 — زرّا التنقّل الأفقيّ للجداول العريضة */
.tblNav{ position:fixed; bottom:18px; left:50%; transform:translateX(-50%); z-index:9000; display:flex; gap:8px;
  background:rgba(255,255,255,.92); border:1px solid var(--line); border-radius:24px; padding:5px; box-shadow:0 6px 18px rgba(0,0,0,.18); }
.tblNav.hide{ display:none; }
.tblNavBtn{ width:44px; height:36px; border-radius:18px; border:1px solid var(--line); background:#fff; color:var(--maroon); font-size:16px; font-weight:800; cursor:pointer; }
.tblNavBtn:hover:not(:disabled){ background:#FBF3E0; }
.tblNavBtn:disabled, .tblNavBtn:disabled:hover{ opacity:.35; cursor:default; background:#fff !important; color:var(--maroon) !important; box-shadow:none !important; }
@media print{ .tblNav{ display:none !important; } }
/* v9.36 — «حفظ الكلّ» تحت بنود الدفعة المرتبطة */
.gpRelinkAllRow{ align-items:center; gap:10px; margin-top:10px; flex-wrap:wrap; }
.gpRelinkAllBtn{ background:#2F6B8A; color:#fff; border:0; border-radius:10px; padding:9px 18px; font-weight:800; cursor:pointer; }
.gpRelinkAllBtn:hover{ filter:brightness(1.08); }
/* ═══ v9.38 — الدفعات على الهاتف جدولاً ═══ */
.batchViewSw{ display:none; }
.bIcons, .bMore, .bLblSub{ display:none; }
@media(max-width:760px){
  .batchViewSw{ display:inline-flex; border:1px solid var(--line); border-radius:18px; overflow:hidden; margin:6px 0; }
  .batchViewSw button{ border:0; background:#fff; color:var(--maroon); font-weight:800; font-size:12.5px; padding:6px 14px; min-height:0; }
  .batchViewSw button.on{ background:var(--maroon); color:#fff; }
  #ctbl_batches.phoneTbl{ font-size:12.5px; margin-top:4px; }
  #ctbl_batches.phoneTbl th, #ctbl_batches.phoneTbl td{ padding:7px 8px !important; white-space:nowrap; vertical-align:middle; }
  #ctbl_batches.phoneTbl th{ font-size:11px; }
  #ctbl_batches.phoneTbl th:first-child, #ctbl_batches.phoneTbl td:first-child{
    position:sticky; inset-inline-start:0; z-index:2; background:#fff; box-shadow:2px 0 4px rgba(0,0,0,.08); font-weight:800; color:var(--maroon); }
  #ctbl_batches.phoneTbl thead th:first-child{ background:var(--card, #fffaf0); }
  #ctbl_batches.phoneTbl td:first-child input[type=checkbox]{ display:none; }
  #ctbl_batches.phoneTbl .bBadges{ display:none; }
  #ctbl_batches.phoneTbl .bIcons{ display:inline; font-size:10px; margin-inline-start:4px; }
  #ctbl_batches.phoneTbl td .s8b6852, #ctbl_batches.phoneTbl td small{ display:block; font-size:10px; }
  #ctbl_batches.phoneTbl td:last-child .mini{ display:none; }
  #ctbl_batches.phoneTbl td:last-child .mini.bMore{ display:inline-block; font-size:17px; padding:2px 10px !important; min-height:0; border:0; background:transparent; color:var(--maroon); }
  /* v9.39 (المالك): الوصف تحت الكود في العمود الثابت — سطر صغير واحد بعرض الكود («…» إن طال)،
     وعمود الوصف المستقلّ يُخفى على الهاتف. حشوة الخليّة الأولى أقلّ فلا يزيد ارتفاع الصفّ. */
  #ctbl_batches.phoneTbl .bLblSub{ display:block; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
    font-size:10.5px; font-weight:500; color:var(--mut); line-height:1.25; margin-top:1px; text-align:match-parent; }
  #ctbl_batches.phoneTbl td:first-child{ padding-block:4px !important; }
  #ctbl_batches.phoneTbl td.bLabel, #ctbl_batches.phoneTbl th:nth-child(14){ display:none !important; }
  #ctbl_batches.phoneTbl tfoot td{ font-size:12px; }
  .actSheetBtn{ display:block; width:100%; text-align:start; padding:12px 14px; margin:0 0 6px; border:1px solid var(--line); border-radius:10px; background:#fff; font-size:15px; font-weight:700; color:var(--maroon); }
  .actSheetBtn.actSheetDel{ color:#a33b2e; border-color:#e6b8b0; background:#fff; }
}

/* ═══ v9.42 (المالك) — كلّ جداول البطاقات على الهاتف: «جدول / كروت» مثل الدفعات ═══
   الجدول: عمود أوّل ثابت (وإن كان خانة تأشير فالثاني ثابت معه) · سحب أفقيّ · أزرار مصغّرة. */
.pvSw{ display:none; }
@media(max-width:760px){
  .pvSw{ display:inline-flex; flex-shrink:0; border:1px solid var(--line); border-radius:20px; overflow:hidden; margin:6px 0; vertical-align:middle; }
  .colbar .pvSw{ margin:0; }
  .pvSw button{ border:0; background:#fff; color:var(--maroon); font-weight:800; font-size:12.5px; padding:0 14px; min-height:34px; white-space:nowrap; }
  /* v9.43: الأزرار الثلاثة بنفس الارتفاع وفي سطر واحد — «مضغوط / مريح» رمزاً فقط على الهاتف */
  .colbar{ flex-wrap:wrap; align-items:center; }
  .colbar .colbtn{ min-height:34px; padding:0 13px; white-space:nowrap; flex-shrink:0; }
  .colbar .colbtn[data-click^="tblDense"] span{ display:none; }
  .colbar .colbtn[data-click^="tblDense"]{ padding:0 12px; font-size:15px; }
  .pvSw button.on{ background:var(--maroon); color:#fff; }
  table.pvTbl{ font-size:12.5px; margin-top:4px; }
  table.pvTbl{ width:max-content !important; min-width:100%; }
  table.pvTbl th, table.pvTbl td{ padding:7px 8px !important; white-space:nowrap; vertical-align:middle; }
  /* v9.43: قاعدة v2.45 تُلفّ الخلايا على الهاتف — في الجدول لا لفّ (فلا تنكسر «INV-M-26-0374» ولا تتكدّس الأزرار) */
  .content table.pvTbl.pvTbl.pvTbl td, .content table.pvTbl.pvTbl.pvTbl td .muted{ white-space:nowrap !important; }
  table.pvTbl td br:has(+ button){ display:none; }
  table.pvTbl td br:has(+ button) + button{ margin-inline-start:6px; }
  table.pvTbl th{ font-size:11px; }
  table.pvTbl th:first-child, table.pvTbl td:first-child{
    position:sticky; inset-inline-start:0; z-index:2; background:#fff; box-shadow:2px 0 4px rgba(0,0,0,.08); font-weight:800; color:var(--maroon); }
  table.pvTbl thead th:first-child{ background:var(--card, #fffaf0); }
  table.pvTbl.pvChk th:first-child, table.pvTbl.pvChk td:first-child{ width:34px; min-width:34px; max-width:34px; padding-inline:4px !important; box-shadow:none; }
  table.pvTbl.pvChk th:nth-child(2), table.pvTbl.pvChk td:nth-child(2){
    position:sticky; inset-inline-start:34px; z-index:2; background:#fff; box-shadow:2px 0 4px rgba(0,0,0,.08); font-weight:800; color:var(--maroon); font-size:11.5px; }
  table.pvTbl.pvChk td:nth-child(2) small, table.pvTbl.pvChk td:nth-child(2) .muted{ font-size:10px; font-weight:500; }
  table.pvTbl.pvChk thead th:nth-child(2){ background:var(--card, #fffaf0); }
  table.pvTbl td button, table.pvTbl td .mini{ min-height:0; padding:4px 9px !important; font-size:12px; margin:1px; }
  table.pvTbl td small, table.pvTbl td .muted{ font-size:10.5px; }
  table.pvTbl tfoot td{ font-size:12px; font-weight:800; }
}
/* ═══ v9.45 (485) — المدير: رؤية بلا تعديل للمخزون والأسعار · بلا ربح · بلا ملفّ العميل · بلا إشعار دائن ═══
   القاعدة نفسها ترفض كلّ هذا (oud_manager)؛ هنا لا تظهر الأزرار أصلاً. */
body.manager-role [data-click^="edToggleCN"], body.manager-role [data-click^="cnIssue"],
body.manager-role [data-click^="editExpense"],
body.manager-role [data-click^="pricesOpen"], body.manager-role [data-click^="pricesEdit"], body.manager-role [data-click^="pricesSave"],
body.manager-role [data-click^="pricesAddShape"], body.manager-role [data-click^="btEditPrice"], body.manager-role [data-click^="btAddShape"],
body.manager-role [data-click^="gradesOpenBatch"], body.manager-role [data-click^="gpRelink"], body.manager-role [data-click^="gpQuickWeight"],
body.manager-role [data-click^="soldRelink"], body.manager-role [data-click^="soldBulkLink"], body.manager-role [data-click^="soldToConsignor"],
body.manager-role [data-click^="soldOpenForGrade"], body.manager-role [data-click^="profSettleGo"], body.manager-role [data-click^="profTagInvestor"],
body.manager-role [data-click^="profUnsettle"], body.manager-role [data-click^="dmgOpen"], body.manager-role [data-click^="dmgUndo"],
body.manager-role [data-click^="openCustomerProfile"], body.manager-role [data-click^="custExport"], body.manager-role [data-click^="custImportPick"],
body.manager-role [data-click^="genExport"], body.manager-role [data-click^="genImportPick"], body.manager-role [data-click^="mrgOpen"]{ display:none !important; }
/* الدفعات: «التكلفة» (سعر الدفعة) · «المالك» · «الدفع» */
body.manager-role #ctbl_batches th:nth-child(4), body.manager-role #ctbl_batches td:nth-child(4),
body.manager-role #ctbl_batches th:nth-child(11), body.manager-role #ctbl_batches td:nth-child(11),
body.manager-role #ctbl_batches th:nth-child(12), body.manager-role #ctbl_batches td:nth-child(12){ display:none !important; }
/* العملاء: إجمالي الشراء · الفواتير · آخر شراء · المتبقّي (= مشترياته) */
body.manager-role #ctbl_customers th:nth-child(5), body.manager-role #ctbl_customers td:nth-child(5),
body.manager-role #ctbl_customers th:nth-child(6), body.manager-role #ctbl_customers td:nth-child(6),
body.manager-role #ctbl_customers th:nth-child(7), body.manager-role #ctbl_customers td:nth-child(7),
body.manager-role #ctbl_customers th:nth-child(8), body.manager-role #ctbl_customers td:nth-child(8){ display:none !important; }
/* المبيعة: عمودا التكلفة والربح (12 · 13) */
body.manager-role #ctbl_solditems th:nth-child(12), body.manager-role #ctbl_solditems td:nth-child(12),
body.manager-role #ctbl_solditems th:nth-child(13), body.manager-role #ctbl_solditems td:nth-child(13){ display:none !important; }
/* المخزون للمدير رؤية فقط: بطاقتا الإضافة · قائمة «يحتاج فرزاً» (فيها تكلفة الدفعة وأدوات الفرز) · «إنشاء أصناف» · عمود «المالك» */
body.manager-role #prodAddCard, body.manager-role #batchAddCard, body.manager-role #rawPending,
body.manager-role [data-click^="gradesGoCreate"]{ display:none !important; }
body.manager-role #ctbl_grades th:nth-child(4), body.manager-role #ctbl_grades td:nth-child(4){ display:none !important; }
/* المنتجات: «تكلفة التولة» و«إجمالي الشراء» تُبنى من سعر الدفعات (لا يصل للمدير) · «المبيعات» من التقارير (مقفلة عليه) */
body.manager-role #ctbl_products th:nth-child(11), body.manager-role #ctbl_products td:nth-child(11),
body.manager-role #ctbl_products th:nth-child(12), body.manager-role #ctbl_products td:nth-child(12),
body.manager-role #ctbl_products th:nth-child(13), body.manager-role #ctbl_products td:nth-child(13){ display:none !important; }
/* العملاء: بطاقات الإحصاء (الأكثر شراءً · المدينون · لم يشترِ · جدد الشهر · الدول · المكرّرون) = مشتريات العملاء ⟵ مخفيّة عن المدير */
body.manager-role [data-click="custHubShow('top')"], body.manager-role [data-click="custHubShow('due')"],
body.manager-role [data-click="custHubShow('idle')"], body.manager-role [data-click="custHubShow('new')"],
body.manager-role [data-click="custHubShow('geo')"], body.manager-role [data-click="custHubShow('dup')"]{ display:none !important; }
/* صفحات الإحصاء للمدير: الكمّيّات والمبيعات فقط — كشوف الحساب والربح والتكلفة وأفضل المشترين ومرشّح المستثمر وأزرار الإجراءات مخفيّة */
body.manager-role #pstatActions, body.manager-role #pstatInvestor, body.manager-role #pstatBars,
body.manager-role .stGrid > div:has(#pstatStmt), body.manager-role .card:has(#pstatBatchTbl), body.manager-role .card:has(#pstatBuyers),
body.manager-role #bstatActions, body.manager-role #bstatInfo, body.manager-role .card:has(#bstatKey), body.manager-role #bstatBars,
body.manager-role .stGrid > div:has(#bstatStmt), body.manager-role #bstatNote,
body.manager-role .stGrid > div:has(#gstatStmt){ display:none !important; }
body.manager-role table:has(#pstatGrades) th:nth-child(6), body.manager-role #pstatGrades td:nth-child(6),
body.manager-role table:has(#bstatGrades) th:nth-child(6), body.manager-role #bstatGrades td:nth-child(6),
body.manager-role table:has(#bstatGrades) th:nth-child(7), body.manager-role #bstatGrades td:nth-child(7){ display:none !important; }
body.manager-role #bstatQty th:last-child, body.manager-role #bstatQty td:last-child,
body.manager-role #bstatQty .stFoot, body.manager-role #pstatQty .stFoot{ display:none !important; }

/* v9.48: سطر البيع — الخانات تبدأ من الأعلى (الكود والوصف والوحدة والكمّيّة في صفّ واحد، كالمزاد) */
#saTable td{ vertical-align:top; }
.saDupBtn{ display:none; margin-top:4px; font-size:11px; padding:3px 9px; }
#saTable tr.saHasCode .saDupBtn{ display:inline-block; }

/* v9.60: batch form product suggestions (the inline style was blocked by CSP style-src) */
.bProdOpt{ padding:7px 10px; cursor:pointer; border-bottom:1px solid #f0e9db; font-size:13px; }

/* v9.61: batches — focus on one batch while editing (list hidden), phone tabs, last-opened row */
#screenBatches.bFocus #batchListCard{ display:none !important; }
.bTabs{ display:none; }
@media(max-width:760px){
  #screenBatches.bFocus .bTabs{ display:flex; gap:6px; position:sticky; top:0; z-index:700; background:var(--bg); padding:6px 0 8px; }
  .bTabs button{ flex:1 1 0; border:1px solid var(--line); background:#fff; color:var(--maroon); font-weight:800; border-radius:12px; padding:10px 6px; min-height:44px; }
  .bTabs button.on{ background:var(--maroon); color:#fff; border-color:var(--maroon); }
  #screenBatches.bFocus.bTab-data #gradesPanel{ display:none !important; }
  #screenBatches.bFocus.bTab-items #batchAddCard{ display:none !important; }
}
tr.bLastOpen > td{ box-shadow:inset 0 2px 0 var(--gold), inset 0 -2px 0 var(--gold); }
/* v9.61: invoice profit box (Super Admin / Admin only) */
.invProfit{ margin-top:10px; border:1px solid var(--line); border-radius:12px; padding:10px 12px; background:#FBF6EA; }
.invProfit h4{ margin:0 0 6px; font-size:14px; color:var(--maroon); }
.invProfit table{ width:100%; border-collapse:collapse; font-size:13.5px; }
.invProfit td{ padding:4px 2px; border-bottom:1px dashed var(--line); }
.invProfit td:last-child{ text-align:end; font-variant-numeric:tabular-nums; white-space:nowrap; }
.invProfit tr.ipTot td{ font-weight:800; border-bottom:2px solid var(--gold); }
.invProfit .ipWarn{ margin-top:6px; font-size:12.5px; color:#9A5B00; }

/* v9.62: tables that were wider than the phone with no scroll box of their own (auction sessions list) */
#auListWrap{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
/* v9.69: 📊 مقارنة المزادات */
.auCmpCard{ max-width:1200px; }
.auCmpBar{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:6px 0; }
.auCmpBar label{ display:flex; align-items:center; gap:6px; margin:0; font-weight:700; }
.auCmpBar input[type=date]{ width:auto; min-width:140px; }
.auCmpBar .mini{ width:auto; }
.auCmpChip{ border-radius:20px; background:transparent; border:1px solid rgba(138,109,20,.55); color:#8a6d14; }
.auCmpChip.on{ background:#C9A24A; color:#1a1206; border-color:#C9A24A; font-weight:800; }
.auCmpCols{ display:flex; flex-wrap:wrap; gap:6px 14px; margin:4px 0 8px; font-size:13px; }
.auCmpColOpt{ display:flex; align-items:center; gap:4px; margin:0; font-weight:600; }
.auCmpColOpt input{ width:auto; margin:0; }
.auCmpT{ width:100%; border-collapse:collapse; font-size:14px; }
.auCmpT th{ background:#C9A24A; color:#1a1206; font-weight:800; padding:9px 7px; white-space:nowrap; text-align:center; }
.auCmpT th.x{ background:#a8873e; }
.auCmpT td{ padding:9px 7px; white-space:nowrap; text-align:center; border-bottom:1px solid rgba(138,109,20,.22); font-variant-numeric:tabular-nums; cursor:pointer; }
.auCmpT td.code{ font-weight:800; color:#8a6d14; direction:ltr; position:sticky; inset-inline-start:0; background:var(--card,#fff); z-index:1; }
.auCmpT tr.hl td{ background:rgba(201,162,74,.14); font-weight:700; }
.auCmpT tr.hl td.code{ background:#f3ead6; }
.auCmpT tr.tot td{ border-top:2px solid #C9A24A; font-weight:800; color:#8a6d14; cursor:default; }
.auCmpT tr.off td{ background:#f7f4ee; cursor:default; }
.auCmpT tr.off td.code{ background:#efe9de; }
.auCmpT tr.tot.all td{ border-top:3px double #8a6d14; color:#5a3e10; }
.auCmpT .sumUp, .auCmpT .sumDn{ font-size:11px; }
.auCmpNote{ font-size:12px; margin-top:8px; line-height:1.8; }
.auCmpShotHide{ display:none !important; }
.auCmpShotFull{ overflow:visible !important; }
.soldInvLink{ color:inherit; text-decoration:underline; text-decoration-color:var(--gold); text-underline-offset:3px; }
.bClNote{ font-size:10px; }
.blblBoxRow{ display:flex; align-items:center; gap:6px; margin:8px 0 2px; font-size:13px; font-weight:700; }
/* v9.86: «🔗 ربط بصنف» في بطاقة البيعة — برتقالي (طلب المالك) */
.acLinkWrap{ width:100%; margin:6px 0 4px; }
.acLinkBtn{ display:inline-block; width:auto; border:1.5px solid #E07B1A; background:#FFF3E6; color:#B85A00; border-radius:10px; padding:4px 10px; font-size:12px; font-weight:800; min-height:0; }
.acLinkBox{ margin-top:8px; border:2px solid #E07B1A; background:#FFF8F0; border-radius:14px; padding:10px; }
.acLinkBox input{ width:100%; }
.acLinkGo{ display:block; width:100%; margin-top:8px; background:#E07B1A; color:#fff; border:0; border-radius:12px; padding:11px; font-weight:800; }
.acLinkGo:disabled{ opacity:.45; }
.acLinkNote{ font-size:12px; margin-top:6px; line-height:1.6; }

/* v9.87.0: «⏳ دفعة قديمة» بجانب كود الدفعة */
.bCodeRow{ display:flex; gap:6px; align-items:center; }
.bCodeRow input{ flex:1; min-width:0; }
.bOldBtn{ width:auto; flex:none; white-space:nowrap; border:1.5px solid #B08D3C; background:#FBF3E0; color:#6B4E12; border-radius:10px; padding:6px 10px; font-size:12px; font-weight:800; min-height:0; }
.bOldBtn.on{ background:#B08D3C; color:#fff; }

/* v9.88.0 (504): كنترول المزاد — مثل البائع (لا تصدير/استيراد، لا أصحاب بضاعة، لا ربط بنود) لكنّه يولّد فواتير المزاد،
   ومثل المدير في المباعة والأصناف والعملاء (بلا تكلفة/ربح/مالك/تفاصيل عميل/تعديل أسعار) */
body.auction-role [data-click^="rlOpen"], body.auction-role [data-click^="custImportPick"], body.auction-role [data-click^="custExport"],
body.auction-role [data-click^="auQuickAddConsignor"], body.auction-role [data-click^="soldOpenForGrade"], body.auction-role [data-click^="openGradeProfile"],
body.auction-role [data-click^="genExport"], body.auction-role [data-click^="genImportPick"],
body.auction-role [data-click^="edToggleCN"], body.auction-role [data-click^="cnIssue"],
body.auction-role [data-click^="pricesOpen"], body.auction-role [data-click^="pricesEdit"], body.auction-role [data-click^="pricesSave"],
body.auction-role [data-click^="pricesAddShape"], body.auction-role [data-click^="btEditPrice"], body.auction-role [data-click^="btAddShape"],
body.auction-role [data-click^="gradesOpenBatch"], body.auction-role [data-click^="gpRelink"], body.auction-role [data-click^="gpQuickWeight"],
body.auction-role [data-click^="soldRelink"], body.auction-role [data-click^="soldBulkLink"], body.auction-role [data-click^="soldToConsignor"],
body.auction-role [data-click^="profSettleGo"], body.auction-role [data-click^="profTagInvestor"], body.auction-role [data-click^="profUnsettle"],
body.auction-role [data-click^="dmgOpen"], body.auction-role [data-click^="dmgUndo"], body.auction-role [data-click^="openCustomerProfile"],
body.auction-role [data-click^="mrgOpen"], body.auction-role [data-click^="gradesGoCreate"],
body.auction-role #rawPending{ display:none !important; }
body.auction-role #ctbl_grades th:nth-child(4), body.auction-role #ctbl_grades td:nth-child(4),
body.auction-role #ctbl_solditems th:nth-child(12), body.auction-role #ctbl_solditems td:nth-child(12),
body.auction-role #ctbl_solditems th:nth-child(13), body.auction-role #ctbl_solditems td:nth-child(13),
body.auction-role #ctbl_customers th:nth-child(5), body.auction-role #ctbl_customers td:nth-child(5),
body.auction-role #ctbl_customers th:nth-child(6), body.auction-role #ctbl_customers td:nth-child(6),
body.auction-role #ctbl_customers th:nth-child(7), body.auction-role #ctbl_customers td:nth-child(7),
body.auction-role #ctbl_customers th:nth-child(8), body.auction-role #ctbl_customers td:nth-child(8){ display:none !important; }
body.auction-role [data-click="custHubShow('top')"], body.auction-role [data-click="custHubShow('due')"],
body.auction-role [data-click="custHubShow('idle')"], body.auction-role [data-click="custHubShow('new')"],
body.auction-role [data-click="custHubShow('geo')"], body.auction-role [data-click="custHubShow('dup')"]{ display:none !important; }
/* v9.89.0: «بيع خاماً» تحت المُباع في قائمة الدفعات */
.bRawSold{ font-size:11px; font-weight:700; color:#7a4a1e; white-space:nowrap; margin-top:2px; }

  /* v9.93.5 (المالك): اسم الصنف كان ينكسر كلمة في كلّ سطر فيطول الصفّ — عرض أدنى لعمود الصنف والدرجة/الشكل */
  #soldRows td.soldItemTd{ min-width:230px; }
  #soldRows td.soldTshTd{ min-width:110px; }

  /* v9.94.0: سجلّ ملاحظات الدفعة · وخانة الملاحظات متعدّدة الأسطر (كانت input فتُدمج الأسطر عند الحفظ) */
  .bnTa{ width:100%; box-sizing:border-box; min-height:64px; padding:8px 10px; border:1px solid #E6DACB; border-radius:12px; background:#FFFEFB; color:inherit; resize:vertical; }
  body.dark .bnTa{ background:transparent; border-color:var(--line); }
  #bnList{ margin:10px 0; max-height:50vh; overflow:auto; }
  .bnItem{ padding:7px 0; border-bottom:1px solid var(--line); white-space:pre-wrap; color:var(--ink,inherit); }
  .bnDate{ color:var(--gold); margin-inline-end:6px; }
  .bnHead{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
  #bnTitle{ font-size:17px; unicode-bidi:plaintext; }
  .bnHead .bnX{ width:auto; flex:0 0 auto; padding:4px 12px; }
  .bnAdd{ display:grid; gap:8px; }
  .bnAdd #bnDate{ max-width:200px; }

/* v9.95.0 — بيعة عالتمّ بأكثر من خيار */
.atoWrap{flex-basis:100%;width:100%;margin-top:6px}
.atoTbl{width:100%;border-collapse:collapse;font-size:13px;margin:4px 0}
.atoTbl th{background:var(--gold-soft,#efe6d6);padding:5px 4px;font-weight:600;text-align:center}
.atoTbl td{padding:4px;border-bottom:1px solid var(--line,#e6dccb);text-align:center;vertical-align:middle}
.atoTbl .atoMain td{color:var(--muted,#7a6a5a);font-size:12px}
.atoTbl input{width:72px;min-width:0;padding:4px 6px}
.atoTbl .atoQty{width:56px}
.atoTbl select.atoUnit{width:auto;min-width:0;padding:4px 2px;margin-inline-start:4px}
.atoAdd{margin-top:4px}
.atoHint{font-size:11px;margin-top:4px}
.atoChip{display:flex;align-items:center;gap:6px;justify-content:space-between;border:1px solid var(--line,#e0d3bd);border-radius:10px;padding:4px 8px;margin:4px 0}
.atoChipName{flex:1;text-align:start}
.atoChipSel{width:auto;min-width:0;padding:3px 6px}
.atoChipSum{font-weight:600;margin-top:4px}
#auCard .atoDel{padding:2px 10px;width:auto !important;flex:0 0 auto !important;min-width:0 !important}
#auCard .atoChipSel{flex:0 0 auto !important}
.atoTbl td.atoQU{display:flex;gap:4px;align-items:center;justify-content:center}
.atoTbl td.atoQU select.atoUnit{margin:0}

/* v9.95.1 — وحدة «السعر الأصلي» · العميل اختياريّ والرسوّ آليّ في «عالتمّ» */
.acUnitBadge{display:inline-block;background:var(--gold,#b3955a);color:#fff;border-radius:6px;padding:0 7px;font-size:11px;font-weight:600;margin-inline-start:4px;line-height:18px}
.acUnitBadge:empty{display:none}
#acCustWrap.acOptional{opacity:.6}
#acCustWrap.acOptional:focus-within{opacity:1}
#auCard input.acAutoFinal{background:#efeae1;color:#6b5d4e;cursor:not-allowed}

/* v9.96.0 — كل مبيعات الصنف / المبيعات المشابهة */
.acLastPx .lpAll{padding:2px 10px;font-size:12px}
.acLastPx .lpSim{color:#8a6d14}
.auSalesOv{position:fixed;inset:0;background:rgba(30,20,15,.45);z-index:9000;display:flex;align-items:center;justify-content:center;padding:12px}
.auSalesBox{background:var(--card,#fffdf9);border-radius:16px;max-width:820px;width:100%;max-height:88vh;display:flex;flex-direction:column;padding:12px 14px;box-shadow:0 10px 30px rgba(0,0,0,.25)}
.auSalesHead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;color:var(--maroon,#5a1e2b)}
.auSalesHead b{unicode-bidi:plaintext}
#auSalesOv .auSalesX{width:auto;flex:0 0 auto;padding:2px 12px}
.auSalesScroll{overflow:auto;flex:1}
.auSalesTbl{width:100%;border-collapse:collapse;font-size:12px}
.auSalesTbl th{position:sticky;top:0;background:var(--gold-soft,#efe6d6);padding:6px 4px;white-space:nowrap}
.auSalesTbl td{padding:5px 3px;border-bottom:1px solid var(--line,#eee3d2);text-align:center;white-space:nowrap}
.auSalesTbl td.asName{white-space:normal;min-width:160px;text-align:start}
.auSalesTbl td.asCust{white-space:normal;min-width:80px}
.auSalesSum{margin-top:8px;background:#f6f1e6;border:1px solid #e4d9bf;border-radius:10px;padding:7px 9px;font-size:12.5px;font-weight:600;color:#5a4a22;line-height:1.8}
.auSalesNote{font-size:11px;margin-top:4px}

/* v9.96.1 */
.tmRowUnit{display:block;font-size:11px;color:var(--muted,#7a6a5a)}
/* v9.98.0: بيعة عالتمّ — عدد كلّ مشترٍ (− ×2 +) والملخّص الحيّ */
.atoN{display:inline-flex;align-items:center;gap:4px;flex:0 0 auto}
.atoNBtn{min-width:30px;padding:2px 8px;font-weight:700}
.atoNVal{min-width:26px;text-align:center}
.atoChipAmt{flex:0 0 auto;font-size:.9em;opacity:.8}
.atoSumOk{color:#1a7f3c;margin-inline-start:6px}
.atoSumBad{color:#a33b2e;margin-inline-start:6px}
/* v9.98.1: على الجوّال كان سطر المشتري يخرج عن البطاقة (يختفي ✕ والمبلغ) ⟵ يلتفّ: الاسم و✕ سطر، والخيار والعدد والمبلغ تحته */
.atoChip{flex-wrap:wrap;row-gap:4px}
@media (max-width:700px){
  .atoChipName{order:1;flex:1 1 auto;min-width:0}
  .atoChip .atoDel{order:2}
  .atoChip::after{content:"";flex-basis:100%;height:0;order:3}
  .atoChipSel,.atoN,.atoChipAmt{order:4}
  .atoChipAmt{flex:1 1 auto;text-align:end}
}
/* v9.99.0: ملاحظة لكلّ مشترٍ في بيعة عالتمّ */
.atoNoteBtn{flex:0 0 auto;padding:2px 8px;opacity:.55}
.atoNoteBtn.on{opacity:1;border-color:#b8913e}
.atoChip .atoNote{flex:1 1 100%;order:9;margin-top:2px;font-size:.92em}
@media (max-width:700px){ .atoChip .atoNoteBtn{order:2} }
#auCard .atoNoteBtn{flex:0 0 auto !important;width:auto !important;min-width:40px}
/* v9.100.0: 🎁 لكلّ مشترٍ في بيعة عالتمّ */
.atoChip .atoGift{flex:1 1 100%;order:10;display:flex;align-items:center;gap:6px;margin-top:2px;flex-wrap:wrap}
.atoChip .atoGiftTo{flex:2 1 160px;min-width:0}
.atoChip .atoGiftQ{flex:1 1 90px;min-width:0;max-width:150px}
.atoGiftSt{min-width:14px;color:#1a7f3c}
@media (max-width:700px){ .atoChip .atoGiftBtn{order:2} }
/* v9.102.0: إضافة عميل سريعة من بطاقة المزاد */
.qcRow{display:flex;gap:6px;align-items:center}
.qcRow input{flex:1 1 auto;min-width:0}
.qcAddBtn{flex:0 0 auto;min-width:38px;font-weight:700;font-size:18px;line-height:1;padding:6px 10px;border-color:#b8913e;color:#8a6a2a}
.qcBox{max-width:380px;width:100%}
.qcHead{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.qcLbl{display:block;font-size:.88em;margin:8px 0 3px;opacity:.8}
.qcBox input{width:100%}
.qcMsg{min-height:18px;margin-top:8px;font-size:.92em}
.qcMsg.err{color:#a33b2e}
.qcBtns{display:flex;gap:8px;margin-top:10px}
