/* =====================================================================
   ميجا ستور — الشكل الجديد: ألوان مبهجة + حركة خفيفة + جرس إشعارات
   يُحمَّل بعد style.css: يغيّر المظهر فقط بدون المساس ببنية الصفحات.
   الطباعة لها قسم خاص في آخر الملف يرجّع الألوان والمظهر القديم كما هو.
   ===================================================================== */

:root {
  --red: #d4213d;
  --red-500: #e63550;
  --red-700: #9d1230;
  --red-100: #fde0e4;
  --red-50: #fff4f5;
  --ink: #2a1c20;
  --muted: #8a777d;
  --line: #f2e5e8;
  --bg: #fff8f7;
  --ok: #0f9d6b;
  --ok-bg: #dcf6ea;
  --warn: #b36b00;
  --warn-bg: #fff1cf;

  --sun: #ffb020; --sun-d: #b36b00; --sun-bg: #fff1cf;
  --mint: #12b886; --mint-d: #0b7a5a; --mint-bg: #dcf6ea;
  --sky: #339af0; --sky-d: #1c6fb8; --sky-bg: #e2f1fe;
  --grape: #8b5cf6; --grape-d: #5b34c9; --grape-bg: #ece6ff;
  --pink: #f06595; --pink-d: #c2255c; --pink-bg: #ffe3ee;

  /* أسطح وحدود وألوان حالات: بقيم الفاتح هنا، والمظهر الداكن يغيّرها من مكان واحد (آخر الملف) */
  --card: #fff;
  --surface-2: #fffafa; --surface-3: #fdf9f9; --input-bg: #fffdfd;
  --line-2: #f0dde1; --line-3: #d3b4b4; --red-200: #f6bcc4;
  --warn-line: #f1d6a0; --warn-tint: #fbf3e2; --warn-tint-2: #fffaf0; --ok-line: #bfe3cd; --bad-bg: #fde8e8; --chip-off: #eee7e7;
  --th-a: #fff1f3; --th-b: #ffe7ea; --th-line: #fbd0d7; --scroll: #ecc3ca;
  --sky-line: #bcdcf9;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(157, 18, 48, .05), 0 14px 32px -14px rgba(157, 18, 48, .18);
  --shadow-lg: 0 28px 64px -18px rgba(157, 18, 48, .38);
  --grad: linear-gradient(135deg, #ff5d6c 0%, #d4213d 48%, #9d1230 100%);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

::selection { background: var(--red-100); color: var(--red-700); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
:focus-visible { outline: 3px solid rgba(212, 33, 61, .35); outline-offset: 2px; border-radius: 8px; }

body {
  background:
    radial-gradient(900px 520px at 100% -8%, rgba(255, 93, 108, .15), transparent 60%),
    radial-gradient(760px 520px at -8% 6%, rgba(51, 154, 240, .11), transparent 58%),
    radial-gradient(720px 520px at 55% 112%, rgba(255, 176, 32, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
@media (pointer: coarse) { body { background-attachment: scroll; } }

/* ---------- الحركات الأساسية ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes tileIn { from { opacity: 0; transform: translateY(22px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(18px, -22px) scale(1.12); } }
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ring { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(18deg); } 20% { transform: rotate(-16deg); } 30% { transform: rotate(13deg); } 40% { transform: rotate(-10deg); } 50% { transform: rotate(6deg); } 60% { transform: rotate(-3deg); } 70% { transform: rotate(0); } }
@keyframes ping { 0% { transform: scale(.9); opacity: .55; } 80%, 100% { transform: scale(1.7); opacity: 0; } }
@keyframes spinring { to { transform: rotate(360deg); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 33, 61, .28), var(--shadow); } 50% { box-shadow: 0 0 0 7px rgba(212, 33, 61, 0), var(--shadow); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-10deg); } 50% { transform: rotate(8deg); } }
@keyframes gradMove { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes dotBounce { 0%, 80%, 100% { transform: translateY(0) scale(.85); opacity: .6; } 40% { transform: translateY(-9px) scale(1.1); opacity: 1; } }
@keyframes loaderPulse { 0% { transform: scale(.94); box-shadow: 0 0 0 0 rgba(212, 33, 61, .38); } 70% { transform: scale(1); box-shadow: 0 0 0 24px rgba(212, 33, 61, 0); } 100% { transform: scale(.94); box-shadow: 0 0 0 0 rgba(212, 33, 61, 0); } }
@keyframes navIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes shimmerLine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-36px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-36px) scale(.94); } }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes panelIn { from { opacity: 0; transform: translateY(-10px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes itemIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes sheet { from { transform: translateY(60px); opacity: 0; } }

/* دخول الصفحة: أقسامها تظهر بالتتابع (تعمل مرة واحدة عند فتح الصفحة، وليس مع كل تحديث داخلي) */
#view.entering > * > *:not(.tiles):not(.cards-grid):not(.rm-flow):not(.erp-sum):not(.stk-overview) { animation: fadeUp .6s var(--ease) both; }
#view.entering > * > :nth-child(2) { animation-delay: .06s; }
#view.entering > * > :nth-child(3) { animation-delay: .12s; }
#view.entering > * > :nth-child(4) { animation-delay: .18s; }
#view.entering > * > :nth-child(5) { animation-delay: .24s; }
#view.entering > * > :nth-child(6) { animation-delay: .3s; }
#view.entering > * > :nth-child(n+7) { animation-delay: .36s; }
#view.entering .tiles > *, #view.entering .cards-grid > *, #view.entering .rm-flow > .rm-step, #view.entering .erp-sum > *, #view.entering .stk-overview > * { animation: tileIn .6s var(--spring) both; }
#view.entering :is(.tiles, .cards-grid, .rm-flow, .erp-sum, .stk-overview) > :nth-child(1) { animation-delay: .05s; }
#view.entering :is(.tiles, .cards-grid, .rm-flow, .erp-sum, .stk-overview) > :nth-child(2) { animation-delay: .11s; }
#view.entering :is(.tiles, .cards-grid, .rm-flow, .erp-sum, .stk-overview) > :nth-child(3) { animation-delay: .17s; }
#view.entering :is(.tiles, .cards-grid, .rm-flow, .erp-sum, .stk-overview) > :nth-child(4) { animation-delay: .23s; }
#view.entering :is(.tiles, .cards-grid, .rm-flow, .erp-sum, .stk-overview) > :nth-child(5) { animation-delay: .29s; }
#view.entering :is(.tiles, .cards-grid, .rm-flow, .erp-sum, .stk-overview) > :nth-child(6) { animation-delay: .35s; }
#view.entering :is(.tiles, .cards-grid, .rm-flow, .erp-sum, .stk-overview) > :nth-child(n+7) { animation-delay: .4s; }
#view.entering .rm-dash-steps > * { animation: tileIn .6s var(--spring) both; animation-delay: .3s; }
#view.entering tbody tr { animation: rowIn .5s var(--ease) both; animation-delay: calc(var(--i, 14) * 38ms + 220ms); }
#view.entering tbody tr:nth-child(1) { --i: 0; } #view.entering tbody tr:nth-child(2) { --i: 1; } #view.entering tbody tr:nth-child(3) { --i: 2; }
#view.entering tbody tr:nth-child(4) { --i: 3; } #view.entering tbody tr:nth-child(5) { --i: 4; } #view.entering tbody tr:nth-child(6) { --i: 5; }
#view.entering tbody tr:nth-child(7) { --i: 6; } #view.entering tbody tr:nth-child(8) { --i: 7; } #view.entering tbody tr:nth-child(9) { --i: 8; }
#view.entering tbody tr:nth-child(10) { --i: 9; } #view.entering tbody tr:nth-child(11) { --i: 10; } #view.entering tbody tr:nth-child(12) { --i: 11; }
#view.entering tbody tr:nth-child(n+21) { animation: none; }
#view.entering .bar-fill { transform-origin: right; animation: barGrow .9s var(--ease) both; animation-delay: .35s; }
#view.entering .list-row { animation: itemIn .5s var(--ease) both; animation-delay: .3s; }

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  overflow-x: hidden;
  background:
    radial-gradient(420px 280px at 112% -6%, rgba(255, 255, 255, .24), transparent 60%),
    radial-gradient(380px 340px at -24% 104%, rgba(255, 176, 32, .30), transparent 62%),
    linear-gradient(185deg, #ec3650 0%, #c61b3a 46%, #8e0f2d 100%);
}
.sidebar::before, .sidebar::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.sidebar::before { width: 190px; height: 190px; top: 36%; inset-inline-start: -86px; background: rgba(255, 255, 255, .07); animation: drift 15s ease-in-out infinite; }
.sidebar::after { width: 130px; height: 130px; bottom: 14%; inset-inline-end: -48px; background: rgba(255, 205, 90, .14); animation: drift 12s ease-in-out infinite reverse; }
.sidebar > * { position: relative; z-index: 1; }
.sidebar { scrollbar-color: rgba(255, 255, 255, .35) transparent; }

.brand { border-bottom-color: rgba(255, 255, 255, .22); }
.brand-logo { position: relative; padding: 3px; background: #fff; box-shadow: 0 10px 26px rgba(80, 0, 20, .4); animation: float 5.5s ease-in-out infinite; }
.brand-logo::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; z-index: -1; background: conic-gradient(from 0deg, #fff, #ffd166, #ff8fa3, #8ce99a, #74c0fc, #fff); animation: spinring 7s linear infinite; }
.brand-name { letter-spacing: .2px; text-shadow: 0 2px 10px rgba(80, 0, 20, .35); }

.nav { gap: 3px; }
.nav a {
  position: relative; gap: 12px; padding: 7px 10px; border-radius: 16px;
  transition: transform .28s var(--ease), background .2s, color .2s, box-shadow .28s;
  animation: navIn .55s var(--ease) both;
}
.nav a:nth-child(1) { animation-delay: .05s; } .nav a:nth-child(2) { animation-delay: .09s; } .nav a:nth-child(3) { animation-delay: .13s; }
.nav a:nth-child(4) { animation-delay: .17s; } .nav a:nth-child(5) { animation-delay: .21s; } .nav a:nth-child(6) { animation-delay: .25s; }
.nav a:nth-child(7) { animation-delay: .29s; } .nav a:nth-child(8) { animation-delay: .33s; } .nav a:nth-child(9) { animation-delay: .37s; }
.nav a:nth-child(n+10) { animation-delay: .42s; }
.nav a > .ico:first-child {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff;
  background: rgba(255, 255, 255, .17); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .35s var(--spring), box-shadow .25s;
}
.nav a:hover { transform: translateX(-5px); background: rgba(255, 255, 255, .15); }
.nav a:hover > .ico:first-child { transform: rotate(-9deg) scale(1.12); }
.nav a.active { background: #fff; color: var(--red-700); box-shadow: 0 14px 28px -10px rgba(60, 0, 15, .55); transform: translateX(-4px); }
.nav a.active > .ico:first-child { box-shadow: 0 6px 14px -4px rgba(0, 0, 0, .35); }
.nav a.active::after { content: ''; position: absolute; inset-inline-end: -14px; top: 50%; width: 5px; height: 22px; margin-top: -11px; border-radius: 5px; background: #fff; }
.nav a[data-href="#/dashboard"] > .ico:first-child { background: linear-gradient(135deg, #ffd666, #ff9f1c); }
.nav a[data-href="#/products"] > .ico:first-child { background: linear-gradient(135deg, #74c0fc, #339af0); }
.nav a[data-href="#/suppliers"] > .ico:first-child { background: linear-gradient(135deg, #63e6be, #12b886); }
.nav a[data-href="#/transfer/new"] > .ico:first-child { background: linear-gradient(135deg, #ff99b9, #f06595); }
.nav a[data-href="#/transfers"] > .ico:first-child { background: linear-gradient(135deg, #b9a1ff, #8b5cf6); }
.nav a[data-href="#/erp"] > .ico:first-child { background: linear-gradient(135deg, #66d9e8, #15aabf); }
.nav a[data-href="#/room"] > .ico:first-child { background: linear-gradient(135deg, #ffb066, #f76707); }
.nav a[data-href="#/chargers"] > .ico:first-child { background: linear-gradient(135deg, #c0eb75, #74b816); }
.nav a[data-href="#/room/serials"] > .ico:first-child { background: linear-gradient(135deg, #faa2c1, #e64980); }
.nav a[data-href="#/stocktake"] > .ico:first-child { background: linear-gradient(135deg, #8ce99a, #2f9e44); }
.nav a[data-href="#/reports"] > .ico:first-child { background: linear-gradient(135deg, #a5b4fc, #5c7cfa); }
.nav a[data-href="#/users"] > .ico:first-child { background: linear-gradient(135deg, #ffe066, #fcc419); color: #7a4a00; }
.nav a.nav-ext { border: 1.5px dashed rgba(255, 255, 255, .45); }
.nav a.nav-ext > .ico:first-child { background: linear-gradient(135deg, #99e9f2, #22b8cf); }
.nav a.nav-ext:hover { background: #fff; color: var(--red-700); border-style: solid; }
.nav-sep { height: 1px; margin: 8px 8px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .38), transparent); }
.nav-badge { background: #fff; color: var(--red); box-shadow: 0 4px 10px rgba(0, 0, 0, .2); }

.feed-card, .user-card { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .26); border-radius: 18px; backdrop-filter: blur(8px); }
.user-avatar { background: linear-gradient(135deg, #ffe58a, #ffb020); color: #7a3d00; box-shadow: 0 6px 14px -4px rgba(0, 0, 0, .35); }
.user-card .btn-icon { transition: transform .25s var(--spring), background .2s; }
.user-card .btn-icon:hover { transform: scale(1.12) rotate(-6deg); }

/* ---------- الشريط العلوي + الجرس ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; padding: 12px 32px;
  background: rgba(255, 248, 247, .74); backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid rgba(212, 33, 61, .08);
}
.top-hello { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.top-hello b { font-size: 18px; font-weight: 800; color: var(--red-700); display: flex; align-items: center; gap: 8px; }
.top-hello small { color: var(--muted); font-weight: 600; }
.wave { display: inline-block; transform-origin: 70% 80%; animation: wave 2.6s ease-in-out 1.2s 2; }
.top-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }
.top-clock { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); color: var(--red-700); font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.top-clock .ico { color: var(--sun); }

.bell-btn {
  position: relative; flex: none; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border-radius: 16px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--red-700); cursor: pointer; box-shadow: var(--shadow);
  transition: transform .25s var(--spring), box-shadow .25s, background .25s, color .25s;
}
.bell-btn:hover { transform: translateY(-2px) rotate(-7deg); }
.bell-btn:active { transform: scale(.92); }
.bell-btn .ico svg { transform-origin: 50% 8%; }
.bell-btn.ring .ico svg { animation: ring 1.2s ease-in-out 2; }
.bell-btn.has { color: #fff; border-color: transparent; background: var(--grad); box-shadow: 0 12px 26px -8px rgba(212, 33, 61, .65); }
.bell-btn.has::before { content: ''; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--red); animation: ping 2s ease-out infinite; pointer-events: none; }
.bell-btn.open { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.bell-btn.has.open { background: var(--grad); color: #fff; }
.bell-count {
  position: absolute; top: -7px; inset-inline-start: -7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; background: #fff; color: var(--red); font-size: 12px; font-weight: 800; line-height: 1;
  box-shadow: 0 4px 10px rgba(80, 0, 20, .28); border: 2px solid var(--red); animation: pulse 1.8s ease-in-out infinite;
}
.bell-count:empty, .bell-count[hidden] { display: none; }
.bell-dot { position: absolute; top: 6px; inset-inline-start: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--sun); border: 2px solid #fff; }
.bell-dot[hidden] { display: none; }

.bell-panel {
  position: fixed; z-index: 70; display: flex; flex-direction: column; max-height: min(600px, calc(100vh - 90px)); overflow: hidden;
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(212, 33, 61, .08); animation: panelIn .34s var(--spring);
}
.bell-panel[hidden] { display: none; }
.bp-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: #fff; background: var(--grad); position: relative; overflow: hidden; }
.bp-head::after { content: ''; position: absolute; width: 150px; height: 150px; border-radius: 50%; top: -80px; inset-inline-end: -30px; background: rgba(255, 255, 255, .14); }
.bp-title { flex: 1; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; }
.bp-title .bp-n { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: #fff; color: var(--red); font-size: 13px; display: inline-grid; place-items: center; }
.bp-head .btn-icon { position: relative; z-index: 1; color: #fff; width: 36px; height: 36px; }
.bp-head .btn-icon:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.bp-body { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; background: linear-gradient(180deg, var(--surface-2), var(--card)); }
.bp-sec { display: flex; flex-direction: column; gap: 8px; }
.bp-sec-title { display: flex; align-items: center; gap: 6px; padding: 0 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.bp-sec-title .ico { color: var(--red); }
.bp-sec-title button { margin-inline-start: auto; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.bp-sec-title button:hover { color: var(--red); }
.bp-item { display: flex; gap: 12px; padding: 12px; border-radius: 18px; background: var(--red-50); border: 1.5px solid var(--red-100); animation: itemIn .45s var(--ease) both; transition: transform .2s var(--ease), box-shadow .2s; }
.bp-item:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(157, 18, 48, .5); }
.bp-item:nth-child(2) { animation-delay: .06s; } .bp-item:nth-child(3) { animation-delay: .12s; } .bp-item:nth-child(4) { animation-delay: .18s; } .bp-item:nth-child(n+5) { animation-delay: .22s; }
.bp-ico { flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 8px 16px -6px rgba(212, 33, 61, .6); }
.bp-item.rej { background: var(--warn-bg); border-color: var(--warn-line); }
.bp-item.rej .bp-ico { background: linear-gradient(135deg, #ffcd5e, #f59f00); box-shadow: 0 8px 16px -6px rgba(245, 159, 0, .6); }
.bp-item.out { background: var(--sky-bg); border-color: var(--sky-line); }
.bp-item.out .bp-ico { background: linear-gradient(135deg, #74c0fc, #339af0); box-shadow: 0 8px 16px -6px rgba(51, 154, 240, .6); }
.bp-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bp-main b { font-size: 14px; line-height: 1.45; }
.bp-main small { color: var(--muted); font-weight: 600; }
.bp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--red-100); font-size: 13px; font-weight: 700; }
.bp-chip b { min-width: 24px; padding: 0 7px; border-radius: 999px; background: var(--red); color: #fff; text-align: center; font-size: 12px; }
.bp-note { display: flex; gap: 6px; align-items: flex-start; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .8); color: var(--red-700); font-size: 13px; font-weight: 600; }
.bp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bp-actions .btn { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.bp-log { display: flex; flex-direction: column; }
.bp-log-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px dashed var(--line); font-size: 13px; animation: itemIn .4s var(--ease) both; }
.bp-log-row:last-child { border-bottom: 0; }
.bp-log-row .dot { flex: none; width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: var(--red-100); }
.bp-log-row.new .dot { background: var(--red); box-shadow: 0 0 0 4px rgba(212, 33, 61, .15); }
.bp-log-row .t { margin-inline-start: auto; flex: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.bp-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 14px; text-align: center; color: var(--muted); }
.bp-empty .bp-big { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: var(--mint); background: radial-gradient(circle, var(--mint-bg), var(--card)); animation: float 4s ease-in-out infinite; }
.bp-empty b { color: var(--ink); font-size: 16px; }
.bp-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--card); }
.bp-foot .btn { height: 38px; font-size: 13px; }
.bp-foot .hint { margin-inline-start: auto; }

/* ---------- الصفحة ---------- */
.page { padding: 24px 32px 60px; }
.page-head .page-title { position: relative; padding-bottom: 10px; font-size: 28px; }
.page-head .page-title::after { content: ''; position: absolute; inset-inline-start: 0; bottom: 0; width: 52px; height: 5px; border-radius: 5px; background: var(--grad); transform-origin: right; animation: barGrow .8s var(--ease) both .2s; }
.back-link { transition: transform .2s var(--ease), color .2s; }
.back-link:hover { transform: translateX(4px); }

/* ---------- أزرار ---------- */
.btn { position: relative; overflow: hidden; border-radius: 14px; transition: transform .22s var(--spring), background .2s, box-shadow .25s, border-color .2s, color .2s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn-primary { background: var(--grad); box-shadow: 0 12px 24px -10px rgba(212, 33, 61, .7); }
.btn-primary:hover:not(:disabled) { background: var(--grad); box-shadow: 0 16px 30px -10px rgba(212, 33, 61, .8); }
.btn-primary::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, .38) 50%, transparent 68%); transform: translateX(130%); transition: transform .7s var(--ease); }
.btn-primary:hover:not(:disabled)::before { transform: translateX(-130%); }
.btn-outline, .btn-ghost { border-color: var(--line-2); background: var(--card); box-shadow: 0 2px 0 rgba(157, 18, 48, .04); }
.btn-outline:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { border-color: var(--red); background: var(--red-50); box-shadow: 0 10px 20px -12px rgba(212, 33, 61, .55); }
.btn-ok { background: linear-gradient(135deg, #34d399, #0f9d6b); box-shadow: 0 12px 24px -10px rgba(15, 157, 107, .65); }
.btn-ok:hover:not(:disabled) { background: linear-gradient(135deg, #34d399, #0f9d6b); box-shadow: 0 16px 30px -10px rgba(15, 157, 107, .75); }
.btn-danger { border-color: var(--red-200); }
.btn-danger:hover:not(:disabled) { background: var(--red); border-color: var(--red); }
.btn-white { box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .35); }
.btn-icon { border-radius: 12px; transition: transform .22s var(--spring), background .2s, color .2s; }
.btn-icon:hover { transform: scale(1.1); }
.icon-btn { border-radius: 12px; border-color: var(--line-2); transition: transform .22s var(--spring), background .2s, color .2s, border-color .2s; }
.icon-btn:hover { transform: translateY(-2px) scale(1.06); }
.rip { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, .55); transform: scale(0); animation: ripple .65s ease-out forwards; }
.btn-ghost .rip, .btn-outline .rip, .chip .rip, .seg button .rip, .btn-danger .rip { background: rgba(212, 33, 61, .2); }

/* ---------- بطاقات وبلاطات ---------- */
.card { border-color: rgba(212, 33, 61, .07); border-radius: var(--radius); }
.card-head { border-bottom-color: var(--line); background: linear-gradient(180deg, var(--surface-2), var(--card)); border-radius: var(--radius) var(--radius) 0 0; }
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; flex: none; width: 6px; height: 22px; border-radius: 6px; background: var(--grad); }
.card-title .ico { color: var(--red); }

.tile { --tc: #d4213d; --tcd: #9d1230; --tcs: rgba(212, 33, 61, .17); isolation: isolate; border-radius: 22px; border-color: rgba(212, 33, 61, .06); padding: 18px 20px; transition: transform .35s var(--spring), box-shadow .3s; }
.tile::before { width: 6px; background: var(--tc); }
.tile::after { content: ''; position: absolute; z-index: -1; width: 112px; height: 112px; border-radius: 50%; top: -46px; inset-inline-end: -30px; background: var(--tcs); box-shadow: 0 0 0 16px color-mix(in srgb, var(--tc) 7%, transparent); transition: transform .7s var(--ease); }
.tile:hover { transform: translateY(-5px); box-shadow: 0 22px 40px -18px rgba(157, 18, 48, .35); }
.tile:hover::after { transform: scale(1.5); }
.tile-value { color: var(--tcd); }
.tiles .tile:nth-child(4n+2) { --tc: #ffb020; --tcd: #b36b00; --tcs: rgba(255, 176, 32, .24); }
.tiles .tile:nth-child(4n+3) { --tc: #12b886; --tcd: #0b7a5a; --tcs: rgba(18, 184, 134, .2); }
.tiles .tile:nth-child(4n+4) { --tc: #339af0; --tcd: #1c6fb8; --tcs: rgba(51, 154, 240, .2); }
.tile.accent { background: var(--grad); box-shadow: 0 22px 40px -16px rgba(212, 33, 61, .65); }
.tile.accent::after { background: rgba(255, 255, 255, .16); box-shadow: 0 0 0 16px rgba(255, 255, 255, .07); }
.tile.accent .tile-value { color: #fff; text-shadow: 0 2px 12px rgba(80, 0, 20, .25); }

/* ---------- نماذج ---------- */
.label { transition: color .2s; }
.field:focus-within .label { color: var(--red); }
.input, .select, .textarea { border-color: var(--line-2); border-radius: 14px; background-color: var(--input-bg); transition: border-color .2s, box-shadow .25s, background-color .2s; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--red-200); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--red); background-color: var(--card); box-shadow: 0 0 0 5px rgba(212, 33, 61, .12); }
.chips .chip, .chip { position: relative; overflow: hidden; border-color: var(--line-2); transition: transform .2s var(--spring), background .2s, border-color .2s, color .2s, box-shadow .2s; }
.chip:hover { transform: translateY(-2px); }
.chip.active { background: var(--grad); border-color: transparent; box-shadow: 0 10px 20px -10px rgba(212, 33, 61, .75); }
.chip.ok.active { background: linear-gradient(135deg, #34d399, #0f9d6b); box-shadow: 0 10px 20px -10px rgba(15, 157, 107, .75); }
.seg { border-radius: 16px; background: var(--red-50); }
.seg button { position: relative; overflow: hidden; transition: background .2s, color .2s, box-shadow .25s, transform .2s var(--spring); }
.seg button.active { background: var(--grad); box-shadow: 0 10px 20px -10px rgba(212, 33, 61, .8); }
.tab { transition: color .2s, border-color .2s, transform .2s var(--spring); }
.tab:hover { transform: translateY(-2px); }
.check input[type=checkbox], .check input[type=radio] { accent-color: var(--red); }

/* ---------- جداول ---------- */
.table-wrap { border-color: rgba(212, 33, 61, .07); border-radius: var(--radius); }
.table th { background: linear-gradient(180deg, var(--th-a), var(--th-b)); color: var(--red-700); border-bottom: 2px solid var(--th-line); }
.table tbody tr { transition: background .18s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:hover td:first-child { box-shadow: inset -4px 0 0 var(--red); }
.table tr.row-click:hover { background: var(--red-50); }
.table tfoot td { background: var(--th-a); border-top-color: var(--th-line); }
.badge { transition: transform .2s var(--spring); }
tr:hover .badge, .badge:hover { transform: scale(1.06); }
.badge-out { background: var(--red-100); }
.badge-warn { background: var(--warn-bg); }
.qty-pill { background: var(--red-100); color: var(--red-700); }
.qty-pill.zero { background: var(--chip-off); }
.holder-chip { background: var(--warn-bg); }

/* ---------- الموردون والتفاصيل ---------- */
.supplier-card { border-radius: 22px; transition: transform .35s var(--spring), box-shadow .3s, border-color .25s; }
.supplier-card:hover { transform: translateY(-6px) rotate(-.4deg); border-color: var(--red-200); box-shadow: 0 26px 44px -20px rgba(157, 18, 48, .45); }
.avatar { background: var(--grad); box-shadow: 0 10px 20px -8px rgba(212, 33, 61, .6); transition: transform .4s var(--spring); }
.supplier-card:hover .avatar { transform: rotate(-8deg) scale(1.1); }
.cards-grid > :nth-child(5n+2) .avatar { background: linear-gradient(135deg, #ffcd5e, #f59f00); box-shadow: 0 10px 20px -8px rgba(245, 159, 0, .6); }
.cards-grid > :nth-child(5n+3) .avatar { background: linear-gradient(135deg, #38d9a9, #0f9d6b); box-shadow: 0 10px 20px -8px rgba(15, 157, 107, .6); }
.cards-grid > :nth-child(5n+4) .avatar { background: linear-gradient(135deg, #74c0fc, #1c7ed6); box-shadow: 0 10px 20px -8px rgba(28, 126, 214, .6); }
.cards-grid > :nth-child(5n+5) .avatar { background: linear-gradient(135deg, #b197fc, #7048e8); box-shadow: 0 10px 20px -8px rgba(112, 72, 232, .6); }
.sc-stat { border-radius: 14px; background: var(--red-50); }
.sc-stat:nth-child(2) { background: var(--sky-bg); } .sc-stat:nth-child(2) b { color: var(--sky-d); }
.bar-track { height: 12px; background: var(--red-100); }
.bar-fill { background: linear-gradient(90deg, #ff8a95, #d4213d); box-shadow: 0 4px 10px -4px rgba(212, 33, 61, .6); }
.bar-row:nth-child(5n+2) .bar-fill { background: linear-gradient(90deg, #ffd166, #ff9f1c); }
.bar-row:nth-child(5n+3) .bar-fill { background: linear-gradient(90deg, #63e6be, #12b886); }
.bar-row:nth-child(5n+4) .bar-fill { background: linear-gradient(90deg, #74c0fc, #339af0); }
.bar-row:nth-child(5n+5) .bar-fill { background: linear-gradient(90deg, #b197fc, #8b5cf6); }
.list-row { border-radius: 12px; transition: background .2s, padding .25s var(--ease); }
a.list-row:hover { background: var(--red-50); padding-inline: 10px; }
.note-card { border-radius: 16px; background: linear-gradient(135deg, var(--red-50), var(--warn-tint-2)); }
.erp-sum-card, .rm-dash-step, .stk-ov { transition: transform .3s var(--spring), box-shadow .3s, border-color .2s, background .2s; }
.erp-sum-card:hover, .rm-dash-step:hover { transform: translateY(-4px); box-shadow: 0 18px 32px -16px rgba(157, 18, 48, .4); }
.stk-ov:hover { transform: translateY(-3px); }
.stk-ov { border-radius: 18px; }
.erp-branch-head, .erp-banner, .stk-ghead { box-shadow: 0 14px 28px -16px rgba(157, 18, 48, .6); }
.erp-banner { border-radius: 20px; }
.erp-arrow, .rt-arrow { display: inline-block; animation: nudge 1.8s ease-in-out infinite; }

/* ---------- غرفة التست ---------- */
.room, .rm-dash, .modal .rm-stage { --st-new: #c77700; --st-new-bg: #fff1cf; --st-sw: #2b7bd8; --st-sw-bg: #e2f1fe; --st-ok: #0f9d6b; --st-ok-bg: #dcf6ea; --st-maint: #d4213d; --st-maint-bg: #ffe9ec; --st-bat: #7c4dff; --st-bat-bg: #ece6ff; }
.rm-step { overflow: hidden; border: 2px solid transparent; border-radius: 22px; transition: transform .35s var(--spring), box-shadow .3s, background .25s, border-color .25s; }
.rm-step::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 5px; background: var(--c, var(--red)); }
.rm-step:hover { transform: translateY(-5px); box-shadow: 0 22px 38px -20px var(--c, var(--red)); }
.rm-step.active { box-shadow: 0 20px 36px -18px var(--c, var(--red)); border-color: var(--c); }
.rm-step.active .rm-step-n { text-shadow: 0 4px 14px var(--bg); }
.rm-step:has(.rm-wait), .rm-step:has(.rm-mine) { padding-top: 36px; }
.rm-arrow { color: var(--red-200); animation: nudge 1.8s ease-in-out infinite; }
.rm-mine, .rm-wait { box-shadow: 0 6px 12px -4px rgba(0, 0, 0, .3); }
.rq-card { border-radius: 20px; }
.rq-card.in { animation: glow 2.2s ease-in-out infinite; }
.rq-chip { border-radius: 12px; }
.rm-count { background: var(--grad); box-shadow: 0 8px 16px -8px rgba(212, 33, 61, .8); }
.rm-bulk { background: linear-gradient(135deg, #3a1520, #2a1018); border-radius: 18px; animation: itemIn .35s var(--ease) both; }
.rm-group, .rm-group td { transition: background .18s; }
.rm-caret { transition: transform .25s var(--spring); }
.rv-entry, .rm-add { border-radius: 18px; background: linear-gradient(135deg, var(--red-50), var(--warn-tint-2)); }

/* ---------- الحالات الفارغة والتحميل ---------- */
.empty > .ico { width: 96px; height: 96px; margin-bottom: 14px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--red-500); background: radial-gradient(circle, var(--red-100), var(--red-50) 70%); animation: float 4.5s ease-in-out infinite; }
/* أيقونات الأزرار جوه الحالة الفارغة تفضل أيقونات أزرار عادية */
.empty .btn .ico { width: auto; height: auto; margin: 0; border-radius: 0; background: none; animation: none; color: inherit; }
.empty h3 { font-size: 20px; }
.loading { padding: 110px 0; }
.loader { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.loader img { width: 78px; height: 78px; border-radius: 50%; animation: loaderPulse 1.5s ease-in-out infinite; }
.loader .dots { display: inline-flex; gap: 8px; }
.loader .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: dotBounce 1.05s ease-in-out infinite; }
.loader .dots i:nth-child(2) { background: var(--sun); animation-delay: .15s; }
.loader .dots i:nth-child(3) { background: var(--mint); animation-delay: .3s; }

/* ---------- النوافذ والرسائل ---------- */
.modal-overlay { background: rgba(48, 12, 24, .5); backdrop-filter: blur(7px) saturate(1.1); -webkit-backdrop-filter: blur(7px) saturate(1.1); animation: fade .22s; }
.modal-overlay.closing { opacity: 0; pointer-events: none; transition: opacity .16s; }
.modal-overlay.closing .modal { transform: translateY(14px) scale(.96); transition: transform .16s; }
.modal { border-radius: 26px; animation: modalIn .42s var(--spring); box-shadow: var(--shadow-lg); }
.modal-head { position: relative; overflow: hidden; background: var(--grad); }
.modal-head::after { content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%; top: -90px; inset-inline-end: -30px; background: rgba(255, 255, 255, .14); pointer-events: none; }
.modal-head > * { position: relative; z-index: 1; }
.modal-head .btn-icon { transition: transform .3s var(--spring), background .2s; }
.modal-head .btn-icon:hover { transform: rotate(90deg); }
.modal-foot { background: linear-gradient(180deg, var(--surface-2), var(--red-50)); }

#toasts { gap: 12px; }
.toast {
  position: relative; overflow: hidden; gap: 12px; padding: 12px 18px 15px 16px; border: 0; border-radius: 18px; background: rgba(42, 20, 28, .94);
  backdrop-filter: blur(10px); box-shadow: 0 22px 44px -14px rgba(42, 0, 15, .6); animation: toastIn .5s var(--spring);
}
.toast.leaving { animation: toastOut .26s ease-in forwards; }
.toast-ico { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #34d399, #0f9d6b); }
.toast.error { background: rgba(120, 12, 36, .96); }
.toast.error .toast-ico { background: linear-gradient(135deg, #ff8a95, #ff4d63); }
.toast::after { content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: #34d399; transform-origin: right; animation: toastBar var(--life, 3.2s) linear forwards; }
.toast.error::after { background: #ff8a95; }

/* ---------- الشريط العلوي للموبايل ---------- */
.mobile-bar { background: var(--grad); box-shadow: 0 10px 24px -12px rgba(157, 18, 48, .8); gap: 8px; }
.mobile-bar .bell-btn { width: 42px; height: 42px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .2); color: #fff; box-shadow: none; }
.mobile-bar .bell-btn.has { background: #fff; color: var(--red); }
.mobile-bar .bell-btn.has::before { border-color: #fff; }
.mobile-bar .bell-count { background: var(--red); color: #fff; border-color: #fff; }
.mobile-logo { background: #fff; padding: 2px; }

/* ---------- شاشة الدخول ---------- */
body.logged-out { background: linear-gradient(130deg, #ff5d6c, #d4213d 42%, #8e0f2d 75%, #c61b3a); background-size: 220% 220%; animation: gradMove 16s ease infinite; }
body.logged-out .topbar { display: none; }
body.logged-out::before, body.logged-out::after { content: ''; position: fixed; z-index: 0; border-radius: 50%; pointer-events: none; }
body.logged-out::before { width: 420px; height: 420px; top: -140px; inset-inline-start: -120px; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 68%); animation: drift 14s ease-in-out infinite; }
body.logged-out::after { width: 520px; height: 520px; bottom: -200px; inset-inline-end: -160px; background: radial-gradient(circle, rgba(255, 196, 70, .32), transparent 66%); animation: drift 18s ease-in-out infinite reverse; }
body.logged-out .app { position: relative; z-index: 1; }
.auth-card { border-radius: 32px; animation: modalIn .7s var(--spring) both; box-shadow: 0 40px 90px -20px rgba(40, 0, 15, .6); }
.auth-logo { background: #fff; padding: 4px; animation: float 5s ease-in-out infinite; box-shadow: 0 16px 36px rgba(60, 0, 20, .4); }
.auth-title { color: var(--red-700); }
.auth-card .field { animation: fadeUp .6s var(--ease) both; }
.auth-card .field:nth-of-type(1) { animation-delay: .25s; } .auth-card .field:nth-of-type(2) { animation-delay: .32s; } .auth-card .field:nth-of-type(3) { animation-delay: .39s; }
.auth-err:not(:empty) { padding: 8px 12px; border-radius: 12px; background: var(--red-50); animation: itemIn .3s var(--ease); }

/* ---------- المسح بالكاميرا ---------- */
.scan-top { background: var(--grad); }

/* ---------- سجل العرض ---------- */
.dl-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dl-dates { display: flex; align-items: center; gap: 8px; }
.dl-dates .label { margin: 0; }
.dl-date { width: 160px; }
.dl-day .card-head { flex-wrap: wrap; }
.dl-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.dl-days { gap: 16px; margin-top: 4px; }
@media print {
  .dl .page-head { display: none; }
  .dl-day { break-inside: avoid; margin-bottom: 8px; }
  .dl .tiles { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
  .dl .tile { padding: 4px 10px; }
  .dl .tile-value { font-size: 18px; }
}

/* ---------- صفحة الغرفة المبسّطة + سجل الاستلامات ---------- */
.rm-links { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 16px; }
.rm-link { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--red-700); font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; transition: transform .2s var(--spring), border-color .2s, background .2s; }
.rm-link:hover { transform: translateY(-2px); border-color: var(--red); background: var(--red-50); color: var(--red); }

.rq-panel { margin-bottom: 16px; padding: 4px 0; overflow: hidden; }
.rq-panel[hidden] { display: none; }
.rq-sec { padding: 4px 18px 8px; }
.rq-sec + .rq-sec { border-top: 1px dashed var(--line); }
.rq-sec-title { display: flex; align-items: center; gap: 6px; padding: 8px 0 4px; font-weight: 800; font-size: 13px; color: var(--muted); }
.rq-sec.in .rq-sec-title { color: var(--red); }
.rq-sec.rej .rq-sec-title { color: var(--warn); }
.rq-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--red); color: #fff; font-size: 12px; }
.rq-sec.rej .rq-n { background: var(--warn); }
.rq-sec.out .rq-n { background: var(--sky); }
.rq-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rq-row:last-child { border-bottom: 0; }
.rq-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rq-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rq-line b { font-size: 15px; }
.rq-line small { color: var(--muted); font-weight: 600; }
.rq-note { display: flex; align-items: center; gap: 6px; color: var(--red-700); font-size: 13px; }
.rq-actions { display: flex; gap: 8px; flex: none; }
.rq-chip { padding: 2px 4px 2px 10px; border-radius: 999px; font-size: 13px; }

.rm-stages { margin-bottom: 20px; padding: 14px 16px 10px; }
.rm-stages .rm-flow { margin-bottom: 0; gap: 8px; }
.rm-stages .rm-step { padding: 10px 14px; min-width: 120px; box-shadow: none; border: 2px solid var(--line); border-radius: 18px; }
.rm-stages .rm-step.active { border-color: var(--c); }
.rm-stages .rm-step:hover { box-shadow: 0 14px 24px -16px var(--c, var(--red)); }
.rm-stages .rm-step:has(.rm-wait), .rm-stages .rm-step:has(.rm-mine) { padding-top: 30px; }
.rm-stages .rm-step-n { font-size: 26px; }
.rm-stages .rm-step-l { font-size: 13px; }
.rm-stages .rm-arrow { font-size: 18px; }
.rm-stages .rm-today { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); }
.rm-stages .rm-today .stk-pill { background: var(--red-50); color: var(--red-700); }

.rm-listsec .rm-toolbar { align-items: center; margin: 0 0 12px; }
.rm-bar-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rm-total { color: var(--muted); font-weight: 700; font-size: 14px; }
.rm-toolbar .search { flex: 0 1 380px; margin: 0; }
.rm-more { width: 36px; padding: 0; }
.rm-act-in { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }

.rm-menu { position: fixed; z-index: 75; display: flex; flex-direction: column; min-width: 200px; padding: 6px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(212, 33, 61, .08); animation: panelIn .2s var(--spring); }
.rm-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; font-family: inherit; font-weight: 700; color: var(--ink); text-align: start; cursor: pointer; }
.rm-menu-item:hover { background: var(--red-50); color: var(--red); }
.rm-menu-item.danger { color: var(--red); }
.rm-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.rc-places { display: flex; flex-wrap: wrap; gap: 4px; }
.rc-qty { width: 100px; text-align: center; font-weight: 800; }
@media screen and (max-width: 700px) {
  .rq-row { flex-direction: column; align-items: stretch; }
  .rq-actions { justify-content: flex-end; }
  .rm-toolbar .search { flex: 1 1 100%; }
}

/* ---------- مركز السيريالات وملصقات الطباعة ---------- */
.rv-auto { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--red-50); border: 1.5px dashed var(--red-100); }
.lbl-bar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.lbl-size { min-width: 280px; }
.lbl-info { padding-bottom: 10px; font-weight: 800; color: var(--red-700); }
.lbl-sheet { --lw: 50; --lh: 30; display: flex; flex-wrap: wrap; gap: 14px; page: lbl; }
.lbl-sheet.is-sheet { display: grid; grid-template-columns: repeat(3, calc(var(--lw) * 1mm)); gap: 0; justify-content: center; }
.lbl {
  width: calc(var(--lw) * 1mm); height: calc(var(--lh) * 1mm); box-sizing: border-box; padding: calc(var(--lh) * .05mm) calc(var(--lh) * .07mm);
  display: flex; flex-direction: column; justify-content: space-between; gap: calc(var(--lh) * .02mm); overflow: hidden;
  background: #fff; color: #000; border: 1px dashed #cfa9b1; border-radius: 3px; font-family: Arial, 'Cairo', sans-serif; break-inside: avoid; page-break-inside: avoid;
}
.lbl-brand { display: flex; justify-content: space-between; align-items: center; direction: ltr; line-height: 1; font-size: calc(var(--lh) * .062mm); letter-spacing: .05mm; white-space: nowrap; gap: calc(var(--lh) * .03mm); padding-bottom: calc(var(--lh) * .02mm); border-bottom: .2mm solid #000; }
.lbl-brand b { font-weight: 900; }
.lbl-ok { font-weight: 800; }
.lbl-cap { margin-top: 2px; text-align: center; font-size: 6px; color: var(--muted); font-weight: 700; }
.lbl-wrap { break-inside: avoid; page-break-inside: avoid; }
.lbl-title { font-size: calc(var(--lh) * .125mm); font-weight: 900; line-height: 1.05; max-height: calc(var(--lh) * .27mm); overflow: hidden; }
.lbl-specs { font-size: calc(var(--lh) * .082mm); font-weight: 600; line-height: 1.1; max-height: calc(var(--lh) * .2mm); overflow: hidden; }
.lbl-bc { flex: 1; min-height: 0; }
.lbl-bc svg { display: block; width: 100%; height: 100%; }
.lbl-serial { text-align: center; font-family: Consolas, 'Courier New', monospace; font-weight: 900; font-size: calc(var(--lh) * .13mm); letter-spacing: .3mm; line-height: 1; }
@media screen { .lbl-sheet { zoom: 1.7; } .lbl-sheet.is-sheet { zoom: 1.1; } }
@media print {
  .lbl-sheet { display: block; gap: 0; zoom: 1; }
  .lbl-sheet.is-sheet { display: grid; }
  .lbl { border: 0; border-radius: 0; margin: 0; }
  .lbl-wrap { break-after: page; page-break-after: always; }
  .lbl-wrap:last-child, .lbl-sheet.is-sheet .lbl-wrap { break-after: auto; page-break-after: auto; }
}

/* ---------- توافق الهاتف: بدون تمرير أفقي للصفحة ---------- */
.dl-dates { flex-wrap: wrap; }
@media screen and (max-width: 900px) { .app { overflow-x: clip; } }
@media screen and (max-width: 700px) {
  /* جدول بدون تحويل لبطاقات يتمرر داخل إطاره بدل ما يوسّع الصفحة كلها */
  .table-wrap:has(> table.no-cards) { overflow-x: auto; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
  .dl-dates { width: 100%; }
  .dl-date { flex: 1 1 130px; width: auto; min-width: 0; }
}

/* ---------- الهاتف ---------- */
@media screen and (max-width: 900px) {
  .topbar { display: none; }
  .page { padding: 18px 14px 44px; }
  .bell-panel { left: 10px !important; right: 10px; width: auto !important; top: 64px !important; }
}
@media screen and (max-width: 700px) {
  .page-head .page-title { font-size: 23px; }
  .tile { border-radius: 18px; }
  .modal, .modal.wide { border-radius: 26px 26px 0 0; animation: sheet .35s var(--ease); }
  .modal-overlay.closing .modal { transform: translateY(40px); }
}

/* ---------- مفتاح المظهر (تلقائي / فاتح / داكن) ---------- */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.theme-switch button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: background .25s, color .25s, transform .25s var(--spring); }
.theme-switch button:hover { color: var(--red); transform: scale(1.1); }
.theme-switch button.active { background: var(--grad); color: #fff; box-shadow: 0 8px 16px -8px rgba(212, 33, 61, .8); }
.side-foot .theme-switch { width: 100%; justify-content: space-between; margin-bottom: 12px; background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .26); box-shadow: none; }
.side-foot .theme-switch button { flex: 1; width: auto; border-radius: 999px; color: rgba(255, 255, 255, .85); }
.side-foot .theme-switch button.active { background: #fff; color: var(--red); box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .4); }
.theme-switch.float { position: fixed; top: 14px; inset-inline-end: 14px; z-index: 30; display: none; }
body.logged-out .theme-switch.float { display: inline-flex; }

/* ---------- المظهر الداكن (للشاشة فقط؛ الطباعة تفضل فاتحة) ---------- */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --red: #f0435a; --red-500: #f55d72; --red-700: #ff9aab; --red-100: #4a2029; --red-50: #2b161d; --red-200: #6d2b38;
    --ink: #f5ebee; --muted: #b9a5ac; --line: #3a2a31; --line-2: #4b363f; --line-3: #61464f;
    --bg: #150c10; --card: #21141b; --surface-2: #281921; --surface-3: #251821; --input-bg: #1a0f15;
    --ok: #38d9a0; --ok-bg: #11382b; --ok-line: #1f6a50; --warn: #ffc247; --warn-bg: #3b2a0d; --warn-line: #6b4d12; --warn-tint: #2d2110; --warn-tint-2: #2a1f12;
    --bad-bg: #3b1620; --chip-off: #34262d; --sky-line: #1f4a72;
    --sun-bg: #3b2a0d; --mint-bg: #11382b; --sky-bg: #12304a; --grape-bg: #2c2350; --pink-bg: #43202f;
    --sun-d: #ffc247; --mint-d: #38d9a0; --sky-d: #74c0fc; --grape-d: #b197fc; --pink-d: #faa2c1;
    --th-a: #2f1a22; --th-b: #371e27; --th-line: #5a2a38; --scroll: #5a3f49;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 14px 32px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 28px 64px -18px rgba(0, 0, 0, .8);
  }
  :root[data-theme="dark"] body {
    background:
      radial-gradient(900px 520px at 100% -8%, rgba(255, 93, 108, .13), transparent 60%),
      radial-gradient(760px 520px at -8% 6%, rgba(51, 154, 240, .09), transparent 58%),
      radial-gradient(720px 520px at 55% 112%, rgba(255, 176, 32, .06), transparent 60%),
      var(--bg);
    background-attachment: fixed;
  }
  /* الأحمر الغامق للترويسات والأزرار (عشان الكتابة البيضا فوقها تفضل واضحة) */
  :root[data-theme="dark"] .tile.accent, :root[data-theme="dark"] .avatar, :root[data-theme="dark"] .modal-head, :root[data-theme="dark"] .scan-top,
  :root[data-theme="dark"] .stk-ghead, :root[data-theme="dark"] .erp-branch-head, :root[data-theme="dark"] .erp-banner, :root[data-theme="dark"] .ps-route { background: var(--grad); }
  :root[data-theme="dark"] .sidebar {
    background:
      radial-gradient(420px 280px at 112% -6%, rgba(255, 255, 255, .12), transparent 60%),
      radial-gradient(380px 340px at -24% 104%, rgba(255, 176, 32, .16), transparent 62%),
      linear-gradient(185deg, #a82240 0%, #7d122e 46%, #4d0a1d 100%);
  }
  :root[data-theme="dark"] .topbar { background: rgba(21, 12, 16, .78); border-bottom-color: rgba(255, 90, 112, .12); }
  :root[data-theme="dark"] .tile { --tcd: #ff9aab; border-color: rgba(255, 255, 255, .06); }
  :root[data-theme="dark"] .tiles .tile:nth-child(4n+2) { --tcd: #ffc247; }
  :root[data-theme="dark"] .tiles .tile:nth-child(4n+3) { --tcd: #38d9a0; }
  :root[data-theme="dark"] .tiles .tile:nth-child(4n+4) { --tcd: #74c0fc; }
  :root[data-theme="dark"] .tile.accent { --tcd: #fff; }
  :root[data-theme="dark"] .room, :root[data-theme="dark"] .rm-dash, :root[data-theme="dark"] .modal .rm-stage {
    --st-new: #ffc247; --st-new-bg: #3b2a0d; --st-sw: #74b6ff; --st-sw-bg: #12304a; --st-ok: #38d9a0; --st-ok-bg: #11382b;
    --st-maint: #ff7a8c; --st-maint-bg: #43202b; --st-bat: #b79cff; --st-bat-bg: #2c2350;
  }
  /* عناصر بخلفية "لون الحالة" ونص أبيض: لازم الخلفية تفضل غامقة */
  :root[data-theme="dark"] .holder-chip b, :root[data-theme="dark"] .qty-pill.neg, :root[data-theme="dark"] .stk-state.neg { color: #fff; }
  :root[data-theme="dark"] .holder-chip b { background: #b36b00; }
  :root[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, .62); }
  :root[data-theme="dark"] .rm-bulk { background: linear-gradient(135deg, #3a1520, #2a1018); border: 1px solid var(--line-2); }
  :root[data-theme="dark"] .bell-btn.open { background: var(--red-50); }
  :root[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b9a5ac' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
  :root[data-theme="dark"] img.doc-logo, :root[data-theme="dark"] .auth-card .auth-logo { background: #fff; }
}

/* ---------- تقليل الحركة لمن يفضّل ذلك ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- الطباعة: نفس الشكل القديم تماماً بدون زينة ---------- */
@media print {
  :root {
    --red: #94100f; --red-500: #b01a19; --red-700: #6a0a0a; --red-100: #f6dcdc; --red-50: #fcf1f1;
    --ink: #241819; --muted: #7b6b6c; --line: #ecdfdf; --bg: #fff;
    --ok: #1d7a46; --ok-bg: #e6f4ec; --warn: #a15c07; --warn-bg: #fdf1dc;
    --radius: 14px; --shadow: none;
  }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  body { background: #fff !important; }
  .topbar, .bell-panel, .bell-btn { display: none !important; }
  .page { padding: 0 !important; }
  .table th { border-bottom: 0; border-color: var(--red); }
  .page-head .page-title::after, .card-title::before, .tile::after, .rip { display: none !important; }
  .card-head { background: none; }
  .tile { --tc: var(--red); --tcd: var(--red-700); }
  .erp-branch-head, .erp-banner, .stk-ghead, .tile, .card, .table-wrap, .stk-ov, .supplier-card { box-shadow: none !important; }
  .table tbody tr:hover td:first-child { box-shadow: none; }
}
