/* ═════════════════════════════════════════════ مخازن الشرقية — نظام التصميم */
:root {
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 10px; --r: 14px; --r-lg: 18px;
  --side-w: 268px; --top-h: 64px; --bn-h: 66px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4f6; --surface: #ffffff; --surface-2: #f6f7f9; --surface-3: #eef0f3; --line: #e4e6ea; --line-2: #d6d9df;
  --fg: #12141a; --fg-2: #3a3f4a; --muted: #6b7280;
  --brand: #a8791f; --brand-2: #c99a3c; --brand-soft: #f6eedc; --brand-fg: #ffffff;
  --side-bg: #111216; --side-fg: #ecebe6; --side-muted: #8d8b84; --side-line: #24252b; --side-hover: #1b1c21;
  --good: #15803d; --bad: #dc2626; --amber: #c2700a; --blue: #2563eb; --violet: #7c3aed; --teal: #0f8f83; --info: #2563eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0e11; --surface: #15161a; --surface-2: #1b1d22; --surface-3: #22242a; --line: #272930; --line-2: #343740;
  --fg: #f1efe9; --fg-2: #cfccc4; --muted: #96938b;
  --brand: #d8b25e; --brand-2: #e7c77f; --brand-soft: #2a2416; --brand-fg: #1a1405;
  --side-bg: #0a0b0d; --side-fg: #ecebe6; --side-muted: #85837c; --side-line: #1c1d22; --side-hover: #16171b;
  --good: #34c06a; --bad: #ff5d5d; --amber: #f2a531; --blue: #5b93ff; --violet: #a78bfa; --teal: #2dd4bf; --info: #5b93ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
/* أكواد/مراجع لاتينية داخل كتلة عربية: تبقى محاذاتها يمينًا (في الواجهات RTL فقط) */
[dir="rtl"] :is(small, b, div, p)[dir="ltr"] { text-align: right; }
.ic.flip { transform: scaleX(-1); }
bdi { unicode-bidi: isolate; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.55; }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; }
p { margin: 0 0 8px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .55; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.xl { width: 44px; height: 44px; }

/* ── ألوان الدلالة ── */
.t-good { --tone: var(--good); } .t-bad { --tone: var(--bad); } .t-amber, .t-warn { --tone: var(--amber); }
.t-blue, .t-info { --tone: var(--blue); } .t-violet { --tone: var(--violet); } .t-teal { --tone: var(--teal); }
.t-gold, .t-brand { --tone: var(--brand); } .t-neutral { --tone: var(--muted); }
:is(span, b, small, td, p, i, div, strong, svg).t-good { color: var(--good); }
:is(span, b, small, td, p, i, div, strong, svg).t-bad { color: var(--bad); }
:is(span, b, small, td, p, i, div, strong, svg).t-amber { color: var(--amber); }
:is(span, b, small, svg).t-brand { color: var(--brand); }

/* ── أدوات ── */
.muted { color: var(--muted); } .xs { font-size: 12px; } .sm { font-size: 13px; } .center { text-align: center; } .right { text-align: end; }
.block { display: block; } .grow { flex: 1; min-width: 0; } .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; } .center-x { justify-content: center; }
.req { color: var(--bad); } .link { color: var(--brand); font-weight: 600; font-size: 13px; }
.qty { font-variant-numeric: tabular-nums; }
.only-m { display: none; }
.lead { font-size: 16px; }

