/* =====================================================================
   ERP_Online — نظام التصميم
   عربي RTL · موبايل أولاً · 3 ثيمات × فاتح/داكن · بدون أي اعتماد خارجي
   ===================================================================== */

/* ---------------------------------------------------------------
   1) إعادة الضبط
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* السمة hidden تخفي العنصر دائمًا حتى لو كانت فئته تحدد display (مثل البطاقات والتنبيهات المرنة) */
[hidden] { display: none !important; }
* { margin: 0; padding: 0; }

html {
  direction: rtl;
  font-size: 16px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
html[dir="ltr"] { direction: ltr; }
html[dir="ltr"] body { font-family: Inter, 'Segoe UI', Arial, sans-serif; }

body {
  font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, 'Noto Naskh Arabic', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

img, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------
   2) المتغيّرات — الوضع الفاتح (الافتراضي)
   --------------------------------------------------------------- */
:root {
  --bg:            #F2F5F7;
  --surface:       #FFFFFF;
  --surface-2:     #F8FAFB;
  --surface-3:     #EDF1F4;
  --border:        #E1E7EC;
  --border-strong: #CBD4DC;
  --text:          #171A1D;
  --text-2:        #4A555F;
  --text-muted:    #7A8792;
  --shadow-sm:  0 1px 2px rgba(16,24,32,.06), 0 1px 3px rgba(16,24,32,.04);
  --shadow-md:  0 2px 6px rgba(16,24,32,.07), 0 6px 16px rgba(16,24,32,.06);
  --shadow-lg:  0 6px 18px rgba(16,24,32,.10), 0 18px 40px rgba(16,24,32,.10);
  --shadow-nav: 0 -2px 10px rgba(16,24,32,.10), 0 6px 24px rgba(16,24,32,.14);

  --ok:      #15803D;  --ok-bg:      #E8F6EE;  --ok-border:      #A9DCC0;
  --danger:  #C0342E;  --danger-bg:  #FCEDEC;  --danger-border:  #F2B9B6;
  --warn:    #A66412;  --warn-bg:    #FDF3E3;  --warn-border:    #F2D5A4;
  --info:    #1A5FA8;  --info-bg:    #E9F1FB;  --info-border:    #B4D2F0;

  --radius:    10px;
  --radius-sm:  7px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --header-h:  58px;
  --nav-h:     62px;
  --session-bar-h: 50px;
  --sidebar-w: 258px;
  --sidebar-collapsed-w: 72px;

  --t-fast: .14s cubic-bezier(.4,0,.2,1);
  --t-base: .22s cubic-bezier(.4,0,.2,1);
}

/* ---------------------------------------------------------------
   3) الوضع الداكن
   --------------------------------------------------------------- */
[data-mode="dark"] {
  --bg:            #101316;
  --surface:       #191D22;
  --surface-2:     #20252B;
  --surface-3:     #272D34;
  --border:        #2D343C;
  --border-strong: #3C4048;
  --text:          #E7EAED;
  --text-2:        #B3BCC5;
  --text-muted:    #8A949E;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.30);
  --shadow-md:  0 2px 8px rgba(0,0,0,.36);
  --shadow-lg:  0 8px 26px rgba(0,0,0,.48);
  --shadow-nav: 0 -2px 12px rgba(0,0,0,.45), 0 6px 28px rgba(0,0,0,.5);

  --ok:      #5BC489;  --ok-bg:      #14301F;  --ok-border:      #245C3B;
  --danger:  #F07B75;  --danger-bg:  #331715;  --danger-border:  #6B2A26;
  --warn:    #E7B45C;  --warn-bg:    #302311;  --warn-border:    #63481B;
  --info:    #6FAEEA;  --info-bg:    #12233A;  --info-border:    #24466E;
}

/* ---------------------------------------------------------------
   4) الثيمات الثلاثة
   --------------------------------------------------------------- */
[data-theme="green"] {
  --brand:       #12A05B;
  --brand-hover: #0E8A4D;
  --brand-dark:  #14402F;
  --brand-ring:  #2E7D5B;
  --brand-soft:  #E5F4EC;
  --brand-text:  #0B6338;
  --on-brand:    #FFFFFF;
}
[data-theme="blue"] {
  --brand:       #1B7FD4;
  --brand-hover: #166CB6;
  --brand-dark:  #0F2E4A;
  --brand-ring:  #2C5C88;
  --brand-soft:  #E5F0FA;
  --brand-text:  #114A80;
  --on-brand:    #FFFFFF;
}
[data-theme="purple"] {
  --brand:       #7C4DDA;
  --brand-hover: #6A3EC4;
  --brand-dark:  #2A1B47;
  --brand-ring:  #4E3A80;
  --brand-soft:  #EEE9FB;
  --brand-text:  #4E2E96;
  --on-brand:    #FFFFFF;
}

[data-mode="dark"][data-theme="green"]  { --brand-soft: #10291D; --brand-text: #63D19A; --brand-dark: #103527; }
[data-mode="dark"][data-theme="blue"]   { --brand-soft: #10243A; --brand-text: #79B8F0; --brand-dark: #0D2740; }
[data-mode="dark"][data-theme="purple"] { --brand-soft: #1E1734; --brand-text: #B294F0; --brand-dark: #241740; }

/* ---------------------------------------------------------------
   5) هيكل الصفحة
   --------------------------------------------------------------- */
.app { min-height: 100vh; width:100%; max-width:100%; min-width:0; display:flex; flex-direction:column; overflow-x: clip; }

.app-main {
  flex: 1;
  min-width: 0;
  padding: 14px;
  padding-bottom: calc(var(--session-bar-h) + var(--license-bar-h, 0px) + 24px);
  width: 100%;
  max-width: 1500px;
  margin-inline: auto;
}
.app-main > * { min-width:0; max-width:100%; }
/* مساحة تحت عشان الشريط السفلي ما يغطّيش المحتوى — على الموبايل والتابلت بس.
   على الكمبيوتر الشريط مخفي، فالمساحة بتتحجز بس لو المدير رجّعه من الإعدادات. */
@media (max-width: 991.98px) {
  /*
   * غلاف الموبايل لازم يفضل بعرض الـ viewport مهما كان وضع القائمة الجانبية.
   * القائمة وهي مقفولة بتتحرك خارج الشاشة؛ من غير القص ده المتصفح RTL كان
   * بيحسبها ضمن عرض الصفحة ويزيّح الهيدر والمحتوى والفوتر ناحية اليسار.
   */
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  body.sidebar-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
  .app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }
  .app-header,
  .app-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0 !important;
  }
  .app-main > * { max-width: 100%; min-width: 0; }

  .app .sidebar {
    inset-block-start: 0;
    inset-block-end: auto;
    width: min(326px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    height: 100vh;
    height: 100dvh;
    transform: translateX(calc(100% + 2px));
    box-shadow: var(--shadow-lg);
    will-change: transform;
  }
  .sidebar.is-open { transform: translateX(0); }
  html[dir="ltr"] .app .sidebar { transform: translateX(calc(-100% - 2px)); }
  html[dir="ltr"] .app .sidebar.is-open { transform: translateX(0); }
  .sb-overlay {
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    touch-action: none;
  }

  .app .footer-nav {
    right: 10px;
    left: 10px;
    width: auto;
    max-width: min(640px, calc(100vw - 20px));
    margin-inline: auto;
    bottom: calc(var(--session-bar-h) + var(--license-bar-h, 0px) + max(10px, env(safe-area-inset-bottom)));
  }
  .has-footer-nav .app-main {
    padding-bottom: calc(var(--nav-h) + var(--session-bar-h) + var(--license-bar-h, 0px) + 34px + env(safe-area-inset-bottom));
  }
  .app .toasts {
    right: 12px;
    left: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
  }
}

/* ------- الهيدر ------- */
.app-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.hdr-btn {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.hdr-btn:hover { background: var(--surface-3); color: var(--text); }
.header-language{position:relative}.header-language>summary{list-style:none;cursor:pointer}.header-language>summary::-webkit-details-marker{display:none}.header-language .hdr-btn{display:flex;align-items:center;justify-content:center;gap:2px}.header-language .hdr-btn small{font-size:8px;font-weight:800;position:absolute;inset-block-end:3px}.language-menu{position:absolute;inset-inline-end:0;inset-block-start:44px;z-index:110;min-width:190px}.language-menu .card-body{padding:10px}.language-menu form+form{margin-top:3px}.language-menu .btn{justify-content:flex-start;gap:10px}.language-menu .btn.is-active{background:var(--brand-soft);color:var(--brand-text)}
.screen-guide-play{
  position:relative; overflow:visible;
  color:var(--on-brand); background:var(--brand);
  animation:screenGuideGlow 1.7s ease-in-out infinite;
}
.screen-guide-play:hover{ color:var(--on-brand); background:var(--brand-hover); animation-play-state:paused; }
.screen-guide-play .ico{ fill:none; }
@keyframes screenGuideGlow{
  0%,100%{ transform:scale(1); box-shadow:0 0 0 0 var(--brand),0 0 8px var(--brand); }
  50%{ transform:scale(1.08); box-shadow:0 0 0 5px transparent,0 0 22px var(--brand); }
}
@media(prefers-reduced-motion:reduce){
  .screen-guide-play{ animation:none; box-shadow:0 0 0 2px var(--brand-soft),0 0 14px var(--brand); }
}

.hdr-brand { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.hdr-logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 9px; object-fit: contain;
  background: var(--brand-soft);
  display: grid; place-items: center;
  color: var(--brand); font-weight: 700; font-size: 15px;
}
.hdr-titles { min-width: 0; line-height: 1.25; }
.hdr-name   { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-slogan { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hdr-badge {
  position: absolute; top: 5px; inset-inline-end: 5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff;
  border-radius: 9px; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}

/* ------- القائمة الجانبية ------- */
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0;
  width: var(--sidebar-w); z-index: 90;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform var(--t-base), width var(--t-base);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar.is-open { transform: translateX(0); }

.sb-head {
  height: var(--header-h); flex: 0 0 var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid var(--border);
}
.sb-body { flex: 1; overflow-y: auto; padding: 10px 8px 20px; }

.sb-group { margin-bottom: 4px; }
.sb-group-title {
  width: 100%; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  font-family: inherit; text-align: start;
  letter-spacing: .3px; padding: 11px 12px 7px; border-radius: var(--radius-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
.sb-group-title:hover { background: var(--surface-3); color: var(--text); }
.sb-group-chevron { transition: transform var(--t-fast); }
.sb-group.is-open .sb-group-chevron { transform: rotate(180deg); }
.sb-group-links { padding-block: 1px 3px; }
.sb-group-links[hidden] { display: none; }
.sb-group.is-plain { margin-bottom: 8px; }

.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.sb-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.sb-link.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 700; }
.sb-link .ico { flex: 0 0 20px; opacity: .85; }
.sb-link.is-active .ico { opacity: 1; }

.sb-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8,12,16,.5);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
}
.sb-overlay.is-open { opacity: 1; pointer-events: auto; }

/* ترتيب القائمة من الإعدادات — عملي وكثيف بدون إخفاء التسلسل البصري */
.sidebar-order-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.sidebar-order-groups{display:grid;gap:14px}
.sidebar-order-group{margin:0;overflow:hidden;border-inline-start:4px solid var(--brand)}
.sidebar-order-head{gap:14px}
.sidebar-order-rank{display:grid;gap:4px;flex:0 0 92px}
.sidebar-order-rank label{font-size:10px;font-weight:800;color:var(--text-muted)}
.sidebar-order-rank .input{height:38px;text-align:center;font-weight:800;color:var(--brand-text);background:var(--brand-soft)}
.sidebar-order-actions{display:flex;gap:4px;align-items:center}
.sidebar-order-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;background:var(--surface-2)}
.sidebar-order-item{display:grid;grid-template-columns:54px 34px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:60px;padding:8px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface)}
.sidebar-order-item>.input{height:38px;text-align:center;font-weight:800}
.sidebar-order-icon{width:32px;height:32px;display:grid;place-items:center;border-radius:9px;background:var(--brand-soft);color:var(--brand-text)}
.sidebar-order-name{min-width:0;display:grid;gap:2px}
.sidebar-order-name small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-muted);font-size:10px;text-align:start}
.sidebar-order-savebar{position:sticky;z-index:15;bottom:calc(var(--statusbar-h, 0px) + 10px);display:flex;align-items:center;gap:8px;margin-top:18px;padding:10px;border:1px solid var(--border);border-radius:var(--radius-lg);background:color-mix(in srgb,var(--surface) 92%,transparent);box-shadow:var(--shadow-md);backdrop-filter:blur(12px)}
@media(max-width:760px){.sidebar-order-items{grid-template-columns:1fr}.sidebar-order-head{align-items:flex-start}.sidebar-order-item{grid-template-columns:48px 32px minmax(0,1fr) auto}.sidebar-order-savebar{flex-wrap:wrap}.sidebar-order-savebar .btn{flex:1}}

/* ---------------------------------------------------------------
   6) الفوتر الثابت — الزرار النشط يرتفع
   --------------------------------------------------------------- */
.footer-nav {
  position: fixed; z-index: 70;
  inset-inline: 10px; bottom: 10px;
  height: var(--nav-h);
  background: var(--brand-dark);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-nav);
  display: flex; align-items: flex-end; justify-content: space-around;
  padding: 0 6px 7px;
  max-width: 640px; margin-inline: auto;
}

.fn-item {
  position: relative;
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  transition: color var(--t-base);
  padding-bottom: 4px;
}
.fn-item:hover { color: #fff; text-decoration: none; }

.fn-icon {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  transition: transform var(--t-base), background var(--t-base), width var(--t-base), height var(--t-base);
}

.fn-label {
  font-size: 11px; font-weight: 700; line-height: 1;
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height var(--t-base), opacity var(--t-base);
  white-space: nowrap;
}

/* الحالة النشطة — الأيقونة تطلع فوق البار في حلقة ملوّنة */
.fn-item.is-active { color: #fff; }
.fn-item.is-active .fn-icon {
  width: 56px; height: 56px;
  background: var(--brand);
  color: var(--on-brand);
  transform: translateY(-24px);
  box-shadow: 0 0 0 6px var(--brand-ring), 0 6px 14px rgba(0,0,0,.28);
}
.fn-item.is-active .fn-label { max-height: 18px; opacity: 1; margin-top: -20px; }

.fn-badge {
  position: absolute; top: 6px; inset-inline-end: 12px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: #E5484D; color: #fff;
  border-radius: 9px; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
  border: 2px solid var(--brand-dark);
}
.fn-item.is-active .fn-badge { top: -14px; inset-inline-end: 6px; }

/* ---------------------------------------------------------------
   7) زرار المساعد الذكي + رسالة الترحيب
   --------------------------------------------------------------- */



/* فقاعة ترحيب المساعد — بتطلع من تحت زر المساعد في الهيدر */
.hdr-smart-tools{position:relative;display:flex;align-items:center;gap:7px;min-width:0;}
.bot-greeting{
  position:fixed; top:calc(var(--header-h) + 12px); left:10px; right:auto;
  width:min(390px,calc(100vw - 28px)); padding:.82rem 2.45rem .82rem 1rem; z-index:60;
  background:var(--surface); color:var(--text);
  border:1px solid var(--brand); border-inline-start:4px solid var(--brand);
  border-radius:14px; border-start-end-radius:4px;
  font-size:.82rem; line-height:1.75; text-align:start; direction:rtl;
  overflow-wrap:anywhere; word-break:normal; isolation:isolate;
  box-shadow:0 12px 30px rgba(16,24,32,.18),0 3px 9px rgba(16,24,32,.10);
  opacity:0; transform:translateY(-10px) scale(.985); transform-origin:var(--bot-pointer-x,50%) top; pointer-events:none;
  transition:opacity .3s ease, transform .3s ease;
}
.bot-greeting.is-shown{ opacity:1; transform:translateY(0) scale(1); pointer-events:auto; }
.bot-greeting-mark{
  position:absolute; top:-18px; left:var(--bot-pointer-x,50%); transform:translateX(-50%);
  width:36px; height:36px; display:grid; place-items:center;
  border:3px solid var(--surface); border-radius:50%;
  background:var(--brand); color:var(--on-brand); box-shadow:var(--shadow-md);
}
.bot-greeting-title,.bot-greeting-text{display:block;}
.bot-greeting-title{font-size:.9rem;margin-bottom:5px;color:var(--brand-text);line-height:1.45;}
.bot-greeting-text{font-size:.8rem;color:var(--text-2);white-space:normal;}
.bot-greeting-time{display:block;margin-top:7px;padding-top:6px;border-top:1px solid var(--border);font-size:.69rem;color:var(--text-muted);direction:rtl;}
.bot-greeting-link{display:inline-flex;margin-top:7px;color:var(--brand);font-size:.76rem;font-weight:700;text-decoration:underline;}
.bot-greeting-link[hidden],.bot-greeting-time[hidden]{display:none;}
.check-line{display:inline-flex;align-items:center;gap:8px;cursor:pointer;font-weight:700;color:var(--text-2)}
.check-line input{width:18px;height:18px;accent-color:var(--brand)}

/* زر المساعد في الهيدر */
.hdr-bot{ color:var(--brand); }
.hdr-bot:hover{ background:var(--brand-soft); }
/* عدّاد المستجدات على زر المساعد: يتحدث دوريًا ويفتح الملخص عند الضغط */
.hdr-badge{ direction:ltr; unicode-bidi:isolate; }
.hdr-bot-wrap{ position:relative; display:inline-flex; }
.hdr-bot-badge{ border:0; cursor:pointer; font-family:inherit; z-index:2; }
.hdr-bot-badge[hidden]{ display:none; }
.hdr-bot-badge::after{ content:""; position:absolute; inset:-7px; }
.hdr-bot-badge:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }
.hdr-bot-badge.is-bumped{ animation:hdrBadgeBump .6s ease-out; }
@keyframes hdrBadgeBump{ 0%{ transform:scale(1); } 35%{ transform:scale(1.35); } 100%{ transform:scale(1); } }
@media(prefers-reduced-motion:reduce){ .hdr-bot-badge.is-bumped{ animation:none; } }
.bot-greeting-close {
  position:absolute; top:8px; inset-inline-start:8px;
  width:28px;height:28px;display:grid;place-items:center;border-radius:50%;
  color:var(--text-muted);background:var(--surface-3);line-height:1;
}
.bot-greeting-close:hover { color:var(--text);background:var(--border); }
@media (max-width:991.98px){
  .app .bot-greeting{
    position:fixed!important;
    right:auto!important;
    max-width:calc(100vw - 20px)!important;
    max-height:min(44vh,340px);
    overflow-x:hidden;overflow-y:auto;
    overscroll-behavior:contain;
    border-start-end-radius:14px;
  }
}

/* ---------------------------------------------------------------
   شريط الجلسة — رفيع، ثابت، ولا يغطي المحتوى
   --------------------------------------------------------------- */
.session-statusbar{
  position:fixed; z-index:72; inset-inline:0; bottom:0;
  min-height:var(--session-bar-h); padding:0 12px max(0px,env(safe-area-inset-bottom));
  display:flex; align-items:center; gap:0; overflow-x:auto; overflow-y:hidden;
  background:var(--surface); color:var(--text-2); border-top:2px solid var(--brand);
  box-shadow:var(--shadow-sm); white-space:nowrap;
  scrollbar-width:none; overscroll-behavior-inline:contain;
}
.session-statusbar::-webkit-scrollbar{display:none;}
.session-status-item{
  flex:0 0 auto; min-height:34px; padding:4px 11px;
  display:inline-flex; align-items:center; gap:5px;
  color:var(--text-2); font-size:11.5px; line-height:1.3;
  border-inline-end:1px solid var(--border);
}
.session-status-item:last-child{border-inline-end:0;}
.session-status-item .ico{width:14px;height:14px;opacity:.9;}
.session-status-item b,.session-status-item strong{font-weight:800;color:var(--brand-text);}
.session-status-moment{gap:8px;background:var(--brand-soft);border:1px solid var(--border);border-radius:10px;margin-inline-end:5px;padding-block:4px;}
.session-status-moment>.ico{width:17px;height:17px;color:var(--brand-text);}
.session-status-moment-copy{display:flex;align-items:center;gap:9px;}
.session-status-time{font-size:17px;font-weight:900;line-height:1;color:var(--brand-text);font-variant-numeric:tabular-nums;letter-spacing:.035em;}
.session-status-gregorian{font-size:12px;font-weight:800;color:var(--brand-text);}
.session-status-date time{font-size:12px;font-weight:800;color:var(--brand-text);}
.session-status-user{background:var(--brand-soft);border-radius:999px;margin-inline:5px;padding-inline:11px;}
/* Theme tokens above adapt the entire bar, including clock/user badges, to data-mode. */
@media (max-width:640px){
  .session-statusbar{padding-inline:7px;}
  .session-status-moment-copy{gap:7px;}
  .session-status-time{font-size:16px;}
  .session-status-gregorian{font-size:11.5px;}
}

/* ---------------------------------------------------------------
   شريط حالة التحميل — جاهز · فتح صفحة · حفظ · عملية طويلة بنسبة تقدّمها ومدتها
   أول عنصر في شريط الجلسة ويبقى ظاهرًا مع التمرير، وشريط عائم في صفحات الدخول والتجهيز
   --------------------------------------------------------------- */
.session-status-activity{
  position:sticky; inset-inline-start:0; z-index:1;
  display:inline-flex; align-items:center; gap:7px;
  min-width:118px; max-width:min(48vw,480px);
  background:var(--surface); color:var(--text-2); font-size:11.5px; line-height:1.3;
}
.activity-dot{ width:8px; height:8px; flex:0 0 8px; border-radius:50%; background:var(--ok); box-shadow:0 0 0 3px var(--ok-bg); }
.activity-label{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:800; color:var(--text-2); }
.activity-meter{ display:none; position:relative; flex:0 0 76px; width:76px; height:6px; border-radius:999px; background:var(--surface-3); overflow:hidden; }
.activity-meter>i{ position:absolute; inset-block:0; inset-inline-start:0; width:0; border-radius:inherit; background:var(--brand); transition:width .3s ease; }
.activity-meter.is-indeterminate>i{ width:42%; animation:activitySlide 1.1s ease-in-out infinite; }
.activity-meta{ flex:0 0 auto; font-size:11px; font-weight:800; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.activity-meta:empty{ display:none; }
[data-state="busy"]>.activity-dot{ background:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); animation:activityPulse 1s ease-in-out infinite; }
[data-state="busy"]>.activity-label{ color:var(--brand-text); }
[data-state="busy"]>.activity-meter{ display:inline-block; }
[data-state="done"]>.activity-label{ color:var(--ok); }
[data-state="failed"]>.activity-dot{ background:var(--danger); box-shadow:0 0 0 3px var(--danger-bg); }
[data-state="failed"]>.activity-label{ color:var(--danger); }
@keyframes activityPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }
@keyframes activitySlide{ 0%{ transform:translateX(-110%); } 100%{ transform:translateX(250%); } }
@keyframes activitySlideRtl{ 0%{ transform:translateX(110%); } 100%{ transform:translateX(-250%); } }
html[dir="rtl"] .activity-meter.is-indeterminate>i{ animation-name:activitySlideRtl; }

/* خط تحميل رفيع أعلى الصفحة أثناء أي تحميل */
.erp-loadbar{ position:fixed; inset-inline:0; top:0; height:3px; z-index:1200; pointer-events:none; opacity:0; overflow:hidden; transition:opacity .2s ease; }
.erp-loadbar>i{ position:absolute; inset-block:0; inset-inline-start:0; width:32%; background:var(--brand); box-shadow:0 0 8px var(--brand); }
.erp-loadbar.is-active{ opacity:1; }
.erp-loadbar.is-active:not(.is-determinate)>i{ animation:loadbarSlide 1.2s ease-in-out infinite; }
.erp-loadbar.is-determinate>i{ transition:width .3s ease; }
@keyframes loadbarSlide{ 0%{ transform:translateX(-100%); } 100%{ transform:translateX(320%); } }
@keyframes loadbarSlideRtl{ 0%{ transform:translateX(100%); } 100%{ transform:translateX(-320%); } }
html[dir="rtl"] .erp-loadbar.is-active:not(.is-determinate)>i{ animation-name:loadbarSlideRtl; }

/* شريط عائم أسفل الصفحة عند غياب شريط الجلسة (الدخول، التجهيز لأول مرة) */
.activity-statusbar{
  position:fixed; inset-inline:0; bottom:0; z-index:1100;
  display:flex; justify-content:center; padding:7px 14px max(7px,env(safe-area-inset-bottom));
  background:var(--surface); border-top:2px solid var(--brand); box-shadow:var(--shadow-md);
}
.activity-statusbar .session-status-activity{ position:static; max-width:100%; font-size:12.5px; gap:9px; }
.activity-statusbar .activity-meter{ flex-basis:140px; width:140px; }
/* الشاشات الصغيرة: اسم العملية يأخذ أغلب الشريط أثناء التحميل، وشريط النسبة أقصر */
@media (max-width:640px){
  .session-statusbar .session-status-activity{ max-width:76vw; }
  .session-statusbar .session-status-activity:not([data-state="idle"]){ min-width:min(76vw,320px); }
  .session-statusbar .activity-meter{ flex-basis:40px; width:40px; }
  .activity-statusbar .activity-meter{ flex-basis:70px; width:70px; }
}
@media (prefers-reduced-motion:reduce){
  [data-state="busy"]>.activity-dot, .activity-meter.is-indeterminate>i, .erp-loadbar.is-active>i{ animation:none !important; }
  .activity-meter.is-indeterminate>i{ width:100%; opacity:.45; }
}

/* ---------------------------------------------------------------
   8) الأنماط العامة للنصوص
   --------------------------------------------------------------- */
h1 { font-size: 21px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14.5px; font-weight: 700; }

