/* ============================================================
   JBOKER — أنماط لوحة المذخر
   ============================================================
   استُخرجت من index.html التي كانت ملفاً واحداً بحجم 415KB.
   الهوية والسلّم الطباعي في design-system.css؛ هذا الملف لهذه
   الصفحة وحدها.

   ملاحظة: أنماط الطباعة (الفواتير وإشعارات الإرجاع وكشوف
   الحساب) تبقى داخل app.js لأنها تُبنى كنصوص وتُحقن في نافذة
   الطباعة وقت التشغيل، وليست أنماطاً لهذه الصفحة.
   ============================================================ */

:root {
    /* الهوية والأسطح والسلّم الطباعي كلها في design-system.css.
       ما يلي خاص بهذه الصفحة وحدها. */

    /* لون القسم النشط — يُبدَّل من JS عند تغيير القسم، درجتان:
       --acc على الخلفية الغامقة، --acc-dk على البطاقات البيضاء */
    --acc:    #38BDF8;
    --acc-dk: #0369A1;
    --acc-sf: #E3F4FD;

    /* نصوص الشارات على الخلفية الغامقة — نظائر فاتحة للدلالات */
    --on-green: #4ADE80;
    --on-amber: #FBD98D;
    --on-red:   #FDA4AF;
    --on-blue:  #93C5FD;

    /* تدرّجات إضافية يستعملها كود الرسم */
    --info-soft:  #E3F1FA;
    --blue-pill:  #1D4ED8;   --blue-pill-sf: #E7EEFD;
  }

  * , *::before, *::after { box-sizing: border-box; }
  html, body { height: 100%; }

  body {
    margin: 0;
    background: var(--shell);
    color: var(--on-shell);
    font-family: "Readex Pro", "IBM Plex Sans Arabic", Tahoma, sans-serif;
    font-size: 16px; font-weight: 300; line-height: 1.65;
    -webkit-font-smoothing: antialiased;
  }

  .num { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; direction: ltr; display: inline-block; }

  /* ================= الهيكل ================= */
  .app { display: flex; min-height: 100vh; }

  .side {
    width: 238px; flex-shrink: 0;
    background: linear-gradient(178deg, var(--brand-1) 0%, var(--brand-2) 46%, var(--brand-3) 100%);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
  }

  .side .brand {
    padding: 20px 20px 18px; display: flex; align-items: center; gap: 11px;
    border-bottom: 1px solid rgba(255,255,255,.16);
  }
  .side .brand img { width: 36px; height: 36px; display: block; border-radius: 9px; }
  .side .brand b { display: block; font-weight: 600; font-size: 17px; color: #fff; letter-spacing: -.2px; }
  .side .brand span { font-size: 12.5px; color: rgba(255,255,255,.74); font-weight: 300; }

  .side nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
  .side nav::-webkit-scrollbar { width: 0; }

  .side .nav-btn {
    position: relative; display: flex; align-items: center; gap: 11px;
    width: 100%; text-align: right; background: none; border: none; cursor: pointer;
    font-family: inherit; font-size: 15px; font-weight: 400; color: rgba(255,255,255,.82);
    padding: 10px 12px; margin-bottom: 2px; border-radius: var(--r-s);
    transition: background .16s, color .16s;
  }
  .side .nav-btn:hover { background: rgba(255,255,255,.13); color: #fff; }
  .side .nav-btn .dot {
    width: 8px; height: 8px; border-radius: 3px; background: #fff; opacity: .5;
    transition: opacity .2s, transform .2s, background .2s;
  }
  .side .nav-btn.on { background: #fff; color: var(--c-dk); font-weight: 500; }
  .side .nav-btn.on .dot { opacity: 1; transform: scale(1.15); background: var(--c-dk); }
  .side .nav-btn.on::before {
    content: ""; position: absolute; right: -10px; top: 7px; bottom: 7px;
    width: 3px; background: #fff; border-radius: 0 3px 3px 0;
  }

  /* كانت الخلفية rgba(255,255,255,.2) — أبيض شفاف تحت نص أبيض، فيهبط
     التباين إلى 3.34 أعلى التدرّج. التعتيم بدل التفتيح يرفعه إلى 7.2. */
  .badge {
    margin-right: auto; font-family: "IBM Plex Mono", monospace; font-size: 12.5px;
    color: #fff; background: rgba(0,0,0,.25); padding: 1px 8px; border-radius: 20px;
  }
  .nav-btn.on .badge { background: var(--c-dk); color: #fff; }
  /* opacity تخفّت النص والخلفية معاً، فقيمة .55 كانت تهبط بالتباين إلى 3.12.
     .75 تُبقي التخفيت المقصود للأصفار وتعبر حد WCAG AA (4.60). */
  .badge.z { opacity: .75; }

  .side .foot {
    padding: 13px 18px 16px; border-top: 1px solid rgba(255,255,255,.16);
    font-size: 12.5px; color: rgba(255,255,255,.78);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
  }

  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .rail { height: 3px; background: var(--acc); transition: background .4s ease; }

  .head {
    padding: 20px 30px 18px; border-bottom: 1px solid var(--line-d);
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  }
  .head .eyebrow {
    font-family: "IBM Plex Mono", monospace; font-size: 12.5px; letter-spacing: 2.2px;
    color: var(--acc); margin-bottom: 4px; transition: color .4s ease;
  }
  .head h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.4px; }
  .head .sub { font-size: 13.5px; color: var(--on-shell-2); margin-top: 2px; }
  .top-right { display: flex; align-items: center; gap: 8px; }

  .live {
    display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--on-shell-2);
    background: rgba(255,255,255,.06); border: 1px solid var(--line-d);
    padding: 6px 12px; border-radius: 99px;
  }
  .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--on-green); animation: pulse 2.4s infinite; }
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(74,222,128,.5); }
    70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
    100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
  }

  .sound-btn {
    width: 34px; height: 34px; border-radius: 50%; padding: 0; cursor: pointer;
    background: rgba(255,255,255,.06); border: 1px solid var(--line-d);
    font-size: 16px; line-height: 1.0; display: grid; place-items: center; color: var(--on-shell);
  }
  .sound-btn:hover { background: rgba(255,255,255,.12); }
  .sound-btn.on { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.4); }

  .wrap { padding: 22px 30px 46px; flex: 1; }

  /* ================= الأزرار ================= */
  button { font-family: inherit; font-size: 15px; cursor: pointer; border: none; }

  .btn {
    background: var(--acc); color: var(--shell); font-weight: 500;
    padding: 10px 20px; border-radius: var(--r-s);
    transition: background .4s ease, filter .15s;
  }
  .btn:hover { filter: brightness(1.07); }
  .btn:active { transform: translateY(1px); }

  .btn-line {
    background: rgba(255,255,255,.05); border: 1px solid var(--line-d); color: var(--on-shell-2);
    padding: 8px 14px; border-radius: var(--r-s); font-size: 13.5px; font-weight: 400;
  }
  .btn-line:hover { background: rgba(255,255,255,.11); color: var(--on-shell); }

  /* داخل البطاقات البيضاء تنقلب للنمط الفاتح */
  .card .btn-line, .card-head .btn-line, .modal .btn-line {
    background: #fff; border-color: var(--line); color: var(--ink-2);
  }
  .card .btn-line:hover, .card-head .btn-line:hover, .modal .btn-line:hover {
    background: var(--tint); color: var(--ink); border-color: var(--on-shell-2);
  }
  .card .btn, .modal .btn { background: var(--acc-dk); color: #fff; }

  .btn-danger {
    background: #fff; border: 1px solid var(--line); color: var(--muted);
    padding: 7px 12px; font-size: 13.5px; border-radius: var(--r-s); font-weight: 400;
  }
  .btn-danger:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-sf); }

  .btn-print {
    background: #fff; border: 1px solid var(--line); color: var(--acc-dk);
    padding: 7px 12px; font-size: 13.5px; border-radius: var(--r-s); font-weight: 500;
  }
  .btn-print:hover { background: var(--acc-sf); border-color: var(--acc-dk); }

  .btn-reset {
    background: var(--bad-sf); border: 1px solid rgba(184,29,63,.28); color: var(--bad);
    border-radius: 99px; padding: 4px 12px; font-size: 12.5px; font-weight: 500;
  }
  .btn-reset:hover { filter: brightness(.97); }

  button:focus-visible, a:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

  /* ================= الحقول ================= */
  label { display: block; font-size: 13.5px; color: var(--ink-2); font-weight: 400; margin-bottom: 5px; }
  input, select {
    width: 100%; background: #fff; border: 1px solid var(--line); color: var(--ink);
    padding: 10px 12px; border-radius: var(--r-s); font-family: inherit; font-size: 15px; font-weight: 300;
    transition: border-color .14s, box-shadow .14s;
  }
  input::placeholder { color: var(--muted); }
  input:focus, select:focus {
    outline: none; border-color: var(--acc-dk); box-shadow: 0 0 0 3px var(--acc-sf);
  }
  .field { margin-bottom: 13px; }
  .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
  .g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
  .g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }

  /* ================= البطاقات ================= */
  .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
  .kpi {
    background: var(--card); border-radius: var(--r); padding: 16px 17px;
    box-shadow: var(--lift); position: relative; overflow: hidden;
  }
  .kpi .ico {
    width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center;
    background: var(--cs); color: var(--c); font-size: 13.5px; margin-bottom: 10px;
  }
  .kpi b {
    display: block; font-family: "IBM Plex Mono", monospace; font-size: 26px; font-weight: 500;
    line-height: 1.2; letter-spacing: -1px; color: var(--ink);
  }
  .kpi span { font-size: 13.5px; color: var(--muted); }
  .kpi .hint { display: block; font-size: 12.5px; color: var(--muted); opacity: .85; margin-top: 3px; }

  .card {
    background: var(--card); border-radius: var(--r); margin-bottom: 18px;
    box-shadow: var(--lift); color: var(--ink); overflow: hidden;
  }
  .card-head {
    padding: 15px 18px; border-bottom: 1px solid var(--line-2);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  }
  .card-head h2 { font-size: 16px; font-weight: 500; margin: 0; }
  .card-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
  .card > *:not(.card-head) { padding-left: 18px; padding-right: 18px; }
  .card > .tbl-wrap, .card > #oList, .card > #pendingList, .card > #alertsList,
  .card > #mList, .card > #cList, .card > #phList, .card > #cartsList, .card > #pendingPharm {
    padding-left: 0; padding-right: 0;
  }
  .card > *:last-child { padding-bottom: 18px; }

  /* ================= الإشعارات ================= */
  .toasts {
    position: fixed; bottom: 20px; left: 20px; z-index: 300;
    display: flex; flex-direction: column-reverse; gap: 9px;
    max-width: min(380px, calc(100vw - 40px)); pointer-events: none;
  }
  .toast {
    background: var(--card); color: var(--ink);
    border-radius: var(--r-s); padding: 13px 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,.28);
    display: flex; align-items: flex-start; gap: 11px;
    font-size: 15px; line-height: 1.65; pointer-events: auto;
    border-right: 3px solid var(--tc);
    animation: toastIn .26s cubic-bezier(.2,.8,.3,1) both;
  }
  .toast.out { animation: toastOut .2s ease both; }
  @keyframes toastIn  { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
  @keyframes toastOut { to { opacity: 0; transform: translateX(-20px); } }
  .toast .ti { font-size: 16px; line-height: 1.35; flex-shrink: 0; color: var(--tc); }
  .toast .tx { flex: 1; }
  .toast .tx b { display: block; font-weight: 500; margin-bottom: 1px; }
  .toast .tx span { color: var(--muted); font-size: 13.5px; }
  .toast .tc {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 17px; line-height: 1.0; padding: 0 2px; flex-shrink: 0;
  }
  .toast .tc:hover { color: var(--ink); }

  /* ================= هياكل التحميل ================= */
  .sk { background: linear-gradient(90deg, var(--line-2) 25%, var(--line-2) 50%, var(--line-2) 75%);
        background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
  @keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  .sk-card { background: var(--card); border-radius: var(--r); padding: 16px 17px; box-shadow: var(--lift); }
  .sk-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px; margin-bottom: 11px; }
  .sk-line { height: 11px; margin-bottom: 9px; }
  .sk-line:last-child { margin-bottom: 0; }

  /* ================= السلّم الطباعي =================
     كانت المقاسات قيماً كسرية متفرّقة (11.5 / 12.5 / 13.5 / 14.5) والنص
     الأساسي 14.5px — صغير على شاشة موبايل، والحروف العربية تحتاج مساحة
     رأسية أكبر من اللاتينية بنفس المقاس. هذا سلّم منتظم بأساس 15px.
     --fs يبقى معامل تكبير المستخدم كما هو. */
  :root {
    --fs: 1;
    --t-xs:   calc(12.5px * var(--fs));  /* شارات، وسوم */
    --t-sm:   calc(13.5px * var(--fs));  /* تسميات، بيانات ثانوية */
    --t-base: calc(15px   * var(--fs));  /* النص الأساسي: أزرار، حقول، جداول */
    --t-md:   calc(16px   * var(--fs));  /* عناوين البطاقات */
    --t-lg:   calc(17.5px * var(--fs));  /* عناوين الصفوف */
    --t-xl:   calc(23px   * var(--fs));  /* عنوان الصفحة */
    --t-2xl:  calc(28px   * var(--fs));  /* أرقام المؤشرات */
  }
  body { font-size: var(--t-base); }
  .head h1 { font-size: var(--t-xl); }
  .kpi b, .big b, .stat b { font-size: var(--t-2xl); }
  .card-head h2, .mini h3 { font-size: var(--t-md); }
  table { font-size: var(--t-base); }
  .row-title, .title { font-size: var(--t-lg); }
  .btn, button { font-size: var(--t-base); }
  label, .fld label { font-size: var(--t-sm); }
  input, select { font-size: var(--t-base); }
  .meta, .rows, .sub { font-size: var(--t-sm); }
  .pill, .tag { font-size: var(--t-xs); }
  .nav-btn, .side .item { font-size: var(--t-base); }

  /* ================= الوضع الإنجليزي ================= */
  body.ltr { direction: ltr; }
  body.ltr .side { border-left: none; border-right: 1px solid var(--line-d); }
  body.ltr .nav-btn.on::before { right: auto; left: -10px; border-radius: 3px 0 0 3px; }
  body.ltr .badge { margin-right: 0; margin-left: auto; }
  body.ltr th, body.ltr td { text-align: left; }
  body.ltr .row::before { inset: 13px 0 13px auto; right: 0; left: auto; }
  body.ltr .search .ic { right: auto; left: 13px; }
  body.ltr .search input { padding-right: 12px; padding-left: 38px; }
  body.ltr .alertbar, body.ltr .warnbar { border-right: none; border-left: 3px solid currentColor; }
  body.ltr .num { direction: ltr; }

  /* ================= الإعدادات ================= */
  .setting-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
  }
  .setting-row:last-child { border-bottom: none; padding-bottom: 0; }
  .setting-row:first-of-type { padding-top: 0; }
  .setting-row > div { flex: 1; min-width: 200px; }
  .setting-row b { display: block; font-weight: 500; font-size: calc(13.5px * var(--fs)); color: var(--ink); }
  .setting-row .sub { font-size: calc(12.5px * var(--fs)); color: var(--muted); margin-top: 2px; }

  .toggle {
    width: 46px; height: 26px; border-radius: 99px; padding: 0; flex-shrink: 0;
    background: var(--line); border: none; position: relative; cursor: pointer;
    transition: background .2s;
  }
  .toggle span {
    position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
    transition: transform .2s;
  }
  .toggle.on { background: var(--acc-dk); }
  .toggle.on span { transform: translateX(-20px); }
  body.ltr .toggle span { right: auto; left: 3px; }
  body.ltr .toggle.on span { transform: translateX(20px); }

  .info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .info-cell { background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-s); padding: 13px 15px; }
  .info-cell .k { font-size: calc(11.5px * var(--fs)); color: var(--muted); margin-bottom: 3px; }
  .info-cell .v { font-size: calc(14.5px * var(--fs)); font-weight: 500; color: var(--ink); }

  .fs-preview {
    background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-s);
    padding: 14px 16px; margin-top: 12px;
  }
  .fs-preview .t { font-weight: 500; color: var(--ink); }
  .fs-preview .s { color: var(--muted); margin-top: 3px; }

  @media (max-width: 620px) { .info-grid { grid-template-columns: 1fr; } }

  /* ================= تثبيت التطبيق ================= */
  .install-bar {
    display: none; align-items: center; gap: 12px; flex-wrap: wrap;
    background: linear-gradient(100deg, var(--acc-dk), var(--acc));
    color: #fff; border-radius: var(--r); padding: 13px 16px; margin-bottom: 16px;
  }
  .install-bar.on { display: flex; }
  .install-bar .ib-txt { flex: 1; min-width: 200px; font-size: 15px; line-height: 1.65; }
  .install-bar .ib-txt b { display: block; font-weight: 600; font-size: 16px; }
  .install-bar button {
    background: #fff; color: var(--acc-dk); border: none; border-radius: var(--r-s);
    padding: 9px 18px; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
  }
  .install-bar button:hover { filter: brightness(.96); }
  .install-bar .ib-x {
    background: rgba(255,255,255,.2); color: #fff; padding: 9px 13px;
  }

  .sw-toast {
    position: fixed; bottom: 20px; left: 20px; z-index: 300;
    background: var(--ink); color: #fff; border-radius: var(--r-s);
    padding: 13px 17px; font-size: 15px; display: none; align-items: center; gap: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
  }
  .sw-toast.on { display: flex; }
  /* --acc ألوان باستيل مخصّصة للخلفية الغامقة؛ استعمالها كخلفية لنص أبيض
     يعطي تبايناً 1.67 فقط. --acc-dk هو المقابل الغامق المعدّ لهذا الغرض. */
  .sw-toast button {
    background: var(--acc-dk); color: #fff; border: none; border-radius: 7px;
    padding: 7px 15px; font-size: 14px; font-weight: 600; cursor: pointer;
  }

  /* ================= تحذير المخزون ================= */
  .row.has-warn { background: var(--red-soft); border-color: rgba(190,36,84,.28); }

  /* ================= الباركود والصور والتشغيلات ================= */
  .scanbar {
    display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
    background: var(--tint); border: 1px solid var(--line);
    border-radius: var(--r-s); padding: 12px 14px; margin-bottom: 14px;
  }
  .scanbar .lbl { font-size: 15px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
  .scanbar input { flex: 1; min-width: 180px; font-family: "IBM Plex Mono", monospace; letter-spacing: 1px; }
  .scanbar .hint { font-size: 12.5px; color: var(--muted); width: 100%; }

  .med-thumb {
    width: 46px; height: 46px; border-radius: 9px; object-fit: cover;
    border: 1px solid var(--line); background: var(--tint); display: block;
  }
  .med-thumb.ph {
    display: grid; place-items: center; font-size: 17px; color: var(--muted);
  }
  .med-cell { display: flex; gap: 11px; align-items: flex-start; }

  .img-box {
    border: 2px dashed var(--line); border-radius: var(--r-s);
    padding: 16px; text-align: center; transition: border-color .16s;
  }
  .img-box:hover { border-color: var(--acc-dk); }
  .img-box img { max-width: 150px; max-height: 150px; border-radius: 9px; margin: 0 auto 10px; display: block; }
  .img-box .acts { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
  .img-box .ph { font-size: 30px; color: var(--muted); margin-bottom: 8px; }

  .batch-row {
    display: grid; grid-template-columns: 1fr auto auto auto; gap: 11px; align-items: center;
    padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-s);
    margin-bottom: 8px; background: #fff;
  }
  .batch-row.expired { border-color: rgba(190,36,84,.35); background: var(--bad-sf); }
  .batch-row.soon { border-color: rgba(166,105,8,.3); background: var(--warn-sf); }
  .batch-row .bn { font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 15px; }
  .batch-row .bd { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
  .batch-row .bq { font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 17px; }

  .scan-view {
    width: 100%; max-width: 420px; border-radius: var(--r-s);
    background: #000; display: block; margin: 0 auto;
  }
  .scan-note { font-size: 13.5px; color: var(--muted); text-align: center; margin-top: 12px; line-height: 1.85; }

  /* ================= الجداول ================= */
  .tbl-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 15px; }
  th {
    text-align: right; font-weight: 400; font-family: "IBM Plex Mono", monospace;
    font-size: 12.5px; letter-spacing: 1.3px; color: var(--muted);
    padding: 11px 18px; border-bottom: 1px solid var(--line-2); background: var(--tint); white-space: nowrap;
  }
  td { padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
  tbody tr:last-child td { border-bottom: none; }
  tbody tr:hover { background: var(--tint); }
  td.n { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }

  /* ================= الشارات ================= */
  .pill { display: inline-block; font-size: 12.5px; font-weight: 400; padding: 3px 10px; border-radius: 6px; white-space: nowrap; }
  .p-teal  { background: var(--acc-sf);  color: var(--acc-dk); }
  .p-green { background: var(--ok-sf);   color: var(--ok); }
  .p-blue  { background: var(--blue-pill-sf);        color: var(--blue-pill); }
  .p-amber { background: var(--warn-sf); color: var(--warn); }
  .p-red   { background: var(--bad-sf);  color: var(--bad); }
  .p-gray  { background: var(--line-2);  color: var(--muted); }

  /* ================= صفوف الطلبات ================= */
  .row {
    background: #fff; border: 1px solid var(--line); border-radius: var(--r);
    padding: 15px 16px; margin: 0 18px 11px; position: relative;
    animation: rise .24s ease both;
  }
  @keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
  .row::before { content: ""; position: absolute; inset: 13px auto 13px 0; width: 3px; border-radius: 3px; background: var(--c); }
  .row.faded { opacity: .6; }
  .row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 9px; }
  .row-title { font-weight: 500; font-size: 17px; }
  .qty { font-family: "IBM Plex Mono", monospace; color: var(--acc-dk); font-weight: 600; }
  .meta { font-size: 13.5px; color: var(--muted); display: grid; gap: 2px; margin-bottom: 12px; }
  .meta b { color: var(--ink-2); font-weight: 400; }
  .miss { color: var(--warn); }
  .money { color: var(--ok); font-weight: 600; }

  .steps { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .step {
    flex: 1; min-width: 86px; background: #fff; border: 1px solid var(--line);
    color: var(--muted); font-size: 13.5px; font-weight: 400; padding: 7px 6px; border-radius: var(--r-s);
  }
  .step:hover { background: var(--tint); color: var(--ink); }
  .step.on { background: var(--c); border-color: var(--c); color: #fff; font-weight: 500; }
  .step.past { border-color: var(--c); color: var(--c); }

  /* ================= الأشرطة ================= */
  .barline { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
  .barline .lbl { min-width: 82px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .track { flex: 1; height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
  .fill { height: 100%; background: var(--c); border-radius: 4px; transition: width .45s ease; }
  .barline .val { min-width: 34px; text-align: left; font-family: "IBM Plex Mono", monospace; font-weight: 500; color: var(--muted); }

  .split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

  /* ================= الفلاتر ================= */
  .chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
  .chip {
    background: #fff; border: 1px solid var(--line); color: var(--muted);
    font-size: 13.5px; font-weight: 400; padding: 6px 13px; border-radius: 99px;
  }
  .chip:hover { border-color: var(--on-shell-2); color: var(--ink); }
  .chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

  .subtabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
  .subtab {
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-s);
    padding: 9px 15px; font-weight: 500; font-size: 15px; color: var(--muted);
    display: flex; align-items: center; gap: 8px;
  }
  .subtab:hover { border-color: var(--on-shell-2); color: var(--ink); }
  .subtab .n { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; background: var(--line-2); padding: 0 8px; border-radius: 99px; }
  .subtab.on { background: var(--c); border-color: var(--c); color: #fff; }
  .subtab.on .n { background: rgba(255,255,255,.26); color: #fff; }

  .agree {
    display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
    font-size: 13.5px; color: var(--ink-2); font-weight: 400;
    margin: 4px 0 16px; line-height: 1.65;
  }
  .agree input { width: auto; margin: 4px 0 0; flex-shrink: 0; accent-color: var(--acc-dk); }
  .agree a { color: var(--acc-dk); text-decoration: underline; text-underline-offset: 3px; }

  .gate-box {
    background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-s);
    padding: 14px 16px; font-size: 13.5px; color: var(--ink-2); line-height: 1.85;
  }
  .gate-box b { display: block; margin-bottom: 6px; font-weight: 500; color: var(--ink); }
  .gate-box ul { margin: 0; padding-right: 18px; }
  .gate-box li { margin-bottom: 4px; }

  .search { position: relative; margin-bottom: 14px; }
  .search input { padding-right: 38px; }
  .search .ic { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; }

  /* ================= شريط التاريخ ================= */
  .datebar { background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px; margin-bottom: 14px; }
  .datebar .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; padding: 0; border: none; }
  .datebar .head .t { font-weight: 500; font-size: 15px; color: var(--ink-2); }
  .datebar .sum { font-size: 13.5px; color: var(--muted); }
  .datebar .sum b { color: var(--acc-dk); font-weight: 600; font-family: "IBM Plex Mono", monospace; }
  .datebar .chips { margin-bottom: 0; }
  .range { display: none; align-items: center; gap: 9px; margin-top: 11px; flex-wrap: wrap; }
  .range.on { display: flex; }
  .range input { width: auto; flex: 1; min-width: 130px; }
  .range span { font-size: 13.5px; color: var(--muted); }

  /* ================= المخزون ================= */
  .stock-ctl { display: inline-flex; align-items: center; gap: 5px; }
  .stock-ctl button {
    width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line);
    background: #fff; color: var(--ink-2); font-size: 16px; line-height: 1.0;
    display: grid; place-items: center; padding: 0;
  }
  .stock-ctl button:hover { background: var(--tint); border-color: var(--on-shell-2); }
  .stock-ctl .v { min-width: 42px; text-align: center; font-family: "IBM Plex Mono", monospace; font-weight: 600; }

  .cart-item {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; flex-wrap: wrap;
  }
  .cart-item:last-child { border-bottom: none; }
  .who { font-size: 12.5px; color: var(--muted); }

  /* ================= التنبيهات ================= */
  .alertbar { display: none; border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; font-size: 15px; border: 1px solid; }
  .alertbar.on { display: block; }
  .alertbar.warn   { background: rgba(251,191,36,.13);  border-color: rgba(251,191,36,.32);  color: var(--on-amber); }
  .alertbar.danger { background: rgba(251,113,133,.13); border-color: rgba(251,113,133,.32); color: var(--on-red); }
  .alertbar b { font-weight: 500; color: #fff; }

  .msg { color: var(--bad); font-size: 13.5px; min-height: 19px; margin-top: 11px; }
  .msg.ok { color: var(--ok); }

  .empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 15px; }
  .empty b { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; font-size: 16px; }

  /* ================= الدخول ================= */
  .auth { max-width: 400px; margin: 8vh auto 0; padding: 0 18px; }
  .auth .card { padding: 28px; }
  .auth .card > * { padding-left: 0; padding-right: 0; }
  .auth h2 { font-size: 19px; font-weight: 600; margin: 0 0 5px; }
  .auth p { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
  .mark-lg { width: 76px; height: 76px; display: block; margin: 0 auto 14px; }

  .blocked { max-width: 440px; margin: 8vh auto 0; text-align: center; padding: 0 18px; }
  .blocked .card { padding: 32px 26px; }
  .blocked .card > * { padding-left: 0; padding-right: 0; }
  .blocked .ico { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--warn-sf); font-size: 26px; }
  .blocked h2 { font-size: 19px; font-weight: 600; margin: 0 0 9px; }
  .blocked p { color: var(--muted); font-size: 15px; margin: 0 0 20px; line-height: 1.85; }
  .contact { background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-s); padding: 13px; margin-bottom: 18px; font-size: 13.5px; color: var(--muted); }
  .contact b { color: var(--ink); display: block; margin-bottom: 4px; font-weight: 500; }
  .contact .num { color: var(--acc-dk); font-size: 16px; font-weight: 600; }

  /* ================= النوافذ ================= */
  .modal-bg { display: none; position: fixed; inset: 0; background: rgba(6,26,32,.62); z-index: 200; padding: 20px; overflow-y: auto; }
  .modal-bg.on { display: flex; align-items: flex-start; justify-content: center; }
  .modal {
    background: #fff; color: var(--ink); border-radius: var(--r);
    box-shadow: 0 20px 60px rgba(0,0,0,.4); padding: 24px; width: 100%; max-width: 480px; margin-top: 7vh;
  }
  .modal h3 { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
  .modal .desc { font-size: 13.5px; color: var(--muted); margin: 0 0 18px; line-height: 1.85; }
  .modal .acts { display: flex; gap: 9px; flex-wrap: wrap; }

  /* ================= التذييل ================= */
  footer {
    border-top: 1px solid var(--line-d); padding: 18px 30px 24px;
    text-align: center; color: var(--on-shell-2); font-size: 13.5px;
  }
  footer .fb { color: var(--acc); font-weight: 600; transition: color .4s ease; }
  /* .4 كانت تهبط بالتباين إلى 2.19؛ .85 تبقي الفاصل خافتاً وتعبر AA (4.99) */
  footer .sep { opacity: .85; margin: 0 8px; }

  /* ================= التبديل ================= */
  #v-auth, #v-app, #v-blocked { display: none; }
  #v-auth.on, #v-app.on, #v-blocked.on { display: block; }
  .page { display: none; }
  .page.on { display: block; animation: rise .24s ease both; }

  /* ================= الجوال ================= */
  @media (max-width: 980px) {
    .app { flex-direction: column; }
    .side {
      width: 100%; height: auto; position: sticky; top: 0; z-index: 40;
      background: linear-gradient(100deg, var(--brand-1) 0%, var(--brand-2) 52%, var(--brand-3) 100%);
    }
    .side .brand { border-bottom: none; padding: 12px 16px; }
    .side nav { padding: 0 10px 10px; display: flex; gap: 6px; overflow-x: auto; }
    .side .nav-btn { width: auto; white-space: nowrap; margin-bottom: 0; padding: 8px 13px; }
    .side .nav-btn.on::before { display: none; }
    .badge { margin-right: 4px; }
    .side .foot { display: none; }
    .head, .wrap, footer { padding-left: 16px; padding-right: 16px; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .split { grid-template-columns: 1fr; }
    .g3, .g4 { grid-template-columns: repeat(2, 1fr); }
  }

  @media (max-width: 620px) {
    .g2, .g3, .g4 { grid-template-columns: 1fr; }
    .row { margin-left: 14px; margin-right: 14px; }
    th, td { padding-left: 14px; padding-right: 14px; }
  }

  @media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