/* ── أزرار ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--fg); font-weight: 600; font-size: 14px; border: 1px solid transparent; transition: background .15s, transform .1s, box-shadow .15s; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--line); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.primary { background: var(--brand); color: var(--brand-fg); box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 2px 6px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn.primary:hover:not(:disabled) { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.warn { background: var(--amber); color: #fff; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 16px; }
.btn.block { width: 100%; }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; margin: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--r-sm); display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--fg-2); flex: none; transition: background .15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.ghost { background: transparent; border-color: transparent; }
.icon-btn.dark { background: rgba(0, 0, 0, .55); border-color: rgba(255, 255, 255, .15); color: #fff; }

/* ── حقول ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--fg-2); font-weight: 600; }
.field > small { font-weight: 400; }
.input { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--fg);
  font: inherit; font-size: 15px; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.input.dark { background: rgba(0, 0, 0, .55); border-color: rgba(255, 255, 255, .2); color: #fff; }
textarea.input { resize: vertical; min-height: 64px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: left 16px top 55%, left 11px top 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-start: 12px; padding-inline-end: 34px; }
[dir="ltr"] select.input { background-position: right 11px top 55%, right 16px top 55%; }
.input.pick { text-align: start; cursor: pointer; }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 48px; }
.in-input { position: absolute; inset-inline-end: 2px; top: 2px; }
.input-affix { display: flex; align-items: stretch; }
.input-affix .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-affix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line-2); border-inline-start: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 400; }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 14px; }
.form-err { color: var(--bad); min-height: 20px; font-size: 13px; margin: 0 0 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--fg-2); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span, .switch input + span { position: relative; width: 42px; height: 24px; border-radius: 99px; background: var(--line-2); transition: background .2s; flex: none; }
.switch input + span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(-18px); }
[dir="ltr"] .switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .6; }

/* ── بطاقات ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.flush { padding: 4px 0; }
.card.narrow { max-width: 440px; margin: 0 auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.card-head h3 .ic { color: var(--brand); }
.sec { font-size: 13px; color: var(--muted); font-weight: 600; margin: 20px 4px 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
.grid-2 .span-2 { grid-column: 1 / -1; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 1.6;
  color: var(--tone, var(--muted)); background: color-mix(in srgb, var(--tone, var(--muted)) 13%, transparent); white-space: nowrap; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-style: normal; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center; background: var(--brand); color: var(--brand-fg); }
.count:empty { display: none; }
.count.bad { background: var(--bad); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-fg); }
.brand-mark { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-fg);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 40%, transparent); }
.brand-mark .ic { width: 30px; height: 30px; }
.brand-mark.sm { width: 40px; height: 40px; border-radius: 12px; }
.brand-mark.sm .ic { width: 22px; height: 22px; }

/* ── تحميل/فارغ ── */
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.skel-list { display: flex; flex-direction: column; gap: 10px; }
.skel { height: 64px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 36px 12px; }
.empty .ic { width: 40px; height: 40px; opacity: .45; margin-bottom: 4px; }
.empty b { color: var(--fg-2); font-size: 15px; }
.empty span { font-size: 13px; }
.empty.sm { padding: 18px 10px; flex-direction: row; justify-content: center; }
.empty.sm .ic { width: 22px; height: 22px; margin: 0; }
.center-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.center-page .card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; }