.page-head {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 14px;
  inline-size: 100%; min-inline-size: 0;
}
.page-head > :first-child { min-inline-size: 0; }
.page-title { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.page-title .ico { color: var(--brand); }
.page-sub { font-size: 13px; color: var(--text-muted); }
.page-actions {
  margin-inline-start: auto; margin-right:auto; margin-left:0; display: flex; align-items: center;
  justify-content: flex-end; gap: 8px; flex-wrap: wrap;
}
html[dir="ltr"] .page-actions,html[dir="ltr"] .card-tools{margin-left:auto;margin-right:0}
html[dir="ltr"] .page-head > :is(a.btn,button.btn,form,details):nth-child(2),html[dir="ltr"] .card-head > :is(a.btn,button.btn,form,details,.badge):nth-child(2){margin-left:auto;margin-right:0}
/* بعض الشاشات القديمة تضع زر العرض/الطباعة مباشرة بعد العنوان بدون page-actions. */
.page-head > :is(a.btn, button.btn, form, details):nth-child(2) { margin-inline-start: auto; margin-right:auto; margin-left:0; }

.text-muted  { color: var(--text-muted) !important; }
.text-2      { color: var(--text-2) !important; }
.text-ok     { color: var(--ok) !important; }
.text-danger { color: var(--danger) !important; }
.text-warn   { color: var(--warn) !important; }
.text-info   { color: var(--info) !important; }
.text-brand  { color: var(--brand) !important; }
.text-center { text-align: center; }
.text-start  { text-align: start; }
.text-end    { text-align: end; }
.fw-bold     { font-weight: 700; }
.fw-normal   { font-weight: 400; }
.fs-sm       { font-size: 13px; }
.fs-xs       { font-size: 11.5px; }
.fs-lg       { font-size: 17px; }
.num         { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.mono        { font-family: ui-monospace, Consolas, 'Courier New', monospace; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------
   9) الكروت
   --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: 14px; }

.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  inline-size: 100%; min-inline-size: 0;
}
.card-head > :first-child { min-inline-size: 0; }
.card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .ico { color: var(--brand); }
.card-tools {
  margin-inline-start: auto; margin-right: auto; margin-left: 0; display: flex; align-items: center;
  justify-content: flex-end; gap: 6px; flex-wrap: wrap;
}
/* يوحّد موضع الإجراء حتى في رؤوس الكروت القديمة غير المغلفة بـ card-tools. */
.card-head > :is(a.btn, button.btn, form, details, .badge):nth-child(2) { margin-inline-start: auto; margin-right:auto; margin-left:0; }
.card-body  { padding: 16px; }
.card-foot  { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.card-body.p0 { padding: 0; }
.progress{height:6px;min-width:100px;border-radius:999px;background:var(--surface-3);overflow:hidden}.progress>span{display:block;height:100%;border-radius:inherit;background:var(--brand)}

/* الموارد البشرية */
.hr-self-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.hr-stamp-times{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px}.hr-stamp-times>div{display:flex;flex-direction:column;align-items:center;padding:12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2)}.hr-stamp-times span{color:var(--text-muted);font-size:12px}.hr-stamp-times strong{font-size:22px}
.hr-certificate{max-width:900px;margin-inline:auto}.hr-certificate .card-body{padding:58px 68px;min-height:720px;font-size:18px;line-height:2.2}.hr-certificate-head{display:flex;align-items:center;gap:18px;border-bottom:2px solid var(--border);padding-bottom:18px;margin-bottom:50px}.hr-certificate-head img{width:76px;height:76px;object-fit:contain}.hr-certificate h2{text-align:center;font-size:30px;margin-bottom:40px}.hr-certificate footer{display:flex;justify-content:space-between;align-items:flex-end;margin-top:70px}.hr-signature{text-align:center;font-weight:700}.hr-signature span{display:block;margin-top:28px;color:var(--text-muted);font-weight:400}
@media(max-width:700px){.hr-self-grid{grid-template-columns:1fr}.hr-certificate .card-body{padding:28px 20px;font-size:15px}.hr-certificate footer{gap:20px;flex-direction:column;align-items:stretch}}

/* خريطة أماكن العمل وبوابة الموظف (public/js/geo-picker.js) — بلاطات OpenStreetMap كصور فقط */
.geo-picker{display:flex;flex-direction:column;gap:8px}
.geo-tools{display:flex;gap:8px;flex-wrap:wrap}
.geo-tools .geo-paste{flex:1 1 240px;min-width:0}
.geo-map-box,.geo-view{height:340px}
.geo-map{position:relative;overflow:hidden;border:1px solid var(--border);border-radius:var(--radius);background:#e5ecef;touch-action:none;cursor:crosshair;user-select:none;-webkit-user-select:none}
.geo-view.geo-map{cursor:grab;touch-action:pan-y}
.geo-map.is-dragging{cursor:grabbing}
.geo-tiles,.geo-overlay{position:absolute;inset:0}
.geo-overlay{pointer-events:none;overflow:visible}
.geo-tile{position:absolute;left:0;top:0;width:256px;height:256px;max-width:none;pointer-events:none}
.geo-area{fill:var(--brand);fill-opacity:.13;stroke:var(--brand);stroke-width:2}
.geo-area.is-alt{fill:rgba(124,77,218,.12);stroke:#7C4DDA;stroke-dasharray:6 4}
.geo-center{fill:var(--brand);stroke:#fff;stroke-width:2}
.geo-accuracy{fill:rgba(27,127,212,.13);stroke:rgba(27,127,212,.55);stroke-width:1}
.geo-dot{fill:#1B7FD4;stroke:#fff;stroke-width:3}
.geo-pin path{fill:var(--danger);stroke:#fff;stroke-width:1.5}
.geo-pin-hole{fill:#fff}
.geo-controls{position:absolute;top:8px;left:8px;display:flex;flex-direction:column;gap:4px;z-index:2}
.geo-btn{width:32px;height:32px;border-radius:8px;background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow-sm);font-size:18px;font-weight:700;color:var(--text);line-height:1;display:grid;place-items:center}
.geo-btn:hover{background:var(--surface-2)}
.geo-credit{position:absolute;right:0;bottom:0;background:rgba(255,255,255,.86);font-size:11px;padding:1px 6px;border-top-left-radius:6px;z-index:2}
.geo-credit a{color:#2b3a44}
[data-mode="dark"] .geo-tile{filter:brightness(.78) contrast(1.08)}
@media(max-width:700px){.geo-map-box,.geo-view{height:260px}}

/* بوابة الموظف: حالة الموقع والختم */
/* تقارير الموارد البشرية */
.hr-report-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.hr-report-bars{display:grid;gap:9px}
.hr-report-bar{display:grid;grid-template-columns:minmax(110px,190px) minmax(0,1fr) 40px;align-items:center;gap:10px;font-size:13.5px}
.hr-report-bar .track{height:10px;border-radius:99px;background:var(--surface-3);overflow:hidden}
.hr-report-bar .track span{display:block;height:100%;border-radius:99px;background:var(--brand)}
.hr-report-bar strong{text-align:end}
.hr-report-bars.is-warn .track span{background:var(--warn)}
.hr-missing{display:flex;flex-wrap:wrap;gap:4px}
@media(max-width:800px){.hr-report-grid{grid-template-columns:1fr}.hr-report-bar{grid-template-columns:minmax(90px,140px) minmax(0,1fr) 34px}}
@media print{.hr-report-bar .track{border:1px solid #999}.hr-report-bar .track span{background:#555!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}}
/* التجميع: الشرح والخطوات والحاسبة */
.asm-flow{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:12px}
.asm-flow-node{display:grid;gap:2px;padding:8px 12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2);font-weight:600;min-width:120px}
.asm-flow-node small{font-weight:400;color:var(--text-muted);font-size:12px}
.asm-flow-node.is-brand{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-text)}
.asm-flow-arrow{color:var(--text-muted);font-size:18px}
.asm-flow-or{color:var(--text-muted);font-size:13px;padding:0 4px}
.asm-steps{margin:0 0 8px;padding-inline-start:20px;display:grid;gap:6px}
.asm-layout{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;align-items:start}
.asm-side{position:sticky;top:12px}
.asm-step{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--brand);color:#fff;font-size:13px;margin-inline-end:6px}
.asm-choice{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}
.asm-choice-card{display:grid;gap:4px;padding:12px;border:1px solid var(--border);border-radius:var(--radius);cursor:pointer;background:var(--surface)}
.asm-choice-card span{color:var(--text-muted);font-size:13px}
.asm-choice-card:has(input:checked){border-color:var(--brand);background:var(--brand-soft)}
.asm-lines td{vertical-align:top}
.asm-cost-fields{display:grid;gap:6px;margin-top:6px}
.asm-calc-out .table{margin:0}
.asm-calc-total{font-weight:700;padding:8px 0}
tr.is-muted td{opacity:.6}
.inv-asm-group td{background:var(--surface-2);font-weight:600}
@media(max-width:1000px){.asm-layout{grid-template-columns:1fr}.asm-side{position:static}}
/* عمال يومية الصالة بالعدد وأجر الساعة */
.cost-crew{border:1px dashed var(--border);border-radius:var(--radius);padding:10px 12px;background:var(--surface-2)}
.cost-crew-head{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap;margin-bottom:6px}
.cost-crew .form-grid{margin:0}

/* دورات النظام في خريطة النظام */
.cy-filter{margin-inline-start:auto;font-size:13px;font-weight:400}
.cy-grid{display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(min(100%,520px),1fr));align-items:start}
.cy-card{overflow:hidden}
.cy-card[hidden]{display:none}
.cy-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:12px 14px;cursor:pointer;list-style:none}
.cy-head::-webkit-details-marker{display:none}
.cy-ico{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;background:var(--brand-soft);color:var(--brand-text);flex:none}
.cy-card.is-incomplete .cy-ico{background:var(--warn-bg);color:var(--warn)}
.cy-title{display:grid;gap:2px;flex:1;min-width:220px}.cy-title small{color:var(--text-muted);font-size:12.5px}
.cy-progress{display:inline-flex;align-items:center;gap:8px;min-width:150px}
.cy-bar{flex:1;height:8px;border-radius:99px;background:var(--surface-3);overflow:hidden;min-width:90px}
.cy-bar i{display:block;height:100%;border-radius:99px;background:var(--ok)}
.cy-card.is-incomplete .cy-bar i{background:var(--warn)}
.cy-steps{list-style:none;margin:0;padding:4px 14px 14px;display:grid;gap:6px;border-top:1px solid var(--border)}
.cy-step{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius);background:var(--surface-2)}
.cy-mark{flex:none;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--surface-3);color:var(--text-muted)}
.cy-step.is-done .cy-mark{background:var(--ok-bg);color:var(--ok)}
.cy-step.is-missing{background:var(--danger-bg)}.cy-step.is-missing .cy-mark{background:var(--danger);color:#fff}
.cy-step.is-attention{background:var(--warn-bg)}.cy-step.is-attention .cy-mark{background:var(--warn);color:#fff}
.cy-step-body{display:grid;gap:1px;flex:1;min-width:0}
.cy-step-title{font-weight:600}
.cy-step-state{display:inline-flex;align-items:center;gap:6px;flex:none}
@media(max-width:700px){.cy-step{flex-wrap:wrap}.cy-step-state{width:100%;justify-content:flex-end}.cy-progress{width:100%}}
@media print{.cy-card{break-inside:avoid}.cy-filter{display:none}}
/* دليل الحسابات: شجرة منسدلة بالكود */
.coa-tools{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}
.coa-tools .field{margin:0;min-width:180px}
.coa-tree .coa-code{padding-inline-start:calc(10px + var(--lvl, 0) * 20px)}
.coa-tree code{font-size:13.5px}
.coa-toggle{display:inline-grid;place-items:center;width:22px;height:22px;margin-inline-end:4px;vertical-align:middle;border:0;border-radius:6px;background:transparent;color:var(--text-2);cursor:pointer;padding:0}
.coa-toggle:hover{background:var(--surface-3);color:var(--text)}
.coa-toggle.is-leaf{cursor:default}
.coa-toggle svg{transition:transform .15s ease}
html[dir="ltr"] .coa-toggle svg{transform:scaleX(-1)}
.coa-tree tr.is-open .coa-toggle svg{transform:rotate(-90deg)}
.coa-tree tr.is-group td{background:var(--surface-2)}
.coa-tree tr[data-level="1"] td{font-size:15px}
.coa-tree tr.is-inactive td{opacity:.6}
@media print{.coa-tree tr[hidden]{display:table-row!important}.coa-toggle{display:none}}
/* شاشة المطبخ */
.body-blank:has(.kds-page){display:block;padding:0}
.kds-page{min-height:100vh;display:flex;flex-direction:column;gap:10px;padding:10px 12px}
.kds-top{display:flex;align-items:center;gap:12px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:8px 12px}
.kds-title{display:flex;align-items:center;gap:8px;font-size:17px}
.kds-clock{font-size:20px;font-weight:700;color:var(--brand-text);margin-inline-start:6px}
.kds-tabs{display:flex;gap:4px;flex-wrap:wrap;flex:1}
.kds-tools{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.kds-mode-note{margin:0}
.kds-board{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;flex:1;align-items:start}
.kds-col{background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius-lg);display:flex;flex-direction:column;min-height:60vh}
.kds-col-head{display:flex;align-items:center;gap:8px;padding:10px 12px;font-weight:700;border-bottom:1px solid var(--border);position:sticky;top:0;background:inherit;border-radius:var(--radius-lg) var(--radius-lg) 0 0}
.kds-col-new .kds-col-head{color:var(--info)}.kds-col-preparing .kds-col-head{color:var(--warn)}.kds-col-ready .kds-col-head{color:var(--ok)}
.kds-count{margin-inline-start:auto;min-width:26px;text-align:center;border-radius:99px;background:var(--surface);padding:1px 8px}
.kds-col-body{display:grid;gap:10px;padding:10px;align-content:start}
.kds-ticket{background:var(--surface);border:1px solid var(--border);border-inline-start:5px solid var(--info);border-radius:var(--radius);padding:10px 12px;display:grid;gap:6px;box-shadow:var(--shadow-sm)}
.kds-col-preparing .kds-ticket{border-inline-start-color:var(--warn)}.kds-col-ready .kds-ticket{border-inline-start-color:var(--ok)}
.kds-ticket.is-warn{border-inline-start-color:var(--warn);background:var(--warn-bg)}
.kds-ticket.is-late{border-inline-start-color:var(--danger);background:var(--danger-bg)}
.kds-ticket.is-void{border-inline-start-color:var(--danger)}
.kds-ticket-head{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:16px}
.kds-ticket-head strong{display:inline-flex;align-items:center;gap:6px}
.kds-time{font-weight:700;font-variant-numeric:tabular-nums}
.kds-ticket.is-late .kds-time{color:var(--danger)}
.kds-ticket-meta{font-size:12.5px;color:var(--text-muted)}
.kds-alert{color:var(--danger);font-weight:700;font-size:13px;display:flex;gap:5px;align-items:center}
.kds-lines{list-style:none;margin:0;padding:0;display:grid;gap:4px}
.kds-lines li{display:flex;gap:8px;align-items:baseline;font-size:15.5px}
.kds-lines li.is-void{color:var(--danger);text-decoration:line-through}
.kds-qty{min-width:34px;text-align:center;font-weight:800;background:var(--surface-3);border-radius:6px;padding:1px 6px;font-variant-numeric:tabular-nums}
.kds-item{display:grid}.kds-item small{color:var(--warn);font-weight:700;text-decoration:none}
.kds-note{font-size:12.5px;color:var(--text-2);display:flex;gap:5px}
.kds-actions{display:flex;gap:6px;flex-wrap:wrap}
.kds-actions .btn-primary{flex:1;justify-content:center;min-height:38px;font-size:14px}
.kds-empty{color:var(--text-muted);text-align:center;padding:24px 8px}
.kds-offline{position:fixed;inset-inline:12px;bottom:12px;background:var(--danger);color:#fff;padding:8px 12px;border-radius:var(--radius);text-align:center}
@media(max-width:900px){.kds-board{grid-template-columns:1fr}.kds-col{min-height:auto}}
/* التوظيف: صفحة الوظائف العامة ومراجعة المتقدمين */
.body-blank:has(.careers-page){place-items:start center}
.careers-page{width:min(880px,100%);margin:0 auto;display:grid;gap:14px;align-content:start}
.careers-narrow{width:min(560px,100%);margin-top:8vh}
.careers-head{display:flex;gap:16px;align-items:center;padding:16px 18px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm)}
.careers-head h1{margin:2px 0 4px;font-size:clamp(22px,4vw,30px);line-height:1.25}
.careers-head p{margin:0}
.careers-logo{width:64px;height:64px;object-fit:contain;border-radius:14px;background:var(--surface);padding:6px;box-shadow:var(--shadow-sm);flex:none}
.careers-kicker{color:var(--brand-text);font-weight:700;font-size:13px;text-decoration:none}
.careers-meta{display:flex;flex-wrap:wrap;gap:6px 16px;color:var(--text-2);font-size:13.5px}
.careers-meta span{display:inline-flex;align-items:center;gap:5px}
.careers-skills{display:flex;flex-wrap:wrap;gap:5px}
.careers-job{display:flex;gap:14px;align-items:center;justify-content:space-between;padding:16px 18px;color:inherit;text-decoration:none;transition:box-shadow .15s,transform .15s}
.careers-job:hover{box-shadow:var(--shadow-md);transform:translateY(-1px);text-decoration:none}
.careers-job h2{margin:0 0 6px;font-size:18px}
.careers-job-main{display:grid;gap:8px;min-width:0}
.careers-details h2{font-size:15px;margin:14px 0 6px}.careers-details h2:first-child{margin-top:0}
.careers-details p{margin:0;line-height:1.8}
.careers-empty,.careers-message{text-align:center;display:grid;justify-items:center;gap:10px;padding:32px 20px}
.careers-message h1{margin:0;font-size:22px}.careers-message p{margin:0;line-height:1.8;color:var(--text-2)}
.careers-message-icon{width:64px;height:64px;border-radius:50%;display:grid;place-items:center;background:var(--surface-3);color:var(--text-2)}
.careers-message-icon.is-ok{background:var(--ok-bg);color:var(--ok)}
.careers-photo{display:flex;gap:14px;align-items:center}
.careers-photo-pick{width:88px;height:88px;border-radius:50%;flex:none;display:grid;place-items:center;overflow:hidden;background:var(--surface-3);color:var(--text-muted);cursor:pointer;border:2px dashed var(--border-strong)}
.careers-photo-pick img{width:100%;height:100%;object-fit:cover}
.careers-location{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.careers-hp{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
.hr-applicant-cell{display:flex;gap:10px;align-items:center}
.hr-applicant-thumb{width:40px;height:40px;border-radius:50%;object-fit:cover;flex:none;background:var(--surface-3);display:grid;place-items:center;color:var(--text-muted)}
.hr-applicant-grid{display:grid;grid-template-columns:240px minmax(0,1fr);gap:14px;align-items:start}
.hr-applicant-profile{display:grid;justify-items:center;text-align:center;gap:4px}
.hr-applicant-photo{width:180px;height:180px;border-radius:16px;object-fit:cover;background:var(--surface-3);display:grid;place-items:center;color:var(--text-muted)}
.hr-stars{color:#E8A317;letter-spacing:1px}
@media(max-width:700px){.careers-job{flex-direction:column;align-items:stretch}.careers-head{align-items:flex-start}.careers-logo{width:48px;height:48px}.hr-applicant-grid{grid-template-columns:1fr}}
/* حالة التوظيف: ترك العمل وإعادة التعيين */
.hr-employment-actions{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px;margin-bottom:12px}
.hr-action{flex:1 1 100%}.hr-action:not([open]){flex:0 0 auto}
.hr-action>summary{list-style:none;display:inline-flex;cursor:pointer}.hr-action>summary::-webkit-details-marker{display:none}
.hr-action-body{margin-top:10px;padding:14px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2)}
.hr-service-total{display:flex;align-items:center;gap:8px;margin-top:12px;padding:9px 12px;border:1px dashed var(--border-strong);border-radius:var(--radius);color:var(--text-muted);font-size:13.5px}
.hr-service-total .ico{color:var(--brand)}
.hr-geo-state{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:var(--radius);border:1px solid var(--border);background:var(--surface-2);font-size:14px;margin-bottom:10px}
.hr-geo-state .ico{flex:0 0 auto}
.hr-geo-state.is-inside{background:var(--ok-bg);border-color:var(--ok-border);color:var(--ok)}
.hr-geo-state.is-outside{background:var(--danger-bg);border-color:var(--danger-border);color:var(--danger)}
.hr-geo-state.is-weak{background:var(--warn-bg);border-color:var(--warn-border);color:var(--warn)}
.hr-stamp-btn{font-size:18px;min-height:54px}
.hr-stamp-foot{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px}
/* رصيد الإجازات */
.hr-balance-main{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;margin-bottom:8px}
.hr-balance-main span{color:var(--text-muted);font-size:13px}
.hr-balance-main strong{font-size:30px;line-height:1;color:var(--brand-text)}
.hr-balance-main small{color:var(--text-muted)}
.hr-balance-bar{height:8px;border-radius:99px;background:var(--surface-3);overflow:hidden;margin-bottom:12px}
.hr-balance-bar span{display:block;height:100%;background:var(--brand);border-radius:99px}
.hr-balance-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 14px}
.hr-balance-list li{display:flex;justify-content:space-between;gap:8px;padding:6px 0;border-bottom:1px dashed var(--border);font-size:13.5px}
.hr-balance-list li span{color:var(--text-muted)}
@media(max-width:700px){.hr-balance-list{grid-template-columns:1fr}}
/* الطلبات ومسار الموافقة */
.hr-request{padding:12px 0;border-bottom:1px solid var(--border)}
.hr-request:last-child{border-bottom:0}
.hr-request-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.hr-request-where{margin:8px 0;font-size:13.5px;font-weight:600;display:flex;align-items:center;gap:6px}
.hr-approval-steps{display:flex;flex-wrap:wrap;gap:6px 18px;margin:6px 0 2px}
.hr-approval-steps li{display:flex;align-items:flex-start;gap:8px;min-width:180px;flex:1 1 180px}
.hr-step-dot{flex:0 0 auto;width:12px;height:12px;margin-top:5px;border-radius:50%;border:2px solid var(--border-strong,var(--border));background:var(--surface)}
.hr-approval-steps .is-pending .hr-step-dot{border-color:var(--warn);background:var(--warn-bg);box-shadow:0 0 0 3px var(--warn-bg)}
.hr-approval-steps .is-approved .hr-step-dot{border-color:var(--ok);background:var(--ok)}
.hr-approval-steps .is-rejected .hr-step-dot{border-color:var(--danger);background:var(--danger)}
.hr-approval-steps .is-postponed .hr-step-dot{border-color:var(--warn);background:var(--warn)}
.hr-approval-steps .is-skipped,.hr-approval-steps .is-cancelled{opacity:.55}
.hr-passkey-prompt{align-items:center}
.section-title{display:flex;align-items:center;gap:8px;font-size:16px;font-weight:700;margin:0}
/* يومية الصالات: بطاقة لكل ماكينة */
.cost-machine{border-inline-start:4px solid var(--ok)}
.cost-machine.is-idle{border-inline-start-color:var(--warn);background:var(--surface-2)}
.cost-machine.is-idle .card-head{opacity:.85}
.cost-workers td{vertical-align:middle}
.cost-workers td:first-child{min-width:210px}
.cost-workers input[type="time"]{min-width:112px}
.cost-workers .input-num{max-width:120px}
.cost-machine-foot{display:flex;flex-wrap:wrap;gap:6px 18px;margin-top:12px;padding-top:10px;border-top:1px dashed var(--border);font-size:13.5px;color:var(--text-muted)}
.cost-machine-foot strong{color:var(--text)}
.cost-machine-foot .cost-total strong{color:var(--brand-text);font-size:15px}
@media(max-width:700px){.cost-workers thead{display:none}.cost-workers tr{display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:8px 0;border-bottom:1px solid var(--border)}.cost-workers td{display:block;padding:0}.cost-workers td:first-child{grid-column:1/-1;min-width:0}.cost-workers .input-num{max-width:none}}
/* التكاليف: المزامنة مع القيود وقواعد التحميل */
.cost-sync-ok{display:flex;gap:10px;align-items:flex-start}
.cost-sync-ok>svg{color:var(--ok);flex:none;margin-top:2px}
.cost-sync-strip{display:flex;gap:10px;align-items:center;flex-wrap:wrap;padding:10px 14px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--ok-bg)}
.cost-sync-strip>svg{color:var(--ok);flex:none}
.cost-unclassified{margin:6px 0 0;padding-inline-start:18px}
.cost-unclassified li{margin:4px 0}
.cost-tags{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.cost-manual>summary{cursor:pointer;list-style:none}
.cost-manual>summary::-webkit-details-marker{display:none}
.cost-manual>summary .card-title::after{content:'▾';margin-inline-start:8px;color:var(--text-muted);font-size:12px}
.cost-manual:not([open])>summary .card-title::after{content:'▸'}
.cost-choice{border:0;padding:0;margin:0;min-width:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}
.cost-choice>legend{font-weight:700;margin-bottom:8px;padding:0}
.cost-choice-item{display:flex;gap:10px;align-items:flex-start;padding:12px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);cursor:pointer;min-width:0}
.cost-choice-item:has(input:checked){border-color:var(--brand);background:var(--brand-soft)}
.cost-choice-item input{margin-top:3px;flex:none}
.cost-choice-item span{display:flex;flex-direction:column;gap:3px;min-width:0}
.cost-choice-item small{color:var(--text-muted);font-size:12.5px;line-height:1.55}
.cost-split{margin-top:10px}
.cost-class-chips{display:flex;flex-wrap:wrap;gap:8px}
.cost-chip{display:inline-flex;gap:6px;align-items:center;padding:6px 10px;border:1px solid var(--border);border-radius:999px;color:inherit;text-decoration:none;background:var(--surface)}
.cost-chip.is-active,.cost-chip:hover{border-color:var(--brand);background:var(--brand-soft)}
.cost-row-muted td{background:var(--surface-2)}
.cost-dl{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 16px;margin:0}
.cost-dl dt{color:var(--text-muted)}
.cost-dl dd{margin:0;font-weight:600;text-align:end}
.cost-matrix td.num a{color:inherit}
@media(max-width:700px){.cost-dl{grid-template-columns:1fr}.cost-dl dd{text-align:start}.cost-sync-strip .btn{width:100%}}
/* المطعم: الطاولات والطلب والدليفري */
.rest-tables{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.rest-table{display:flex;flex-direction:column;gap:4px;min-height:112px;padding:12px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);color:inherit;text-decoration:none;transition:border-color var(--t-base),box-shadow var(--t-base)}
.rest-table.is-free{border-inline-start:4px solid var(--ok)}
.rest-table.is-busy{border-inline-start:4px solid var(--warn);background:var(--warn-bg)}
a.rest-table:hover{border-color:var(--brand);box-shadow:var(--shadow-md)}
.rest-table-name{font-weight:700;font-size:15px}
.rest-table-total{font-size:17px;color:var(--text)}
.rest-table-meta{display:flex;align-items:center;gap:4px;color:var(--text-muted);font-size:12.5px}
.rest-table .badge{align-self:flex-start}
.rest-lines{display:grid;gap:8px}
.rest-line{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:8px;padding:8px 0;border-bottom:1px dashed var(--border)}
.rest-line-main{display:grid;gap:3px;min-width:0}
.rest-line-main strong{overflow:hidden;text-overflow:ellipsis}
.rest-line-qty{display:flex;align-items:center;gap:4px}
.rest-line-qty .input{width:68px;text-align:center}
.rest-line-total{min-width:84px;text-align:end}
.rest-totals{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 14px;margin:14px 0 0;padding-top:10px;border-top:1px solid var(--border)}
.rest-totals dt{color:var(--text-muted)}
.rest-totals dd{margin:0;text-align:end;font-weight:600}
.rest-totals .rest-grand{font-size:18px;font-weight:800;color:var(--text)}
.rest-actions{display:flex;flex-wrap:wrap;gap:8px}
.rest-pay-total{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;margin-bottom:12px;border-radius:var(--radius-lg);background:var(--brand-soft);font-size:18px}
.rest-change{font-size:20px;color:var(--ok)}
.rest-drivers{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px}
.rest-driver.has-out{border-top:3px solid var(--warn)}
.rest-driver-who{display:flex;flex-direction:column;gap:2px}
.rest-driver-orders{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:6px}
.rest-driver-orders li{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.rest-driver-orders li strong{margin-inline-start:auto}
.rest-driver-due{display:flex;justify-content:space-between;margin-top:10px;padding-top:8px;border-top:1px dashed var(--border);font-weight:700}
.rest-table.is-reserved{border-inline-start:4px solid var(--info);background:var(--info-bg)}
.rest-table-flag{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;padding:1px 7px;border-radius:999px;font-size:12px;font-weight:700;background:var(--surface);border:1px solid var(--border)}
.rest-table-flag.is-kitchen{color:var(--danger);border-color:var(--danger)}
.rest-table-flag.is-reserved{color:var(--info);border-color:var(--info)}
.rest-line-kitchen{display:inline-flex;align-items:center;gap:3px;font-size:12px;font-weight:600}
.rest-line-kitchen.is-sent{color:var(--ok)}
.rest-line-kitchen.is-new{color:var(--warn)}
.rest-kitchen-rounds{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.rest-kitchen-rounds li{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:6px 0;border-bottom:1px dashed var(--border)}
.rest-kitchen-rounds li .btn{margin-inline-start:auto}
.rest-res-list{display:grid;gap:10px}
.rest-res-layout{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr);gap:16px;align-items:start}
.rest-res{display:grid;grid-template-columns:86px minmax(0,1fr);gap:10px 12px;align-items:start;padding:12px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface)}
.rest-res.is-late{border-inline-start:4px solid var(--warn)}
.rest-res.is-soon{border-inline-start:4px solid var(--info)}
.rest-res.is-done{opacity:.72}
.rest-res-time{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px;border-radius:var(--radius);background:var(--brand-soft)}
.rest-res-time strong{font-size:18px}
.rest-res-who{display:grid;gap:3px;min-width:0}
.rest-res-who code{white-space:nowrap}
.rest-res-who svg{display:inline-block;vertical-align:-2px}
.rest-res-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:6px;padding-top:8px;border-top:1px dashed var(--border)}
.rest-res-cancel{grid-column:1/-1}
.rest-res-deposit{grid-column:1/-1;border-top:1px dashed var(--border);padding-top:8px;display:grid;gap:4px}
.rest-res-deposit > summary{width:fit-content;list-style:none;cursor:pointer}.rest-res-deposit > summary::-webkit-details-marker{display:none}
.rest-res-methods{display:inline-flex;gap:10px;flex-wrap:wrap;align-items:center}
.kitchen-ticket-head{display:flex;flex-direction:column;align-items:center;gap:2px;padding-bottom:6px;border-bottom:2px solid currentColor;text-align:center}
.kitchen-ticket-section{font-size:20px;font-weight:800}
.kitchen-ticket-copy{padding:1px 8px;border:1px solid currentColor;border-radius:4px;font-size:11px;font-weight:700}
.kitchen-ticket-place{margin:8px 0 4px;text-align:center;font-size:22px;font-weight:800}
.kitchen-ticket-alert{margin:4px 0 8px;padding:4px;border:2px solid currentColor;text-align:center;font-weight:800}
.kitchen-ticket-round{margin:0 0 6px;text-align:center;font-weight:700}
.kitchen-ticket-lines{width:100%;margin:10px 0;border-collapse:collapse;font-size:15px}
.kitchen-ticket-lines td{padding:6px 2px;border-bottom:1px dashed var(--border-strong);vertical-align:top}
.kitchen-ticket-lines .kitchen-qty{width:1%;padding-inline-end:8px;white-space:nowrap;font-size:18px;font-weight:800}
.kitchen-ticket-lines.is-void strong{text-decoration:line-through}
.kitchen-note{margin-top:2px;font-size:13px;font-weight:700}
.kitchen-void-title{margin-top:8px;padding:3px 6px;border:2px dashed currentColor;text-align:center;font-weight:800}
.kitchen-ticket-notes{margin-top:8px;padding-top:6px;border-top:1px dashed var(--border-strong);font-size:13px}
.kitchen-ticket-notes span{font-weight:700}
.paper-thermal58 .kitchen-ticket-place{font-size:18px}
.paper-thermal58 .kitchen-ticket-lines{font-size:13px}
@media(max-width:700px){.rest-tables{grid-template-columns:repeat(2,minmax(0,1fr))}.rest-line{grid-template-columns:minmax(0,1fr) auto}.rest-line-main{grid-column:1/-1}.rest-line-total{min-width:0}
  .rest-res{grid-template-columns:70px minmax(0,1fr)}}
@media(max-width:900px){.rest-res-layout{grid-template-columns:1fr}}
.hrc-dept{padding-inline-start:calc(var(--depth,0) * 20px)}
.hrc-table tr.hrc-parent td{font-weight:700;background:var(--surface-2)}.hrc-table tr.is-selected td{background:var(--brand-soft)}
.hrc-table tfoot tr.hrc-total td{font-weight:700;border-top:2px solid var(--border)}
.hrc-change{font-weight:700;white-space:nowrap}.hrc-change.is-up{color:var(--danger)}.hrc-change.is-down{color:var(--ok)}
.hrc-share{display:inline-block;vertical-align:middle;width:56px;height:6px;border-radius:6px;background:var(--surface-2);overflow:hidden}.hrc-share>span{display:block;height:100%;background:var(--brand)}
.hrc-lines>summary{cursor:pointer;font-weight:700;padding:6px 0}
.print-only{display:none}@media print{.print-only{display:block}.hrc-share{display:none}}
@media(max-width:700px){.hrc-dept{padding-inline-start:0}.hrc-share{width:40px}}
.cost-entry-box{border:1px solid var(--border);border-radius:12px;padding:12px 14px;background:var(--surface-2)}
.cost-summary-table .input,.cost-summary-table .smart-select{min-width:86px}.cost-summary-table td:first-child{min-width:150px}
.cost-summary-notes{margin:0;padding-inline-start:18px;line-height:1.9}
.hr-edit-times{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
@media(max-width:700px){.hr-edit-times{grid-template-columns:1fr}}
.login-passkey{margin-top:14px}
.login-divider{display:flex;align-items:center;gap:10px;color:var(--text-muted);font-size:13px;margin:4px 0 12px}
.login-divider::before,.login-divider::after{content:"";flex:1;height:1px;background:var(--border)}
.hr-punch-list{display:flex;flex-direction:column;gap:6px}
.hr-punch-list li{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface)}
.hr-punch-list .num{font-weight:700}
.hr-device-state{display:inline-flex;align-items:center;gap:6px;font-weight:700}
.hr-device-state::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--text-muted)}
.hr-device-state.is-online::before{background:var(--ok);box-shadow:0 0 0 3px var(--ok-bg)}
.hr-device-state.is-offline::before{background:var(--danger)}
.hr-setup-steps{counter-reset:step;display:flex;flex-direction:column;gap:8px}
.hr-setup-steps li{counter-increment:step;position:relative;padding-inline-start:34px;line-height:1.8}
.hr-setup-steps li::before{content:counter(step);position:absolute;inset-inline-start:0;top:2px;width:24px;height:24px;border-radius:50%;background:var(--brand-soft);color:var(--brand-text);font-weight:700;display:grid;place-items:center;font-size:13px}
.hr-setup-value{direction:ltr;unicode-bidi:plaintext;font-family:Consolas,'Courier New',monospace;background:var(--surface-3);padding:2px 8px;border-radius:6px;font-weight:700}
.hr-code-block{direction:ltr;text-align:left;unicode-bidi:plaintext;white-space:pre-wrap;word-break:break-all;background:#0D1B2A;color:#e2e8f0;padding:12px;border-radius:var(--radius-sm);font-family:Consolas,'Courier New',monospace;font-size:12.5px}

/* كروت الإحصاء */
.stat-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 7px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.stat-top   { display: flex; align-items: center; gap: 8px; }
.stat-ico   { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
              background: var(--brand-soft); color: var(--brand-text); flex: 0 0 34px; }
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-note  { font-size: 11.5px; color: var(--text-muted); }

.stat.is-ok     .stat-ico { background: var(--ok-bg);     color: var(--ok); }
.stat.is-danger .stat-ico { background: var(--danger-bg); color: var(--danger); }
.stat.is-warn   .stat-ico { background: var(--warn-bg);   color: var(--warn); }
.stat.is-info   .stat-ico { background: var(--info-bg);   color: var(--info); }

/* ---------------------------------------------------------------
   10) الأزرار
   --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 15px;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn:hover  { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }

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

.btn-danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); background: var(--danger); }

.btn-ok      { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { filter: brightness(.93); background: var(--ok); }

.btn-ghost   { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-soft    { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.btn-soft:hover { background: var(--brand-soft); filter: brightness(.96); }

.btn-sm  { min-height: 34px; padding: 0 11px; font-size: 13px; gap: 5px; }
.btn-lg  { min-height: 50px; padding: 0 22px; font-size: 15.5px; }
.btn-icon{ width: 38px; min-height: 38px; padding: 0; flex: 0 0 38px; }
.btn-block { display: flex; width: 100%; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------
   11) النماذج
   --------------------------------------------------------------- */
.form-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-all { grid-column: 1 / -1; }

.label {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
}
.label .req { color: var(--danger); font-weight: 700; }
.hint { font-size: 11.5px; color: var(--text-muted); }

.input, .select, .textarea {
  width: 100%; min-height: 42px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text); font-size: 14.5px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); opacity: .75; cursor: not-allowed; }
