/* =====================================================================
   NOOL — نظام إدارة السجاد
   RTL أولًا، خطوط بيروتي وBricolage Grotesque، بدون إيموجي

   كل لون هنا اتقاس مش اتخمّن. القاعدة:
     • أي نص على خلفيته ≥ 4.5:1، والنص الأساسي ≥ 7:1
     • كل لون ليه نسختين: solid للتعبئة (شريط، نقطة، زرار)
       و ink أغمق للكتابة — عشان اللون يفضل مبهج من غير
       ما الكلام يبهت عليه
     • ألوان الرسوم البيانية متمايزة تحت عمى الألوان الثلاثة
   ===================================================================== */

:root {
  /* ─── ألوان الهوية ──────────────────────────────────────────────
     من دليل هوية NOOL. الأربعة الأساسيين:
       أزرق  #2B3BFF   سماوي #5CE1FF
       حبر   #0B1033   فاتح  #F2F3F7
     والتوزيع المعتمد: 55% أبيض · 25% أزرق · 12% حبر · 5% فاتح
     · 3% سماوي — السماوي للمسات بس.
     ──────────────────────────────────────────────────────────── */
  --nool-blue:   #2B3BFF;
  --nool-cyan:   #5CE1FF;
  --nool-ink:    #0B1033;
  --nool-light:  #F2F3F7;

  --bg:            #F2F3F7;
  --surface:       #FFFFFF;
  --surface-2:     #F8F9FD;
  --border:        #DCDFE8;
  --border-strong: #C2C7D6;

  --text:          #0B1033;
  --text-2:        #565B70;
  --text-3:        #9AA0B4;

  /* الأزرق هو لون الأفعال: الأزرار الأساسية والروابط والتركيز */
  --brand:         #2B3BFF;
  --brand-2:       #1C27B8;
  --brand-3:       #8C95FF;
  --brand-soft:    #EEF0FF;

  /* الحبر للأسطح الغامقة: الشريط الجانبي وشاشة الدخول */
  --ink:           #0B1033;
  --ink-2:         #161E54;
  --ink-3:         #05081C;
  --ink-fg:        #C8CDE6;

  /* السماوي لمسة: يتعبّى ومايتكتبش عليه.
     تباينه مع الأبيض 1.5:1، فالكتابة بتاخد نسخة الحبر #0E7FA0. */
  --accent:        #5CE1FF;
  --accent-ink:    #0E7FA0;
  --accent-soft:   #DDF8FF;

  /* ─── ألوان الحالات ─────────────────────────────────────────────
     دي ألوان الحالات من دليل الهوية بالظبط، ومربوطة بمعناها في
     السيستم: متاح = ok، محجوز = warn، مرتجع = danger، مباع = info.
     اللون الواحد مابيتكررش بمعنيين، فالمستخدم بيتعلّمه مرة.
     ──────────────────────────────────────────────────────────── */
  --ok:            #15803D;
  --ok-ink:        #126331;
  --ok-soft:       #DCFCE7;
  --warn:          #B45309;
  --warn-ink:      #8A3F07;
  --warn-soft:     #FEF3C7;
  --danger:        #B91C1C;
  --danger-ink:    #991616;
  --danger-soft:   #FEE2E2;
  --info:          #2B3BFF;
  --info-ink:      #1C27B8;
  --info-soft:     #E5E8FF;

  /* حالتين زيادة من الدليل ملهمش مقابل دلالي */
  --transit:       #6D28D9;
  --transit-ink:   #5B21B6;
  --transit-soft:  #EDE9FE;
  --remnant:       #475569;
  --remnant-ink:   #334155;
  --remnant-soft:  #E2E8F0;

  /* نصف القطر من توكنز الدليل: 8 / 12 / 18 */
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     18px;

  /* الظل بحبر NOOL مش رمادي — عشان يقعد في نفس العائلة اللونية */
  /* الدليل: الكروت حدود بس من غير ظل — الظل للحاجات اللي طايرة فوق
     الصفحة (النوافذ والقوايم والتنبيهات) */
  --shadow-sm:     none;
  --shadow:        0 4px 16px rgba(11,16,51,.08);
  --shadow-lg:     0 18px 50px rgba(11,16,51,.22);

  /* من صفحة «لوحة الويب» في الدليل: الشريط الجانبي حبر سادة، والبند
     المفتوح #1F2A6B بنص أبيض، والباقي #B9C2E6 */
  --side-active:   #1F2A6B;
  --side-fg:       #B9C2E6;
  --side-muted:    #7C86B6;
  /* أعمدة الرسم: الدليل بيلوّن العمود الأهم بالأزرق والباقي بالأزرق الفاتح */
  --bar-soft:      #C4CAFF;

  --sidebar-w:     248px;
  --header-h:      72px;

  /* أقل ارتفاع لأي عنصر تفاعلي — من الدليل، وبيخلي اللمس على
     الموبايل مايحتاجش تدقيق */
  --control-h:     44px;
}

* { box-sizing: border-box; }

/* خاصية hidden لازم تكسب أي display تاني.
   من غير السطر ده، أي عنصر عليه display:flex — زي .toolbar و .pager —
   يفضل ظاهر رغم إن الكود مخفيه، وده بيسيب فلاتر وأشرطة على الشاشة
   في غير وقتها. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Beiruti', 'Bricolage Grotesque', -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--accent-ink); }

/* ---------------- تسجيل الدخول ---------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-shell {
  width: 100%;
  max-width: 880px;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 34px rgba(11,16,51,.14);
  overflow: hidden;
}

@media (min-width: 840px) {
  .login-shell { grid-template-columns: 1fr 1fr; }
}

/* ---- لوحة الهوية ----
   زي «شاشة الفتح» في صفحة تطبيق الموبايل في الدليل: أزرق NOOL سادة،
   وشكل الحلقتين مكبّر ومقصوص في الركن («Big crop» من صفحة شكل
   البراند). الأزرق هنا سطح كبير — ده دوره في توزيع الألوان. */

.login-aside {
  display: none;
  position: relative;
  padding: 40px 36px;
  background: var(--brand);
  color: #fff;
  flex-direction: column;
  justify-content: space-between;
  min-height: 460px;
  overflow: hidden;
}

@media (min-width: 840px) { .login-aside { display: flex; } }

.login-aside::after {
  content: '';
  position: absolute;
  inset-inline-start: -90px;
  inset-block-end: -150px;
  width: 440px; height: 440px;
  background: rgba(255,255,255,.12);
  -webkit-mask: url('../brand/nool-shape-rings-mono-blue.svg') center / contain no-repeat;
          mask: url('../brand/nool-shape-rings-mono-blue.svg') center / contain no-repeat;
  pointer-events: none;
}

.login-aside > * { position: relative; z-index: 1; }

.login-aside-top { display: flex; align-items: center; gap: 12px; }

.login-aside .mark {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: rgba(255,255,255,.14);
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
}