/* ═════════════════════════════════════════════ شاشة التحميل */
.boot-in { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: rise .5s var(--ease) both; }
.boot-in b { font-size: 20px; margin-top: 14px; }
.boot-in small { color: var(--muted); font-size: 13px; }
.boot-bar { width: 140px; height: 3px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 14px; }
.boot-bar i { display: block; width: 40%; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); animation: bootbar 1.1s ease-in-out infinite; }
@keyframes bootbar { 0% { transform: translateX(160%); } 100% { transform: translateX(-260%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.brand-mark.lg { width: 64px; height: 64px; border-radius: 18px; }
.brand-mark.lg .ic { width: 34px; height: 34px; }
.brand-mark.xl { width: 84px; height: 84px; border-radius: 24px; }
.brand-mark.xl .ic { width: 44px; height: 44px; }
/* شعار «شرقية»: دائرة سوداء، الشعار الأصفر يملؤها */
.brand-mark.logo { background: #000; border-radius: 50%; padding: 0; overflow: visible;
  box-shadow: 0 0 0 1px rgba(255, 221, 0, .22), 0 8px 22px rgba(0, 0, 0, .35); }
.brand-mark.logo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.brand-mark.logo.glow::after { border-color: rgba(255, 221, 0, .5); border-radius: 50%; }
.brand-mark.glow { position: relative; }
.brand-mark.glow::after { content: ""; position: absolute; inset: -10px; border-radius: inherit; border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent);
  animation: halo 2.6s ease-out infinite; }
@keyframes halo { 0% { opacity: .9; transform: scale(.92); } 100% { opacity: 0; transform: scale(1.25); } }

/* ═════════════════════════════════════════════ الدخول */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
/* الزخرفة: نجمة ثمانية ذهبية خافتة */
.art-pattern { position: absolute; inset: 0; pointer-events: none; opacity: .9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23d8b25e' stroke-opacity='.13' stroke-width='1'%3E%3Cpath d='M44 10 53 35 78 44 53 53 44 78 35 53 10 44 35 35Z'/%3E%3Crect x='26' y='26' width='36' height='36' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='7'/%3E%3Cpath d='M0 0 10 10M88 0 78 10M0 88 10 78M88 88 78 78'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 88px 88px; -webkit-mask-image: radial-gradient(120% 90% at 70% 40%, #000 30%, transparent 85%); mask-image: radial-gradient(120% 90% at 70% 40%, #000 30%, transparent 85%); }
.login-art { position: relative; overflow: hidden; background: linear-gradient(160deg, #17181c 0%, #0c0d10 60%, #121008 100%); color: #f1efe9;
  padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.art-glow { position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; }
.art-glow.g1 { width: 460px; height: 460px; inset-inline-end: -120px; top: -140px; background: rgba(216, 178, 94, .22); }
.art-glow.g2 { width: 380px; height: 380px; inset-inline-start: -140px; bottom: -160px; background: rgba(168, 121, 31, .18); }
.login-art > :not(.art-pattern):not(.art-glow) { position: relative; z-index: 1; }
.art-top { display: flex; align-items: center; gap: 14px; animation: rise .6s var(--ease) both; }
.art-top b { display: block; font-size: 17px; } .art-top small { color: #a9a59b; font-size: 13px; }
.art-main { animation: rise .7s .08s var(--ease) both; }
.art-main h1 { font-size: clamp(44px, 5vw, 68px); line-height: 1.05; font-weight: 700; letter-spacing: -.5px; }
.art-main h1 span { background: linear-gradient(90deg, #f3d68e, #c99a3c 60%, #a8791f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.art-main p { color: #b9b5ab; font-size: 17px; max-width: 520px; margin: 18px 0 0; line-height: 1.8; }
.art-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 34px; max-width: 600px; }
.feat { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(6px); transition: border-color .2s, transform .2s var(--ease); }
.feat:hover { border-color: rgba(216, 178, 94, .45); transform: translateY(-2px); }
.feat .ic { width: 24px; height: 24px; color: #d8b25e; margin-bottom: 8px; }
.feat b { font-size: 15px; } .feat small { color: #a09c92; font-size: 12.5px; }
.art-foot { display: flex; align-items: center; gap: 8px; color: #a09c92; font-size: 13px; animation: rise .7s .16s var(--ease) both; }
.art-foot em { font-style: normal; margin-inline-start: auto; opacity: .7; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #34c06a; box-shadow: 0 0 0 0 rgba(52, 192, 106, .6); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(52, 192, 106, .55); } 70% { box-shadow: 0 0 0 9px rgba(52, 192, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 192, 106, 0); } }

.login-side { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px;
  background: radial-gradient(700px 420px at 50% 0%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 70%), var(--bg); }
.login-mhead { display: none; }
.login-card { width: min(420px, 100%); padding: 34px 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 24px 60px -12px rgba(16, 24, 40, .18); animation: rise .6s .05s var(--ease) both; }
.login-head { margin-bottom: 24px; }
.login-head .hello { display: inline-block; font-size: 13px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 4px 12px; border-radius: 99px; }
.login-head h2 { font-size: 28px; margin-top: 12px; }
.login-head p { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 19px; height: 19px; pointer-events: none; transition: color .15s; }
/* الحقول dir=ltr داخل الواجهة: الحشوة فيزيائية حسب اتجاه الصفحة (الأيقونة في البداية، زر العين في النهاية) */
.input-icon .input { min-height: 52px; border-radius: 14px; font-size: 16px; }
[dir="rtl"] .input-icon .input { padding-right: 46px; padding-left: 14px; text-align: right; }
[dir="ltr"] .input-icon .input { padding-left: 46px; padding-right: 14px; text-align: left; }
.input-icon .input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input-icon:focus-within > .ic { color: var(--brand); }
.input-icon .in-input { top: 6px; inset-inline-end: 6px; }
[dir="rtl"] .input-icon:has(.in-input) .input { padding-left: 52px; }
[dir="ltr"] .input-icon:has(.in-input) .input { padding-right: 52px; }
.caps { display: flex; align-items: center; gap: 6px; color: var(--amber); font-size: 12.5px; font-weight: 600; }
.caps .ic { width: 15px; height: 15px; }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--fg-2); cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-2); display: grid; place-items: center; transition: all .15s; }
.check input:checked + span { background: var(--brand); border-color: var(--brand); }
.check input:checked + span::after { content: ""; width: 5px; height: 9px; border: solid var(--brand-fg); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.link-btn { font-size: 13.5px; color: var(--brand); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.form-err { display: flex; align-items: center; gap: 6px; }
.form-err .ic { width: 16px; height: 16px; flex: none; }
.btn.xl { min-height: 56px; font-size: 17px; border-radius: 14px; }
#go .ic { transition: transform .2s var(--ease); }
#go:hover:not(:disabled) .ic { transform: translateX(-4px); }
#go:hover:not(:disabled) .ic.flip { transform: scaleX(-1) translateX(-4px); }
.btn.install { margin-top: 10px; border-style: dashed; color: var(--fg-2); }
.login-copy { margin-top: 22px; font-size: 12px; color: var(--muted); text-align: center; }
.shake { animation: shake .45s; }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
[data-theme="dark"] .login-card { box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .6); }

/* ═════════════════════════════════════════════ الهيكل */
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); background: var(--side-bg); color: var(--side-fg); display: flex; flex-direction: column; z-index: 30; border-inline-end: 1px solid var(--side-line); }
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.sb-brand b { display: block; font-size: 16px; } .sb-brand small { color: var(--side-muted); font-size: 12px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--side-muted); font-weight: 500; font-size: 14px; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--side-hover); color: var(--side-fg); }
.nav-item.active { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--side-fg); }
.nav-item.active .ic { color: var(--brand); }
.nav-item span { flex: 1; }
.nav-item.primary { margin: 6px 0; background: var(--brand); color: var(--brand-fg); font-weight: 700; }
.nav-item.primary:hover { background: var(--brand-2); color: var(--brand-fg); }
.nav-item.primary .ic { color: var(--brand-fg); }
.sb-foot { padding: 10px; border-top: 1px solid var(--side-line); }
.me-chip { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; text-align: start; color: var(--side-fg); }
.me-chip:hover { background: var(--side-hover); }
.me-chip > span:not(.avatar) { flex: 1; min-width: 0; } .me-chip b { display: block; font-size: 14px; } .me-chip small { color: var(--side-muted); font-size: 12px; }
.me-chip .ic { color: var(--side-muted); }

.main { margin-inline-start: var(--side-w); min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.tb-title { flex: 1; min-width: 0; }
.tb-title h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title small:empty { display: none; }
.tb-actions { display: flex; align-items: center; gap: 8px; }
.store-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--fg-2); max-width: 220px; }
.store-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-chip .ic { color: var(--brand); width: 18px; height: 18px; }
.view { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 22px 24px 40px; }

/* ── أدوات الشريط: تثبيت · لغة · فاتح/داكن · المستخدم ── */
.tb-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.tool-btn { height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--surface); color: var(--brand);
  font-weight: 700; font-size: 14px; transition: background .15s, border-color .15s, transform .1s; position: relative; }
.tool-btn:hover { background: var(--brand-soft); border-color: var(--brand); }
.tool-btn:active { transform: scale(.96); }
.tool-btn.sq { width: 40px; padding: 0; }
.tool-btn .ic { width: 19px; height: 19px; }
.lang-short { font-size: 13px; letter-spacing: .2px; }
.install-btn { border-radius: 99px; padding: 0 16px; }
.me-btn b { font-size: 14px; }
.me-btn { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.presence { position: absolute; bottom: -3px; inset-inline-end: -3px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--muted); transition: background .3s; }
[data-online="on"][data-live="on"] .presence { background: #22c55e; }
[data-online="on"]:not([data-live="on"]) .presence { background: var(--amber); }
[data-online="off"] .presence { background: var(--bad); }

/* قائمة اللغات */
.lang-list { display: flex; flex-direction: column; gap: 10px; }
.lang-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); text-align: start; font-size: 16px; transition: border-color .15s, background .15s; }
.lang-item:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.lang-item.on { border-color: var(--brand); background: var(--brand-soft); }
.lang-item b { flex: 1; font-weight: 700; }
.lang-code { min-width: 34px; height: 26px; padding: 0 6px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800;
  color: var(--brand); background: var(--brand-soft); flex: none; }
.lang-code.sm { min-width: 28px; height: 22px; font-size: 11px; }
.lang-check { color: var(--brand); width: 20px; height: 20px; }
.login-tools { position: absolute; top: 18px; inset-inline-end: 20px; z-index: 5; }
.bottom-nav { display: none; }

/* ── الرئيسية ── */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 22px; border-radius: var(--r-lg); margin-bottom: 6px;
  background: radial-gradient(600px 240px at 0% 0%, color-mix(in srgb, var(--brand) 28%, transparent), transparent 70%), var(--side-bg); color: var(--side-fg); }