.input[readonly] { background: var(--surface-3); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A8792' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-inline-start: 12px;
  padding-inline-end: 34px;
}
[data-mode="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A949E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* قائمة الاختيار العامة القابلة للبحث */
.smart-select{ position:relative; width:100%; min-width:0; }
.smart-select-native{
  position:absolute !important; width:1px !important; height:1px !important;
  min-height:0 !important; padding:0 !important; margin:0 !important;
  opacity:0 !important; pointer-events:none !important; inset:50% auto auto 50%;
}
.smart-select-control{
  min-height:42px; display:flex; align-items:stretch; overflow:hidden;
  border:1px solid var(--border-strong); border-radius:var(--radius);
  background:var(--surface); transition:border-color var(--t-fast),box-shadow var(--t-fast);
}
.smart-select-control:hover{ border-color:var(--text-muted); }
.smart-select.is-open .smart-select-control,
.smart-select-control:focus-within{
  border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft);
}
.smart-select.is-invalid .smart-select-control{
  border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-bg);
}
.smart-select-trigger{
  flex:1; min-width:0; min-height:40px; border:0; background:transparent;
  color:var(--text); font:inherit; padding:.45rem .75rem; cursor:pointer;
  display:flex; align-items:center; justify-content:space-between; gap:.65rem; text-align:start;
}
.smart-select-trigger:focus{ outline:none; }
.smart-select-value{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.smart-select.is-placeholder .smart-select-value{ color:var(--text-muted); }
.smart-select-caret{
  flex:0 0 8px; width:8px; height:8px; border-inline-end:2px solid var(--text-muted);
  border-bottom:2px solid var(--text-muted); transform:rotate(45deg) translateY(-2px);
  transition:transform var(--t-fast);
}
.smart-select.is-open .smart-select-caret{ transform:rotate(225deg) translate(-2px,-2px); }
.smart-select-clear{
  flex:0 0 34px; width:34px; border:0; border-inline-start:1px solid var(--border);
  background:transparent; color:var(--text-muted); font-size:1.25rem; cursor:pointer;
}
.smart-select-clear:hover{ color:var(--danger); background:var(--danger-bg); }
.smart-select-clear[hidden]{ display:none; }
.smart-select-add{flex:0 0 36px;width:36px;border:0;border-inline-start:1px solid var(--border);background:var(--brand-soft);color:var(--brand-text);font-size:1.3rem;font-weight:700;cursor:pointer}.smart-select-add:hover{background:var(--brand);color:#fff}.smart-select-add:focus{outline:none;box-shadow:inset 0 0 0 2px var(--brand)}
.smart-select-add:disabled{opacity:.5;cursor:not-allowed;background:var(--surface-3);color:var(--text-muted)}
#pos-assignment-card[hidden]{display:none!important}
.smart-select.is-disabled{ opacity:.72; }
.smart-select.is-disabled .smart-select-control{ background:var(--surface-3); }
.smart-select.is-disabled .smart-select-trigger{ cursor:not-allowed; }
.smart-select.is-compact .smart-select-control{ min-height:34px; border-radius:8px; }
.smart-select.is-compact .smart-select-trigger{ min-height:32px; padding:.25rem .45rem; font-size:.82rem; }
.smart-select.is-compact .smart-select-clear{ flex-basis:28px; width:28px; }

.smart-select-menu{
  position:fixed; z-index:1600; direction:rtl; overflow:hidden;
  display:flex; flex-direction:column; padding:.4rem;
  border:1px solid var(--border-strong); border-radius:var(--radius-lg);
  background:var(--surface); box-shadow:var(--shadow-lg);
}
.smart-select-menu[hidden]{ display:none; }
.smart-select-search{ position:relative; flex:0 0 auto; margin-bottom:.35rem; }
.smart-select-search::before{
  content:'⌕'; position:absolute; inset-inline-start:.65rem; top:50%; transform:translateY(-52%);
  color:var(--text-muted); font-size:1.15rem; pointer-events:none;
}
.smart-select-input{
  width:100%; height:40px; padding:.35rem 2rem .35rem .65rem;
  border:1px solid var(--border); border-radius:9px; background:var(--surface-2);
  color:var(--text); font:inherit;
}
.smart-select-input:focus{
  outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft);
  background:var(--surface);
}
.smart-select-options{
  overflow:auto; min-height:0; max-height:280px;
  overscroll-behavior:contain; scrollbar-gutter:stable;
  -webkit-overflow-scrolling:touch;
}
.smart-select-option{
  position:relative; width:100%; min-height:38px; display:flex; flex-direction:column; justify-content:center;
  padding:.42rem .6rem; border:1px solid transparent; border-radius:9px;
  background:transparent; color:var(--text); font:inherit; text-align:start; cursor:pointer;
}
.smart-select-option:hover,.smart-select-option.is-active{
  background:var(--brand-soft); border-color:var(--brand);
}
.smart-select-option.is-selected{ color:var(--brand-text); font-weight:700; }
.smart-select-option.is-selected::after{ content:'✓'; position:absolute; inset-inline-end:1rem; }
.smart-select-option.is-create{
  margin-top:.3rem; border-top-color:var(--border); border-radius:0 0 9px 9px;
  color:var(--brand-text); font-weight:700; background:var(--brand-soft);
}
.smart-select-option.is-create:hover,.smart-select-option.is-create.is-active{
  color:var(--brand-text); border-color:var(--brand); background:var(--brand-soft);
}
.smart-select-option:disabled{ opacity:.5; cursor:not-allowed; }
.smart-select-option-text{ padding-inline-end:1.35rem; }
.smart-select-option-meta{ color:var(--text-muted); font-size:.72rem; font-weight:400; }
.smart-select-empty{ padding:1rem .5rem; text-align:center; color:var(--text-muted); font-size:.84rem; }
.inv-disc .smart-select{ flex:0 0 72px; }

@media(max-width:700px){
  .smart-select-menu{ max-width:calc(100vw - 16px); }
}

.input.is-invalid, .select.is-invalid, .textarea.is-invalid {
  border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg);
}
.field-error { font-size: 12px; color: var(--danger); font-weight: 600; }

.input-num { direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }

.input-group { display: flex; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .btn   { border-start-start-radius: 0; border-end-start-radius: 0; margin-inline-start: -1px; }

.check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 14px; user-select: none;
  min-height: 40px;
}
.check input[type="checkbox"], .check input[type="radio"] {
  width: 19px; height: 19px; accent-color: var(--brand); cursor: pointer; flex: 0 0 19px;
}

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 42px; height: 24px; border-radius: 12px;
  background: var(--border-strong); position: relative;
  transition: background var(--t-fast); flex: 0 0 42px;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform var(--t-fast); box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(-18px); }
/* في الواجهة الإنجليزية (من اليسار لليمين) يتحرك المؤشر لليمين داخل المسار */
html[dir="ltr"] .switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }

.fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px;
}
.fieldset > legend {
  font-size: 13px; font-weight: 700; color: var(--brand-text);
  padding: 0 7px; margin-inline-start: 4px;
}

/* ---------------------------------------------------------------
   12) الجداول
   --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { font-size: 14px; table-layout: auto; border-spacing: 0; }
.table th, .table td { padding: 10px 12px; text-align: start; vertical-align: middle; }
.table thead th {
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.num, .table th.num { display: table-cell; text-align: left; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.table [data-col-align="right"], table [data-col-align="right"] { text-align: right !important; }
.table [data-col-align="left"], table [data-col-align="left"] { text-align: left !important; }
.table [data-col-align="center"], table [data-col-align="center"] { text-align: center !important; }
.table td.actions { white-space: nowrap; width: 1%; }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--border-strong); }

.table-empty { padding: 42px 18px; text-align: center; color: var(--text-muted); }
.table-empty .ico { margin: 0 auto 10px; opacity: .4; }

/* ---------------------------------------------------------------
   13) الشارات والتنبيهات
   --------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; line-height: 1.7;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge-ok     { background: var(--ok-bg);     color: var(--ok); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn   { background: var(--warn-bg);   color: var(--warn); }
.badge-info   { background: var(--info-bg);   color: var(--info); }
.badge-brand  { background: var(--brand-soft);color: var(--brand-text); }

.activity-filter-bar{display:flex;flex-wrap:wrap;gap:8px;padding:12px 16px;border-top:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--surface-2)}
.activity-filter{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border);background:var(--surface);color:var(--text-muted);border-radius:999px;padding:7px 11px;font:inherit;cursor:pointer}
.activity-filter:hover,.activity-filter.is-active{border-color:var(--brand);color:var(--brand-text);background:var(--brand-soft)}
.activity-filter .badge{min-width:24px;text-align:center}
.activity-device-line{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.activity-device-icon{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:9px;background:var(--brand-soft);color:var(--brand-text)}
.activity-location{display:flex;align-items:center;gap:5px;margin-top:4px}
.activity-location a{color:var(--brand-text);font-weight:700;text-decoration:underline}
@media(max-width:640px){.dashboard-activity .card-head{align-items:flex-start}.activity-filter-bar{flex-wrap:nowrap;overflow-x:auto;padding:10px}.activity-filter{flex:0 0 auto}.dashboard-activity td:first-child{width:auto!important}.activity-device-line .muted{width:100%}}

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 14px; margin-bottom: 12px;
}
.alert .ico { flex: 0 0 20px; margin-top: 2px; }
.alert-success { background: var(--ok-bg);     border-color: var(--ok-border);     color: var(--ok); }
.alert-danger  { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert-warning { background: var(--warn-bg);   border-color: var(--warn-border);   color: var(--warn); }
.alert-info    { background: var(--info-bg);   border-color: var(--info-border);   color: var(--info); }
.alert-close { margin-inline-start: auto; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* الرسائل المنبثقة */
.toasts {
  position: fixed; z-index: 200;
  top: 14px; inset-inline-start: 14px; inset-inline-end: 14px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; max-width: 420px; margin-inline: auto;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toastIn .28s cubic-bezier(.3,1.2,.5,1);
}
.toast.is-out { animation: toastOut .22s ease forwards; }
.toast-success { border-inline-start: 4px solid var(--ok); }
.toast-danger  { border-inline-start: 4px solid var(--danger); }
.toast-warning { border-inline-start: 4px solid var(--warn); }
.toast-info    { border-inline-start: 4px solid var(--info); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------------------------------------------------------------
   14) شريط الأدوات والفلاتر
   --------------------------------------------------------------- */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.toolbar .search-box { flex: 1 1 220px; min-width: 0; position: relative; }
/* زر التنفيذ جنب خانات لها عناوين يصطف مع خانات الإدخال نفسها لا مع عناوينها */
.toolbar > .btn, .toolbar > button, .toolbar > a.btn { align-self: flex-end; }
.toolbar .search-box .input { padding-inline-start: 38px; }
.toolbar .search-box .ico {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%); color: var(--text-muted); pointer-events: none;
}

.filters {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  padding: 13px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 12px;
}
.filters > .btn, .filters > button, .filters > a.btn { align-self: end; }

/* ---------------------------------------------------------------
   15) ترقيم الصفحات
   --------------------------------------------------------------- */
.pager {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; padding: 12px 4px;
}
.pager-info { font-size: 13px; color: var(--text-muted); margin-inline-end: auto; }
.pager-btn {
  min-width: 38px; height: 38px; padding: 0 10px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2);
  font-size: 13.5px; font-weight: 600;
}
.pager-btn:hover { background: var(--surface-3); text-decoration: none; }
.pager-btn.is-active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pager-btn.is-disabled { opacity: .4; pointer-events: none; }

/* ---------------------------------------------------------------
   16) النوافذ المنبثقة
   --------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(8,12,16,.55);
  display: grid; place-items: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity var(--t-base);
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 480px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(14px) scale(.98);
  transition: transform var(--t-base);
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-backdrop.is-open .modal { transform: none; }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-start; background: var(--surface-2); }
.modal-lg { max-width: 760px; }

/* ---------------------------------------------------------------
   17) الشجرة (دليل الحسابات · التصنيفات · مراكز التكلفة)
   --------------------------------------------------------------- */
.tree { font-size: 14px; }
.tree-node { border-bottom: 1px solid var(--border); }
.tree-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; min-height: 46px;
}
.tree-row:hover { background: var(--surface-2); }
.tree-toggle {
  width: 24px; height: 24px; flex: 0 0 24px;
  display: grid; place-items: center; color: var(--text-muted);
  border-radius: 5px; transition: transform var(--t-fast);
}
.tree-toggle:hover { background: var(--surface-3); }
.tree-toggle.is-open { transform: rotate(-90deg); }
.tree-toggle.is-leaf { visibility: hidden; }
.tree-code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--text-muted); flex: 0 0 auto; }
.tree-name { flex: 1; min-width: 0; }
.tree-name.is-group { font-weight: 700; }
.tree-children { display: none; }
.tree-children.is-open { display: block; }
.tree-node[data-level="2"] .tree-row { padding-inline-start: 28px; }
.tree-node[data-level="3"] .tree-row { padding-inline-start: 52px; }
.tree-node[data-level="4"] .tree-row { padding-inline-start: 76px; }
.tree-node[data-level="5"] .tree-row { padding-inline-start: 100px; }