.login-aside .nm { font-size: 16px; font-weight: 700; }
.login-aside .sb { font-size: 12px; color: #DDE1FF; }

.login-aside-body h2 {
  font-size: 34px;
  font-weight: 900;
  margin: 0 0 12px;
  line-height: 1.2;
}

.login-aside-body p {
  margin: 0;
  font-size: 15px;
  line-height: 1.8;
  color: #DDE1FF;
  max-width: 30ch;
}

.login-aside-foot {
  font-size: 12px;
  color: #DDE1FF;
}

/* ---- بطاقة النموذج ---- */

.login-card {
  padding: 40px 34px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-head { margin-bottom: 26px; }
.login-head h1 { font-size: 28px; margin: 0 0 6px; font-weight: 800; }
.login-head p  { margin: 0; color: var(--text-2); font-size: 14px; }
.login-head p b { color: var(--ink); }
/* «نسيت كلمة المرور» */
.login-forgot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.login-forgot a { font-size: 13px; font-weight: 600; color: var(--brand); text-decoration: none; }
.login-forgot a:hover { text-decoration: underline; }
.login-note { padding: 14px 16px; border-radius: var(--radius); background: var(--nool-light); font-size: 14px; line-height: 1.8; color: var(--text-2); }
.login-note b { color: var(--ink); }
.login-note a { color: var(--brand); font-weight: 600; }

/* على الموبايل اللوحة الزرقا مستخبية، فاللوجو بيظهر فوق النموذج */
.login-mobile-logo { display: none; width: 104px; height: auto; margin-bottom: 22px; }

/* الهوية بتظهر فوق النموذج على الموبايل — اللوحة الجانبية مخفية */
@media (max-width: 839px) {
  .login-mobile-logo { display: block; }
  .login-card { padding: 32px 24px 26px; }
}

/* توافق مع أي استخدام قديم للفئة */
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .mark {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 12px;
  background: var(--brand); display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 19px; letter-spacing: .5px;
}
.login-brand h1 { font-size: 19px; margin: 0 0 4px; font-weight: 700; }
.login-brand p  { margin: 0; color: var(--text-3); font-size: 12.5px; }

/* ---------------- الهيكل ---------------- */

.shell { display: flex; min-height: 100vh; }

/* الرأس ثابت والقائمة هي اللي بتتمرّر — عشان اللوجو واسم النظام
   يفضلوا ظاهرين مهما نزلت، والتمرير يرجع مكانه بعد فتح أي صفحة
   (الحفظ في ui.js). */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink);
  color: var(--side-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 7px; }
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.2); border-radius: 4px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.34); }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }

.sidebar-head {
  padding: 22px 22px 18px;
  display: flex; align-items: center; gap: 11px;
}

.sidebar-head .mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff;
}