.hero h2 { font-size: 22px; } .hero p { color: var(--side-muted); margin: 4px 0 0; }
.hero-date { color: var(--side-muted); font-size: 13px; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--fg);
  transition: transform .15s var(--ease), box-shadow .15s; overflow: hidden; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi::after { content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: color-mix(in srgb, var(--tone) 10%, transparent); }
.kpi-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); margin-bottom: 8px; }
.kpi-n { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-l { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi small { font-size: 12px; color: var(--muted); }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 8px; }
.action { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, transform .15s var(--ease); }
.action:hover { border-color: var(--tone); transform: translateY(-1px); }
.action > .ic:first-child { width: 42px; height: 42px; padding: 10px; border-radius: 12px; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.action span { flex: 1; } .action b { display: block; } .action small { color: var(--muted); font-size: 12px; }
.action .end { color: var(--muted); }
.actions-grid.big .action { padding: 20px; }

/* ── صفوف ── */
.rows { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); transition: background .12s; text-align: start; width: 100%; }
.card:not(.flush) .row-item { padding-inline: 2px; }
.rows .row-item:last-child { border-bottom: 0; }
a.row-item:hover, button.row-item:hover { background: var(--surface-2); }
.row-item b { display: block; font-size: 14px; font-weight: 600; }
.row-item small { display: block; font-size: 12px; color: var(--fg-2); }
.row-item small.muted { color: var(--muted); }
.ri-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.ri-ic .ic { width: 18px; height: 18px; }
.ri-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tone); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 15%, transparent); }
.ri-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: end; flex: none; }