/* شجرة أوامر التصنيع الرئيسية والفرعية */
.production-tree-card{overflow:visible}
.production-tree-node{border:1px solid var(--border);border-radius:10px;background:var(--surface);overflow:hidden}
.bom-visual-wrap{overflow:auto;padding:20px;direction:rtl}.bom-visual-tree,.bom-visual-children{list-style:none;margin:0;padding:0}.bom-visual-children{margin-right:28px;padding-right:30px;border-right:2px solid var(--border)}.bom-visual-item{position:relative;margin:10px 0}.bom-visual-children>.bom-visual-item:before{content:"";position:absolute;right:-30px;top:28px;width:30px;border-top:2px solid var(--border)}.bom-visual-node{min-width:330px;display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--border);border-right:4px solid var(--brand);border-radius:12px;background:var(--surface);box-shadow:var(--shadow-sm)}.bom-visual-node.type-raw{border-right-color:#22a06b}.bom-visual-node.type-packaging{border-right-color:#e49b0f}.bom-visual-node.type-semi{border-right-color:#7c4dff}.bom-visual-node.type-service{border-right-color:#64748b}.bom-visual-node.type-finished{border-right-color:var(--brand)}.bom-visual-icon{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;background:var(--brand-soft);color:var(--brand);flex:0 0 auto}.bom-visual-main{min-width:140px;flex:1}.bom-visual-meta{display:grid;gap:3px;text-align:left;white-space:nowrap}.bom-visual-meta small{color:var(--muted)}
@media(max-width:720px){.bom-visual-wrap{padding:12px}.bom-visual-children{margin-right:12px;padding-right:16px}.bom-visual-children>.bom-visual-item:before{right:-16px;width:16px}.bom-visual-node{min-width:270px;align-items:flex-start;flex-wrap:wrap}.bom-visual-meta{margin-right:44px;text-align:right}}
.production-tree-card>.card-body>.production-tree-node{border:0;border-radius:0}
.production-tree-node>summary{list-style:none;display:flex;align-items:center;gap:9px;padding:12px 14px;cursor:pointer;background:var(--surface-2);position:relative}
.production-tree-node>summary::-webkit-details-marker{display:none}
.production-tree-node.is-current>summary{box-shadow:inset -4px 0 var(--brand);background:var(--brand-soft)}
.production-tree-chevron{display:grid;place-items:center;color:var(--text-muted);transition:transform var(--t-fast)}
.production-tree-node[open]>summary>.production-tree-chevron{transform:rotate(-90deg)}
.production-tree-branch{color:var(--brand);display:grid;place-items:center}
.production-process-number{display:flex;flex-direction:column;gap:2px;min-width:125px}
.production-process-number small,.production-tree-qty small{color:var(--text-muted);font-size:10px}
.production-tree-title{display:flex;align-items:center;gap:6px;flex:1;min-width:150px;flex-wrap:wrap}
.production-tree-title small{display:block;flex-basis:100%;color:var(--text-muted)}
.production-tree-qty{display:flex;flex-direction:column;gap:2px;min-width:78px;text-align:center}
.production-tree-body{padding:10px}
.production-shortage-summary{display:flex;justify-content:center;align-items:center;text-align:center;gap:12px 24px;flex-wrap:wrap;padding:9px 12px;margin-bottom:8px;border:1px dashed var(--border-strong);border-radius:8px;background:var(--surface-2)}
.production-shortage-parent{display:flex;justify-content:center;align-items:center;gap:5px;flex:1 1 100%;padding-bottom:7px;border-bottom:1px solid var(--border);font-size:14px;font-weight:700}
.production-shortage-parent strong:first-of-type{color:var(--brand-text);font-size:15px}
.production-components-panel{border:1px solid var(--border);border-radius:10px;overflow:hidden;background:var(--surface)}
.production-components-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;background:var(--surface-2);border-bottom:1px solid var(--border)}
.production-components-head>div{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.production-components-head small{display:block;flex-basis:100%;padding-inline-start:24px;color:var(--text-muted)}
.production-components-actions{justify-content:flex-end}.production-components-actions .btn{white-space:nowrap}
.production-component-list{display:grid;gap:0}
.production-component-branch{padding:10px;border-bottom:1px solid var(--border);background:var(--surface)}
.production-component-branch:last-child{border-bottom:0}
.production-component-card{border:1px solid var(--border);border-radius:9px;overflow:hidden;background:var(--surface)}
.production-component-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 11px;background:var(--surface-2);border-bottom:1px solid var(--border)}
.production-component-identity{display:flex;align-items:center;gap:9px}.production-component-identity>div{display:flex;flex-direction:column;gap:2px}.production-component-identity small{color:var(--text-muted)}
.production-component-seq{display:grid;place-items:center;width:25px;height:25px;border-radius:50%;background:var(--brand-soft);color:var(--brand-text);font-weight:700;font-size:12px}
.production-component-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(105px,1fr));gap:0}
.production-component-metrics>div{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:60px;padding:8px;border-inline-end:1px solid var(--border);text-align:center}.production-component-metrics>div:last-child{border-inline-end:0}
.production-component-metrics small{color:var(--text-muted);font-size:11px}.production-component-metrics strong{font-size:14px}.production-component-metrics .is-primary{background:var(--brand-soft)}
.production-component-foot{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:7px 11px;border-top:1px solid var(--border);color:var(--text-muted);font-size:12px}.production-component-foot>span{display:flex;align-items:center;gap:5px}
.production-stock-list{margin-top:5px;font-size:12px;color:var(--text-muted)}
.production-stock-list>summary{cursor:pointer;color:var(--brand-text)}
.production-stock-list>div{display:flex;justify-content:space-between;gap:12px;padding:3px 6px;border-bottom:1px dashed var(--border)}
.production-component-children{position:relative;margin-top:10px;margin-inline-start:24px;padding-inline-start:18px;border-inline-start:2px solid var(--brand-ring)}
.production-component-children:before{content:"";position:absolute;inset-inline-start:-2px;top:22px;width:18px;border-top:2px solid var(--brand-ring)}
.production-child-link-label{display:flex;align-items:center;gap:7px;width:max-content;max-width:calc(100% - 8px);margin-bottom:7px;padding:6px 9px;border-radius:8px;background:var(--brand-soft);color:var(--brand-text);font-size:12px}
.production-component-uncovered{display:flex;align-items:center;gap:8px;margin-top:7px;padding:7px 10px;border-radius:8px;background:var(--warn-bg);color:var(--warn);font-size:12px}.production-component-uncovered>span{flex:1}.production-component-uncovered .btn{background:var(--surface);white-space:nowrap}
.manufacturing-execute-ready{background:var(--brand);border-color:var(--brand);color:var(--on-brand);animation:manufacturingReadyGlow 1.65s ease-in-out infinite;will-change:box-shadow}
.manufacturing-execute-ready:hover{background:var(--brand-hover);border-color:var(--brand-hover);color:var(--on-brand);animation-play-state:paused}
.manufacturing-execute-blocked,.manufacturing-execute-blocked:disabled{opacity:1;background:var(--surface-3);border-color:var(--border-strong);color:var(--text-muted);cursor:not-allowed;box-shadow:none}
.manufacturing-execute-blocked .ico{color:var(--danger);stroke-width:2.8}
.manufacturing-readiness-alert{align-items:flex-start}.manufacturing-readiness-alert>.ico{color:var(--danger);flex:0 0 auto;margin-top:1px}
.manufacturing-shortage-list{display:grid;gap:4px;margin-top:8px}.manufacturing-shortage-list>span{padding:6px 9px;border:1px solid var(--danger-border);border-radius:7px;background:var(--danger-bg)}
@keyframes manufacturingReadyGlow{0%,100%{box-shadow:0 0 0 0 var(--brand-ring),0 0 7px var(--brand)}50%{box-shadow:0 0 0 5px transparent,0 0 20px var(--brand)}}
@media(prefers-reduced-motion:reduce){.manufacturing-execute-ready{animation:none;box-shadow:0 0 0 2px var(--brand-soft),0 0 12px var(--brand)}}
.document-meta-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(175px,1fr));gap:10px}.document-meta-grid>div,.document-meta-strip>span{display:flex;flex-direction:column;gap:3px;padding:9px 11px;border:1px solid var(--border);border-radius:8px;background:var(--surface-2)}.document-meta-grid small,.document-meta-strip small{color:var(--text-muted);font-size:11px}.document-meta-strip{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.production-unlinked-children{display:grid;gap:8px;margin-top:10px}.production-tree-leaf{display:flex;align-items:center;gap:6px;color:var(--text-muted);font-size:12px;padding:10px}
@media(max-width:900px){.production-tree-node>summary{align-items:flex-start;flex-wrap:wrap}.production-process-number,.production-tree-title{min-width:calc(50% - 32px)}.production-tree-qty{min-width:70px}.production-component-metrics{grid-template-columns:repeat(3,1fr)}}
@media(max-width:700px){.production-process-number,.production-tree-title{min-width:calc(100% - 58px)}.production-shortage-summary{gap:8px;flex-direction:column}.production-component-metrics{grid-template-columns:repeat(2,1fr)}.production-component-foot,.production-stock-list>div,.production-component-uncovered{flex-direction:column;align-items:stretch;gap:5px}.production-component-children{margin-inline-start:10px;padding-inline-start:10px}.document-meta-strip{grid-template-columns:repeat(2,1fr)}}

/* ---------------------------------------------------------------
   18) أدوات مساعدة
   --------------------------------------------------------------- */
.d-none  { display: none !important; }
.d-flex  { display: flex !important; }
.d-grid  { display: grid !important; }
.flex-1  { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }  .gap-2 { gap: 8px; }  .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }  .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }  .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.ms-auto { margin-inline-start: auto; }
.w-100 { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.ico { flex-shrink: 0; }

.empty-state { padding: 48px 20px; text-align: center; }
.empty-state .ico { margin: 0 auto 12px; opacity: .35; }
.empty-state h3 { font-size: 16px; margin-bottom: 5px; }
.empty-state p  { color: var(--text-muted); font-size: 13.5px; margin-bottom: 16px; }

.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------
   19) الاستجابة
   --------------------------------------------------------------- */
@media (min-width: 992px) {
  .sidebar { transform: translateX(0); box-shadow: none; }
  .sb-close { display: none; }
  .app-header, .app-main {
    margin-inline-start: var(--sidebar-w);
    transition: margin-inline-start var(--t-base), width var(--t-base);
  }
  /* لازم نخصم عرض القائمة الجانبية من العرض، وإلا الصفحة بتزحف أفقياً */
  .app-main {
    width: calc(100% - var(--sidebar-w));
    padding: 20px 22px calc(var(--session-bar-h) + var(--license-bar-h, 0px) + 28px);
  }

  /* الشريط السفلي للموبايل — على الكمبيوتر القائمة الجانبية بتغني عنه.
     المدير يقدر يرجّعه من الإعدادات (footer_on_desktop). */
  .footer-nav { display: none; }
  .app.footer-on-desktop .footer-nav { display: flex; }
  .app.has-footer-nav.footer-on-desktop .app-main {
    padding-bottom: calc(var(--nav-h) + var(--session-bar-h) + var(--license-bar-h, 0px) + 34px);
  }
  .sb-overlay { display: none; }
  .footer-nav { inset-inline-start: calc(var(--sidebar-w) + 16px); inset-inline-end: 16px; }
  .app .footer-nav{bottom:calc(var(--session-bar-h) + var(--license-bar-h, 0px) + 10px);}
  .session-statusbar{inset-inline-start:var(--sidebar-w);}
  .btn-menu { display: grid; }

  /* وضع الأيقونات: يوفّر مساحة الشاشة مع إبقاء كل الروابط متاحة. */
  html.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
  html.sidebar-collapsed .app-header,
  html.sidebar-collapsed .app-main { margin-inline-start: var(--sidebar-collapsed-w); }
  html.sidebar-collapsed .app-main { width: calc(100% - var(--sidebar-collapsed-w)); }
  html.sidebar-collapsed .footer-nav { inset-inline-start: calc(var(--sidebar-collapsed-w) + 16px); }
  html.sidebar-collapsed .session-statusbar{inset-inline-start:var(--sidebar-collapsed-w);}
  html.sidebar-collapsed .sidebar .sb-head { justify-content: center; padding-inline: 8px; }
  html.sidebar-collapsed .sidebar .hdr-titles,
  html.sidebar-collapsed .sb-group-title,
  html.sidebar-collapsed .sb-link > span,
  html.sidebar-collapsed .sb-body > .divider { display: none; }
  html.sidebar-collapsed .sb-group-links[hidden] { display: block; }
  html.sidebar-collapsed .sb-body { padding-inline: 8px; }
  html.sidebar-collapsed .sb-group { margin-bottom: 2px; }
  html.sidebar-collapsed .sb-link {
    justify-content: center; gap: 0; min-height: 42px; padding-inline: 10px;
  }
  html.sidebar-collapsed .sb-link .ico { flex-basis: 22px; width: 22px; height: 22px; }

  /* نقطة البيع: إخفاء كامل للقائمة للاستفادة من عرض الشاشة. */
  html[data-pos-screen="1"] .app-main{ max-width:none; }
  html[data-pos-screen="1"].pos-sidebar-hidden .sidebar{
    transform:translateX(110%); pointer-events:none;
  }
  html[data-pos-screen="1"].pos-sidebar-hidden .app-header,
  html[data-pos-screen="1"].pos-sidebar-hidden .app-main{
    margin-inline-start:0;
  }
  html[data-pos-screen="1"].pos-sidebar-hidden .app-main{ width:100%; }
  html[data-pos-screen="1"].pos-sidebar-hidden .footer-nav{ inset-inline-start:16px; }

  html[data-pos-screen="1"] .app-header .btn-menu{
    color:var(--brand-text); background:var(--brand-soft);
  }
}

/* الجداول تتحوّل كروت على الموبايل */
@media (max-width: 767px) {
  /* الشبكات ذات المقاسات المكتوبة داخل الصفحات تتحول لعمود واحد على الهاتف. */
  .app-main .d-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid.cols-2,
  .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }

  .table.responsive thead { display: none; }
  .table.responsive tbody tr {
    display: block; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); padding: 6px 2px;
  }
  .table.responsive tbody tr:hover { background: var(--surface); }
  .table.responsive tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 7px 12px; border: none; text-align: end;
  }
  .table.responsive tbody td::before {
    content: attr(data-label);
    font-size: 12.5px; font-weight: 700; color: var(--text-muted);
    text-align: start; flex: 0 0 auto;
  }
  .table.responsive tbody td.actions { justify-content: flex-start; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 4px; }
  .table.responsive tbody td.actions::before { content: ''; }
  .table.responsive tfoot { display: none; }

  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .page-head > :is(a.btn, button.btn, form, details):nth-child(2) { margin-inline-start: 0; }
  .page-head > a.btn, .page-head > button.btn { flex: 1 1 auto; }
  .card-head { flex-wrap: wrap; }
  .field.span-2 { grid-column: span 1; }
  .modal-foot .btn { flex: 1; }
}

/* ---------------------------------------------------------------
   20) الطباعة
   --------------------------------------------------------------- */
.erp-print-header,.thermal-only{ display:none; }
.erp-generated-print{ display:none; }
.erp-print-dialog{ max-width:540px; }
.erp-print-dialog .modal-head{ align-items:flex-start; }
.erp-print-options{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.erp-print-option{
  position:relative; min-width:0; min-height:150px; padding:16px 10px 12px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface);
  color:var(--text); font:inherit; text-align:center; cursor:pointer; transition:.15s ease;
}
.erp-print-option:hover,.erp-print-option:focus-visible{
  border-color:var(--brand); background:var(--brand-soft); outline:0; transform:translateY(-1px);
}
.erp-print-option.is-default{ border-color:var(--brand); box-shadow:0 0 0 1px var(--brand-soft); }
.erp-print-option > span:not(.erp-print-paper-icon):not(.erp-print-roll-icon){ display:flex; flex-direction:column; gap:3px; }
.erp-print-option strong{ font-size:.9rem; }
.erp-print-option small{ color:var(--text-muted); font-size:.7rem; line-height:1.55; }
.erp-print-option em{
  position:absolute; top:7px; inset-inline-start:7px; padding:2px 6px; border-radius:999px;
  background:var(--brand); color:var(--on-brand); font-size:.61rem; font-style:normal;
}
.erp-print-paper-icon{
  width:48px; height:60px; display:grid; place-items:center; border:2px solid currentColor;
  border-radius:4px; color:var(--brand-text); font-weight:800; font-size:16px;
}
.erp-print-roll-icon{
  position:relative; width:48px; height:55px; border:2px solid var(--brand); border-radius:7px 7px 3px 3px;
  background:var(--surface-2);
}
.erp-print-roll-icon::before{
  content:''; position:absolute; inset:8px 7px auto; height:14px; border:2px solid var(--brand); border-radius:50%;
}
.erp-print-roll-icon i{
  position:absolute; inset-inline:7px; bottom:-8px; height:22px; border:2px solid var(--brand);
  background:var(--surface); clip-path:polygon(0 0,100% 0,100% 70%,84% 100%,68% 70%,52% 100%,36% 70%,18% 100%,0 70%);
}