.sidebar-head .name { font-size: 14.5px; font-weight: 700; color: #fff; }
.sidebar-head .sub  { font-size: 11px; color: rgba(200,205,230,.62); }

/* لوجو NOOL في رأس الشريط.
   المسافة الفاضية حوالين اللوجو شرط في دليل الهوية (٣ أضعاف مقاس
   المربع اللي في حرف n)، والـpadding هنا بيضمنها — من غيرها اللوجو
   بيلزق في حدود الشريط وبيبقى مخنوق. */
.sidebar-logo {
  display: block;
  padding: 4px 2px;
  line-height: 0;
  text-decoration: none;
}
.sidebar-logo img {
  display: block;
  width: 104px; height: auto;
  /* أقل عرض للكلمة ٩٦ بكسل حسب الدليل — ١٠٤ فوقه بهامش */
}
.sidebar-logo:focus-visible {
  outline: 2px solid var(--nool-cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

.nav { padding: 6px 12px 24px; }
.nav-group { margin-bottom: 6px; }

/* اسم المجموعة: هادي، بيرتّب القايمة الطويلة من غير ما يشد العين.
   الدليل مافيهوش نقط ملونة للأقسام، فاتشالت. */
.nav-label {
  padding: 14px 12px 6px;
  font-size: 12px;
  color: var(--side-muted);
  font-weight: 700;
}

.nav a {
  display: flex; align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--side-fg);
  font-size: 14.5px;
  margin-bottom: 2px;
  transition: background .13s ease, color .13s ease;
}

.nav a > span { flex: 1; min-width: 0; }

/* أيقونات خطية بسُمك 2 وزوايا دايرية — زي حروف اللوجو (الدليل) */
.nav a .ic {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .85;
  transition: opacity .13s ease;
}

.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a:hover .ic { opacity: 1; }

/* البند المفتوح: سطح #1F2A6B ونص أبيض — من لوحة الويب في الدليل */
.nav a.active {
  background: var(--side-active);
  color: #fff;
  font-weight: 700;
}
.nav a.active .ic { opacity: 1; }

.nav a .count {
  font-size: 11.5px;
  font-family: 'Bricolage Grotesque', sans-serif;
  background: rgba(255,255,255,.12);
  color: #fff;
  padding: 1px 8px;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
}
.nav a.active .count { background: var(--accent); color: var(--ink); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  /* الدليل: عنوان الشاشة على الخلفية الفاتحة نفسها، مش في شريط أبيض.
     شفافية خفيفة عشان المحتوى اللي بيعدي تحته وانت نازل مايتقصش فجأة */
  background: rgba(242,243,247,.9);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
          backdrop-filter: saturate(1.4) blur(10px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}

.topbar h2 { font-size: 22px; margin: 0; font-weight: 800; line-height: 1.2; }
.topbar .crumb { font-size: 12.5px; color: var(--text-2); }

.userbox { display: flex; align-items: center; gap: 12px; }
.userbox .who { text-align: left; line-height: 1.35; }
.userbox .who .n { font-size: 13.5px; font-weight: 700; }
.userbox .who .r { font-size: 12px; color: var(--text-2); }
.userbox .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}

.content { padding: 6px 28px 28px; flex: 1; }

/* ---------------- البطاقات ---------------- */

/* auto-fill مش auto-fit: البطاقة اليتيمة في آخر صف بتفضل بحجمها
   الطبيعي بدل ما تتمطط على عرض الشاشة كلها وتبقى وحشة. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 12px; margin-bottom: 20px; }
.cards-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* تركيب مقصود بدل ما نسيب الشبكة تتصرف لوحدها وتسيب بطاقة يتيمة:
   الرقم البطل واخد عمود كامل على ارتفاع صفين، وجنبه أربع بطاقات
   في مربع ٢×٢. العدد مظبوط، ومفيش خانة فاضية. */
@media (min-width: 900px) {
  .cards.has-hero {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
  }
  .cards.has-hero .card.is-hero {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .cards.has-hero .card.is-hero .v { font-size: 34px; }
}
.cards-tight { gap: 10px; }

/* شريط ملخّص أعلى الشاشة: البطاقات بتاخد عرض محتواها وبس.
   الشبكة كانت بتحجز عرض الصف كله وتسيب فراغ جنب بطاقتين. */
.cards-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cards-inline .card { flex: 0 1 auto; min-width: 150px; }

/* النص العربي تحت خلية الكود ما ياخدش خط الأكواد —
   Bricolage Grotesque للأرقام والأكواد، وبيروتي للكلام. */
table.data td.mono .cell-sub,
table.data td.mono .cell-main:not(.mono) {
  font-family: 'Beiruti', 'Bricolage Grotesque', -apple-system, 'Segoe UI', Tahoma, sans-serif;
  letter-spacing: 0;
}
table.data td.mono .cell-main { font-family: 'Bricolage Grotesque', ui-monospace, Menlo, monospace; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

/* بطاقة الرقم زي الدليل: اسم صغير باهت، رقم تقيل بالحبر، وسطر تفاصيل */
.card .k { font-size: 13px; color: var(--text-2); font-weight: 500; }
/* الرقم بيتكتب LTR عشان 43,634.62 تتقرا صح في صفحة RTL.
   بس لو القيمة فيها كلام عربي، الـ LTR بيقلب الترتيب و"14 يوم"
   بتطلع "يوم 14". الحل: الاتجاه بيتحدد من المحتوى نفسه —
   القيم اللي فيها حروف بتاخد .v-text وبترجع لاتجاه الصفحة. */
.card .v {
  font-size: 28px; font-weight: 700; margin-top: 6px;
  letter-spacing: -.01em; line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  direction: ltr; text-align: right;
  unicode-bidi: plaintext;
}
[dir="rtl"] .card .v { text-align: right; }
.card .m { font-size: 12.5px; color: var(--text-2); margin-top: 5px; line-height: 1.45; }

/* الرقم البطل — واحد بس في الشاشة، وإلا مفيش بطل.
   أزرق NOOL سادة، وعليه الحلقتين مكبّرين ومقصوصين في الركن —
   «Big crop» من صفحة شكل البراند، بدل النقشة العامة اللي كانت هنا. */
.card.is-hero {
  background: var(--brand);
  border-color: var(--brand);
  position: relative; overflow: hidden;
}
.card.is-hero::after {
  content: ''; position: absolute; pointer-events: none;
  inset-inline-start: -60px; inset-block-end: -90px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,.12);
  -webkit-mask: url('../brand/nool-shape-rings-mono-blue.svg') center / contain no-repeat;
          mask: url('../brand/nool-shape-rings-mono-blue.svg') center / contain no-repeat;
}
.card.is-hero > * { position: relative; z-index: 1; }
.card.is-hero .k { color: #DDE1FF; }
.card.is-hero .v { color: #fff; font-size: 34px; }
.card.is-hero .m { color: #DDE1FF; }

/* بطاقات الحالة: بيضا زي باقي البطاقات، والرقم بس هو اللي بياخد لون
   معناه — زي «ديون التجار» بالأحمر في لوحة الويب في الدليل. ونقطة
   صغيرة جنب الاسم بنفس لون الحالة. الخلفيات الملونة اتشالت: كانت
   بتقسم الشاشة لبقع ألوان وبتسرق الانتباه من الأرقام نفسها. */
.card.tone-ok     .v { color: var(--ok); }
.card.tone-warn   .v { color: var(--warn); }
.card.tone-danger .v { color: var(--danger); }
.card.tone-accent .v { color: var(--accent-ink); }
.card.tone-info   .v { color: var(--info); }
.card.tone-brand  .v { color: var(--brand); }
.card[class*="tone-"] .k { display: flex; align-items: center; gap: 7px; }
.card[class*="tone-"] .k::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--tone, var(--text-3));
}
.card.tone-ok     { --tone: var(--ok); }
.card.tone-warn   { --tone: var(--warn); }
.card.tone-danger { --tone: var(--danger); }
.card.tone-accent { --tone: var(--accent); }
.card.tone-info   { --tone: var(--info); }
.card.tone-brand  { --tone: var(--brand); }

/* البطاقة القابلة للنقر تبان كده */
a.card { text-decoration: none; color: inherit; display: block; transition: border-color .13s ease, box-shadow .13s ease, transform .13s ease; }
a.card:hover { border-color: var(--brand-3); color: inherit; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

/* رأس اللوحة أبيض زي جسمها، والعنوان هو اللي بيفصل — زي كروت
   «المخزون الراكد» و«مبيعات آخر 7 أيام» في الدليل */
.panel-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
}

.panel-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.panel-head .sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.panel-body { padding: 20px; }

/* ---------------- أدوات التصفية ---------------- */

.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--ink); font-weight: 600; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=email], select, textarea {
  font-family: inherit;
  font-size: 14.5px;
  min-height: var(--control-h);
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  min-width: 0;
  width: 100%;
  transition: border-color .13s ease, box-shadow .13s ease;
}
/* الأرقام والأكواد اللي بتتكتب في الخانات بتاخد Bricolage لوحدها
   (unicode-range)، وده كفاية — مفيش كلاس محتاج */
input::placeholder, textarea::placeholder { color: var(--text-3); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(43,59,255,.12);
}

input:disabled, select:disabled { background: var(--nool-light); color: var(--text-3); }
textarea { min-height: 88px; padding-top: 11px; resize: vertical; }

.search-input { min-width: 240px; }

input[type=date] { min-width: 155px; }
.date-hint { font-size: 11.5px; color: var(--text-3); margin-top: -1px; }

/* ---------------- الأزرار ----------------

   أربع أنواع من صفحة «عناصر الواجهة» في الدليل:
     أزرق سادة     الفعل الأساسي في الشاشة («امسح السجادة»)
     إطار أزرق     فعل تاني مهم («إضافة للفاتورة»)
     حبر           فعل نهائي بيقفل حاجة («قفل الفاتورة»)
     فاتح          فعل جانبي جوّه كارت («حجز»)
   كلهم ارتفاع 44 وزوايا 12. والزرار العادي من غير نوع أبيض بإطار
   رمادي — بيبان على الخلفية الفاتحة وعلى الكروت البيضا الاتنين. */

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: var(--control-h);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background .13s ease, border-color .13s ease, color .13s ease, transform .06s ease;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid rgba(43,59,255,.35); outline-offset: 2px; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

.btn-secondary, .btn-line { background: var(--surface); border-color: var(--brand); color: var(--brand); }
.btn-secondary:hover, .btn-line:hover { background: var(--brand-soft); }

.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }

.btn-light { background: var(--nool-light); border-color: var(--nool-light); color: var(--ink); }
.btn-light:hover { background: #E6E8F0; border-color: #E6E8F0; color: var(--ink); }

/* السماوي لمسة بس وعمره ما يبقى خلفية لنص (الدليل) — فالزرار ده
   بقى حبر عليه خط سماوي بدل ما يبقى سماوي عليه كلام أبيض */
.btn-accent { background: var(--ink); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--ink-2); color: #fff; }

.btn-danger { background: var(--surface); border-color: #F0B9B9; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-ink); }

.btn-sm { min-height: 36px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------------- الجداول ---------------- */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }

/* زي جدول «المخزون الراكد» في الدليل: رأس أبيض بخط باهت، وسطور
   مفصولة بخط رفيع، والكود تقيل بخط Bricolage */
table.data th {
  text-align: right;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  position: sticky; top: 0;
}

table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid #ECEEF4;
  vertical-align: middle;
}

table.data tbody tr:hover { background: #F7F8FC; }
table.data tbody tr:last-child td { border-bottom: none; }

/* صف الإجمالي — الجدول المالي من غير إجمالي ناقص */
table.data tfoot td {
  padding: 13px 16px;
  background: var(--nool-light);
  border-top: 2px solid var(--border-strong);
  font-weight: 800;
  font-size: 13px;
}
table.data tfoot td.num { font-variant-numeric: tabular-nums; text-align: left; direction: ltr; }

table.data td.num.pos { color: var(--ok-ink); }
table.data td.num.neg { color: var(--danger-ink); }
table.data td .sub-cell { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* الأكواد والأرقام والتواريخ ما تتقسمش على سطرين.
   الالتفاف بيخلي صف الجدول ضعف ارتفاعه، والشاشة تعرض نص عدد
   الصفوف، والعين تتوه وهي بتقرا كود مقسوم. */
table.data td.num {
  font-variant-numeric: tabular-nums;
  text-align: left; direction: ltr;
  white-space: nowrap;
}

table.data td.mono {
  font-family: 'Bricolage Grotesque', ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  direction: ltr; text-align: left;
  white-space: nowrap;
}

table.data td.actions { white-space: nowrap; text-align: left; }
table.data td.nowrap  { white-space: nowrap; }

/* خلية بسطرين: الأساسي فوق والتفاصيل تحته باهتة.
   بتجمع أربع أعمدة مكررة في عمود واحد يتقرا أسرع. */
.cell-main { font-weight: 600; white-space: nowrap; }
.cell-sub {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 1px;
  white-space: nowrap;
}

table.data td { white-space: normal; }
table.data th { white-space: nowrap; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty .t { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.empty .d { font-size: 13.5px; color: var(--text-2); }

/* ---------------- الوسوم ----------------
   شكل حالة السجادة من الدليل: كبسولة بنقطة بلون الحالة قبل الكلمة.
   النقطة مش زينة — هي اللي بتخلّي الحالة تتقري بنظرة في جدول طويل. */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--nool-light);
  color: var(--text-2);
  white-space: nowrap;
}

.tag-ok, .tag-warn, .tag-danger, .tag-brand, .tag-info, .tag-accent, .tag-transit, .tag-remnant {
  --dot: currentColor;
}
.tag-ok::before, .tag-warn::before, .tag-danger::before, .tag-brand::before,
.tag-info::before, .tag-accent::before, .tag-transit::before, .tag-remnant::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot); flex-shrink: 0;
}

.tag-ok      { background: var(--ok-soft);      color: var(--ok); }
.tag-warn    { background: var(--warn-soft);    color: var(--warn); }
.tag-danger  { background: var(--danger-soft);  color: var(--danger); }
.tag-brand   { background: var(--info-soft);    color: var(--brand); }
.tag-info    { background: var(--info-soft);    color: var(--info); }
.tag-accent  { background: var(--accent-soft);  color: var(--accent-ink); --dot: var(--accent); }
.tag-transit { background: var(--transit-soft); color: var(--transit); }
.tag-remnant { background: var(--remnant-soft); color: var(--remnant); }

.swatch {
  display: inline-block; width: 13px; height: 13px;
  border-radius: 3px; border: 1px solid var(--border-strong);
  vertical-align: -2px; margin-inline-end: 6px;
}

/* ---------------- الترقيم ---------------- */

.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--text-2);
}
.pager .controls { display: flex; gap: 6px; align-items: center; }