/* ── شريط أدوات / بحث / رقائق / تبويب ── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; }
.search > .ic { position: absolute; inset-inline-start: 12px; top: 12px; color: var(--muted); pointer-events: none; }
.search .input { padding-inline-start: 42px; }
.pop { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 25; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: 360px; overflow-y: auto; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); }
.pop-item:hover { background: var(--surface-2); }
.pop-item b { display: block; font-weight: 600; font-size: 14px; } .pop-item small { display: block; font-size: 12px; color: var(--muted); }
.pop-qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.pop-empty { padding: 16px; text-align: center; color: var(--muted); }
.pop .spinner { display: block; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--fg-2); transition: all .15s; }
.chip .ic { width: 16px; height: 16px; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; margin-bottom: 14px; overflow-x: auto; }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab .ic { width: 18px; height: 18px; }
.tab.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); margin: 0 4px 10px; }
.stat-row span { display: inline-flex; align-items: center; gap: 6px; }
.stat-row .ic { width: 16px; height: 16px; color: var(--brand); }

.note-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); margin-bottom: 14px; font-size: 14px;
  background: color-mix(in srgb, var(--tone, var(--muted)) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone, var(--muted)) 25%, transparent); color: var(--fg); }
.note-bar > .ic { color: var(--tone, var(--muted)); }
.note-bar .spinner { width: 18px; height: 18px; border-width: 2px; margin: 0; }
.note-bar.xs { font-size: 12.5px; margin: 6px 0 0; }
.link-bar:hover { filter: brightness(1.04); }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; }
.sum-box { border: 1px solid var(--line); border-radius: var(--r); padding: 4px 12px; margin: 10px 0; background: var(--surface-2); }
.sum-box > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.sum-box > div:last-child { border-bottom: 0; }
.sum-box.warn { border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: color-mix(in srgb, var(--amber) 7%, var(--surface)); }
.sum-box.warn > b { display: flex; align-items: center; gap: 6px; padding: 8px 0 2px; color: var(--amber); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv span { color: var(--muted); }

/* ── جدول ── */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }

/* ═════════════════════════════════════════════ المهام */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.tcard { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, transform .15s var(--ease); }
.tcard:hover { border-color: var(--brand); transform: translateY(-1px); }
.tc-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.tc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tc-main b { font-size: 15px; }
.tc-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tc-tags:empty { display: none; }
.tc-end { display: flex; flex-direction: column; align-items: center; flex: none; min-width: 52px; }
.tc-end b { font-size: 20px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tc-end small { font-size: 11px; color: var(--muted); }
.head-card { padding: 18px; }
.hc-top { display: flex; align-items: center; gap: 12px; }
.hc-top h2 { font-size: 18px; }
.hc-route { color: var(--fg-2); font-size: 13.5px; margin-top: 2px; }
.hc-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.hc-meta span { display: flex; flex-direction: column; }
.hc-meta small { font-size: 11.5px; color: var(--muted); }
.hc-meta b { font-size: 14px; font-weight: 600; }

.rt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.rt { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface-2); text-align: start; transition: all .15s; }
.rt .ic { color: var(--violet); width: 22px; height: 22px; }
.rt b { font-size: 14px; } .rt small { font-size: 11.5px; color: var(--muted); }
.rt:hover { border-color: var(--violet); }
.rt.on { border-color: var(--violet); background: color-mix(in srgb, var(--violet) 10%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 15%, transparent); }