.inventory-print-report{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:22px; }
.inventory-print-title{ font-size:1.25rem; font-weight:800; text-align:center; margin-bottom:14px; }
.inventory-print-meta{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-bottom:10px; }
.inventory-print-meta>span{ display:flex; flex-direction:column; gap:3px; padding:8px 10px; border:1px solid var(--border); border-radius:8px; }
.inventory-print-meta small{ color:var(--text-muted); }
.inventory-print-summary{ display:flex; flex-wrap:wrap; gap:8px 18px; padding:9px 10px; margin-bottom:10px; background:var(--surface-2); border:1px solid var(--border); }
.inventory-print-table{ table-layout:fixed; }
.inventory-print-table th:first-child,.inventory-print-table td:first-child{ width:34px; }
.inventory-print-table th:nth-child(2),.inventory-print-table td:nth-child(2){ width:24%; }
.inventory-row-out td{ background:#fff1f1; }
.inventory-row-low td{ background:#fff9e8; }

@media print {
  .app-header, .sidebar, .footer-nav, .bot-greeting, .session-statusbar,
  .erp-loadbar, .activity-statusbar,
  .page-actions, .toolbar, .filters, .pager, .toasts, .no-print,
  .erp-print-backdrop, .form-actions, .card-tools { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  .app-main { margin: 0; padding: 0; max-width: none; }
  html.erp-generated-printing .app-main > :not(.erp-print-header):not(#erpGeneratedPrint){ display:none !important; }
  html.erp-generated-printing #erpGeneratedPrint{ display:block !important; width:100%; color:#000; }
  .erp-print-header{
    display:flex !important; align-items:center; gap:9px; padding:0 0 8px; margin-bottom:10px;
    border-bottom:1px solid #777; color:#000;
  }
  .erp-print-header img{ width:34px; height:34px; object-fit:contain; }
  .erp-print-header > div{ flex:1; display:flex; flex-direction:column; line-height:1.4; }
  .erp-print-header strong{ font-size:14px; }
  .erp-print-header span,.erp-print-header time{ font-size:9px; color:#444; }
  .card { border: 1px solid #ccc; box-shadow: none; border-radius: 0; page-break-inside: avoid; }
  .table thead th { background: #f1f1f1 !important; color: #000; position: static; }
  .table-wrap{ overflow:visible !important; max-height:none !important; }
  table{ break-inside:auto; }
  thead{ display:table-header-group; }
  tfoot{ display:table-footer-group; }
  tr{ break-inside:avoid; break-after:auto; }
  a { color: #000; text-decoration: none; }
  details.production-tree-node > .production-tree-body,
  details.production-stock-list > div{ display:block !important; }
  .production-tree-chevron{ display:none !important; }
  .production-tree-node,.production-component-card,.production-component-branch{ break-inside:avoid; border-color:#bbb !important; }
  .production-tree-node>summary,.production-components-head,.production-component-head{ background:#f1f1f1 !important; color:#000 !important; }
  .production-component-children{ border-color:#777 !important; }
  .production-tree-body{ padding:5px !important; }
  .production-stock-list>div{ padding:2px 4px; }
  .inventory-print-report{ border:0; border-radius:0; padding:0; }
  .inventory-print-title{ font-size:16px; margin-bottom:8px; }
  .inventory-print-meta{ gap:4px; margin-bottom:6px; }
  .inventory-print-meta>span{ padding:4px 6px; border-radius:0; }
  .inventory-print-meta small{ font-size:8px; }
  .inventory-print-summary{ padding:5px 6px; margin-bottom:6px; gap:4px 12px; }
  .inventory-print-table th,.inventory-print-table td{ border:1px solid #999 !important; }

  .erp-generated-title{
    margin:0 0 3px; text-align:center; color:#000; font-size:17px; line-height:1.45;
  }
  .erp-generated-subtitle{ margin:0 0 9px; text-align:center; color:#444; font-size:10px; }
  .erp-generated-meta,.erp-generated-summary{
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; margin:0 0 8px;
  }
  .erp-generated-summary{ padding:5px; border:1px solid #999; background:#f5f5f5 !important; }
  .erp-generated-pair{
    min-width:0; display:flex; flex-direction:column; gap:1px; padding:4px 6px;
    border:1px solid #bbb; background:#fff !important; break-inside:avoid;
  }
  .erp-generated-pair small{ color:#444; font-size:8px; }
  .erp-generated-pair strong{ color:#000; font-size:10px; overflow-wrap:anywhere; }
  .erp-generated-notice{
    margin:0 0 7px; padding:5px 7px; border:1px solid #999; background:#f5f5f5 !important;
    color:#000; font-size:9px; line-height:1.5;
  }
  .erp-generated-section{ margin:0 0 10px; break-inside:auto; }
  .erp-generated-section-title{
    margin:0; padding:5px 7px; border:1px solid #888; border-bottom:0;
    background:#eee !important; color:#000; font-size:11px;
  }
  .erp-generated-table-wrap{ width:100%; overflow:visible; }
  .erp-generated-table{ width:100%; border-collapse:collapse; table-layout:auto; }
  .erp-generated-table th,.erp-generated-table td{
    border:1px solid #999 !important; padding:5px 6px; color:#000; background:#fff;
    vertical-align:top; white-space:normal; overflow-wrap:anywhere;
  }
  .erp-generated-table th{ background:#eee !important; font-weight:700; }
  .erp-generated-block{
    margin:0 0 9px; padding:8px; border:1px solid #999; background:#fff !important;
    color:#000; box-shadow:none !important; border-radius:0 !important; break-inside:avoid;
  }
  .erp-generated-block .card-head,.erp-generated-block .card-body,.erp-generated-block .card-foot{
    padding:4px 0; border:0; background:transparent !important;
  }
  .erp-generated-block h1,.erp-generated-block h2,.erp-generated-block h3{ color:#000; }

  html[data-print-paper="a4"] body{ width:auto; margin:0 !important; }
  html[data-print-paper="a4"] .app-main{ width:100% !important; min-width:0 !important; }
  html[data-print-paper="a4"] table,
  html[data-print-paper="a4"] .table{ width:100% !important; min-width:0 !important; }
  html[data-print-paper="a4"] .table th,
  html[data-print-paper="a4"] .table td{ padding:6px 7px; white-space:normal; overflow-wrap:anywhere; }
  html[data-print-paper="a4"] table.erp-print-wide{
    table-layout:fixed !important; min-width:0 !important; font-size:7.5px !important;
  }
  html[data-print-paper="a4"] table.erp-print-wide th,
  html[data-print-paper="a4"] table.erp-print-wide td{
    padding:3px 2px !important; white-space:normal !important;
    overflow:visible !important; text-overflow:clip !important; overflow-wrap:anywhere;
  }

  html[data-print-paper^="thermal"] body{
    width:calc(100% - 1px); margin:0 !important; font-size:10px; line-height:1.45;
  }
  html[data-print-paper="thermal58"] body{ max-width:52mm; }
  html[data-print-paper="thermal80"] body{ max-width:74mm; }
  html[data-print-paper^="thermal"] .app-main{ width:100% !important; min-width:0 !important; }
  html[data-print-paper^="thermal"] .erp-print-header{ margin-bottom:6px; padding-bottom:5px; }
  html[data-print-paper^="thermal"] .erp-print-header img{ width:28px; height:28px; }
  html[data-print-paper^="thermal"] .erp-print-header strong{ font-size:12px; }
  html[data-print-paper^="thermal"] .page-head{ margin-bottom:7px; }
  html[data-print-paper^="thermal"] .page-title{ font-size:13px; }
  html[data-print-paper^="thermal"] .page-sub{ font-size:9px; }
  html[data-print-paper^="thermal"] .alert{ padding:5px 6px; margin-bottom:6px; border-radius:0; font-size:9px; }
  html[data-print-paper^="thermal"] .stat-grid{
    display:grid !important; grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:4px !important; margin-bottom:6px !important;
  }
  html[data-print-paper^="thermal"] .stat{ min-width:0; padding:6px; border-radius:0; break-inside:avoid; }
  html[data-print-paper^="thermal"] .stat-label,html[data-print-paper^="thermal"] .stat-note{ font-size:8px; }
  html[data-print-paper^="thermal"] .stat-value{ font-size:12px; }
  html[data-print-paper^="thermal"] .card{ margin:0 0 6px !important; break-inside:auto; }
  html[data-print-paper^="thermal"] .card-head{ min-height:0; padding:5px 6px; }
  html[data-print-paper^="thermal"] .card-title{ font-size:10px; }
  html[data-print-paper^="thermal"] .card-body{ padding:6px; }
  html[data-print-paper^="thermal"] .card-body.p0{ padding:0; }
  html[data-print-paper^="thermal"] .table-wrap{ overflow:visible !important; max-height:none !important; }
  html[data-print-paper^="thermal"] table,
  html[data-print-paper^="thermal"] .table{
    width:100% !important; min-width:0 !important; table-layout:fixed !important; font-size:8px !important;
  }
  html[data-print-paper^="thermal"] .table th,
  html[data-print-paper^="thermal"] .table td{
    padding:3px 2px !important; white-space:normal !important; overflow:visible !important;
    text-overflow:clip !important; overflow-wrap:anywhere;
  }
  html[data-print-paper^="thermal"] table.erp-print-stacked{
    display:block !important; table-layout:auto !important; font-size:9px !important;
  }
  html[data-print-paper^="thermal"] table.erp-print-stacked thead,
  html[data-print-paper^="thermal"] table.erp-print-stacked tfoot{ display:none !important; }
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody{ display:block !important; }
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody tr{
    display:block !important; margin:0 0 6px !important; padding:3px 0 !important;
    border:1px solid #999 !important; break-inside:avoid !important;
  }
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody td{
    display:grid !important; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);
    align-items:start; gap:5px; width:100% !important; padding:3px 4px !important;
    border:0 !important; border-bottom:1px dashed #ccc !important;
    text-align:left !important; direction:rtl !important; white-space:normal !important;
  }
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody td:last-child{ border-bottom:0 !important; }
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody td::before{
    content:attr(data-print-label); display:block; color:#333; font-weight:700;
    text-align:right; direction:rtl; white-space:normal;
  }
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody td.num,
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody td.text-end{
    text-align:left !important;
  }
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody td.actions,
  html[data-print-paper^="thermal"] table.erp-print-stacked tbody td[data-print-label=""]{ display:none !important; }
  html[data-print-paper^="thermal"] .hide-sm,
  html[data-print-paper^="thermal"] .print-hide-thermal{ display:none !important; }
  html[data-print-paper^="thermal"] .standard-print{ display:none !important; }
  html[data-print-paper^="thermal"] .thermal-only{ display:block !important; }
  html[data-print-paper^="thermal"] .thermal-slip{ color:#000; }
  html[data-print-paper^="thermal"] .thermal-slip-title{
    padding:4px 0; margin-bottom:5px; border-block:1px dashed #777; text-align:center; font-size:12px; font-weight:700;
  }
  html[data-print-paper^="thermal"] .thermal-slip-meta,
  html[data-print-paper^="thermal"] .thermal-slip-totals{ display:flex; flex-direction:column; gap:2px; }
  html[data-print-paper^="thermal"] .thermal-slip-meta > div,
  html[data-print-paper^="thermal"] .thermal-slip-totals > div{
    display:flex; align-items:flex-start; justify-content:space-between; gap:7px; padding:2px 0;
  }
  html[data-print-paper^="thermal"] .thermal-slip-totals{
    margin-top:6px; padding-top:5px; border-top:1px dashed #777;
  }
  html[data-print-paper^="thermal"] .thermal-slip-total{
    margin-top:3px; padding-block:5px !important; border-block:2px solid #333; font-size:11px; font-weight:700;
  }
  html[data-print-paper^="thermal"] .inventory-thermal-table{
    font-size:7.5px !important; table-layout:fixed !important; border-collapse:collapse !important;
  }
  html[data-print-paper^="thermal"] .inventory-thermal-table th,
  html[data-print-paper^="thermal"] .inventory-thermal-table td{
    padding:3px 1px !important; border:1px solid #777 !important; overflow-wrap:anywhere !important;
  }
  html[data-print-paper^="thermal"] .inventory-thermal-table th:first-child,
  html[data-print-paper^="thermal"] .inventory-thermal-table td:first-child{ width:43%; }
  html[data-print-paper^="thermal"] .inventory-thermal-table small{ font-size:6.5px; }
  html[data-print-paper^="thermal"] .erp-generated-title{ font-size:13px; margin-bottom:2px; }
  html[data-print-paper^="thermal"] .erp-generated-subtitle{ font-size:8px; margin-bottom:5px; }
  html[data-print-paper^="thermal"] .erp-generated-meta,
  html[data-print-paper^="thermal"] .erp-generated-summary{
    grid-template-columns:repeat(2,minmax(0,1fr)); gap:2px; margin-bottom:5px; padding:2px;
  }
  html[data-print-paper^="thermal"] .erp-generated-pair{ padding:3px; }
  html[data-print-paper^="thermal"] .erp-generated-pair small{ font-size:6.5px; }
  html[data-print-paper^="thermal"] .erp-generated-pair strong{ font-size:8px; }
  html[data-print-paper^="thermal"] .erp-generated-notice{ margin-bottom:4px; padding:3px 4px; font-size:7.5px; }
  html[data-print-paper^="thermal"] .erp-generated-section{ margin-bottom:6px; }
  html[data-print-paper^="thermal"] .erp-generated-section-title{ padding:3px 4px; font-size:9px; }
  html[data-print-paper^="thermal"] .erp-generated-block{ margin-bottom:5px; padding:4px; font-size:8px; }
}

@media (max-width:560px){
  .erp-print-options{ grid-template-columns:1fr; }
  .erp-print-option{ min-height:92px; flex-direction:row; justify-content:flex-start; text-align:start; padding:12px 14px; }
  .erp-print-option em{ inset-inline-start:auto; inset-inline-end:7px; }
  .inventory-print-meta{ grid-template-columns:1fr 1fr; }
}

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

/* ---------------------------------------------------------------
   21) شاشة الدخول
   --------------------------------------------------------------- */
.body-blank {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 20px 16px;
  background:
    radial-gradient(1100px 520px at 82% -12%, var(--brand-soft), transparent 62%),
    var(--bg);
}

.login-wrap { width: 100%; max-width: 400px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 30px 24px 22px;
}

.login-brand { text-align: center; margin-bottom: 22px; }

.login-logo {
  width: 74px; height: 74px; margin: 0 auto 13px;
  border-radius: 21px;
  background: var(--brand); color: var(--on-brand);
  display: grid; place-items: center;
  box-shadow: 0 0 0 7px var(--brand-soft);
}
.login-logo-img {
  width: 84px; height: 84px; margin: 0 auto 13px;
  border-radius: 19px; object-fit: contain; background: var(--surface-2);
  padding: 7px; border: 1px solid var(--border);
}
.login-name   { font-size: 21px; font-weight: 700; line-height: 1.35; }
.login-slogan { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.login-portal-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 5px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-text); font-weight: 700; font-size: 14px; }

.login-foot {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 11.5px; color: var(--text-muted); line-height: 1.6;
}
.login-foot .ico { flex: 0 0 15px; margin-top: 2px; }

.login-tools {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 4px; margin-top: 16px;
}
.login-tools .dot { width: 15px; height: 15px; border-radius: 50%; display: block; }
.login-tools .btn { min-height: 34px; }

/* ---------------------------------------------------------------
   22) صفحات الأخطاء
   --------------------------------------------------------------- */
.err-wrap { width: 100%; max-width: 460px; text-align: center; }
.err-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg); padding: 36px 26px 28px;
}
.err-icon {
  width: 76px; height: 76px; margin: 0 auto 16px;
  border-radius: 50%; display: grid; place-items: center;
}
.err-icon.is-warn   { background: var(--warn-bg);   color: var(--warn); }
.err-icon.is-danger { background: var(--danger-bg); color: var(--danger); }
.err-icon.is-info   { background: var(--info-bg);   color: var(--info); }
.err-code  { font-size: 44px; font-weight: 700; line-height: 1; color: var(--text-muted); letter-spacing: 1px; }
.err-title { font-size: 19px; font-weight: 700; margin: 10px 0 6px; }
.err-text  { color: var(--text-muted); font-size: 14px; line-height: 1.75; margin-bottom: 20px; }
.err-ref   { font-family: ui-monospace, Consolas, monospace; font-size: 12px;
             background: var(--surface-3); padding: 4px 10px; border-radius: 6px;
             display: inline-block; margin-bottom: 16px; }
.err-trace {
  direction: ltr; text-align: left; background: var(--surface-3);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; font-size: 11.5px; font-family: ui-monospace, Consolas, monospace;
  overflow: auto; max-height: 260px; margin-top: 16px; line-height: 1.6;
}

/* ---------------------------------------------------------------
   23) قائمة تجهيز النظام
   --------------------------------------------------------------- */
.setup-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
  font-size: 13.5px; font-weight: 600;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.setup-item:hover { border-color: var(--brand); text-decoration: none; }
.setup-check {
  width: 27px; height: 27px; flex: 0 0 27px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-muted);
}
.setup-item.is-done { background: var(--ok-bg); border-color: var(--ok-border); }
.setup-item.is-done .setup-check { background: var(--ok); color: #fff; }
.setup-item.is-done span:not(.setup-check) { color: var(--ok); }

/* ---------------------------------------------------------------
   24) اختيار الدور والثيم · صندوق النطاق
   --------------------------------------------------------------- */
.role-pick {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 13px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.role-pick:hover { border-color: var(--border-strong); }
.role-pick input[type="radio"] { margin-top: 3px; accent-color: var(--brand); width: 17px; height: 17px; flex: 0 0 17px; }
.role-pick.is-picked { border-color: var(--brand); background: var(--brand-soft); }

.theme-pick {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 13.5px; font-weight: 600;
  min-height: 42px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.theme-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-pick .dot { width: 15px; height: 15px; border-radius: 50%; display: block; }
.theme-pick.is-picked { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.theme-pick .dot.is-system { width: 24px; height: 17px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.theme-pick-group { margin-bottom: 6px; }

/* قائمة الثيم في الهيدر وشاشة الدخول: ألوان + أنماط الأنظمة + الوضع */
.theme-menu-wrap { position: relative; }
.theme-menu {
  position: absolute; inset-inline-end: 0; top: 46px; z-index: 100;
  width: 292px; max-width: calc(100vw - 20px); max-height: calc(100vh - 110px); overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.theme-menu .card-body { padding: 10px; }
.theme-menu-title { font-size: 11.5px; font-weight: 800; color: var(--text-muted); margin: 6px 4px 5px; }
.theme-menu-title:first-child { margin-top: 0; }
.theme-menu-list { display: grid; gap: 3px; margin-bottom: 6px; }
.theme-menu-list.is-colors, .theme-menu-list.is-modes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.theme-option {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 5px 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--text); font: inherit; font-size: 13px; text-align: start; cursor: pointer;
}
.theme-option:hover { background: var(--surface-3); }
.theme-option.is-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); font-weight: 700; }
.theme-option .ico { flex: 0 0 16px; }
.theme-option-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-swatch { width: 26px; height: 18px; flex: 0 0 26px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.theme-menu-list.is-colors .theme-option, .theme-menu-list.is-modes .theme-option { flex-direction: column; justify-content: center; gap: 4px; min-height: 50px; font-size: 11.5px; text-align: center; }
.theme-menu-list.is-colors .theme-swatch { width: 18px; height: 18px; flex-basis: 18px; border-radius: 50%; }
.login-theme { position: relative; }
.login-theme > summary { list-style: none; }
.login-theme > summary::-webkit-details-marker { display: none; }
.login-theme-menu { position: absolute; inset-inline-end: 0; bottom: calc(100% + 6px); top: auto; z-index: 60; text-align: start; }
.btn-menu .ico-apps { display: none; }
/* اسم التطبيق الحالي وروابطه في الشريط العلوي: يظهر في أنماط الأنظمة التي تستخدمه (أودو) */
.hdr-app-menu { display: none; }

.scope-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 6px 11px;
  max-height: 170px; overflow-y: auto;
  display: flex; flex-direction: column;
}
.scope-box .check { min-height: 34px; font-size: 13.5px; }

/* ---------------------------------------------------------------
   25) التبويبات
   --------------------------------------------------------------- */
.tabs {
  display: flex; gap: 4px; overflow-x: auto;
  padding-bottom: 3px; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; white-space: nowrap;
  color: var(--text-2); font-size: 13.5px; font-weight: 600;
  border-bottom: 2.5px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--brand-text); border-bottom-color: var(--brand); }

/* ---------------------------------------------------------------
   26) رفع الشعارات
   --------------------------------------------------------------- */
.logo-drop {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--surface-2);
  transition: border-color var(--t-fast), opacity var(--t-fast);
}
.logo-drop:hover { border-color: var(--brand); }
.logo-drop.is-removing { opacity: .45; border-color: var(--danger); }
.logo-preview {
  width: 66px; height: 66px; flex: 0 0 66px;
  border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.logo-drop .btn { cursor: pointer; }
.product-image-drop{ min-height:104px; }
.product-image-preview{
  width:86px;
  height:86px;
  flex-basis:86px;
}
.product-image-preview img{ object-fit:cover; padding:0; }
.item-name-cell{ display:flex; align-items:center; gap:10px; min-width:190px; }
.item-thumb{
  width:44px;
  height:44px;
  flex:0 0 44px;
  display:grid;
  place-items:center;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:var(--surface-2);
  color:var(--text-muted);
}
.item-thumb img{ width:100%; height:100%; object-fit:cover; }
.item-thumb.is-empty{ background:var(--brand-soft); color:var(--brand-text); }

/* ================= حقل الموقع الجغرافي ================= */
.geo{
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:.7rem .8rem;
  background:var(--surface-2);
}
.geo-body{ margin-bottom:.6rem; }
.geo-body.is-empty{ padding:.15rem 0; }
.geo-coords code{
  font-size:.86rem; letter-spacing:.02em;
  background:var(--surface-3); padding:.15rem .4rem; border-radius:var(--radius-sm);
}
.geo-actions{ display:flex; flex-wrap:wrap; gap:.4rem; }
.geo-msg{ margin-top:.5rem; min-height:1em; }
.geo .is-hidden{ display:none !important; }

/* ================= أدوات مساعدة ================= */
.d-inline{ display:inline-block; }
.nowrap{ white-space:nowrap; }
.badge-accent{ background:var(--brand-soft); color:var(--brand-text); }

.form-actions{
  display:flex; flex-wrap:wrap; gap:.5rem; align-items:center;
  padding:.9rem 0 2rem;
}
.form-actions .btn{ min-height:44px; }

/* ================= مصفوفة الصلاحيات ================= */
.perm-table th,
.perm-table td{ padding:.55rem .6rem; }
.perm-table thead th{ font-size:.82rem; white-space:nowrap; }
.perm-table tbody tr:hover{ background:var(--surface-2); }

.perm-special{
  display:grid; gap:.5rem;
  grid-template-columns:repeat(auto-fill, minmax(260px, 1fr));
}
.perm-special-item{
  display:flex; align-items:flex-start; gap:.55rem;
  padding:.6rem .7rem; border:1px solid var(--border);
  border-radius:var(--radius); cursor:pointer;
  transition:border-color var(--t-fast), background var(--t-fast);
}
.perm-special-item:hover{ border-color:var(--border-strong); background:var(--surface-2); }
.perm-special-body{ display:flex; flex-direction:column; gap:.15rem; min-width:0; }
.perm-special-name{ font-weight:600; font-size:.9rem; line-height:1.4; }

/* إخفاء أعمدة ثانوية على الشاشات الصغيرة */
@media (max-width: 767px){
  .table:not(.responsive) .hide-sm{ display:none !important; }
  .table.responsive .hide-sm{ display:block; }
}

/* ================= مقارنة عروض الأسعار ================= */
.select-sm{ height:34px; padding:.2rem .5rem; font-size:.85rem; }

.cmp-table th, .cmp-table td{ padding:.6rem .55rem; vertical-align:middle; }
.cmp-table thead th{ font-size:.82rem; }
.cmp-supplier{ min-width:118px; }
.cmp-cell{ background:var(--surface-2); }
.cmp-price{ font-weight:600; }
.cmp-cell.is-best{
  background:var(--brand-soft);
  box-shadow:inset 0 0 0 1.5px var(--brand);
}
.cmp-cell.is-best .cmp-price{ color:var(--brand-text); }
.cmp-badge{
  display:inline-block; margin-top:.15rem; padding:.05rem .4rem;
  font-size:.68rem; border-radius:var(--radius-sm);
  background:var(--brand); color:var(--on-brand);
}

.quote-chips{ display:flex; flex-wrap:wrap; gap:.5rem; align-items:stretch; }
.quote-chip{
  display:flex; flex-direction:column; gap:.1rem;
  min-width:150px; padding:.55rem .7rem;
  border:1px solid var(--border); border-radius:var(--radius);
  transition:border-color var(--t-fast), background var(--t-fast);
}
.quote-chip:hover{ border-color:var(--brand); background:var(--surface-2); }
.quote-chip.is-done{ border-color:var(--ok); }
.quote-chip-name{ font-weight:600; font-size:.88rem; }
.quote-chip-total{ font-weight:600; color:var(--brand-text); font-size:.95rem; }
.quote-invite{ display:flex; gap:.4rem; align-items:center; }
.quote-invite .select{ min-width:170px; }

/* ================= نافذة اختيار صنف ================= */
.pick-results{ margin-top:.7rem; max-height:min(52vh, 380px); overflow-y:auto; }

.pick-item{
  width:100%; display:flex; align-items:center; justify-content:space-between; gap:.8rem;
  padding:.6rem .7rem; text-align:start;
  border:1px solid transparent; border-radius:var(--radius);
  transition:background var(--t-fast), border-color var(--t-fast);
}
.pick-item:hover, .pick-item:focus-visible{
  background:var(--brand-soft); border-color:var(--brand);
}
.pick-item.is-active{
  background:var(--brand-soft); border-color:var(--brand);
  box-shadow:0 0 0 2px color-mix(in srgb,var(--brand) 14%,transparent);
}
.pick-item + .pick-item{ margin-top:.2rem; }

.pick-item-main{ display:flex; flex-direction:column; gap:.1rem; min-width:0; }
.pick-item-main strong{ font-size:.92rem; }
.pick-item-meta{ font-size:.74rem; color:var(--text-muted); }

.pick-item-side{ display:flex; flex-direction:column; align-items:flex-end; gap:.1rem; flex:0 0 auto; }
.pick-item-qty{ font-size:.8rem; font-weight:600; color:var(--ok); white-space:nowrap; }

.pick-hint{ padding:1.1rem .5rem; text-align:center; color:var(--text-muted); font-size:.86rem; }

/* ================= سطور الفاتورة ================= */
.pos-barcode-strip{
  padding:.85rem; border-bottom:1px solid var(--border); background:var(--brand-soft);
}
.pos-barcode-strip .label{ display:flex; align-items:center; gap:.4rem; margin-bottom:.4rem; }
.pos-barcode-entry{ display:flex; gap:.5rem; align-items:center; }
.pos-barcode-entry .input{ min-width:0; font-size:1.05rem; font-weight:700; letter-spacing:.04em; }
.pos-barcode-entry .btn{ flex:0 0 auto; }
.pos-barcode-strip .hint{ margin-top:.35rem; }
.inv-table th, .inv-table td{ padding:.45rem .4rem; vertical-align:middle; }
.inv-table thead th{ font-size:.8rem; }
.inv-table .input{ height:38px; padding:.2rem .35rem; }
.inv-item-name{ font-weight:600; font-size:.9rem; line-height:1.4; }
.inv-disc{ display:flex; gap:.25rem; }
.inv-disc .input{ flex:1; min-width:0; }
.inv-disc .select{ flex:0 0 52px; padding-inline:.3rem; }
.inv-warn{ font-size:.74rem; line-height:1.4; margin-top:.15rem; }
.inv-warn.is-bad{ color:var(--danger); font-weight:600; }
tr.is-invalid-line{ background:var(--danger-bg); }

.inv-totals{ max-width:460px; margin-inline-start:auto; }
.inv-total-row{
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  padding:.45rem 0; border-bottom:1px dashed var(--border); font-size:.9rem;
}
.inv-total-row:last-child{ border-bottom:none; }
.inv-total-row.is-grand{
  margin-top:.35rem; padding-top:.7rem; border-top:2px solid var(--border-strong);
  border-bottom:none; font-size:1.06rem;
}
.inv-total-row.is-grand strong{ color:var(--brand-text); }
.inv-total-row.is-profit{ border-bottom:none; }
.inv-hdisc{ display:inline-flex; gap:.25rem; margin-inline-start:.4rem; vertical-align:middle; }
.inv-hdisc .input{ width:78px; height:32px; padding:.1rem .3rem; }
.inv-hdisc .select{ width:52px; height:32px; padding-inline:.25rem; }

@media (max-width: 700px){
  .inv-totals{ max-width:none; }
}

/* ================= تعليقات الجودة ================= */
.qc-list{ display:flex; flex-direction:column; gap:.6rem; }
.qc-item{
  padding:.65rem .8rem; border:1px solid var(--border);
  border-radius:var(--radius); background:var(--surface-2);
}
.qc-head{ display:flex; align-items:center; gap:.5rem; margin-bottom:.3rem; flex-wrap:wrap; }
.qc-body{ font-size:.9rem; line-height:1.7; color:var(--text-2); }

/* ================= التتبّع ================= */
.trace-chain{
  display:flex; align-items:stretch; gap:.6rem; flex-wrap:wrap; justify-content:center;
}
.trace-node{
  flex:1; min-width:170px; padding:.8rem .9rem; text-align:center;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-2);
}
.trace-node.is-mid{ border-color:var(--brand); background:var(--brand-soft); }
.trace-node-label{ font-size:.74rem; color:var(--text-muted); margin-bottom:.25rem; }
.trace-node-value{ font-weight:600; font-size:.95rem; line-height:1.5; }
.trace-arrow{ display:grid; place-items:center; color:var(--text-muted); flex:0 0 auto; }
@media (max-width: 640px){
  .trace-arrow{ transform:rotate(-90deg); }
}

/* ================= اتجاه الأسعار ================= */
.trend-up{ color:var(--danger); font-weight:600; white-space:nowrap; }
.trend-down{ color:var(--ok); font-weight:600; white-space:nowrap; }
.trend-table th, .trend-table td{ padding:.5rem .45rem; }
.trend-buy{ background:var(--surface-2); }
.trend-sell{ background:var(--brand-soft); }
[data-mode="dark"] .trend-sell{ background:var(--surface-3); }

/* ================= درجة المورد ================= */
.score-badge{
  display:inline-grid; place-items:center;
  width:44px; height:44px; border-radius:50%;
  font-weight:700; font-size:.95rem; color:#fff;
}
.score-high{ background:var(--ok); }
.score-mid { background:var(--warn); }
.score-low { background:var(--danger); }
tr.row-blocked{ opacity:.6; }

/* ================= مهام الداشبورد ================= */
.task-chips{ display:flex; flex-wrap:wrap; gap:.5rem; }
.task-chip{
  display:flex; align-items:center; gap:.5rem;
  padding:.55rem .75rem; font-size:.87rem;
  border:1px solid var(--border); border-radius:var(--radius);
  background:var(--surface-2); color:var(--text);
  transition:border-color var(--t-fast), background var(--t-fast);
}
.task-chip:hover{ border-color:var(--brand); text-decoration:none; }
.task-chip strong{ color:var(--brand-text); }
.task-chip.is-warn{ border-color:var(--warn-border); background:var(--warn-bg); }
.task-chip.is-warn strong{ color:var(--warn); }
.task-chip.is-accent{ border-color:var(--brand); background:var(--brand-soft); }

/* ================= شجرة المخازن ================= */
.wt-tree{ font-size:.9rem; }
.wt-node{ }
.wt-row{
  display:flex; align-items:center; gap:.5rem;
  padding:.5rem .6rem; border-radius:var(--radius);
  border-bottom:1px solid var(--border);
  transition:background var(--t-fast);
}
.wt-row:hover{ background:var(--surface-2); }

.wt-toggle{
  flex:0 0 26px; width:26px; height:26px; display:grid; place-items:center;
  border-radius:var(--radius-sm); color:var(--text-muted);
}
.wt-toggle:hover{ background:var(--surface-3); color:var(--text); }
.wt-caret{ display:grid; place-items:center; transition:transform var(--t-fast); }
.wt-toggle.is-open .wt-caret{ transform:rotate(-90deg); }

.wt-ico{ flex:0 0 auto; display:grid; place-items:center; color:var(--brand); }
.wt-spacer{ flex:0 0 26px; }

.wt-name{ flex:1; min-width:0; display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; }
.wt-name strong{ font-weight:600; }
.wt-code{
  font-size:.72rem; background:var(--surface-3); color:var(--text-2);
  padding:.05rem .35rem; border-radius:var(--radius-sm);
}

.wt-meta{ flex:0 0 auto; display:flex; align-items:center; gap:.6rem; }
.wt-qty{ font-weight:700; font-variant-numeric:tabular-nums; min-width:52px; text-align:end; }
.wt-val{
  font-variant-numeric:tabular-nums; color:var(--text-2);
  min-width:82px; text-align:end; font-size:.85rem;
}
.wt-actions{ flex:0 0 auto; display:flex; gap:.15rem; }

.wt-children{ margin-inline-start:1.15rem; border-inline-start:2px solid var(--border); padding-inline-start:.35rem; }

.wt-wh{ background:var(--surface-2); font-size:.94rem; }
.wt-wh .wt-ico{ color:var(--brand); }
.wt-cat .wt-ico{ color:var(--info); }
.wt-item{ font-size:.86rem; }
.wt-item.is-low{ background:var(--warn-bg); }
.wt-item.is-out{ background:var(--danger-bg); }

.wt-loading, .wt-empty{ padding:.6rem .8rem; color:var(--text-muted); font-size:.85rem; }

@media (max-width: 700px){
  .wt-val{ display:none; }
  .wt-meta{ gap:.35rem; }
  .wt-actions .btn{ padding:.2rem .3rem; }
}

/* ================= فلتر الفترة ================= */
.period-bar{
  display:flex; align-items:center; gap:.4rem; flex-wrap:wrap;
  padding:.5rem .6rem; margin-bottom:.9rem;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
}
.period-chip{
  padding:.35rem .85rem; border-radius:20px; font-size:.85rem;
  color:var(--text-2); background:var(--surface-2);
  transition:background var(--t-fast), color var(--t-fast);
}
.period-chip:hover{ background:var(--surface-3); text-decoration:none; }
.period-chip.is-active{ background:var(--brand); color:var(--on-brand); font-weight:600; }

/* ================= كروت المؤشرات الكبيرة ================= */
.kpi-grid{
  display:grid; gap:12px;
  grid-template-columns:repeat(auto-fit, minmax(215px, 1fr));
}
.kpi{
  padding:.9rem 1rem; border-radius:var(--radius-lg);
  background:var(--surface); border:1px solid var(--border);
  border-top:3px solid var(--brand);
  display:flex; flex-direction:column; gap:.3rem;
}
.kpi-top{ display:flex; align-items:center; gap:.5rem; }
.kpi-ico{
  width:32px; height:32px; flex:0 0 32px; display:grid; place-items:center;
  border-radius:9px; background:var(--brand-soft); color:var(--brand);
}
.kpi-label{ font-size:.82rem; color:var(--text-muted); font-weight:600; }
.kpi-value{
  font-size:1.5rem; font-weight:700; line-height:1.25;
  font-variant-numeric:tabular-nums; letter-spacing:-.01em;
}
.kpi-foot{ font-size:.76rem; color:var(--text-muted); line-height:1.7; }

.kpi-sales  { border-top-color:var(--brand); }
.kpi-profit { border-top-color:var(--ok); }
.kpi-profit .kpi-ico{ background:var(--ok-bg); color:var(--ok); }
.kpi-profit .kpi-value{ color:var(--ok); }
.kpi-purch  { border-top-color:var(--warn); }
.kpi-purch .kpi-ico{ background:var(--warn-bg); color:var(--warn); }
.kpi-cash   { border-top-color:var(--ok); }
.kpi-cash .kpi-ico{ background:var(--ok-bg); color:var(--ok); }
.kpi-cash .kpi-value{ color:var(--ok); }
.kpi-recv   { border-top-color:var(--info); }
.kpi-recv .kpi-ico{ background:var(--info-bg); color:var(--info); }
.kpi-pay    { border-top-color:var(--danger); }
.kpi-pay .kpi-ico{ background:var(--danger-bg); color:var(--danger); }
.kpi-stock  { border-top-color:var(--info); }
.kpi-stock .kpi-ico{ background:var(--info-bg); color:var(--info); }
.kpi-vat    { border-top-color:var(--text-muted); }

.dl-up  { color:var(--ok);     font-weight:600; font-size:.78rem; }
.dl-down{ color:var(--danger); font-weight:600; font-size:.78rem; }

/* ================= رسم الأعمدة ================= */
.bchart-legend{
  display:flex; align-items:center; gap:1rem; flex-wrap:wrap;
  margin-bottom:.6rem; font-size:.8rem; color:var(--text-2);
}
.bchart-key{ display:inline-flex; align-items:center; gap:.35rem; }
.bchart-dot{ width:11px; height:11px; border-radius:3px; display:inline-block; }
.bchart-max{ margin-inline-start:auto; }
.bchart-plot{ color:var(--text); }
.bchart-plot svg{ width:100%; height:180px; display:block; }
.bchart-labels{
  display:flex; margin-top:.35rem;
  font-size:.7rem; color:var(--text-muted);
}
.bchart-label{ flex:1; text-align:center; overflow:hidden; white-space:nowrap; }

@media (max-width: 640px){
  .bchart-plot svg{ height:140px; }
  .bchart-label{ font-size:.6rem; }
}

/* ================= أعمار الديون ================= */
.aging-bar{
  display:flex; height:22px; border-radius:11px; overflow:hidden;
  background:var(--surface-3);
}
.aging-seg{ height:100%; transition:filter var(--t-fast); }
.aging-seg:hover{ filter:brightness(1.12); }
.aging-dot{
  width:10px; height:10px; border-radius:3px;
  display:inline-block; margin-inline-end:.35rem;
}

/* ================= صفوف الجداول الخاصة ================= */
tr.row-sep td{ border-top:2px solid var(--border-strong); }
tr.row-total th{ background:var(--surface-2); font-weight:700; }

/* ================= شريط التجهيز ================= */
.setup-bar{
  height:8px; border-radius:5px; background:var(--surface-3);
  overflow:hidden; margin-bottom:.9rem;
}
.setup-bar span{ display:block; height:100%; background:var(--brand); transition:width var(--t-base); }
.setup-grid{
  display:grid; gap:.5rem;
  grid-template-columns:repeat(auto-fill, minmax(190px, 1fr));
}

/* =====================================================================
   خريطة النظام — الإنفوجرافيك
   ===================================================================== */
.ig-hero{
  display:flex; align-items:center; gap:1rem; flex-wrap:wrap;
  padding:1.1rem 1.2rem; margin-bottom:1.1rem;
  background:linear-gradient(135deg, var(--brand-soft), var(--surface));
  border:1px solid var(--border); border-radius:var(--radius-lg);
}
.ig-hero-logo{ width:62px; height:62px; object-fit:contain; border-radius:12px; flex:0 0 62px; }
.ig-hero-body{ flex:1; min-width:180px; }
.ig-hero-title{ font-size:1.3rem; font-weight:700; line-height:1.35; }
.ig-hero-sub{ font-size:.86rem; color:var(--text-2); }
.ig-hero-meta{
  display:flex; flex-wrap:wrap; gap:.9rem; margin-top:.4rem;
  font-size:.78rem; color:var(--text-muted);
}
.ig-hero-meta span{ display:inline-flex; align-items:center; gap:.25rem; }
.ig-hero-stats{ display:flex; gap:1.4rem; flex-wrap:wrap; }
.ig-hero-stats > div{ text-align:center; }
.ig-hero-stats strong{ display:block; font-size:1.3rem; font-weight:700; color:var(--brand-text); }
.ig-hero-stats span{ font-size:.72rem; color:var(--text-muted); }

.ig-section{ margin-bottom:1.4rem; }
.ig-section-title{
  display:flex; align-items:center; gap:.5rem;
  font-size:1rem; font-weight:700; margin-bottom:.7rem;
  padding-bottom:.45rem; border-bottom:2px solid var(--border);
}
.ig-section-title svg{ color:var(--brand); }

/* ------- دليل الشاشات الحي ------- */
.ig-map-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.ig-map-search{display:flex;align-items:center;gap:8px;flex:1 1 320px;min-width:0;padding-inline:.7rem;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface)}
.ig-map-search:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.ig-map-search svg{flex:0 0 auto;color:var(--text-muted)}
.ig-map-search .input{border:0;box-shadow:none;background:transparent;padding-inline:0}
.ig-map-note{margin-bottom:10px}
.ig-map-groups{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:10px;align-items:start}
.ig-map-group{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.ig-map-group summary{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:.7rem .8rem;background:var(--surface-2);font-weight:700;cursor:pointer;list-style:none}
.ig-map-group summary::-webkit-details-marker{display:none}
.ig-map-group summary>span:first-child{display:flex;align-items:center;gap:7px}
.ig-map-group[open] summary{border-bottom:1px solid var(--border)}
.ig-map-links{display:grid;gap:5px;padding:6px}
.ig-map-link{display:grid;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:9px;padding:.55rem;border-radius:var(--radius-sm);color:var(--text);transition:background var(--t-fast),transform var(--t-fast)}
.ig-map-link:hover{background:var(--brand-soft);text-decoration:none;transform:translateX(-2px)}
.ig-map-link-icon{width:36px;height:36px;display:grid;place-items:center;border-radius:9px;background:var(--surface-2);color:var(--brand)}
.ig-map-link strong,.ig-map-link small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ig-map-link strong{font-size:.84rem}.ig-map-link small{font-size:.68rem;color:var(--text-muted);margin-top:2px}
.ig-acc-item:hover{background:var(--brand-soft);text-decoration:none}.ig-role:hover{border-color:var(--brand);text-decoration:none;box-shadow:var(--shadow-sm)}
@media(max-width:600px){.ig-map-toolbar .btn{flex:1}.ig-map-search{flex-basis:100%}.ig-map-groups{grid-template-columns:1fr}}

/* ------- الأركان ------- */
.ig-pillars{
  display:grid; gap:10px;
  grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));
}
.ig-pillar{
  display:flex; flex-direction:column; align-items:center; gap:.2rem;
  padding:.9rem .6rem; text-align:center;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); border-top:3px solid var(--pc, var(--brand));
  transition:transform var(--t-fast), box-shadow var(--t-fast);
}
.ig-pillar:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); text-decoration:none; }
.ig-pillar-ico{
  width:40px; height:40px; display:grid; place-items:center; border-radius:11px;
  background:var(--surface-2); color:var(--pc, var(--brand)); margin-bottom:.15rem;
}
.ig-pillar-name{ font-size:.82rem; color:var(--text-muted); }
.ig-pillar-num{ font-size:1.35rem; font-weight:700; color:var(--text); line-height:1.2; }
.ig-pillar-note{ font-size:.7rem; color:var(--text-muted); }

/* ------- الدورات ------- */
.ig-flow{
  display:flex; align-items:stretch; gap:.3rem; flex-wrap:wrap;
  padding:.3rem 0;
}
.ig-step{
  flex:1 1 132px; min-width:118px; position:relative;
  display:flex; flex-direction:column; gap:.15rem;
  padding:.65rem .55rem .55rem;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius);
  transition:border-color var(--t-fast), background var(--t-fast);
}
.ig-step:hover{ border-color:var(--brand); background:var(--surface-2); text-decoration:none; }
.ig-step-num{
  position:absolute; top:-8px; inset-inline-start:8px;
  width:20px; height:20px; display:grid; place-items:center;
  border-radius:50%; background:var(--brand); color:var(--on-brand);
  font-size:.68rem; font-weight:700;
}
.ig-step-ico{ color:var(--brand); margin-top:.15rem; }
.ig-step-name{ font-weight:600; font-size:.84rem; color:var(--text); }
.ig-step-desc{ font-size:.7rem; color:var(--text-muted); line-height:1.5; }
.ig-step-val{
  margin-top:.2rem; font-size:.72rem; font-weight:600;
  color:var(--brand-text); background:var(--brand-soft);
  padding:.1rem .4rem; border-radius:var(--radius-sm); align-self:flex-start;
}
.ig-arrow{
  display:grid; place-items:center; color:var(--text-muted);
  flex:0 0 auto; align-self:center;
}
@media (max-width: 860px){ .ig-arrow{ display:none; } }

/* ------- الصورة المالية ------- */
.ig-fin{
  display:flex; align-items:stretch; gap:.8rem; flex-wrap:wrap;
}
.ig-fin-side{
  flex:1 1 260px; padding:.9rem 1rem;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
}
.ig-fin-head{ font-size:.82rem; color:var(--text-muted); font-weight:600; }
.ig-fin-value{
  font-size:1.5rem; font-weight:700; color:var(--brand-text);
  font-variant-numeric:tabular-nums; margin:.15rem 0 .6rem;
}
.ig-fin-list li{
  display:flex; justify-content:space-between; gap:1rem;
  padding:.32rem 0; font-size:.85rem;
  border-bottom:1px dashed var(--border);
}
.ig-fin-list li:last-child{ border-bottom:none; }
.ig-fin-list li span:last-child{ font-variant-numeric:tabular-nums; font-weight:600; }
.ig-fin-eq{
  display:grid; place-items:center; font-size:1.6rem;
  font-weight:700; color:var(--text-muted); flex:0 0 auto; padding:0 .3rem;
}
@media (max-width: 700px){
  .ig-fin-side{ flex:1 1 100%; }
  .ig-fin-eq{ flex:1 1 100%; padding:.1rem 0; font-size:1.2rem; }
}
.ig-balance{
  display:flex; align-items:center; gap:.5rem; flex-wrap:wrap;
  margin-top:.7rem; padding:.6rem .85rem; border-radius:var(--radius); font-size:.86rem;
}
.ig-balance.is-ok { background:var(--ok-bg);     color:var(--ok);     border:1px solid var(--ok-border); }
.ig-balance.is-bad{ background:var(--danger-bg); color:var(--danger); border:1px solid var(--danger-border); }

/* ------- دليل الحسابات ------- */
.ig-accounts{
  display:grid; gap:10px;
  grid-template-columns:repeat(auto-fit, minmax(230px, 1fr));
}
.ig-acc-group{
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); border-top:3px solid var(--ac, var(--brand));
  overflow:hidden;
}
.ig-acc-head{
  display:flex; justify-content:space-between; align-items:center; gap:.5rem;
  padding:.55rem .7rem; font-weight:700; font-size:.88rem;
  background:var(--surface-2); border-bottom:1px solid var(--border);
}
.ig-acc-list{ padding:.35rem 0; max-height:230px; overflow-y:auto; }
.ig-acc-item{
  display:flex; align-items:center; gap:.4rem;
  padding:.22rem .7rem; font-size:.8rem;
}
.ig-acc-item code{
  font-size:.72rem; color:var(--text-muted);
  background:var(--surface-3); padding:.02rem .3rem; border-radius:4px;
  flex:0 0 auto;
}
.ig-acc-item > span{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ig-acc-tag{
  flex:0 0 auto; font-size:.65rem; padding:.02rem .32rem;
  border-radius:4px; background:var(--surface-3); color:var(--text-muted);
}
.ig-acc-tag.is-link{ background:var(--brand-soft); color:var(--brand-text); }

/* ------- الأدوار ------- */
.ig-roles{
  display:grid; gap:10px;
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
}
.ig-role{
  padding:.75rem .85rem; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius);
}
.ig-role.is-system{ border-color:var(--brand); }
.ig-role-name{
  font-weight:600; font-size:.9rem;
  display:flex; align-items:center; gap:.4rem; flex-wrap:wrap;
}
.ig-role-meta{
  display:flex; gap:.35rem; font-size:.74rem;
  color:var(--text-muted); margin:.2rem 0 .45rem;
}
.ig-role-bar{ height:6px; border-radius:4px; background:var(--surface-3); overflow:hidden; }
.ig-role-bar span{ display:block; height:100%; background:var(--brand); }

/* ------- قواعد العمل ------- */
.ig-rules{
  display:grid; gap:8px;
  grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));
}
.ig-rule{
  display:flex; align-items:flex-start; gap:.6rem;
  padding:.65rem .75rem; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius);
}
.ig-rule-ico{
  flex:0 0 32px; width:32px; height:32px; display:grid; place-items:center;
  border-radius:9px; background:var(--brand-soft); color:var(--brand);
}
.ig-rule-body{ flex:1; min-width:0; }
.ig-rule-name{ font-weight:600; font-size:.86rem; }
.ig-rule-desc{ font-size:.74rem; color:var(--text-muted); line-height:1.55; }
.ig-rule-tag{
  flex:0 0 auto; align-self:center; font-size:.68rem;
  padding:.12rem .42rem; border-radius:var(--radius-sm);
  background:var(--surface-3); color:var(--text-2); white-space:nowrap;
}

/* ------- حالة التشغيل ------- */
.ig-status{
  display:grid; gap:10px;
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
}
.ig-status-group{
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden;
}
.ig-status-head{
  padding:.5rem .75rem; font-weight:700; font-size:.85rem;
  background:var(--surface-2); border-bottom:1px solid var(--border);
}
.ig-status-row{
  display:flex; justify-content:space-between; gap:.6rem;
  padding:.38rem .75rem; font-size:.83rem;
  border-bottom:1px dashed var(--border);
}
.ig-status-row:last-child{ border-bottom:none; }
.ig-status-row strong{ font-variant-numeric:tabular-nums; color:var(--brand-text); }

@media print{
  .ig-pillar, .ig-step, .ig-rule, .ig-acc-group, .ig-role, .ig-status-group{
    break-inside:avoid;
  }
  .ig-hero{ background:none; }
}

.empty-mini{ padding:18px 14px; text-align:center; color:var(--text-muted); font-size:.85rem; }

/* =====================================================================
   المساعد الذكي — شاشة الشات
   ===================================================================== */
.chat{
  display:flex; flex-direction:column;
  height:calc(100vh - var(--header-h) - var(--nav-h) - 92px);
  min-height:380px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); overflow:hidden;
}
.chat-stream{
  flex:1; overflow-y:auto; padding:16px 14px;
  display:flex; flex-direction:column; gap:12px;
  scroll-behavior:smooth;
}

.chat-hello{ margin:auto; text-align:center; padding:24px 16px; max-width:420px; }
.chat-hello-ico{
  width:64px; height:64px; margin:0 auto 12px;
  display:grid; place-items:center; border-radius:50%;
  background:var(--brand-soft); color:var(--brand);
}
.chat-hello h3{ font-size:1.25rem; margin-bottom:.3rem; }
.chat-hello p{ font-size:.88rem; line-height:1.7; }

/* ------- الرسائل ------- */
.msg{ display:flex; gap:8px; max-width:100%; }
.msg-me{ flex-direction:column; align-items:flex-end; }
.msg-bot{ align-items:flex-start; }

.msg-avatar{
  flex:0 0 30px; width:30px; height:30px; margin-top:2px;
  display:grid; place-items:center; border-radius:50%;
  background:var(--brand); color:var(--on-brand); font-size:.9rem;
}
.msg-body{ flex:1; min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:6px; }

.msg-bubble{
  padding:.6rem .85rem; border-radius:14px; font-size:.9rem; line-height:1.75;
  max-width:min(660px, 92%); word-wrap:break-word; white-space:normal;
}
.msg-me .msg-bubble{
  background:var(--brand); color:var(--on-brand);
  border-end-end-radius:4px;
}
.msg-bot .msg-bubble{
  background:var(--surface-2); color:var(--text);
  border:1px solid var(--border); border-end-start-radius:4px;
}
.msg-time{ font-size:.68rem; color:var(--text-muted); }

.msg-table{
  max-width:min(660px, 100%); overflow-x:auto;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface);
}
.msg-table .table{ margin:0; font-size:.82rem; }
.msg-table .table th{ background:var(--surface-2); white-space:nowrap; }
.msg-table .table td{ white-space:nowrap; }

.msg-link{
  display:inline-flex; align-items:center; gap:.3rem;
  font-size:.8rem; font-weight:600; color:var(--brand-text);
  background:var(--brand-soft); padding:.3rem .6rem; border-radius:var(--radius-sm);
}
.msg-link:hover{ text-decoration:none; filter:brightness(.96); }

.msg-foot{ display:flex; align-items:center; gap:.35rem; }
.msg-vote{
  border:1px solid var(--border); background:var(--surface);
  border-radius:8px; padding:.1rem .35rem; cursor:pointer;
  font-size:.82rem; line-height:1.4; opacity:.55;
  transition:opacity var(--t-fast), border-color var(--t-fast);
}
.msg-vote:hover{ opacity:1; }
.msg-vote.is-on{ opacity:1; border-color:var(--brand); background:var(--brand-soft); }

/* مؤشّر الكتابة */
.msg-typing{ display:flex; gap:4px; align-items:center; padding:.75rem .85rem; }
.msg-typing span{
  width:6px; height:6px; border-radius:50%; background:var(--text-muted);
  animation:botdot 1.2s infinite ease-in-out;
}
.msg-typing span:nth-child(2){ animation-delay:.18s; }
.msg-typing span:nth-child(3){ animation-delay:.36s; }
@keyframes botdot{
  0%, 60%, 100% { opacity:.25; transform:translateY(0); }
  30%           { opacity:1;   transform:translateY(-3px); }
}

/* ------- اقتراحات ------- */
.chat-guide{
  padding:10px 12px; border-top:1px solid var(--border);
  background:var(--surface-2);
}
.chat-guide-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin-bottom:8px;
}
.chat-guide-head > div{ display:flex; align-items:center; gap:8px; min-width:0; }
.chat-guide-head strong{ font-size:.84rem; color:var(--text); }
.chat-guide-head span{
  font-size:.68rem; color:var(--brand-text); background:var(--brand-soft);
  border-radius:999px; padding:.08rem .45rem; white-space:nowrap;
}
.chat-guide-options{
  display:grid; grid-template-columns:repeat(5,minmax(115px,1fr)); gap:7px;
  max-height:145px; overflow:auto;
}
.chat-guide-option{
  min-height:42px; display:flex; align-items:center; justify-content:center; gap:7px;
  border:1px solid var(--border); border-radius:var(--radius-sm);
  background:var(--surface); color:var(--text-2); padding:.42rem .65rem;
  font-size:.79rem; font-weight:600; line-height:1.45; text-align:center;
  transition:border-color var(--t-fast),background var(--t-fast),color var(--t-fast);
}
.chat-guide-option:hover{
  border-color:var(--brand); background:var(--brand-soft); color:var(--brand-text);
}
.chat-guide-icon{ color:var(--brand); flex:0 0 auto; }
.chat-guide.is-busy{ opacity:.65; pointer-events:none; }
.chat-quick{ border-top:1px solid var(--border); background:var(--surface); }
.chat-quick > summary{
  display:flex; align-items:center; gap:6px; padding:7px 12px;
  cursor:pointer; color:var(--text-muted); font-size:.76rem; font-weight:600;
}
.chat-quick > summary:hover{ color:var(--brand-text); background:var(--surface-2); }
.chat-quick .chat-chips{ border-top:1px solid var(--border); padding-block:8px; }
.chat-chips{
  display:flex; gap:6px; flex-wrap:wrap;
  padding:10px 12px; border-top:1px solid var(--border);
  background:var(--surface-2);
}
.chat-chip{
  border:1px solid var(--border); background:var(--surface);
  border-radius:999px; padding:.28rem .7rem; font-size:.78rem;
  cursor:pointer; color:var(--text-2); white-space:nowrap;
  transition:border-color var(--t-fast), color var(--t-fast);
}
.chat-chip:hover{ border-color:var(--brand); color:var(--brand-text); }

/* ------- شريط الكتابة ------- */
.chat-bar{
  display:flex; gap:8px; align-items:center;
  padding:10px 12px; border-top:1px solid var(--border); background:var(--surface);
}
.chat-input{
  flex:1; min-width:0; height:42px; padding:0 .9rem;
  border:1px solid var(--border); border-radius:999px;
  background:var(--surface-2); color:var(--text); font-size:.9rem;
  font-family:inherit;
}
.chat-input:focus{
  outline:none; border-color:var(--brand);
  box-shadow:0 0 0 3px var(--brand-soft); background:var(--surface);
}
.chat-send{
  flex:0 0 42px; width:42px; height:42px; border:none; border-radius:50%;
  background:var(--brand); color:var(--on-brand);
  display:grid; place-items:center; cursor:pointer;
  transition:filter var(--t-fast);
}
.chat-send:hover{ filter:brightness(.94); }
.chat-send:disabled{ opacity:.5; cursor:not-allowed; }

@media (max-width: 767px){
  .chat{ height:calc(100vh - var(--header-h) - var(--nav-h) - 74px); }
  .msg-bubble{ max-width:100%; font-size:.86rem; }
  .chat-guide-options{ grid-template-columns:repeat(2,minmax(125px,1fr)); max-height:132px; }
  .chat-guide-head > div{ align-items:flex-start; flex-direction:column; gap:2px; }
  .chat-chips{ overflow-x:auto; flex-wrap:nowrap; }
}

/* سطر التسعير الحي تحت الحقل */
.price-note{
  margin-top:.28rem; font-size:.75rem; line-height:1.6;
  color:var(--text-muted); min-height:1.1em;
}
.price-note.is-ok  { color:var(--ok); }
.price-note.is-bad { color:var(--danger); font-weight:600; }
.price-note.is-hint{ color:var(--text-muted); }

/* =====================================================================
   منتقي العميل / المورد
   ===================================================================== */
.party-field{ position:relative; }
.party-box{
  position:relative;
  border:1px solid var(--border); border-radius:var(--radius);
  background:var(--surface-2); transition:border-color var(--t-fast), box-shadow var(--t-fast);
}
.party-box:focus-within{
  border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); background:var(--surface);
}
.party-box.is-picked{ background:var(--surface); }
.party-box.is-invalid{ border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-bg); }

