* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Cairo', sans-serif; -webkit-tap-highlight-color: transparent; }

/* ✅ V32 PERF: تحسينات الأداء العامة */
html {
    /* تحسين الـ scrolling على الموبايل والكمبيوتر */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
body {
    /* ✅ V32 FIX: حُذف transform:translateZ(0) لأنه بيكسّر gradient على Android */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* عناصر الـ animation - will-change محدود بالعناصر الأساسية فقط */
.laser {
    will-change: transform;
}
/* السلة — تحسين الـ scrolling */
.cart-container {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
/* تحسين الـ rendering للنصوص الكثيرة - بدون content-visibility لدعم Android القديم */
.inv-cards-list, .report-box, #modal-body {
    overflow-anchor: none;
}

:root {
    /* === ألوان سماوية/زرقاء للوضع العادي (النهاري) === */
    --bg: #e8f4fd;
    --surface: #d0e8f8;
    --surface2: #b8d8f0;
    --primary: #1a7fc4;
    --primary-light: #2d9ae0;
    --primary-dark: #115a9a;
    --primary-glow: rgba(26,127,196,0.22);
    --success: #0fa871;
    --danger: #e53e3e;
    --accent: #e8a214;
    --text-main: #0c2a45;
    --text-sub: #4a6a8a;
    --border: rgba(26,127,196,0.25);
    --border-subtle: rgba(0,0,0,0.08);
    --header-h: 60px;
    --cam-h: 22vh;
    /* ألوان إضافية */
    --deep1: #c0daf0;
    --deep2: #a8cce8;
    --gold1: #1a7fc4;
    --gold2: #115a9a;
    --gold3: #5ab0e8;
}

body.dark-mode {
    --bg: #080d1a;
    --surface: #0e1628;
    --surface2: #131e35;
    --primary: #C9A84C;
    --primary-light: #e8c96a;
    --primary-dark: #9a7a2e;
    --primary-glow: rgba(201,168,76,0.22);
    --text-main: #dde4f0;
    --text-sub: #5a6a8a;
    --border: rgba(201,168,76,0.18);
    --border-subtle: rgba(255,255,255,0.06);
    --deep1: #05080f;
    --deep2: #0a0f1c;
    --gold1: #C9A84C;
    --gold2: #a07830;
    --gold3: #f0d070;
    background-color: #080d1a;
    background-image: linear-gradient(160deg, #080d1a 0%, #0b1020 50%, #0d1428 100%);
}

@media (min-width:1200px){
    :root{ --cam-h:32vh; --header-h:68px; }
    #main-app {
        display:grid !important;
        grid-template-rows: auto auto 1fr auto;
        grid-template-columns: 1fr 380px;
        grid-template-areas:
            "banner banner"
            "header header"
            "left   right"
            "bottom bottom";
        height:100dvh;
        overflow:hidden;
    }
    #hs-top-banner { grid-area:banner; }
    header { grid-area:header; padding:0 24px; }
    #camera-area {
        grid-area:left;
        margin:16px 16px 0 20px;
        max-width:none; width:auto;
        height:auto; min-height:auto; max-height:none;
        border-radius:20px;
    }
    #quick-actions-panel {
        grid-area:left;
        margin:16px 16px 0 20px;
        border-radius:20px;
        display:none;
    }
    .cart-container {
        grid-area:right;
        margin:16px 20px 0 0;
        max-width:none; width:auto;
        border-radius:20px;
        overflow-y:auto;
        border:1px solid rgba(201,168,76,0.15);
        background:rgba(14,22,40,0.7);
    }
    .bottom-panel {
        grid-area:bottom;
        max-width:none; width:100%;
        margin:0;
        border-radius:0;
        padding:12px 20px;
    }
    .btn-grid { grid-template-columns:1fr 1fr 1fr; gap:10px; }
    .btn { font-size:0.95rem; padding:14px 8px; }
    .total-price { font-size:2.8rem; }
    #owner-header { font-size:1.15rem; }
    .logo-hs { width:56px; height:56px; font-size:1.35rem; }
    #clock-header { font-size:0.85rem; }
    #accountant-dashboard { grid-column:1/-1; }
    #printer-fab { bottom:220px; }
    #printer-menu { bottom:282px; left:auto; right:20px; }
    #sync-fab { bottom:282px; }

    /* ============================================================
       ✅ NEW: تخطيط شاشة الكاشير على الكمبيوتر (desktop-pos-mode)
       السلة تظهر في الجانب الكبير (يسار) — واللوحات (مدير/مدير ثانوي/مساعد)
       تظهر في الجانب الضيق (يمين) كبطاقات رأسية فخمة فوق بعضها
       ينطبق على كل الأدوار: مدير رئيسي M، مدير ثانوي S، مساعد A
       ============================================================ */
    body.desktop-pos-mode .cart-container {
        grid-area: left;
        margin: 16px 16px 0 20px;
    }
    body.desktop-pos-mode #quick-actions-panel,
    body.desktop-pos-mode #accountant-dashboard {
        grid-area: right !important;
        margin: 16px 20px 0 0 !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        flex-direction: column;
        overflow-y: auto;
        justify-content: flex-start;
    }
    /* كروت لوحة الإجراءات (مدير ثانوي / مساعد) — عمود واحد رأسي */
    body.desktop-pos-mode .qa-grid {
        grid-template-columns: 1fr;
    }
    body.desktop-pos-mode .qa-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 16px 18px;
    }
    body.desktop-pos-mode .qa-btn-wide {
        flex-direction: row;
    }
    /* كروت لوحة المدير الرئيسي — عمود واحد رأسي بنفس الشكل الفخم */
    body.desktop-pos-mode .acc-dash-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    body.desktop-pos-mode .acc-dash-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 14px 16px;
        gap: 12px;
    }
    /* ✅ مؤشر دائم لحالة السكانر الخارجي على الكمبيوتر — خافت في الجاهزية، يلمع بالأخضر عند الاستخدام */
    body.desktop-pos-mode .scanner-badge {
        display: flex !important;
        align-items: center;
        gap: 6px;
        opacity: 0.6;
        background: linear-gradient(135deg,#334155,#1e293b);
        color: #cbd5e1;
        transition: all .3s;
    }
    body.desktop-pos-mode .scanner-badge.active {
        opacity: 1;
        background: linear-gradient(135deg,#15803d,#22c55e);
        color: #fff;
        box-shadow: 0 0 16px rgba(34,197,94,0.6);
    }
}
@media (max-width:480px){ :root{--cam-h:20vh;} .btn-grid button{font-size:0.82rem;} .total-price{font-size:2rem;} }

/* ============================================================
   ✅ FIX: تخطيط "السلة في جانب + الكروت 2×2 في الجانب الثاني"
   على أي عرض نافذة كمبيوتر — مش لازم 1200px+. الكلاس desktop-pos-mode
   بيتفعّل بالأساس بس على جهاز كمبيوتر حقيقي (مش موبايل/تابلت لمس)،
   فمفيش خطر إنها تتفعّل غلط على الموبايل أو التابلت.
   ============================================================ */
body.desktop-pos-mode #main-app {
    display: grid !important;
    grid-template-rows: auto auto 1fr auto;
    grid-template-columns: 1fr minmax(260px, 360px);
    grid-template-areas:
        "banner banner"
        "header header"
        "left   right"
        "bottom bottom";
    height: 100dvh;
    overflow: hidden;
}
body.desktop-pos-mode #hs-top-banner { grid-area: banner; }
body.desktop-pos-mode header { grid-area: header; padding: 0 24px; }
body.desktop-pos-mode #camera-area { display: none !important; }
body.desktop-pos-mode .cart-container {
    grid-area: left;
    margin: 16px 16px 0 20px;
    max-width: none; width: auto;
    border-radius: 20px;
    overflow-y: auto;
    border: 1px solid rgba(201,168,76,0.15);
    background: rgba(14,22,40,0.7);
}
body.desktop-pos-mode #quick-actions-panel,
body.desktop-pos-mode #accountant-dashboard {
    grid-area: right !important;
    margin: 16px 20px 0 0 !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    flex-direction: column;
    overflow-y: auto;
    justify-content: flex-start;
}
/* كروت الإجراءات (مدير ثانوي / مساعد) — تفضل 2×2 */
body.desktop-pos-mode .qa-grid {
    grid-template-columns: repeat(2, 1fr);
}
/* كروت لوحة المدير الرئيسي/المحاسب — 2×2 بدل 3 أعمدة ضيقة */
body.desktop-pos-mode .acc-dash-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
}
body.desktop-pos-mode .bottom-panel {
    grid-area: bottom;
    max-width: none; width: 100%;
    margin: 0;
    border-radius: 0;
    padding: 12px 20px;
}
body.desktop-pos-mode .btn-grid { grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* === تيمات نوع المتجر === */
body.theme-pharma {
    --primary: #1ab87a;
    --primary-dark: #0d9060;
    --primary-glow: rgba(26,184,122,0.2);
    --gold1: #1ab87a;
    --gold2: #0d9060;
}
body.theme-food {
    --primary: #e8365d;
    --primary-dark: #c02248;
    --primary-glow: rgba(232,54,93,0.2);
    --gold1: #e8365d;
    --gold2: #c02248;
}
body.theme-retail {
    --primary: #2979ff;
    --primary-dark: #1a52cc;
    --primary-glow: rgba(41,121,255,0.2);
    --gold1: #2979ff;
    --gold2: #1a52cc;
}

html { height: 100%; }
body {
    /* ✅ V32: خلفية سماوية زرقاء للوضع العادي */
    background-color: #e8f4fd;
    background-image: linear-gradient(160deg, #d0e8f8 0%, #e8f4fd 50%, #c0daf0 100%);
    background-attachment: fixed;
    background-size: 100% 100%;
    color: var(--text-main);
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   INSTALL
   ============================================================ */
.install-btn { background: var(--primary); color: #000; border: none; border-radius: 50px; padding: 8px 14px; font-weight: 900; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 0.78rem; }
.install-prompt { position:fixed; bottom:20px; left:16px; right:16px; background:#0e1628; border:1px solid var(--primary); color:#fff; padding:14px 18px; border-radius:18px; display:none; justify-content:space-between; align-items:center; z-index:100000; animation:slideUp .3s ease; box-shadow:0 8px 32px rgba(201,168,76,0.2); }
@keyframes slideUp { from{transform:translateY(100px);opacity:0} to{transform:translateY(0);opacity:1} }
.install-prompt button { background:var(--primary); color:#000; border:none; padding:8px 18px; border-radius:12px; font-weight:900; cursor:pointer; }

/* HS Install Button — فخم وذهبي */
.install-btn-hs {
    background: linear-gradient(135deg, #1a1400 0%, #2d2000 100%);
    border: 1.5px solid #DAA520;
    border-radius: 10px;
    padding: 4px 10px 4px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0;
    box-shadow: 0 0 10px rgba(218,165,32,0.35), inset 0 1px 0 rgba(255,215,0,0.15);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.install-btn-hs::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,215,0,0.08) 0%, transparent 60%);
    pointer-events: none;
}
.install-btn-hs:hover {
    box-shadow: 0 0 18px rgba(218,165,32,0.6), inset 0 1px 0 rgba(255,215,0,0.2);
    border-color: #FFD700;
    transform: translateY(-1px);
}
.install-btn-hs:active { transform: translateY(0); }
.hs-install-icon { display: flex; align-items: center; gap: 5px; }
.hs-install-label {
    color: #DAA520;
    font-weight: 900;
    font-size: 0.72rem;
    font-family: 'Cairo', sans-serif;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(218,165,32,0.5);
}

/* ============================================================
   LOADING — DEEP LUXURY (V32)
   ============================================================ */
#loading-screen {
    position:fixed; inset:0;
    background:
        radial-gradient(ellipse at 50% 28%, rgba(201,168,76,0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 75%, rgba(154,122,46,0.10) 0%, transparent 60%),
        linear-gradient(160deg, #05080f 0%, #0a0f1c 50%, #05080f 100%);
    z-index:190000;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:22px;
}
#loading-screen::before {
    content:''; position:absolute; inset:0;
    background: radial-gradient(circle at 50% 35%, rgba(240,208,112,0.08) 0%, transparent 40%);
    pointer-events:none;
}
.ld-logo {
    width:108px; height:108px;
    background:
        linear-gradient(145deg, #f0d070 0%, #e8c96a 25%, #C9A84C 55%, #a07830 100%);
    border-radius:28px;
    display:flex; align-items:center; justify-content:center;
    font-family:'Cairo','Arial Black',sans-serif;
    font-weight:900; font-size:2.7rem; color:#1a1100;
    letter-spacing:2px;
    animation:pulse 1.6s infinite ease-in-out;
    box-shadow:
        0 0 0 2px rgba(201,168,76,0.45),
        0 0 0 8px rgba(201,168,76,0.12),
        0 12px 50px rgba(201,168,76,0.50),
        0 4px 14px rgba(0,0,0,0.7),
        inset 0 2px 0 rgba(255,255,255,0.55),
        inset 0 -2px 0 rgba(0,0,0,0.25);
    text-shadow: 0 1px 0 rgba(255,255,255,0.35), 0 -1px 0 rgba(0,0,0,0.25);
    position:relative; z-index:2;
}
@keyframes pulse {
    0%,100% { transform:scale(1); box-shadow: 0 0 0 2px rgba(201,168,76,0.45), 0 0 0 8px rgba(201,168,76,0.12), 0 12px 50px rgba(201,168,76,0.5), inset 0 2px 0 rgba(255,255,255,0.55); }
    50%    { transform:scale(1.06); box-shadow: 0 0 0 2px rgba(240,208,112,0.6), 0 0 0 14px rgba(201,168,76,0.18), 0 18px 70px rgba(240,208,112,0.7), inset 0 2px 0 rgba(255,255,255,0.7); }
}
#loading-screen h2 {
    color:#f0d070; font-weight:900; font-size:1.1rem;
    letter-spacing:3px; text-shadow:0 2px 14px rgba(201,168,76,0.4);
    position:relative; z-index:2;
}
#loading-screen p { position:relative; z-index:2; }

/* ============================================================
   HYDRATION OVERLAY — شاشة استرداد البيانات من Firebase
   ============================================================ */
#hs-hydration-overlay {
    position: fixed;
    inset: 0;
    z-index: 195000;
}
#hs-hydration-overlay .ld-logo {
    animation: pulse 1.6s infinite ease-in-out;
}

/* ============================================================
   FORCE LOCK
   ============================================================ */
#force-lock {
    position:fixed; inset:0;
    background: radial-gradient(ellipse at 50% 35%, #0e1628, #080d1a);
    z-index:99999;
    display:none; flex-direction:column; align-items:center; justify-content:center;
    text-align:center; gap:12px; padding:30px;
}

/* ============================================================
   MAIN APP
   ============================================================ */
#main-app { display:none; flex-direction:column; height:100dvh; overflow:hidden; }

/* ============================================================
   TOP BANNER — SHIMMER GOLD
   ============================================================ */
#hs-top-banner {
    width:100%;
    background: linear-gradient(90deg, #060b14, #0e1a10, #060b14);
    border-bottom: 1px solid rgba(201,168,76,0.2);
    padding: 5px 14px;
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0;
    overflow:hidden; position:relative;
}
#hs-top-banner::after {
    content:'';
    position:absolute; top:0; left:-100%; width:50%; height:100%;
    background: linear-gradient(90deg, transparent, rgba(201,168,76,0.12), transparent);
    animation: shine 2.5s infinite linear;
}
@keyframes shine { to{left:200%} }
#hs-top-banner span { color: var(--gold1); font-weight:900; font-size:0.8rem; letter-spacing:2.5px; }

/* ============================================================
   HEADER — DEEP LUXURY
   ============================================================ */
header {
    height:var(--header-h); min-height:var(--header-h); flex-shrink:0;
    display:flex; justify-content:space-between; align-items:center;
    padding:0 14px;
    background: linear-gradient(180deg, #1a7fc4 0%, #1268a8 100%);
    border-bottom: 1px solid rgba(26,127,196,0.3);
    z-index:1000;
    box-shadow: 0 4px 20px rgba(26,127,196,0.3), 0 1px 0 rgba(255,255,255,0.1);
}
body.dark-mode header {
    background: linear-gradient(180deg, #0b1120 0%, #080e1c 100%);
    border-bottom-color: rgba(201,168,76,0.12);
    box-shadow: 0 4px 30px rgba(0,0,0,0.7), 0 1px 0 rgba(201,168,76,0.08);
}
/* في الـ header الأزرق، نص اسم المتجر والساعة يكون أبيض */
header #owner-header { color: #fff !important; text-shadow: 0 1px 4px rgba(0,0,0,0.3); }
header #clock-header { color: rgba(255,255,255,0.9) !important; background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); }
body.dark-mode header #owner-header { color: var(--primary) !important; text-shadow: 0 0 30px rgba(201,168,76,0.4); }
body.dark-mode header #clock-header { color: var(--primary-light) !important; background: rgba(201,168,76,0.06); border-color: rgba(201,168,76,0.12); }
/* === HS LOGO — PREMIUM EMBOSSED GOLD (V32) === */
.logo-hs {
    width:54px; height:54px;
    background:
        linear-gradient(145deg, #f5db8a 0%, #f0d070 22%, #d4b25a 45%, #C9A84C 65%, #8a6826 100%);
    border-radius:16px;
    display:flex; align-items:center; justify-content:center;
    font-family:'Cairo','Arial Black',sans-serif;
    font-weight:900; font-size:1.35rem; color:#1a1100;
    cursor:pointer;
    transition:all .25s cubic-bezier(.34,1.56,.64,1);
    letter-spacing:1.5px;
    position:relative;
    overflow:hidden;
    text-shadow: 0 1px 0 rgba(255,255,255,0.45), 0 -1px 0 rgba(0,0,0,0.3);
    box-shadow:
        0 0 0 1.5px rgba(240,208,112,0.55),
        0 0 0 3.5px rgba(0,0,0,0.85),
        0 0 0 4.5px rgba(201,168,76,0.35),
        0 8px 28px rgba(201,168,76,0.55),
        0 2px 8px rgba(0,0,0,0.6),
        inset 0 2px 0 rgba(255,255,255,0.55),
        inset 0 -2px 0 rgba(0,0,0,0.25);
}
.logo-hs::after {
    content:''; position:absolute; top:-50%; left:-60%; width:40%; height:200%;
    background: linear-gradient(105deg, transparent, rgba(255,255,255,0.45), transparent);
    animation: hs-shine 3s infinite;
}
@keyframes hs-shine { 0%{left:-60%} 60%,100%{left:140%} }
.logo-hs:hover {
    transform:scale(1.08);
    box-shadow:
        0 0 0 2px rgba(240,208,112,0.7),
        0 0 0 4px rgba(0,0,0,0.85),
        0 0 0 5.5px rgba(240,208,112,0.45),
        0 12px 36px rgba(240,208,112,0.7),
        0 2px 8px rgba(0,0,0,0.6),
        inset 0 2px 0 rgba(255,255,255,0.65);
}
.logo-hs:active { transform:rotate(8deg) scale(0.92); }
#owner-header { flex:1; text-align:center; font-weight:900; color:var(--primary); font-size:1rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding:0 10px; text-shadow: 0 0 30px rgba(201,168,76,0.4); }
#clock-header { min-width:80px; text-align:center; flex-shrink:0; color:var(--primary-light); font-weight:700; font-size:0.82rem; background:rgba(201,168,76,0.06); padding:7px 12px; border-radius:12px; border:1px solid rgba(201,168,76,0.12); letter-spacing:1px; }

/* ============================================================
   CAMERA
   ============================================================ */
#camera-area {
    height:var(--cam-h); min-height:130px; max-height:260px; flex-shrink:0;
    position:relative; background:#000;
    margin:10px 12px 0; border-radius:20px; overflow:hidden;
    border: 1px solid rgba(201,168,76,0.18);
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}
#video { width:100%; height:100%; object-fit:cover; display:block; filter:grayscale(100%) contrast(160%) brightness(1.1); }
.laser { position:absolute; width:100%; height:2px; background:linear-gradient(90deg,transparent 0%,#ff2020 20%,#ff6060 50%,#ff2020 80%,transparent 100%); top:50%; animation:laserScan 1.5s infinite ease-in-out; z-index:10; box-shadow:0 0 8px #ff0000,0 0 20px rgba(255,0,0,0.3); pointer-events:none; }
@keyframes laserScan { 0%,100%{top:15%;opacity:.7} 50%{top:85%;opacity:1} }
.scan-frame { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:55%; height:65%; border:1.5px solid rgba(201,168,76,0.5); border-radius:12px; pointer-events:none; z-index:9; }
.cam-tools { position:absolute; right:10px; bottom:10px; display:flex; flex-direction:column; gap:8px; z-index:20; }
.tool-btn { width:42px; height:42px; border-radius:12px; background:rgba(0,0,0,0.65); border:1px solid rgba(255,255,255,0.12); display:flex; align-items:center; justify-content:center; font-size:1.2rem; cursor:pointer; backdrop-filter:blur(10px); transition:all .2s; }
.tool-btn:active { transform:scale(.86); background:rgba(201,168,76,0.2); }
#cam-status { position:absolute; bottom:0; left:0; right:0; background:linear-gradient(transparent,rgba(0,0,0,0.8)); color:rgba(255,255,255,0.75); font-size:0.67rem; font-weight:700; text-align:center; padding:10px 4px 4px; z-index:15; }

/* ============================================================
   CART — RICH DARK
   ============================================================ */
.cart-container {
    flex:1; min-height:0; overflow-y:auto;
    margin:8px 12px 0; padding:8px;
    background: rgba(255,255,255,0.85);
    border-radius:18px;
    border: 1px solid rgba(26,127,196,0.18);
}
body.dark-mode .cart-container {
    background: rgba(8,13,26,0.98);
    border-color: rgba(255,255,255,0.05);
}
.cart-container::-webkit-scrollbar { width:8px; }
.cart-container::-webkit-scrollbar-track { background:transparent; border-radius:4px; }
.cart-container::-webkit-scrollbar-thumb { background:var(--border); border-radius:4px; transition:background 0.2s, width 0.2s; }
.cart-container::-webkit-scrollbar-thumb:hover { background:var(--primary); width:10px; }
.cart-container { scrollbar-width:thin; scrollbar-color:var(--border) transparent; }

/* ✅ V32 UX: شريط تمرير أعرض وأوضح على الكمبيوتر — أسهل في الإمساك بالماوس */
@media (min-width:1200px){
    .cart-container::-webkit-scrollbar,
    .sidebar-menu::-webkit-scrollbar { width:14px; }
    .cart-container::-webkit-scrollbar-track,
    .sidebar-menu::-webkit-scrollbar-track { background:rgba(255,255,255,0.04); border-radius:8px; margin:6px 0; }
    .cart-container::-webkit-scrollbar-thumb,
    .sidebar-menu::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, var(--gold2), var(--primary));
        border-radius:8px;
        border:3px solid var(--surface);
        min-height:40px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }
    .cart-container::-webkit-scrollbar-thumb:hover,
    .sidebar-menu::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, var(--primary), var(--gold3));
        width:14px;
        border-width:2px;
    }
    .cart-container::-webkit-scrollbar-thumb:active,
    .sidebar-menu::-webkit-scrollbar-thumb:active {
        background: var(--gold3);
    }
    .cart-container, .sidebar-menu { scrollbar-width:auto; scrollbar-color:var(--primary) rgba(255,255,255,0.04); }
}
.cart-row {
    display:flex; justify-content:space-between; align-items:center;
    padding:11px 14px;
    background: linear-gradient(90deg, #ffffff 0%, #f0f8ff 100%);
    margin-bottom:5px; border-radius:13px;
    border: 1px solid rgba(26,127,196,0.15);
    border-right: 3px solid var(--primary);
    transition:background .15s;
}
.cart-row:active { background: rgba(26,127,196,0.07); }
body.dark-mode .cart-row { background: linear-gradient(90deg, #101828 0%, #0e1626 100%); border-color: rgba(255,255,255,0.05); }
.cart-row .item-name { font-size:0.92rem; color:var(--text-main); word-break:break-word; flex:2; }
.cart-row .item-price { font-weight:900; color:var(--primary); font-size:0.98rem; white-space:nowrap; }

/* ============================================================
   BOTTOM PANEL — PREMIUM DARK
   ============================================================ */
.bottom-panel {
    flex-shrink:0;
    background: linear-gradient(180deg, #d0e8f8 0%, #c0daf0 100%);
    border-top: 1px solid rgba(26,127,196,0.2);
    padding:10px 12px;
    padding-bottom:max(10px,env(safe-area-inset-bottom));
}
body.dark-mode .bottom-panel {
    background: linear-gradient(180deg, #080d1a 0%, #060a14 100%);
    border-top-color: rgba(201,168,76,0.1);
}
.undo-btn {
    width:100%; height:40px;
    background:rgba(229,62,62,0.08);
    border:1px solid rgba(229,62,62,0.25);
    border-radius:12px; color:#f87171;
    font-weight:900; font-size:0.88rem;
    cursor:pointer; margin-bottom:8px;
    display:flex; align-items:center; justify-content:center; gap:8px;
    transition:all .2s;
}
.undo-btn:active { background:rgba(229,62,62,0.2); transform:scale(.98); }
.total-price { font-size:2.5rem; font-weight:900; color:#0fa871; text-align:center; line-height:1; margin-bottom:10px; text-shadow:0 0 28px rgba(15,168,113,0.35); }
.total-price small { font-size:1rem; color:var(--text-sub); font-weight:700; }
.btn-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; }

/* Buttons — Premium */
.btn {
    border:none; border-radius:16px;
    font-weight:900; height:56px;
    cursor:pointer;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
    font-size:0.9rem;
    transition:all .18s cubic-bezier(.4,0,.2,1);
    position:relative; overflow:hidden;
}
.btn::before {
    content:'';
    position:absolute; inset:0;
    background:linear-gradient(180deg,rgba(255,255,255,0.1) 0%,transparent 60%);
    pointer-events:none;
}
.btn:active { transform:scale(.92); filter:brightness(.85); }
.btn-icon { font-size:1.3rem; line-height:1; }
.btn-label { font-size:0.8rem; font-weight:900; letter-spacing:.3px; }

.btn-cash {
    background: linear-gradient(145deg, #0a4a2e, #0fa871);
    color:#fff;
    box-shadow: 0 6px 20px rgba(15,168,113,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-monthly {
    background: linear-gradient(145deg, #7a5c18, #C9A84C);
    color:#000;
    box-shadow: 0 6px 20px rgba(201,168,76,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-edit {
    background: linear-gradient(145deg, #8a4210, #e8740a);
    color:#000;
    box-shadow: 0 6px 20px rgba(232,116,10,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ============================================================
   SIDEBAR OVERLAY
   ============================================================ */
#sidebar-overlay {
    display:none;
    position:fixed; inset:0;
    background:rgba(0,0,0,0.82);
    z-index:9999;
    animation:fadeIn .25s ease;
    /* GPU acceleration */
    will-change: opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* ============================================================
   SIDEBAR — GPU-ACCELERATED + LUXURY
   FIX: تهنيج الفتح ← will-change + translateZ(0) + contain
   ============================================================ */
#sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 78%;
    max-width: 290px;
    height: 100%;
    /* Light mode background */
    background: linear-gradient(160deg, #e0f0fc 0%, #cce4f8 60%, #b8d8f4 100%);
    z-index: 10000;
    border-left: 1px solid rgba(26,127,196,0.2);
    display: flex;
    flex-direction: column;
    box-shadow: none;
    
    /* ✅ FIX التهنيج — GPU-only animation (transform فقط بدل right) */
    will-change: transform;
    transform: translateX(108%) translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    contain: layout style;
    
    /* transition على transform فقط — أسرع بكثير على الـ GPU */
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
body.dark-mode #sidebar {
    background: linear-gradient(160deg, #0d1525 0%, #0b1220 60%, #090e1a 100%);
    border-left-color: rgba(201,168,76,0.15);
}

/* ✅ V32 FIX: الستارة أكبر على شاشات الكمبيوتر */
@media (min-width: 768px) {
    #sidebar {
        width: 340px;
        max-width: 340px;
    }
}
@media (min-width: 1024px) {
    #sidebar {
        width: 380px;
        max-width: 380px;
    }
}
#sidebar.active {
    transform: translateX(0) translateZ(0);
    box-shadow: -24px 0 80px rgba(0,0,0,0.85), -1px 0 0 rgba(201,168,76,0.08);
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px 16px 16px;
    display:flex; justify-content:space-between; align-items:center;
    background: linear-gradient(135deg, rgba(201,168,76,0.08) 0%, rgba(0,0,0,0) 100%);
    border-bottom: 1px solid rgba(201,168,76,0.1);
    flex-shrink:0;
}
.sidebar-brand { display:flex; align-items:center; gap:12px; }
.sidebar-logo {
    width:50px; height:50px;
    background: linear-gradient(145deg, #f5db8a 0%, #f0d070 25%, #C9A84C 60%, #8a6826 100%);
    border-radius:14px;
    display:flex; align-items:center; justify-content:center;
    font-family:'Cairo','Arial Black',sans-serif;
    font-weight:900; font-size:1.2rem; color:#1a1100;
    letter-spacing:1.5px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.45), 0 -1px 0 rgba(0,0,0,0.3);
    box-shadow:
        0 0 0 1.5px rgba(240,208,112,0.4),
        0 0 0 3px rgba(0,0,0,0.75),
        0 6px 22px rgba(201,168,76,0.5),
        inset 0 2px 0 rgba(255,255,255,0.55),
        inset 0 -2px 0 rgba(0,0,0,0.25);
    flex-shrink:0;
}
.sidebar-title { font-weight:900; font-size:1rem; color:var(--primary); line-height:1.2; }
.sidebar-version { font-size:0.68rem; color:var(--text-sub); font-weight:700; margin-top:2px; }
.sidebar-close-btn {
    width:36px; height:36px;
    background:rgba(229,62,62,0.08);
    border:1px solid rgba(229,62,62,0.22);
    border-radius:10px; color:#f87171;
    font-size:1rem; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    transition:all .2s;
}
.sidebar-close-btn:active { background:rgba(229,62,62,0.22); transform:scale(.9); }

/* Sidebar Menu */
.sidebar-menu { flex:1; overflow-y:auto; padding:8px 0 16px; }
.sidebar-menu::-webkit-scrollbar { width:8px; }
.sidebar-menu::-webkit-scrollbar-track { background:transparent; border-radius:4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background:rgba(201,168,76,0.3); border-radius:4px; transition:background 0.2s, width 0.2s; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background:var(--primary); width:10px; }
.sidebar-menu { scrollbar-width:thin; scrollbar-color:rgba(201,168,76,0.3) transparent; }

/* Section label */
.menu-section-label {
    padding:14px 18px 6px;
    font-size:0.65rem; font-weight:900;
    color:var(--text-sub);
    letter-spacing:2px;
    text-transform:uppercase;
}

/* Menu Item */
.menu-item {
    display:flex; align-items:center; gap:13px;
    padding:10px 16px;
    cursor:pointer;
    transition: background .18s ease;
    margin:2px 8px;
    border-radius:12px;
}
/* ✅ V32 FIX: أحجام أفضل على الكمبيوتر */
@media (min-width: 768px) {
    .menu-item { padding:13px 18px; gap:16px; }
    .menu-title { font-size:0.95rem !important; }
    .menu-sub   { font-size:0.72rem !important; }
    .menu-icon  { width:46px !important; height:46px !important; font-size:1.1rem !important; }
    .sidebar-header { padding:24px 20px 20px; }
    .sidebar-logo { width:52px !important; height:52px !important; font-size:1.2rem !important; }
    .sidebar-title { font-size:1.1rem !important; }
}
.menu-item:active, .menu-item:hover {
    background: rgba(201,168,76,0.05);
}
.menu-item:active .menu-icon { transform:scale(.9); }

/* Icon bubble */
.menu-icon {
    width:40px; height:40px; border-radius:12px;
    display:flex; align-items:center; justify-content:center;
    font-size:1rem; color:#fff;
    flex-shrink:0;
    transition:transform .2s;
    box-shadow:0 3px 10px rgba(0,0,0,0.4);
}
.menu-text { flex:1; display:flex; flex-direction:column; gap:1px; min-width:0; }
.menu-title { font-size:0.88rem; font-weight:900; color:var(--text-main); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.menu-sub { font-size:0.65rem; color:var(--text-sub); font-weight:600; }
.menu-arrow { color:var(--text-sub); font-size:0.65rem; flex-shrink:0; opacity:.4; }

/* Danger item */
.menu-item-danger { margin-top:6px; }
.menu-item-danger .menu-title { color:#f87171; }
.menu-item-danger .menu-sub { color:rgba(248,113,113,0.55); }

/* Sidebar Footer */
.sidebar-footer {
    padding:12px 18px;
    border-top: 1px solid rgba(201,168,76,0.1);
    display:flex; justify-content:space-between; align-items:center;
    font-size:0.65rem; font-weight:700; color:var(--text-sub);
    flex-shrink:0;
    background: rgba(201,168,76,0.02);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,20,0.82); display:none; z-index:20000; align-items:center; justify-content:center; padding:12px; }
.custom-modal { background: linear-gradient(160deg, #f0f8ff 0%, #e0f0fc 100%); border:1px solid rgba(26,127,196,0.25); width:100%; max-width:500px; border-radius:24px; padding:24px; display:flex; flex-direction:column; gap:14px; max-height:88vh; overflow-y:auto; box-shadow: 0 32px 80px rgba(0,0,80,0.3), 0 0 0 1px rgba(26,127,196,0.1); }
body.dark-mode .modal-overlay { background:rgba(0,0,0,0.88); }
body.dark-mode .custom-modal { background: linear-gradient(160deg, #0e1628 0%, #0a1020 100%); border-color:rgba(201,168,76,0.2); box-shadow: 0 32px 80px rgba(0,0,0,0.97), 0 0 0 1px rgba(201,168,76,0.08), 0 0 60px rgba(201,168,76,0.06); }
/* modal title */
#modal-title { color: var(--primary); }
/* input باسورد فاخر داخل المودال */
.custom-modal input[type="password"],
.custom-modal input[type="text"],
.custom-modal input[type="number"] {
    width:100%;
    background:rgba(255,255,255,0.04);
    border:1.5px solid rgba(201,168,76,0.25);
    border-radius:14px;
    color:var(--text-main);
    padding:14px 16px;
    font-size:1rem;
    font-family:'Cairo',sans-serif;
    transition:border-color .2s, box-shadow .2s;
    outline:none;
}
.custom-modal input[type="password"]:focus,
.custom-modal input[type="text"]:focus,
.custom-modal input[type="number"]:focus {
    border-color:var(--primary);
    box-shadow:0 0 0 3px rgba(201,168,76,0.15);
}
input, select { width:100%; padding:14px; background:rgba(255,255,255,0.85); border:1.5px solid rgba(26,127,196,0.25); color:var(--text-main); border-radius:13px; text-align:center; outline:none; font-size:1.05rem; font-weight:700; transition:all .2s; }
input:focus { border-color:var(--primary); background:#fff; box-shadow:0 0 0 3px rgba(26,127,196,0.12); }
input::placeholder { color:var(--text-sub); }
body.dark-mode input, body.dark-mode select { background:rgba(255,255,255,0.04); border-color:rgba(201,168,76,0.15); }
body.dark-mode input:focus { background:rgba(201,168,76,0.05); box-shadow:0 0 0 3px rgba(201,168,76,0.1); }

/* ============================================================
   REPORT BOX
   ============================================================ */
.report-box { background:rgba(255,255,255,0.02); padding:8px; border-radius:14px; max-height:60vh; overflow-y:auto; width:100%; border:1px solid var(--border-subtle); }
.report-box table { width:100%; border-collapse:collapse; }
.report-box th { background:rgba(201,168,76,0.1); color:var(--primary); padding:10px; font-weight:900; border:1px solid var(--border); position:sticky; top:0; font-size:0.8rem; }
.report-box td { padding:8px; text-align:center; border:1px solid var(--border-subtle); font-size:0.77rem; color:var(--text-main); }

/* ============================================================
   MISC COMPONENTS
   ============================================================ */
#sleep-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.97); z-index:150000; display:none; flex-direction:column; align-items:center; justify-content:center; cursor:pointer; color:#fff; }
.offline-badge { position:fixed; top:68px; left:14px; padding:4px 12px; border-radius:20px; font-size:0.67rem; font-weight:900; z-index:999; display:none; }
.offline-active { display:block !important; background:var(--accent); color:#000; }
.new-customer-badge { position:fixed; top:68px; right:14px; padding:7px 16px; border-radius:20px; font-size:0.85rem; font-weight:900; z-index:999; display:none; background:var(--success); color:#fff; animation:slideIn .4s ease; }
@keyframes slideIn { from{transform:translateX(250px);opacity:0} to{transform:translateX(0);opacity:1} }
#receipt-print-area { position:fixed; left:-9999px; top:-9999px; background:#fff; color:#000; direction:rtl; width:300px; padding:20px; }
#sync-dot { position:fixed; bottom:8px; left:8px; width:10px; height:10px; border-radius:50%; background:var(--success); z-index:9999; box-shadow:0 0 8px var(--success); }
#sync-dot.syncing { animation:syncPulse .8s infinite; }
#sync-dot.offline { background:var(--accent); box-shadow:0 0 8px var(--accent); }
@keyframes syncPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(1.7)} }
.toast-notification { position:fixed; bottom:125px; left:50%; transform:translateX(-50%) translateY(100px); background:var(--success); color:#fff; padding:10px 24px; border-radius:50px; font-weight:900; z-index:200000; opacity:0; transition:all .3s; pointer-events:none; white-space:nowrap; box-shadow:0 8px 24px rgba(0,0,0,0.5); }
.toast-notification.show { transform:translateX(-50%) translateY(0); opacity:1; }
.toast-notification.error { background:var(--danger); }
.toast-notification.warning { background:var(--accent); color:#000; }
.scanner-badge { position:fixed; bottom:65px; right:14px; background:var(--primary); color:#000; padding:5px 12px; border-radius:20px; font-size:0.67rem; font-weight:900; z-index:999; display:none; }
.scanner-badge.active { display:block; }

/* ============================================================
   ACCOUNTANT BTN & DASHBOARD
   ============================================================ */
#act-as-accountant-btn { display:none; background:rgba(201,168,76,0.08); border:1px solid rgba(201,168,76,0.3); border-radius:12px; color:var(--primary); font-weight:900; font-size:0.74rem; padding:7px 11px; cursor:pointer; white-space:nowrap; font-family:'Cairo',sans-serif; transition:all .2s; }
#act-as-accountant-btn:active { background:rgba(201,168,76,0.2); }
#accountant-dashboard { display:none; height:var(--cam-h); min-height:130px; max-height:260px; flex-shrink:0; margin:10px 12px 0; border-radius:20px; background:linear-gradient(135deg,#060c18,#0c1420); border:1px solid rgba(201,168,76,0.12); padding:14px 12px; flex-direction:column; justify-content:center; gap:10px; }
.acc-dash-title { color:var(--primary); font-weight:900; font-size:0.85rem; text-align:center; }
.acc-dash-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.acc-dash-btn { background:rgba(201,168,76,0.05); border:1px solid rgba(201,168,76,0.15); border-radius:14px; color:var(--text-main); font-weight:900; font-size:0.7rem; padding:9px 4px; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:5px; transition:all .18s; font-family:'Cairo',sans-serif; }
.acc-dash-btn:active { background:rgba(201,168,76,0.18); transform:scale(.94); }
.acc-dash-btn i { font-size:1.2rem; color:var(--primary); }

/* ============================================================
   SYNC FAB — زرار المزامنة اليدوية
   ============================================================ */
#sync-fab {
    position:fixed; bottom:158px; left:18px;
    width:52px; height:52px; border-radius:50%;
    background: linear-gradient(135deg, #1a7fc4, #0e4d8a);
    color:#fff; font-size:1.15rem;
    display:flex; align-items:center; justify-content:center;
    cursor:pointer; z-index:9000;
    box-shadow: 0 6px 22px rgba(26,127,196,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
    border:none; transition:all .18s; user-select:none;
    -webkit-tap-highlight-color: transparent;
}
#sync-fab:active { transform:scale(.88); }
#sync-fab.syncing {
    background: linear-gradient(135deg, #0e9c6a, #076b48);
    box-shadow: 0 6px 22px rgba(14,156,106,0.5);
}
#sync-fab.syncing #sync-fab-icon { animation: spinIcon .7s linear infinite; }
#sync-fab.has-pending {
    background: linear-gradient(135deg, #d97706, #92400e);
    box-shadow: 0 6px 22px rgba(217,119,6,0.5);
    animation: pendingPulse 1.8s ease-in-out infinite;
}
#sync-fab.offline-state {
    background: linear-gradient(135deg, #555, #333);
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    opacity: 0.82;
}
#sync-fab-badge {
    position:absolute; top:-4px; right:-4px;
    background:#ef4444; color:#fff;
    font-size:0.62rem; font-weight:900;
    border-radius:50%; width:18px; height:18px;
    display:flex; align-items:center; justify-content:center;
    border:2px solid var(--bg);
    font-family:Cairo,sans-serif;
}
@keyframes spinIcon { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes pendingPulse {
    0%,100%{box-shadow:0 6px 22px rgba(217,119,6,0.5)}
    50%{box-shadow:0 6px 32px rgba(217,119,6,0.9),0 0 0 6px rgba(217,119,6,0.15)}
}

/* ============================================================
   PRINTER FAB
   ============================================================ */

#printer-fab {
    position:fixed; bottom:110px; left:18px;
    width:52px; height:52px; border-radius:50%;
    background: linear-gradient(135deg, #C9A84C, #9a7a2e);
    color:#000; font-size:1.2rem;
    display:flex; align-items:center; justify-content:center;
    cursor:pointer; z-index:9000;
    box-shadow: 0 6px 22px rgba(201,168,76,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    border:none; transition:all .18s; user-select:none;
}
#printer-fab:active { transform:scale(.88); }
#printer-menu { position:fixed; bottom:155px; left:12px; z-index:9001; display:flex; flex-direction:column; gap:7px; animation:fadeInUp .2s ease; }
.printer-menu-btn { background: #fff; border:1px solid rgba(26,127,196,0.2); color:var(--text-main); border-radius:14px; padding:10px 18px; font-family:Cairo,sans-serif; font-size:0.88rem; font-weight:700; cursor:pointer; white-space:nowrap; box-shadow:0 4px 20px rgba(26,127,196,0.15); direction:rtl; display:flex; align-items:center; gap:8px; transition:all .2s; }
.printer-menu-btn i { color:var(--primary); }
.printer-menu-btn:active { background:rgba(26,127,196,0.07); }
body.dark-mode .printer-menu-btn { background: #0d1525; border-color:rgba(201,168,76,0.12); box-shadow:0 4px 20px rgba(0,0,0,0.6); }
@keyframes fadeInUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

/* ============================================================
   DASHBOARD & TABLES
   ============================================================ */
.dashboard-stats { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:15px; }
.stat-card { background: linear-gradient(135deg, #0e1628, #0b1220); border:1px solid rgba(201,168,76,0.12); border-radius:14px; padding:12px; text-align:center; }
.stat-card h4 { font-size:0.73rem; color:var(--text-sub); }
.stat-card .value { font-size:1.4rem; font-weight:900; color:var(--primary); }
.debt-warning { color:var(--accent) !important; font-weight:900; margin-right:8px; }
.whatsapp-btn { background:#25D366; border:none; border-radius:50%; width:30px; height:30px; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; margin-right:8px; font-size:16px; color:#fff; }
.customer-name-cell { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.qty-input-group { display:flex; gap:8px; align-items:center; justify-content:center; flex-wrap:wrap; }
.qty-input-group input { width:70px; padding:6px; font-size:14px; }
.qty-input-group button { background:var(--primary); border:none; color:#000; padding:6px 12px; border-radius:8px; cursor:pointer; font-weight:900; }
.inventory-search { margin-bottom:12px; padding:8px; border-radius:12px; border:1px solid rgba(201,168,76,0.12); width:100%; }
.low-stock-row { background:rgba(232,162,20,0.08) !important; }
.out-stock-row { background:rgba(229,62,62,0.08) !important; }
.inventory-summary { display:flex; justify-content:space-between; padding:10px; background: linear-gradient(135deg, #C9A84C, #9a7a2e); color:#000; border-radius:12px; margin-bottom:12px; font-weight:900; flex-wrap:wrap; gap:8px; }
.btn-excel { background:#1e7e34 !important; margin-top:8px; }

/* ============================================================
   BARCODE & EXPORT
   ============================================================ */
.barcode-preview { background:#fff; padding:15px; text-align:center; border-radius:12px; margin:10px 0; }
.print-barcode-btn { background:var(--primary); color:#000; padding:10px; border-radius:12px; cursor:pointer; text-align:center; margin-top:10px; font-weight:900; }
.export-buttons { display:flex; gap:10px; margin-top:15px; flex-wrap:wrap; }
.export-buttons button { flex:1; }

/* ============================================================
   SEARCH & TABS
   ============================================================ */
#header-search-btn { touch-action:manipulation; }
#header-search-btn:active { transform:scale(.9); }
.mc-tab-btn { touch-action:manipulation; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    body > *:not(#_hs_print_iframe) {}
}

/* ============================================================
   ACCOUNTANT DASHBOARD — PREMIUM REDESIGN (override block)
   ============================================================ */
#accountant-dashboard {
    display: none;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex-shrink: 0;
    margin: 10px 12px 0;
    border-radius: 22px;
    background: linear-gradient(135deg, #08101e 0%, #0c1820 50%, #08102a 100%);
    border: 1px solid rgba(201,168,76,0.2);
    padding: 14px 12px 12px;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.03);
    position: relative;
    overflow: hidden;
}
#accountant-dashboard::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(201,168,76,0.1) 0%, transparent 70%);
    pointer-events: none;
}
.acc-dash-title {
    color: #fff;
    font-weight: 900;
    font-size: 0.82rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(201,168,76,0.15);
}
.acc-dash-title i { color: var(--primary); font-size: 1rem; }
.acc-dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.acc-dash-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    color: #fff;
    font-weight: 900;
    font-size: 0.72rem;
    padding: 12px 6px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    font-family: 'Cairo', sans-serif;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
}
.acc-dash-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}
.acc-dash-btn:nth-child(1) { border-color: rgba(99,102,241,0.35); }
.acc-dash-btn:nth-child(1) i { color: #818cf8; background: rgba(99,102,241,0.12); }
.acc-dash-btn:nth-child(1):active { background: rgba(99,102,241,0.12); }
.acc-dash-btn:nth-child(2) { border-color: rgba(15,168,113,0.35); }
.acc-dash-btn:nth-child(2) i { color: #2de09e; background: rgba(15,168,113,0.12); }
.acc-dash-btn:nth-child(2):active { background: rgba(15,168,113,0.12); }
.acc-dash-btn:nth-child(3) { border-color: rgba(232,162,20,0.35); }
.acc-dash-btn:nth-child(3) i { color: #f5c842; background: rgba(232,162,20,0.12); }
.acc-dash-btn:nth-child(3):active { background: rgba(232,162,20,0.12); }
.acc-dash-btn:nth-child(4) { border-color: rgba(139,92,246,0.35); }
.acc-dash-btn:nth-child(4) i { color: #a78bfa; background: rgba(139,92,246,0.12); }
.acc-dash-btn:nth-child(4):active { background: rgba(139,92,246,0.12); }
.acc-dash-btn:nth-child(5) { border-color: rgba(201,168,76,0.35); }
.acc-dash-btn:nth-child(5) i { color: var(--primary); background: rgba(201,168,76,0.1); }
.acc-dash-btn:nth-child(5):active { background: rgba(201,168,76,0.12); }
.acc-dash-btn:nth-child(6) { border-color: rgba(229,62,62,0.3); }
.acc-dash-btn:nth-child(6) i { color: #f87171; background: rgba(229,62,62,0.1); }
.acc-dash-btn:nth-child(6):active { background: rgba(229,62,62,0.12); }
.acc-dash-btn:active { transform: scale(.93); border-color: rgba(255,255,255,0.15); }
.acc-dash-btn i { font-size: 1.3rem; width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; transition: transform .2s; }
.acc-dash-btn:active i { transform: scale(.88); }


/* =====================================================================
   ✨ V32 UI POLISH — تحسين نوافذ (الجرد الشهري / مخزن المحل / سجل المبيعات)
   تباين أعلى، صفوف متمايزة، عناوين أوضح، حالات ملوّنة بشكل ذكي
   ===================================================================== */

/* خلفية أعمق وأنيق لجسم النافذة */
#modal-body,
.modal-body,
.report-box {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
    color: var(--text-main);
    border-radius: 14px;
    padding: 14px 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

/* عنوان فرعي بارز داخل النوافذ */
#modal-body h2, #modal-body h3,
.modal-body h2, .modal-body h3,
.report-box h2, .report-box h3 {
    color: var(--primary-light);
    font-weight: 800;
    letter-spacing: 0.2px;
    padding: 10px 12px;
    margin: 6px 0 12px;
    border-right: 4px solid var(--primary);
    background: linear-gradient(90deg, rgba(201,168,76,0.12), transparent 70%);
    border-radius: 8px;
}

/* جداول النوافذ — صفوف متمايزة (zebra) + رؤوس واضحة */
#modal-body table,
.modal-body table,
.report-box table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
    margin: 8px 0 14px;
    font-size: 14px;
}
#modal-body table thead th,
.modal-body table thead th,
.report-box table thead th {
    background: linear-gradient(180deg, #1a2540, #131e35);
    color: var(--primary-light);
    font-weight: 800;
    padding: 11px 10px;
    text-align: center;
    border-bottom: 2px solid var(--primary-dark);
    position: sticky; top: 0; z-index: 2;
    letter-spacing: 0.3px;
}
#modal-body table tbody td,
.modal-body table tbody td,
.report-box table tbody td {
    padding: 10px 9px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
    background: transparent;
}
#modal-body table tbody tr:nth-child(odd) td,
.modal-body table tbody tr:nth-child(odd) td,
.report-box table tbody tr:nth-child(odd) td {
    background: rgba(255,255,255,0.025);
}
#modal-body table tbody tr:hover td,
.modal-body table tbody tr:hover td,
.report-box table tbody tr:hover td {
    background: rgba(201,168,76,0.10);
    color: #fff;
}
#modal-body table tbody tr:last-child td,
.modal-body table tbody tr:last-child td,
.report-box table tbody tr:last-child td { border-bottom: 0; }

/* عمود الإجمالي/المبلغ — بارز بلون ذهبي */
#modal-body table td.amount,
#modal-body table td.total,
.report-box td.amount,
.report-box td.total {
    color: var(--primary-light);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* صف الإجمالي العام في آخر الجدول */
#modal-body table tfoot td,
.modal-body table tfoot td,
.report-box table tfoot td {
    background: linear-gradient(180deg, #1a2540, #0e1628);
    color: var(--primary-light);
    font-weight: 900;
    font-size: 15px;
    border-top: 2px solid var(--primary);
    padding: 12px 10px;
}

/* كروت الإحصائيات أعلى نوافذ التقارير */
.report-box .stat-row,
#modal-body .stat-row,
.modal-body .stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 6px 0 14px;
}
.report-box .stat-card,
#modal-body .stat-card,
.modal-body .stat-card {
    background: linear-gradient(160deg, #131e35, #0e1628);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    position: relative;
    overflow: hidden;
}
.report-box .stat-card::before,
#modal-body .stat-card::before,
.modal-body .stat-card::before {
    content: "";
    position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
}
.report-box .stat-card .label,
#modal-body .stat-card .label,
.modal-body .stat-card .label {
    color: var(--text-sub);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}
.report-box .stat-card .value,
#modal-body .stat-card .value,
.modal-body .stat-card .value {
    color: var(--primary-light);
    font-size: 20px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* بطاقات الجرد (inv-cards-list) — تباين أعلى + حالة ملوّنة */
.inv-cards-list .inv-card,
.inv-card {
    background: linear-gradient(160deg, #131e35, #0e1628);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    transition: transform .15s ease, border-color .15s ease;
}
.inv-card:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
}
.inv-card .inv-name {
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 6px;
}
.inv-card .inv-meta {
    color: var(--text-sub);
    font-size: 12px;
}
.inv-card .inv-qty {
    color: var(--primary-light);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* حالات الكمية (out / low / ok) */
.inv-card.status-out,
tr.status-out td { background: rgba(229,62,62,0.10) !important; }
.inv-card.status-low,
tr.status-low td { background: rgba(232,162,20,0.10) !important; }
.inv-card.status-ok { border-color: rgba(15,168,113,0.35); }

.badge-out { background: var(--danger); color: #fff; padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: 11px; }
.badge-low { background: var(--accent); color: #1b1100; padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: 11px; }
.badge-ok  { background: var(--success); color: #fff; padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: 11px; }

/* أزرار التحكم داخل النوافذ — حجم ولمسة أوضح على الموبايل */
#modal-body .inv-qty-btn,
.modal-body .inv-qty-btn,
.inv-qty-btn {
    min-width: 38px; min-height: 38px;
    border-radius: 10px; border: 0;
    font-weight: 800; font-size: 15px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
    transition: transform .1s ease, filter .15s ease;
}
.inv-qty-btn:active { transform: scale(.95); }
.inv-qty-btn:hover { filter: brightness(1.1); }
.inv-del-btn { background: var(--danger) !important; color: #fff; }

/* سجل المبيعات — تمييز الإجمالي والمنتجات داخل الصف */
.sales-log-row .sale-total,
.sales-row .sale-total {
    color: var(--primary-light);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}
.sales-log-row .sale-items,
.sales-row .sale-items {
    color: var(--text-sub);
    font-size: 12px;
}

/* تحسين خفيف للـ scrollbar داخل النوافذ */
#modal-body::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.report-box::-webkit-scrollbar { width: 8px; height: 8px; }
#modal-body::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.report-box::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    border-radius: 8px;
}
#modal-body::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.report-box::-webkit-scrollbar-track { background: rgba(0,0,0,0.25); }

/* قسم العنوان داخل النافذة (إن وُجد) */
.modal-section-title {
    color: var(--primary-light);
    font-size: 14px;
    font-weight: 800;
    margin: 12px 4px 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(201,168,76,0.25);
}

/* ============================================================
   QUICK ACTIONS PANEL - للمساعد والمدير الثانوي على الكمبيوتر
   ============================================================ */
#quick-actions-panel {
    display:none;
    flex-direction:column;
    justify-content:center;
    gap:16px;
    padding:28px 24px;
    background:linear-gradient(160deg,rgba(8,13,26,0.97) 0%,rgba(12,18,36,0.97) 100%);
    border:1px solid rgba(201,168,76,0.2);
    border-radius:24px;
    backdrop-filter:blur(16px);
    box-shadow:0 8px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
    position:relative;
    overflow:hidden;
}
#quick-actions-panel::before {
    content:'';
    position:absolute;
    top:0; left:0; right:0;
    height:2px;
    background:linear-gradient(90deg,transparent,#DAA520,transparent);
    opacity:0.6;
}
.qa-header {
    display:flex;
    align-items:center;
    gap:10px;
    color:var(--primary);
    font-family:Cairo,sans-serif;
    font-size:0.85rem;
    font-weight:900;
    letter-spacing:2px;
    text-transform:uppercase;
    opacity:0.7;
    padding-bottom:4px;
    border-bottom:1px solid rgba(201,168,76,0.1);
    direction:rtl;
}
.qa-header i { font-size:0.9rem; }
.qa-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
}
.qa-btn {
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:10px;
    padding:18px 12px;
    border:none;
    border-radius:18px;
    font-family:Cairo,sans-serif;
    font-size:0.92rem;
    font-weight:900;
    cursor:pointer;
    transition:all .2s cubic-bezier(.34,1.56,.64,1);
    direction:rtl;
    position:relative;
    overflow:hidden;
    border:1px solid rgba(255,255,255,0.07);
}
.qa-btn::after {
    content:'';
    position:absolute;
    inset:0;
    background:linear-gradient(160deg,rgba(255,255,255,0.08) 0%,transparent 60%);
    pointer-events:none;
}
.qa-btn i { font-size:1.6rem; }
.qa-btn span { font-size:0.88rem; line-height:1.2; text-align:center; }
.qa-btn:hover { transform:translateY(-3px) scale(1.03); box-shadow:0 10px 28px rgba(0,0,0,0.5); }
.qa-btn:active { transform:scale(.95); }
.qa-btn-wide { grid-column:1 / -1; flex-direction:row; gap:14px; padding:16px 24px; justify-content:center; }
.qa-btn-wide i { font-size:1.4rem; }
.qa-btn-logout   { background:linear-gradient(135deg,#7f1d1d,#b91c1c); color:#fff; box-shadow:0 4px 18px rgba(185,28,28,0.35); }
.qa-btn-dark     { background:linear-gradient(135deg,#1e293b,#334155); color:#fff; box-shadow:0 4px 18px rgba(30,41,59,0.5); }
.qa-btn-pay      { background:linear-gradient(135deg,#14532d,#15803d); color:#fff; box-shadow:0 4px 18px rgba(21,128,61,0.35); }
.qa-btn-customer { background:linear-gradient(135deg,#1e3a5f,#1d4ed8); color:#fff; box-shadow:0 4px 18px rgba(29,78,216,0.35); }
.qa-btn-catalog  { background:linear-gradient(135deg,#DAA520,#9a7a2e); color:#000; box-shadow:0 4px 18px rgba(218,165,32,0.4); font-weight:900; }
