/* ================================================================
   حسابات برو — الواجهة الزجاجية
   كل الألوان متغيرات، والوضع الفاتح والغامق بيبدّلوا نفس المتغيرات.
   ================================================================ */

:root {
  --bg-1: #0b1220;
  --bg-2: #131f38;
  --blob-1: #14b8a6;
  --blob-2: #6366f1;
  --blob-3: #f59e0b;

  --glass: rgba(255, 255, 255, .07);
  --glass-2: rgba(255, 255, 255, .12);
  --glass-hi: rgba(255, 255, 255, .16);
  --stroke: rgba(255, 255, 255, .14);
  --stroke-hi: rgba(255, 255, 255, .28);

  --text: #eef2ff;
  --text-dim: #a8b3cf;
  --text-mute: #7c89a8;

  --accent: #2dd4bf;
  --accent-2: #818cf8;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .40);
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, .25);
  --blur: blur(22px) saturate(170%);
  --side: 240px;
}

html[data-theme="light"] {
  --bg-1: #eef2f9;
  --bg-2: #dfe7f5;
  --blob-1: #5eead4;
  --blob-2: #a5b4fc;
  --blob-3: #fcd34d;

  --glass: rgba(255, 255, 255, .58);
  --glass-2: rgba(255, 255, 255, .74);
  --glass-hi: rgba(255, 255, 255, .88);
  --stroke: rgba(15, 23, 42, .10);
  --stroke-hi: rgba(15, 23, 42, .20);

  --text: #14203a;
  --text-dim: #4a5878;
  --text-mute: #6b7896;

  --accent: #0d9488;
  --accent-2: #4f46e5;
  --ok: #059669;
  --warn: #b45309;
  --bad: #e11d48;

  --shadow: 0 18px 45px rgba(38, 60, 110, .16);
  --shadow-sm: 0 6px 18px rgba(38, 60, 110, .10);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;               /* مفيش إزاحة أفقية للصفحة على الموبايل */
  overscroll-behavior: none;        /* مفيش «نطّ» يوري فراغ */
}

body {
  font-family: "Cairo", "Segoe UI", "Tahoma", "Dubai", system-ui, sans-serif;
  color: var(--text);
  direction: rtl;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 700;            /* الشاشة كلها بولد */
  -webkit-font-smoothing: antialiased;

  /* الشعار علامة مائية جوه الخلفية نفسها — مش عنصر مستقل.
     العنصر المستقل بشفافية كان بيعمل طبقة تركيب بحجم الشاشة،
     وده مع backdrop-filter بيخلّي كروم يومض أسود لجزء من الثانية. */
  background-color: var(--bg-2);
  background-image:
    linear-gradient(160deg,
      color-mix(in srgb, var(--bg-1) 95%, transparent),
      color-mix(in srgb, var(--bg-2) 95%, transparent)),
    url("logo-256.png");
  background-repeat: no-repeat, no-repeat;
  background-position: center, center 46%;
  background-size: cover, min(46vmin, 430px);
  background-attachment: fixed, fixed;
}

:root[data-theme="light"] body {
  background-image:
    linear-gradient(160deg,
      color-mix(in srgb, var(--bg-1) 93%, transparent),
      color-mix(in srgb, var(--bg-2) 93%, transparent)),
    url("logo-256.png");
}

/* ---------------------------------------------------- خلفية الأورورا */
.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.aurora i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .40;
  animation: drift 26s ease-in-out infinite;
}

.aurora i:nth-child(1) { width: 46vw; height: 46vw; background: var(--blob-1); top: -12vh; inset-inline-start: -8vw; }
.aurora i:nth-child(2) { width: 40vw; height: 40vw; background: var(--blob-2); bottom: -16vh; inset-inline-end: -6vw; animation-delay: -9s; }
.aurora i:nth-child(3) { width: 30vw; height: 30vw; background: var(--blob-3); top: 32vh; inset-inline-start: 42vw; opacity: .22; animation-delay: -17s; }

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(4vw, 5vh, 0) scale(1.10); }
  66%      { transform: translate3d(-3vw, -4vh, 0) scale(.94); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora i { animation: none; }
}

/* ---------------------------------------------------- الهيكل */
/* overflow:hidden ضروري — من غيره لو ابن اتمدّد بيطلع بره الشاشة من غير تمرير */
#app { position: relative; z-index: 1; height: 100%; display: flex;
       flex-direction: column; overflow: hidden; }

/* ---------------------------------------------------- الشريط العلوي */
.topstrip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin: 10px 12px 0;
  padding: 8px 14px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.topstrip .logo {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  padding: 2px;
}

.brand-txt b { font-size: 14.5px; display: block; line-height: 1.2; }
.brand-txt small { color: var(--text-mute); font-size: 11px; }

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--stroke-hi);
  background: var(--glass-2);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background .14s, transform .1s;
}

.home-btn:hover { background: var(--glass-hi); }
.home-btn:active { transform: translateY(1px); }
.home-btn.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(45, 212, 191, .3);
}

html[data-theme="light"] .home-btn.on { color: #fff; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--glass-2);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
}

.icon-btn:hover { background: var(--glass-hi); }

/* ---------------------------------------------------- بلاطات الرئيسية */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 10px;
}

.tile {
  position: relative;
  overflow: hidden;
  padding: 20px 16px;
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}

.tile::before {
  content: "";
  position: absolute;
  inset-block-start: -55%;
  inset-inline-start: 50%;
  transform: translateX(50%);
  width: 150px; height: 150px;
  border-radius: 50%;
  background: var(--tint);
  opacity: .22;
  filter: blur(34px);
  transition: opacity .16s;
}

.tile:hover {
  transform: translateY(-4px);
  border-color: var(--stroke-hi);
  box-shadow: 0 24px 55px rgba(0, 0, 0, .38);
}

.tile:hover::before { opacity: .38; }
.tile:active { transform: translateY(-1px); }