.party-search{
  display:flex; align-items:center; gap:.45rem;
  padding:0 .7rem; height:42px; color:var(--text-muted);
}
.party-picked[hidden],.party-search[hidden],.party-results[hidden]{display:none!important}
.party-input{
  flex:1; min-width:0; border:none; background:transparent;
  height:100%; font-size:.9rem; font-family:inherit; color:var(--text);
}
.party-input:focus{ outline:none; }
.party-input::placeholder{ color:var(--text-muted); font-size:.82rem; }

.party-picked{
  display:flex; align-items:center; gap:.55rem;
  padding:.4rem .55rem .4rem .4rem; min-height:42px;
}
.party-avatar{
  flex:0 0 30px; width:30px; height:30px; border-radius:9px;
  display:grid; place-items:center;
  background:var(--brand-soft); color:var(--brand);
}
.party-info{ flex:1; min-width:0; display:flex; flex-direction:column; line-height:1.4; }
.party-info strong{ font-size:.9rem; }
.party-info .sm{ font-size:.73rem; }
.party-clear{
  flex:0 0 28px; width:28px; height:28px; border-radius:8px;
  border:1px solid var(--border); background:var(--surface);
  color:var(--text-muted); display:grid; place-items:center; cursor:pointer;
}
.party-clear:hover{ border-color:var(--danger); color:var(--danger); }

.party-results{
  position:absolute; inset-inline:0; top:calc(100% + 4px); z-index:70;
  max-height:320px; overflow-y:auto;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow-md);
}
.party-item{
  width:100%; display:flex; align-items:center; gap:.6rem;
  padding:.5rem .7rem; border:none; background:transparent;
  text-align:start; cursor:pointer; font-family:inherit;
  border-bottom:1px solid var(--border);
}
.party-item:last-child{ border-bottom:none; }
.party-item:hover, .party-item.is-active{ background:var(--brand-soft); }
.party-item.is-blocked{ opacity:.6; }
.party-item-main{ flex:1; min-width:0; display:flex; flex-direction:column; gap:.1rem; }
.party-item-main strong{ font-size:.88rem; }
.party-item-meta{
  font-size:.73rem; color:var(--text-muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.party-item-side{ flex:0 0 auto; font-size:.8rem; color:var(--text-2); }
.party-empty{ padding:.8rem .7rem; font-size:.82rem; color:var(--text-muted); text-align:center; }

/* قائمة نتائج فحص دليل الحسابات */
.repair-list{ display:flex; flex-direction:column; gap:.2rem; }
.repair-list li{
  display:flex; align-items:center; gap:.35rem;
  font-size:.85rem; color:var(--text-2);
  padding:.2rem 0; border-bottom:1px dashed var(--border);
}
.repair-list li:last-child{ border-bottom:none; }
.repair-list li svg{ color:var(--text-muted); flex:0 0 auto; }

.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover { filter: brightness(.93); background: var(--warn); }

/* --- حقل الاختيار: زر الإضافة السريعة --- */
.pick-add{
  flex:0 0 28px; width:28px; height:28px; border-radius:8px;
  border:1px solid var(--border); background:var(--surface);
  color:var(--brand); display:grid; place-items:center; cursor:pointer;
  transition:border-color var(--t-fast), background var(--t-fast);
}
.pick-add:hover{ border-color:var(--brand); background:var(--brand-soft); }
.modal-sm{ max-width: 380px; }
.modal-x{
  margin-inline-start:auto; border:none; background:transparent;
  font-size:1.4rem; line-height:1; cursor:pointer; color:var(--text-muted);
  width:28px; height:28px; border-radius:8px;
}
.modal-x:hover{ background:var(--surface-2); color:var(--danger); }
.link-btn{
  border:none; background:none; padding:0; cursor:pointer;
  color:var(--brand-text); font:inherit; text-decoration:underline;
}

/* =====================================================================
   مركز الإشعارات
   ===================================================================== */
.notif-list{ display:flex; flex-direction:column; gap:8px; }
.notif{
  display:flex; gap:.7rem; align-items:flex-start;
  padding:.7rem .85rem; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius);
  border-inline-start:3px solid var(--border);
}
.notif.is-unread{ background:var(--brand-soft); }
.notif.is-info    { border-inline-start-color:var(--info); }
.notif.is-warn    { border-inline-start-color:var(--warn); }
.notif.is-danger  { border-inline-start-color:var(--danger); }
.notif-ico{
  flex:0 0 34px; width:34px; height:34px; border-radius:10px;
  display:grid; place-items:center; background:var(--surface-2); color:var(--text-muted);
}
.notif.is-info   .notif-ico{ background:var(--info-bg);   color:var(--info); }
.notif.is-warn   .notif-ico{ background:var(--warn-bg);   color:var(--warn); }
.notif.is-danger .notif-ico{ background:var(--danger-bg); color:var(--danger); }
.notif-body{ flex:1; min-width:0; }
.notif-head{ display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; }
.notif-title{ font-size:.9rem; }
.notif-meta{
  display:flex; align-items:center; gap:.3rem; flex-wrap:wrap;
  font-size:.74rem; color:var(--text-muted); margin-top:.15rem;
}
.notif-meta code{ font-size:.7rem; background:var(--surface-3); padding:.02rem .3rem; border-radius:4px; }
.notif-changes{
  margin-top:.45rem; padding-inline-start:.9rem;
  font-size:.8rem; line-height:1.85; color:var(--text-2);
}
.notif-changes li{ list-style:disc; }
.notif-act{ flex:0 0 auto; }

/* شبكة اختيارات */
.chk-grid{ display:grid; gap:8px; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); }
.chk-card{
  display:flex; align-items:center; gap:.5rem; cursor:pointer;
  padding:.6rem .7rem; background:var(--surface-2);
  border:1px solid var(--border); border-radius:var(--radius);
  font-size:.86rem; transition:border-color var(--t-fast), background var(--t-fast);
}
.chk-card:hover{ border-color:var(--brand); }
.chk-card.is-on{ background:var(--brand-soft); border-color:var(--brand); }
.chk-card input{ accent-color:var(--brand); }
.chk-ico{ color:var(--text-muted); display:grid; place-items:center; }
.chk-card.is-on .chk-ico{ color:var(--brand); }

/* جرس الإشعارات في الهيدر */
.hdr-bell{ position:relative; }
.hdr-badge{
  position:absolute; top:2px; inset-inline-end:2px;
  min-width:16px; height:16px; padding:0 3px;
  border-radius:999px; background:var(--danger); color:#fff;
  font-size:9.5px; font-weight:700; line-height:16px; text-align:center;
  box-shadow:0 0 0 2px var(--surface);
}

/* شارة نوع التصنيف */
.cat-type{
  display:inline-flex; align-items:center; gap:.3rem;
  font-size:.78rem; color:var(--ct, var(--text-muted));
}
.cat-type b{
  display:grid; place-items:center;
  width:18px; height:18px; border-radius:5px;
  background:var(--ct, var(--text-muted)); color:#fff;
  font-size:.68rem; font-weight:700;
}

/* تحويل قرار الشراء لفواتير */
.card.is-muted{ opacity:.62; }
.conv-head{
  display:flex; align-items:center; gap:.5rem; flex-wrap:wrap;
  cursor:pointer; font-size:.92rem;
}
.conv-head input{ accent-color:var(--brand); width:16px; height:16px; }
.conv-name{ display:inline-flex; align-items:center; gap:.35rem; }
.conv-total{
  display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap;
}

/* =====================================================================
   الكلندر المالي
   ===================================================================== */
.cal-wrap{
  display:grid; gap:14px;
  grid-template-columns:minmax(0,2.2fr) minmax(0,1fr);
}
@media (max-width: 900px){ .cal-wrap{ grid-template-columns:1fr; } }

.cal-nav{ display:flex; align-items:center; justify-content:space-between; gap:.5rem; }
.cal-nav .card-title{ flex:1; text-align:center; }

.cal-grid{
  display:grid; grid-template-columns:repeat(7, 1fr);
  border-top:1px solid var(--border);
}
.cal-dow{
  padding:.45rem .2rem; text-align:center;
  font-size:.72rem; font-weight:700; color:var(--text-muted);
  background:var(--surface-2); border-inline-start:1px solid var(--border);
  border-bottom:1px solid var(--border);
}
.cal-dow:first-child{ border-inline-start:none; }

.cal-cell{
  position:relative; display:flex; flex-direction:column; gap:.15rem;
  min-height:78px; padding:.3rem .35rem;
  border-inline-start:1px solid var(--border); border-bottom:1px solid var(--border);
  color:var(--text); text-decoration:none;
}
.cal-cell:nth-child(7n+1){ border-inline-start:none; }
.cal-cell.is-empty{ background:var(--surface-2); }
.cal-cell.has-money:hover{ background:var(--brand-soft); text-decoration:none; }
.cal-cell.is-today{ background:var(--brand-soft); box-shadow:inset 0 0 0 2px var(--brand); }
.cal-cell.is-heavy{ background:var(--warn-bg); }
.cal-cell.is-overdue{ box-shadow:inset 0 0 0 2px var(--danger); }

.cal-num{ font-size:.8rem; font-weight:700; color:var(--text-muted); }
.cal-cell.is-today .cal-num{ color:var(--brand-text); }
.cal-amounts{ display:flex; flex-direction:column; gap:1px; font-size:.68rem; font-variant-numeric:tabular-nums; }
.cal-in { color:var(--ok);   font-weight:600; }
.cal-out{ color:var(--warn); font-weight:600; }
.cal-flag{
  position:absolute; top:3px; inset-inline-end:4px;
  width:15px; height:15px; border-radius:50%;
  background:var(--danger); color:#fff;
  font-size:.62rem; font-weight:700; display:grid; place-items:center;
}