.qc-head, .cnt-head, .stock-head { display: grid; gap: 12px; padding: 0 10px 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.qc-head { grid-template-columns: 1fr 90px 150px 150px 78px; }
.cnt-head { grid-template-columns: 1fr 100px 160px 90px; }
.lines { display: flex; flex-direction: column; }
.line { display: grid; grid-template-columns: 1fr 90px 150px 150px 78px; gap: 6px 12px; align-items: center; padding: 12px 10px; border-bottom: 1px solid var(--line); border-radius: 10px; transition: background .2s; position: relative; }
.line.cnt { grid-template-columns: 1fr 100px 160px 90px; }
.line.doc { grid-template-columns: 1fr auto 40px; }
.line:last-child { border-bottom: 0; }
.line.ok { background: color-mix(in srgb, var(--good) 6%, transparent); }
.line.short { background: color-mix(in srgb, var(--amber) 7%, transparent); }
.line.over { background: color-mix(in srgb, var(--blue) 6%, transparent); }
.line.over-stock { background: color-mix(in srgb, var(--bad) 6%, transparent); }
.line.pulse { animation: pulse .5s; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.ln-prod { min-width: 0; }
.ln-prod b { display: block; font-size: 14px; font-weight: 600; }
.ln-prod small { display: block; font-size: 12px; color: var(--muted); }
.ln-dem { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.ln-dem b { font-size: 16px; } .ln-dem small { font-size: 11px; color: var(--muted); }
.ln-st { display: flex; align-items: center; gap: 6px; }
.ln-flag { font-size: 12px; font-weight: 700; text-align: center; }
.line.ok .ln-flag { color: var(--good); } .line.short .ln-flag { color: var(--amber); } .line.over .ln-flag { color: var(--blue); }
.reason { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reason[hidden] { display: none; }
.reason .input[hidden] { display: none; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); overflow: hidden; height: 42px; }
.stepper input { width: 64px; height: 100%; border: 0; text-align: center; font: inherit; font-size: 16px; font-weight: 700; background: transparent; color: var(--fg); font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--surface-2); }
.st-btn { width: 40px; height: 100%; display: grid; place-items: center; color: var(--fg-2); background: var(--surface-2); touch-action: manipulation; user-select: none; }
.st-btn:active { background: var(--line); }
.st-btn .ic { width: 18px; height: 18px; }
.stepper.good input { color: var(--good); } .stepper.bad input { color: var(--bad); }

.photos { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ph { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; border: 1px solid var(--line); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .spinner { width: 22px; height: 22px; margin: 0; }
.ph-x { position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: #fff; }
.ph-x .ic { width: 14px; height: 14px; }

.sticky-foot { position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 10px; margin: 8px -24px -40px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.sf-sum { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; font-variant-numeric: tabular-nums; }
.sf-sum span { display: inline-flex; align-items: center; gap: 4px; }
.sf-sum .ic { width: 16px; height: 16px; }
.bo { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.bo input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ── الجرد ── */
.stock-head { grid-template-columns: 1fr 100px 100px 130px; padding: 10px 14px; }
.stock-row { display: grid !important; grid-template-columns: 1fr 100px 100px 130px; }
.sr-n { font-variant-numeric: tabular-nums; font-weight: 600; }
.prod-head { display: flex; flex-direction: column; margin-bottom: 8px; }
.prod-head b { font-size: 16px; } .prod-head small { color: var(--fg-2); font-size: 12.5px; }

/* ── التقارير ── */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 10px; font-size: 13px; }
.br-l { display: flex; align-items: center; gap: 6px; color: var(--fg-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.br-l .ic { width: 16px; height: 16px; color: var(--muted); }
.br-n { text-align: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar, .stack { display: flex; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--tone); border-radius: 99px; }
.stack i { display: block; height: 100%; }
.stack i.t-good, .legend i.t-good { background: var(--good); } .stack i.t-bad, .legend i.t-bad { background: var(--bad); }
.legend { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.t-in, .stackv i.t-in { background: var(--blue); } .legend i.t-out, .stackv i.t-out { background: var(--brand); }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 6px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.col small { font-size: 10px; color: var(--muted); }
.stackv { flex: 1; width: 100%; max-width: 26px; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.stackv i { display: block; width: 100%; }

/* ── الموظفون ── */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.staff-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s; }
.staff-card:hover { border-color: var(--brand); }
.staff-card.off { opacity: .6; }
.sc-top { display: flex; align-items: center; gap: 10px; }
.sc-top b { display: block; } .sc-top small { color: var(--muted); font-size: 12.5px; }
.sc-stores { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-2); }
.sc-stores .ic { width: 16px; height: 16px; color: var(--muted); }
.sc-perms { display: flex; flex-wrap: wrap; gap: 5px; }
.mini { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--fg-2); }
.sc-off { display: flex; align-items: center; gap: 6px; color: var(--bad); font-size: 13px; font-weight: 600; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 8px; }
.role { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface-2); }
.role .ic { width: 24px; height: 24px; color: var(--muted); }
.role.on { border-color: var(--brand); background: var(--brand-soft); }
.role.on .ic { color: var(--brand); }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.perm { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.perm b { display: block; font-size: 14px; } .perm small { font-size: 12px; color: var(--muted); }
.perm.dis { opacity: .7; cursor: default; }

/* ═════════════════════════════════════════════ النوافذ */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(8, 9, 12, 0); display: flex; align-items: center; justify-content: center; padding: 20px; transition: background .2s; }
.sheet-wrap.in { background: rgba(8, 9, 12, .5); }
.sheet { width: min(480px, 100%); max-height: min(86dvh, 760px); display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.98); opacity: 0; transition: transform .22s var(--ease), opacity .18s; }
.sheet.wide { width: min(760px, 100%); }
.sheet-wrap.in .sheet { transform: none; opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding-block: 14px 10px; padding-inline: 16px 10px; border-bottom: 1px solid var(--line); }
.sheet-head b { font-size: 16px; padding-inline-start: 6px; }
.sheet-body { padding: 16px; overflow-y: auto; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.list { display: flex; flex-direction: column; gap: 2px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; text-align: start; width: 100%; font-size: 15px; }
.list-item:hover { background: var(--surface-2); }
.list-item.on { background: var(--brand-soft); }
.list-item > .ic:first-child { color: var(--muted); }
.list-item.danger { color: var(--bad); } .list-item.danger .ic { color: var(--bad); }
.list-item b { display: block; font-weight: 600; } .list-item small { display: block; color: var(--muted); font-size: 12px; }
.me-card { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.me-card .avatar { width: 52px; height: 52px; font-size: 17px; }
.me-card b { display: block; font-size: 17px; } .me-card span { display: block; font-size: 13px; }

/* ── الماسح ── */
.scanner { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scan-frame i { width: min(78vw, 420px); height: min(42vw, 220px); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); border: 2px solid var(--brand); position: relative; }
.scan-frame i::after { content: ""; position: absolute; inset-inline: 10%; top: 50%; height: 2px; background: var(--brand); box-shadow: 0 0 12px var(--brand); animation: scanline 1.8s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-60px); } 50% { transform: translateY(60px); } }
.scanner.flash .scan-frame i { border-color: var(--good); }
.scan-top { position: absolute; top: 0; inset-inline: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 16px 14px; background: linear-gradient(rgba(0, 0, 0, .6), transparent); }
.scan-count { min-width: 40px; text-align: end; font-weight: 700; color: var(--good); }
.scan-bottom { position: absolute; bottom: 0; inset-inline: 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .75)); display: flex; flex-direction: column; gap: 10px; }
.scan-hint { text-align: center; font-size: 14px; color: rgba(255, 255, 255, .85); }

/* ── إشعار ── */
.toast { position: fixed; inset-inline: 0; bottom: 24px; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); z-index: 90; padding: 11px 18px; border-radius: 12px;
  background: #15161a; color: #f2f0ea; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); transform: translateY(20px); opacity: 0; pointer-events: none; transition: transform .25s var(--ease), opacity .2s; }
.toast.show { transform: none; opacity: 1; }
.toast.good { background: var(--good); color: #fff; } .toast.bad { background: var(--bad); color: #fff; }

/* ═════════════════════════════════════════════ الجوال */
@media (max-width: 1023px) {
  :root { --top-h: 58px; }
  .sidebar { display: none; }
  .main { margin: 0; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
  .tb-title h1 { font-size: 17px; }
  .store-chip { max-width: 130px; padding: 0 10px; height: 34px; }
  .view { padding: 14px 14px calc(var(--bn-h) + 24px + env(safe-area-inset-bottom)); }
  body.is-sub .view { padding-bottom: 24px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 40; height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  body.is-sub .bottom-nav { display: none; }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; }
  .bn-item .ic { width: 22px; height: 22px; }
  .bn-item.active { color: var(--brand); }
  .bn-item .count { position: absolute; top: 6px; inset-inline-start: calc(50% + 4px); height: 18px; min-width: 18px; font-size: 10px; padding: 0 5px; }
  .bn-fab { flex: none; width: 56px; }
  .bn-fab .ic { width: 26px; height: 26px; padding: 0; }
  .bn-fab::before { content: ""; position: absolute; width: 50px; height: 50px; border-radius: 16px; background: var(--brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 45%, transparent); z-index: -1; }
  .bn-fab { color: var(--brand-fg) !important; z-index: 0; }
  .only-m { display: initial; }
  .hide-m { display: none !important; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 18px; } .hero h2 { font-size: 19px; } .hero-date { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 14px; } .kpi-n { font-size: 24px; }
  .actions-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .actions-grid .action { flex-direction: column; align-items: flex-start; }
  .actions-grid.big { grid-template-columns: 1fr; }
  .actions-grid.big .action { flex-direction: row; align-items: center; }
  .cards { grid-template-columns: 1fr; }
  .card { padding: 14px; border-radius: 16px; }
  .rt-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rt { flex-direction: row; align-items: center; gap: 8px; padding: 10px; }
  .rt small { display: none; }
  .rt b { font-size: 13px; line-height: 1.35; }
  .line, .line.cnt { grid-template-columns: 1fr auto; padding: 12px 6px; }
  .line .ln-prod { grid-column: 1 / -1; }
  .line .ln-dem { grid-column: 1 / -1; }
  .line .ln-st { flex-direction: column; align-items: flex-start; gap: 2px; }
  .line .ln-st small { font-size: 11px; color: var(--muted); }
  .line:not(.cnt):not(.doc) { grid-template-columns: 1fr 1fr; }
  .line .ln-flag { position: absolute; top: 12px; inset-inline-end: 8px; }
  .line.doc { grid-template-columns: 1fr auto; }
  .line.doc .ln-prod { grid-column: auto; }
  .line.doc .ln-st { flex-direction: row; align-items: center; }
  .stepper { height: 46px; } .stepper input { width: 58px; } .st-btn { width: 42px; }
  .reason { grid-template-columns: 1fr; }
  .sticky-foot { margin: 8px -14px -24px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .sticky-foot .btn.lg { flex: 1; }
  .sf-sum { flex-basis: 100%; font-size: 13px; }
  .stock-row { grid-template-columns: 1fr 1fr 1fr !important; gap: 4px 10px; }
  .stock-row .grow { grid-column: 1 / -1; }
  .sr-n small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
  .bar-row { grid-template-columns: 110px 1fr 70px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-side { justify-content: flex-start; padding: 0 0 24px; background: var(--bg); }
  .login-mhead { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%;
    padding: calc(42px + env(safe-area-inset-top)) 20px 78px; color: #f1efe9; text-align: center;
    background: radial-gradient(380px 220px at 80% 0%, rgba(216, 178, 94, .3), transparent 70%), linear-gradient(165deg, #17181c, #0c0d10 70%, #141008); }
  .login-mhead > :not(.art-pattern) { position: relative; z-index: 1; }
  .login-mhead b { font-size: 26px; margin-top: 14px; }
  .login-mhead small { color: #a9a59b; font-size: 13px; }
  .login-card { width: calc(100% - 28px); margin-top: -54px; padding: 26px 20px 22px; border-radius: 22px; position: relative; z-index: 2; }
  .login-tools { top: calc(12px + env(safe-area-inset-top)); inset-inline-end: 12px; }
  .login-tools .tool-btn { background: rgba(255, 255, 255, .06); border-color: rgba(216, 178, 94, .45); color: #e7c77f; height: 36px; }
  .login-tools .tool-btn.sq { width: 36px; }
  .tb-tools { gap: 6px; }
  .tb-tools .tool-btn { height: 36px; }
  .tb-tools .tool-btn.sq { width: 36px; }
  .install-btn span { display: none; }
  .install-btn { width: 36px; padding: 0; }
  .topbar .store-chip span { max-width: 70px; }
  .login-head h2 { font-size: 24px; }
  .sheet-wrap { align-items: flex-end; padding: 0; }
  .sheet { width: 100%; max-height: 90dvh; border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .sheet.wide { width: 100%; }
  .toast { bottom: calc(var(--bn-h) + 16px + env(safe-area-inset-bottom)); }
  body.is-sub .toast { bottom: 96px; }
  .form-grid { grid-template-columns: 1fr; }
  .tab span { display: none; }
  .tab.on span { display: inline; }
}
@media (min-width: 1024px) { .only-m { display: none !important; } }
@media print { .sidebar, .topbar, .bottom-nav, .sticky-foot { display: none !important; } .main { margin: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* شاشة الجوال الضيقة: زر المخزن أيقونة فقط كي يبقى للعنوان مكان */
@media (max-width: 560px) {
  .topbar .store-chip { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .topbar .store-chip span { display: none; }
  .topbar { gap: 6px; }
}