/* ---------------- النوافذ ---------------- */

.modal-back {
  position: fixed; inset: 0;
  background: rgba(11,16,51,.5);
  backdrop-filter: blur(3px);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 24px;
}
.modal-back.open { display: grid; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 34px rgba(11,16,51,.20);
  width: 100%;
  max-width: 620px;
  /* dvh مش vh: على الموبايل شريط المتصفح بيظهر ويختفي، و100vh
     بتفضل محسوبة على الشاشة كاملة — يعني النافذة بتطلع أطول من
     المساحة الظاهرة وآخرها بيتقص. dvh بتتابع المساحة الحقيقية. */
  max-height: 88vh;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal.wide { max-width: 880px; }

/* الفورم بيقع بين النافذة وجسمها.
   من غير القواعد دي هو عنصر flex عادي بـ min-height تلقائي، يعني
   مابيصغّرش نفسه تحت حجم محتواه — فبيمتد على طوله، والتذييل اللي
   فيه زرار الحفظ بينزل تحت حدود النافذة ويتقص. النتيجة: فورم
   طويل على الموبايل بيبقى **مفيهوش زرار حفظ توصله**.
   min-height:0 هي الحتة اللي بتسمح للـ flex يصغّر أصلًا. */
.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; min-width: 0; }

/* الجسم هو الجزء الوحيد اللي بيتمرّر — والرأس والتذييل ثابتين */
.modal-body {
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-start; gap: 9px;
  background: var(--surface);
  flex-shrink: 0;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section {
  grid-column: 1 / -1;
  font-size: 13px; font-weight: 700; color: var(--brand);
  padding-top: 8px; border-top: 1px solid var(--border);
  margin-top: 4px;
}
.form-grid .form-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: auto; }

.hint { font-size: 12.5px; color: var(--text-2); }

/* ---------------- التنبيهات ---------------- */

.toasts {
  position: fixed; bottom: 22px; left: 22px;
  display: flex; flex-direction: column; gap: 9px;
  z-index: 200;
  max-width: 400px;
}