.cal-legend{ display:flex; gap:1rem; font-size:.75rem; color:var(--text-muted); }
.cal-legend .dot{ display:inline-block; width:9px; height:9px; border-radius:50%; margin-inline-end:.25rem; }
.dot-in  { background:var(--ok); }
.dot-out { background:var(--warn); }
.dot-late{ background:var(--danger); }

/* أقرب المستحقات */
.up-list{ display:flex; flex-direction:column; }
.up-item{
  display:flex; align-items:center; gap:.6rem;
  padding:.5rem .7rem; border-bottom:1px solid var(--border);
  color:var(--text); text-decoration:none;
}
.up-item:last-child{ border-bottom:none; }
.up-item:hover{ background:var(--surface-2); text-decoration:none; }
.up-item.is-late{ background:var(--danger-bg); }
.up-date{
  flex:0 0 44px; text-align:center; line-height:1.15;
  padding:.25rem 0; border-radius:8px; background:var(--surface-2);
}
.up-date strong{ display:block; font-size:1rem; }
.up-date span{ font-size:.62rem; color:var(--text-muted); }
.up-body{ flex:1; min-width:0; display:flex; flex-direction:column; }
.up-name{ font-size:.85rem; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.up-meta{ display:flex; align-items:center; gap:.3rem; font-size:.7rem; color:var(--text-muted); }
.up-amt{ flex:0 0 auto; font-size:.85rem; font-weight:700; font-variant-numeric:tabular-nums; }

/* تفصيل اليوم */
.day-sum{ display:grid; gap:8px; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); margin-bottom:1rem; }
.day-sum-box{
  padding:.6rem .8rem; border-radius:var(--radius);
  border:1px solid var(--border); background:var(--surface-2);
  display:flex; flex-direction:column;
}
.day-sum-box strong{ font-size:1.15rem; font-variant-numeric:tabular-nums; }
.day-sum-box.is-in  strong{ color:var(--ok); }
.day-sum-box.is-out strong{ color:var(--warn); }

.day-inv{
  border:1px solid var(--border); border-radius:var(--radius);
  padding:.7rem .85rem; margin-bottom:.7rem; background:var(--surface);
}
.day-inv.is-late{ border-color:var(--danger); background:var(--danger-bg); }
.day-inv-head{ display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; }
.day-dir{
  display:inline-flex; align-items:center; gap:.25rem;
  font-size:.72rem; font-weight:700; padding:.12rem .45rem; border-radius:var(--radius-sm);
}
.day-dir.is-in { background:var(--ok-bg);   color:var(--ok); }
.day-dir.is-out{ background:var(--warn-bg); color:var(--warn); }
.day-inv-name{ flex:1; min-width:0; display:flex; flex-direction:column; }
.day-inv-amt{ font-size:1.05rem; font-weight:700; font-variant-numeric:tabular-nums; }
.day-inv-meta{
  display:flex; align-items:center; gap:.35rem; flex-wrap:wrap;
  margin-top:.35rem; font-size:.74rem; color:var(--text-muted);
}
.day-inv-meta code{ background:var(--surface-3); padding:.02rem .3rem; border-radius:4px; }
.day-items{ margin-top:.5rem; }
.day-items summary{
  cursor:pointer; font-size:.78rem; color:var(--brand-text);
  padding:.2rem 0; user-select:none;
}
.day-items[open] summary{ margin-bottom:.4rem; }

/* ---------------------------------------------------------------
   أرصدة السنوات والفترات والمراجعة اليومية
   --------------------------------------------------------------- */
.fiscal-summary-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-bottom:16px;
}
.fiscal-summary-card{
  position:relative;
  overflow:hidden;
  min-width:0;
  padding:15px 16px;
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  background:var(--surface);
  box-shadow:var(--shadow-sm);
}
.fiscal-summary-card::before{
  content:"";
  position:absolute;
  inset-block:0;
  inset-inline-start:0;
  width:4px;
  background:var(--brand);
}
.fiscal-summary-card.movement::before{ background:var(--info); }
.fiscal-summary-card.closing::before{ background:var(--ok); }
.fiscal-summary-label{
  display:flex;
  align-items:center;
  gap:7px;
  margin-bottom:10px;
  color:var(--text-2);
  font-weight:700;
}
.balance-pair{
  display:grid;
  grid-template-columns:repeat(2,minmax(94px,1fr));
  gap:6px;
  direction:rtl;
}
.balance-side{
  display:flex;
  flex-direction:column;
  gap:1px;
  padding:5px 8px;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  background:var(--surface-2);
  line-height:1.35;
  direction:rtl;
}
.balance-side small{ color:var(--text-muted); font-size:11px; }
.balance-side strong{
  color:var(--text);
  font-size:13px;
  font-variant-numeric:tabular-nums;
  direction:ltr;
  text-align:right;
}
.balance-side.debit{ border-inline-start:3px solid var(--info); }
.balance-side.credit{ border-inline-start:3px solid var(--warn); }
.balance-pair-lg{ grid-template-columns:repeat(2,minmax(110px,1fr)); }
.balance-pair-lg .balance-side{ padding:8px 10px; }
.balance-pair-lg .balance-side strong{ font-size:16px; }
.balance-diff{ display:inline-flex; margin-top:5px; }
.fiscal-review-note{ margin-bottom:16px; }
.fiscal-days-table tr.is-today td{ background:var(--info-bg); }

@media (max-width:900px){
  .fiscal-summary-grid{ grid-template-columns:1fr; }
}

@media (max-width:600px){
  .balance-pair,
  .balance-pair-lg{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .balance-side strong{ font-size:12px; }
  .balance-pair-lg .balance-side strong{ font-size:14px; }
}

/* ---------------------------------------------------------------
   نقطة البيع — كتالوج بثيم النظام + سلة متجاوبة
   --------------------------------------------------------------- */
.pos-connectivity{
  display:inline-flex;align-items:center;gap:8px;min-height:42px;padding:6px 10px;
  border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface);
  color:var(--success);white-space:nowrap;
}
.pos-server-clock{
  flex:0 0 auto;height:40px;display:inline-flex;align-items:center;gap:7px;padding:3px 8px;
  border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface-2);
  color:var(--text);direction:ltr;font-variant-numeric:tabular-nums;
}
.pos-analog-clock{
  --clock-hour:0deg;--clock-minute:0deg;--clock-second:0deg;
  position:relative;width:34px;height:34px;flex:0 0 34px;border-radius:50%;
  border:2px solid var(--brand);background:
    radial-gradient(circle at center,var(--surface) 0 61%,transparent 62%),
    repeating-conic-gradient(from -1deg,var(--text-muted) 0 2deg,transparent 2deg 30deg);
  box-shadow:inset 0 0 0 2px var(--surface),0 2px 8px rgba(0,0,0,.08);
}
.pos-clock-hand{position:absolute;left:50%;bottom:50%;display:block;border-radius:99px;transform-origin:50% 100%;}
.pos-clock-hour{width:3px;height:8px;background:var(--text);transform:translateX(-50%) rotate(var(--clock-hour));}
.pos-clock-minute{width:2px;height:11px;background:var(--brand);transform:translateX(-50%) rotate(var(--clock-minute));}
.pos-clock-second{width:1px;height:12px;background:var(--danger);transform:translateX(-50%) rotate(var(--clock-second));}
.pos-clock-center{position:absolute;left:50%;top:50%;width:5px;height:5px;border-radius:50%;background:var(--brand);transform:translate(-50%,-50%);box-shadow:0 0 0 2px var(--surface);}
.pos-server-clock-copy{display:grid;line-height:1.15;text-align:center;}
.pos-server-clock-copy strong{font-size:14px;letter-spacing:.5px;}
.pos-server-clock-copy small{font-size:9px;color:var(--text-muted);direction:rtl;white-space:nowrap;}
.pos-connectivity-topbar{
  flex:0 0 auto;min-height:40px;height:40px;max-width:min(390px,42vw);padding:4px 7px;
  background:var(--surface-2);box-shadow:none;
}
.pos-connectivity-topbar .pos-connectivity-copy{min-width:0;max-width:190px;}
.pos-connectivity-topbar .pos-connectivity-copy strong,
.pos-connectivity-topbar .pos-connectivity-copy small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.pos-connectivity-topbar .btn{min-height:30px;padding:4px 8px;}
.pos-connectivity-topbar .btn:disabled{opacity:.55;cursor:not-allowed;}
.pos-connectivity-copy{display:grid;line-height:1.25;text-align:start;}
.pos-connectivity-copy strong{font-size:12px;}
.pos-connectivity-copy small{color:var(--text-muted);font-size:10px;}
.pos-connectivity-icon-offline{display:none;}
.pos-connectivity-timer{direction:ltr;font-variant-numeric:tabular-nums;font-size:12px;}
.pos-connectivity[data-state="offline"],.pos-connectivity[data-state="expired"]{
  position:relative;color:var(--danger);border-color:var(--danger);
  background:var(--danger-bg);box-shadow:0 0 0 3px rgba(220,38,38,.08);
}
.pos-connectivity[data-state="syncing"]{color:var(--primary);}
.pos-connectivity[data-state="offline"] .pos-connectivity-icon-online,
.pos-connectivity[data-state="expired"] .pos-connectivity-icon-online{display:none;}
.pos-connectivity[data-state="offline"] .pos-connectivity-icon-offline,
.pos-connectivity[data-state="expired"] .pos-connectivity-icon-offline{display:inline-flex;}
.pos-connectivity[data-state="expired"]{animation:pos-offline-pulse 1.4s ease-in-out infinite;}
@keyframes pos-offline-pulse{50%{box-shadow:0 0 0 7px rgba(220,38,38,.04);}}
@media (max-width:1100px){
  .pos-server-clock-copy small{display:none;}
  .pos-connectivity-topbar .pos-connectivity-copy small{display:none;}
  .pos-connectivity-topbar .pos-connectivity-copy{max-width:135px;}
}
@media (max-width:767px){
  .app-header{gap:5px;padding-inline:7px;}
  .hdr-smart-tools{gap:4px;}
  .pos-server-clock{padding:2px 5px;gap:4px;}
  .pos-server-clock-copy strong{font-size:12px;}
  .pos-analog-clock{width:30px;height:30px;flex-basis:30px;}
  .pos-connectivity-topbar{max-width:none;gap:5px;padding-inline:6px;}
  .pos-connectivity-topbar .pos-connectivity-copy{display:none;}
  .pos-connectivity-topbar .btn span{display:none;}
  .pos-connectivity-topbar .btn{width:30px;padding:4px;}
}
.pos-page-head{ margin-bottom:10px; }
.pos-sale-form{ min-width:0; }
.pos-quickbar{
  display:grid;
  grid-template-columns:repeat(3,minmax(140px,1fr));
  gap:0;
  margin-bottom:12px;
  overflow:visible;
}
.pos-quick-field{
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:3px;
  padding:10px 12px;
  border-inline-end:1px solid var(--border);
}
.pos-quick-field:first-child{ border-inline-end:0; }
.pos-quick-label{
  display:flex;
  align-items:center;
  gap:5px;
  color:var(--text-muted);
  font-size:11px;
  font-weight:700;
}
.pos-quick-field > strong{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pos-auto-print{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  cursor:pointer;
  color:var(--text-2);
  font-weight:600;
}
.pos-auto-print input{ width:18px; height:18px; accent-color:var(--brand); }
.pos-auto-print span{ display:flex; align-items:center; gap:6px; }

.pos-workspace{
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(450px,.9fr);
  grid-template-areas:"catalog order";
  gap:12px;
  align-items:start;
}
.pos-catalog-panel{
  grid-area:catalog;
  position:sticky;
  top:calc(var(--header-h) + 10px);
  min-width:0;
  max-height:calc(100vh - var(--header-h) - 24px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.pos-order-panel{ grid-area:order; min-width:0; }
.pos-catalog-search{ padding:10px; border-bottom:1px solid var(--border); }
.pos-catalog-body{
  min-height:390px;
  display:grid;
  grid-template-columns:122px minmax(0,1fr);
  overflow:hidden;
}
.pos-category-list{
  padding:8px;
  overflow-y:auto;
  border-inline-end:1px solid var(--border);
  background:var(--surface-2);
}
.pos-category{
  width:100%;
  min-height:46px;
  display:grid;
  grid-template-columns:20px minmax(0,1fr) auto;
  align-items:center;
  gap:6px;
  margin-bottom:5px;
  padding:7px 8px;
  border:1px solid transparent;
  border-radius:var(--radius);
  color:var(--text-2);
  text-align:start;
  transition:background var(--t-fast),border-color var(--t-fast),color var(--t-fast);
}
.pos-category:hover{ background:var(--surface-3); }
.pos-category.is-active{
  background:var(--brand-soft);
  border-color:var(--brand);
  color:var(--brand-text);
  font-weight:700;
}
.pos-category span{ min-width:0; line-height:1.3; }
.pos-category small{
  min-width:20px;
  padding:1px 5px;
  border-radius:10px;
  background:var(--surface);
  color:var(--text-muted);
  text-align:center;
}
.pos-products-area{ min-width:0; overflow-y:auto; padding:9px; }
.pos-products-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(132px,1fr));
  gap:8px;
}
.pos-product{
  min-width:0;
  min-height:148px;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:6px;
  padding:8px;
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  background:var(--surface);
  color:var(--text);
  text-align:start;
  box-shadow:var(--shadow-sm);
  transition:transform var(--t-fast),border-color var(--t-fast),box-shadow var(--t-fast);
}
.pos-product:hover:not(:disabled),.pos-product:focus-visible{
  transform:translateY(-2px);
  border-color:var(--brand);
  box-shadow:var(--shadow-md);
}
.pos-product:active:not(:disabled){ transform:translateY(0); }
.pos-product.is-unavailable{ opacity:.55; cursor:not-allowed; }
.pos-product-media{
  height:64px;
  display:grid;
  place-items:center;
  overflow:hidden;
  border-radius:var(--radius);
  background:var(--brand-soft);
  color:var(--brand-text);
}
.pos-product-media img{ width:100%; height:100%; object-fit:cover; }
.pos-product-name{
  min-height:38px;
  font-size:13px;
  font-weight:700;
  line-height:1.45;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.pos-product-meta{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:6px;
  margin-top:auto;
}
.pos-product-meta strong{ color:var(--brand-text); font-size:12px; white-space:nowrap; }
.pos-product-meta small{ color:var(--text-muted); font-size:10px; }
.pos-cart-table{ min-width:520px; }
.pos-cart-table td:first-child{ min-width:160px; }
.pos-order-summary .inv-totals{ max-width:none; }
.pos-order-notes{ margin-bottom:12px; }
.pos-order-notes summary{
  display:flex;
  align-items:center;
  gap:6px;
  padding:11px 13px;
  cursor:pointer;
  color:var(--text-2);
  font-weight:600;
}
.pos-payment-launch{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-color:var(--border-strong);
}
.pos-checkout-total-block{ display:flex; flex-direction:column; min-width:145px; }
.pos-checkout-total{ color:var(--brand-text); font-size:22px; line-height:1.25; }
.pos-payment-modal-total{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-bottom:14px; padding:12px 14px; border:1px solid var(--brand);
  border-radius:var(--radius); background:var(--brand-soft);
}
.pos-payment-modal-total span{ color:var(--text-2); font-weight:700; }
.pos-payment-modal-total strong{ color:var(--brand-text); font-size:25px; }
.pos-checkout-error{
  position:sticky; top:0; z-index:3; margin:.75rem 0;
  box-shadow:0 8px 22px rgba(185,28,28,.12);
}
.pos-checkout-error[hidden]{ display:none !important; }
.pos-payment-method-picker{
  margin-bottom:14px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:var(--surface-2);
}
.pos-payment-picker-title{
  display:flex;
  align-items:center;
  gap:6px;
  margin-bottom:9px;
  color:var(--text-2);
  font-size:12px;
  font-weight:700;
}
.pos-payment-type-buttons{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
}
.pos-payment-type{
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:9px 12px;
  border:1.5px solid var(--border-strong);
  border-radius:var(--radius);
  background:var(--surface);
  color:var(--text-2);
  font-weight:700;
  transition:border-color var(--t-fast),background var(--t-fast),color var(--t-fast),box-shadow var(--t-fast);
}
.pos-payment-type:hover:not(:disabled){ border-color:var(--brand); color:var(--brand-text); }
.pos-payment-type.is-active{
  border-color:var(--brand);
  background:var(--brand-soft);
  color:var(--brand-text);
  box-shadow:0 0 0 1px var(--brand);
}
.pos-payment-type:disabled{ opacity:.45; cursor:not-allowed; }
.pos-card-machine{ margin-top:10px; }
.pos-card-machine[hidden]{ display:none; }
.pos-cash-settlement{
  display:grid;
  grid-template-columns:minmax(210px,1fr) minmax(140px,.7fr);
  align-items:end;
  gap:6px 12px;
  margin-bottom:14px; padding:12px;
  border:1px solid var(--border); border-radius:var(--radius);
  background:var(--surface-2);
}
.pos-cash-settlement[hidden]{ display:none; }
.pos-cash-received,.pos-cash-change{ display:flex; flex-direction:column; gap:4px; }
.pos-cash-received > span:first-child,.pos-cash-change > span:first-child{
  color:var(--text-muted); font-size:11px; font-weight:700;
}
.pos-cash-input-wrap{ display:flex; align-items:center; gap:6px; }
.pos-cash-input-wrap .input{ min-width:0; height:42px; font-size:18px; font-weight:700; }
.pos-cash-change strong{ min-height:42px; display:flex; align-items:center; color:var(--brand-text); font-size:20px; }
.pos-cash-message{ grid-column:1/-1; min-height:18px; }
.pos-complete-btn{ min-height:48px; padding-inline:22px; font-size:15px; }
.pos-close-summary{
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:16px;
}
.pos-close-summary > div{
  display:flex; flex-direction:column; gap:4px; padding:10px;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-2);
}
.pos-close-summary > div[hidden]{ display:none; }
.pos-close-summary span{ color:var(--text-muted); font-size:11px; }
.pos-close-summary strong{ color:var(--brand-text); }
.pos-card-last4{ margin-top:14px; }
.pos-card-last4 .input{ max-width:190px; font-size:20px; letter-spacing:5px; }

/* شرح الشاشات */
.screen-guide-modal{ width:min(760px,calc(100vw - 28px)); max-height:92vh; }
.screen-guide-modal .modal-body{ overflow:auto; }
.screen-guide-media{
  min-height:130px; display:grid; place-items:center; overflow:hidden;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-2);
}
.screen-guide-media img,.screen-guide-media video{
  display:block; width:100%; max-height:62vh; object-fit:contain; background:#000;
}
.screen-guide-description{
  margin-top:12px; padding:12px 14px; border-inline-start:3px solid var(--brand);
  border-radius:var(--radius-sm); background:var(--brand-soft); line-height:1.9;
}
.screen-guide-settings-grid{
  display:grid; grid-template-columns:minmax(320px,.85fr) minmax(420px,1.15fr); gap:14px; align-items:start;
}
.screen-guide-current-media{
  display:flex; flex-direction:column; gap:9px; margin-top:8px; padding:10px;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-2);
}
.screen-guide-current-media img{ width:100%; max-height:240px; object-fit:contain; border-radius:var(--radius-sm); }
@media(max-width:980px){ .screen-guide-settings-grid{ grid-template-columns:1fr; } }

/* إيصال POS على الشاشة والطباعة */
.pos-receipt-screen{ display:flex; justify-content:center; padding:4px 0 24px; }
.pos-receipt-print{ width:100%; padding:16px; color:var(--text); }
.pos-receipt-screen.paper-thermal58 .pos-receipt-print{ max-width:58mm; }
.pos-receipt-screen.paper-thermal80 .pos-receipt-print{ max-width:80mm; }
.pos-receipt-screen.paper-a4 .pos-receipt-print{ max-width:210mm; padding:28px; }
.receipt-head{ text-align:center; font-size:11px; line-height:1.6; }
.receipt-head h1{ font-size:17px; margin:2px 0; }
.receipt-logo{ width:52px; height:52px; object-fit:contain; margin:0 auto 5px; }
.receipt-title{
  margin:10px 0 8px;
  padding:5px;
  border-block:1px dashed var(--border-strong);
  text-align:center;
  font-weight:700;
}
.receipt-meta{ display:grid; grid-template-columns:1fr; gap:3px; font-size:10.5px; }
.receipt-meta > div,.receipt-totals > div{ display:flex; justify-content:space-between; gap:8px; }
.receipt-meta span,.receipt-totals span{ color:var(--text-muted); }
.receipt-table{ margin:9px 0; font-size:10.5px; table-layout:fixed; }
.receipt-table th,.receipt-table td{ padding:5px 3px; border-bottom:1px solid var(--border); }
.receipt-table th:first-child,.receipt-table td:first-child{ text-align:right; }
.receipt-table .receipt-qty{ text-align:center; direction:ltr; white-space:nowrap; }
.receipt-table .receipt-money{ text-align:left; direction:ltr; white-space:nowrap; }
.receipt-totals{ display:flex; flex-direction:column; gap:4px; font-size:11px; }
.receipt-totals .is-grand{
  margin-block:3px;
  padding-block:6px;
  border-block:2px solid var(--border-strong);
  font-size:13px;
}
.receipt-totals .receipt-change{ font-size:12px; font-weight:700; }
.receipt-totals .receipt-change strong{ color:var(--brand-text); }
.receipt-note{ margin-top:8px; padding-top:7px; border-top:1px dashed var(--border); font-size:10px; }
.receipt-foot{ margin-top:12px; padding-top:9px; border-top:1px dashed var(--border-strong); text-align:center; font-size:10px; }
.receipt-policy{margin-top:7px;padding-top:7px;border-top:1px dashed var(--border);line-height:1.55}
.receipt-policy-link{margin-top:5px;overflow-wrap:anywhere}.receipt-policy-link a{font-weight:700;color:inherit;text-decoration:underline}
.paper-a4 .receipt-head{ font-size:13px; }
.paper-a4 .receipt-head h1{ font-size:24px; }
.paper-a4 .receipt-meta{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px 24px; font-size:12px; }
.paper-a4 .receipt-table{ font-size:12px; }
.paper-a4 .receipt-table th,.paper-a4 .receipt-table td{ padding:8px 6px; }
.paper-a4 .receipt-totals{ margin-inline-start:auto; max-width:400px; font-size:12px; }