.tile .t-ic {
  position: relative;
  width: 62px; height: 62px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  font-size: 30px;
  border-radius: 19px;
  background: var(--glass-2);
  border: 1px solid var(--stroke-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}
/* ===== أيقونات زجاجية — مربّع لون صريح + رمز أبيض بولد + لمعة =====
   اللون جوّه الأيقونة، والرمز خط أبيض تخين واضح. */
.gi-line  { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.gi-fill  { fill: #fff; }
.gi-sheen { fill: #fff; opacity: .20; }
.tile .t-ic svg { width: 42px; height: 42px; filter: drop-shadow(0 5px 9px rgba(20,30,50,.28)); }

/* ===== بلاطة مستطيلة بالعرض: أيقونة + نص جنب بعض، مدمجة ===== */
.home-grid .tile.trow {
  display: flex; align-items: center; gap: 10px;
  text-align: start; padding: 9px 12px; min-height: 62px;
}
.home-grid .tile.trow .t-ic {
  margin: 0; flex: 0 0 auto;
  width: 54px; height: 54px; background: transparent; border: none; box-shadow: none;
}
.home-grid .tile.trow .t-ic svg { width: 52px; height: 52px; }
/* الأيقونة الزجاجية 3D — أكبر وبلا برواز/خلفية (القاعدة جوّه الأيقونة نفسها) */
.home-grid .tile.trow.ic3d .t-ic {
  width: 76px; height: 76px; background: transparent; border: none; box-shadow: none;
}
.home-grid .tile.trow.ic3d .t-ic svg { width: 76px; height: 76px; filter: none; }
.home-grid .tile.trow .t-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.home-grid .tile.trow b { font-size: 14px; line-height: 1.2; }
/* سطر وصف واحد بس — عشان تفضل مستطيل قصير مرصوص */
.home-grid .tile.trow small {
  font-size: 10.5px; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.home-grid .tile.trow .t-kpi { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-grid .tile.trow .t-kpi:empty { display: none; }

.tile b { position: relative; display: block; font-size: 15px; margin-bottom: 3px; }
.tile small { position: relative; color: var(--text-mute); font-size: 11.5px; line-height: 1.5; }

.tile .t-kpi {
  position: relative;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--stroke);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.brand .logo {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  object-fit: contain;
  background: rgba(255, 255, 255, .92);
  padding: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}

.brand b { font-size: 16px; display: block; line-height: 1.2; }
.brand small { color: var(--text-mute); font-size: 11px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}

.nav-item .ic { font-size: 17px; width: 22px; text-align: center; flex: 0 0 22px; }
.nav-item:hover { background: var(--glass-2); color: var(--text); }

.nav-item.on {
  background: var(--glass-hi);
  color: var(--text);
  border-color: var(--stroke-hi);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.nav-sep {
  margin: 10px 10px 4px;
  font-size: 10.5px;
  letter-spacing: .5px;
  color: var(--text-mute);
}

.side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--stroke); }

/* ---------------------------------------------------- المنطقة الرئيسية */
/* min-height:0 هي اللي بتخلّي التمرير يشتغل. من غيرها الحد الأدنى للطول
   في الـ flex العمودي = طول المحتوى، فـ .view بتتمدد لطول الجدول كله
   وتبقى scrollHeight = clientHeight يعني عجلة الماوس ماتنزّلش حاجة. */
.main { flex: 1; min-width: 0; min-height: 0; display: flex;
        flex-direction: column; padding: 12px; gap: 10px; }
/* لما مفيش شريط عنوان، منخليش فجوة فاضية فوق */
.main:has(.topbar.hide) { gap: 8px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

/* ---------------------------------------------------- شريط التبويبات */
.tabstrip {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.tabstrip::-webkit-scrollbar { height: 0; }
.tabstrip:empty { display: none; }

.tab-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 13px 13px 0 0;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-bottom: 0;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  user-select: none;
  transition: background .14s, color .14s;
}

.tab-chip:hover { background: var(--glass-2); color: var(--text); }

.tab-chip.on {
  background: var(--glass-hi);
  color: var(--text);
  font-weight: 600;
  border-color: var(--stroke-hi);
  box-shadow: 0 -3px 14px rgba(0, 0, 0, .16);
}

.tab-chip .num {
  font-size: 10px;
  opacity: .55;
  border: 1px solid var(--stroke-hi);
  border-radius: 5px;
  padding: 0 3px;
  font-variant-numeric: tabular-nums;
}

.tab-chip .cl { opacity: .5; font-size: 15px; line-height: 1; padding: 0 1px; }
.tab-chip .cl:hover { opacity: 1; color: var(--bad); }
.tab-chip.dirty > span:nth-child(2)::after { content: " •"; color: var(--warn); }

/* لوح التبويب: بنخفي غير النشط عشان الحالة ما تضيعش */
.tab-pane { display: none; }
.tab-pane.on { display: block; }
.tab-top { display: none; width: 100%; align-items: center; gap: 10px; }
.tab-top.on { display: flex; }

.topbar.hide { display: none; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar .sub { color: var(--text-mute); font-size: 12px; }
.spacer { flex: 1; }

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-inline-end: 4px;
  padding-bottom: 6px;
}

.view::-webkit-scrollbar { width: 9px; }
.view::-webkit-scrollbar-thumb { background: var(--stroke-hi); border-radius: 9px; }
.view::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------- الزجاج */
.glass {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.card { padding: 16px; }
.card > h3 { margin: 0 0 12px; font-size: 14px; color: var(--text-dim); font-weight: 600; }

.grid { display: grid; gap: 12px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

@media (max-width: 1150px) { .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .g-3, .g-2 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------- بطاقات الأرقام */
.kpi { padding: 15px 16px; position: relative; overflow: hidden; }

.kpi::after {
  content: "";
  position: absolute;
  inset-block-start: -40%;
  inset-inline-end: -18%;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: var(--tint, var(--accent));
  opacity: .16;
  filter: blur(26px);
}

.kpi .lab { color: var(--text-mute); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi .num { font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: -.4px; }
.kpi .num small { font-size: 13px; font-weight: 700; color: var(--text-mute); margin-inline-start: 3px; }
.kpi .foot { margin-top: 5px; font-size: 11.5px; color: var(--text-mute); }

/* ---------------------------------------------------- عناصر الإدخال */
input, select, textarea, button { font-family: inherit; font-size: 14px; }

.f {
  width: 100%;
  padding: 9px 12px;
  color: var(--text);
  /* (2026-10-28) لون الخانة من --field (الثيم) — قبلها كانت أبيض على كارت أبيض فماتبانش */
  background: var(--field, var(--glass-2));
  border: 1px solid var(--field-stroke, var(--stroke));
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .14s, box-shadow .14s, background .14s;
}

.f:focus {
  border-color: var(--accent);
  background: var(--glass-hi);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.f:disabled { opacity: .55; cursor: not-allowed; }
.f::placeholder { color: var(--text-mute); }
select.f option { background: var(--bg-2); color: var(--text); }
textarea.f { resize: vertical; min-height: 62px; }

.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label { font-size: 11.5px; color: var(--text-mute); padding-inline-start: 2px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .fld { flex: 1; min-width: 130px; }

/* ---------------------------------------------------- الأزرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--stroke);
  background: var(--glass-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s, background .14s, border-color .14s, box-shadow .14s;
}

.btn:hover { background: var(--glass-hi); border-color: var(--stroke-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.p {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #04121a;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(45, 212, 191, .30);
}

html[data-theme="light"] .btn.p { color: #fff; }
.btn.p:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.ico { padding: 7px 9px; }

.seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--glass-2); border: 1px solid var(--stroke); border-radius: 12px; }
.seg button { padding: 7px 13px; border: 0; background: transparent; color: var(--text-dim); border-radius: 9px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--glass-hi); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------- الجداول */
.tbl-wrap { overflow: auto; border-radius: var(--r-md); border: 1px solid var(--stroke); }
.tbl-wrap::-webkit-scrollbar { width: 9px; height: 9px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--stroke-hi); border-radius: 9px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }

table.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: start;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

table.tbl td { padding: 9px 12px; border-bottom: 1px solid color-mix(in srgb, var(--stroke) 60%, transparent); }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--glass-2); }
table.tbl tbody tr.click { cursor: pointer; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tfoot td { padding: 10px 12px; font-weight: 700; border-top: 1px solid var(--stroke-hi); background: var(--glass-2); }
table.tbl .num, table.tbl th.num { text-align: start; font-variant-numeric: tabular-nums; }
table.tbl tr.sel { background: color-mix(in srgb, var(--accent) 15%, transparent) !important; }

.empty { padding: 42px 16px; text-align: center; color: var(--text-mute); }
.empty .big { font-size: 34px; opacity: .5; display: block; margin-bottom: 8px; }

/* ---------------------------------------------------- الشارات */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid var(--stroke);
  background: var(--glass-2);
  white-space: nowrap;
}

.tag.ok   { color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 40%, transparent);   background: color-mix(in srgb, var(--ok) 13%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.tag.bad  { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 40%, transparent);  background: color-mix(in srgb, var(--bad) 13%, transparent); }
.tag.info { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); background: color-mix(in srgb, var(--accent-2) 13%, transparent); }

.pos { color: var(--ok); }
.neg { color: var(--bad); }
.dim { color: var(--text-mute); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------- النوافذ */
.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 8, 18, .55);
  backdrop-filter: blur(5px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* (2026-11-08) من غيرها العمود بياخد عرض أوسع جدول جوّه النافذة فبتتزق برّه الشاشة */
  place-items: center;
  padding: 20px;
  animation: fade .16s ease;
}

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.modal {
  width: min(var(--w, 620px), 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg-2) 72%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-hi);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  animation: pop .18s ease;
}

.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--stroke); }
.modal header h3 { margin: 0; font-size: 15.5px; }
.modal .body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; padding: 13px 18px; border-top: 1px solid var(--stroke); }
.modal .body::-webkit-scrollbar { width: 8px; }
.modal .body::-webkit-scrollbar-thumb { background: var(--stroke-hi); border-radius: 8px; }

.x { margin-inline-start: auto; cursor: pointer; color: var(--text-mute); font-size: 20px; line-height: 1; padding: 0 4px; }
.x:hover { color: var(--bad); }

/* ---------------------------------------------------- التنبيهات */
#toasts { position: fixed; top: 16px; inset-inline-start: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
/* (2026-11-24) طلب المالك: التنبيهات كانت بتطلع فوق على اليمين وبتغطّي التابات وأسهم الفاتورة وزرار الحفظ
   («دول انا مش عايزهم هنا»). على الكمبيوتر نزلت تحت على الشمال — زي التصنيع والموارد البشرية —
   وفوق زرار «🔄 فيه تحديث» لو ظاهر، ومابتمسكش الماوس (اللي تحتها بيتداس عادي). الموبايل زي ما هو. */
@media (min-width: 861px) {
  html:not(.view-phone) #toasts { top: auto; bottom: 16px; inset-inline-start: auto; inset-inline-end: 16px; pointer-events: none; }
  html:not(.view-phone) body:has(#upd-pill) #toasts { bottom: 64px; }
  /* في الفاتورة: جنب عمود أدوات السطور (الكمية/السعر/الخصم/حذف) مش فوقه */
  html:not(.view-phone) body:has(.tab-pane.on .iv-tools) #toasts { inset-inline-end: 104px; }
  html:not(.view-phone) #toasts .toast.out { transform: translateY(8px); }
}

.toast {
  padding: 11px 16px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-hi);
  box-shadow: var(--shadow);
  animation: pop .2s ease;
  max-width: 420px;
  border-inline-start: 3px solid var(--accent);
}

.toast.ok  { border-inline-start-color: var(--ok); }
.toast.bad { border-inline-start-color: var(--bad); }
.toast.warn{ border-inline-start-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }
/* زرار الحفظ بيوضّح النتيجة في مكانه (saveBtn في app.js) */
.btn.btn-saved { background: var(--ok) !important; color: #fff !important; border-color: var(--ok) !important; opacity: 1 !important; }
.btn.btn-failed { background: var(--bad) !important; color: #fff !important; border-color: var(--bad) !important; opacity: 1 !important; }

/* ---------------------------------------------------- شاشة الدخول */
.login-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; }

.login {
  width: min(390px, 92vw);
  padding: 30px 26px;
  text-align: center;
}

.login .logo {
  display: block;
  width: 108px; height: 108px;
  margin: 0 auto 14px;
  object-fit: contain;
  border-radius: 22px;
  background: rgba(255, 255, 255, .94);
  padding: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}

.login h2 { margin: 0 0 4px; font-size: 21px; }
.login p { margin: 0 0 20px; color: var(--text-mute); font-size: 13px; }

/* ---------------------------------------------------- شاشة الفاتورة */
.inv-layout { display: grid; grid-template-columns: 1fr 300px; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .inv-layout { grid-template-columns: 1fr; } }

/* صف رأس الفاتورة: الاسم وكل الخانات في سطر واحد */
/* z-index عشان قايمة العميل المنسدلة تعلو على خانة البحث
   والجدول اللي بعدهم في الترتيب */
.inv-head-row { margin-bottom: 8px; align-items: flex-end;
                position: relative; z-index: 20; }

.inv-kind-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  box-shadow: 0 5px 15px rgba(45, 212, 191, .28);
}

html[data-theme="light"] .inv-kind-chip { color: #fff; }
.inv-kind-chip b { font-size: 15px; opacity: .85; }
/* (2026-11-24) أسهم التنقّل في السندات وتسوية المخازن (docNavHTML في screens.js) — بنفس شكل أسهم الفاتورة،
   أول حاجة في رأس الشاشة فمكانها ثابت */
.doc-nav { display: inline-flex; align-items: center; align-self: flex-end; flex: 0 0 auto; gap: 0; padding: 2px; border-radius: 11px; background: var(--glass); border: 1px solid var(--stroke); }
.doc-nav .ib { min-width: 32px; height: 34px; }

.inv-search { font-size: 15px; padding: 11px 14px; }

/* شريط الأوامر أسفل الشاشة */
.inv-actions {
  position: sticky;
  bottom: 6px;              /* مش لازق في الحافة — عشان أي شريط تحت ما يغطّيش */
  z-index: 20;
  margin-top: 12px;
  padding: 9px 12px;
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  border-radius: var(--r-lg);
  box-shadow: 0 -8px 26px rgba(0, 0, 0, .30);
}

.inv-actions .act {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
  background: var(--glass-2);
  color: var(--text);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .14s, transform .1s, box-shadow .14s;
}

.inv-actions .act span { font-size: 19px; line-height: 1; }
.inv-actions .act:hover { background: var(--glass-hi); border-color: var(--stroke-hi); }
.inv-actions .act:active { transform: translateY(1px); }

.inv-actions .act.p {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #04121a;
  box-shadow: 0 7px 20px rgba(45, 212, 191, .3);
}

html[data-theme="light"] .inv-actions .act.p { color: #fff; }
.inv-actions .act kbd { opacity: .7; }

@media (max-width: 760px) {html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-actions .act { flex: 1; justify-content: center; padding: 11px 8px; font-size: 12px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-actions .act kbd { display: none; }
}

.pick { position: relative; }

.pick-list {
  position: absolute;
  z-index: 30;
  inset-inline: 0;
  top: calc(100% + 5px);
  max-height: 320px;
  overflow-y: auto;
  /* التمرير بالعجلة يفضل جوّه القايمة — من غير كده الصفحة اللي ورا بتتحرك */
  overscroll-behavior: contain;
  padding: 5px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-hi);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
}

.pick-list div.opt { padding: 9px 11px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.pick-list div.opt:hover, .pick-list div.opt.on { background: var(--glass-hi); }

/* ---------------------------------------------------- قايمة الأصناف بأعمدة */
.pick-list.cols div.opt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 84px 96px 80px;
  gap: 8px;
  align-items: center;
  padding: 7px 11px;
}

.pick-list.cols div.opt > span { min-width: 0; overflow: hidden; text-overflow: ellipsis;
                                 white-space: nowrap; }
.pick-list.cols div.opt > span:not(:first-child) { text-align: center; font-size: 12.5px; }

/* صف العناوين ثابت فوق وانت بتنزّل، ومش قابل للاختيار */
.pick-list.cols div.opt.head {
  position: sticky;
  top: -5px;                 /* -5 عشان padding القايمة نفسها */
  z-index: 2;
  cursor: default;
  font-size: 11.5px;
  color: var(--text-mute);
  background: color-mix(in srgb, var(--bg-2) 97%, transparent);
  border-bottom: 1px solid var(--stroke-hi);
  border-radius: 0;
  margin: -5px -5px 4px;
  padding-inline: 16px;
}

.pick-list.cols div.opt.head:hover { background: color-mix(in srgb, var(--bg-2) 97%, transparent); }
.pick-list.cols div.opt.head > span:not(:first-child) { font-size: 11.5px; }

/* (2026-11-25) شكوى المالك: «لما بفتح بالتابلت مش بيظهرلي أسماء الأصناف في فاتورة البيع».
   التابلت بالعرض (~1280): خانة البحث جنب الكارت الأخضر عرضها ~520، والأعمدة التانية ثابتة،
   فعمود الاسم كان بيفضل له ~80 نقطة والاسم يتقص لأول كلمة («سحلب و…»).
   دلوقتي القايمة بتقيس عرضها هي (مش عرض الشاشة): لو أضيق من 640 التصنيف بيتشال والأعمدة بتصغر
   والاسم بياخد الباقي (~240) ويلف لو طويل بدل ما يتقص. اللاب (القايمة ~780) زي ما هو،
   والموبايل (أقل من 761) ليه شكل السطرين بتاعه. ملحوظة: container-type محتاج القايمة يبقى ليها
   عرض صريح — وهي ليها دايماً (inset-inline من الخانة، أو fixed بـ inset-inline على الموبايل). */
.pick-list.cols { container-type: inline-size; }
@media (min-width: 761px) {
  @container (max-width: 640px) {
    html:not(.view-phone) .pick-list.cols div.opt { grid-template-columns: minmax(0, 1fr) 88px 70px 72px; gap: 6px; }
    html:not(.view-phone) .pick-list.cols div.opt > span:nth-child(4) { display: none; }
    html:not(.view-phone) .pick-list.cols div.opt:not(.head) > span:first-child { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
  }
}

/* أرقام الخطوات في نافذة الوحدة — زي ترقيم سهل ١ ٢ ٣ ٤ */
.step {
  display: inline-grid;
  place-items: center;
  width: 17px; height: 17px;
  margin-inline-end: 4px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #04121a;
  vertical-align: middle;
}

/* قايمة الوحدات وهي مركّز عليها — عشان تبان إن الأسهم هتشتغل */
#u-opts { outline: none; border: 1px solid var(--stroke); }
#u-opts:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
#u-opts .opt.on {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-inline-start: 3px solid var(--accent);
}

/* ---- تكبير نافذة اختيار الوحدة: الاسم والوحدة والسعر ---- */
.modal:has(#u-opts) header h3 { font-size: 19px; font-weight: 700; }

#u-opts .opt { padding: 11px 12px; font-size: 15.5px; }
#u-opts .opt b { font-size: 17px; }
#u-opts .opt .dim { font-size: 12.5px; }
#u-opts .opt .r { font-size: 17px; font-weight: 700; color: var(--text); }

.modal:has(#u-opts) #u-qty,
.modal:has(#u-opts) #u-price,
.modal:has(#u-opts) #u-disc {
  font-size: 18px;
  font-weight: 700;
  padding: 10px 12px;
  text-align: center;
}

.modal:has(#u-opts) #u-total { font-size: 22px; }
.pick-list .opt .r { margin-inline-start: auto; font-size: 12px; color: var(--text-mute); white-space: nowrap; }

/* صف مضغوط لرأس الفاتورة — خانات صغيرة عشان الجدول ياخد مساحة أكبر */
.row.compact { gap: 7px; }
/* لازم نلغي min-width الافتراضي (130بك) عشان العروض المحددة تشتغل */
.row.compact > .fld { min-width: 0; }
.row.compact .fld > label { font-size: 10.5px; }
.row.compact .f { padding: 6px 8px; font-size: 13px; }

.lines th, .lines td { padding: 6px 7px; }
.lines th { font-size: 12px; }
.lines input, .lines select { padding: 6px 7px; font-size: 13px; }
.lines td input.f { min-width: 56px; }
.lines td select.f { min-width: 64px; }

/* اسم الصنف والسعر أكبر — دول اللي العين بتدوّر عليهم في السطر */
.lines .it-name { font-size: 15.5px; font-weight: 600; line-height: 1.3; display: block; }
.lines .it-sub { font-size: 11px; }
.lines td input[data-f="price"],
.lines td input[data-f="qty"] { font-size: 15px; font-weight: 600; }
.lines td:nth-last-child(2) { font-size: 15px; font-weight: 700; }   /* عمود الإجمالي */

.totbox { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.totbox.grand { font-size: 20px; font-weight: 700; padding-top: 11px; margin-top: 6px; border-top: 1px solid var(--stroke-hi); }

kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  border-radius: 5px;
  border: 1px solid var(--stroke-hi);
  background: var(--glass-2);
  color: var(--text-dim);
}

/* ---------------------------------------------------- الرسم البياني */
.spark { width: 100%; height: 130px; display: block; overflow: visible; }
.spark .bar { fill: url(#gbar); transition: opacity .12s; }
.spark .bar:hover { opacity: .75; }
.bar-h { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; }
.bar-h .track { flex: 1; height: 8px; border-radius: 8px; background: var(--glass-2); overflow: hidden; }
.bar-h .fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------------------------------------------------- متنوع */
.hint { font-size: 12px; color: var(--text-mute); line-height: 1.7; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 13.5px; }
.sw input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.divider { height: 1px; background: var(--stroke); margin: 4px 0; }
.scroll-y { overflow-y: auto; }
.nowrap { white-space: nowrap; }
.loading { padding: 40px; text-align: center; color: var(--text-mute); }

.spin {
  width: 26px; height: 26px;
  margin: 0 auto 10px;
  border: 2.5px solid var(--stroke);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------- الطباعة */
@media print {
  body { background: #fff; color: #000; overflow: visible; }
  .side, .topbar, .no-print, #toasts { display: none !important; }
  #app, .main, .view { display: block; height: auto; overflow: visible; padding: 0; }
  .glass, .modal-bg, .modal {
    background: #fff !important;
    backdrop-filter: none !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #000 !important;
    max-height: none !important;
    position: static !important;
  }
  .modal-bg { display: block !important; padding: 0; }
  table.tbl th { background: #eee !important; color: #000 !important; }
  table.tbl th, table.tbl td { border-bottom: 1px solid #bbb !important; }
}

/* ================================================================
   الطباعة المباشرة للفاتورة (بدون نافذة معاينة):
   printInvoice بيبني الفاتورة في #print-host ويحط class على body،
   ووقت الطباعة نخفي كل حاجة غيره. مخفي على الشاشة العادية.
   ================================================================ */
#print-host { display: none; }
@media print {
  body.printing-invoice { background: #fff !important; }
  body.printing-invoice > *:not(#print-host) { display: none !important; }
  body.printing-invoice #print-host { display: block !important; }
  body.printing-invoice #print-host .inv-paper { margin: 0 auto; }
}

/* ---------------------------------------------------- التنقّل بين الفواتير */
.inv-nav {
  display: flex;
  gap: 3px;
  align-self: flex-end;
  padding: 2px;
  border-radius: var(--r-md);
  background: var(--glass-2);
  border: 1px solid var(--stroke);
}

/* كل زرار عمود: الكلمة فوق والسهم تحتها */
.inv-nav .btn.sm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  padding: 3px 6px 4px;
  line-height: 1;
  border: 0;
  background: transparent;
}

.inv-nav .btn.sm > span {
  font-size: 9.5px;
  font-weight: 600;
  opacity: .7;
  white-space: nowrap;
}

.inv-nav .btn.sm > i {
  font-style: normal;
  font-size: 13px;
  line-height: 1;
}

.inv-nav .btn.sm:hover { background: var(--glass-hi); }
.inv-nav .btn.sm:hover > span { opacity: 1; }

/* صف فيه فرق كبير في سحب الأسعار — غالباً وحدة التصنيع مختلفة عن وحدتنا */
.row-warn > td { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.row-warn > td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------------------------------------------------- خانة الخامات المخفية */
.raw-btn {
  flex: 0 0 46px;
  align-self: stretch;
  font-size: 18px;
  padding: 0;
  border-color: color-mix(in srgb, #a3e635 45%, var(--stroke));
}

.raw-btn:hover { background: color-mix(in srgb, #a3e635 18%, transparent); }

.raw-strip {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin: -2px 0 8px;
  padding: 7px 8px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, #a3e635 12%, transparent);
  border: 1px solid color-mix(in srgb, #a3e635 40%, var(--stroke));
}

.raw-strip[hidden] { display: none; }
.raw-strip .f { border-color: color-mix(in srgb, #a3e635 35%, var(--stroke)); }

.raw-tag {
  margin-inline-start: 6px;
  font-size: 10px;
  padding: 1px 6px;
  background: color-mix(in srgb, #a3e635 22%, transparent);
  border-color: color-mix(in srgb, #a3e635 45%, var(--stroke));
}

/* ---------------------------------------------------- تطبيق مدمج (اليومية)
   اللوح بيبقى display:block، فـ height:100% على الإطار بيطلع صفر تقريباً.
   بنستخدم ارتفاع منطقة العرض نفسها — والـ .tab-pane بتاعه بيبقى flex. */
.tab-pane.embed-host {
  display: none;
  height: 100%;
  min-height: 0;
}

.tab-pane.embed-host.on { display: flex; }

.embed-app {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: #fff;
  display: block;
}

/* ---------------------------------------------------- زرار الرئيسية */
.home-chip {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 34px;
  margin-inline-end: 4px;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-mute);
  background: var(--glass-2);
  border: 1px solid var(--stroke);
  transition: background .15s, color .15s, border-color .15s;
}

.home-chip:hover { color: var(--text); background: var(--glass-hi); }

/* أزرق وهو واقف على الرئيسية */
.home-chip.on {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 2px 10px color-mix(in srgb, #2563eb 45%, transparent);
}

/* زرار 🔄 تحديث الشاشة (2026-11-29) — بيلف وهو بيجيب الأرقام، ومابيلزقش في الموبايل فوق زرار الرئيسية */
.tabstrip .home-chip.rf-chip { position: relative !important; inset: auto !important; }
.home-chip.rf-chip.spin svg { animation: rf-spin .7s linear infinite; }
@keyframes rf-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------- اختيار شكل البرنامج */
.theme-card {
  flex: 1;
  min-width: 180px;
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  text-align: start;
  cursor: pointer;
  border-radius: var(--r-md);
  background: var(--glass-2);
  border: 1.5px solid var(--stroke);
  color: var(--text);
  transition: border-color .15s, background .15s;
}

.theme-card:hover { background: var(--glass-hi); }
.theme-card .th-ic { font-size: 22px; }
.theme-card b { font-size: 14px; }
.theme-card small { color: var(--text-mute); font-size: 11.5px; }

.theme-card.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* ---------------------------------------------------- شريط أرقام الفاتورة
   الأرقام طلعت من العمود الشمال لصف واحد فوق — الجدول كسب المساحة. */
.inv-nums {
  /* العميل بقى هنا وقايمته المنسدلة لازم تعلو على خانة البحث والجدول
     اللي بعدها في الترتيب — من غير كده بيغطّوا عليها. */
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 7px;
  margin-bottom: 8px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  background: var(--glass-2);
  border: 1px solid var(--stroke);
}

.inv-nums .nums-level { flex: 0 0 96px; }

/* العميل اتنقل هنا — أعرض من باقي الخانات عشان الأسامي الطويلة تبان */

/* ---------------------------------------------------- ألوان خانات الفاتورة
   لون لكل خانة عشان العين تلاقيها على طول من غير ما تقرا الكلام.
   اللون على الكتابة والإطار، والخلفية لمسة خفيفة بس عشان تفضل مقروءة. */
.nums-partner .f,
.inv-nums #i-disc,
.inv-nums #i-extra,
.inv-nums #t-tax,
.inv-nums #i-paid,
.inv-search {
  font-weight: 700;
  border-width: 2px;
}

.nums-partner .f::placeholder,
.inv-search::placeholder {
  color: var(--text-mute);
  font-weight: 700;
}

/* العميل — أحمر */
.nums-partner .f {
  color: var(--bad);
  font-size: 14.5px;
  border-color: color-mix(in srgb, var(--bad) 80%, var(--stroke));
  background: color-mix(in srgb, var(--bad) 20%, transparent);
}

/* الضريبة — بنفسجي. بقت خانة بشكل خانة الخصم، بس مقفولة للكتابة
   لأنها بتتحسب من نسبة الضريبة بتاعة كل صنف. */
.inv-nums #t-tax {
  color: #57309f;
  border-color: color-mix(in srgb, #6b3fc4 80%, var(--stroke));
  background: color-mix(in srgb, #6b3fc4 22%, transparent);
  cursor: default;
}

/* المدفوع — أخضر. كانت الوحيدة البيضا وسط خانات ملوّنة. */
.inv-nums #i-paid {
  color: #0a6b3d;
  border-color: color-mix(in srgb, #0a6b3d 80%, var(--stroke));
  background: color-mix(in srgb, #0a6b3d 20%, transparent);
}

/* اللون يفضل باين وهي مقفولة (بتتقفل لما الدفع نقدي) */
.inv-nums #i-paid:disabled { opacity: 1; }

/* خصم على الفاتورة — أزرق */
.inv-nums #i-disc {
  color: #0f4fa8;
  border-color: color-mix(in srgb, #1668d6 80%, var(--stroke));
  background: color-mix(in srgb, #1668d6 20%, transparent);
}

/* مصاريف إضافية — أصفر (كهرماني عشان الأصفر الصريح مش بيتقرا) */
.inv-nums #i-extra {
  color: #8a5600;
  border-color: color-mix(in srgb, #d99400 85%, var(--stroke));
  background: color-mix(in srgb, #d99400 30%, transparent);
}

/* خانة البحث عن الصنف — أخضر */
.inv-search {
  color: #08603b;
  border-color: color-mix(in srgb, #0b7a4b 80%, var(--stroke));
  background: color-mix(in srgb, #0b7a4b 18%, transparent);
}
.inv-nums .numfld { flex: 0 0 118px; }
.inv-nums .fld > label { font-size: 10.5px; }
.inv-nums .f { padding: 6px 8px; font-size: 13px; }

.numbox {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 11px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--stroke);
  white-space: nowrap;
}

.numbox > span { font-size: 11.5px; color: var(--text-mute); }
.numbox > b { font-size: 14.5px; }
.numbox.bal > b { font-size: 15px; }
.numbox.bal { border-color: var(--stroke-hi); }

/* العمود الشمال بقى مختصر: الصافي والمدفوع والملاحظات والأوامر */
.inv-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
}

/* «إجمالي الأصناف» طلع للصف الفوقاني — مربع مضغوط بنفس ارتفاع الخانات */
.inv-head-row .numbox.head-sub {
  flex: 0 0 118px;          /* أعرض — الأرقام الكبيرة كانت بتتزنق */
  align-self: flex-end;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 4px 10px;
  border-color: color-mix(in srgb, #6b3fc4 70%, var(--stroke));
  background: color-mix(in srgb, #6b3fc4 16%, transparent);
}

.inv-head-row .numbox.head-sub > span { font-size: 10px; color: #57309f; font-weight: 600; }
.inv-head-row .numbox.head-sub > b { font-size: 15px; color: #57309f; }

/* شارة رقم الفاتورة نزلت أعلى اللوحة */
.inv-side .side-chip {
  align-self: stretch;
  justify-content: center;
  margin-bottom: 8px;
}

/* الصافي جوّه المربع بس على العرض كله وبخط أكبر ولون مميز —
   هو الرقم اللي بيتدفع، مايصحش يبقى زي باقي المربعات */
.inv-side .inv-nums .numbox.net {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  padding: 7px 11px;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--stroke));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.inv-side .inv-nums .numbox.net > span { font-size: 12.5px; color: var(--text); font-weight: 600; }
.inv-side .inv-nums .numbox.net > b { font-size: 20px; font-weight: 700; }

/* أرقام الفاتورة جوّه اللوحة: عمودين مرصوصين — الشريط الأفقي القديم
   ماكانش هيدخل في عرض اللوحة. */
.inv-side .inv-nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 8px 0 0;
  padding: 7px;
  z-index: auto;                /* مفيش قايمة منسدلة هنا بعد ما العميل طلع فوق */
}

.inv-side .inv-nums .numbox,
.inv-side .inv-nums .numfld { min-width: 0; }

.inv-side .inv-nums .numbox {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 5px 8px;
}

.inv-side .inv-nums .numbox > span { font-size: 11.5px; }
.inv-side .inv-nums .numbox > b { font-size: 16px; }
.inv-side .inv-nums .fld > label { font-size: 11.5px; }
.inv-side .inv-nums .f { padding: 7px 9px; font-size: 15px; }

/* الرصيد السابق واللي يبقى عليه — على العرض كله عشان الكلام طويل */
.inv-side .inv-nums .numbox.bal { grid-column: 1 / -1; flex-direction: row;
  align-items: baseline; justify-content: space-between; }

/* ===== محرّر الدفع المقسّم (اختياري) ===== */
#i-split-btn.on { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }
.split-pay { margin-top: 6px; padding: 6px; border: 1px dashed var(--stroke-hi); border-radius: 12px; }
.split-row { display: flex; gap: 4px; margin-bottom: 4px; align-items: center; }
.split-row .meth { flex: 0 0 82px; }
.split-row .box  { flex: 1 1 0; min-width: 0; }
.split-row .amt  { flex: 0 0 70px; }
.split-row .x    { flex: 0 0 26px; padding: 0 !important; min-width: 0; }
.split-row .f { padding: 3px 5px !important; font-size: 11px !important; min-height: 0 !important; height: auto !important; }
.split-sum { display: flex; justify-content: space-between; font-size: 11px; margin-top: 5px; padding: 0 2px; }
.split-sum b { font-weight: 800; }

/* ============================================================
   لوحة أرقام فاتورة البيع (الصافي/الضريبة/الخصم/المصاريف/المدفوع/الربح)
   مضغوطة ~50% (ارتفاع وحشو أنحف + خط أصغر لكن واضح).
   !important عشان تغلب قواعد وضع الموبايل اللي بتفرض ارتفاع 42px.
   ============================================================ */
.inv-side .inv-nums            { gap: 2px !important; padding: 3px !important; margin-top: 4px !important; }
.inv-side .inv-nums .numbox    { padding: 2px 6px !important; gap: 0 !important; }
.inv-side .inv-nums .numbox > span { font-size: 9px !important; line-height: 1.1 !important; }
.inv-side .inv-nums .numbox > b    { font-size: 11.5px !important; line-height: 1.1 !important; }
.inv-side .inv-nums .numbox.net    { padding: 3px 8px !important; }
.inv-side .inv-nums .numbox.net > span { font-size: 10px !important; }
.inv-side .inv-nums .numbox.net > b    { font-size: 13.5px !important; }
.inv-side .inv-nums .fld > label   { font-size: 9px !important; margin-bottom: 0 !important; line-height: 1.05 !important; }
.inv-side .inv-nums .f             { padding: 2px 6px !important; font-size: 11.5px !important; line-height: 1.15 !important; min-height: 0 !important; height: auto !important; }

/* أزرار التنقّل: الستة في صف واحد زي ما كانوا فوق */
.inv-side .inv-nav {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 2px;
  align-self: stretch;
}

.inv-side .inv-nav .btn.sm {
  min-width: 0;
  padding: 3px 1px;
  gap: 1px;
}

.inv-side .inv-nav .btn.sm > span { font-size: 8.5px; }
.inv-side .inv-nav .btn.sm > i { font-size: 11px; }

/* عمودين — زرارين في كل صف */
.inv-side .inv-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: auto;
  padding: 10px 0 0;
  position: static;
  background: none;
  border: 0;
  box-shadow: none;
}

/* الحفظ لوحده على العرض كله — أهم زرار وأكتر واحد بيتداس */
.inv-side #i-save { grid-column: 1 / -1; }

/* لو باقي الأزرار عددها فردي، الأخير يمدّ على العرض بدل ما يقف
   لوحده في نص صف (بيحصل في عرض السعر، ومع مستخدم مالوش صلاحية حذف) */
.inv-side .inv-actions .act:last-child:nth-child(even) { grid-column: 1 / -1; }

.inv-side .act {
  width: 100%;
  justify-content: flex-start;
  gap: 5px;
  padding: 6px 6px;
  font-size: 11.5px;
  min-width: 0;
  white-space: nowrap;          /* سطر واحد — كلهم بنفس الارتفاع */
  overflow: hidden;
  line-height: 1.2;
}

.inv-side .act span { font-size: 14px; flex: 0 0 auto; }

/* «حفظ» في نص الزرار — أهم زرار وهو ماخد العرض كله.
   الاختصار مثبّت على الجنب بـposition عشان ميزحّقش الكلمة عن النص. */
.inv-side #i-save {
  position: relative;
  justify-content: center;
  padding: 9px 8px;
  font-size: 13.5px;
}

.inv-side #i-save span { font-size: 17px; }

.inv-side #i-save kbd {
  position: absolute;
  inset-inline-start: 9px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

/* الاختصار في آخر الزرار وصغير — مش محتاج ياخد مساحة الاسم.
   flex:0 0 auto ضروري: من غيره الزرار الضيّق كان بيضغطه لعرض صفر فيختفي. */
.inv-side .act kbd {
  flex: 0 0 auto;
  margin-inline-start: auto;
  padding: 1px 4px;
  font-size: 10px;
  opacity: .6;
}

/* الجدول ياخد الطول المتاح كله */
.inv-lines-wrap { max-height: min(62vh, 560px); }

/* زرار حذف الفاتورة — أحمر وواضح إنه مختلف عن الباقي */
.inv-side .act.danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 40%, var(--stroke));
}

.inv-side .act.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--bad) 16%, transparent);
}

.inv-side .act.danger:disabled { opacity: .38; cursor: not-allowed; }

/* ---------------------------------------------------- شاشة التوقّعات */
.bar-list { display: grid; gap: 9px; }

.bar-h { display: flex; align-items: center; gap: 10px; }
.bar-h .lb { flex: 0 0 76px; font-size: 13px; color: var(--text-mute); }
.bar-h .track { flex: 1; height: 9px; border-radius: 9px; background: var(--glass-2); overflow: hidden; }
.bar-h .track > i { display: block; height: 100%; border-radius: 9px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar-h > b { flex: 0 0 110px; text-align: end; }

/* ---------------------------------------------------- خانات كلمة السر */
.pw-wrap { position: relative; display: flex; }
.pw-wrap > .f { flex: 1; padding-inline-end: 38px; }
.pw-wrap > .f::-ms-reveal { display: none; }   /* إيدج بيحط عين تانية جنب زرار البرنامج */

.pw-eye {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  opacity: .6;
}

.pw-eye:hover, .pw-eye.on { opacity: 1; background: var(--glass-hi); }

/* القايمة المنسدلة لازم تطلع فوق الكروت اللي تحتها.
   .glass فيها backdrop-filter وده بيعمل سياق رسم مستقل، فالكارت
   اللي بعدها كان بيغطي القايمة مهما كان z-index بتاعها. */
.pick-host { position: relative; z-index: 20; }

/* خانة مبلغ السند — أكبر عشان هي المهمة في الشاشة */
.vc-amount { font-size: 20px !important; padding: 12px 12px !important; font-weight: 700; }

/* ---------------------------------------------------- نوافذ الإضافة المجمّعة */
.box {
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 10px 12px 12px;
  margin: 0 0 12px;
  background: var(--glass-2);
}

.box > legend {
  padding: 2px 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--glass-hi);
  border: 1px solid var(--stroke);
  border-radius: 7px;
}

.box .fld { margin-bottom: 8px; }
.box .fld:last-child { margin-bottom: 0; }

.radios { display: flex; gap: 14px; align-items: center; padding: 6px 0; }
.rad { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 13px; }
.rad input { accent-color: var(--accent); width: 15px; height: 15px; }

.pd-head { margin-bottom: 12px; }
.pd-grid { align-items: start; }

/* ---------------------------------------------------- الخط العريض
   خانات الإدخال والأزرار مابتورّثش خط الصفحة افتراضياً — الفورم بيستعمل
   خط النظام. فبنجبرها تاخد نفس الخط والوزن. */
input, select, textarea, button, kbd, table, th, td {
  font-family: inherit;
  font-weight: 700;
}

/* الكلام الخافت والتسميات — عريض برضه بس بلونه الخافت عشان يفضل
   واضح إنه شرح مش قيمة */
.hint, .dim, label, .fld > label, small,
.numbox > span, .tile small, .brand-txt small { font-weight: 700; }

/* ---------------------------------------------------- التعديل الجماعي */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 8px 11px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--stroke));
}

.bulk-bar > b { font-size: 13.5px; }

/* عمود التحديد ضيّق، والمربع أكبر شوية عشان يتداس بسهولة */
.tbl td:has(> .it-pick), .tbl th:first-child:empty { width: 34px; text-align: center; }
.it-pick { width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent); }

/* ---------------------------------------------------- جدول وحدات الصنف */
.u-tbl th { white-space: nowrap; font-size: 12px; }
.u-tbl td { padding: 4px 6px; }
.u-tbl .f { padding: 5px 7px; font-size: 13px; }

/* سطر الوحدة الأساسية — للعرض بس، مميّز عشان يبان إنه مش بيتعدّل */
.u-tbl tr.u-base > td {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.u-tbl .x { cursor: pointer; padding: 0 3px; opacity: .6; }
.u-tbl .x:hover { opacity: 1; }

/* وحدة الإنتاج «وجبه» — بتتحدد في التصنيع ومابتظهرش في البيع */
.u-tbl tr.u-batch > td {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

/* ===== شاشة البداية: اختيار البرنامج ===== */
.launcher-grid{grid-template-columns:repeat(auto-fit,minmax(230px,1fr));max-width:1060px;margin:5vh auto 0;gap:20px}
.launcher-grid .app-tile{padding:34px 20px;min-height:210px;justify-content:center}
.launcher-grid .app-tile .t-ic{font-size:54px;margin-bottom:6px}
.launcher-grid .app-tile b{font-size:20px}
.launcher-grid .app-tile small{font-size:13px;opacity:.75}

/* شريط البرنامج الحالي فوق الشبكة */
.zone-bar{display:flex;align-items:center;gap:10px;margin-bottom:14px}
.zone-now{font-weight:700;font-size:15px;opacity:.85}
.zone-bar .btn{margin-inline-start:auto}

/* أيقونة الإعدادات تحت البرنامجين */
.setup-row{margin-top:18px;max-width:380px}
.setup-tile{min-height:150px!important;padding:22px 18px!important}
.setup-tile .t-ic{font-size:38px!important}
.setup-tile b{font-size:17px!important}

/* ===== إطار التصنيع: واحد مشترك بيغطّي لوح التبويب النشط ===== */
#view{position:relative}
#masnaa-host{position:absolute;inset:0;display:none;z-index:2;background:var(--bg,#fff)}
#masnaa-host.on{display:block}
#masnaa-host iframe{width:100%;height:100%;border:0;display:block}
.tab-pane.masnaa-pane{min-height:100%}


/* ===== إطارات البرامج المدموجة ===== */
.emb-host{position:absolute;inset:0;display:none;z-index:2;background:var(--bg,#fff)}
.emb-host.on{display:block}
/* (2026-10-26) القسم المستخبّي (تصنيع/مرتبات/يومية/تاب تركيبة) بيفضل محتفظ بترتيبه من غير ما يترسم —
   مع display:none المتصفح كان بيرمي ترتيب الإطار ويعيد حسابه كله مع كل رجوع (اليومية ~26 ألف عنصر = 0.15–0.45ث) */
#view>.emb-host:not(.on):not(.mv-prev){display:block;content-visibility:hidden;visibility:hidden;pointer-events:none}
/* وتاب الحسابات المستخبّي كمان (2026-10-26): بيفضل في مكانه بارتفاع صفر ومحتفظ بترتيبه (نفس display بتاع الظاهر
   — ui.css) — الرجوع ليه مابيعيدش حساب الشاشة كلها. أي كود بيسأل «التاب ده ظاهر؟» يسأل بالكلاس
   (`.tab-pane.on`) مش بالمقاس — الحاجة جوه التاب المستخبّي ليها مقاس.
   min-height:0 (2026-10-27): تاب القسم المدمج (`.masnaa-pane` = min-height:100%) كان بيغلب height:0 وهو مستخبّي
   فبياخد طول الشاشة فاضي ويزق التاب اللي بعده لتحت (فاتورة الشراء نزلت لآخر الشاشة بعد تاب «المخزن الرئيسي»). */
#view>.tab-pane:not(.on):not(.mv-prev){display:flex;flex-direction:column;gap:var(--u-gap,10px);content-visibility:hidden;visibility:hidden;height:0;min-height:0;margin:0;overflow:hidden;pointer-events:none}
@media print{#view>.tab-pane:not(.on){display:none!important}}
/* (2026-12-02) التاب المستخبّي مالوش حركة شغّالة: نجوم الجو ونبضات العقل المدبر كانت فاضلة شغّالة (42 حركة)
   وهو ورا الرئيسية. ده بيوقّف حركات الـCSS بس — انتقالات motion.js بالـWeb Animations ومش بتتأثر. */
#view>.tab-pane:not(.on):not(.mv-prev),#view>.tab-pane:not(.on):not(.mv-prev) *{animation-play-state:paused!important}
.emb-host iframe{width:100%;height:100%;border:0;display:block;position:relative;z-index:1}

/* (2026-12-02) طلب المالك: «علامة تحميل أفضل من الشاشات البيضاء»
   ١) الشاشة اللي لسه بتجيب بياناتها: علامة أوضح + هيكل باهت للشاشة بيلمع (بدل الفراغ) */
.tab-pane>.loading{padding:52px 20px 20px;font-weight:700}
.tab-pane>.loading .spin{width:34px;height:34px;border-width:3px;margin-bottom:14px}
.tab-pane>.loading::after{content:"";display:block;max-width:760px;height:160px;margin:22px auto 0;border-radius:18px;opacity:.6;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.6),transparent) -60% 0/45% 100% no-repeat,
    linear-gradient(var(--stroke),var(--stroke)) 0 0/100% 34px no-repeat,
    linear-gradient(var(--stroke),var(--stroke)) 100% 52px/86% 20px no-repeat,
    linear-gradient(var(--stroke),var(--stroke)) 100% 86px/72% 20px no-repeat,
    linear-gradient(var(--stroke),var(--stroke)) 100% 120px/58% 20px no-repeat;
  animation:hpSkel 1.3s ease-in-out infinite}
@keyframes hpSkel{to{background-position:160% 0,0 0,100% 52px,100% 86px,100% 120px}}
/* ٢) القسم المدمج (تصنيع/موارد بشرية) لحد ما يفتح: علامة تحميل ورا الإطار بدل المساحة الفاضية */
#view>.emb-host.on:not(.ready)::before{content:"";position:absolute;top:38%;left:50%;width:34px;height:34px;margin:-17px 0 0 -17px;
  border:3px solid var(--stroke);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite;z-index:0}
#view>.emb-host.on:not(.ready)::after{content:"بيفتح القسم…";position:absolute;top:calc(38% + 30px);inset-inline:0;text-align:center;color:var(--text-mute);font-weight:700;z-index:0}
/* ٣) أي طلب للسيرفر بياخد أكتر من ربع ثانية: شريط رفيع بيلف فوق (مهم على السحابة) */
html.api-busy::before{content:"";position:fixed;top:0;left:0;right:0;height:3px;z-index:100000;pointer-events:none;
  background:linear-gradient(90deg,transparent,var(--accent,#16a34a),transparent) 0 0/35% 100% no-repeat;animation:hpBar 1.1s ease-in-out infinite}
@keyframes hpBar{from{background-position:-40% 0}to{background-position:140% 0}}
@media print{html.api-busy::before{display:none}}

/* ================================================================
   نظام الشاشات — لاب / تابلت / تليفون
   البرنامج واحد بيتأقلم مع حجم الشاشة: القوائم مابتختفيش،
   الجداول بتتزحلق بدل ما تتقص، والأزرار بحجم يناسب اللمس.
   ================================================================ */

/* ---------- تابلت (لحد 1024) ---------- */
@media (max-width: 1024px) {html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .home-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .launcher-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); max-width: 100%; margin-top: 3vh; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-layout { grid-template-columns: 1fr; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .g-4, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .g-3, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .g-2 { grid-template-columns: repeat(2, 1fr) !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .view { padding-inline: 6px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* الجداول تتزحلق بدل ما تتقص */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tbl-wrap table { min-width: 640px; }
}

/* ---------- تليفون (لحد 760) ---------- */
@media (max-width: 760px) {html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* شريط التبويبات: يتزحلق ويفضل باين — الأزرار الثابتة ماتختفيش */
  .tabstrip { gap: 5px; padding-bottom: 4px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tabstrip .home-chip { position: sticky; inset-inline-start: 0; z-index: 4; flex: 0 0 auto; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tab-chip { flex: 0 0 auto; max-width: 46vw; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tab-chip span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tab-chip .num { display: none; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* الشبكات عمودين */
  .home-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tile { padding: 13px 10px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tile .t-ic { font-size: 26px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tile b { font-size: 13px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tile small { display: none; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .launcher-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 2vh; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .launcher-grid .app-tile { min-height: 150px; padding: 18px 12px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .launcher-grid .app-tile .t-ic { font-size: 34px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .launcher-grid .app-tile b { font-size: 15px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .launcher-grid .app-tile small { display: block; font-size: 11px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* بطاقات الأرقام والصفوف */
  .g-4, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .g-3, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .g-2 { grid-template-columns: 1fr !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .kpi .num { font-size: 21px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .row { gap: 8px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .row > .fld { min-width: 100%; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* كل خانة سطر لوحدها */
  .row.compact > .fld { min-width: 46%; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* حجم مريح للّمس */
  .f, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .btn, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) select.f, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) input.f { min-height: 42px; font-size: 15px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .btn.sm { min-height: 36px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) kbd { display: none; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* اختصارات الكيبورد مالهاش لازمة */

  /* النوافذ تاخد الشاشة */
  .modal { --w: 96vw !important; max-height: 92vh; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .modal .body { max-height: 70vh; overflow-y: auto; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* الجداول */
  .tbl-wrap table { min-width: 560px; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .view { padding-inline: 4px; }
}

/* ---------- تليفون صغير ---------- */
@media (max-width: 420px) {html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .home-grid { grid-template-columns: repeat(2, 1fr); }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .launcher-grid { grid-template-columns: 1fr; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tab-chip { max-width: 40vw; }
}

/* ---------- اللمس عموماً (مش بالحجم) ---------- */
@media (hover: none) and (pointer: coarse) {
  .tile, .btn, .nav-item, .tab-chip { -webkit-tap-highlight-color: transparent; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
}

/* ================================================================
   القوائم المنسدلة لازم تغطّي اللي تحتها — مش العكس
   المشكلة إن الكروت بتعمل طبقات مستقلة (backdrop-filter)، فالقايمة
   كانت بتتدفن وراها. الحل: نرفع القايمة والكارت اللي فيه وقت الفتح.
   ================================================================ */
.pick-list { z-index: 900 !important; }
.pick { position: relative; }
.pick:focus-within { z-index: 900; }

/* نرفع الحاوية نفسها وقت ما القايمة مفتوحة — وإلا الكارت اللي بعدها يغطّيها */
.card:has(.pick-list), .glass:has(.pick-list),
.card:has(.pick:focus-within), .glass:has(.pick:focus-within),
.tab-pane:has(.pick-list) { position: relative; z-index: 900; }

/* الصف اللي فيه خانة البحث ما يقصّش القايمة */
.row:has(.pick-list), .row:has(.pick:focus-within) { overflow: visible !important; }

/* على التليفون: القايمة تاخد عرض مريح وتفضل فوق كل حاجة */
@media (max-width: 760px) {html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .pick-list { max-height: 46vh; z-index: 950 !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-layout > .card:has(.pick-list), html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-layout > .glass:has(.pick-list) { z-index: 950; }
}

/* ===== شاشة صلاحيات المستخدم — مجموعة لكل برنامج ===== */
.perm-zone { border: 1px solid var(--stroke); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.perm-zone .zone-head { display: flex; align-items: center; gap: 9px; padding: 11px 13px;
  cursor: pointer; background: var(--glass-hi); font-size: 14px; }
.perm-zone .zone-head .zone-ic { font-size: 19px; }
.perm-zone .zone-head small { margin-inline-start: auto; color: var(--text-mute); font-size: 11px; }
.perm-zone .zone-body { display: none; padding: 11px 13px; border-top: 1px solid var(--stroke); }
.perm-zone.on .zone-body { display: block; }
.perm-zone.on { border-color: var(--accent); }
@media (max-width: 760px) {html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .perm-zone .zone-body .grid.g-2 { grid-template-columns: 1fr !important; }
}

/* ================================================================
   أوضاع العرض اليدوية — المستخدم يختار حسب جهازه
   auto = حسب حجم الشاشة (الافتراضي)
   phone · tablet (طولي) · tablet-land (عرضي) · laptop
   ================================================================ */

/* ---------- آيفون / موبايل ---------- */
html.view-phone .home-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 9px; }
html.view-phone .launcher-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
html.view-phone .g-4, html.view-phone .g-3, html.view-phone .g-2 { grid-template-columns: 1fr !important; }
html.view-phone .inv-layout { grid-template-columns: 1fr !important; }
html.view-phone .row > .fld { min-width: 100% !important; }
html.view-phone .tile small { display: none; }
html.view-phone .tile .t-ic { font-size: 26px; }
html.view-phone .tile b { font-size: 13px; }
html.view-phone .f, html.view-phone .btn { min-height: 42px; font-size: 15px; }
html.view-phone kbd { display: none; }
html.view-phone .tab-chip { max-width: 44vw; }
html.view-phone .tab-chip .num { display: none; }
html.view-phone .modal { --w: 96vw !important; }
html.view-phone .tbl-wrap { overflow-x: auto; }
html.view-phone .tbl-wrap table { min-width: 540px; }

/* ---------- تابلت بالطول ---------- */
html.view-tablet .home-grid { grid-template-columns: repeat(3, 1fr) !important; }
html.view-tablet .launcher-grid { grid-template-columns: repeat(2, 1fr) !important; }
html.view-tablet .g-4, html.view-tablet .g-3 { grid-template-columns: repeat(2, 1fr) !important; }
html.view-tablet .inv-layout { grid-template-columns: 1fr !important; }
html.view-tablet .row > .fld { min-width: 46% !important; }
html.view-tablet .f, html.view-tablet .btn { min-height: 40px; }
html.view-tablet .tbl-wrap { overflow-x: auto; }
html.view-tablet .tbl-wrap table { min-width: 640px; }

/* ---------- تابلت بالعرض ---------- */
html.view-tablet-land .home-grid { grid-template-columns: repeat(4, 1fr) !important; }
html.view-tablet-land .launcher-grid { grid-template-columns: repeat(4, 1fr) !important; }
html.view-tablet-land .g-4 { grid-template-columns: repeat(3, 1fr) !important; }
html.view-tablet-land .g-3, html.view-tablet-land .g-2 { grid-template-columns: repeat(2, 1fr) !important; }
html.view-tablet-land .inv-layout { grid-template-columns: 1fr 280px !important; }
html.view-tablet-land .f, html.view-tablet-land .btn { min-height: 38px; }
html.view-tablet-land .tbl-wrap { overflow-x: auto; }

/* ---------- لاب توب (العرض الكامل مهما كانت الشاشة) ---------- */
html.view-laptop .home-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important; }
html.view-laptop .launcher-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)) !important; }
html.view-laptop .g-4 { grid-template-columns: repeat(4, 1fr) !important; }
html.view-laptop .g-3 { grid-template-columns: repeat(3, 1fr) !important; }
html.view-laptop .g-2 { grid-template-columns: repeat(2, 1fr) !important; }
html.view-laptop .inv-layout { grid-template-columns: 1fr 300px !important; }
html.view-laptop .tile small { display: block; }
html.view-laptop kbd { display: inline-block; }
html.view-laptop .tab-chip { max-width: none; }
html.view-laptop .tab-chip .num { display: inline-block; }

/* ================================================================
   أمان الشاشات الضيقة — منع أي تمدد أفقي
   المشكلة: خانات كتير مكتوب فيها عرض ثابت جوه الماركب (flex:0 0 150px)
   وده كان بيتغلب على قواعد الموبايل فيخرج المحتوى بره الشاشة.
   ================================================================ */
@media (max-width: 760px) {html, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) body { overflow-x: hidden; max-width: 100%; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .view, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .tab-pane, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .card, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .glass, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-layout { max-width: 100%; min-width: 0; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .row { flex-wrap: wrap !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .row > * { max-width: 100% !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* نكسر أي عرض ثابت متكتوب في الماركب */
  .row > [style*="flex:0 0"], html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .row > [style*="flex: 0 0"] { flex: 1 1 100% !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .row > .fld { flex: 1 1 100% !important; min-width: 0 !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .row.compact > .fld { flex: 1 1 47% !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .f, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) input.f, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) select.f, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) textarea.f { max-width: 100%; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .numbox, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-kind-chip, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .head-sub { max-width: 100% !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .inv-head-row { flex-wrap: wrap !important; }html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) /* جداول السطور: تتزحلق جوه إطارها بس */
  .tbl-wrap, html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) .lines-wrap { overflow-x: auto !important; max-width: 100%; }
}

/* نفس الأمان لوضع «موبايل» اليدوي مهما كان عرض الشاشة */
html.view-phone .row { flex-wrap: wrap !important; }
html.view-phone .row > * { max-width: 100% !important; }
html.view-phone .row > [style*="flex:0 0"],
html.view-phone .row > [style*="flex: 0 0"] { flex: 1 1 100% !important; }
html.view-phone .row > .fld { flex: 1 1 100% !important; min-width: 0 !important; }
html.view-phone .row.compact > .fld { flex: 1 1 47% !important; }
html.view-phone .numbox, html.view-phone .inv-kind-chip { max-width: 100% !important; }
html.view-phone .view, html.view-phone .card, html.view-phone .glass { max-width: 100%; min-width: 0; }
html.view-phone .tbl-wrap { overflow-x: auto !important; }

/* تابلت بالطول — نفس المنطق بعرض أوسع شوية */
html.view-tablet .row > [style*="flex:0 0"],
html.view-tablet .row > [style*="flex: 0 0"] { flex: 1 1 47% !important; }
html.view-tablet .row > .fld { flex: 1 1 47% !important; min-width: 0 !important; }

/* ================================================================
   تحسينات موبايل (2026): تثبيت العمود الأول في الجداول العريضة عشان
   الاسم يفضل باين وإنت بتزحلق أفقي + هامش جانبي مريح. بتشتغل في
   الوضع التلقائي (شاشة صغيرة) وفي وضع «آيفون» اليدوي.
   ================================================================ */
@media (max-width: 760px) {
  .view { padding-inline: 11px; }
  .tbl-wrap .tbl th:first-child,
  .tbl-wrap .tbl td:first-child {
    position: sticky; inset-inline-start: 0; z-index: 2;
    background: var(--glass);
  }
  .tbl-wrap .tbl thead th:first-child { z-index: 3; }
}
html.view-phone .view { padding-inline: 11px; }
html.view-phone .tbl-wrap .tbl th:first-child,
html.view-phone .tbl-wrap .tbl td:first-child {
  position: sticky; inset-inline-start: 0; z-index: 2;
  background: var(--glass);
}
html.view-phone .tbl-wrap .tbl thead th:first-child { z-index: 3; }

/* التحويل والتسوية بالوحدات (2026-10-19): اسم الصنف المثبّت كان واخد تلتين الإطار
   على الموبايل وبيغطّي خانة الوحدة والكمية — بيتلف في عرض أقل */
@media (max-width: 760px) {
  .stock-lines th:first-child,
  .stock-lines td:first-child { width: 32vw !important; min-width: 32vw; max-width: 32vw; }
}
html.view-phone .stock-lines th:first-child,
html.view-phone .stock-lines td:first-child { width: 32vw !important; min-width: 32vw; max-width: 32vw; }
.stock-lines td select.f { min-width: 96px; }       /* «رابطه» كانت بتتقص «رابط» */

/* ================================================================
   إصلاحات موبايل (2026): (١) شريط تبويبات الإعدادات .seg يلفّ لأكتر من
   صف بدل ما يخرج بره الشاشة. (٢) .view (الحاوية اللي بتتزحلق) نقفل
   تزحلقها الأفقي خالص — الجداول بتفضل تتزحلق جوّه إطارها .tbl-wrap.
   ================================================================ */
@media (max-width: 760px) {
  .seg { display: flex; flex-wrap: wrap; width: 100%; }
  .seg button { flex: 1 1 auto; text-align: center; }
  .view { overflow-x: hidden; }
}
html.view-phone .seg { display: flex; flex-wrap: wrap; width: 100%; }
html.view-phone .seg button { flex: 1 1 auto; text-align: center; }
html.view-phone .view { overflow-x: hidden; }
/* (2026-10-27) شريط تابات الإعدادات بيلف لأي عرض مايكفيهوش — على التابلت (800) كان عرضه 1232
   وبيزحلق الشاشة كلها للجنب */
#s-tabs.seg { display: flex; flex-wrap: wrap; }

/* ================================================================
   قائمة الأصناف على الشاشات الضيقة — سطرين مرتبين

   السطر الأول: اسم الصنف + السعر (خط عادي وواضح)
   السطر التاني: الرصيد والتصنيف بخط أصغر وباهت — معلومات مساعدة
   كل عنصر في خانته الخاصة عشان مايركبوش على بعض.
   ================================================================ */
@media (max-width: 760px) {
  .pick-list.cols div.opt.head { display: none; }
  .pick-list.cols div.opt {
    grid-template-columns: auto auto 1fr auto !important;
    grid-template-areas: "name name name price" "s2 s3 s4 s4" !important;
    gap: 2px 7px !important;
    padding: 10px 12px !important;
    align-items: baseline !important;
  }
  .pick-list.cols div.opt > span:nth-child(1) {
    grid-area: name; font-size: 14px; font-weight: 600;
    white-space: normal; line-height: 1.3;
  }
  .pick-list.cols div.opt > span:nth-child(5) {
    grid-area: price; font-size: 14px; font-weight: 700; white-space: nowrap;
  }
  .pick-list.cols div.opt > span:nth-child(2) { grid-area: s2; }
  .pick-list.cols div.opt > span:nth-child(3) { grid-area: s3; }
  .pick-list.cols div.opt > span:nth-child(4) { grid-area: s4; }
  .pick-list.cols div.opt > span:nth-child(2),
  .pick-list.cols div.opt > span:nth-child(3),
  .pick-list.cols div.opt > span:nth-child(4) {
    font-size: 11px; opacity: .68; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
  }
  .pick-list.cols div.opt > span:nth-child(3)::before { content: "الكل "; opacity: .7; }
  .pick-list.cols div.opt > span:nth-child(4) { text-align: start; }
  .pick-list { max-height: 44vh; }
}

/* نفس التصميم لوضع «موبايل» اليدوي */
html.view-phone .pick-list.cols div.opt.head { display: none; }
html.view-phone .pick-list.cols div.opt {
  grid-template-columns: auto auto 1fr auto !important;
  grid-template-areas: "name name name price" "s2 s3 s4 s4" !important;
  gap: 2px 7px !important; padding: 10px 12px !important; align-items: baseline !important;
}
html.view-phone .pick-list.cols div.opt > span:nth-child(1) { grid-area: name; font-size: 14px; font-weight: 600; white-space: normal; }
html.view-phone .pick-list.cols div.opt > span:nth-child(5) { grid-area: price; font-size: 14px; font-weight: 700; }
html.view-phone .pick-list.cols div.opt > span:nth-child(2) { grid-area: s2; }
html.view-phone .pick-list.cols div.opt > span:nth-child(3) { grid-area: s3; }
html.view-phone .pick-list.cols div.opt > span:nth-child(4) { grid-area: s4; }
html.view-phone .pick-list.cols div.opt > span:nth-child(2),
html.view-phone .pick-list.cols div.opt > span:nth-child(3),
html.view-phone .pick-list.cols div.opt > span:nth-child(4) { font-size: 11px; opacity: .68; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* تابلت بالطول: نشيل التصنيف ونضيّق الباقي */
html.view-tablet .pick-list.cols div.opt {
  grid-template-columns: minmax(0,1fr) 92px 74px 76px !important;
}
html.view-tablet .pick-list.cols div.opt > span:nth-child(4) { display: none; }

/* ================================================================
   القوايم المنسدلة على الموبايل — تحت الخانة اللي بتكتب فيها (2026-11-07)

   قبل كده كانت «ورقة» ثابتة فوق الكيبورد بقياس طوله (--kb)، وعلى الآيفون
   القياس كان بيطلع غلط فالقايمة تقع ورا الكيبورد (شكوى المالك).
   دلوقتي القايمة في الـbody (عشان الكروت الزجاجية ماتحبسهاش) ومكانها
   وطولها بيتحسبوا في app.js (placePick): تحت الخانة مباشرة، وطولها
   = المساحة الباينة لحد الكيبورد. القوايم التانية بتفضل منسدلة عادي.
   ================================================================ */
@media (max-width: 760px) {
  .pick-list { max-height: 44vh; }
}
body > .pick-list.pick-sheet:not(#_) {
  position: fixed !important;
  inset-inline: 8px !important;
  bottom: auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  border-radius: 14px !important;
  border: 2px solid var(--accent) !important;
  background: var(--bg-2) !important;
  box-shadow: 0 12px 32px rgba(0,0,0,.30) !important;
  z-index: 9999 !important;
}
:root[data-theme="light"] body > .pick-list.pick-sheet:not(#_) { background: #fff !important; }
body > .pick-list.pick-sheet div.opt { padding: 12px 11px; }   /* سطر أعلى = لمسة أسهل */

/* ================================================================
   البوانص — هدايا على الكميات
   ================================================================ */
.bn-wrap { display: flex; flex-direction: column; gap: 16px; }
.bn-load { padding: 40px; text-align: center; color: var(--text-mute); }

.bn-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(120deg, #fb7185 0%, #f472b6 55%, #c084fc 100%);
  border-radius: var(--r-md); padding: 16px 18px; color: #fff;
  box-shadow: 0 8px 26px rgba(244, 114, 182, .3);
}
.bn-title { display: flex; align-items: center; gap: 12px; }
.bn-ic { font-size: 32px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.bn-title b { font-size: 19px; display: block; }
.bn-title small { font-size: 12px; opacity: .9; }
.bn-kpis { display: flex; gap: 9px; margin-inline-start: auto; }
.bn-kpi {
  background: rgba(255,255,255,.22); backdrop-filter: blur(6px);
  border-radius: 12px; padding: 8px 15px; text-align: center; min-width: 62px;
}
.bn-kpi b { display: block; font-size: 20px; line-height: 1.1; }
.bn-kpi span { font-size: 10.5px; opacity: .92; }
.bn-head .bn-new {
  background: #fff !important; color: #be185d !important;
  border: none !important; font-weight: 800;
}

.bn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 13px; }

.bn-card {
  border-radius: 15px; padding: 14px; color: #fff; position: relative;
  display: flex; flex-direction: column; gap: 11px;
  box-shadow: 0 5px 18px rgba(0,0,0,.16); transition: transform .15s, box-shadow .15s;
}
.bn-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.24); }
.bn-card.c0 { background: linear-gradient(140deg, #f43f5e, #fb7185); }
.bn-card.c1 { background: linear-gradient(140deg, #7c3aed, #a78bfa); }
.bn-card.c2 { background: linear-gradient(140deg, #0891b2, #22d3ee); }
.bn-card.c3 { background: linear-gradient(140deg, #ea580c, #fb923c); }
.bn-card.c4 { background: linear-gradient(140deg, #15803d, #4ade80); }
.bn-card.off { filter: grayscale(.85); opacity: .62; }

.bn-c-top { display: flex; align-items: flex-start; gap: 8px; }
.bn-item { font-size: 15px; font-weight: 800; line-height: 1.5; flex: 1; }

/* مفتاح التشغيل */
.bn-sw { flex: 0 0 auto; cursor: pointer; }
.bn-sw input { display: none; }
.bn-sw i {
  display: block; width: 38px; height: 21px; border-radius: 20px;
  background: rgba(0,0,0,.28); position: relative; transition: background .2s;
}
.bn-sw i::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
  transition: inset-inline-start .2s;
}
.bn-sw input:checked + i { background: rgba(255,255,255,.55); }
.bn-sw input:checked + i::after { inset-inline-start: 20px; }

.bn-rule {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.18); border-radius: 12px; padding: 11px 13px;
}
.bn-n { text-align: center; }
.bn-n b { display: block; font-size: 25px; line-height: 1; font-weight: 900; }
.bn-n span { font-size: 10px; opacity: .9; }
.bn-n.free b { color: #fef08a; }
.bn-arrow { font-size: 17px; opacity: .8; }
.bn-unit {
  margin-inline-start: auto; font-size: 12px; font-weight: 700;
  background: rgba(0,0,0,.22); border-radius: 20px; padding: 4px 11px;
}

.bn-c-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.bn-c-foot .sp { flex: 1; }
.bn-pct { background: #fef08a; color: #713f12; font-weight: 800;
          border-radius: 20px; padding: 3px 10px; }
.bn-note { opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100px; }
.bn-e, .bn-d {
  border: none; background: rgba(255,255,255,.2); color: #fff; cursor: pointer;
  border-radius: 8px; width: 28px; height: 26px; font-size: 12px;
}
.bn-e:hover { background: rgba(255,255,255,.38); }
.bn-d:hover { background: rgba(220,38,38,.8); }

.bn-empty { grid-column: 1/-1; text-align: center; padding: 46px 20px;
            color: var(--text-mute); }
.bn-empty .e-ic { font-size: 52px; margin-bottom: 10px; }
.bn-empty b { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }
.bn-empty p { font-size: 13px; margin: 0; }

/* نافذة الإضافة */
.bn-form { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.bn-form .f { display: flex; flex-direction: column; gap: 5px; position: relative; min-width: 0; }
.bn-form .f.full { grid-column: 1/-1; }
.bn-form label { font-size: 12px; font-weight: 700; color: var(--text-mute); }
.bn-form small { font-size: 10.5px; color: var(--text-mute); }
.bn-dd {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--bg-2); border: 1px solid var(--stroke-hi);
  border-radius: 11px; box-shadow: var(--shadow); max-height: 240px;
  overflow-y: auto; padding: 5px;
}
.bn-dd[hidden] { display: none; }
.bn-o {
  display: flex; width: 100%; align-items: center; gap: 8px; text-align: start;
  padding: 8px 11px; border: none; background: transparent; border-radius: 8px;
  cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text);
}
.bn-o:hover { background: var(--glass-hi); }
.bn-o span { margin-inline-start: auto; font-size: 11px; color: var(--text-mute); }
.bn-none { padding: 14px; text-align: center; color: var(--text-mute); font-size: 12px; }

.bn-prev {
  background: var(--bg-2); border: 1px dashed var(--stroke-hi); border-radius: 11px;
  padding: 12px 14px; font-size: 13px; color: var(--text-mute); text-align: center;
}
.bn-prev.ok {
  background: linear-gradient(120deg, #fdf2f8, #f5f3ff); border-style: solid;
  border-color: #f9a8d4; color: #831843;
}
.bn-prev b { color: #be185d; }
.bn-prev .p { background: #fef08a; color: #713f12; border-radius: 20px;
              padding: 2px 9px; font-weight: 800; margin-inline-start: 5px; }

@media (max-width: 560px) { .bn-form { grid-template-columns: 1fr; } }

/* سطر البونص في الفاتورة */
tr.bn-hint td { padding: 0 !important; border: none !important; }
.bn-tip {
  display: inline-block; margin: 0 0 6px; padding: 4px 11px; font-size: 11.5px;
  background: color-mix(in srgb, #f472b6 12%, transparent); color: #be185d;
  border-radius: 20px;
}
tr.bn-hint.on td { padding: 0 0 7px !important; }
.bn-go {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: linear-gradient(120deg, #fdf2f8, #fae8ff);
  border: 1px solid #f9a8d4; border-radius: 10px; padding: 7px 13px;
  font-size: 12.5px; color: #831843; font-weight: 700;
  box-shadow: 0 2px 8px rgba(244,114,182,.18);
}
.bn-go:hover { border-color: #f472b6; }
.bn-go input { width: 17px; height: 17px; accent-color: #db2777; cursor: pointer; margin: 0; }
.bn-go b { color: #be185d; }
tr.bn-line { background: color-mix(in srgb, #f472b6 8%, transparent); }
.bonus-tag { background: #fce7f3 !important; color: #be185d !important; }

/* ================================================================
   الفوارغ — الشكاير والكراتين الفاضية
   ================================================================ */
tr.em-hint td { padding: 0 0 7px !important; border: none !important; }
.em-ask {
  border: 1px dashed var(--stroke-hi); background: transparent;
  color: var(--text-mute); border-radius: 9px; padding: 5px 12px;
  font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.em-ask:hover { border-color: #0d9488; color: #0d9488; border-style: solid; }

.em-go {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: linear-gradient(120deg, #ecfeff, #f0fdfa);
  border: 1px solid #99f6e4; border-radius: 10px; padding: 7px 13px;
  font-size: 12.5px; color: #115e59; font-weight: 700;
}
.em-go:hover { border-color: #2dd4bf; }
.em-go input { width: 17px; height: 17px; accent-color: #0d9488; cursor: pointer; margin: 0; }
.em-go b { color: #0f766e; }

.em-cnt {
  display: inline-flex; align-items: center; gap: 7px; margin-inline-start: 9px;
  font-size: 12px; color: var(--text-mute);
}
.em-cnt.off { opacity: .45; }
.em-cnt input {
  width: 76px; padding: 6px 9px; font-size: 13.5px; font-weight: 800;
  text-align: center; border: 1px solid #99f6e4; border-radius: 8px;
  background: #f0fdfa; color: #115e59; font-family: inherit;
}
.em-cnt input:focus { outline: none; border-color: #14b8a6;
                      box-shadow: 0 0 0 2px rgba(20,184,166,.18); }
.em-cnt i { font-style: normal; font-size: 10px; background: #ccfbf1;
            color: #0f766e; border-radius: 20px; padding: 2px 8px; }
.em-cnt i.man { background: #fef3c7; color: #92400e; }
.em-edit {
  border: none; background: transparent; cursor: pointer; font-size: 13px;
  color: var(--text-mute); margin-inline-start: 5px;
}
.em-edit:hover { color: #0d9488; }

/* نافذة إعداد الخامة */
.em-form { display: grid; grid-template-columns: 1fr; gap: 13px; }
.em-form .f { display: flex; flex-direction: column; gap: 5px; }
.em-form label { font-size: 12px; font-weight: 700; color: var(--text-mute); }
.em-form small { font-size: 10.5px; color: var(--text-mute); line-height: 1.7; }
.em-intro { margin: 0; font-size: 13px; color: var(--text-mute); line-height: 1.9; }
.em-kg { display: flex; align-items: center; gap: 8px; }
.em-kg input { flex: 1; }
.em-kg span { font-size: 13px; font-weight: 700; color: var(--text-mute); }
.em-prev {
  background: var(--bg-2); border: 1px dashed var(--stroke-hi); border-radius: 11px;
  padding: 13px 15px; font-size: 13.5px; color: var(--text-mute); text-align: center;
}
.em-prev.ok {
  background: linear-gradient(120deg, #ecfeff, #f0fdfa);
  border-style: solid; border-color: #5eead4; color: #115e59;
}
.em-prev b { color: #0f766e; }
.em-prev .hint { display: block; font-size: 11px; opacity: .8; margin-top: 5px; }

/* شاشة الفوارغ */
.em-wrap { display: flex; flex-direction: column; gap: 16px; }
.em-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(120deg, #0d9488 0%, #14b8a6 55%, #22d3ee 100%);
  border-radius: var(--r-md); padding: 16px 18px; color: #fff;
  box-shadow: 0 8px 26px rgba(20, 184, 166, .3);
}
.em-h-t { display: flex; align-items: center; gap: 12px; }
.em-h-ic { font-size: 32px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.em-h-t b { font-size: 19px; display: block; }
.em-h-t small { font-size: 12px; opacity: .9; }
.em-kpis { display: flex; gap: 9px; margin-inline-start: auto; }
.em-kpi { background: rgba(255,255,255,.22); border-radius: 12px;
          padding: 8px 15px; text-align: center; min-width: 66px; }
.em-kpi b { display: block; font-size: 20px; line-height: 1.1; }
.em-kpi span { font-size: 10.5px; opacity: .92; }
.em-head .em-add { background: #fff !important; color: #0f766e !important;
                   border: none !important; font-weight: 800; }

.em-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 13px; }
.em-card { border-radius: 15px; padding: 14px; color: #fff;
           display: flex; flex-direction: column; gap: 10px;
           box-shadow: 0 5px 18px rgba(0,0,0,.16); transition: transform .15s; }
.em-card:hover { transform: translateY(-3px); }
.em-card.c0 { background: linear-gradient(140deg, #0f766e, #14b8a6); }
.em-card.c1 { background: linear-gradient(140deg, #b45309, #f59e0b); }
.em-card.c2 { background: linear-gradient(140deg, #4338ca, #818cf8); }
.em-card.c3 { background: linear-gradient(140deg, #be123c, #fb7185); }
.em-c-t { display: flex; align-items: baseline; gap: 9px; }
.em-c-t b { font-size: 15px; font-weight: 800; flex: 1; line-height: 1.5; }
.em-q { font-size: 23px; font-weight: 900; }
.em-q i { font-style: normal; font-size: 11px; opacity: .85; font-weight: 600; }
.em-pr { font-size: 11.5px; background: rgba(0,0,0,.2);
         border-radius: 20px; padding: 3px 11px; align-self: flex-start; }
.em-src { display: flex; flex-wrap: wrap; gap: 6px; }
.em-s { font-size: 11px; background: rgba(255,255,255,.2);
        border-radius: 8px; padding: 4px 9px; display: inline-flex; gap: 6px; }
.em-s i { font-style: normal; background: rgba(0,0,0,.22);
          border-radius: 20px; padding: 1px 7px; font-size: 9.5px; }
.em-s i.man { background: #fde68a; color: #78350f; }
.em-none { font-size: 11.5px; opacity: .85; }

.em-pend { background: var(--bg-2); border: 1px solid var(--stroke-hi);
           border-radius: var(--r-md); padding: 14px 16px; }
.em-pend b { font-size: 13.5px; }
.em-pend p { font-size: 12px; color: var(--text-mute); margin: 5px 0 10px; }
.em-chips { display: flex; flex-wrap: wrap; gap: 7px; max-height: 190px; overflow-y: auto; }
.em-chip { border: 1px solid var(--stroke-hi); background: transparent;
           color: var(--text); border-radius: 20px; padding: 5px 13px;
           font-size: 12px; cursor: pointer; font-family: inherit; }
.em-chip:hover { border-color: #14b8a6; color: #0d9488; background: #f0fdfa; }

/* مفتاح تنبيهات النواقص في الإعدادات */
.x-al-sw { display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
           font-size: 13px; font-weight: 700; }
.x-al-sw input { display: none; }
.x-al-sw i { display: block; width: 42px; height: 23px; border-radius: 20px;
             background: var(--stroke-hi); position: relative; transition: background .2s; }
.x-al-sw i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
                    width: 17px; height: 17px; border-radius: 50%; background: #fff;
                    transition: inset-inline-start .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.x-al-sw input:checked + i { background: #16a34a; }
.x-al-sw input:checked + i::after { inset-inline-start: 22px; }
.x-al-sw.on span { color: #16a34a; }

/* ================================================================
   التحليل الذكي
   ================================================================ */
.an-wrap { display: flex; flex-direction: column; gap: 14px; }
.an-empty { padding: 30px; text-align: center; color: var(--text-mute); font-size: 13px; }

.an-hero {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  border-radius: var(--r-md); padding: 16px 18px; color: #fff;
  box-shadow: 0 8px 26px rgba(124, 58, 237, .3);
}
.an-h-t { display: flex; align-items: center; gap: 12px; }
.an-h-t .ic { font-size: 30px; }
.an-h-t b { font-size: 18px; display: block; }
.an-h-t small { font-size: 12px; opacity: .9; }
.an-goal { margin-inline-start: auto; background: #fff !important;
           color: #6d28d9 !important; border: none !important; font-weight: 800; }

.an-goals { display: grid; grid-template-columns: auto auto 1fr; gap: 14px; align-items: center;
            background: var(--bg-2); border-radius: var(--r-md); padding: 16px; }
.an-ring { text-align: center; }
.an-ring svg { width: 108px; height: 108px; }
.an-ring b { display: block; font-size: 12px; font-weight: 700; margin-top: 4px; color: var(--text); }
.an-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.an-kpi { background: var(--card, #fff); border-radius: 12px; padding: 10px 13px;
          display: flex; flex-direction: column; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.an-kpi .k-ic { font-size: 18px; }
.an-kpi b { font-size: 20px; font-weight: 800; line-height: 1.2; }
.an-kpi small { font-size: 10.5px; color: var(--text-mute); }

.an-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.an-tip { border-radius: 12px; padding: 11px 14px; border-inline-start: 4px solid;
          background: var(--card, #fff); box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.an-tip b { display: block; font-size: 13px; margin-bottom: 3px; }
.an-tip span { font-size: 11.5px; color: var(--text-mute); line-height: 1.7; }
.an-tip.up { border-color: #16a34a; } .an-tip.up b { color: #15803d; }
.an-tip.down { border-color: #dc2626; } .an-tip.down b { color: #b91c1c; }
.an-tip.x { border-color: #ea580c; } .an-tip.x b { color: #c2410c; }
.an-tip.quiet { border-color: #0891b2; } .an-tip.quiet b { color: #0e7490; }
.an-tip.star { border-color: #ca8a04; } .an-tip.star b { color: #a16207; }
.an-tip.ok, .an-tip.g { border-color: #64748b; }

.an-card { background: var(--card, #fff); border-radius: var(--r-md); padding: 14px 16px;
           box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.an-c-h { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.an-svg { width: 100%; height: auto; display: block; overflow: visible; }
.an-leg { display: flex; gap: 16px; justify-content: center; margin-top: 6px; font-size: 11.5px; color: var(--text-mute); }
.an-leg i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 4px; vertical-align: -1px; }

.an-prod { display: flex; flex-direction: column; gap: 7px; }
.an-p-row { display: grid; grid-template-columns: 1fr 130px 78px; gap: 11px; align-items: center;
            padding: 9px 11px; border-radius: 10px; background: var(--bg-2); }
.an-p-main { min-width: 0; }
.an-p-main b { font-size: 13px; font-weight: 700; display: block; overflow: hidden;
               text-overflow: ellipsis; white-space: nowrap; }
.an-p-main span { font-size: 10.5px; color: var(--text-mute); }
.an-p-bar { height: 8px; background: #eceff5; border-radius: 20px; overflow: hidden; }
.an-p-bar i { display: block; height: 100%; border-radius: 20px; }
.an-p-tag { text-align: center; }
.an-p-tag b { display: block; font-size: 13px; font-weight: 800; }
.an-p-tag span { font-size: 9.5px; color: var(--text-mute); }
.an-p-row.x  { background: #fef2f2; } .an-p-row.x  .an-p-bar i { background: #ef4444; } .an-p-row.x  .an-p-tag b { color: #dc2626; }
.an-p-row.a  { background: #fff7ed; } .an-p-row.a  .an-p-bar i { background: #f97316; } .an-p-row.a  .an-p-tag b { color: #ea580c; }
.an-p-row.b  { background: #fefce8; } .an-p-row.b  .an-p-bar i { background: #eab308; } .an-p-row.b  .an-p-tag b { color: #ca8a04; }
.an-p-row.g  { } .an-p-row.g .an-p-bar i { background: #22c55e; } .an-p-row.g .an-p-tag b { color: #16a34a; }

.an-quiet { display: flex; flex-wrap: wrap; gap: 8px; }
.an-q { font-size: 12px; background: var(--bg-2); border-radius: 9px; padding: 6px 11px;
        display: inline-flex; flex-direction: column; }
.an-q i { font-style: normal; font-size: 9.5px; color: var(--text-mute); }

.an-goal-form { display: flex; flex-direction: column; gap: 13px; }
.an-goal-form .f { display: flex; flex-direction: column; gap: 5px; }
.an-goal-form label { font-size: 12.5px; font-weight: 700; color: var(--text-mute); }

@media (max-width: 640px) {
  .an-goals { grid-template-columns: 1fr 1fr; }
  .an-kpis { grid-column: 1/-1; }
  .an-p-row { grid-template-columns: 1fr 70px; }
  .an-p-bar { display: none; }
}

/* نموذج (تعديل صنف/حساب) في تاب لوحده بدل نافذة — formTab() */
.form-tab { display: flex; justify-content: center; padding: 14px 8px 40px; }
.form-tab .modal { max-height: none; animation: none; margin: 0 auto; }
.form-tab .modal .body { overflow: visible; }
.form-tab footer { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg-2) 88%, transparent); border-radius: 0 0 var(--r-lg) var(--r-lg); z-index: 2; }

/* (2026-10-07) يوم البداية — خطوات التشغيل من غير سهل */
.gl-steps { display: flex; flex-direction: column; gap: 10px; }
.gl-step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line, rgba(0,0,0,.08)); background: var(--bg2, rgba(255,255,255,.5)); }
.gl-step.ok { border-color: rgba(22,163,74,.35); background: rgba(22,163,74,.06); }
.gl-n { flex: 0 0 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 900; background: var(--accent, #2563eb); color: #fff; }
.gl-step.ok .gl-n { background: #16a34a; }
.gl-b { flex: 1; min-width: 0; }
.gl-list { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 11.5px; }
.gl-list span { white-space: normal; overflow-wrap: anywhere; }

/* (2026-11-08) خانات الموبايل 16 على الأقل — أقل من كده الآيفون بيكبّر الشاشة لوحده مع كل ضغطة */
@media (max-width: 760px) {
  html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) input.f,
  html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) select.f,
  html:not(.view-phone):not(.view-tablet):not(.view-tablet-land):not(.view-laptop) textarea.f,
  html.view-phone input.f, html.view-phone select.f, html.view-phone textarea.f { font-size: 16px; }
}

/* (2026-11-09) باقي الفحص الشامل */
/* الليلي: البلاطة <button> مابتورثش لون الكلام فكان أسود على غامق · كروت «يوم البداية» كانت رمادي فاتح */
button.tile { color: var(--text); }
[data-theme="dark"] .gl-step { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .gl-step.ok { background: rgba(22,163,74,.12); border-color: rgba(22,163,74,.4); }
/* أصغر كلام على الشاشة */
.row.compact .fld > label { font-size: 12px; }
.tag { font-size: 11.5px; }
.home-grid .tile.trow .t-kpi, .home-grid .tile.trow small { font-size: 11px; }
/* آخر حاجة في الشاشة ماتفضلش تحت زرار المايك العايم: مساحة تحت تتسكرل لها (الفاتورة ليها تخطيط لوحدها) */
@media screen { #view > .tab-pane.on:not(.embed-host):not(.masnaa-pane):not(:has(.ivr))::after { content: ""; display: block; height: 72px; } }

/* (2026-11-18) علامة «NEW» جنب اسم صنف التركيبة الجديدة (new_items.py) — المخزن والفاتورة وقايمة البحث */
.new-tag {
  display: inline-block; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px;
  font: 800 10.5px/1.6 Cairo, sans-serif; letter-spacing: .4px; direction: ltr; vertical-align: middle;
  background: #dc2626; color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); white-space: nowrap;
}
html[data-theme="dark"] .new-tag { background: #ef4444; color: #fff; }
/* أول الاسم (قايمة البحث) — عشان ماتتقصّش مع الاسم الطويل */
.new-tag.lead { margin-inline-start: 0; margin-inline-end: 6px; }
@media print { .new-tag { background: none !important; color: #000 !important; border: 1.2px solid #000; box-shadow: none; } }