/* التنبيه حبر دايمًا، ولون الحالة شريط على جنبه — كده كل التنبيهات
   من نفس العيلة، والمعنى واضح من اللون من غير ما الكارت كله يتلوّن */
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  border-inline-start: 4px solid var(--accent);
  font-size: 14px;
  box-shadow: 0 14px 34px rgba(11,16,51,.28);
  animation: rise .2s ease;
}
.toast.ok     { border-inline-start-color: #4ADE80; }
.toast.err    { border-inline-start-color: #F87171; }
.toast.warn   { border-inline-start-color: #FBBF24; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.alert {
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid;
  margin-bottom: 16px;
}
.alert-warn   { background: var(--warn-soft);   border-color: #F8E29A; color: var(--warn-ink); }
.alert-danger { background: var(--danger-soft); border-color: #F8C4C4; color: var(--danger-ink); }
.alert-info   { background: var(--info-soft);   border-color: #C8CFFF; color: var(--info-ink); }
.alert-ok     { background: var(--ok-soft);     border-color: #B4EFC8; color: var(--ok-ink); }
.alert b { font-weight: 700; }

/* ---------------- شجرة الحسابات ---------------- */

.tree { font-size: 13.5px; }
.tree-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #EDEFF5;
}
.tree-row:hover { background: var(--surface-2); }
.tree-row .code {
  font-family: 'Bricolage Grotesque', ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px; color: var(--text-2);
  min-width: 56px; direction: ltr;
}
.tree-row .nm { flex: 1; }
.tree-row.parent { font-weight: 700; background: var(--nool-light); }
.tree-row .bal { font-variant-numeric: tabular-nums; direction: ltr; color: var(--text-2); font-size: 12.5px; }

/* ---------------- مفتاح الصلاحيات ---------------- */

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.perm-module { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.perm-module h4 {
  margin: 0; padding: 10px 14px;
  background: var(--nool-light);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--text-2);
}
.perm-module .items { padding: 9px 13px; display: flex; flex-direction: column; gap: 7px; }

/* ---------------- الحالة والتحميل ---------------- */

.loading { padding: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

.spinner {
  width: 17px; height: 17px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
  margin-inline-end: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   الاستجابة

   أربع مراحل مقصودة، مش تصغير تدريجي:
     ≥1500  شاشة واسعة — الشريط أعرض والمحتوى بياخد راحته
     ≥1000  ديسكتوب عادي — الشكل الأساسي
     <1000  تابلت/موبايل — الشريط بيتحوّل لدرج بينفتح من الجنب
      <560  موبايل صغير — عمود واحد، ولمس كبير
   ===================================================================== */

/* ---- الدرج الجانبي ---- */

.scrim {
  position: fixed; inset: 0;
  background: rgba(11,16,51,.5);
  backdrop-filter: blur(2px);
  z-index: 55;
  opacity: 0;
  transition: opacity .2s ease;
}
.scrim.show { opacity: 1; }

.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.menu-toggle:hover { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-3); }
.menu-toggle svg { width: 19px; height: 19px; }

.drawer-close {
  display: none;
  margin-inline-start: auto;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  color: #fff; cursor: pointer; padding: 0;
  flex-shrink: 0;
}
.drawer-close:hover { background: rgba(255,255,255,.2); }
.drawer-close svg { width: 16px; height: 16px; }

.topbar-start { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-start h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-id { min-width: 0; }
.sidebar-id .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* اللوجو المرفوع بيتحط جوّه نفس المربع بتاع الحروف — أي مقاس
   بيترفع بيتحط جوّه من غير ما يكسر الصف. */
.sidebar-head .mark.has-logo,
.login-aside .mark.has-logo,
.login-brand .mark.has-logo {
  background: #fff; border-color: #fff; padding: 4px; overflow: hidden;
}
.mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ---- شاشة واسعة ---- */

@media (min-width: 1500px) {
  :root { --sidebar-w: 268px; }
  .content { padding: 6px 32px 32px; }
  .topbar { padding: 0 32px; }
}

/* ---- تابلت وموبايل: الشريط يبقى درج ---- */

@media (max-width: 999px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 60;
    transform: translateX(var(--drawer-out, 105%));
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: 8px 0 40px rgba(11,16,51,.3);
  }
  /* RTL بيطلّع الدرج من اليمين، وLTR من الشمال —
     نفس الكلاس، والاتجاه هو اللي بيحدد. */
  [dir="rtl"] .sidebar { --drawer-out: 105%; }
  [dir="ltr"] .sidebar { --drawer-out: -105%; }
  .sidebar.open { transform: translateX(0); }

  .menu-toggle, .drawer-close { display: inline-flex; }

  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }

  .userbox .who { display: none; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .field { width: 100%; }
  .search-input { min-width: 0; }

  .panel-head { padding: 13px 14px; flex-wrap: wrap; gap: 10px; }
  .panel-body { padding: 14px; }

  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card .v { font-size: 21px; }
  .cards.has-hero { grid-template-columns: 1fr 1fr; }
  .cards.has-hero .card.is-hero { grid-column: 1 / -1; }
  .cards.has-hero .card.is-hero .v { font-size: 27px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data { font-size: 12.5px; }
  table.data th, table.data td { padding: 9px 11px; }

  .att-grid { grid-template-columns: 1fr; }
  .dash-charts { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: minmax(78px, 110px) 1fr auto; gap: 9px; }

  .modal { width: 100%; max-width: 100%; }
}

/* ---- موبايل صغير ---- */

@media (max-width: 559px) {
  :root { --header-h: 56px; }
  .content { padding: 11px; }
  .topbar { padding: 0 11px; }
  .topbar h2 { font-size: 18px; }

  .cards { grid-template-columns: 1fr 1fr; }
  .cards-3 { grid-template-columns: 1fr; }

  /* الأزرار بتبقى لمس: 40 بكسل ارتفاع على الأقل */
  .btn { padding: 10px 14px; min-height: 40px; }
  .btn-sm { padding: 7px 11px; min-height: 34px; }

  /* أزرار الصف في الجدول بتنزل تحت بعض بدل ما تتكتّم */
  .actions { flex-wrap: wrap; gap: 5px; }

  .pager { flex-direction: column; gap: 9px; align-items: stretch; }
  .pager .btn { width: 100%; justify-content: center; }

  /* النافذة بتبقى ورقة بتطلع من تحت — أسهل في الوصول بإيد واحدة.
     الكلاس هنا .modal-back مش .modal-wrap: ده اللي الكود بيحطه
     فعلًا، والقواعد دي كانت مكتوبة على اسم مش موجود فماكانتش
     بتتطبّق خالص. */
  .modal-back {
    place-items: end stretch;
    padding: 0;
  }
  .modal {
    border-radius: 16px 16px 0 0;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    animation: sheet-up .22s cubic-bezier(.4,0,.2,1);
  }
  .modal-head { padding: 14px 15px; }
  .modal-body { padding: 15px; }

  /* التذييل ملزّق تحت وفيه مساحة أمان لشريط الإيماءات في الآيفون */
  .modal-foot {
    padding: 12px 15px calc(12px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
  }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; min-width: 110px; }

  /* زرار «إغلاق» اللي في الرأس بيبقى كفاية — التاني في التذييل
     بياخد مكان زرار الحفظ على شاشة ضيقة */
  .modal-foot .btn[data-close] { flex: 0 1 auto; min-width: 88px; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* الأجهزة اللي بتفضّل حركة أقل — بنحترم الإعداد */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* =====================================================================
   شاشة المسح على الموبايل
   دي الشاشة اللي عامل المخزن قاعد عليها طول اليوم، وبإيد واحدة —
   التانية ماسكة السجادة. فالخانة والزراير لازم يكونوا كبار.
   ===================================================================== */

@media (max-width: 720px) {
  .scan-form { flex-direction: column; align-items: stretch; gap: 10px; }
  .scan-form .field { width: 100%; }

  .scan-form input[type=text] {
    font-size: 17px;          /* أقل من 16 بيخلي iOS يزوّم لوحده */
    padding: 15px 14px;
    text-align: center;
    letter-spacing: .5px;
  }

  .scan-form .btn,
  #camBtn {
    width: 100%;
    padding: 15px 18px;
    font-size: 15px;
    justify-content: center;
  }

  /* الزرار المخفي بسبب عدم دعم الكاميرا يفضل مخفي */
  #camBtn[hidden] { display: none !important; }

  .scan-form label { font-size: 12.5px; }

  /* نتيجة المسح: الأرقام أكبر والأزرار أعرض */
  #scanResult .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  #scanResult .btn { padding: 11px 16px; }
  #scanResult .panel-head { flex-direction: column; align-items: stretch; gap: 10px; }
  #scanResult .panel-head .btn { width: 100%; justify-content: center; }

  /* زرار "دي القطعة" في قايمة اختيار الباركود */
  #scanResult td.actions .btn { width: 100%; padding: 10px 12px; }
}

/* ملحوظة: كان في هنا سطر .menu-toggle { display: none } من النسخة
   القديمة. لأنه بعد الـ media query اللي بيظهّر الزرار على الموبايل،
   كان بيكسبه ويخلّي زرار القائمة مختفي على الموبايل خالص — يعني
   مفيش طريقة تفتح بيها القايمة أصلًا. التعريف الأساسي دلوقتي فوق
   مع باقي قواعد الدرج، والـ media query بعده. */

@media print {
  .sidebar, .topbar, .toolbar, .pager, .actions { display: none !important; }
  .content { padding: 0; }
  .panel { border: none; box-shadow: none; }
}

/* =====================================================================
   الرسوم البيانية
   ===================================================================== */

.chart-bars { display: flex; flex-direction: column; gap: 9px; }

.chart-row {
  display: grid;
  grid-template-columns: minmax(96px, 148px) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 2px 0;
  cursor: default;
}

.chart-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* المسار خفيف عن قصد — العمود هو اللي يبان مش الخلفية */
.chart-track {
  position: relative;
  height: 12px;
  background: var(--nool-light);
  border-radius: 5px;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  border-radius: 6px;
  min-width: 3px;
  transition: filter .13s ease;
}

.chart-row:hover .chart-bar { filter: brightness(.93); }

.chart-value {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  white-space: nowrap;
  color: var(--text);
  min-width: 62px;
  text-align: left;
}

.chart-value .u { font-weight: 600; color: var(--text-3); font-size: 11px; }

.chart-empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
}

/* ---------------- شريط التركيب ---------------- */

.comp-bar {
  display: flex;
  height: 13px;
  border-radius: 7px;
  overflow: hidden;
  /* فاصل بين القطع عشان اللونين المتجاورين ما يدوبوش في بعض */
  gap: 2px;
  background: var(--surface);
  margin-bottom: 14px;
}

.comp-seg { transition: filter .13s ease; cursor: default; }
.comp-seg:first-child { border-radius: 7px 0 0 7px; }
.comp-seg:last-child  { border-radius: 0 7px 7px 0; }
.comp-seg:hover { filter: brightness(.92); }

.comp-legend { display: flex; flex-direction: column; gap: 7px; }

.comp-item {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}

.comp-item .dot { width: 10px; height: 10px; border-radius: 3px; }
.comp-item .nm { color: var(--text-2); font-weight: 600; }
.comp-item .vl { font-variant-numeric: tabular-nums; direction: ltr; font-weight: 700; }
.comp-item .pc { font-variant-numeric: tabular-nums; color: var(--text-3); min-width: 42px; text-align: left; font-size: 11.5px; }

/* ---------------- خط الاتجاه ---------------- */

.trend { width: 100%; height: 34px; display: block; margin-top: 8px; }

/* ---------------- التلميح ---------------- */

.chart-tip {
  position: fixed;
  top: 0; left: 0;
  z-index: 90;
  pointer-events: none;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(11,16,51,.22);
  opacity: 0;
  transition: opacity .1s ease;
  max-width: 260px;
}

.chart-tip.on { opacity: 1; }
.chart-tip .t { font-weight: 700; margin-bottom: 3px; }
.chart-tip .v { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; text-align: right; }
.chart-tip .x { display: flex; justify-content: space-between; gap: 14px; color: rgba(255,255,255,.72); margin-top: 3px; }
.chart-tip .x b { color: #fff; font-variant-numeric: tabular-nums; }

/* ---------------- صف الرسم + الجدول ---------------- */

/* التباين المنخفض لبعض ألوان الرسم مع الأبيض معناه إن التسمية
   المباشرة والجدول مش رفاهية — دول البديل المطلوب. */
.chart-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 1100px) {
  .chart-split.with-table { grid-template-columns: minmax(300px, 420px) 1fr; }
}

.chart-box { padding: 16px 18px; }
.chart-box + .chart-box { border-top: 1px solid var(--border); }

.chart-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.chart-title .note { font-size: 11px; font-weight: 600; color: var(--text-3); }

/* =====================================================================
   لوحة التحكم
   ===================================================================== */

/* الرسوم في شبكة تملأ نفسها — من غير خانة فاضية جنب آخر رسم */
.dash-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 0 18px;
  align-items: start;
}

/* ---------------- محتاج انتباه ---------------- */

.att-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.att-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  transition: border-color .13s ease, background .13s ease;
}

.att-item:hover { background: var(--surface); border-color: var(--border-strong); color: inherit; }

.att-item .n {
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
  line-height: 1;
}

.att-item .b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.att-item .t { font-size: 12.5px; font-weight: 700; }
.att-item .h { font-size: 11px; color: var(--text-3); line-height: 1.4; }

.att-item.tone-warn   .n { color: var(--warn-ink); }
.att-item.tone-danger .n { color: var(--danger-ink); }
.att-item.tone-info   .n { color: var(--info-ink); }
.att-item.tone-ok     .n { color: var(--ok-ink); }

/* ---------------- خطوات الإعداد ---------------- */

.setup-panel { border-color: var(--brand-3); }
/* السماوي لمسة بس، عمره ما يبقى خلفية لكلام (الدليل)، فالتمييز هنا
   بإطار أزرق فاتح وشريط أزرق NOOL على جنب العنوان */
.setup-panel .panel-head { background: var(--brand-soft); border-bottom-color: #DDE1FF; }
.setup-panel .panel-head h3 { color: var(--brand-2); }

.setup-step {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid #EDEFF5;
  font-size: 13px;
}

.setup-step:last-child { border-bottom: none; }

.setup-step .mark {
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  color: transparent;
  flex-shrink: 0;
}

.setup-step.is-done .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-step.is-done .tx { color: var(--text-3); }
.setup-step .tx { flex: 1; font-weight: 600; }

@media (max-width: 720px) {
  /* التنبيه كان بيقع فوق آخر سطر في النتيجة ويغطيه */
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .toast { width: 100%; }
}

/* ---------------- لوجو الشركة ---------------- */

.logo-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }

/* المربع شفاف بمربعات رمادية خفيفة — عشان تشوف لو اللوجو خلفيته
   بيضا ولا شفافة فعلًا قبل ما تطبعه على ملصق. */
.logo-preview {
  width: 128px; height: 128px; flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid; place-items: center;
  overflow: hidden;
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, #EDEFF6 25%, transparent 25%, transparent 75%, #EDEFF6 75%),
    linear-gradient(45deg, #EDEFF6 25%, transparent 25%, transparent 75%, #EDEFF6 75%);
  background-size: 14px 14px;
  background-position: 0 0, 7px 7px;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo-preview .ph { font-size: 11.5px; color: var(--text-3); }
.logo-actions { flex: 1; min-width: 210px; }

@media (max-width: 559px) {
  .logo-row { gap: 14px; }
  .logo-preview { width: 96px; height: 96px; }
}

/* ---------------- شرح طرق التوصيل ---------------- */

.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.how {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 15px;
  background: var(--surface-2);
}
.how-t { font-weight: 700; font-size: 13.5px; margin-bottom: 7px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.how p { margin: 0 0 7px; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.how p:last-child { margin-bottom: 0; }
/* السطر ده هو اللي بيمنع الاختيار الغلط — لازم يبان مش يتلمّ مع الباقي */
.how p.neg { color: var(--text-3); padding-inline-start: 10px; border-inline-start: 2px solid var(--border-strong); }

/* ---------------- خطوات مرقّمة ---------------- */

.steps-ol { margin: 0; padding-inline-start: 20px; font-size: 13px; color: var(--text-2); line-height: 1.85; }
.steps-ol li { margin-bottom: 9px; }
.steps-ol li::marker { color: var(--brand-2); font-weight: 700; }
.code-line {
  display: block;
  margin-top: 6px;
  background: var(--brand-soft);
  border: 1px solid #C8CFFF;
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--brand);
  direction: ltr; text-align: left;
  overflow-x: auto; white-space: pre;
}

/* =====================================================================
   نقطة البيع

   الشاشة دي بتتفتح طول اليوم على شاشة واحدة، والكاشير بيشتغل عليها
   بالكيبورد. فالمساحة كلها مقسومة على حتتين واضحتين: الشمال للمسح
   والسطور، واليمين للحساب والدفع — والاتنين ظاهرين مع بعض من غير
   تمرير، عشان مايحصلش إنه يدفع وهو مش شايف الإجمالي.
   ===================================================================== */

.pos { display: grid; grid-template-columns: 1fr 370px; gap: 16px; align-items: start; }
.pos-side { position: sticky; top: calc(var(--header-h) + 16px); }

.pos-scan { display: flex; gap: 10px; align-items: flex-end; }
.pos-scan .field { flex: 1; margin: 0; }

/* الخانة دي هي كل الشغل — أكبر من أي خانة تانية في النظام عن قصد */
.pos-scan input[type=text] {
  font-size: 18px; padding: 13px 14px; letter-spacing: .5px; font-weight: 600;
}
.pos-scan .btn { padding: 13px 22px; font-size: 15px; }
.pos-hint { padding: 0 18px 14px; min-height: 20px; }

/* ---- معاينة الكاميرا ----
   خلفية سودا مقصودة: الفيديو بياخد وقت جزء من الثانية قبل ما يظهر،
   وبدون الخلفية بيبان مربع أبيض بيرمش. والارتفاع محدود عشان على
   الموبايل الكاميرا ماتزقّش زرار الدفع تحت الشاشة. */
.pos-cam {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  line-height: 0;
}
.pos-cam video {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  display: block;
}

/* في الكاشير المعاينة بره الـpanel-body فمحتاجة هامش جانبي بنفسها،
   وفي شاشة فاتورة الجملة جوّاه فبتاخد هامشه. */
#posCamWrap { margin: 0 18px 12px; }

/* =====================================================================
   شاشة التسجيل بالمسح

   نفس هيكل الكاشير: الشغل على الشمال والسجل على اليمين. العامل
   بيبص على الشمال وهو ماسك السجادة، واليمين بيطمّنه إن اللي مسحه
   اتسجّل فعلًا — من غير ما يسيب مكانه.
   ===================================================================== */

.reg { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.reg-side { position: sticky; top: calc(var(--header-h) + 16px); }
.reg-main > .panel + .panel { margin-top: 16px; }

/* الخانة دي هي كل الشغل — أكبر خانة في الشاشة عن قصد */
.reg #code { font-size: 18px; padding: 13px 14px; letter-spacing: .5px; font-weight: 600; }

@media (max-width: 1100px) {
  .reg { grid-template-columns: 1fr; }
  .reg-side { position: static; }
}

/* ---- شرايط صغيرة لأسماء الموظفين ----
   قايمة أسامي مفصولة بفواصل بتبقى كتلة نص صعب تقراها بسرعة.
   الشريحة بتخلّي كل اسم وحدة قائمة بذاتها، والمسؤول باين فيها. */
.chip {
  display: inline-block;
  padding: 2.5px 9px;
  margin: 2px 0 2px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}
.chip-on {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand-2);
  font-weight: 600;
}

/* قايمة نقط بسيطة جوّه اللوحات — بدون الهوامش الافتراضية للمتصفح */
.plain-list { margin: 8px 0 0; padding-inline-start: 18px; font-size: 12.5px; color: var(--text-3); }
.plain-list li { margin-bottom: 3px; }

/* «لسه مافيش» جوّه خانة جدول — بتبان أهدى من النص العادي فالعين
   بتعدّي عليها بدل ما تقراها كأنها قيمة */
.muted { color: var(--text-3); }

/* ---- سطر التغيير في شاشة الحوكمة ----
   «اللون: أحمر ← أزرق» في سطر واحد. القديم مشطوب عشان العين تعرف
   في ربع ثانية إيه اللي راح وإيه اللي جه من غير ما تقرا الكلمتين. */
.chg { font-size: 12px; line-height: 1.6; }
.chg + .chg { margin-top: 2px; }
/* سطر أوامر ينسخه المستخدم ويلزقه.
   direction: ltr مش تجميل — من غيرها الصفحة الـRTL بتعيد ترتيب
   النجوم والشرطات، والأمر بيطلع مقلوب ومابيشتغلش لما يتنسخ. */
.cmd {
  direction: ltr;
  text-align: left;
  unicode-bidi: bidi-override;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin: 8px 0 0;
  overflow-x: auto;
  white-space: nowrap;
  user-select: all;          /* ضغطة واحدة بتحدد السطر كله */
}

/* =====================================================================
   التحويل والجرد
   ===================================================================== */

/* نتايج البحث جوّه نافذة التحويل — مساحة محدودة بتتمرّر، عشان
   القايمة الطويلة ماتزقّش زرار الحفظ بره الشاشة */
.pick-results {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.pick-results:empty { display: none; }

/* خانة ملاحظة جوّه صف جدول */
.mini-wide {
  width: 100%; min-width: 120px;
  padding: 5px 8px; font-size: 12.5px;
}

/* ---- شريط تقدّم الجرد ----
   العامل بيبص عليه من بعيد وهو ماسك سجادة، فالرقم جوّه الشريط
   مش تحته: بصة واحدة تقول اتعدّ كام وفاضل كام. */
.cnt-bar {
  position: relative;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.cnt-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-2), var(--brand-3));
  transition: width .25s ease;
}
.cnt-txt {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--text);
  /* الرقم لاتيني والصفحة عربية — plaintext بتمنع قلب «12 من 40» */
  unicode-bidi: plaintext;
}

.chg-f { color: var(--text-3); font-weight: 600; }
.chg-o { color: var(--danger-ink); text-decoration: line-through; opacity: .75; }
.chg-n { color: var(--ok-ink); font-weight: 600; }

/* ---- كتلة المسؤولية في بطاقة القطعة ----
   أربع حقائق جنب بعض بدل صفوف جدول: العين بتلقطهم كلهم في نظرة
   واحدة، وده المطلوب لما يكون السؤال «مين مسؤول عن دي». */
.gov {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.gov-i { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gov-k { font-size: 10.5px; color: var(--text-3); font-weight: 700; letter-spacing: .03em; }
.gov-v {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  unicode-bidi: plaintext;
}

.pos-lines input.mini {
  width: 88px; padding: 5px 8px; font-size: 12.5px; text-align: left;
  direction: ltr; font-variant-numeric: tabular-nums;
}

/* ---- لوحة الحساب ---- */

.pos-total .panel-body { padding: 16px 18px; }

.pt-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 7px 0; font-size: 13.5px; color: var(--text-2);
}
.pt-row b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.pt-row em { font-style: normal; color: var(--text-3); font-size: 12px; }
.pt-row input[type=number] {
  width: 120px; padding: 6px 9px; text-align: left; direction: ltr;
  font-variant-numeric: tabular-nums;
}

.pt-grand {
  margin-top: 8px; padding-top: 13px; border-top: 2px solid var(--border-strong);
}
.pt-grand span { font-size: 15px; font-weight: 700; color: var(--text); }
.pt-grand b { font-size: 26px; font-weight: 800; color: var(--brand-2); letter-spacing: -.5px; }

.pt-margin b { color: var(--ok-ink); }
.pt-margin b.neg { color: var(--danger-ink); }

.pt-change { background: var(--ok-soft); margin: 12px -18px 0; padding: 11px 18px; }
.pt-change b { color: var(--ok-ink); font-size: 19px; }
.pt-due { background: var(--warn-soft); margin: 12px -18px 0; padding: 11px 18px; }
.pt-due b { color: var(--warn-ink); font-size: 19px; }

.hint-inline { font-weight: 400; color: var(--text-3); font-size: 11.5px; }

/* ---- شريط الوردية ---- */

.shift-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 13px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.shift-bar.open { border-color: #B4EFC8; background: var(--ok-soft); }
.shift-bar.closed { border-color: #F8E29A; background: var(--warn-soft); }

.sb-l { display: flex; align-items: center; gap: 9px; }
.sb-l .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(21,128,61,.18);
}
.sb-code { font-family: 'Bricolage Grotesque', ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--text-2); }

.sb-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-inline-start: auto; }
.sb-stats span { display: flex; flex-direction: column; font-size: 14px; font-weight: 700;
                 font-variant-numeric: tabular-nums; }
.sb-stats em { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--text-3); }
.sb-stats .strong { color: var(--ok-ink); }

@media (max-width: 1199px) {
  .pos { grid-template-columns: 1fr; }
  .pos-side { position: static; }
  .sb-stats { margin-inline-start: 0; gap: 14px; }
}
@media (max-width: 559px) {
  .pos-scan { flex-direction: column; align-items: stretch; }
  .pos-scan .btn { width: 100%; }
  /* أقل من 16 بكسل بيخلي iOS يزوّم لوحده وقت الكتابة */
  .pos-scan input[type=text] { font-size: 17px; }
  .sb-stats { width: 100%; justify-content: space-between; }
}

/* ---------------- قائمة الدخل ---------------- */

table.data tr.grp td {
  background: var(--surface-2); font-weight: 700; font-size: 12px;
  color: var(--text-2); padding-top: 12px;
}
table.data tr.sub-total td { border-top: 1px solid var(--border-strong); font-weight: 600; }
table.data tr.grand-total td {
  border-top: 2px solid var(--brand-2); background: var(--brand-soft);
  font-weight: 800; font-size: 15px; color: var(--brand);
}

/* شريط الوزن النسبي — بيوري أنهي مجموعة بتجيب معظم الربح بنظرة */
.bar { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar span { display: block; height: 100%; background: var(--brand-2); border-radius: 4px; }

/* ---------------- إجماليات فاتورة الجملة ---------------- */

.wsale-totals {
  margin-top: 16px; margin-inline-start: auto; max-width: 320px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 16px; background: var(--surface-2);
}
.wsale-totals div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; font-size: 13.5px; color: var(--text-2);
}
.wsale-totals b { color: var(--text); font-variant-numeric: tabular-nums; }
.wsale-totals .grand {
  border-top: 2px solid var(--border-strong); margin-top: 7px; padding-top: 10px;
}
.wsale-totals .grand span { font-weight: 700; color: var(--text); }
.wsale-totals .grand b { font-size: 20px; font-weight: 800; color: var(--brand-2); }

/* =====================================================================
   محرر السطور على الموبايل

   جدول بسبع أعمدة على شاشة 390 بكسل بيدي كل عمود 50 بكسل — يعني
   خانات مالهاش لازمة ومستحيل تكتب فيها. فالجدول بيتقلب لبطاقات:
   كل سطر بيبقى كارت، وكل خلية سطر فيه اسمه على الشمال وقيمته على
   اليمين. نفس الـHTML، والاختلاف كله في العرض.
   ===================================================================== */

@media (max-width: 719px) {
  table.data.line-editor,
  table.data.line-editor tbody,
  table.data.line-editor tr,
  table.data.line-editor td { display: block; width: auto; }

  table.data.line-editor thead { display: none; }

  table.data.line-editor tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 12px 12px;
    margin-bottom: 11px;
    background: var(--surface-2);
  }

  table.data.line-editor td {
    border: none;
    padding: 7px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: start;
  }

  table.data.line-editor td::before {
    content: attr(data-label);
    flex: 0 0 96px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-2);
  }
  table.data.line-editor td:not([data-label])::before { content: none; }

  table.data.line-editor td input,
  table.data.line-editor td select { flex: 1; min-width: 0; }

  /* الإجمالي مش خانة إدخال — بيتعرض رقم كبير واضح */
  table.data.line-editor td[data-line-total] {
    font-weight: 800; font-size: 15px;
    border-top: 1px dashed var(--border-strong);
    margin-top: 4px; padding-top: 10px;
  }

  table.data.line-editor td.le-del { padding-top: 10px; }
  table.data.line-editor td.le-del .btn { width: 100%; justify-content: center; }
}

/* لوجو NOOL على لوحة شاشة الدخول — الحد الأدنى للعرض ٩٦ بكسل */
.login-logo { display: block; width: 132px; height: auto; }

/* =====================================================================
   الاستلام بالمسح
   خانة المسح كبيرة وفي أول السطور: الموظف واقف بالماسح قدام كومة
   سجاد، والشاشة لازم تتقري من بعيد — العدّاد بيقوله كام قطعة دخلت
   من غير ما يقرب.
   ===================================================================== */

.recv-scan {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 18px;
  background: var(--brand-soft);
  border: 1.5px solid #DDE1FF;
  border-radius: var(--radius-lg);
}

.recv-scan-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.recv-scan-field label { font-size: 13px; font-weight: 700; color: var(--brand-2); }
.recv-scan-field input {
  min-height: 52px;
  font-size: 18px;
  font-family: 'Bricolage Grotesque', 'Beiruti', sans-serif;
  letter-spacing: .02em;
  border-color: var(--brand-3);
}

.recv-scan-count {
  flex-shrink: 0;
  min-width: 112px;
  text-align: center;
  padding: 6px 12px;
}
.recv-scan-count b {
  display: block;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.recv-scan-count span { font-size: 12.5px; color: var(--text-2); }

/* المورد بيرقّم كل قطعة: أرقام القطع الجديدة بتتسجل على صنف واحد
   لحد ما الموظف يقول «صنف تاني» */
.recv-sticky {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--transit-soft);
  color: var(--transit);
  font-size: 13.5px;
}
.recv-sticky b { color: var(--ink); }

.le-units {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--transit);
}

/* وميض السطر اللي اتزوّد — العين بتعرف المسح راح فين */
@keyframes leFlash {
  from { background: #DDE1FF; }
  to   { background: transparent; }
}
table.data tr.le-flash td { animation: leFlash .9s ease-out; }

@media (max-width: 700px) {
  .recv-scan { flex-direction: column; align-items: stretch; }
  .recv-scan-count { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  table.data tr.le-flash td { animation: none; background: #EEF0FF; }
}

/* اختيار القطعة لما باركود الموديل يوصل لأكتر من واحدة */
.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; }
.pick-row {
  display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 12px; align-items: center;
  min-height: 48px; padding: 8px 14px; text-align: right;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.pick-row:hover, .pick-row:focus-visible { border-color: var(--brand); outline: none; }
.pick-row.is-first { border-color: var(--brand-3); background: var(--brand-soft); }
.pick-row .mono { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; direction: ltr; text-align: right; }

/* ---------------- وضع المنصة: شريط حالة الاشتراك ----------------
   فوق المحتوى تحت الشريط العلوي. لونه على قد خطورته: معلومة،
   سماح، قراية بس. ودخول الدعم الفني بالحبر عشان يبان إنه مش
   حساب صاحب المتجر. */
.sub-banner {
  margin: 0 24px; padding: 11px 16px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1.6;
}
.sub-banner + .sub-banner { margin-top: 8px; }
.sub-banner.is-info    { background: var(--info-soft);   border-color: #C8CFFF; color: var(--info-ink); }
.sub-banner.is-warn    { background: var(--warn-soft);   border-color: #F8E29A; color: var(--warn-ink); }
.sub-banner.is-danger  { background: var(--danger-soft); border-color: #F8C4C4; color: var(--danger-ink); }
.sub-banner.is-support { background: var(--ink); color: #fff; border-inline-start: 4px solid var(--accent); }
.sub-banner.is-demo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--brand); border-color: var(--brand); color: #fff; }
.sub-banner.is-demo b { font-weight: 800; }
.sub-banner.is-demo .btn { background: #fff; color: var(--brand); border-color: #fff; font-weight: 700; white-space: nowrap; }
@media (max-width: 999px) { .sub-banner { margin: 0 14px; } }

/* ---------------- استيراد المخزون من Excel ---------------- */
.imp-steps { margin: 0 0 18px; padding-inline-start: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--text-2); }
.imp-new { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid #ECEEF4; font-size: 14px; }
.imp-new:last-child { border-bottom: 0; }
.imp-new span { color: var(--text-2); }
.imp-done { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.imp-done span { color: var(--text-2); flex: 1 1 260px; }
.imp-help summary { cursor: pointer; list-style: none; }
.imp-help summary::-webkit-details-marker { display: none; }
@media (max-width: 640px) { .imp-new { grid-template-columns: 1fr; gap: 2px; } }