@media (max-width:1180px){
  .pos-quickbar{ grid-template-columns:repeat(3,minmax(150px,1fr)); }
  .pos-workspace{ grid-template-columns:1fr; grid-template-areas:"catalog" "order"; }
  .pos-catalog-panel{ position:static; max-height:none; }
  .pos-products-area{ max-height:480px; }
}
@media (max-width:720px){
  .pos-quickbar{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .pos-quick-field,.pos-auto-print{ border-bottom:1px solid var(--border); }
  .pos-catalog-body{ grid-template-columns:1fr; grid-template-rows:auto minmax(320px,auto); }
  .pos-category-list{
    display:flex;
    gap:6px;
    overflow-x:auto;
    border-inline-end:0;
    border-bottom:1px solid var(--border);
  }
  .pos-category{ flex:0 0 auto; width:auto; min-width:112px; margin:0; }
  .pos-products-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .pos-payment-launch{ margin-bottom:calc(var(--nav-h) + 8px); }
}
@media (max-width:480px){
  .pos-quickbar{ grid-template-columns:1fr; }
  .pos-product{ min-height:138px; }
  .pos-product-media{ height:54px; }
  .pos-payment-launch{ align-items:stretch; flex-direction:column; }
  .pos-cash-settlement{ grid-template-columns:1fr; }
  .pos-cash-message{ grid-column:auto; }
  .pos-complete-btn{ width:100%; }
  .pos-close-summary,.pos-customer-fields{ grid-template-columns:1fr; }
}

/* =====================================================================
   مركز التقارير
   ===================================================================== */
.reports-filter{
  display:grid;
  grid-template-columns:minmax(260px,1.35fr) minmax(210px,.7fr) minmax(280px,1fr);
  gap:0;
  align-items:stretch;
  margin-bottom:14px;
  overflow:hidden;
}
.reports-filter-field{ padding:12px 14px; border-inline-end:1px solid var(--border); }
.reports-filter-field .label{ display:flex; align-items:center; gap:6px; margin-bottom:6px; }
.reports-scope-note{
  display:flex; align-items:center; gap:9px; padding:13px 15px;
  color:var(--text-2); background:var(--surface-2); font-size:13px; line-height:1.65;
}
.reports-accordion-list{ display:flex; flex-direction:column; gap:10px; }
.report-accordion{ overflow:hidden; margin:0; }
.report-accordion > summary{
  display:flex; align-items:center; gap:10px; padding:13px 15px;
  cursor:pointer; list-style:none; user-select:none; font-weight:700;
  background:var(--surface); transition:background var(--t-fast);
}
.report-accordion > summary::-webkit-details-marker{ display:none; }
.report-accordion > summary:hover{ background:var(--surface-2); }
.report-group-icon{
  width:36px; height:36px; display:grid; place-items:center; flex:0 0 36px;
  color:var(--brand); background:var(--brand-soft); border-radius:var(--radius-sm);
}
.report-group-title{ flex:1; }
.report-group-chevron{ transition:transform var(--t-fast); color:var(--text-muted); }
.report-accordion[open] .report-group-chevron{ transform:rotate(180deg); }
.report-group-body{ padding:0 14px 14px; border-top:1px solid var(--border); }
.report-grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(285px,1fr));
  gap:10px; padding-top:12px;
}
.report-card{
  display:flex; gap:10px; align-items:center; min-width:0; padding:12px;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface);
  transition:border-color var(--t-fast),background var(--t-fast),transform var(--t-fast);
}
.report-card:hover{
  border-color:var(--brand); background:var(--surface-2); text-decoration:none;
  transform:translateY(-1px);
}
.report-ico{
  flex:0 0 42px; width:42px; height:42px; display:grid; place-items:center;
  border-radius:var(--radius-sm); background:var(--brand-soft); color:var(--brand);
}
.report-body{ display:flex; flex-direction:column; gap:3px; min-width:0; flex:1; }
.report-card-head{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.report-body strong{ color:var(--text); font-size:14px; }
.report-body .sm{ line-height:1.55; }
.report-scope-badge{ font-size:10px; font-weight:600; white-space:nowrap; }
.report-card-arrow{ color:var(--text-muted); flex:0 0 auto; }

@media(max-width:900px){
  .reports-filter{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .reports-scope-note{ grid-column:1/-1; border-top:1px solid var(--border); }
}
@media(max-width:600px){
  .reports-filter{ grid-template-columns:1fr; }
  .reports-filter-field{ border-inline-end:0; border-bottom:1px solid var(--border); }
  .reports-scope-note{ grid-column:auto; }
  .report-grid{ grid-template-columns:1fr; }
  .report-card{ align-items:flex-start; }
  .report-card-head{ align-items:flex-start; }
}

.report-permission-center{
  display:grid; grid-template-columns:minmax(0,1fr) minmax(210px,300px);
  gap:14px; align-items:center; padding:12px 14px; margin-bottom:10px;
  border:1px solid var(--brand); border-radius:var(--radius); background:var(--brand-soft);
}
.report-permission-groups{ display:flex; flex-direction:column; gap:8px; }
.report-permission-group{ border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.report-permission-group > summary{
  display:flex; align-items:center; gap:8px; padding:11px 12px; cursor:pointer; list-style:none;
  background:var(--surface-2);
}
.report-permission-group > summary::-webkit-details-marker{ display:none; }
.report-permission-group > summary strong{ flex:1; }
.report-permission-group[open] .report-group-chevron{ transform:rotate(180deg); }
.report-permission-list{ padding:4px 12px; }
.report-permission-row{
  display:grid; grid-template-columns:minmax(0,1fr) minmax(155px,220px);
  gap:14px; align-items:center; padding:10px 0; border-bottom:1px solid var(--border); cursor:pointer;
}
.report-permission-row:last-child{ border-bottom:0; }
.report-permission-row > span{ display:flex; flex-direction:column; gap:2px; }
@media(max-width:600px){
  .report-permission-center,.report-permission-row{ grid-template-columns:1fr; }
}

/* خطة السداد */
.inst-warn{ margin-inline-start:.7rem; font-size:.78rem; }
.inst-warn.is-ok  { color:var(--ok); font-weight:600; }
.inst-warn.is-warn{ color:var(--warn); font-weight:600; }

/* =====================================================================
   المرتجعات
   ===================================================================== */
.kv{ display:flex; flex-direction:column; gap:.1rem; }
.kv > div{
  display:flex; justify-content:space-between; gap:1rem;
  padding:.35rem 0; font-size:.86rem;
  border-bottom:1px dashed var(--border);
}
.kv > div:last-child{ border-bottom:none; }
.kv span{ color:var(--text-muted); }
.kv strong{ text-align:end; }
.kv .is-total{ border-top:2px solid var(--border); padding-top:.5rem; margin-top:.2rem; }
.kv .is-total strong{ font-size:1.05rem; color:var(--brand-text); }

.disp-tag{
  display:inline-flex; align-items:center; gap:.25rem; white-space:nowrap;
  font-size:.74rem; font-weight:600; padding:.15rem .45rem; border-radius:var(--radius-sm);
  background:var(--surface-2); color:var(--text-2);
}
.disp-tag.is-ok    { background:var(--ok-bg);     color:var(--ok); }
.disp-tag.is-danger{ background:var(--danger-bg); color:var(--danger); }
.disp-tag.is-warn  { background:var(--warn-bg);   color:var(--warn); }

tr.is-scrap    td{ background:var(--danger-bg); }
tr.is-supplier td{ background:var(--warn-bg); }

.ret-totals{
  display:grid; gap:10px;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
}
.ret-totals > div{
  display:flex; flex-direction:column; gap:.15rem;
  padding:.6rem .8rem; background:var(--surface-2);
  border:1px solid var(--border); border-radius:var(--radius);
}
.ret-totals strong{ font-size:1.1rem; font-variant-numeric:tabular-nums; }
.ret-totals .is-grand{ background:var(--brand-soft); border-color:var(--brand); }
.ret-totals .is-grand strong{ color:var(--brand-text); font-size:1.25rem; }
.input-sm{ height:30px; font-size:.8rem; padding:0 .5rem; }

/* سطور المرتجع من الفاتورة: بيانات الصنف والمتاح للإرجاع */
.ret-line-info{ display:flex; flex-wrap:wrap; gap:.2rem .7rem; margin-top:.15rem; font-size:.78rem; color:var(--text-muted); }
.ret-line-info strong{ color:var(--text-2); font-weight:700; }
#retBody tr.is-picked td{ background:var(--brand-soft); }
#retBody tr.ret-line-off td{ opacity:.62; }
form.alert .select-sm{ max-width:220px; }
@media (max-width: 767px){
  .ret-lines.responsive tbody td.ret-item{ display:block; text-align:start; }
  .ret-lines.responsive tbody td.ret-item::before{ display:none; }
  .ret-lines.responsive tbody td .input-num{ max-width:150px; }
  .ret-lines.responsive tbody td.hide-sm{ display:flex; }
}

/* خريطة مراحل تطوير المنصة في لوحة المدير */
.roadmap-head-actions{display:flex;align-items:center;justify-content:flex-end;gap:.55rem;flex-wrap:wrap}
.roadmap-size-tabs{display:inline-grid;grid-template-columns:repeat(3,auto);padding:3px;border:1px solid var(--border);border-radius:10px;background:var(--surface-3)}
.roadmap-size-tab{min-height:29px;padding:3px 10px;border:0;border-radius:7px;background:transparent;color:var(--text-muted);font-family:inherit;font-size:.75rem;font-weight:600;line-height:1.2;cursor:pointer}
.roadmap-size-tab:hover{color:var(--text);background:var(--surface)}
.roadmap-size-tab.is-active{color:var(--brand-text);background:var(--surface);box-shadow:var(--shadow-sm)}
.roadmap-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;transition:grid-template-columns var(--t-base),gap var(--t-base)}
.roadmap-stage{position:relative;display:flex;flex-direction:column;min-height:190px;padding:14px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2);overflow:hidden;transition:min-height var(--t-base),padding var(--t-base),box-shadow var(--t-fast)}
.roadmap-stage:hover{box-shadow:var(--shadow-sm)}
.roadmap-stage::before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:4px;background:var(--text-muted)}
.roadmap-stage.is-ready::before{background:var(--ok)}
.roadmap-stage.is-progress::before{background:var(--brand)}
.roadmap-stage.is-blocked::before{background:var(--danger)}
.roadmap-stage.is-planned::before{background:var(--warn)}
.roadmap-stage-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.roadmap-number{display:grid;place-items:center;width:29px;height:29px;border-radius:50%;background:var(--brand-soft);color:var(--brand-text);font-weight:800}
.roadmap-stage h3{font-size:1rem;margin:.8rem 0 .35rem}.roadmap-stage p{color:var(--text-muted);font-size:.82rem;line-height:1.65;margin:0 0 1rem}
.roadmap-progress{height:7px;margin-top:auto;border-radius:999px;background:var(--border);overflow:hidden}
.roadmap-progress span{display:block;height:100%;border-radius:inherit;background:var(--brand)}
.roadmap-stage.is-ready .roadmap-progress span{background:var(--ok)}
.roadmap-stage.is-planned .roadmap-progress span{background:var(--warn)}
.roadmap-percent{margin-top:.35rem;font-weight:700;font-size:.78rem;color:var(--text-muted);text-align:end}
.roadmap-stage.is-ai-stage{grid-column:2 / span 2;width:calc(50% - 6px);margin:22px auto 0;overflow:visible}
.roadmap-stage-botmark{position:absolute;z-index:2;top:-22px;left:50%;transform:translateX(-50%);width:44px;height:44px;display:grid;place-items:center;border:4px solid var(--surface);border-radius:50%;background:var(--brand);color:var(--on-brand);box-shadow:var(--shadow-md)}
.roadmap-note{display:flex;align-items:flex-start;gap:.5rem;margin-top:12px;padding:10px 12px;border-radius:var(--radius-sm);background:var(--info-bg);color:var(--text-2);font-size:.82rem;line-height:1.6}
.roadmap-checks{margin-top:8px;padding-top:7px;border-top:1px dashed var(--border);font-size:.73rem;color:var(--text-muted)}
.roadmap-checks summary{cursor:pointer;font-weight:700;color:var(--text-2)}
.roadmap-checks ul{list-style:none;margin:7px 0 0;padding:0;display:grid;gap:4px}
.roadmap-checks li{display:flex;align-items:center;gap:5px}.roadmap-checks li.is-done{color:var(--ok)}.roadmap-checks li.is-pending{color:var(--warn)}
.platform-roadmap.is-collapsed .card-head{border-bottom:0}.platform-roadmap.is-collapsed{margin-bottom:10px!important}
.platform-roadmap.roadmap-size-compact .roadmap-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
.platform-roadmap.roadmap-size-compact .roadmap-stage{min-height:118px;padding:10px}
.platform-roadmap.roadmap-size-compact .roadmap-stage h3{font-size:.86rem;margin:.55rem 0 .25rem;line-height:1.4}
.platform-roadmap.roadmap-size-compact .roadmap-stage p{font-size:.72rem;line-height:1.45;margin-bottom:.5rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.platform-roadmap.roadmap-size-compact .roadmap-number{width:25px;height:25px;font-size:.75rem}
.platform-roadmap.roadmap-size-compact .roadmap-checks{display:none}
.platform-roadmap.roadmap-size-compact .roadmap-stage.is-ai-stage{grid-column:auto;width:auto;margin:0;overflow:visible}
.platform-roadmap.roadmap-size-compact .roadmap-stage-botmark{width:30px;height:30px;top:-12px;border-width:3px}
.platform-roadmap.roadmap-size-comfortable .roadmap-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
.platform-roadmap.roadmap-size-large .roadmap-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.platform-roadmap.roadmap-size-large .roadmap-stage{min-height:235px;padding:18px}
.platform-roadmap.roadmap-size-large .roadmap-stage.is-ai-stage{grid-column:2;width:100%;margin-top:22px}
@media(max-width:1100px){.roadmap-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.roadmap-stage.is-ai-stage{grid-column:1 / span 2;width:calc(50% - 6px)}}
@media(max-width:1100px){.platform-roadmap.roadmap-size-compact .roadmap-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.platform-roadmap.roadmap-size-comfortable .roadmap-grid,.platform-roadmap.roadmap-size-large .roadmap-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.platform-roadmap .roadmap-stage.is-ai-stage{grid-column:auto;width:auto;margin:12px 0 0}}
@media(max-width:640px){.roadmap-grid,.platform-roadmap.roadmap-size-compact .roadmap-grid,.platform-roadmap.roadmap-size-comfortable .roadmap-grid,.platform-roadmap.roadmap-size-large .roadmap-grid{grid-template-columns:1fr}.roadmap-stage,.platform-roadmap.roadmap-size-large .roadmap-stage{min-height:145px}.platform-roadmap .roadmap-stage.is-ai-stage{grid-column:1;width:100%}.platform-roadmap .card-head{align-items:flex-start}.roadmap-head-actions{width:100%;justify-content:flex-start}.roadmap-size-tabs{flex:1}.roadmap-size-tab{padding-inline:6px}.roadmap-note{font-size:.75rem}}

/* ترتيب ثابت لأزرار وروابط رؤوس الصفحات بدل التفافها بشكل عشوائي. */
.page-actions>form{display:inline-flex;align-items:stretch;margin:0}.page-actions>form>.btn{height:100%}
.page-actions>a.btn,.page-actions>button.btn,.page-actions>form>.btn{min-height:39px;justify-content:center;white-space:nowrap}
.sb-group-links{display:grid;gap:2px;margin-inline:7px 2px;padding:4px 5px 6px;border-inline-start:1px solid var(--border)}
.sb-group-links[hidden]{display:none}.sb-group.is-open>.sb-group-title{background:var(--surface-3);color:var(--text)}
@media(max-width:640px){.page-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;width:100%}.page-actions>*{min-width:0!important;width:100%}.page-actions>a.btn,.page-actions>button.btn,.page-actions>form>.btn{width:100%;white-space:normal;line-height:1.3}.page-actions>form{display:flex}}
.print-audit-count{display:inline-flex;align-items:center;gap:.35rem;margin:0 0 .55rem;padding:.25rem .55rem;border:1px solid var(--border);border-radius:999px;background:var(--surface);color:var(--muted);font-size:.78rem}

/* ---------- مساعد إدخال الفواتير: لصق Excel، آخر سعر، اختصارات ---------- */
.inv-hint{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center;font-size:.74rem;line-height:1.4;margin-top:.15rem;color:var(--info,var(--text-2))}
.inv-hint:empty{display:none}
.inv-hint .link-btn{font-size:.74rem}
.inv-shortcuts{display:flex;flex-wrap:wrap;gap:.35rem 1.1rem;padding:.6rem .9rem;border-top:1px solid var(--border);margin:0}
.inv-shortcuts span{display:inline-flex;align-items:center;gap:.3rem}
kbd{display:inline-block;min-width:1.5em;padding:0 .35em;border:1px solid var(--border-strong,var(--border));border-bottom-width:2px;border-radius:5px;background:var(--surface);font-family:ui-monospace,Consolas,monospace;font-size:.72rem;line-height:1.55;text-align:center;color:var(--text)}
.paste-text{width:100%;min-height:9rem;font-family:ui-monospace,Consolas,monospace;font-size:.86rem;line-height:1.6;resize:vertical}
.paste-report{margin-top:.6rem;font-size:.86rem}
.paste-report ul{margin:.35rem 0 0;padding-inline-start:1.2rem;display:grid;gap:.2rem}
@media(max-width:640px){.inv-shortcuts{display:none}}

/* ---------- مساعد إدخال الأصناف: قيم التصنيف والإدخال الجماعي ---------- */
.cat-assist{display:flex;flex-wrap:wrap;gap:.45rem .8rem;align-items:center;margin-top:.45rem;padding:.5rem .7rem;border:1px dashed var(--border-strong,var(--border));border-radius:8px;background:var(--surface-2);font-size:.8rem;line-height:1.5}
.cat-assist[hidden]{display:none}
.cat-assist-text{flex:1 1 220px;color:var(--text-2)}
.cat-assist-actions{display:flex;gap:.35rem}
.bulk-table td{padding:4px 5px;vertical-align:top}
.bulk-table .input,.bulk-table .select,.bulk-table .smart-select{min-width:0;width:100%}
.bulk-table .bulk-no{color:var(--text-2);text-align:center;padding-top:.7rem}
.bulk-table td.is-bad-cell .smart-select-control,.bulk-table td.is-bad-cell .select{outline:2px solid var(--danger);outline-offset:-1px;border-radius:6px}
.bulk-table .bulk-error-row td{border-top:0;padding-top:0}

/* ---------- قوالب القيود المتكررة ---------- */
.journal-tools{display:grid;grid-template-columns:minmax(220px,1fr) auto;gap:.6rem 1rem;align-items:end;margin:.4rem 0 1rem;padding:.75rem;border:1px dashed var(--border-strong,var(--border));border-radius:10px;background:var(--surface-2)}
.journal-tools .field{margin:0}
.journal-tools-actions{display:flex;flex-wrap:wrap;gap:.4rem}
.journal-template-save{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}
.journal-template-save[hidden]{display:none}
.journal-template-save .input{flex:1 1 240px;min-width:0}
.journal-hint{margin:.4rem 0 0}
@media(max-width:640px){.journal-tools{grid-template-columns:1fr}}

/* قيد اليومية: ناتج العملية الحسابية بجانب «مدين/دائن» وتمييز الموازنة التلقائية */
.journal-amount-label{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-height:26px; }
.amount-chip{
  display:inline-flex; align-items:center; gap:6px; padding:2px 10px 2px 11px;
  border-radius:999px; border:1px solid var(--ok-border); background:var(--ok-bg); color:var(--ok);
  font-size:12px; font-weight:700; line-height:1.7; white-space:nowrap; max-width:100%;
  box-shadow:0 1px 0 rgba(0,0,0,.03); animation:amountChipIn .22s ease-out;
}
.amount-chip[hidden]{ display:none; }
.amount-chip bdi{ direction:ltr; unicode-bidi:isolate; font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-weight:600; letter-spacing:.2px; overflow:hidden; text-overflow:ellipsis; max-width:220px; }
.amount-chip .amount-chip-eq{ opacity:.65; font-weight:600; }
.amount-chip strong{ font-variant-numeric:tabular-nums; font-size:12.5px; }
.amount-chip::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.8; flex:0 0 6px; }
.amount-chip.is-auto{ border-color:transparent; background:var(--brand-soft); color:var(--brand-text); font-weight:600; }
.amount-chip.is-error{ border-color:var(--danger-border); background:var(--danger-bg); color:var(--danger); }
.journal-entry-row .input.has-formula{ border-color:var(--ok-border); box-shadow:inset 3px 0 0 var(--ok); }
html[dir="rtl"] .journal-entry-row .input.has-formula{ box-shadow:inset -3px 0 0 var(--ok); }
.journal-entry-row .input.is-auto-updated{ animation:amountAutoFlash .9s ease-out; }
@keyframes amountChipIn{ from{ opacity:0; transform:translateY(-3px) scale(.96); } to{ opacity:1; transform:none; } }
@keyframes amountAutoFlash{ 0%{ background:var(--brand-soft); box-shadow:0 0 0 3px var(--brand-soft); } 100%{ box-shadow:0 0 0 0 transparent; } }
@media(prefers-reduced-motion:reduce){ .amount-chip, .journal-entry-row .input.is-auto-updated{ animation:none; } }

/* ---------- مساعد الوصفات ومعاينة أمر التصنيع ---------- */
.bom-assist-panel{display:flex;flex-wrap:wrap;gap:.6rem 1rem;align-items:end;padding:.75rem 1rem;border-bottom:1px solid var(--border);background:var(--surface-2)}
.bom-assist-panel[hidden]{display:none}
.bom-assist-panel .field{flex:1 1 260px;margin:0}
.bom-assist-panel .paste-text{flex-basis:100%}
.bom-lines .bom-no{color:var(--text-2);text-align:center}
.order-preview-note{padding:.6rem 1rem;margin:0}

/* ---------------------------------------------------------------
   اشتراك النظام (لوحة ITQAN): شريط التنبيه أسفل الشاشة وصفحة القفل
   --------------------------------------------------------------- */
.app.has-license-bar{ --license-bar-h: 40px; }
.license-bar{
  position:fixed; z-index:73; inset-inline:0; bottom:var(--session-bar-h);
  min-height:var(--license-bar-h, 40px); padding:6px 14px;
  display:flex; align-items:center; gap:6px 14px; flex-wrap:wrap;
  background:#b91c1c; color:#fff; font-size:13px; font-weight:700; line-height:1.5;
  box-shadow:0 -2px 10px rgba(0,0,0,.18);
}
.license-bar.no-statusbar{ bottom:0; }
.license-bar .ico{ width:17px; height:17px; flex:0 0 auto; }
.license-bar .license-days{ font-size:16px; font-variant-numeric:tabular-nums; }
.license-bar .license-over{ background:rgba(255,255,255,.16); border-radius:999px; padding:1px 10px; }
.license-bar .license-contact{ margin-inline-start:auto; font-weight:600; }
.license-bar a{ color:#fff; text-decoration:underline; }
@media (max-width:640px){
  .app.has-license-bar{ --license-bar-h: 58px; }
  .license-bar{ font-size:12px; padding:5px 10px; gap:2px 8px; }
  .license-bar .license-date,.license-bar .license-support-name{ display:none; }
  .license-bar .license-contact{ margin-inline-start:0; }
}
.license-lock{ min-height:100vh; display:grid; place-items:center; padding:24px 16px; }
.license-lock-card{
  width:min(560px,100%); background:var(--surface); border:1px solid var(--border); border-top:5px solid #b91c1c;
  border-radius:22px; padding:30px 26px; text-align:center; box-shadow:var(--shadow-lg, 0 18px 50px rgba(0,0,0,.12));
}
.license-lock-icon{ width:72px; height:72px; margin:0 auto 10px; display:grid; place-items:center; border-radius:50%; background:#fee2e2; color:#b91c1c; }
.license-lock-icon .ico{ width:34px; height:34px; }
.license-lock h1{ margin:6px 0 8px; font-size:24px; }
.license-lock-message{ color:var(--danger); font-weight:700; margin:0 0 14px; }
.license-lock-meta{ display:grid; gap:6px; margin:0 auto 14px; max-width:360px; text-align:start; }
.license-lock-meta > div{ display:flex; justify-content:space-between; gap:10px; padding:7px 12px; border-radius:10px; background:var(--surface-2); }
.license-lock-meta span{ color:var(--text-muted); }
.license-lock-help{ color:var(--text-2); line-height:1.9; margin:0 0 16px; }
.license-lock-actions{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
.license-lock-actions form{ margin:0; }
@media (min-width: 992px){
  .license-bar{ inset-inline-start:var(--sidebar-w); }
  html.sidebar-collapsed .license-bar{ inset-inline-start:var(--sidebar-collapsed-w); }
}

/* ---------------------------------------------------------------
   الزكاة: ملخص الوعاء وأقسامه
   --------------------------------------------------------------- */
.zk-summary{ display:grid; gap:10px; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); }
.zk-tile{ display:flex; flex-direction:column; gap:4px; padding:12px 14px; border-radius:var(--radius); background:var(--surface); border:1px solid var(--border); }
.zk-tile span{ color:var(--text-muted); font-size:12.5px; font-weight:700; }
.zk-tile strong{ font-size:19px; font-variant-numeric:tabular-nums; }
.zk-tile.zk-minus strong{ color:var(--danger); }
.zk-tile.zk-base{ background:var(--brand-soft); border-color:var(--brand); }
.zk-tile.zk-base strong{ color:var(--brand-text); }
.zk-tile.zk-due{ background:var(--ok-bg); border-color:var(--ok); }
.zk-tile.zk-due strong{ color:var(--ok); font-size:22px; }
.zk-tile small{ font-size:12px; font-weight:600; }
.zk-sections{ display:grid; gap:12px; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); align-items:start; }
.zk-section .card-head{ align-items:flex-start; }
.zk-section-total{ font-size:16px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.zk-section.zk-asset{ border-top:3px solid var(--ok); }
.zk-section.zk-liability{ border-top:3px solid var(--danger); }
.zk-section.zk-liability .zk-section-total{ color:var(--danger); }
.zk-section.zk-info{ border-top:3px solid var(--border-strong, var(--border)); opacity:.92; }
.zk-lines td{ padding:8px 12px; vertical-align:top; }
.zk-lines td .muted{ margin-inline-start:6px; }
.zk-more summary{ cursor:pointer; font-weight:700; color:var(--brand-text); }
.zk-assets{ display:grid; grid-template-columns:minmax(0,1fr) 170px; gap:6px 12px; align-items:center; max-width:640px; }
.zk-post-box{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.zk-post-box form{ margin:0; }
@media (max-width:640px){ .zk-assets{ grid-template-columns:1fr; } .zk-sections{ grid-template-columns:1fr; } }

/* كشكول النواقص */
.shortage-table tr.sh-urgent td{ background:var(--danger-bg); }
.shortage-table tr.sh-locked td{ opacity:.78; }
.shortage-table .sh-qty{ max-width:110px; margin-inline:auto; }
.shortage-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.shortage-actions .input{ min-width:220px; }
.modal.modal-lg{ width:min(980px, calc(100vw - 24px)); max-width:none; }

/* =====================================================================
   سير العمل: ابدأ بـ ← إذا أردت ← يلزم إضافة ← كل إضافة تحتوي على ← بعد ذلك
   ===================================================================== */
.wf-tabs{display:flex;gap:6px;overflow-x:auto;padding:10px 14px;border-bottom:1px solid var(--border);scrollbar-width:thin}
.wf-tab{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;white-space:nowrap;padding:6px 12px;border:1px solid var(--border);border-radius:999px;background:var(--surface);color:var(--text);font:inherit;font-size:13px;cursor:pointer}
.wf-tab:hover{border-color:var(--brand)}
.wf-tab.is-active{background:var(--brand);border-color:var(--brand);color:#fff}
.wf-panel{padding:14px}
.wf-guide-head{display:flex;align-items:center;gap:6px;margin-bottom:6px;font-size:15px}
.wf-summary{margin:0 0 10px;color:var(--text-muted)}
.wf-steps{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.wf-step{display:grid;grid-template-columns:32px minmax(0,1fr);gap:10px;align-items:start;padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface)}
.wf-num{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--brand-soft);color:var(--brand-text);font-weight:800}
.wf-step.is-first .wf-num{background:var(--brand);color:#fff}
.wf-content{min-width:0}
.wf-title{line-height:1.6}
.wf-kind{display:inline-block;padding:1px 9px;margin-inline-end:4px;border-radius:999px;font-size:12px;font-weight:700;background:var(--info-bg);color:var(--info)}
.wf-step.is-first .wf-kind{background:var(--brand-soft);color:var(--brand-text)}
.wf-step.is-require .wf-kind{background:var(--warn-bg);color:var(--warn)}
.wf-step.is-fields .wf-kind{background:var(--ok-bg);color:var(--ok)}
.wf-step.is-then .wf-kind{background:var(--bg);color:var(--text-muted)}
.wf-text{margin:4px 0 0;line-height:1.75}
.wf-links{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.wf-options{margin:6px 0 0;padding-inline-start:20px;display:grid;gap:6px}
.wf-options small{display:block;line-height:1.5}
.wf-fields{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:6px 14px;margin:8px 0 0}
.wf-fields dt{font-weight:700}
.wf-fields dd{margin:0;color:var(--text-muted);line-height:1.6}
.wf-note{margin-top:6px;font-size:12px;color:var(--text-muted)}
.wf-guide [hidden]{display:none!important}
@media(max-width:700px){.wf-fields{grid-template-columns:1fr}.wf-fields dd{margin-bottom:4px}.wf-step{grid-template-columns:26px minmax(0,1fr);padding:10px}.wf-num{width:26px;height:26px}}
/* أدلة الوحدات في خريطة النظام */
.ig-wf-index{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}
.ig-wf-list{display:grid;gap:10px}
.ig-wf{padding:0;overflow:hidden}
.ig-wf>summary{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px;padding:12px 14px;cursor:pointer;list-style:none}
.ig-wf>summary::-webkit-details-marker{display:none}
.ig-wf>summary::after{content:'+';font-weight:800;color:var(--brand)}
.ig-wf[open]>summary::after{content:'−'}
.ig-wf[open]>summary{border-bottom:1px solid var(--border)}
.ig-wf-title{display:inline-flex;align-items:center;gap:6px;font-size:15px}
.ig-wf-body{padding:12px 14px}
@media print{.ig-wf{break-inside:auto}.ig-wf>summary::after{content:''}}
/* تجهيز النظام لأول مرة */
.install-wrap{max-width:520px}

/* تفاصيل الحركة وأثرها */
.notif-detail{font-weight:600}
.trace-body{white-space:normal;line-height:1.8;padding:10px 12px;border-radius:var(--radius);background:var(--surface-2)}
.trace-meta{display:flex;flex-wrap:wrap;gap:8px 18px;color:var(--text-2);font-size:13.5px;margin-bottom:12px}
.trace-meta>span{display:inline-flex;align-items:center;gap:5px}
.trace-h{font-size:14px;font-weight:700;margin:6px 0 8px}
.trace-table tr.is-changed td{background:var(--warn-bg)}
.trace-table .trace-before{color:var(--text-2)}
.trace-table .trace-after{font-weight:600}
.trace-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.trace-nav>div{padding:10px 12px;border:1px dashed var(--border-strong);border-radius:var(--radius)}
.trace-event{border:1px solid var(--border);border-radius:var(--radius);margin-bottom:8px;background:var(--surface)}
.trace-event>summary{cursor:pointer;padding:9px 12px;display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.trace-event-body{padding:0 12px 12px}
@media(max-width:700px){.trace-nav{grid-template-columns:1fr}}
