/* ══════════════════════════════════════════
   MAIN STYLES
══════════════════════════════════════════ */

/* Clean v2 FIXED: single real CSS layer; JS/print template styles untouched. */
:root {
  --navy:   #0d3d2a;
  --blue:   #166534;
  --sky:    #2e7d52;
  --sky2:   #6abf8a;
  --sky3:   #edfaf3;
  --gold:   #92600a;
  --gold2:  #b87d14;
  --gold3:  #fdf7e8;
  --green:  #145c30;
  --green2: #22a05a;
  --green3: #e6f9ee;
  --red:    #b91c2a;
  --red2:   #d94040;
  --red3:   #fdf0f0;
  --orange: #b85c10;
  --orange2:#d4782a;
  --orange3:#fdf3e8;
  --purple: #4b2882;
  --purple2:#7a55b0;
  --purple3:#f2eefa;
  --bg:     #eef7f2;
  --card:   #ffffff;
  --card2:  #f4faf7;
  --text:   #0d1f17;
  --muted:  #45604e;
  --border: #b8ddc8;
  --r:      14px;
  --shadow: 0 1px 4px rgba(13,61,42,0.06), 0 6px 18px rgba(13,61,42,0.07);
  --shadow2: 0 10px 30px rgba(22,101,52,0.12);
}

*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent;}
html{scroll-behavior:smooth;}
body{font-family:'Cairo',sans-serif;background:var(--bg);color:var(--text);min-height:100vh;font-size:15px;overscroll-behavior:none;}
body.no-scroll{overflow:hidden;height:100vh;}
body.modal-lock{position:fixed;inset:0;width:100%;overflow:hidden;}

.hdr{
  background:linear-gradient(135deg,#0d3d2a 0%,#166534 60%,#1e7a42 100%);
  color:#ffffff;padding:12px 14px 10px;
  display:flex;align-items:center;justify-content:space-between;
  position:sticky;top:0;z-index:90;
  box-shadow:0 4px 16px rgba(13,61,42,.28);
  border-bottom:1px solid rgba(255,255,255,.10);
  flex-shrink:0;
}
body.dark .hdr{
  background:linear-gradient(135deg,#020617 0%,#0f172a 52%,#16213b 100%);
  box-shadow:0 10px 30px rgba(0,0,0,.42);
  border-bottom:1px solid rgba(148,163,184,.12);
}
.hdr-left h1{font-size:18px;font-weight:900;line-height:1.2;color:#ffffff;}
.hdr-left h1 span{color:#86efac;}
.hdr-left small{font-size:11px;opacity:1;display:block;margin-top:1px;color:rgba(255,255,255,.7);}
.hdr-right{display:flex;gap:7px;align-items:center;}
@media (min-width:769px){
  .hdr-profile{display:none;}
}
.hdr-badge{
  background:rgba(255,255,255,.13);border:1px solid rgba(255,255,255,.22);
  border-radius:10px;padding:5px 10px;font-size:13px;font-weight:700;
  backdrop-filter:blur(8px);line-height:1.4;text-align:center;min-width:60px;
}
.hdr-badge .lbl{font-size:9.5px;opacity:.75;display:block;text-transform:uppercase;letter-spacing:.3px;}
.hdr-badge.gold{background:rgba(251,191,36,.18);border-color:rgba(251,191,36,.3);}
.hdr-menu-btn{
  display:none;background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.25);
  border-radius:9px;color:var(--text);cursor:pointer;padding:6px 9px;font-size:18px;
  backdrop-filter:blur(6px);
}

.pos-layout{display:grid;grid-template-columns:1.25fr .75fr;gap:14px;align-items:start;}
.pos-scan-box{background:linear-gradient(135deg,var(--sky3),var(--card));border:1px solid var(--border);border-radius:16px;padding:14px;margin-bottom:12px;box-shadow:var(--shadow);}
.pos-product-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;}
.pos-product-card{border:1px solid var(--border);border-radius:16px;background:#fff;padding:12px;cursor:pointer;box-shadow:0 2px 10px rgba(15,23,42,.04);transition:.16s;}
.pos-product-card:hover{transform:translateY(-2px);box-shadow:var(--shadow2);}
.pos-product-name{font-size:13px;font-weight:900;color:var(--navy);margin-bottom:6px;}
.pos-product-meta{font-size:11px;color:var(--muted);font-weight:800;line-height:1.7;}
.pos-cart{background:var(--card);border:1px solid var(--border);border-radius:18px;box-shadow:var(--shadow);overflow:hidden;position:sticky;top:76px;}
.pos-cart-head{padding:12px 14px;background:linear-gradient(135deg,var(--card),var(--card2));border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:10px;}
.pos-cart-title{font-size:14px;font-weight:900;color:var(--navy);}
.pos-cart-body{padding:12px;max-height:52vh;overflow:auto;}
.pos-cart-row{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;border-bottom:1px dashed var(--border);padding:10px 0;}
.pos-cart-row:last-child{border-bottom:none;}
.pos-cart-name{font-weight:900;font-size:13px;color:var(--text);}
.pos-cart-sub{font-size:11px;color:var(--muted);font-weight:800;margin-top:2px;}
.pos-qty-controls{display:flex;align-items:center;gap:6px;justify-content:flex-end;}
.pos-qty-controls button{width:28px;height:28px;border-radius:9px;border:1px solid var(--border);background:var(--card);font-weight:900;cursor:pointer;}
.pos-cart-total{border-top:1px solid var(--border);padding:12px 14px;background:linear-gradient(135deg,var(--card2),var(--sky3));}
.pos-mobile-cart-toggle{display:none;position:fixed;right:14px;bottom:18px;z-index:180;border:none;border-radius:999px;padding:12px 16px;background:linear-gradient(135deg,var(--orange),var(--gold2));color:#fff;font-family:'Cairo',sans-serif;font-weight:900;box-shadow:0 14px 28px rgba(234,88,12,.28);}
.pos-cart-close{display:none;}
.pos-pro-row{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:10px;}
.pos-mini-card{background:linear-gradient(135deg,var(--card),var(--card2));border:1px solid var(--border);border-radius:14px;padding:10px;}
.pos-mini-card label{font-size:11px;margin-bottom:4px;}
.pos-invoice-strip{display:flex;align-items:center;justify-content:space-between;gap:10px;background:linear-gradient(135deg,#0d3d2a,#166534);color:#fff;border-radius:16px;padding:10px 12px;margin-bottom:12px;box-shadow:var(--shadow);}
.pos-invoice-strip b{font-size:13px;}
.pos-invoice-strip span{font-size:11px;opacity:.85;font-weight:800;}
.pos-scan-focus{box-shadow:0 0 0 4px rgba(245,158,11,.18)!important;border-color:var(--gold2)!important;}
.pos-payment-note{font-size:11px;color:var(--muted);font-weight:800;line-height:1.6;margin-top:5px;}
@media(max-width:768px){.pos-pro-row{grid-template-columns:1fr}.pos-invoice-strip{display:block}.pos-invoice-strip span{display:block;margin-top:3px}.pos-mini-card{padding:9px}}
body.dark .pos-mini-card{background:#111b2d;border-color:#243244;}
body.dark .pos-invoice-strip{background:linear-gradient(135deg,#020617,#172554);}

@media(max-width:768px){
  .pos-layout{display:block;}
  .pos-product-grid{grid-template-columns:repeat(2,1fr);}
  .pos-mobile-cart-toggle{display:inline-flex;align-items:center;gap:8px;}
  .pos-cart{position:fixed;right:0;left:0;bottom:0;top:auto;z-index:210;max-height:82vh;border-radius:24px 24px 0 0;transform:translateY(105%);transition:transform .22s cubic-bezier(.22,1,.36,1);box-shadow:0 -18px 42px rgba(15,23,42,.28);}
  .pos-cart.on{transform:translateY(0);}
  .pos-cart-close{display:inline-flex;width:auto;padding:7px 10px;font-size:12px;}
  .pos-cart-body{max-height:50vh;}
}
body.dark .pos-product-card{background:#111b2d;border-color:#243244;}
body.dark .pos-scan-box,body.dark .pos-cart-head,body.dark .pos-cart-total{background:#111b2d;border-color:#243244;}

.nav{
  display:none;
}
.tab{display:none;}

:root{
  --sb-bg:         linear-gradient(180deg,#eef7f2 0%,#e4f2ea 55%,#d8ecdf 100%);
  --sb-border:     rgba(22,101,52,.12);
  --sb-shadow:     4px 0 24px rgba(22,101,52,.08);
  --sb-logo-bg:    linear-gradient(135deg,rgba(22,101,52,.10),rgba(146,96,10,.07));
  --sb-logo-border:rgba(22,101,52,.12);
  --sb-logo-text:  #0d3d2a;
  --sb-logo-span:  #92600a;
  --sb-scroll-thumb: rgba(22,101,52,.18);
  --sb-label-color:rgba(22,101,52,.50);
  --sb-label-line: rgba(22,101,52,.12);
  --sb-item-color: #1e4433;
  --sb-item-hover-bg: rgba(22,101,52,.08);
  --sb-item-hover-border: rgba(22,101,52,.14);
  --sb-item-hover-color: #0d3d2a;
  --sb-item-on-bg: linear-gradient(135deg,rgba(22,101,52,.20),rgba(46,125,82,.12));
  --sb-item-on-border: rgba(22,101,52,.32);
  --sb-item-on-color: #145c30;
  --sb-item-on-shadow: 0 4px 14px rgba(22,101,52,.14);
  --sb-ico-bg:     rgba(22,101,52,.08);
  --sb-ico-border: rgba(22,101,52,.10);
  --sb-ico-on-bg:  rgba(22,101,52,.20);
  --sb-dot:        rgba(22,101,52,.22);
  --sb-dot-on:     #166534;
  --sb-footer-border: rgba(22,101,52,.12);
  --sb-footer-bg:  rgba(22,101,52,.04);
  --sb-user-bg:    rgba(22,101,52,.06);
  --sb-user-border:rgba(22,101,52,.12);
  --sb-avatar-bg:  linear-gradient(135deg,rgba(22,101,52,.32),rgba(46,125,82,.20));
  --sb-name-color: #0d3d2a;
  --sb-role-color: #45604e;
}

body.dark{
  --sb-bg:         linear-gradient(180deg,#050d1a 0%,#080f1e 55%,#0b1528 100%);
  --sb-border:     rgba(255,255,255,.04);
  --sb-shadow:     4px 0 28px rgba(0,0,0,.45);
  --sb-logo-bg:    linear-gradient(135deg,rgba(22,101,52,.18),rgba(245,158,11,.08));
  --sb-logo-border:rgba(255,255,255,.06);
  --sb-logo-text:  #e2ecff;
  --sb-logo-span:  #fbbf24;
  --sb-scroll-thumb: rgba(255,255,255,.12);
  --sb-label-color:rgba(255,255,255,.3);
  --sb-label-line: rgba(255,255,255,.07);
  --sb-item-color: rgba(255,255,255,.65);
  --sb-item-hover-bg: rgba(255,255,255,.07);
  --sb-item-hover-border: rgba(255,255,255,.07);
  --sb-item-hover-color: #fff;
  --sb-item-on-bg: linear-gradient(135deg,rgba(37,99,235,.42),rgba(59,130,246,.22));
  --sb-item-on-border: rgba(147,197,253,.25);
  --sb-item-on-color: #fff;
  --sb-item-on-shadow: 0 6px 20px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.08);
  --sb-ico-bg:     rgba(255,255,255,.07);
  --sb-ico-border: rgba(255,255,255,.06);
  --sb-ico-on-bg:  rgba(255,255,255,.16);
  --sb-dot:        rgba(255,255,255,.2);
  --sb-dot-on:     #60a5fa;
  --sb-footer-border: rgba(255,255,255,.07);
  --sb-footer-bg:  rgba(0,0,0,.15);
  --sb-user-bg:    rgba(255,255,255,.05);
  --sb-user-border:rgba(255,255,255,.07);
  --sb-avatar-bg:  linear-gradient(135deg,rgba(37,99,235,.5),rgba(59,130,246,.3));
  --sb-name-color: #e2ecff;
  --sb-role-color: rgba(255,255,255,.4);
}

@media (min-width:769px){
  body.app-ready{overflow:hidden;}
  body.app-ready #app{display:flex!important;flex-direction:column;height:100vh;}
  body:not(.app-ready) #app{display:none!important;}
  .hdr{flex-shrink:0;position:sticky;top:0;}
  .app-body{
    display:flex;flex:1;overflow:hidden;min-height:0;
  }
  .sidebar{
    width:252px;flex-shrink:0;
    background:var(--sb-bg);
    display:flex;flex-direction:column;
    overflow:hidden;
    border-left:1px solid var(--sb-border);
    box-shadow:var(--sb-shadow);
    position:relative;z-index:10;
    transition:background .25s,border-color .25s,box-shadow .25s;
  }
  .sidebar-logo{display:none;}
  .sidebar-scroll{
    flex:1;overflow-y:auto;padding:18px 10px 10px;
    scrollbar-width:thin;scrollbar-color:var(--sb-scroll-thumb) transparent;
  }
  .sidebar-scroll::-webkit-scrollbar{width:4px;}
  .sidebar-scroll::-webkit-scrollbar-thumb{background:var(--sb-scroll-thumb);border-radius:4px;}
  .sidebar-section{margin-bottom:6px;}
  .sidebar-section-label{
    font-size:9.5px;font-weight:900;letter-spacing:1.2px;text-transform:uppercase;
    color:var(--sb-label-color);padding:8px 12px 5px;
    display:flex;align-items:center;gap:6px;
    transition:color .25s;
  }
  .sidebar-section-label::after{
    content:'';flex:1;height:1px;background:var(--sb-label-line);
    transition:background .25s;
  }
  .sb-item{
    display:flex;align-items:center;gap:11px;
    padding:10px 12px;margin-bottom:3px;
    color:var(--sb-item-color);
    cursor:pointer;font-size:13px;font-weight:800;
    transition:all .16s;border:1px solid transparent;
    background:transparent;
    font-family:'Cairo',sans-serif;width:100%;text-align:right;border-radius:13px;
    position:relative;
  }
  .sb-item:hover:not(.on){
    color:var(--sb-item-hover-color);
    background:var(--sb-item-hover-bg);
    border-color:var(--sb-item-hover-border);
  }
  .sb-item.on{
    color:var(--sb-item-on-color);
    background:var(--sb-item-on-bg);
    border-color:var(--sb-item-on-border);
    box-shadow:var(--sb-item-on-shadow);
  }
  .sb-ico{
    display:inline-flex;align-items:center;justify-content:center;
    font-size:16px;width:32px;height:32px;
    border-radius:10px;background:var(--sb-ico-bg);
    border:1px solid var(--sb-ico-border);flex-shrink:0;
    transition:all .16s;
  }
  .sb-item.on .sb-ico{
    background:var(--sb-ico-on-bg);
    border-color:var(--sb-item-on-border);
  }
  .sb-item:hover:not(.on) .sb-ico{background:var(--sb-item-hover-bg);}
  .sb-dot{
    width:6px;height:6px;border-radius:50%;
    background:var(--sb-dot);margin-right:auto;flex-shrink:0;
    transition:all .16s;
  }
  .sb-item.on .sb-dot{
    background:var(--sb-dot-on);
    box-shadow:0 0 6px color-mix(in srgb, var(--sb-dot-on) 70%, transparent);
  }
  .sidebar-footer{
    padding:12px 10px 14px;
    border-top:1px solid var(--sb-footer-border);
    background:var(--sb-footer-bg);
    flex-shrink:0;transition:background .25s,border-color .25s;
  }
  .sb-footer-user{
    display:flex;align-items:center;gap:10px;
    padding:10px 12px;border-radius:13px;
    background:var(--sb-user-bg);
    border:1px solid var(--sb-user-border);
    margin-bottom:8px;transition:background .25s;
  }
  .sb-footer-avatar{
    width:34px;height:34px;border-radius:10px;
    background:var(--sb-avatar-bg);
    display:flex;align-items:center;justify-content:center;
    font-size:16px;flex-shrink:0;
  }
  .sb-footer-name{font-size:12px;font-weight:900;color:var(--sb-name-color);min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:color .25s;}
  .sb-footer-role{font-size:10px;color:var(--sb-role-color);margin-top:1px;transition:color .25s;}
  .sb-logout-btn{
    width:100%;display:flex;align-items:center;justify-content:center;gap:8px;
    padding:9px 12px;border:1px solid rgba(239,68,68,.3);border-radius:12px;
    background:rgba(239,68,68,.08);color:#dc2626;
    font-family:'Cairo',sans-serif;font-size:12px;font-weight:800;cursor:pointer;
    transition:all .16s;
  }
  .sb-logout-btn:hover{background:rgba(239,68,68,.15);border-color:rgba(220,38,38,.4);color:#b91c1c;}
  body.dark .sb-logout-btn{color:rgba(248,113,113,.85);}
  body.dark .sb-logout-btn:hover{color:#fca5a5;}

  .main-wrap{flex:1;overflow-y:auto;overflow-x:hidden;min-width:0;}
  .main{padding:16px 20px 40px;width:100%;max-width:1100px;margin:0 auto;}
}

@media (max-width:768px){
  .sidebar{display:none!important;}
  .app-body{display:block;}
  .main-wrap{display:block;}
}

.nav-drawer{
  display:none;position:fixed;top:var(--mobile-header-offset,60px);left:0;right:0;bottom:0;z-index:200;
}
.nav-drawer.on{display:flex;}
.nav-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.5);}
.nav-panel{
  position:relative;width:288px;max-width:88vw;height:100%;
  display:flex;flex-direction:column;overflow:hidden;
  background:linear-gradient(180deg,#1e1b4b 0%,#312e81 100%);
  border-top-right-radius:24px;border-bottom-right-radius:24px;
  box-shadow:0 20px 46px rgba(0,0,0,.34);
  border:1px solid rgba(255,255,255,.08);border-left:none;
  animation:slideLeft .25s cubic-bezier(.22,1,.36,1);
}
body.dark{
  --navy:#e5eef9;
  --blue:#60a5fa;
  --sky:#38bdf8;
  --sky2:#7dd3fc;
  --sky3:#0f172a;
  --gold:#f59e0b;
  --gold2:#fbbf24;
  --gold3:#3a2a07;
  --green:#34d399;
  --green2:#10b981;
  --green3:#062e24;
  --red:#f87171;
  --red2:#ef4444;
  --red3:#3a1014;
  --orange:#fb923c;
  --orange2:#f97316;
  --orange3:#3a1c09;
  --purple:#a78bfa;
  --purple2:#818cf8;
  --purple3:#22173d;
  --bg:#0b1220;
  --card:#111827;
  --card2:#0f172a;
  --text:#e5eef9;
  --muted:#94a3b8;
  --border:#243244;
  --shadow:0 1px 3px rgba(0,0,0,0.35), 0 10px 26px rgba(0,0,0,0.24);
  --shadow2:0 24px 60px rgba(0,0,0,0.45);
}

body.dark .hdr-left h1{color:#f4faf7;}
body.dark .hdr-left h1 span{color:#7dd3fc;}
body.dark .hdr-left small{color:#9db0c7;}
body.dark .hdr-profile-btn{
  background:#111b2d;
  border-color:#2a3a52;
  color:#edf5ff;
}
body.dark .hdr-profile-btn:hover{
  background:#162338;
  border-color:#39506f;
}
body.dark .hdr-profile-avatar{
  background:linear-gradient(135deg,#3a2a07,#6b4f12);
  color:#fde68a;
}
body.dark .nav,
body.dark .bottom-nav{
  background:linear-gradient(135deg,#08111f 0%,#101827 100%);
  border-color:rgba(148,163,184,.1);
}
body.dark .nav{
  box-shadow:0 10px 22px rgba(0,0,0,.18);
}
body.dark .tab{
  color:#8ea3bc;
}
body.dark .tab:hover:not(.on){
  color:#dbe8f8;
  background:none;
}
body.dark .tab.on{
  color:#ffffff;
  background:none;
  box-shadow:none;
}
body.dark .tab.on::after{background:#7dd3fc;}
body.dark .bn-btn{color:#8196b0;}
body.dark .bn-btn.on{
  color:#7dd3fc;
  border-color:#3b82f6;
}
body.dark .more-sheet{
  background:linear-gradient(180deg,#0c1525 0%,#121c2d 100%);
  border-top:1px solid rgba(148,163,184,.14);
}
body.dark .more-sheet-scroll{
  background:transparent;
}
body.dark .more-sheet-handle{background:#50647e;}

/* ── تثبيت الصفحة عند فتح قائمة الموبيل ── */
body.more-menu-open .main-wrap {
  overflow: hidden !important;
  touch-action: none !important;
}
body.more-menu-open .pg.on {
  overflow: hidden !important;
  pointer-events: none !important;
}
body.more-menu-open .more-sheet,
body.more-menu-open .more-overlay {
  pointer-events: auto !important;
}
body.dark .more-item{
  background:#111b2d;
  border-color:#243244;
  color:#e5eef9;
}
body.dark .more-item:hover{background:#162338;}
body.dark .more-item.more-logout{
  background:rgba(239,68,68,.12);
  border-color:rgba(248,113,113,.2);
}
body.dark .card-head,
body.dark .statement-card,
body.dark .sum-box,
body.dark .qa-btn,
body.dark .date-filter,
body.dark .modal,
body.dark .alert-box,
body.dark .confirm-box,
body.dark .login-card,
body.dark .setup-card,
body.dark .hdr-dropdown{
  background:var(--card);
}
body.dark .hdr-dropdown{
  border-color:#253346;
  box-shadow:0 20px 50px rgba(0,0,0,.42);
}
body.dark .hdr-dropdown-head{
  border-bottom-color:#243244;
  background:linear-gradient(135deg,#111b2d 0%,#162338 100%);
  border-radius:14px;
}
body.dark .hdr-dropdown-avatar{
  background:linear-gradient(135deg,#5b3c11,#7c5a14);
  box-shadow:none;
  color:#fde68a;
}
body.dark .hdr-dropdown-name{color:var(--sky3);}
body.dark .hdr-dropdown-email{color:#9db0c7;}
body.dark .fr-btn{background:#1e2d42;color:#94a3b8;border-color:#2d3f57;}
body.dark .pro-table thead tr,
body.dark .btn-ghost.on,
body.dark .fr-btn.on{
  background:linear-gradient(135deg,#172334 0%,#0d1726 100%);
}
body.dark #cf-debt.on{background:#3a1014;color:#f87171;border-color:#7f1d1d;}
body.dark #cf-paid.on{background:#062e24;color:#34d399;border-color:#065f46;}
body.dark .btn-purple{background:linear-gradient(135deg,#5b21b6,#7c3aed);}
body.dark .pro-table tbody tr:nth-child(even){background:#0f172a;}
body.dark .pro-table tbody tr:hover{background:#162033;}
body.dark .pro-table tfoot tr{
  background:linear-gradient(135deg,#141f31 0%,#0f172a 100%);
}
body.dark .pro-table tfoot td{
  color:#f4faf7;
  border-top:1px solid #243244;
}
body.dark .cust-dropdown{
  background:#0f172a;
  border-color:#243244;
  box-shadow:0 18px 38px rgba(0,0,0,.36);
}
body.dark .cust-dropdown-item{
  color:#e5eef9;
}
body.dark .cust-dropdown-item:hover{
  background:#162338;
}
body.dark .cust-dropdown-item.red:hover{
  background:rgba(239,68,68,.14);
}
body.dark .cust-dropdown-divider{background:#243244;}
body.dark .close-btn,
body.dark .cust-menu-btn{
  background:#0f172a;
  color:var(--text);
  border-color:var(--border);
}
body.dark .meta-pill{background:#0f172a;border-color:var(--border);color:var(--muted);}
body.dark .stat{
  background:linear-gradient(180deg,#121c2d 0%,#0f172a 100%);
  border-color:#243244;
  box-shadow:none;
}
body.dark .stat:hover{box-shadow:none;background:#162033;}
body.dark .stat.s-blue{border-right-color:#38bdf8;}
body.dark .stat.s-gold{border-right-color:#fbbf24;}
body.dark .stat.s-green{border-right-color:#34d399;}
body.dark .stat.s-red{border-right-color:#f87171;}
body.dark .stat.s-orange{border-right-color:#fb923c;}
body.dark .stat.s-navy{border-right-color:#93c5fd;}
body.dark .stat.s-purple{border-right-color:#a78bfa;}
body.dark .stat-val{color:#f4faf7;}
body.dark .stat-unit,
body.dark .stat-lbl{color:#9db0c7;}
body.dark .stat.s-blue .stat-icon{background:#0c2843;color:#7dd3fc;}
body.dark .stat.s-gold .stat-icon{background:#3a2a07;color:#fde68a;}
body.dark .stat.s-green .stat-icon{background:#062e24;color:#86efac;}
body.dark .stat.s-red .stat-icon{background:#3a1014;color:#fca5a5;}
body.dark .stat.s-orange .stat-icon{background:#3a1c09;color:#fdba74;}
body.dark .stat.s-navy .stat-icon{background:#172334;color:#c7ddf7;}
body.dark .stat.s-purple .stat-icon{background:#22173d;color:#c4b5fd;}
body.dark input,
body.dark select,
body.dark textarea{
  background:#0f172a;
  color:var(--text);
}
body.dark .login-screen,
body.dark .setup-screen{
  background:linear-gradient(160deg,#020617 0%,#0f172a 55%,#1d4ed8 100%);
}
body.dark .info{background:#0b2442;color:#93c5fd;border-right-color:#60a5fa;}
body.dark .warn{background:#3a2a07;color:#fde68a;border-right-color:#f59e0b;}
body.dark .success-box{background:#062e24;color:#86efac;border-right-color:#10b981;}
body.dark .hdr-dropdown-item{background:transparent;color:var(--text);}
body.dark .hdr-dropdown-item:hover{background:#0f172a;border-color:var(--border);}
body.dark .hdr-icon-btn,
body.dark .hdr-theme-btn{
  background:#142033;
  border-color:#24364b;
  color:#e2ecff;
}
body.dark .hdr-icon-btn:hover,
body.dark .hdr-theme-btn:hover{
  background:#1a2a41;
  border-color:#314861;
  color:#ffffff;
}
body.dark .inv-hero{
  background:linear-gradient(135deg,#101a2b 0%,#162338 55%,#1d3557 100%);
  border:1px solid #22324a;
  box-shadow:0 18px 40px rgba(0,0,0,.28);
}
body.dark .inv-hero-lbl{color:#9fb3cc;}
body.dark .inv-divider{background:rgba(255,255,255,.12);}
body.dark .inner-tabs{background:#111c2d;border:1px solid #22324a;}
body.dark .it-btn{color:#8ea3bd;}
body.dark .it-btn.on{background:#eef4ff;color:#0f172a;box-shadow:none;}
body.dark .sum-val{color:#f4faf7;}
body.dark .sum-lbl{color:#9db0c7;}
body.dark .pro-table-wrap{border-color:#243244;background:#0d1726;}
body.dark .pro-table tfoot tr{background:#162338;}
body.dark .pro-table tfoot td{color:#eaf2ff;border-top:1px solid #24364b;}

.nav-panel-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:18px 16px 14px;
  border-bottom:1px solid rgba(255,255,255,.10);
  background:linear-gradient(135deg,rgba(99,102,241,.25),rgba(245,158,11,.12));
  flex-shrink:0;
}
.nav-logo{display:flex;align-items:center;gap:10px;}
.nav-logo-ico{font-size:26px;filter:drop-shadow(0 2px 6px rgba(0,0,0,.25));}
.nav-logo-text{font-size:14px;font-weight:900;color:#fff;line-height:1.3;}
.nav-logo-text span{color:var(--gold2);}
.nav-close-btn{
  background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.18);
  border-radius:10px;color:rgba(255,255,255,.85);cursor:pointer;
  width:34px;height:34px;font-size:14px;display:flex;align-items:center;justify-content:center;
  transition:background .15s;flex-shrink:0;
}
.nav-close-btn:hover{background:rgba(255,255,255,.22);}

@keyframes slideLeft{from{transform:translateX(-100%)}to{transform:none}}
.nav-scroll{flex:1;overflow-y:auto;min-height:0;padding:16px 12px 14px;scrollbar-width:none;}
.nav-scroll::-webkit-scrollbar{display:none;}
.nav-footer{padding:14px 14px 16px;margin-top:auto;border-top:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.04);backdrop-filter:blur(10px);flex-shrink:0;}
.nav-user-box{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:18px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);box-shadow:inset 0 1px 0 rgba(255,255,255,.05);}
.nav-user-avatar{width:44px;height:44px;border-radius:14px;background:linear-gradient(135deg,rgba(59,130,246,.45),rgba(37,99,235,.22));display:flex;align-items:center;justify-content:center;color:#fff;font-size:18px;flex-shrink:0;border:1px solid rgba(255,255,255,.08);box-shadow:0 8px 18px rgba(0,0,0,.18);}
.nav-user-info{min-width:0;flex:1;}
.nav-item{
  display:flex;align-items:center;gap:12px;
  padding:11px 14px;margin-bottom:8px;color:rgba(255,255,255,.82);
  cursor:pointer;font-size:14px;font-weight:800;
  transition:all .18s;border:1px solid transparent;background:rgba(255,255,255,.03);
  font-family:'Cairo',sans-serif;width:100%;text-align:right;border-radius:16px;
}
.nav-item.on{color:#fff;background:linear-gradient(135deg,rgba(37,99,235,.34),rgba(59,130,246,.18));border-color:rgba(147,197,253,.22);box-shadow:0 10px 24px rgba(0,0,0,.18);}
.nav-item:hover:not(.on){color:#fff;background:rgba(255,255,255,.07);border-color:rgba(255,255,255,.08);}
.nav-item .nav-ico{display:inline-flex;align-items:center;justify-content:center;font-size:17px;width:34px;height:34px;text-align:center;border-radius:12px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.06);flex-shrink:0;}
.nav-item.on .nav-ico{background:rgba(255,255,255,.14);}
.nav-install-btn{
  width:100%;display:none;align-items:center;justify-content:center;gap:8px;
  padding:12px 14px;border:none;border-radius:15px;
  background:linear-gradient(135deg,var(--gold),var(--gold2));color:#fff;
  font-family:'Cairo',sans-serif;font-size:13px;font-weight:900;cursor:pointer;
  box-shadow:0 10px 24px rgba(217,119,6,.28);margin-bottom:12px;
}
.nav-install-btn.show{display:flex;}
#install-app-btn{display:none;}
#install-app-btn.show{display:inline-flex;}

.hdr-icon-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:40px;height:40px;background:#ffffff;border:1px solid var(--border);
  border-radius:12px;color:var(--blue);cursor:pointer;font-size:18px;backdrop-filter:none;box-shadow:0 2px 8px rgba(22,101,52,.08);
}

.hdr-cart-btn{position:relative;}
.hdr-cart-badge{
  display:none;position:absolute;top:-7px;left:-7px;
  background:var(--orange);color:#fff;
  border-radius:999px;font-size:9px;font-weight:900;
  min-width:18px;height:18px;padding:0 4px;
  align-items:center;justify-content:center;
  font-family:'Cairo',sans-serif;
  box-shadow:0 2px 6px rgba(234,88,12,.4);
  border:2px solid var(--bg);
}
.hdr-cart-badge.show{display:flex;}

.hdr-profile{display:none!important;}

.main{padding:16px 14px 100px;}

.pg{display:none;animation:fadeIn .2s ease;}
.pg.on{display:block;}
@keyframes fadeIn{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}

.card{background:var(--card);border-radius:var(--r);box-shadow:var(--shadow);margin-bottom:16px;overflow:hidden;border:1px solid rgba(219,231,243,0.8);}
.card-head{
  padding:14px 18px 12px;
  display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid var(--border);
  background:linear-gradient(135deg,var(--card) 0%,var(--card2) 100%);
  border-radius:var(--r) var(--r) 0 0;overflow:hidden;
}
.card-title{font-size:14.5px;font-weight:900;color:var(--navy);display:flex;align-items:center;gap:8px;}
.card-title .ico{font-size:18px;}
.card-body{padding:16px 18px;overflow-x:auto;-webkit-overflow-scrolling:touch;}

.nav-shortcuts-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
  margin-bottom:16px;
}
.ns-btn{
  display:flex;flex-direction:column;align-items:center;gap:6px;
  padding:14px 8px 12px;cursor:pointer;
  border-radius:var(--r);border:1.5px solid var(--border);
  background:var(--card);
  transition:all .18s;
  box-shadow:var(--shadow);
}
.ns-btn:hover{border-color:var(--sky);transform:translateY(-1px);box-shadow:var(--shadow2);}
.ns-btn:active{transform:scale(.97);}
.ns-ico{
  font-size:22px;line-height:1;
  border-radius:10px;
  width:40px;height:40px;
  display:flex;align-items:center;justify-content:center;
  transition:background .18s;
}
.ns-lbl{font-size:11px;font-weight:900;letter-spacing:.1px;text-align:center;color:var(--navy);}

.ns-navy  .ns-ico{background:var(--sky3);}
.ns-red   .ns-ico{background:var(--red3);}
.ns-gold  .ns-ico{background:var(--gold3);}
.ns-blue  .ns-ico{background:var(--sky3);}
.ns-green .ns-ico{background:var(--green3);}
.ns-orange .ns-ico{background:var(--orange3);}
.ns-purple .ns-ico{background:var(--purple3);}
.ns-teal   .ns-ico{background:var(--green3);}
@media(max-width:600px){
  .nav-shortcuts-grid{grid-template-columns:repeat(2,1fr);gap:8px;}
  .ns-btn{padding:10px 4px 9px;}
  .ns-ico{font-size:18px;width:34px;height:34px;}
  .ns-lbl{font-size:9.5px;}
}

.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:0;margin-bottom:16px;border:1px solid var(--border);overflow:hidden;}
.stat{
  background:var(--card);
  border-radius:0;padding:20px 14px 18px;
  position:relative;overflow:hidden;cursor:default;
  transition:transform .18s, box-shadow .18s;
  border:none;border-right:1px solid var(--border);border-bottom:1px solid var(--border);
  box-shadow:none;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:8px;text-align:center;
}
.stat-grid > .stat:nth-child(even){border-right:none;}
.stat-grid > .stat:nth-last-child(1),.stat-grid > .stat:nth-last-child(2){border-bottom:none;}
.stat:hover{transform:none;box-shadow:none;background:var(--card2);}
.stat:active{transform:scale(.98);}
.stat::after{display:none;}
.stat.s-blue{border-top:3px solid #166534;}
.stat.s-gold{border-top:3px solid #92600a;}
.stat.s-green{border-top:3px solid #145c30;}
.stat.s-red{border-top:3px solid #b91c2a;}
.stat.s-orange{border-top:3px solid #b85c10;}
.stat.s-navy{border-top:3px solid #0d3d2a;}
.stat.s-purple{border-top:3px solid #4b2882;}
.stat-val{font-size:22px;font-weight:900;color:var(--text);line-height:1;margin-top:2px;text-shadow:none;display:flex;align-items:baseline;gap:6px;justify-content:center;}
.stat-unit{font-size:10px;color:var(--muted);font-weight:800;letter-spacing:.3px;margin-top:0;}
.stat-lbl{font-size:11px;color:var(--muted);margin-top:0;font-weight:800;letter-spacing:.2px;}
.stat-top{display:flex;flex-direction:column;align-items:center;gap:6px;width:100%;}
.stat-copy{display:flex;flex-direction:column;gap:3px;align-items:center;}
.stat-bottom{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;margin-top:0;justify-content:center;}
.stat-icon{
  font-size:22px;margin-bottom:0;
  width:44px;height:44px;border-radius:12px;
  display:inline-flex;align-items:center;justify-content:center;
  box-shadow:none;
}
.stat.s-blue .stat-icon{background:#e6f9ee;color:#166534;}
.stat.s-gold .stat-icon{background:#fdf7e8;color:#92600a;}
.stat.s-green .stat-icon{background:#e0f5e9;color:#145c30;}
.stat.s-red .stat-icon{background:#fdf0f0;color:#b91c2a;}
.stat.s-orange .stat-icon{background:#fdf3e8;color:#b85c10;}
.stat.s-navy .stat-icon{background:#eaf3ed;color:#0d3d2a;}
.stat.s-purple .stat-icon{background:#f2eefa;color:#4b2882;}

.tip-field{position:relative;}
.label-inline{
  display:flex;align-items:center;gap:8px;margin-bottom:6px;
}
.tip-btn{
  width:24px;height:24px;border:none;border-radius:999px;
  display:inline-flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,var(--blue),var(--sky));color:#fff;
  font-family:'Cairo',sans-serif;font-size:12px;font-weight:900;cursor:pointer;
  box-shadow:0 6px 16px rgba(22,101,52,.18);transition:transform .15s,opacity .15s;
}
.tip-btn:disabled{opacity:.45;cursor:default;box-shadow:none;}
.tip-btn:not(:disabled):hover{transform:translateY(-1px);}
.pro-tooltip{
  position:absolute;top:100%;right:0;z-index:60;
  width:min(320px,calc(100vw - 48px));
  background:rgba(255,255,255,.98);border:1px solid var(--border);border-radius:16px;
  box-shadow:0 18px 42px rgba(15,23,42,.16);padding:12px;display:none;
  backdrop-filter:blur(8px);
}
.pro-tooltip.on{display:block;animation:fadeIn .16s ease;}
.pro-tooltip::before{
  content:'';position:absolute;top:-7px;right:22px;width:12px;height:12px;
  background:inherit;border-top:1px solid var(--border);border-right:1px solid var(--border);
  transform:rotate(-45deg);
}
.tip-title{font-size:12px;font-weight:900;color:var(--navy);margin-bottom:8px;display:flex;align-items:center;gap:6px;}
.tip-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;}
.tip-chip{
  background:linear-gradient(180deg,#dde6ef,#d0dce8);border:1px solid var(--border);border-radius:12px;
  padding:9px 10px;
}
.tip-chip.full{grid-column:1/-1;}
.tip-k{font-size:10.5px;color:var(--muted);font-weight:800;margin-bottom:4px;}
.tip-v{font-size:13px;color:var(--navy);font-weight:900;line-height:1.4;word-break:break-word;}
.tip-v.good{color:var(--green);}
.tip-v.due{color:var(--red);}
body.dark .pro-tooltip{
  background:rgba(15,23,42,.96);border-color:rgba(148,163,184,.18);box-shadow:0 20px 46px rgba(0,0,0,.45);
}
body.dark .pro-tooltip::before{border-color:rgba(148,163,184,.18);}
body.dark .tip-title{color:#e2e8f0;}
body.dark .tip-chip{
  background:linear-gradient(180deg,rgba(30,41,59,.92),rgba(15,23,42,.92));
  border-color:rgba(148,163,184,.16);
}
body.dark .tip-k{color:#94a3b8;}
body.dark .tip-v{color:#f8fafc;}
body.dark .tip-v.good{color:#34d399;}
body.dark .tip-v.due{color:#f87171;}

.collect-tooltip{
  display:none;
  margin-top:8px;
  padding:10px 12px;
  border-radius:12px;
  background:linear-gradient(180deg,var(--card),var(--card2));
  border:1px solid var(--border);
  color:var(--navy);
  box-shadow:0 8px 22px rgba(15,23,42,.08);
  font-size:12.5px;
  font-weight:800;
}
.collect-tooltip.on{display:block;animation:fadeIn .16s ease;}
.collect-tooltip .k{color:var(--muted);font-weight:700;margin-left:6px;}
.collect-tooltip .v{color:var(--red);font-weight:900;}
body.dark .collect-tooltip{
  background:linear-gradient(180deg,#111b2d,#0f172a);
  border-color:#243244;
  color:#e5eef9;
  box-shadow:0 14px 30px rgba(0,0,0,.24);
}
body.dark .collect-tooltip .k{color:#9db0c7;}
body.dark .collect-tooltip .v{color:#fca5a5;}

.fg{margin-bottom:12px;}
label{display:block;font-size:12px;font-weight:700;color:var(--muted);margin-bottom:5px;}
input,select,textarea{
  width:100%;padding:10px 13px;
  border:1.5px solid var(--border);border-radius:9px;
  font-family:'Cairo',sans-serif;font-size:14px;color:var(--text);
  background:var(--card);transition:border-color .2s,box-shadow .2s;direction:rtl;
  -webkit-appearance:none;appearance:none;
}
input:focus,select:focus,textarea:focus{
  outline:none;border-color:var(--sky);background:var(--card);
  box-shadow:0 0 0 3px rgba(22,101,52,.10);
}
input[type=number]{text-align:center;font-size:17px;font-weight:700;}
input[type=date]{text-align:center;}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.row3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:11px 18px;border:none;border-radius:9px;
  font-family:'Cairo',sans-serif;font-size:14px;font-weight:800;
  cursor:pointer;transition:all .18s;width:100%;letter-spacing:.2px;
}
.btn-primary{background:#166534;color:#fff;box-shadow:0 6px 16px rgba(22,101,52,.20);}
.btn-primary:active{transform:scale(.97);}
.btn-blue{background:#166534;color:#fff;box-shadow:0 4px 12px rgba(22,101,52,.22);}
.btn-blue:active{transform:scale(.97);}
.btn-green{background:#145c30;color:#fff;box-shadow:0 4px 12px rgba(20,92,48,.18);}
.btn-orange{background:linear-gradient(135deg,#b85c10,#d4782a);color:#fff;box-shadow:0 4px 12px rgba(184,92,16,.22);}
.btn-orange:active{transform:scale(.97);}
.btn-red{background:#b91c2a;color:#fff;box-shadow:0 4px 12px rgba(185,28,42,.18);}
.btn-gold{background:#92600a;color:#fff;box-shadow:0 4px 12px rgba(146,96,10,.18);}
.btn-purple{background:linear-gradient(135deg,#4b2882,#7a55b0);color:#fff;box-shadow:0 4px 12px rgba(75,40,130,.22);}
.btn-purple:active{transform:scale(.97);}
.btn-purple{background:#4b2882;color:#fff;box-shadow:0 4px 12px rgba(75,40,130,.18);}
.btn-sm{padding:6px 12px;font-size:12px;width:auto;border-radius:7px;}
.btn-ghost{background:var(--card2);color:var(--muted);border:1.5px solid var(--border);width:auto;}
.btn-ghost:hover{background:var(--border);}
.btn-ghost.on{background:var(--sky3);color:var(--blue);border-color:var(--border);}

.info{background:var(--sky3);border-right:3px solid var(--sky2);border-radius:9px;padding:10px 13px;font-size:13px;color:var(--blue);margin-bottom:12px;font-weight:700;line-height:1.5;}
.warn{background:#fffbeb;border-right:3px solid var(--gold2);border-radius:9px;padding:10px 13px;font-size:13px;color:#92400e;margin-bottom:12px;font-weight:700;}
.success-box{background:var(--green3);border-right:3px solid var(--green2);border-radius:9px;padding:10px 13px;font-size:13px;color:var(--green);margin-bottom:12px;font-weight:700;}

.cust-menu-wrap{position:relative;display:inline-block;}
.cust-menu-btn{
  width:34px;height:34px;border-radius:10px;border:1.5px solid var(--border);
  background:#fff;cursor:pointer;font-size:18px;font-weight:900;
  display:flex;align-items:center;justify-content:center;color:var(--muted);
  transition:all .15s;line-height:1;letter-spacing:1px;
}
.cust-menu-btn:hover{background:var(--sky3);border-color:var(--sky2);color:var(--navy);}
.cust-menu-btn.open{background:var(--navy);border-color:var(--navy);color:#fff;}
.cust-dropdown{
  position:absolute;left:0;top:calc(100% + 6px);z-index:300;
  background:var(--card);border:1px solid var(--border);border-radius:14px;
  box-shadow:0 12px 36px rgba(15,23,42,.16);min-width:170px;
  display:none;overflow:hidden;animation:fadeIn .15s ease;
}
.cust-menu-wrap.open .cust-dropdown{display:block;}
.cust-dropdown-item{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:11px 14px;border:none;background:none;
  font-family:'Cairo',sans-serif;font-size:13px;font-weight:700;
  color:var(--text);cursor:pointer;text-align:right;transition:background .12s;
}
.cust-dropdown-item:hover{background:var(--sky3);}
.cust-dropdown-item .di{font-size:16px;width:20px;text-align:center;}
.cust-dropdown-item.red{color:var(--red);}
.cust-dropdown-item.red:hover{background:var(--red3);}
.cust-dropdown-divider{height:1px;background:var(--border);margin:4px 0;}

.pro-table tbody tr.cust-data-row{border-bottom:1px solid var(--border);}
.pro-table tbody tr.cust-data-row td{padding:11px 12px;}

.pro-table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:14px;border:1px solid var(--border);margin-top:4px;max-width:100%;}
.pro-table{width:100%;border-collapse:collapse;font-size:13px;min-width:420px;}
.pro-table thead tr{background:#e6f9ee;color:var(--navy);}
.pro-table thead th{padding:10px 12px;text-align:right;font-weight:800;font-size:12px;letter-spacing:.3px;white-space:nowrap;}
.pro-table thead th:first-child{border-radius:0 14px 0 0;}
.pro-table thead th:last-child{border-radius:14px 0 0 0;}
.pro-table tbody tr{border-bottom:1px solid var(--border);transition:background .13s;}
.pro-table tbody tr:last-child{border-bottom:none;}
.pro-table tbody tr:nth-child(even){background:var(--card2);}
.pro-table tbody tr:hover{background:var(--card2);}
.pro-table td{padding:10px 12px;vertical-align:middle;}
.pro-table tfoot tr{background:var(--card2);}
.pro-table tfoot td{padding:10px 12px;font-weight:900;font-size:13px;color:var(--navy);}
.tbl-badge{display:inline-flex;align-items:center;gap:3px;padding:3px 9px;border-radius:20px;font-size:11px;font-weight:800;white-space:nowrap;}
.tbl-badge.cash{background:#d1fae5;color:#047857;}
.tbl-badge.debt-b{background:#fee2e2;color:#b91c1c;}
.tbl-badge.pos-b{background:#d1fae5;color:#047857;}
.tbl-badge.neg-b{background:#fee2e2;color:#b91c1c;}
.tbl-badge.neu-b{background:#f3f4f6;color:#6b7280;}
.tbl-amt-pos{color:var(--green);font-weight:900;}
.tbl-amt-neg{color:var(--red2);font-weight:900;}
.tbl-amt-neu{color:var(--muted);font-weight:900;}


/* POS non-cash ledger — replaces dashboard-like cards inside treasury */
.pos-ledger-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:12px;}
.pos-ledger-row{display:flex;align-items:center;justify-content:space-between;gap:10px;background:linear-gradient(135deg,var(--card),var(--card2));border:1px solid var(--border);border-radius:16px;padding:12px 14px;box-shadow:0 2px 10px rgba(15,23,42,.04);}
.pos-ledger-title{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:900;color:var(--navy);}
.pos-ledger-title small{display:block;font-size:10px;color:var(--muted);font-weight:800;margin-top:2px;}
.pos-ledger-amount{font-size:15px;font-weight:900;color:var(--blue);white-space:nowrap;}
.pos-ledger-toolbar{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:0 0 12px;}
.pos-settle-box{background:linear-gradient(135deg,var(--card2),var(--sky3));border:1px solid var(--border);border-radius:16px;padding:12px;margin-top:12px;}
body.dark .pos-ledger-row,body.dark .pos-settle-box{background:#111b2d;border-color:#243244;}
body.dark .pos-ledger-title{color:#e5eef9;}
@media(max-width:768px){.pos-ledger-summary{grid-template-columns:1fr}.pos-ledger-row{padding:10px 12px}.pos-ledger-toolbar .fr-btn{flex:1;text-align:center}.pos-settle-box .row2{grid-template-columns:1fr}}

/* ══ Treasury Summary Table ══ */
.tsummary-table{width:100%;border-collapse:collapse;font-size:13px;}
.tsummary-table tr{border-bottom:1px solid var(--border);}
.tsummary-table tr:last-child{border-bottom:none;}
.tsummary-table td{padding:11px 14px;vertical-align:middle;}
.tsummary-table .ts-label{font-weight:800;color:var(--text);display:flex;align-items:center;gap:8px;}
.tsummary-table .ts-label .ts-ico{width:32px;height:32px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;font-size:15px;flex-shrink:0;}
.tsummary-table .ts-label .ts-sub{font-size:11px;color:var(--muted);font-weight:700;margin-top:2px;}
.tsummary-table .ts-amount{font-weight:900;font-size:15px;text-align:left;white-space:nowrap;}
.tsummary-table .ts-row-open .ts-ico{background:var(--sky3);}
.tsummary-table .ts-row-open .ts-amount{color:var(--navy);}
.tsummary-table .ts-row-in .ts-ico{background:var(--green3);}
.tsummary-table .ts-row-in .ts-amount{color:var(--green);}
.tsummary-table .ts-row-out .ts-ico{background:var(--red3);}
.tsummary-table .ts-row-out .ts-amount{color:var(--red);}
.tsummary-table .ts-row-net{background:linear-gradient(135deg,var(--sky3),#f0fdf4);}
.tsummary-table .ts-row-net td{padding:13px 14px;}
.tsummary-table .ts-row-net .ts-label{font-size:14px;font-weight:900;color:var(--navy);}
.tsummary-table .ts-row-net .ts-ico{background:linear-gradient(135deg,var(--blue),var(--green));font-size:16px;}
.tsummary-table .ts-row-net .ts-amount{font-size:17px;}
.tsummary-sub-table{width:100%;border-collapse:collapse;margin-top:5px;}
.tsummary-sub-table td{padding:4px 6px;font-size:11.5px;font-weight:700;}
.tsummary-sub-table .sub-lbl{color:var(--muted);}
.tsummary-sub-table .sub-val{color:var(--text);text-align:left;}
body.dark .tsummary-table .ts-row-net{background:linear-gradient(135deg,#0f2040,#052e1e);}
body.dark .tsummary-table .ts-row-net .ts-label{color:#e2ecff;}

.tx{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--border);}
.tx:last-child{border-bottom:none;}
.tx-ico{width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:16px;flex-shrink:0;}
.tx-ico.charge{background:var(--red3);}
.tx-ico.collect{background:var(--green3);}
.tx-ico.inv-add{background:var(--sky3);}
.tx-ico.inv-sub{background:var(--orange3);}
.tx-ico.open{background:var(--purple3);}
.tx-ico.purchase{background:#ecfdf5;border:1.5px solid var(--green3);}
.tx-info{flex:1;min-width:0;}
.tx-name{font-size:13.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.tx-sub{font-size:11.5px;color:var(--muted);margin-top:1px;}
.tx-amt{font-size:15px;font-weight:900;white-space:nowrap;flex-shrink:0;}
.tx-amt.pos{color:var(--green);}
.tx-amt.neg{color:var(--red2);}
.tx-amt.neu{color:var(--muted);}

.cust{
  background:var(--card);border-radius:var(--r);box-shadow:var(--shadow);
  margin-bottom:11px;border-right:4px solid var(--sky2);overflow:hidden;
  transition:transform .15s;
}
.cust:active{transform:scale(.99);}
.cust.debt{border-right-color:var(--red2);}
.cust.paid{border-right-color:var(--green2);}
.cust-head{padding:12px 14px 9px;display:flex;align-items:flex-start;justify-content:space-between;gap:8px;}
.cust-name{font-size:15px;font-weight:800;}
.badge{padding:4px 11px;border-radius:20px;font-size:13px;font-weight:900;white-space:nowrap;}
.badge-red{background:var(--red3);color:var(--red);}
.badge-green{background:var(--green3);color:var(--green);}
.badge-gold{background:var(--gold3);color:var(--orange);}
.cust-stats{
  display:grid;grid-template-columns:repeat(3,1fr);gap:0;
  border-top:1px solid var(--border);
}
.cs-item{text-align:center;padding:8px 4px;border-left:1px solid var(--border);}
.cs-item:last-child{border-left:none;}
.cs-lbl{font-size:10px;color:var(--muted);font-weight:700;}
.cs-val{font-size:13px;font-weight:800;margin-top:2px;}
.cust-actions{display:flex;gap:6px;padding:9px 14px 11px;flex-wrap:wrap;}

.filter-row{display:flex;gap:7px;margin-bottom:13px;flex-wrap:wrap;}
.fr-btn{
  flex-shrink:0;padding:6px 13px;border:1.5px solid var(--border);border-radius:20px;
  background:#dde6f0;font-family:'Cairo',sans-serif;font-size:12.5px;font-weight:700;
  cursor:pointer;color:#334155;transition:all .18s;
}
.fr-btn.on{background:var(--sky3);color:var(--blue);border-color:var(--border);box-shadow:0 4px 12px rgba(22,101,52,.12);}
#cf-debt.on{background:#fee2e2;color:#b91c1c;border-color:#fca5a5;box-shadow:0 4px 12px rgba(185,28,28,.10);}
#cf-paid.on{background:#d1fae5;color:#047857;border-color:#6ee7b7;box-shadow:0 4px 12px rgba(4,120,87,.10);}

.date-filter{
  display:flex;gap:8px;align-items:center;background:var(--card);
  border-radius:var(--r);padding:10px 13px;box-shadow:var(--shadow);margin-bottom:13px;
  flex-wrap:wrap;
}
.date-filter label{font-size:12px;color:var(--muted);font-weight:700;margin:0;white-space:nowrap;}
.date-filter input[type=date]{padding:6px 10px;font-size:13px;flex:1;min-width:110px;}
.date-filter .btn{width:auto;padding:7px 14px;font-size:12.5px;}

.search-wrap{position:relative;margin-bottom:12px;}
.search-wrap input{padding-right:12px;padding-left:40px;}
.search-ico{position:absolute;left:13px;right:auto;top:50%;transform:translateY(-50%);font-size:17px;pointer-events:none;}

.customers-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;flex-wrap:wrap;}
.customers-toolbar .meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.customers-toolbar .count{font-size:12px;color:var(--muted);font-weight:800;}
.customers-toolbar .btn{width:auto;}
.charge-mode-wrap{margin-bottom:12px;}
.charge-mode-hint{font-size:12px;color:var(--muted);font-weight:700;margin-top:4px;line-height:1.6;}
.mode-badge{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:800;background:var(--card2);border:1px solid var(--border);color:var(--muted);}
.mode-badge.cash{background:var(--green3);border-color:#a7f3d0;color:var(--green);}
.mode-badge.debt{background:var(--red3);border-color:#fecaca;color:var(--red);}
@media(max-width:600px){.customers-toolbar{align-items:stretch}.customers-toolbar .meta{width:100%;justify-content:space-between}.customers-toolbar .btn{width:100%;}}

/* Dashboard Level Pro */
.dash-hero{
  display:grid;grid-template-columns:1.3fr .7fr;gap:12px;margin-bottom:14px;
}
.dash-main-card{
  background:linear-gradient(135deg,var(--card) 0%,var(--sky3) 58%,#c8d8ee 100%);
  border:1px solid var(--border);border-radius:22px;padding:18px;box-shadow:var(--shadow);
  display:flex;align-items:center;justify-content:space-between;gap:14px;overflow:hidden;position:relative;
}
.dash-main-card::after{content:'';position:absolute;left:-40px;top:-40px;width:140px;height:140px;border-radius:50%;background:rgba(22,101,52,.12);}
.dash-welcome{position:relative;z-index:1;min-width:0;}
.dash-kicker{font-size:11px;color:var(--muted);font-weight:900;margin-bottom:5px;}
.dash-title{font-size:20px;font-weight:900;color:var(--navy);line-height:1.35;}
.dash-sub{font-size:12px;color:var(--muted);font-weight:800;margin-top:5px;line-height:1.7;}
.dash-big-balance{position:relative;z-index:1;text-align:left;white-space:nowrap;}
.dash-balance-label{font-size:11px;color:var(--muted);font-weight:900;margin-bottom:4px;}
.dash-balance-value{font-size:26px;font-weight:900;color:var(--blue);line-height:1;}
.dash-balance-value small{font-size:11px;color:var(--muted);font-weight:900;margin-right:3px;}
.dash-health-card{
  background:var(--card);border:1px solid var(--border);border-radius:22px;padding:14px;box-shadow:var(--shadow);
}
.dash-health-title{font-size:13px;font-weight:900;color:var(--navy);margin-bottom:10px;display:flex;align-items:center;gap:6px;}
.dash-health-row{display:flex;justify-content:space-between;align-items:center;padding:7px 0;border-bottom:1px dashed var(--border);gap:8px;}
.dash-health-row:last-child{border-bottom:none;}
.dash-health-row span{font-size:11px;color:var(--muted);font-weight:800;}
.dash-health-row b{font-size:13px;color:var(--text);font-weight:900;}
.dash-actions-pro{
  display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin-bottom:14px;
}
.dash-action{
  border:1px solid var(--border);background:var(--card);border-radius:18px;padding:13px 8px;
  box-shadow:var(--shadow);cursor:pointer;font-family:'Cairo',sans-serif;text-align:center;transition:.18s;
}
.dash-action:hover{transform:translateY(-2px);box-shadow:var(--shadow2);border-color:var(--sky2);}
.dash-action:active{transform:scale(.97);}
.dash-action .ico{width:42px;height:42px;border-radius:14px;display:flex;align-items:center;justify-content:center;margin:0 auto 7px;font-size:21px;background:var(--sky3);}
.dash-action .lbl{font-size:12px;font-weight:900;color:var(--navy);line-height:1.4;}
.dash-action .sub{font-size:10px;font-weight:800;color:var(--muted);margin-top:2px;line-height:1.4;}
.dash-action.green .ico{background:var(--green3)}
.dash-action.red .ico{background:var(--red3)}
.dash-action.gold .ico{background:var(--gold3)}
.dash-action.purple .ico{background:var(--purple3)}
.dash-action.orange .ico{background:var(--orange3)}
.dash-action.navy .ico{background:#f1f5f9}
.dash-mini-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px;}
.dash-mini{
  background:var(--card);border:1px solid var(--border);border-radius:18px;padding:12px;box-shadow:var(--shadow);
  display:flex;align-items:center;gap:10px;min-width:0;
}
.dash-mini-ico{width:38px;height:38px;border-radius:13px;display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0;background:var(--sky3);}
.dash-mini b{display:block;font-size:17px;font-weight:900;color:var(--text);line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.dash-mini span{display:block;font-size:10.5px;color:var(--muted);font-weight:900;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.dash-mini.green .dash-mini-ico{background:var(--green3)}
.dash-mini.red .dash-mini-ico{background:var(--red3)}
.dash-mini.gold .dash-mini-ico{background:var(--gold3)}
.dash-mini.purple .dash-mini-ico{background:var(--purple3)}
.dash-board-grid{display:grid;grid-template-columns:.85fr 1.15fr;gap:14px;align-items:start;}
.dash-alert-list{display:flex;flex-direction:column;gap:8px;}
.dash-alert{
  display:flex;align-items:center;gap:10px;border:1px solid var(--border);border-radius:15px;padding:10px;background:linear-gradient(135deg,var(--card),var(--card2));
}
.dash-alert .aico{width:34px;height:34px;border-radius:12px;display:flex;align-items:center;justify-content:center;background:var(--gold3);flex-shrink:0;}
.dash-alert .atxt{min-width:0;flex:1;}
.dash-alert .atitle{font-size:12.5px;font-weight:900;color:var(--navy);}
.dash-alert .asub{font-size:11px;font-weight:800;color:var(--muted);margin-top:2px;}
.dash-alert.good .aico{background:var(--green3)}
.dash-alert.danger .aico{background:var(--red3)}
.dash-alert.info .aico{background:var(--sky3)}
body.dark .dash-main-card{background:linear-gradient(135deg,#111b2d 0%,#0f172a 58%,#172554 100%);border-color:#243244;}
body.dark .dash-main-card::after{background:rgba(96,165,250,.08)}
body.dark .dash-action,body.dark .dash-mini,body.dark .dash-health-card{background:#111b2d;border-color:#243244;}
body.dark .dash-alert{background:linear-gradient(135deg,#111b2d,#0f172a);border-color:#243244;}
body.dark .dash-action.navy .ico{background:#172334;}
@media(max-width:900px){
  .dash-hero,.dash-board-grid{grid-template-columns:1fr;}
  .dash-actions-pro{grid-template-columns:repeat(3,1fr);}
  .dash-mini-grid{grid-template-columns:repeat(2,1fr);}
  .dash-main-card{align-items:flex-start;flex-direction:column;}
  .dash-big-balance{text-align:right;}
}
@media(max-width:600px){
  .dash-actions-pro{grid-template-columns:repeat(2,1fr);gap:8px;}
  .dash-mini-grid{grid-template-columns:repeat(2,1fr);gap:8px;}
  .dash-title{font-size:17px;}
  .dash-balance-value{font-size:22px;}
  .dash-action{padding:10px 6px;border-radius:16px;}
  .dash-action .ico{width:36px;height:36px;font-size:18px;}
  .dash-action .lbl{font-size:11px;}
  .dash-action .sub{display:none;}
}


.inv-hero{
  background:linear-gradient(135deg,var(--card) 0%,var(--card2) 100%);
  border:1px solid var(--border);border-radius:var(--r);padding:20px 18px;color:var(--text);margin-bottom:14px;
  display:grid;grid-template-columns:1fr 1px 1fr;gap:16px;box-shadow:var(--shadow);
}
.inv-hero-item{text-align:center;}
.inv-hero-val{font-size:28px;font-weight:900;line-height:1;}
.inv-hero-lbl{font-size:11.5px;color:var(--muted);margin-top:5px;font-weight:800;}
.inv-divider{background:var(--border);}

.divider{height:1px;background:var(--border);margin:13px 0;}

.empty{text-align:center;padding:28px 16px;color:var(--muted);}
.empty .ei{font-size:38px;margin-bottom:8px;}
.empty p{font-size:13.5px;font-weight:600;}

.sec-hdr{
  font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase;
  letter-spacing:.8px;padding:6px 0;border-bottom:2px solid var(--border);margin-bottom:10px;
  display:flex;justify-content:space-between;align-items:center;
}

.rr{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px dashed var(--border);}
.rr:last-child{border:none;}
.rr-lbl{font-size:13px;color:var(--muted);font-weight:600;}
.rr-val{font-size:14px;font-weight:800;}

.overlay{display:none;position:fixed;inset:0;background:rgba(8,18,38,.62);z-index:200;align-items:flex-end;justify-content:center;backdrop-filter:blur(4px);overscroll-behavior:contain;padding-top:12px;}
.overlay.on{display:flex;}
.modal{
  background:var(--card);border-radius:22px 22px 0 0;padding:20px 18px calc(36px + env(safe-area-inset-bottom));
  width:100%;max-width:520px;animation:slideUp .28s cubic-bezier(.22,1,.36,1);
  max-height:min(90vh, calc(100dvh - 24px));overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;touch-action:pan-y;scrollbar-gutter:stable;
  box-shadow:0 -14px 40px rgba(15,23,42,.24);
}
@keyframes slideUp{from{transform:translateY(100%)}to{transform:none}}
.modal-hdr{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;}
.modal-title{font-size:16px;font-weight:800;color:var(--navy);}
.close-btn{background:var(--card2);border:1.5px solid var(--border);border-radius:50%;width:32px;height:32px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;color:var(--muted);transition:all .15s;}
.close-btn:hover{background:var(--border);}

.alert-overlay{display:none;position:fixed;inset:0;background:rgba(8,18,38,.55);z-index:500;align-items:center;justify-content:center;padding:20px;backdrop-filter:blur(3px);}
.alert-overlay.on{display:flex;}
.alert-box{
  background:var(--card);border-radius:18px;padding:24px 20px;
  width:100%;max-width:360px;box-shadow:var(--shadow2);
  animation:scaleIn .22s cubic-bezier(.22,1,.36,1);text-align:center;
}
@keyframes scaleIn{from{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}
.alert-icon{font-size:40px;margin-bottom:12px;}
.alert-title{font-size:17px;font-weight:900;color:var(--navy);margin-bottom:8px;}
.alert-msg{font-size:14px;color:var(--muted);font-weight:600;line-height:1.6;margin-bottom:20px;}
.alert-btns{display:flex;gap:10px;justify-content:center;}
.alert-btns .btn{width:auto;min-width:100px;padding:10px 18px;}

.confirm-box{
  background:var(--card);border-radius:18px;padding:24px 20px;
  width:100%;max-width:360px;box-shadow:var(--shadow2);
  animation:scaleIn .22s;text-align:center;
}

.toast{
  position:fixed;bottom:80px;left:50%;transform:translateX(-50%) translateY(16px);
  padding:10px 20px;border-radius:25px;font-size:13px;font-weight:700;
  z-index:999;opacity:0;transition:all .28s;pointer-events:none;white-space:nowrap;
  box-shadow:0 6px 24px rgba(0,0,0,.2);max-width:90vw;text-align:center;
}
.toast.on{opacity:1;transform:translateX(-50%) translateY(0);}
.toast.ok{background:var(--green);color:#fff;}
.toast.err{background:var(--red);color:#fff;}
.toast.inf{background:#166534;color:#fff;}

.setup-screen{
  min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:24px;background:linear-gradient(180deg,#f4faf7 0%,#eef6ff 100%);
}
.setup-card{background:#fff;border-radius:20px;padding:24px 20px;width:100%;max-width:460px;box-shadow:var(--shadow);border:1px solid var(--border);}
.setup-logo{text-align:center;margin-bottom:22px;}
.setup-logo .logo-ico{font-size:46px;margin-bottom:8px;}
.setup-logo h2{font-size:24px;font-weight:900;color:var(--navy);}
.setup-logo h2 span{color:var(--sky);}
.setup-logo p{font-size:13px;color:var(--muted);margin-top:5px;}
.setup-step{
  display:none;
}
.setup-step.on{display:block;}
.step-indicator{display:flex;gap:6px;justify-content:center;margin-bottom:20px;}
.step-dot{width:8px;height:8px;border-radius:50%;background:var(--border);transition:all .2s;}
.step-dot.on{background:var(--sky);width:20px;border-radius:4px;}

.inner-tabs{display:flex;gap:0;background:var(--card2);border-radius:10px;padding:3px;margin-bottom:14px;}
.it-btn{flex:1;padding:8px;border:none;border-radius:8px;background:none;font-family:'Cairo',sans-serif;font-size:12.5px;font-weight:700;cursor:pointer;color:var(--muted);transition:all .18s;}
.it-btn.on{background:#fff;color:var(--navy);box-shadow:0 1px 6px rgba(0,0,0,.1);}

.sum-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:9px;margin-bottom:14px;}
.sum-box{border-radius:11px;padding:11px 8px;text-align:center;border:1.5px solid transparent;}
.sum-box.sb-blue{background:var(--sky3);border-color:var(--border);}
.sum-box.sb-green{background:var(--green3);border-color:#a7f3d0;}
.sum-box.sb-red{background:var(--red3);border-color:#fecaca;}
.sum-box.sb-gold{background:var(--gold3);border-color:#fde68a;}
.sum-box.sb-purple{background:var(--purple3);border-color:#ddd6fe;}
.sum-val{font-size:16px;font-weight:900;}
.sum-lbl{font-size:10px;color:var(--muted);font-weight:700;margin-top:3px;}

.pg-title{
  font-size:16px;font-weight:900;color:var(--navy);margin-bottom:14px;
  display:flex;align-items:center;gap:8px;
}

.net-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;}
.net-tag{
  padding:4px 11px;border-radius:20px;background:var(--card2);border:1.5px solid var(--border);
  font-size:12.5px;font-weight:700;cursor:pointer;color:var(--muted);transition:all .15s;
  display:flex;align-items:center;gap:5px;
}
.net-tag:hover{border-color:var(--sky);color:var(--sky);}
.net-tag .del{color:var(--red2);font-size:11px;line-height:1;}

.quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px;}
.qa-btn{
  background:var(--card);border-radius:var(--r);box-shadow:var(--shadow);
  padding:14px;text-align:center;cursor:pointer;border:1.5px solid var(--border);
  transition:all .18s;
}
.qa-btn:hover{border-color:var(--sky);transform:translateY(-1px);box-shadow:var(--shadow2);}
.qa-btn:active{transform:scale(.97);}
.qa-ico{font-size:26px;margin-bottom:6px;}
.qa-lbl{font-size:13px;font-weight:800;color:var(--navy);}
.qa-sub{font-size:11px;color:var(--muted);margin-top:2px;}

.action-btn{
  width:38px;height:38px;border:none;border-radius:11px;display:inline-flex;align-items:center;justify-content:center;
  cursor:pointer;font-size:16px;transition:transform .15s, box-shadow .18s, background .18s, color .18s;
  box-shadow:0 4px 14px rgba(13,31,60,.10);
}
.action-btn:hover{transform:translateY(-1px);}
.action-btn.edit{background:linear-gradient(135deg,var(--sky3),#dbeafe);color:var(--blue);}
.action-btn.delete{background:linear-gradient(135deg,#fee2e2,#fecaca);color:var(--red);}

.action-btn.print{background:linear-gradient(135deg,#ecfdf5,#d1fae5);color:var(--green);}
.invoice-actions{display:flex;gap:5px;align-items:center;justify-content:center;flex-wrap:wrap}
.invoice-actions .action-btn{width:30px;height:30px;border-radius:9px;border:none;cursor:pointer;font-size:14px;display:inline-flex;align-items:center;justify-content:center}
.invoice-edit-row{background:var(--sky3);border:1px solid var(--border);border-radius:12px;padding:10px;margin-bottom:8px}
@media print{.invoice-actions,.no-print,.btn,.close-btn,.hdr,.sidebar,.bottom-nav,.treasury-live-ticker{display:none!important}.card,.modal{box-shadow:none!important}}

.action-btn.view{background:linear-gradient(135deg,#f5f3ff,#ede9fe);color:var(--purple);}
.action-btn.mini{width:34px;height:34px;border-radius:10px;font-size:15px;box-shadow:none}
.statement-head{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:14px;}
.statement-card{
  background:linear-gradient(180deg,#dde6ef,#d0dce8);border:1.5px solid var(--border);border-radius:14px;padding:14px 12px;
}
.statement-card .s-k{font-size:11px;color:var(--muted);font-weight:800;margin-bottom:6px}
.statement-card .s-v{font-size:18px;font-weight:900;color:var(--navy)}
.statement-meta{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.statement-meta .meta-pill{
  background:var(--card2);border:1px solid var(--border);border-radius:999px;padding:5px 10px;font-size:11.5px;font-weight:700;color:var(--muted)
}
@media(max-width:700px){.statement-head{grid-template-columns:1fr 1fr;}}
@media(max-width:600px){
  #pg-balance > div:nth-child(3){grid-template-columns:1fr !important;}
}

@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}
.live-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--green2);margin-left:5px;animation:pulse 2s infinite;}
.sync-pill.offline .dot{background:#ef4444;}
.sync-pill.syncing .dot{background:#fbbf24;animation:pulse 1.2s infinite;}
.sync-pill.offline{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.26);}
.sync-pill.syncing{background:rgba(251,191,36,.12);border-color:rgba(251,191,36,.28);}

.bottom-nav{
  display:none;
  position:fixed;bottom:0;left:0;right:0;z-index:90;
  background:#ffffff;
  border-top:1px solid var(--border);
  box-shadow:0 -4px 20px rgba(148,163,184,.16);
  padding:0 2px;
  padding-bottom:env(safe-area-inset-bottom);
}
.bottom-nav-inner{
  display:flex;align-items:stretch;justify-content:space-around;
  height:58px;
}
.bn-btn{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:2px;background:none;border:none;color:#94a3b8;
  font-family:'Cairo',sans-serif;font-size:7.8px;font-weight:800;cursor:pointer;
  transition:color .18s;padding:0 1px;min-width:0;
  border-top:2px solid transparent;
}
.bn-btn .bn-ico{font-size:17px;line-height:1;}
.bn-btn.on{color:var(--blue);border-top-color:var(--blue);}
.bn-btn:active{transform:scale(.92);}

@media(max-width:600px){
  .hdr{display:flex !important;padding:10px 12px 9px;}
  .hdr-left h1{font-size:16px;}
  .hdr-left small{font-size:10px;opacity:.72;}
  .hdr-right{gap:6px;}
  .hdr-icon-btn{width:38px;height:38px;border-radius:11px;font-size:17px;}
  .hdr-menu-btn{display:none !important;}
  .nav{display:none !important;}
  .nav-drawer{display:none !important;}
  .bottom-nav{display:block;}
  .stat-grid{gap:8px;}
  .stat-val{font-size:18px;}
  .inv-hero-val{font-size:23px;}
  .main{padding:13px 11px 80px;}
  .sum-grid{grid-template-columns:1fr 1fr;}
  .quick-actions{grid-template-columns:1fr 1fr;}
  .accounts-sum-grid{grid-template-columns:repeat(3,1fr) !important;}
}

.more-overlay{
  display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:299;
  touch-action:none;
  overscroll-behavior:none;
}
.more-overlay.on{display:block;}
body.more-menu-open{overflow:hidden!important;position:fixed!important;width:100%!important;top:0!important;}
.more-sheet{
  display:none;position:fixed;bottom:0;left:0;right:0;z-index:300;
  background:#ffffff;
  border-radius:22px 22px 0 0;
  padding:8px 0 0;
  box-shadow:0 -8px 32px rgba(148,163,184,.25);
  border-top:1px solid var(--border);
  animation:slideUp .25s cubic-bezier(.22,1,.36,1);
  max-height:75vh;
  display:none;
  flex-direction:column;
  overscroll-behavior:contain;
  touch-action:pan-y;
}
.more-sheet.on{display:flex;}
.more-sheet-scroll{
  overflow-y:auto;
  overscroll-behavior:contain;
  flex:1;
  padding:0 16px calc(16px + env(safe-area-inset-bottom));
  scrollbar-width:none;
}
.more-sheet-scroll::-webkit-scrollbar{display:none;}
.more-sheet-handle{width:38px;height:4px;border-radius:2px;background:#cbd5e1;margin:0 auto 14px;}
.more-item{
  display:flex;align-items:center;gap:13px;width:100%;padding:13px 14px;
  background:#f4faf7;border:1px solid var(--border);
  border-radius:14px;color:var(--text);font-family:'Cairo',sans-serif;
  font-size:14px;font-weight:800;cursor:pointer;margin-bottom:8px;
  transition:background .15s;
}
.more-item span:first-child{font-size:18px;}
.more-item:hover{background:var(--sky3);}
.more-item.more-logout{color:var(--red);background:#fef2f2;border-color:#fecaca;}

.login-screen{
  min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:24px;background:linear-gradient(180deg,#f4faf7 0%,#eef6ff 100%);
  /* موبايل: دعم safe area + منع الـ overflow عند ظهور الكيبورد */
  padding-bottom:env(safe-area-inset-bottom, 24px);
  padding-left:env(safe-area-inset-left, 24px);
  padding-right:env(safe-area-inset-right, 24px);
}
.login-card{
  background:#fff;border-radius:22px;padding:28px 24px;
  width:100%;max-width:420px;box-shadow:0 20px 60px rgba(148,163,184,.18);border:1px solid var(--border);
}
.login-logo{text-align:center;margin-bottom:24px;}
.login-ico{font-size:50px;margin-bottom:10px;}
.login-logo h2{font-size:22px;font-weight:900;color:var(--navy);}
.login-logo h2 span{color:var(--sky);}
.login-logo p{font-size:13px;color:var(--muted);margin-top:5px;font-weight:600;}
.login-err{
  background:var(--red3);border:1.5px solid #fca5a5;border-radius:9px;
  padding:9px 13px;font-size:13px;color:var(--red);font-weight:700;margin-bottom:12px;
}
.login-btn-loader{display:none;align-items:center;justify-content:center;gap:8px;}
.login-btn-loader .spinner{
  width:16px;height:16px;border:2px solid rgba(255,255,255,.28);
  border-top-color:#fff;border-radius:50%;display:inline-block;animation:spin .6s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}

.acc-hero{
  background:linear-gradient(135deg,var(--card) 0%,var(--card2) 100%);
  border:1px solid var(--border);border-radius:var(--r);padding:22px 18px;color:var(--text);margin-bottom:14px;text-align:center;
  box-shadow:var(--shadow);
}
.acc-avatar{font-size:52px;margin-bottom:8px;}
.acc-name{font-size:17px;font-weight:900;margin-bottom:4px;}
.acc-email-lbl{font-size:12px;opacity:.7;}
.acc-email-val{font-size:14px;font-weight:700;direction:ltr;word-break:break-all;}

@media(max-width:600px){
  .login-card{padding:22px 18px;}
  .login-screen{
    padding:16px;
    justify-content:flex-start;
    padding-top:max(48px, env(safe-area-inset-top, 48px));
    min-height:100dvh;
    /* تجنب الـ overflow لما الكيبورد يظهر */
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
  }
  .login-card{
    border-radius:18px;
    box-shadow:0 10px 30px rgba(148,163,184,.15);
    /* ضمان إن الكارد مش بيتقطع بالكيبورد */
    margin-bottom:max(16px, env(safe-area-inset-bottom, 16px));
  }
  .login-ico{font-size:40px;margin-bottom:8px;}
  .login-logo h2{font-size:19px;}
}
@media(max-width:380px){
  .row2{grid-template-columns:1fr;}
}

@media(max-width:600px){
  .pr-mob{display:block !important;}
  .pr-desk{display:none !important;}
  .ext-mob{display:block !important;}
  .ext-desk{display:none !important;}
  .card-body{padding:12px 12px;}
  .pro-table-wrap{border-radius:10px;}
}

@media(max-width:768px){
  .pos-mobile-cart-toggle{
    right:14px;
    bottom:calc(74px + env(safe-area-inset-bottom));
    z-index:120;
    padding:11px 14px;
    border-radius:16px;
    box-shadow:0 12px 26px rgba(15,23,42,.20);
  }
  .pos-payment-row{grid-template-columns:1fr;}
}

.home-actions-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-bottom:16px;
}
.home-actions-grid .qa-btn{
  width:100%;
  min-height:108px;
  text-align:center;
  border:1.5px solid var(--border);
  background:var(--card);
  box-shadow:var(--shadow);
}
.home-actions-grid .qa-ico{font-size:24px;margin-bottom:6px;line-height:1;}
.home-actions-grid .qa-lbl{font-size:13px;font-weight:900;line-height:1.35;}
.home-actions-grid .qa-sub{font-size:10.5px;line-height:1.45;min-height:30px;display:flex;align-items:center;justify-content:center;text-align:center;}
@media(max-width:600px){
  .home-actions-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
  .home-actions-grid .qa-btn{min-height:96px;padding:10px 6px;}
  .home-actions-grid .qa-ico{font-size:21px;margin-bottom:5px;}
  .home-actions-grid .qa-lbl{font-size:11.5px;}
  .home-actions-grid .qa-sub{font-size:9.5px;min-height:28px;}
}

.invoice-complete-box{background:linear-gradient(135deg,var(--card),var(--card2));border:1px solid var(--border);border-radius:16px;padding:12px;margin:12px 0;box-shadow:0 6px 18px rgba(15,23,42,.05)}
.invoice-complete-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.invoice-metric{background:var(--sky3);border:1px solid var(--border);border-radius:12px;padding:10px;text-align:center;font-weight:900;color:var(--navy)}.invoice-metric small{display:block;color:var(--muted);font-weight:800;font-size:11px}.invoice-metric b{font-size:18px}.invoice-line{background:var(--card);border:1px solid var(--border);border-radius:14px;padding:12px;margin-bottom:10px}.invoice-line-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.invoice-line-head span{font-size:12px;font-weight:900;color:var(--muted)}.invoice-line-head em{font-style:normal;font-size:12px;font-weight:900;color:var(--green);background:var(--green3);border-radius:999px;padding:4px 9px}.invoice-remove{border:none;background:var(--red3);color:var(--red);border-radius:9px;padding:4px 9px;font:800 12px Cairo;cursor:pointer}.invoice-auto-note{font-size:11px;color:var(--muted);font-weight:800;margin-top:6px}.hide-old-add{display:none!important}@media(max-width:768px){.invoice-complete-grid{grid-template-columns:1fr 1fr}.row3{grid-template-columns:1fr}}
body.dark .invoice-complete-box{background:linear-gradient(135deg,#111b2d,#0f172a)}body.dark .invoice-line{background:#111b2d}

.invoice-complete-box{display:block!important;margin-top:14px!important}
.invoice-table-card{background:linear-gradient(135deg,var(--card),var(--card2));border:1px solid var(--border);border-radius:16px;padding:12px;margin:12px 0;box-shadow:0 8px 22px rgba(15,23,42,.06)}
.invoice-table-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:14px;background:var(--card);-webkit-overflow-scrolling:touch}
.invoice-items-table{width:100%;min-width:760px;border-collapse:collapse;font-size:13px}
.invoice-items-table th{background:linear-gradient(135deg,var(--sky3),#f4faf7);color:var(--navy);font-size:12px;font-weight:900;text-align:right;padding:10px;border-bottom:1px solid var(--border);white-space:nowrap}
.invoice-items-table td{padding:8px;border-bottom:1px solid var(--border);vertical-align:middle}
.invoice-items-table tr:last-child td{border-bottom:none}
.invoice-items-table select,.invoice-items-table input{height:40px;padding:7px 9px;font-size:13px;border-radius:10px;background:#fff}
.invoice-items-table input[type=number]{font-size:14px;text-align:center}
.invoice-row-total{font-weight:900;color:var(--green);white-space:nowrap;text-align:center;background:var(--green3);border-radius:10px;padding:8px 10px;display:block}
.invoice-del-btn{border:none;background:var(--red3);color:var(--red);border-radius:10px;padding:8px 11px;font:900 12px Cairo;cursor:pointer;white-space:nowrap}
.invoice-summary-bottom{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-top:12px}
.invoice-summary-bottom .invoice-metric{min-height:74px;display:flex;flex-direction:column;justify-content:center}
.invoice-paid-field{background:var(--sky3);border:1px solid var(--border);border-radius:12px;padding:10px}
.invoice-paid-field label{font-size:11px;margin-bottom:5px;text-align:center;font-weight:900}
.invoice-paid-field input{height:38px;background:#fff;text-align:center;font-weight:900}
.invoice-hint-row{font-size:11px;color:var(--muted);font-weight:800;margin-top:8px;line-height:1.7}
@media(max-width:768px){.invoice-table-card{padding:10px;margin-inline:-4px}.invoice-summary-bottom{grid-template-columns:1fr 1fr}.invoice-paid-field{grid-column:1/-1}.invoice-items-table{min-width:720px}.invoice-items-table th,.invoice-items-table td{padding:7px}.invoice-row-total{padding:7px}}
body.dark .invoice-table-card{background:linear-gradient(135deg,#111b2d,#0f172a);border-color:#243244}body.dark .invoice-table-wrap{background:#0f172a;border-color:#243244}body.dark .invoice-items-table th{background:linear-gradient(135deg,#172334,#0f172a);color:#e5eef9;border-color:#243244}body.dark .invoice-items-table td{border-color:#243244}body.dark .invoice-items-table select,body.dark .invoice-items-table input,body.dark .invoice-paid-field input{background:#0f172a;border-color:#243244;color:#e5eef9}body.dark .invoice-paid-field{background:#111b2d;border-color:#243244}

#ch-pay-mode,#sup-invoice-mode,label[for="ch-pay-mode"],label[for="sup-invoice-mode"],#ch-pay-mode-wrap,#sup-invoice-mode-wrap{display:none!important}
.invoice-paid-field input{pointer-events:auto!important;user-select:auto!important;opacity:1!important}

.fg:has(> #ch-pay-mode),.fg:has(> #sup-invoice-mode),#sup-partial-wrap,#ch-mode-hint,.invoice-hint-row,.invoice-auto-note{display:none!important;}
.row2:has(#ch-note){grid-template-columns:1fr!important;}
#ch-note,#sup-invoice-note{min-height:42px;}
.invoice-table-card{background:linear-gradient(135deg,#ffffff,#f4faf7);border:1px solid var(--border);border-radius:18px;padding:12px;margin:12px 0;box-shadow:0 8px 22px rgba(15,23,42,.05);}
.invoice-table-wrap{border-radius:16px;overflow:auto;border:1px solid var(--border);background:#fff;}
.invoice-summary-bottom{margin-top:12px;}
.invoice-paid-field input{height:44px!important;font-size:16px!important;}
.invoice-items-table select,.invoice-items-table input{width:100%;}
.invoice-del-btn{min-width:58px;}
@media(max-width:768px){
  #pg-charge .card-body,#pg-suppliers .card-body{padding:12px 10px;}
  #pg-charge .fg,#pg-suppliers .fg{margin-bottom:10px;}
  #pg-charge label,#pg-suppliers label{font-size:11.5px;margin-bottom:4px;}
  #pg-charge input,#pg-charge select,#pg-suppliers input,#pg-suppliers select{height:42px;font-size:13px;padding:8px 10px;border-radius:11px;}
  .invoice-table-card{padding:10px;margin:10px -2px;border-radius:16px;}
  .invoice-table-wrap{border:none;background:transparent;overflow:visible;}
  .invoice-items-table{min-width:0!important;width:100%;border-collapse:separate;border-spacing:0 10px;}
  .invoice-items-table thead{display:none;}
  .invoice-items-table tbody,.invoice-items-table tr,.invoice-items-table td{display:block;width:100%;}
  .invoice-items-table tr{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:10px;box-shadow:0 4px 14px rgba(15,23,42,.05);}
  .invoice-items-table td{border:0!important;padding:6px 0!important;}
  .invoice-items-table td:nth-child(1){font-size:12px;font-weight:900;color:var(--muted);padding-bottom:8px!important;}
  .invoice-items-table td:nth-child(2)::before{content:'اسم المنتج';}
  .invoice-items-table td:nth-child(3)::before{content:'الكمية';}
  #ch-items-container .invoice-items-table td:nth-child(4)::before{content:'السعر';}
  #sup-items-container .invoice-items-table td:nth-child(4)::before{content:'سعر الشراء';}
  #sup-items-container .invoice-items-table td:nth-child(5)::before{content:'سعر البيع';}
  .invoice-items-table td:nth-last-child(2)::before{content:'إجمالي الصف';}
  .invoice-items-table td:not(:first-child):not(:last-child)::before{display:block;font-size:11px;color:var(--muted);font-weight:900;margin-bottom:4px;}
  .invoice-row-total{display:flex;align-items:center;justify-content:center;width:100%;height:40px;border-radius:12px;font-size:14px;}
  .invoice-del-btn{width:100%;height:38px;border-radius:11px;}
  .invoice-summary-bottom{grid-template-columns:1fr 1fr!important;gap:8px;}
  .invoice-paid-field{grid-column:1/-1;}
  .invoice-paid-field input{text-align:center;}
  .invoice-metric{padding:9px 6px;}
  .invoice-metric b{font-size:15px;}
}
body.dark .invoice-table-card{background:linear-gradient(135deg,#111b2d,#0f172a);border-color:#243244;}
body.dark .invoice-items-table tr{background:#111b2d;border-color:#243244;}

#balance-date{display:none!important;}
.pro-table-wrap,.invoice-table-wrap{overflow-x:auto!important;overflow-y:hidden;-webkit-overflow-scrolling:touch;max-width:100%;}
.pro-table{min-width:max-content;}
.pro-table th,.pro-table td,.invoice-items-table th,.invoice-items-table td{white-space:nowrap!important;}
.pro-table td:nth-child(4),.pro-table th:nth-child(4){min-width:220px;}
.invoice-items-table th:nth-child(2),.invoice-items-table td:nth-child(2){min-width:240px;}
.invoice-items-table select{min-width:220px;white-space:nowrap!important;}
.invoice-actions,.cust-actions,.record-actions,.table-actions,.actions-cell,.pro-table td:last-child,.invoice-items-table td:last-child{white-space:nowrap!important;}
.invoice-actions,.cust-actions,.record-actions,.table-actions,.actions-cell{display:flex!important;align-items:center!important;gap:6px!important;flex-wrap:nowrap!important;justify-content:flex-start!important;}
.invoice-actions .btn,.cust-actions .btn,.record-actions .btn,.table-actions .btn,.invoice-actions button,.cust-actions button,.record-actions button,.table-actions button,.pro-table td:last-child .btn,.pro-table td:last-child button{flex:0 0 auto!important;width:auto!important;}
@media(max-width:768px){
  .invoice-table-card{margin-inline:0!important;padding:10px!important;}
  .invoice-table-wrap{display:block!important;overflow-x:auto!important;overflow-y:hidden!important;border:1px solid var(--border)!important;border-radius:14px!important;background:var(--card)!important;}
  .invoice-items-table{display:table!important;width:max-content!important;min-width:820px!important;border-collapse:collapse!important;border-spacing:0!important;}
  #sup-items-container .invoice-items-table{min-width:940px!important;}
  .invoice-items-table thead{display:table-header-group!important;}
  .invoice-items-table tbody{display:table-row-group!important;}
  .invoice-items-table tr{display:table-row!important;width:auto!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;background:transparent!important;}
  .invoice-items-table th,.invoice-items-table td{display:table-cell!important;width:auto!important;padding:7px!important;border-bottom:1px solid var(--border)!important;vertical-align:middle!important;}
  .invoice-items-table td::before{content:none!important;display:none!important;}
  .invoice-items-table td:nth-child(1){width:42px!important;padding-bottom:7px!important;}
  .invoice-items-table input,.invoice-items-table select{height:38px!important;min-width:110px!important;}
  .invoice-items-table td:nth-child(2) select{min-width:220px!important;}
  .invoice-del-btn{white-space:nowrap!important;}
  .pro-table{min-width:max-content!important;}
}

  .invoice-summary-bottom.v68{grid-template-columns:repeat(5,1fr)!important}
  .invoice-summary-bottom .invoice-paid-field{grid-column:auto!important}
  @media(max-width:768px){
    .invoice-summary-bottom.v68{grid-template-columns:1fr 1fr!important;gap:8px!important}
    .invoice-summary-bottom.v68 .invoice-paid-field{grid-column:1/-1!important;order:99}
    .invoice-summary-bottom.v68 .invoice-metric{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:10px 8px;text-align:center;min-height:64px}
    .invoice-summary-bottom.v68 .invoice-metric small{font-size:10.5px;color:var(--muted);font-weight:700;display:block;margin-bottom:4px}
    .invoice-summary-bottom.v68 .invoice-metric b{font-size:16px;font-weight:900;color:var(--text)}
  }

#pg-product-categories .pro-table-wrap,
#inv-nets-body .pro-table-wrap,
#inv-log .pro-table-wrap{overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;}
#inv-nets-body .pro-table,#inv-log .pro-table{min-width:max-content!important;width:max-content!important;}
#inv-nets-body .pro-table th,#inv-nets-body .pro-table td,
#inv-log .pro-table th,#inv-log .pro-table td{white-space:nowrap!important;min-width:auto!important;}
#inv-nets-body .pro-table td:nth-child(4),#inv-nets-body .pro-table th:nth-child(4),
#inv-log .pro-table td:nth-child(4),#inv-log .pro-table th:nth-child(4){min-width:auto!important;}
.action-text-btn{display:inline-flex;align-items:center;justify-content:center;gap:5px;width:auto!important;min-width:64px;padding:6px 10px;border:none;border-radius:8px;font-family:'Cairo',sans-serif;font-size:12px;font-weight:900;cursor:pointer;white-space:nowrap;margin-inline:2px;}
.action-text-btn.edit{background:var(--sky3);color:#1d4ed8;border:1px solid var(--border);}
.action-text-btn.delete{background:#fef2f2;color:#dc2626;border:1px solid #fecaca;}
.action-text-btn.print{background:#ecfdf5;color:#059669;border:1px solid #a7f3d0;}
.v70-actions{display:flex!important;align-items:center!important;gap:6px!important;flex-wrap:nowrap!important;white-space:nowrap!important;}
.v70-inline-note{font-size:11px;color:var(--muted);font-weight:800;margin-top:4px;}
@media(max-width:768px){
  #pg-product-categories .row2{grid-template-columns:1fr!important;}
  #inv-nets-body .pro-table{min-width:920px!important;}
  #inv-log .pro-table{min-width:760px!important;}
}
body.dark .action-text-btn.edit{background:#0f172a;color:#93c5fd;border-color:#243244;}
body.dark .action-text-btn.delete{background:#3a1014;color:#fca5a5;border-color:#7f1d1d;}

  #inv-nets-body .pro-table-wrap,
  #inv-log .pro-table-wrap{width:100% !important;max-width:100% !important;overflow-x:auto !important;-webkit-overflow-scrolling:touch !important;border-radius:14px !important;}
  #inv-nets-body .pro-table{width:100% !important;min-width:980px !important;}
  #inv-log .pro-table{width:100% !important;min-width:1180px !important;table-layout:auto !important;}
  #inv-nets-body .pro-table th,#inv-nets-body .pro-table td,#inv-log .pro-table th,#inv-log .pro-table td{white-space:nowrap !important;vertical-align:middle !important;}
  #inv-log .inv-move-note{white-space:normal !important;min-width:190px !important;max-width:280px !important;line-height:1.55 !important;}
  #inv-log .inv-move-product{min-width:150px !important;font-weight:900 !important;}
  #inv-log .inv-move-code{font-family:monospace !important;direction:ltr !important;text-align:center !important;}
  @media(max-width:768px){#inv-nets-body .pro-table{min-width:920px !important;}#inv-log .pro-table{min-width:1120px !important;}}

  .v72-actions{display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap;flex-wrap:nowrap}
  .v72-ico-btn{width:34px;height:34px;border-radius:10px;border:1px solid var(--border);background:#fff;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:15px;box-shadow:0 2px 8px rgba(15,23,42,.04)}
  .v72-ico-btn:hover{background:var(--sky3);border-color:var(--sky2)}
  .v72-ico-btn.danger{background:var(--red3);border-color:#fecaca;color:var(--red)}
  .v72-ico-btn.edit{background:var(--sky3);color:var(--blue)}
  .v72-ico-btn.statement{background:var(--gold3);color:var(--gold)}
  body.dark .v72-ico-btn{background:#0f172a;border-color:#243244;color:#e5eef9}
  body.dark .v72-ico-btn.danger{background:#3a1014;color:#fca5a5;border-color:#7f1d1d}
  body.dark .v72-ico-btn.edit{background:#0b2442;color:#93c5fd}
  body.dark .v72-ico-btn.statement{background:#3a2a07;color:#fde68a}
  #cust-list .pro-table{min-width:720px!important}
  #cust-list .pro-table th,#cust-list .pro-table td,#sup-list .pro-table th,#sup-list .pro-table td,#cred-list .pro-table th,#cred-list .pro-table td{white-space:nowrap!important;vertical-align:middle!important}
  #cust-list .pro-table th:nth-child(4),#cust-list .pro-table td:nth-child(4),#cust-list .pro-table th:nth-child(5),#cust-list .pro-table td:nth-child(5){padding-left:8px!important;padding-right:8px!important;min-width:86px!important}
  #sup-list .pro-table,#cred-list .pro-table{min-width:760px!important;width:100%!important}
  #sup-list .pro-table-wrap,#cred-list .pro-table-wrap{width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important}
  .pos-cat-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px;position:sticky;top:0;background:var(--card);z-index:2;padding-bottom:8px}
  .pos-cat-btn{border:1px solid var(--border);background:#fff;border-radius:999px;padding:7px 12px;font-family:'Cairo',sans-serif;font-size:12px;font-weight:900;cursor:pointer;color:var(--muted);white-space:nowrap}
  .pos-cat-btn.on{background:linear-gradient(135deg,var(--blue),var(--sky));border-color:var(--blue);color:#fff;box-shadow:0 6px 16px rgba(37,99,235,.16)}
  body.dark .pos-cat-tabs{background:var(--card)}
  body.dark .pos-cat-btn{background:#0f172a;border-color:#243244;color:#e5eef9}
  body.dark .pos-cat-btn.on{background:linear-gradient(135deg,#1d4ed8,#2563eb);color:#fff}
  .pos-product-card{min-height:118px}
  @media(max-width:768px){.v72-ico-btn{width:32px;height:32px}.pos-cat-tabs{flex-wrap:nowrap;overflow-x:auto;padding-bottom:10px}.pos-cat-btn{flex:0 0 auto}.pos-product-grid{grid-template-columns:repeat(2,minmax(135px,1fr))!important}}

  .v73-settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .v73-logo-preview{width:72px;height:72px;border-radius:16px;border:1px solid var(--border);background:#fff;display:flex;align-items:center;justify-content:center;overflow:hidden;font-size:28px}
  .v73-logo-preview img{width:100%;height:100%;object-fit:contain}
  .v73-profit-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px}
  .v73-profit-card{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:14px;box-shadow:var(--shadow)}
  .v73-profit-card small{display:block;color:var(--muted);font-weight:800;margin-bottom:6px;font-size:11px}
  .v73-profit-card b{font-size:18px;color:var(--navy)}
  .v73-qr-box{display:flex;align-items:center;justify-content:center;margin-top:8px}
  @media(max-width:768px){.v73-settings-grid,.v73-profit-grid{grid-template-columns:1fr}.v73-profit-card b{font-size:16px}}

  .pos-mobile-cart-toggle{display:none!important;visibility:hidden!important;pointer-events:none!important;}

  #pg-suppliers > .inv-hero,
  #pg-creditors > .inv-hero,
  #pg-purchases > .inv-hero,
  #pg-inventory > .inv-hero,
  #pg-treasury > .inv-hero{display:none!important;}

  #sup-list .pro-table-wrap,
  #cred-list .pro-table-wrap,
  #treasury-log .pro-table-wrap{width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;}
  #sup-list .pro-table,#cred-list .pro-table{min-width:980px!important;width:100%!important;}
  #treasury-log .pro-table{min-width:1120px!important;width:100%!important;}
  #sup-list th,#sup-list td,#cred-list th,#cred-list td,#treasury-log th,#treasury-log td{white-space:nowrap!important;vertical-align:middle!important;}
  #sup-list tfoot td,#cred-list tfoot td{font-weight:900!important;background:linear-gradient(135deg,var(--card2),var(--sky3))!important;}
  body.dark #sup-list tfoot td,body.dark #cred-list tfoot td{background:#111b2d!important;}

  #pg-product-categories .pro-table-wrap{width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;}
  #pg-product-categories .pro-table{min-width:620px!important;width:100%!important;}
  #pg-product-categories th,#pg-product-categories td{white-space:nowrap!important;}

  #treasury-log .treasury-account-cell{font-weight:900;color:var(--navy)}
  #treasury-log .treasury-current{font-weight:900;color:var(--blue)}
  body.dark #treasury-log .treasury-account-cell{color:#e5eef9}
  #treasury-log .pro-table th:nth-child(6),#treasury-log .pro-table th:nth-child(7),#treasury-log .pro-table th:nth-child(8),
  #treasury-log .pro-table td:nth-child(6),#treasury-log .pro-table td:nth-child(7),#treasury-log .pro-table td:nth-child(8){text-align:center!important;}

  #hdr-cart-btn{display:inline-flex!important;}

  .v78-action-row{display:flex;gap:6px;align-items:center;justify-content:center;flex-wrap:nowrap;white-space:nowrap}
  .v78-action-row .btn{width:auto;min-width:auto;padding:7px 10px;font-size:12px;white-space:nowrap}
  .v78-totals-row td{font-weight:900;background:var(--card2);color:var(--navy)}
  .v78-note{font-size:12px;color:var(--muted);font-weight:800;line-height:1.7;margin-bottom:10px}
  .v78-chip{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--border);background:var(--card2);border-radius:999px;padding:4px 9px;font-size:11px;font-weight:900;color:var(--muted)}
  .v78-page-tools{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:12px}
  .v78-page-tools .btn{width:auto}
  .v78-wide-table{min-width:760px}
  @media(max-width:768px){.v78-page-tools{align-items:stretch}.v78-page-tools .btn{width:100%}.v78-action-row .btn{padding:6px 8px;font-size:11px}}

@media(max-width:600px){.bottom-nav-inner{height:60px;gap:0}.bn-btn{font-size:7px;padding:0;line-height:1.1}.bn-btn .bn-ico{font-size:15px}}

.hdr-logout-btn{color:#dc2626!important;background:rgba(220,38,38,.08)!important;border:1.5px solid rgba(220,38,38,.28)!important;border-radius:9px!important;transition:all .16s!important;}
.hdr-logout-btn:hover{background:rgba(220,38,38,.16)!important;border-color:rgba(220,38,38,.5)!important;}
body.dark .hdr-logout-btn{background:rgba(220,38,38,.12)!important;border-color:rgba(248,113,113,.25)!important;color:#fca5a5!important;}
body.dark .hdr-logout-btn:hover{background:rgba(220,38,38,.22)!important;}
.v89-pos-actions{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 12px;align-items:center}
.v89-pos-actions .btn{width:auto;padding:9px 13px;font-size:12px;border-radius:11px}
.v89-pos-note{font-size:12px;color:var(--muted);font-weight:800;line-height:1.7;margin:6px 0 10px}
.v89-permission-warn{background:var(--gold3);border-right:3px solid var(--gold2);border-radius:12px;padding:10px 12px;color:#92400e;font-weight:800;font-size:12px;line-height:1.7;margin:10px 0}
body[data-user-role="cashier"] #pg-inventory button:not(.v89-allow),
body[data-user-role="cashier"] #pg-inventory input,
body[data-user-role="cashier"] #pg-inventory textarea{pointer-events:none;opacity:.68}
@media(max-width:768px){.v89-pos-actions .btn{width:100%}.hdr-logout-btn{display:inline-flex!important}}

  body[data-user-role="cashier"] .admin-only,
  body[data-user-role="manager"] .admin-only,
  body[data-user-role="accountant"] .admin-only{display:none!important}
  body[data-user-role="admin"] .admin-only{display:initial}

body[data-user-role="cashier"] #pg-home,
body[data-user-role="cashier"] #pg-charge,
body[data-user-role="cashier"] #pg-customers,
body[data-user-role="cashier"] #pg-collect,
body[data-user-role="cashier"] #pg-pay,
body[data-user-role="cashier"] #pg-creditors,
body[data-user-role="cashier"] #pg-treasury,
body[data-user-role="cashier"] #pg-profits,
body[data-user-role="cashier"] #pg-product-categories,
body[data-user-role="cashier"] #pg-reports,
body[data-user-role="cashier"] #pg-suppliers,
body[data-user-role="cashier"] #pg-purchases,
body[data-user-role="cashier"] #pg-assets,
body[data-user-role="cashier"] #pg-balance,
body[data-user-role="cashier"] #pg-settings{ display:none!important; }

body[data-user-role="cashier"] .sidebar,
body[data-user-role="cashier"] #desktop-sidebar,
body[data-user-role="cashier"] .nav-drawer,
body[data-user-role="cashier"] .hdr-menu-btn,
body[data-user-role="cashier"] .bottom-nav,
body[data-user-role="cashier"] .nav{ display:none!important; }
body[data-user-role="cashier"] .main{ max-width:100%!important; }
/* ✅ إخفاء الـ sidebar أثناء تحميل الـ role — يمنع الوميض */
body.role-loading .sidebar,
body.role-loading #desktop-sidebar,
body.role-loading .nav-drawer,
body.role-loading .bottom-nav{ visibility:hidden; opacity:0; transition:none!important; }

body[data-user-role="cashier"] .admin-only,
body[data-user-role="manager"] .admin-only,
body[data-user-role="accountant"] .admin-only{ display:none!important; }
body[data-user-role="cashier"] #users-admin-card,
body[data-user-role="manager"] #users-admin-card,
body[data-user-role="accountant"] #users-admin-card{ display:none!important; }

.pos-history-toolbar{display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-bottom:12px}
.pos-history-toolbar .fg{min-width:180px;margin-bottom:0;flex:1}
.pos-history-total{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.pos-history-total .meta-pill{background:var(--card2);border:1px solid var(--border);border-radius:999px;padding:7px 12px;font-size:12px;font-weight:900;color:var(--navy)}
.pos-history-actions{display:flex;gap:6px;flex-wrap:wrap}.pos-history-actions .btn{width:auto}
.audit-mini-note{font-size:11px;color:var(--muted);font-weight:800;margin-top:6px;line-height:1.7}
@media(max-width:768px){.pos-history-toolbar{display:block}.pos-history-toolbar .fg{margin-bottom:8px;min-width:0}.pos-history-actions .btn{width:100%}}

    @keyframes splashSpin{to{transform:rotate(360deg)}}
    @keyframes splashPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}


/* CSS login-fix merged into HARD FIX below */

.dash-actions-pro{
  grid-template-columns:repeat(4,1fr) !important;
  gap:14px !important;
  margin-bottom:16px !important;
}
.dash-action{
  min-height:154px;
  padding:18px 12px 15px !important;
  border-radius:24px !important;
  background:linear-gradient(180deg,rgba(255,255,255,.88),var(--card)) !important;
  border:1px solid rgba(148,163,184,.22) !important;
  box-shadow:0 8px 24px rgba(15,23,42,.07) !important;
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:8px !important;
  position:relative;
  overflow:hidden;
}
.dash-action::before{
  content:'';
  position:absolute;
  inset:0 0 auto 0;
  height:52px;
  background:linear-gradient(135deg,rgba(22,101,52,.08),rgba(96,165,250,.04));
  pointer-events:none;
}
.dash-action .ico{
  position:relative;
  z-index:1;
  width:66px !important;
  height:66px !important;
  margin:0 auto 2px !important;
  border-radius:22px !important;
  font-size:31px !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7),0 10px 22px rgba(15,23,42,.08);
  border:1px solid rgba(255,255,255,.65);
}
.dash-action .lbl{
  position:relative;
  z-index:1;
  display:block !important;
  font-size:14px !important;
  font-weight:900 !important;
  color:var(--navy) !important;
  line-height:1.35 !important;
  margin-top:2px !important;
}
.dash-action .sub{
  position:relative;
  z-index:1;
  display:block !important;
  font-size:11.5px !important;
  font-weight:800 !important;
  color:var(--muted) !important;
  line-height:1.7 !important;
  max-width:130px;
  margin:0 auto !important;
}
.dash-action:hover{
  transform:translateY(-4px) !important;
  border-color:rgba(37,99,235,.28) !important;
  box-shadow:0 18px 38px rgba(37,99,235,.14) !important;
}
body.dark .dash-action{
  background:linear-gradient(180deg,#121c2d,#0f172a) !important;
  border-color:#243244 !important;
  box-shadow:0 10px 26px rgba(0,0,0,.24) !important;
}
body.dark .dash-action::before{background:linear-gradient(135deg,rgba(96,165,250,.12),rgba(15,23,42,0));}
body.dark .dash-action .ico{border-color:rgba(255,255,255,.06);box-shadow:0 12px 24px rgba(0,0,0,.22);}

@media(max-width:900px){
  .dash-actions-pro{grid-template-columns:repeat(3,1fr) !important;}
}
@media(max-width:600px){
  .dash-actions-pro{grid-template-columns:repeat(2,1fr) !important;gap:10px !important;}
  .dash-action{min-height:142px;padding:15px 8px 13px !important;border-radius:20px !important;}
  .dash-action .ico{width:56px !important;height:56px !important;font-size:27px !important;border-radius:18px !important;}
  .dash-action .lbl{font-size:12.5px !important;}
  .dash-action .sub{font-size:10.5px !important;line-height:1.55 !important;max-width:112px;}
}


/* ===== HARD FIX: منع ظهور شاشة الدخول عند سحب الصفحة بعد الدخول ===== */
body.app-ready #login-screen,
body.app-ready #setup-screen,
body.app-ready .auth-hidden{
  display:none !important;
  visibility:hidden !important;
  opacity:0 !important;
  pointer-events:none !important;
  position:fixed !important;
  top:-300vh !important;
  right:-300vw !important;
  width:0 !important;
  height:0 !important;
  min-width:0 !important;
  min-height:0 !important;
  max-width:0 !important;
  max-height:0 !important;
  margin:0 !important;
  padding:0 !important;
  overflow:hidden !important;
  z-index:-1 !important;
}
body.app-ready{
  overscroll-behavior-y:none;
}
body.app-ready #app{
  display:flex !important;
  flex-direction:column !important;
  min-height:100vh !important;
  width:100% !important;
  position:relative !important;
  z-index:1 !important;
}
@supports (height:100dvh){
  body.app-ready #app{min-height:100dvh !important;}
}
/* ===== موبايل: إلغاء flex و height ثابت على #app عشان السكرول يشتغل ===== */
@media(max-width:768px){
  body.app-ready{
    overflow-y:auto !important;
    overflow-x:hidden !important;
    height:auto !important;
    position:static !important;
    overscroll-behavior-y:auto !important;
  }
  body.app-ready #app{
    display:block !important;
    height:auto !important;
    min-height:100dvh !important;
    overflow:visible !important;
  }
  .app-body{
    display:block !important;
    height:auto !important;
    overflow:visible !important;
  }
  .main-wrap{
    height:auto !important;
    overflow-y:visible !important;
    overflow-x:hidden !important;
  }
}



/* ===== POS delete confirmation modal (admin only) ===== */
.pos-delete-modal{position:fixed;inset:0;z-index:9999;display:none;align-items:center;justify-content:center;padding:16px;}
.pos-delete-modal.on{display:flex;}
.pos-delete-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.55);backdrop-filter:blur(4px);}
.pos-delete-box{position:relative;width:min(420px,100%);background:var(--card);border:1px solid var(--border);border-radius:22px;box-shadow:0 28px 70px rgba(15,23,42,.30);padding:18px;animation:fadeIn .18s ease;}
.pos-delete-icon{width:54px;height:54px;border-radius:18px;background:var(--red3);display:flex;align-items:center;justify-content:center;font-size:26px;margin:0 auto 10px;}
.pos-delete-box h3{font-size:17px;font-weight:900;color:var(--red);text-align:center;margin-bottom:6px;}
.pos-delete-text{font-size:12.5px;font-weight:800;color:var(--muted);text-align:center;line-height:1.7;margin-bottom:12px;}
.pos-delete-info{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0;}
.pos-delete-info div{background:var(--card2);border:1px solid var(--border);border-radius:14px;padding:9px;}
.pos-delete-info span{display:block;font-size:10.5px;color:var(--muted);font-weight:800;margin-bottom:3px;}
.pos-delete-info b{display:block;font-size:12.5px;color:var(--text);font-weight:900;word-break:break-word;}
.pos-delete-actions{display:flex;gap:8px;margin-top:12px;}
.pos-delete-actions .btn{width:100%;}
body.dark .pos-delete-backdrop{background:rgba(0,0,0,.65);}
@media(max-width:520px){.pos-delete-info{grid-template-columns:1fr}.pos-delete-actions{flex-direction:column-reverse}}



/* vUsers mobile page isolation fix */
.pg{display:none!important;width:100%;position:relative;z-index:1;overflow:visible;clear:both;}
.pg.on{display:block!important;}
.pg:not(.on){visibility:hidden!important;height:0!important;overflow:hidden!important;pointer-events:none!important;margin:0!important;padding:0!important;}
.main-wrap{overflow-x:hidden!important;}
@media(max-width:768px){
  .main{overflow-x:hidden!important;}
  #pg-assets:not(.on), #pg-home:not(.on){display:none!important;visibility:hidden!important;height:0!important;overflow:hidden!important;}
  #pg-assets > div[style*="grid-template-columns:1fr 1fr 1fr"]{grid-template-columns:1fr!important;}
}

  #activity-log-card-main .card-body > div:first-child{max-width:100%;}
@media(max-width:600px){
  #activity-log-card-main .card-body > div:first-child{grid-template-columns:1fr!important;}
  #activity-search-main,#activity-date-main{width:100%;}
}




/* v-stable-mobile-users-fixes */
html,body{max-width:100%;overflow-x:hidden;}
.main-wrap,.main,.app-body,#app{max-width:100%;overflow-x:hidden;}
.pro-table-wrap{max-width:100%;}
@media(max-width:768px){
  #pg-users{overflow-x:hidden;}
  #pg-users .pg-title{display:flex;align-items:center;justify-content:flex-start;gap:8px;text-align:right;line-height:1.5;}
  #pg-users .card-head{align-items:center;gap:10px;flex-wrap:wrap;}
  #pg-users .card-head .card-title{flex:1;min-width:160px;justify-content:flex-start;text-align:right;}
  #pg-users .card-head .btn{width:auto;min-width:110px;}
  #pg-users .users-my-account-card .card-body{display:flex!important;flex-direction:row!important;align-items:center!important;text-align:right!important;}
  #pg-users #activity-log-card-main .card-body > div:first-child{grid-template-columns:1fr!important;align-items:stretch!important;}
  #pg-users #activity-log-card-main .btn{width:100%;}
  .more-sheet .more-item{display:flex!important;align-items:center!important;justify-content:flex-start!important;gap:10px!important;text-align:right!important;direction:rtl!important;}
  .more-sheet .more-item span{width:24px;min-width:24px;text-align:center;display:inline-flex;align-items:center;justify-content:center;}
}



/* v65: fixed header + smoother users/permissions mobile scrolling */
:root{--app-header-h:64px;}
body.app-ready .hdr{
  position:fixed!important;top:0;right:0;left:0;width:100%;z-index:999;
}
body.app-ready .app-body{
  padding-top:var(--app-header-h);
}
@media (min-width:769px){
  body.app-ready #app{height:100vh;}
  body.app-ready .app-body{height:100vh;min-height:0;}
}
@media (max-width:768px){
  :root{--app-header-h:60px;}
  body.app-ready{padding-top:var(--app-header-h);}
  body.app-ready .app-body{padding-top:0;}
  .hdr{min-height:var(--app-header-h);}
  .main{padding-top:14px;}
  .nav-drawer{top:var(--app-header-h)!important;}
  #pg-users{
    overflow-x:hidden!important;
    overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-y;
  }
  #pg-users .card{overflow:visible;}
  #pg-users .card-body{
    overflow-x:visible!important;
    -webkit-overflow-scrolling:touch;
  }
  #pg-users .pro-table-wrap{
    overflow-x:auto!important;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    scroll-behavior:smooth;
    border-radius:14px;
  }
  #pg-users .users-my-account-card .card-body{
    flex-wrap:nowrap!important;
    min-width:0;
  }
}



/* metro v71 overrides removed — new enterprise dashboard active */
#pg-home .dash-title,
#pg-home .dash-health-title,
#pg-home .dash-health-row b,
#pg-home .dash-balance-value{
  color:#fff !important;
}
#pg-home .dash-kicker,
#pg-home .dash-sub,
#pg-home .dash-balance-label,
#pg-home .dash-health-row span,
#pg-home .dash-balance-value small{
  color:rgba(255,255,255,.72) !important;
}
#pg-home .dash-actions-pro{
  display:grid !important;
  grid-template-columns:repeat(6,minmax(0,1fr)) !important;
  grid-auto-rows:118px !important;
  gap:8px !important;
  margin-bottom:10px !important;
}
#pg-home .dash-action{
  position:relative !important;
  overflow:hidden !important;
  align-items:flex-start !important;
  justify-content:flex-end !important;
  display:flex !important;
  flex-direction:column !important;
  gap:4px !important;
  text-align:right !important;
  border:0 !important;
  border-radius:0 !important;
  padding:14px 14px 12px !important;
  min-height:118px !important;
  box-shadow:none !important;
  color:#fff !important;
  isolation:isolate !important;
}
#pg-home .dash-action::before{
  content:'';
  position:absolute;
  inset:0;
  background:linear-gradient(135deg,rgba(255,255,255,.16),rgba(255,255,255,0) 45%);
  z-index:-1;
}
#pg-home .dash-action::after{
  content:'';
  position:absolute;
  left:-28px;
  top:-28px;
  width:92px;
  height:92px;
  border-radius:50%;
  background:rgba(255,255,255,.10);
  z-index:-1;
}
#pg-home .dash-action:hover{
  transform:translateY(-2px) !important;
  filter:brightness(1.06);
  box-shadow:0 10px 22px rgba(0,0,0,.18) !important;
}
#pg-home .dash-action:active{transform:scale(.985) !important;}
#pg-home .dash-action .ico{
  position:absolute !important;
  top:13px !important;
  left:13px !important;
  width:44px !important;
  height:44px !important;
  margin:0 !important;
  border-radius:0 !important;
  background:rgba(255,255,255,.16) !important;
  color:#fff !important;
  font-size:24px !important;
  border:1px solid rgba(255,255,255,.12);
}
#pg-home .dash-action .lbl{
  color:#fff !important;
  font-size:15px !important;
  font-weight:900 !important;
  line-height:1.25 !important;
  text-shadow:0 1px 2px rgba(0,0,0,.18);
}
#pg-home .dash-action .sub{
  color:rgba(255,255,255,.78) !important;
  font-size:10.5px !important;
  font-weight:800 !important;
  line-height:1.45 !important;
  max-width:88%;
}
#pg-home .dash-action:nth-child(1){grid-column:span 2;background:#16a34a !important;}
#pg-home .dash-action:nth-child(2){grid-column:span 2;background:#0ea5e9 !important;}
#pg-home .dash-action:nth-child(3){background:#22c55e !important;}
#pg-home .dash-action:nth-child(4){background:#f59e0b !important;}
#pg-home .dash-action:nth-child(5){background:#ef4444 !important;}
#pg-home .dash-action:nth-child(6){background:#14b8a6 !important;}
#pg-home .dash-action:nth-child(7){background:#2563eb !important;}
#pg-home .dash-action:nth-child(8){background:#7c3aed !important;}
#pg-home .dash-action:nth-child(9){grid-column:span 2;background:#059669 !important;}
#pg-home .dash-action:nth-child(10){background:#0891b2 !important;}
#pg-home .dash-action:nth-child(11){background:#db2777 !important;}
#pg-home .dash-action:nth-child(12){background:#475569 !important;}
#pg-home .dash-mini-grid{
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  gap:8px !important;
  margin-bottom:12px !important;
}
#pg-home .dash-mini{
  border:0 !important;
  border-radius:0 !important;
  min-height:92px !important;
  box-shadow:none !important;
  color:#fff !important;
  padding:12px !important;
  align-items:flex-end !important;
  position:relative !important;
  overflow:hidden !important;
}
#pg-home .dash-mini::after{
  content:'';position:absolute;left:-24px;top:-24px;width:76px;height:76px;border-radius:50%;background:rgba(255,255,255,.12);
}
#pg-home .dash-mini.green{background:#22c55e !important;}
#pg-home .dash-mini.purple{background:#8b5cf6 !important;}
#pg-home .dash-mini.gold{background:#f59e0b !important;}
#pg-home .dash-mini.red{background:#ef4444 !important;}
#pg-home .dash-mini-ico{
  background:rgba(255,255,255,.16) !important;
  color:#fff !important;
  border-radius:0 !important;
  width:42px !important;
  height:42px !important;
  position:relative;z-index:1;
}
#pg-home .dash-mini b,
#pg-home .dash-mini span{color:#fff !important;position:relative;z-index:1;}
#pg-home .dash-board-grid .card{
  border-radius:0 !important;
}
@media(max-width:900px){
  #pg-home .dash-actions-pro{grid-template-columns:repeat(3,minmax(0,1fr)) !important;grid-auto-rows:112px !important;}
  #pg-home .dash-action:nth-child(n){grid-column:span 1;}
  #pg-home .dash-action:nth-child(1),#pg-home .dash-action:nth-child(9){grid-column:span 2;}
}
@media(max-width:600px){
  #pg-home .dash-actions-pro{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:7px !important;grid-auto-rows:106px !important;}
  #pg-home .dash-action:nth-child(n){grid-column:span 1;min-height:106px !important;padding:12px !important;}
  #pg-home .dash-action .ico{width:38px !important;height:38px !important;font-size:21px !important;}
  #pg-home .dash-action .lbl{font-size:13px !important;}
  #pg-home .dash-action .sub{font-size:9.5px !important;}
  #pg-home .dash-mini-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
  #pg-home .dash-main-card{display:block !important;}
  #pg-home .dash-big-balance{text-align:right !important;margin-top:12px;}
}


/* v73 Metro Dashboard + fixed local date filters */
.metro-dashboard{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin-bottom:18px;direction:rtl;}
.metro-tile{min-height:104px;border:0;border-radius:0;padding:14px 13px;color:#fff;font-family:'Cairo',sans-serif;font-weight:900;text-align:right;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;cursor:pointer;box-shadow:0 8px 18px rgba(15,23,42,.13);position:relative;overflow:hidden;transition:.16s;}
.metro-tile::after{content:'';position:absolute;left:-30px;bottom:-30px;width:95px;height:95px;border-radius:50%;background:rgba(255,255,255,.12);}
.metro-tile:hover{transform:translateY(-2px);filter:saturate(1.08);}
.metro-tile:active{transform:scale(.98);}
.mt-ico{font-size:25px;line-height:1;position:relative;z-index:1;}
.mt-title{font-size:14px;line-height:1.35;position:relative;z-index:1;}
.mt-sub{font-size:10.5px;font-weight:800;opacity:.86;position:relative;z-index:1;}
.mt-value{font-size:18px;font-weight:900;line-height:1.2;position:relative;z-index:1;}
.metro-wide{grid-column:span 2;}
.metro-panel{grid-column:span 2;min-height:170px;cursor:default;background:#0f766e;}
.metro-panel:hover{transform:none;filter:none;}
.metro-panel-body{position:relative;z-index:2;width:100%;margin-top:10px;font-weight:800;max-height:205px;overflow:auto;-webkit-overflow-scrolling:touch;}
.metro-panel-body .pro-table-wrap{border:0;border-radius:0;margin:0;background:rgba(255,255,255,.10);}
.metro-panel-body .pro-table{min-width:0;font-size:11.5px;color:#fff;}
.metro-panel-body .pro-table thead tr{background:rgba(255,255,255,.16);color:#fff;}
.metro-panel-body .pro-table td,.metro-panel-body .pro-table th{padding:7px 8px;color:#fff!important;border-color:rgba(255,255,255,.16)!important;}
.metro-panel-body .empty{background:rgba(255,255,255,.12);color:#fff;border-radius:0;padding:12px;}
.metro-panel-body .dash-alert{background:rgba(255,255,255,.13)!important;border:1px solid rgba(255,255,255,.18)!important;color:#fff!important;border-radius:0!important;margin-bottom:7px;padding:9px!important;display:flex;gap:8px;align-items:center;}
.metro-panel-body .atitle,.metro-panel-body .asub{color:#fff!important;}
.metro-green{background:#13a538;}.metro-blue{background:#0872b8;}.metro-gold{background:#d88916;}.metro-purple{background:#683bb7;}.metro-red{background:#c72d3a;}.metro-orange{background:#e25b18;}.metro-navy{background:#124e78;}.metro-teal{background:#078b83;}.metro-gray{background:#4b5563;}.metro-info{background:#0ea5e9;}
body.dark .metro-tile{box-shadow:0 10px 26px rgba(0,0,0,.28);}
@media(max-width:900px){.metro-dashboard{grid-template-columns:repeat(3,minmax(0,1fr));}.metro-wide,.metro-panel{grid-column:span 3;}}
@media(max-width:600px){.metro-dashboard{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.metro-tile{min-height:96px;padding:12px 10px}.metro-wide,.metro-panel{grid-column:span 2}.mt-title{font-size:12px}.mt-value{font-size:15px}.mt-sub{font-size:9.5px}.metro-panel{min-height:150px}}



/* ══════════════════════════════════════════
   ENTERPRISE THEME
══════════════════════════════════════════ */


/* ══════════════════════════════════════════════════════
   🎨 LIGHT MODE — نظام ألوان متناسق للوضع الفاتح
   ══════════════════════════════════════════════════════ */

/* متغيرات الوضع الفاتح */
:root {
  --navy:   #1e293b;
  --blue:   #2563eb;
  --sky:    #3b82f6;
  --sky2:   #93c5fd;
  --sky3:   #eff6ff;
  --gold:   #b45309;
  --gold2:  #d97706;
  --gold3:  #fef3c7;
  --green:  #059669;
  --green2: #10b981;
  --green3: #d1fae5;
  --red:    #dc2626;
  --red2:   #ef4444;
  --red3:   #fee2e2;
  --orange: #ea580c;
  --orange2:#f97316;
  --orange3:#ffedd5;
  --purple: #7c3aed;
  --purple2:#8b5cf6;
  --purple3:#ede9fe;
  --bg:     #c8d4e0;
  --card:   #dde6ef;
  --card2:  #d0dce8;
  --text:   #0f172a;
  --muted:  #4a5568;
  --border: #a8bcd0;
  --r:      12px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.06);
  --shadow2: 0 8px 28px rgba(15,23,42,.12);
}

/* ── Body ── */
body { font-family: 'Cairo', sans-serif !important; background: var(--bg) !important; color: var(--text) !important; font-size: 13px !important; }

/* ── الـ Header ── */
.hdr {
  background: linear-gradient(135deg,#0f172a 0%,#1e3a5f 55%,#1d4ed8 100%) !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
  box-shadow: 0 2px 16px rgba(15,23,42,.3) !important;
  height: 52px !important; min-height: 52px !important;
  padding: 0 16px !important; align-items: center !important;
}
:root { --app-header-h: 52px; }
.hdr-left h1 { font-size: 14px !important; font-weight: 800 !important; color: #f1f5f9 !important; }
.hdr-left h1 span { color: #fbbf24 !important; }
.hdr-left small { color: rgba(203,213,225,.65) !important; font-size: 10px !important; }
.hdr-badge { background: rgba(255,255,255,.10) !important; border: 1px solid rgba(255,255,255,.16) !important; border-radius: 6px !important; }
.hdr-badge.gold { background: rgba(251,191,36,.15) !important; border-color: rgba(251,191,36,.28) !important; }
.hdr-icon-btn, .hdr-theme-btn { background: rgba(255,255,255,.10) !important; border: 1px solid rgba(255,255,255,.16) !important; border-radius: 6px !important; color: #cbd5e1 !important; }
.hdr-icon-btn:hover, .hdr-theme-btn:hover { background: rgba(255,255,255,.18) !important; color: #fff !important; }

/* ── السايدبار ── */
:root {
  --sb-bg: linear-gradient(180deg,#f8fafc 0%,#f1f5f9 100%);
  --sb-border: rgba(203,213,225,.6);
  --sb-shadow: 2px 0 12px rgba(15,23,42,.06);
  --sb-logo-text: #0f172a;
  --sb-logo-span: #d97706;
  --sb-label-color: #94a3b8;
  --sb-label-line: rgba(226,232,240,.9);
  --sb-item-color: #475569;
  --sb-item-hover-bg: rgba(37,99,235,.07);
  --sb-item-hover-border: rgba(37,99,235,.14);
  --sb-item-hover-color: #1d4ed8;
  --sb-item-on-bg: linear-gradient(135deg,rgba(37,99,235,.13),rgba(59,130,246,.07));
  --sb-item-on-border: rgba(37,99,235,.28);
  --sb-item-on-color: #1d4ed8;
  --sb-item-on-shadow: 0 2px 8px rgba(37,99,235,.12);
  --sb-ico-bg: rgba(37,99,235,.07);
  --sb-ico-border: rgba(37,99,235,.10);
  --sb-ico-on-bg: rgba(37,99,235,.16);
  --sb-dot: rgba(203,213,225,.9);
  --sb-dot-on: #2563eb;
  --sb-footer-border: rgba(226,232,240,.9);
  --sb-footer-bg: rgba(248,250,252,.9);
  --sb-user-bg: rgba(241,245,249,.8);
  --sb-user-border: rgba(226,232,240,.9);
  --sb-avatar-bg: linear-gradient(135deg,rgba(37,99,235,.28),rgba(124,58,237,.18));
  --sb-name-color: #0f172a;
  --sb-role-color: #64748b;
}
.sidebar { width: 230px !important; }
.sb-item { border-radius: 8px !important; font-size: 12.5px !important; padding: 8px 12px !important; margin-bottom: 2px !important; }
.sb-item.on { border-radius: 8px !important; }
.sb-ico { border-radius: 8px !important; width: 28px !important; height: 28px !important; font-size: 14px !important; }
.sb-logout-btn { border-radius: 8px !important; }

/* ── الكروت ── */
.card { border-radius: 12px !important; border: 1px solid var(--border) !important; background: var(--card) !important; box-shadow: var(--shadow) !important; }
.card-head { background: linear-gradient(135deg,#dde6ef 0%,#d0dce8 100%) !important; border-bottom: 1px solid var(--border) !important; border-radius: 12px 12px 0 0 !important; padding: 11px 16px !important; }
.card-title { font-size: 13px !important; font-weight: 800 !important; color: var(--navy) !important; }
.card-body { padding: 14px 16px !important; }

/* ── إحصائيات ── */
.stat { border-radius: 12px !important; border: 1px solid var(--border) !important; background: var(--card) !important; box-shadow: var(--shadow) !important; transition: transform .16s,box-shadow .16s,border-color .16s !important; }
.stat:hover { transform: translateY(-2px) !important; box-shadow: var(--shadow2) !important; }
.stat.s-blue   { border-top: 3px solid #2563eb !important; background: linear-gradient(160deg,#fff 65%,#eff6ff) !important; }
.stat.s-gold   { border-top: 3px solid #d97706 !important; background: linear-gradient(160deg,#fff 65%,#fef3c7) !important; }
.stat.s-green  { border-top: 3px solid #059669 !important; background: linear-gradient(160deg,#fff 65%,#d1fae5) !important; }
.stat.s-red    { border-top: 3px solid #dc2626 !important; background: linear-gradient(160deg,#fff 65%,#fee2e2) !important; }
.stat.s-orange { border-top: 3px solid #ea580c !important; background: linear-gradient(160deg,#fff 65%,#ffedd5) !important; }
.stat.s-navy   { border-top: 3px solid #1e293b !important; background: linear-gradient(160deg,#fff 65%,#f1f5f9) !important; }
.stat.s-purple { border-top: 3px solid #7c3aed !important; background: linear-gradient(160deg,#fff 65%,#ede9fe) !important; }
.stat.s-blue   .stat-icon { background: #dbeafe !important; color: #2563eb !important; }
.stat.s-gold   .stat-icon { background: #fef3c7 !important; color: #b45309 !important; }
.stat.s-green  .stat-icon { background: #d1fae5 !important; color: #059669 !important; }
.stat.s-red    .stat-icon { background: #fee2e2 !important; color: #dc2626 !important; }
.stat.s-orange .stat-icon { background: #ffedd5 !important; color: #ea580c !important; }
.stat.s-navy   .stat-icon { background: #c8d4e0 !important; color: #1e293b !important; }
.stat.s-purple .stat-icon { background: #ede9fe !important; color: #7c3aed !important; }
.stat-val { color: var(--text) !important; font-size: 20px !important; font-weight: 900 !important; }
.stat-lbl { color: var(--muted) !important; font-size: 11px !important; font-weight: 700 !important; }
.stat-unit { color: var(--muted) !important; font-size: 10px !important; }

/* ── ألوان خاصة الميزانية ── */
body:not(.dark) #pg-balance .stat.s-red  .stat-lbl { color: #dc2626 !important; }
body:not(.dark) #pg-balance .stat.s-red  .stat-val { color: #b91c1c !important; }
body:not(.dark) #pg-balance .stat.s-blue .stat-lbl { color: #1d4ed8 !important; }
body:not(.dark) #pg-balance .stat.s-blue .stat-val { color: #1e3a8a !important; }
body:not(.dark) #pg-balance .stat.s-green { background: linear-gradient(135deg,#059669,#047857) !important; border: none !important; }
body:not(.dark) #pg-balance .stat.s-green .stat-val,
body:not(.dark) #pg-balance .stat.s-green .stat-lbl,
body:not(.dark) #pg-balance .stat.s-green .stat-unit { color: #fff !important; }
body:not(.dark) #pg-balance .stat.s-green .stat-icon { background: rgba(255,255,255,.2) !important; color: #fff !important; }

/* ── الجداول ── */
.pro-table-wrap { border: 1px solid var(--border) !important; border-radius: 12px !important; overflow: hidden !important; }
.pro-table { font-size: 12.5px !important; border-collapse: collapse !important; }
.pro-table thead tr { background: linear-gradient(135deg,#f8fafc,#f1f5f9) !important; }
.pro-table th { color: #475569 !important; font-weight: 700 !important; font-size: 11px !important; letter-spacing: .4px !important; text-transform: uppercase !important; padding: 9px 12px !important; border-bottom: 1.5px solid var(--border) !important; }
.pro-table td { padding: 9px 12px !important; border-bottom: 1px solid #f1f5f9 !important; color: var(--text) !important; }
.pro-table tbody tr:nth-child(even) { background: #fafbfc !important; }
.pro-table tbody tr:hover { background: #eff6ff !important; }
.pro-table tfoot tr { background: linear-gradient(135deg,#f1f5f9,#e8eef5) !important; }
.pro-table tfoot td { color: var(--navy) !important; font-weight: 800 !important; border-top: 1.5px solid var(--border) !important; }
.tbl-amt-pos { color: #059669 !important; font-weight: 800 !important; }
.tbl-amt-neg { color: #dc2626 !important; font-weight: 800 !important; }
.tbl-amt-neu { color: var(--muted) !important; }

/* ── الأزرار ── */
.btn { border-radius: 8px !important; font-size: 12.5px !important; font-weight: 700 !important; padding: 8px 16px !important; letter-spacing: .2px !important; transition: all .14s !important; }
.btn:hover:not(:disabled) { filter: brightness(1.08) !important; transform: translateY(-1px) !important; }
.btn-blue   { background: linear-gradient(135deg,#2563eb,#1d4ed8) !important; box-shadow: 0 2px 8px rgba(37,99,235,.28) !important; }
.btn-green  { background: linear-gradient(135deg,#059669,#047857) !important; box-shadow: 0 2px 8px rgba(5,150,105,.28) !important; }
.btn-orange { background: linear-gradient(135deg,#ea580c,#c2410c) !important; box-shadow: 0 2px 8px rgba(234,88,12,.28) !important; }
.btn-red    { background: linear-gradient(135deg,#dc2626,#b91c1c) !important; box-shadow: 0 2px 8px rgba(220,38,38,.28) !important; }
.btn-purple { background: linear-gradient(135deg,#7c3aed,#6d28d9) !important; box-shadow: 0 2px 8px rgba(124,58,237,.28) !important; }
.btn-sm { padding: 5px 12px !important; font-size: 11.5px !important; }
.btn-ghost { background: var(--card2) !important; color: var(--text) !important; border: 1px solid var(--border) !important; box-shadow: none !important; }
.btn-ghost:hover { background: var(--card2) !important; border-color: #cbd5e1 !important; }
.btn-ghost.on { background: #eff6ff !important; color: #1d4ed8 !important; border-color: #bfdbfe !important; }

/* ── الحقول ── */
label { font-size: 11.5px !important; font-weight: 700 !important; color: var(--muted) !important; margin-bottom: 5px !important; display: block !important; }
input, select, textarea { border-radius: 8px !important; border: 1.5px solid var(--border) !important; background: var(--card) !important; font-size: 13px !important; padding: 8px 11px !important; color: var(--text) !important; transition: border-color .16s,box-shadow .16s !important; }
input:focus, select:focus, textarea:focus { border-color: #3b82f6 !important; box-shadow: 0 0 0 3px rgba(59,130,246,.12) !important; outline: none !important; background: #fff !important; }
.search-wrap input { padding-right: 11px !important; padding-left: 40px !important; }
.fr-btn { border-radius: 6px !important; background: var(--card) !important; border: 1.5px solid var(--border) !important; font-size: 12px !important; font-weight: 600 !important; color: var(--text) !important; }
.fr-btn.on { background: #eff6ff !important; color: #1d4ed8 !important; border-color: #bfdbfe !important; }

/* ── Badges ── */
.tbl-badge { border-radius: 999px !important; padding: 2px 10px !important; font-size: 11px !important; font-weight: 800 !important; }
.tbl-badge.pos-b, .pos-b  { background: #d1fae5 !important; color: #059669 !important; border: 1px solid rgba(5,150,105,.2) !important; }
.tbl-badge.neg-b, .neg-b  { background: #fee2e2 !important; color: #dc2626 !important; border: 1px solid rgba(220,38,38,.2) !important; }
.tbl-badge.neu-b, .neu-b  { background: #eff6ff !important; color: #2563eb !important; border: 1px solid rgba(37,99,235,.18) !important; }
.tbl-badge.cash,  .cash   { background: #fef3c7 !important; color: #b45309 !important; border: 1px solid rgba(180,83,9,.2) !important; }
.tbl-badge.debt-b { background: #fee2e2 !important; color: #b91c1c !important; border: 1px solid rgba(185,28,28,.2) !important; }

/* ── Info/Warn/Success ── */
.info    { background: #eff6ff !important; color: #1d4ed8 !important; border-right-color: #3b82f6 !important; border-radius: 8px !important; }
.warn    { background: #fef3c7 !important; color: #92400e !important; border-right-color: #f59e0b !important; border-radius: 8px !important; }
.success-box { background: #d1fae5 !important; color: #065f46 !important; border-right-color: #10b981 !important; border-radius: 8px !important; }

/* ── POS ── */
.pos-scan-box { background: linear-gradient(135deg,#c8d8ee,#d0dce8) !important; border: 1.5px solid #bfdbfe !important; border-radius: 14px !important; }
.pos-invoice-strip { background: linear-gradient(135deg,#1e293b,#1d4ed8) !important; border-radius: 12px !important; }
.pos-cart { border: 1.5px solid var(--border) !important; border-radius: 14px !important; box-shadow: var(--shadow) !important; }
.pos-cart-head { background: linear-gradient(135deg,#dde6ef,#d0dce8) !important; border-bottom: 1px solid var(--border) !important; }
.pos-cart-total { background: linear-gradient(135deg,#d0dce8,#c8d8e8) !important; border-top: 1px solid var(--border) !important; }
.pos-product-card { border: 1.5px solid var(--border) !important; border-radius: 12px !important; box-shadow: var(--shadow) !important; transition: transform .15s,box-shadow .15s,border-color .15s !important; }
.pos-product-card:hover { transform: translateY(-2px) !important; box-shadow: var(--shadow2) !important; border-color: #3b82f6 !important; }
.pos-qty-controls button { border-radius: 6px !important; }
.pos-cat-btn { border-radius: 8px !important; border: 1.5px solid var(--border) !important; background: var(--card) !important; color: var(--muted) !important; font-size: 12px !important; font-weight: 800 !important; }
.pos-cat-btn:hover:not(.on) { border-color: #3b82f6 !important; color: #2563eb !important; background: #eff6ff !important; }
.pos-cat-btn.on { background: linear-gradient(135deg,#2563eb,#1d4ed8) !important; border-color: #2563eb !important; color: #fff !important; box-shadow: 0 3px 10px rgba(37,99,235,.25) !important; }

/* ── Summary boxes ── */
.sum-box { border-radius: 10px !important; }
.sum-box.sb-blue   { background: #eff6ff !important; border-color: #bfdbfe !important; }
.sum-box.sb-green  { background: #d1fae5 !important; border-color: #6ee7b7 !important; }
.sum-box.sb-red    { background: #fee2e2 !important; border-color: #fca5a5 !important; }
.sum-box.sb-gold   { background: #fef3c7 !important; border-color: #fde68a !important; }
.sum-box.sb-purple { background: #ede9fe !important; border-color: #c4b5fd !important; }

/* ── Misc ── */
.inner-tabs { background: #c8d4e0 !important; border-radius: 8px !important; border: 1px solid var(--border) !important; }
.it-btn.on { background: #fff !important; color: #1d4ed8 !important; border-radius: 6px !important; font-weight: 800 !important; }
.statement-card { border-radius: 8px !important; border: 1px solid var(--border) !important; background: var(--card) !important; }
.toast { border-radius: 10px !important; font-size: 12.5px !important; }
.pro-tooltip { border-radius: 10px !important; }
.date-filter { background: var(--card) !important; border: 1px solid var(--border) !important; border-radius: 10px !important; }
.search-wrap { position: relative !important; }
.modal { border-radius: 16px !important; }
.modal-hdr { background: linear-gradient(135deg,var(--card),var(--card2)) !important; border-bottom: 1px solid var(--border) !important; border-radius: 16px 16px 0 0 !important; }
.modal-title { color: var(--navy) !important; font-weight: 900 !important; }
.dashboard-title, .pg-title { color: var(--navy) !important; }
.qa-btn, .ns-btn { border-radius: 10px !important; box-shadow: var(--shadow) !important; }
.qa-btn:hover, .ns-btn:hover { border-color: #3b82f6 !important; box-shadow: var(--shadow2) !important; }
.ns-ico { border-radius: 8px !important; }
.ns-navy .ns-ico  { background: #eff6ff !important; }
.ns-red  .ns-ico  { background: #fee2e2 !important; }
.ns-gold .ns-ico  { background: #fef3c7 !important; }
.ns-blue .ns-ico  { background: #eff6ff !important; }
.ns-green.ns-ico  { background: #d1fae5 !important; }
.ns-orange.ns-ico { background: #ffedd5 !important; }
.ns-purple.ns-ico { background: #ede9fe !important; }
.bottom-nav { background: var(--card) !important; border-top: 1px solid var(--border) !important; box-shadow: 0 -2px 10px rgba(15,23,42,.07) !important; }
.bn-btn.on { color: #2563eb !important; border-top-color: #2563eb !important; }
.more-item { background: var(--card2) !important; border-color: var(--border) !important; }
.more-item:hover { background: #eff6ff !important; }
#cf-debt.on { background: #fee2e2 !important; color: #b91c1c !important; border-color: #fca5a5 !important; }
#cf-paid.on { background: #d1fae5 !important; color: #059669 !important; border-color: #6ee7b7 !important; }
.action-text-btn { font-size: 12px !important; font-weight: 800 !important; padding: 3px 8px !important; border-radius: 6px !important; transition: background .12s !important; }
.action-text-btn.edit   { color: #2563eb !important; }
.action-text-btn.delete { color: #dc2626 !important; }
.action-text-btn:hover  { background: var(--card2) !important; }
.inv-hero { background: linear-gradient(135deg,#0f172a 0%,#1e3a5f 55%,#1d4ed8 100%) !important; border: none !important; border-radius: 14px !important; }
.inv-hero-val { color: #fff !important; } .inv-hero-lbl { color: rgba(203,213,225,.8) !important; }
.inv-divider { background: rgba(255,255,255,.15) !important; }
.login-screen, .setup-screen { background: linear-gradient(160deg,#0f172a 0%,#1e3a5f 50%,#1d4ed8 100%) !important; }
.login-card, .setup-card { border-radius: 14px !important; border: 1px solid var(--border) !important; box-shadow: 0 12px 40px rgba(15,23,42,.16) !important; }
.dash-alert { border-radius: 8px !important; border: 1px solid var(--border) !important; background: var(--card) !important; }
.dash-mini { border-radius: 10px !important; box-shadow: var(--shadow) !important; }
#pg-home .dash-main-card, #pg-home .dash-health-card { background: linear-gradient(135deg,#1e293b 0%,#1d4ed8 100%) !important; border: none !important; }
#pg-home .dash-action:nth-child(1)  { background: #2563eb !important; }
#pg-home .dash-action:nth-child(2)  { background: #0369a1 !important; }
#pg-home .dash-action:nth-child(3)  { background: #059669 !important; }
#pg-home .dash-action:nth-child(4)  { background: #d97706 !important; }
#pg-home .dash-action:nth-child(5)  { background: #dc2626 !important; }
#pg-home .dash-action:nth-child(6)  { background: #0d9488 !important; }
#pg-home .dash-action:nth-child(7)  { background: #2563eb !important; }
#pg-home .dash-action:nth-child(8)  { background: #7c3aed !important; }
#pg-home .dash-action:nth-child(9)  { background: #059669 !important; }
#pg-home .dash-action:nth-child(10) { background: #0369a1 !important; }
#pg-home .dash-action:nth-child(11) { background: #be185d !important; }
#pg-home .dash-action:nth-child(12) { background: #374151 !important; }
#pg-home .dash-action { border-radius: 10px !important; }
#pg-home .dash-mini.green  { background: #059669 !important; }
#pg-home .dash-mini.purple { background: #7c3aed !important; }
#pg-home .dash-mini.gold   { background: #d97706 !important; }
#pg-home .dash-mini.red    { background: #dc2626 !important; }
#pg-home .dash-mini { border-radius: 10px !important; }
.metro-tile { border-radius: 10px !important; box-shadow: 0 2px 8px rgba(15,23,42,.12) !important; }
.metro-green  { background: #059669 !important; }
.metro-blue   { background: #2563eb !important; }
.metro-gold   { background: #d97706 !important; }
.metro-purple { background: #7c3aed !important; }
.metro-red    { background: #dc2626 !important; }
.metro-orange { background: #ea580c !important; }
.metro-navy   { background: #1e293b !important; }
.metro-teal   { background: #0d9488 !important; }
.metro-gray   { background: #374151 !important; }
.metro-info   { background: #0369a1 !important; }

/* ══════════════════════════════════════════════════════
   🌙 DARK MODE — الوضع الداكن المحسّن
   ══════════════════════════════════════════════════════ */
body.dark {
  --bg:    #0d1117 !important;
  --card:  #161b22 !important;
  --card2: #1c2333 !important;
  --text:  #e6edf3 !important;
  --muted: #8b949e !important;
  --border:#30363d !important;
  --navy:  #cdd9e5 !important;
  --blue:  #58a6ff !important;
  --sky:   #79c0ff !important;
  --sky2:  #388bfd !important;
  --sky3:  #0d2b45 !important;
  --gold:  #e3b341 !important;
  --gold2: #f0c040 !important;
  --gold3: #2d2006 !important;
  --green: #3fb950 !important;
  --green2:#56d364 !important;
  --green3:#0d2b1a !important;
  --red:   #f85149 !important;
  --red2:  #ff7b72 !important;
  --red3:  #2d1117 !important;
  --orange:#f0883e !important;
  --orange2:#ffa657 !important;
  --orange3:#2d1c0d !important;
  --purple:#d2a8ff !important;
  --purple2:#bc8cff !important;
  --purple3:#1e1433 !important;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25) !important;
  --shadow2: 0 8px 28px rgba(0,0,0,.4) !important;
}
body.dark .hdr { background: linear-gradient(135deg,#010409 0%,#0d1117 55%,#161b22 100%) !important; border-bottom: 1px solid #30363d !important; }
body.dark .card  { background: var(--card) !important; border-color: var(--border) !important; }
body.dark .card-head { background: linear-gradient(135deg,#1c2333,#161b22) !important; border-bottom-color: var(--border) !important; }
body.dark .pro-table thead tr { background: linear-gradient(135deg,#1c2333,#161b22) !important; }
body.dark .pro-table th { color: #8b949e !important; border-bottom-color: var(--border) !important; }
body.dark .pro-table td { border-bottom-color: #21262d !important; color: var(--text) !important; }
body.dark .pro-table tbody tr:nth-child(even) { background: #0d1117 !important; }
body.dark .pro-table tbody tr:hover { background: rgba(88,166,255,.06) !important; }
body.dark .pro-table tfoot tr { background: linear-gradient(135deg,#1c2333,#161b22) !important; }
body.dark .pro-table tfoot td { color: #cdd9e5 !important; border-top-color: var(--border) !important; }
body.dark .pro-table-wrap { background: #0d1117 !important; border-color: var(--border) !important; }
body.dark .tbl-amt-pos { color: #3fb950 !important; }
body.dark .tbl-amt-neg { color: #f85149 !important; }
body.dark .stat { background: var(--card) !important; border-color: var(--border) !important; }
body.dark .stat.s-blue   { background: linear-gradient(160deg,var(--card) 65%,#0d2b45) !important; border-top-color: #58a6ff !important; }
body.dark .stat.s-gold   { background: linear-gradient(160deg,var(--card) 65%,#2d2006) !important; border-top-color: #e3b341 !important; }
body.dark .stat.s-green  { background: linear-gradient(160deg,var(--card) 65%,#0d2b1a) !important; border-top-color: #3fb950 !important; }
body.dark .stat.s-red    { background: linear-gradient(160deg,var(--card) 65%,#2d1117) !important; border-top-color: #f85149 !important; }
body.dark .stat.s-orange { background: linear-gradient(160deg,var(--card) 65%,#2d1c0d) !important; border-top-color: #f0883e !important; }
body.dark .stat.s-navy   { background: linear-gradient(160deg,var(--card) 65%,#1c2333) !important; border-top-color: #8b949e !important; }
body.dark .stat.s-purple { background: linear-gradient(160deg,var(--card) 65%,#1e1433) !important; border-top-color: #d2a8ff !important; }
body.dark .stat.s-blue   .stat-icon { background: #0d2b45 !important; color: #58a6ff !important; }
body.dark .stat.s-gold   .stat-icon { background: #2d2006 !important; color: #e3b341 !important; }
body.dark .stat.s-green  .stat-icon { background: #0d2b1a !important; color: #3fb950 !important; }
body.dark .stat.s-red    .stat-icon { background: #2d1117 !important; color: #f85149 !important; }
body.dark .stat.s-orange .stat-icon { background: #2d1c0d !important; color: #f0883e !important; }
body.dark .stat.s-navy   .stat-icon { background: #1c2333 !important; color: #8b949e !important; }
body.dark .stat.s-purple .stat-icon { background: #1e1433 !important; color: #d2a8ff !important; }
body.dark .stat-val { color: #e6edf3 !important; }
body.dark .stat-lbl, body.dark .stat-unit { color: #8b949e !important; }
body.dark #pg-balance .stat.s-green { background: linear-gradient(135deg,#033a1d,#065f46) !important; border: none !important; }
body.dark input, body.dark select, body.dark textarea { background: #0d1117 !important; border-color: #30363d !important; color: #e6edf3 !important; }
body.dark input:focus, body.dark select:focus, body.dark textarea:focus { border-color: #58a6ff !important; box-shadow: 0 0 0 3px rgba(88,166,255,.12) !important; }
body.dark .btn-ghost { background: #1c2333 !important; color: #cdd9e5 !important; border-color: #30363d !important; }
body.dark .btn-ghost:hover { background: #21262d !important; }
body.dark .inner-tabs { background: #0d1117 !important; border-color: #30363d !important; }
body.dark .it-btn.on { background: #1c2333 !important; color: #e6edf3 !important; }
body.dark .date-filter { background: #1c2333 !important; border-color: #30363d !important; }
body.dark .fr-btn { background: #1c2333 !important; border-color: #30363d !important; color: #cdd9e5 !important; }
body.dark .fr-btn.on { background: #0d2b45 !important; color: #58a6ff !important; border-color: #388bfd !important; }
body.dark .hdr-dropdown { background: #161b22 !important; border-color: #30363d !important; }
body.dark .hdr-dropdown-head { background: linear-gradient(135deg,#1c2333,#161b22) !important; border-bottom-color: #30363d !important; }
body.dark .hdr-dropdown-name { color: #e6edf3 !important; }
body.dark .hdr-dropdown-email { color: #8b949e !important; }
body.dark .info  { background: #0d2b45 !important; color: #58a6ff !important; }
body.dark .warn  { background: #2d2006 !important; color: #e3b341 !important; }
body.dark .success-box { background: #0d2b1a !important; color: #3fb950 !important; }
body.dark .pos-cart, body.dark .pos-cart-head, body.dark .pos-cart-total { background: var(--card) !important; border-color: var(--border) !important; }
body.dark .pos-product-card { background: var(--card) !important; border-color: var(--border) !important; }
body.dark .pos-scan-box { background: var(--card2) !important; border-color: var(--border) !important; }
body.dark .pos-invoice-strip { background: linear-gradient(135deg,#0d1117,#1c2333) !important; }
body.dark .bottom-nav { background: #161b22 !important; border-top-color: #30363d !important; }
body.dark .more-item { background: #1c2333 !important; border-color: #30363d !important; color: #e6edf3 !important; }
body.dark .modal, body.dark .alert-box, body.dark .confirm-box { background: #161b22 !important; border-color: #30363d !important; }
body.dark .statement-card { background: #161b22 !important; border-color: #30363d !important; }
body.dark .dash-alert { background: #161b22 !important; border-color: #30363d !important; }
body.dark .dash-mini { background: #161b22 !important; border-color: #30363d !important; }
body.dark .qa-btn { background: #161b22 !important; border-color: #30363d !important; }
body.dark .inv-hero { background: linear-gradient(135deg,#010409,#0d1117,#161b22) !important; }
body.dark .login-screen, body.dark .setup-screen { background: linear-gradient(160deg,#010409 0%,#0d1117 50%,#1e3a5f 100%) !important; }
body.dark .login-card, body.dark .setup-card { background: #161b22 !important; border-color: #30363d !important; }
body.dark .cust-dropdown { background: #161b22 !important; border-color: #30363d !important; }
body.dark .cust-dropdown-item { color: #e6edf3 !important; }
body.dark .cust-dropdown-item:hover { background: #1c2333 !important; }
body.dark .close-btn { background: #1c2333 !important; border-color: #30363d !important; color: #e6edf3 !important; }
body.dark .meta-pill { background: #1c2333 !important; border-color: #30363d !important; }
body.dark .sum-box.sb-blue   { background: #0d2b45 !important; border-color: #1c3a5f !important; }
body.dark .sum-box.sb-green  { background: #0d2b1a !important; border-color: #1a3828 !important; }
body.dark .sum-box.sb-red    { background: #2d1117 !important; border-color: #3d1c22 !important; }
body.dark .sum-box.sb-gold   { background: #2d2006 !important; border-color: #3d2e0e !important; }
body.dark .sum-box.sb-purple { background: #1e1433 !important; border-color: #2e1c44 !important; }
body.dark .pos-delete-box { background: #161b22 !important; }
body.dark .pos-delete-icon { background: #2d1117 !important; }
body.dark .pos-mini-card { background: #1c2333 !important; border-color: #30363d !important; }
body.dark .action-btn.edit   { background: #0d2b45 !important; color: #58a6ff !important; border-color: #1c3a5f !important; }
body.dark .action-btn.delete { background: #2d1117 !important; color: #f85149 !important; border-color: #3d1c22 !important; }
body.dark .action-btn.print  { background: #0d2b1a !important; color: #3fb950 !important; border-color: #1a3828 !important; }
body.dark .action-btn.view   { background: #1e1433 !important; color: #bc8cff !important; border-color: #2e1c44 !important; }
body.dark .sb-logout-btn { border-color: rgba(248,81,73,.3) !important; background: rgba(248,81,73,.1) !important; color: #f85149 !important; }
body.dark .hdr-icon-btn, body.dark .hdr-theme-btn { background: rgba(255,255,255,.08) !important; border-color: rgba(255,255,255,.12) !important; color: #8b949e !important; }
body.dark .pos-cat-btn { background: #1c2333 !important; border-color: #30363d !important; color: #8b949e !important; }
body.dark .pos-cat-btn:hover:not(.on) { background: #0d2b45 !important; border-color: #388bfd !important; color: #58a6ff !important; }
body.dark .pos-cat-btn.on { background: linear-gradient(135deg,#388bfd,#1a5ccf) !important; border-color: #388bfd !important; color: #fff !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px !important; height: 5px !important; }
::-webkit-scrollbar-track { background: transparent !important; }
::-webkit-scrollbar-thumb { background: var(--border) !important; border-radius: 999px !important; }
::-webkit-scrollbar-thumb:hover { background: var(--muted) !important; }
* { scrollbar-width: thin !important; scrollbar-color: var(--border) transparent !important; }

#splash-screen { color: #e6edf3 !important; }
#splash-screen > div:nth-child(2) { color: #f1f5f9 !important; }

/* ── POS DELETE MODAL ────────────────────────────────── */
.pos-delete-box { border-radius: 6px !important; }
.pos-delete-icon { border-radius: 6px !important; background: #fdf3f2 !important; }

/* ── SPLASH FIX ──────────────────────────────────────── */
#splash-screen { color: #d8e8f8 !important; }
#splash-screen > div:nth-child(2) { color: #e8f0fa !important; }


/* ══ UNIFIED ACTION BUTTONS — match POS invoice style ══ */
/* Override v72-ico-btn to look like POS history buttons */
.v72-ico-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 32px !important;
  height: 30px !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  border: 1px solid var(--border) !important;
  background: #fff !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-family: 'IBM Plex Sans Arabic','Cairo',sans-serif !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 2px rgba(15,40,80,.06) !important;
  transition: all .13s !important;
  color: var(--text) !important;
}
.v72-ico-btn:hover { background: #bccedd !important; border-color: #90a8c0 !important; }
.v72-ico-btn.edit   { background: #eef4fb !important; color: #1e4d8c !important; border-color: #b8d0e8 !important; }
.v72-ico-btn.edit:hover { background: #dce9f8 !important; }
.v72-ico-btn.danger { background: #fdf3f2 !important; color: #9b1c1c !important; border-color: #f0c0bb !important; }
.v72-ico-btn.danger:hover { background: #fde8e6 !important; }
.v72-ico-btn.statement { background: #fef9ec !important; color: #a07800 !important; border-color: #e8d898 !important; }
.v72-ico-btn.statement:hover { background: #fef3d0 !important; }
/* Also override action-text-btn to match */
.action-text-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 52px !important;
  padding: 5px 10px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  font-family: 'IBM Plex Sans Arabic','Cairo',sans-serif !important;
  border: 1px solid var(--border) !important;
  transition: all .13s !important;
}
.action-text-btn.edit   { background: #eef4fb !important; color: #1e4d8c !important; border-color: #b8d0e8 !important; }
.action-text-btn.edit:hover { background: #dce9f8 !important; }
.action-text-btn.delete { background: #fdf3f2 !important; color: #9b1c1c !important; border-color: #f0c0bb !important; }
.action-text-btn.delete:hover { background: #fde8e6 !important; }
.action-text-btn.print  { background: #eaf5ee !important; color: #155c30 !important; border-color: #a8d8b8 !important; }
/* invoice-actions wrapper */
.invoice-actions { display: flex !important; gap: 5px !important; align-items: center !important; flex-wrap: wrap !important; }
.invoice-actions .action-btn {
  width: auto !important; height: 30px !important; padding: 4px 9px !important;
  border-radius: 4px !important; border: 1px solid var(--border) !important;
  font-size: 14px !important; cursor: pointer !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  box-shadow: none !important;
}
.invoice-actions .action-btn.print  { background: #eaf5ee !important; color: #155c30 !important; border-color: #a8d8b8 !important; }
.invoice-actions .action-btn.edit   { background: #eef4fb !important; color: #1e4d8c !important; border-color: #b8d0e8 !important; }
.invoice-actions .action-btn.delete { background: #fdf3f2 !important; color: #9b1c1c !important; border-color: #f0c0bb !important; }
/* pos-history-actions already looks correct — ensure consistent */
.pos-history-actions .btn { border-radius: 4px !important; }
/* v70-actions wrapper */
.v70-actions { display: flex !important; align-items: center !important; gap: 5px !important; }
/* dark mode overrides for unified buttons */
body.dark .v72-ico-btn { background: #0e1a28 !important; border-color: #1e3050 !important; color: #a0c0e0 !important; }
body.dark .v72-ico-btn.edit   { background: #0e1a28 !important; color: #5b9bd5 !important; }
body.dark .v72-ico-btn.danger { background: #1a0808 !important; color: #f87171 !important; border-color: #3a1010 !important; }
body.dark .v72-ico-btn.statement { background: #1a1408 !important; color: #c09000 !important; border-color: #3a2c10 !important; }
body.dark .action-text-btn.edit   { background: #0e1a28 !important; color: #5b9bd5 !important; border-color: #1e3050 !important; }
body.dark .action-text-btn.delete { background: #1a0808 !important; color: #f87171 !important; border-color: #3a1010 !important; }

/* Fix for redesigned v39 modal - openOv adds .on class */
#ov-v39-invoice-editor { display: none !important; }
#ov-v39-invoice-editor.on { display: flex !important; }

/* ══ Add-line bar above invoice totals ══ */
.inv-add-row-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 2px 10px;
  border-top: 1px dashed var(--border);
  margin-top: 2px;
}
.inv-add-line-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px 7px 14px;
  background: linear-gradient(180deg, #2563b0, #1e4d8c);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: 'IBM Plex Sans Arabic','Cairo',sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30,77,140,.25);
  transition: all .14s;
  letter-spacing: .2px;
}
.inv-add-line-btn:hover {
  background: linear-gradient(180deg,#2d6fc4,#234fa0);
  box-shadow: 0 4px 10px rgba(30,77,140,.32);
  transform: translateY(-1px);
}
.inv-add-line-btn:active { transform: scale(.97); }
.inv-add-line-ico {
  font-size: 15px;
  font-weight: 300;
  line-height: 1;
  background: rgba(255,255,255,.18);
  border-radius: 3px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.dark .inv-add-line-btn {
  background: linear-gradient(180deg,#1e4d8c,#162038);
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ══ Metro panel: no white striped rows ══ */
.metro-panel-body .pro-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,.06) !important;
}
.metro-panel-body .pro-table tbody tr:hover {
  background: rgba(255,255,255,.14) !important;
}
.metro-panel-body .pro-table tbody tr {
  background: transparent !important;
}

/* ══ POS product card serial badge ══ */
.pos-product-card { position: relative !important; }
.pos-product-serial-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  background: linear-gradient(180deg,#1e4d8c,#1a3a5c);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: 'IBM Plex Sans Arabic','Cairo',sans-serif;
  border-radius: 4px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  letter-spacing: .3px;
  box-shadow: 0 1px 4px rgba(0,20,50,.25);
  z-index: 2;
}
body.dark .pos-product-serial-badge {
  background: linear-gradient(180deg,#2563b0,#1e4d8c);
}

/* ══ F1 keyboard badge on save buttons ══ */
kbd.f1-key-hint {
  display: inline-flex; align-items: center; justify-content: center;
  margin-right: 6px; padding: 1px 5px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .3px;
  border-radius: 3px; border: 1.5px solid rgba(255,255,255,.38);
  background: rgba(255,255,255,.14); color: rgba(255,255,255,.88);
  font-family: monospace; line-height: 1.6; vertical-align: middle;
  flex-shrink: 0;
}
/* tooltip F1 سريع على الأزرار */
button[data-f1] { position: relative; }
button[data-f1]::after {
  content: 'F1';
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  background: #1a3a5c; color: #fff; font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 3px; white-space: nowrap;
  font-family: monospace; pointer-events: none; opacity: 0;
  transition: opacity .15s;
}
button[data-f1]:hover::after { opacity: 1; }

/* ══ Dark mode: label & tfoot color fixes ══ */
body.dark label {
  color: #8ab0d0 !important;
}
body.dark .fg > label,
body.dark .pos-mini-card label,
body.dark .pos-edit-fg label,
body.dark .invoice-paid-field label,
body.dark .date-filter label,
body.dark .label-inline label {
  color: #8ab0d0 !important;
}
/* tfoot صفوف الإجمالي في الوضع الداكن */
body.dark .pro-table tfoot tr {
  background: linear-gradient(180deg,#162038,#111c2c) !important;
}
body.dark .pro-table tfoot td {
  color: #c8dff0 !important;
  font-weight: 700 !important;
  border-top: 1px solid #1e3050 !important;
}
body.dark .pro-table tfoot td.tbl-amt-pos { color: #4cc98a !important; }
body.dark .pro-table tfoot td.tbl-amt-neg { color: #f08080 !important; }
/* صفوف الإجمالي في جداول البيانات الأخرى */
body.dark tfoot td,
body.dark tfoot th {
  color: #c8dff0 !important;
}
body.dark #sup-list tfoot td,
body.dark #cred-list tfoot td {
  background: #111b2d !important;
  color: #c8dff0 !important;
}
/* الرصيد الافتتاحي و metric boxes */
body.dark .sum-lbl,
body.dark .stat-lbl,
body.dark .stat-unit,
body.dark .rr-lbl {
  color: #7090b0 !important;
}
/* placeholder color في dark mode */
body.dark input::placeholder,
body.dark textarea::placeholder {
  color: #4a6080 !important;
}

/* ════════════════════════════════════════════════════
   ENTERPRISE DASHBOARD — لوحة التحكم الجديدة
   ════════════════════════════════════════════════════ */
.ent-dash {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 16px;
  direction: rtl;
}

/* ── Header ── */
.ed-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.ed-company {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}
.ed-date {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}
.ed-header-right { display: flex; align-items: center; gap: 10px; }
.ed-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--green3);
  border: 1px solid #a8d8b8;
  border-radius: 4px;
  padding: 4px 10px;
}
.ed-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #1e7a44;
  animation: pulse 2s infinite;
}

/* ── KPI Strip ── */
.ed-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.ed-kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  transition: box-shadow .15s, transform .12s;
}
.ed-kpi:hover { box-shadow: var(--shadow2); transform: translateY(-1px); }
.ed-kpi-icon {
  width: 40px; height: 40px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.ed-kpi-teal  { background: #eaf5ee; }
.ed-kpi-blue  { background: #eef4fb; }
.ed-kpi-amber { background: #fef9ec; }
.ed-kpi-red   { background: #fdf3f2; }
.ed-kpi-body { min-width: 0; }
.ed-kpi-val {
  font-size: 17px; font-weight: 700;
  color: var(--text); line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ed-kpi-lbl {
  font-size: 11px; color: var(--muted);
  font-weight: 600; margin-top: 2px;
}

/* ── Main Row ── */
.ed-main-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 10px;
  align-items: stretch;
}

/* ── Actions Panel ── */
.ed-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.ed-panel-title {
  font-size: 12.5px; font-weight: 700;
  color: var(--navy);
  margin-bottom: 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.ed-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ed-act {
  display: flex; flex-direction: column;
  align-items: center; gap: 5px;
  padding: 12px 6px 10px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer; font-family: inherit;
  transition: all .14s;
  text-align: center;
}
.ed-act:hover {
  background: var(--sky3);
  border-color: var(--sky2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.ed-act:active { transform: scale(.97); }
.ed-act-ico { font-size: 22px; line-height: 1; }
.ed-act-name { font-size: 12px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.ed-act-sub  { font-size: 10px; color: var(--muted); font-weight: 600; }

/* ── Treasury Card ── */
.ed-treasury-card {
  background: linear-gradient(160deg, #1a3a5c 0%, #1e4d8c 100%);
  border-radius: var(--r);
  padding: 18px 18px 16px;
  display: flex; flex-direction: column;
  justify-content: space-between;
  cursor: pointer; border: none; font-family: inherit;
  transition: filter .15s;
  box-shadow: 0 4px 16px rgba(26,58,92,.3);
  text-align: right;
}
.ed-treasury-card:hover { filter: brightness(1.06); }
.ed-tr-label { font-size: 11px; color: rgba(255,255,255,.65); margin-bottom: 6px; }
.ed-tr-val   { font-size: 28px; font-weight: 700; color: #fff; line-height: 1.1; }
.ed-tr-currency { font-size: 14px; font-weight: 400; opacity: .8; }
.ed-tr-tag {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,.14);
  border-radius: 4px; padding: 3px 10px;
  font-size: 10.5px; color: #fff;
  margin-top: 10px; font-weight: 600;
}
.ed-tr-divider { height: 1px; background: rgba(255,255,255,.15); margin: 14px 0 10px; }
.ed-tr-rows { display: flex; flex-direction: column; gap: 7px; }
.ed-tr-row  { display: flex; justify-content: space-between; font-size: 11.5px; }
.ed-tr-row span:first-child { color: rgba(255,255,255,.6); }
.ed-tr-row span:last-child  { color: #fff; font-weight: 600; }

/* ── Bottom Row ── */
.ed-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

/* ── Alerts inside panel ── */
#dash-alerts .ed-alert-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 10px; border-radius: 5px;
  margin-bottom: 6px;
}
#dash-alerts .ed-alert-item:last-child { margin-bottom: 0; }
#dash-alerts .ed-alert-item.danger { background: #fdf3f2; }
#dash-alerts .ed-alert-item.info   { background: #eef4fb; }
#dash-alerts .ed-alert-item.good   { background: #eaf5ee; }
#dash-alerts .ed-alert-item.warn   { background: #fef9ec; }
.ed-alert-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.danger .ed-alert-dot { background: #9b1c1c; }
.info   .ed-alert-dot { background: #1e4d8c; }
.good   .ed-alert-dot { background: #155c30; }
.warn   .ed-alert-dot { background: #a07800; }
.ed-alert-title { font-size: 12px; font-weight: 700; }
.danger .ed-alert-title { color: #791F1F; }
.info   .ed-alert-title { color: #0c447c; }
.good   .ed-alert-title { color: #085041; }
.warn   .ed-alert-title { color: #633806; }
.ed-alert-sub { font-size: 10.5px; margin-top: 2px; }
.danger .ed-alert-sub { color: #9b1c1c; }
.info   .ed-alert-sub { color: #1e4d8c; }
.good   .ed-alert-sub { color: #0f6e56; }
.warn   .ed-alert-sub { color: #a07800; }

/* ── Debtors in panel ── */
#home-debtors .ed-debtor-row {
  display: flex; align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
#home-debtors .ed-debtor-row:last-child { border-bottom: none; }
.ed-debtor-rank {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card2); border: 1px solid var(--border);
  font-size: 10px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); flex-shrink: 0;
}
.ed-debtor-name { font-size: 12px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ed-debtor-amt  { font-size: 12px; font-weight: 700; color: #9b1c1c; white-space: nowrap; }

/* ── Today shortcuts list ── */
.ed-today-list { display: flex; flex-direction: column; gap: 4px; }
.ed-today-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 5px;
  background: var(--card2); border: 1px solid var(--border);
  cursor: pointer; font-family: inherit;
  transition: background .13s;
  text-align: right;
}
.ed-today-row:hover { background: var(--sky3); border-color: var(--sky2); }
.ed-today-ico  { font-size: 15px; width: 22px; text-align: center; }
.ed-today-lbl  { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; }
.ed-today-arrow { font-size: 12px; color: var(--muted); }

/* ── Recent panel full width ── */
.ed-recent-panel { }
#home-recent .pro-table-wrap { margin: 0; }
#home-recent .pro-table { font-size: 12px; }

/* ── Dark mode ── */
body.dark .ed-header { background: #131f30; border-color: #1e3050; }
body.dark .ed-company { color: #d8e8f8; }
body.dark .ed-status { background: #081a10; border-color: #1a3020; color: #40a060; }
body.dark .ed-dot { background: #40a060; }
body.dark .ed-kpi { background: #131f30; border-color: #1e3050; }
body.dark .ed-kpi-val { color: #d8e8f8; }
body.dark .ed-kpi-teal  { background: #081a10; }
body.dark .ed-kpi-blue  { background: #0e1a28; }
body.dark .ed-kpi-amber { background: #1a1408; }
body.dark .ed-kpi-red   { background: #1a0808; }
body.dark .ed-panel { background: #131f30; border-color: #1e3050; }
body.dark .ed-panel-title { color: #a0c0e0; border-bottom-color: #1e3050; }
body.dark .ed-act { background: #0e1a28; border-color: #1e3050; }
body.dark .ed-act:hover { background: #162038; border-color: #2563b0; }
body.dark .ed-act-name { color: #d8e8f8; }
body.dark .ed-treasury-card { background: linear-gradient(160deg,#0a1520,#1a3a5c); box-shadow: 0 4px 16px rgba(0,0,0,.35); }
body.dark #dash-alerts .ed-alert-item.danger { background: #1a0808; }
body.dark #dash-alerts .ed-alert-item.info   { background: #0e1a28; }
body.dark #dash-alerts .ed-alert-item.good   { background: #081a10; }
body.dark #dash-alerts .ed-alert-item.warn   { background: #1a1408; }
body.dark .danger .ed-alert-title { color: #f08080; }
body.dark .info   .ed-alert-title { color: #5b9bd5; }
body.dark .good   .ed-alert-title { color: #4cc98a; }
body.dark .warn   .ed-alert-title { color: #c09000; }
body.dark .danger .ed-alert-sub { color: #d04040; }
body.dark .info   .ed-alert-sub  { color: #4a7aaa; }
body.dark .good   .ed-alert-sub  { color: #2a8050; }
body.dark .warn   .ed-alert-sub  { color: #907000; }
body.dark .danger .ed-alert-dot  { background: #f08080; }
body.dark .info   .ed-alert-dot  { background: #5b9bd5; }
body.dark .good   .ed-alert-dot  { background: #4cc98a; }
body.dark .warn   .ed-alert-dot  { background: #c09000; }
body.dark #home-debtors .ed-debtor-row { border-bottom-color: #1e3050; }
body.dark .ed-debtor-rank { background: #0e1a28; border-color: #1e3050; }
body.dark .ed-debtor-name { color: #d8e8f8; }
body.dark .ed-debtor-amt  { color: #f08080; }
body.dark .ed-today-row { background: #0e1a28; border-color: #1e3050; }
body.dark .ed-today-row:hover { background: #162038; border-color: #2563b0; }
body.dark .ed-today-lbl { color: #d8e8f8; }

/* ── Responsive ── */
@media(max-width:900px){
  .ed-main-row { grid-template-columns: 1fr; }
  .ed-treasury-card { min-height: 180px; }
  .ed-bottom-row { grid-template-columns: 1fr 1fr; }
  .ed-kpi-strip { grid-template-columns: 1fr 1fr; }
}
@media(max-width:600px){
  .ed-kpi-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ed-kpi { padding: 10px 10px; }
  .ed-kpi-val { font-size: 14px; }
  .ed-actions-grid { grid-template-columns: repeat(2,1fr); }
  .ed-bottom-row { grid-template-columns: 1fr; }
  .ed-act-ico { font-size: 18px; }
}

/* ── PWA Install Button ── */
#pwa-install-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(240,192,64,.15);
  border: 1px solid rgba(240,192,64,.35);
  border-radius: 4px;
  color: #f0c040;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'IBM Plex Sans Arabic','Cairo',sans-serif;
  transition: background .15s;
}
#pwa-install-btn:hover { background: rgba(240,192,64,.25); }


/* ══════════════════════════════════════════
   MOBILE SCROLL FIX
══════════════════════════════════════════ */

html, body { max-width: 100%; overflow-x: hidden; }
@media(max-width:768px){
  html {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
  }
  /* الحالات اللي المفروض تمنع السكرول */
  body.no-scroll  { overflow: hidden !important; height: 100vh !important; }
  body.modal-lock { overflow: hidden !important; height: 100vh !important; }

  /* ضمان أن الـ body قابل للسكرول دايماً لما مفيش modal */
  body.app-ready:not(.no-scroll):not(.modal-lock) {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100dvh !important;
    position: static !important;
  }

  /* #app يتمدد مع المحتوى */
  body.app-ready:not(.no-scroll):not(.modal-lock) #app {
    display: block !important;
    height: auto !important;
    min-height: 100dvh !important;
    overflow: visible !important;
  }

  /* app-body و main-wrap يتمددوا مع المحتوى */
  body.app-ready:not(.no-scroll):not(.modal-lock) .app-body,
  body.app-ready:not(.no-scroll):not(.modal-lock) .main-wrap {
    height: auto !important;
    overflow: visible !important;
    overflow-x: hidden !important;
  }

  /* صفحة المستخدمين: السكرول يشتغل صح */
  #pg-users.on {
    display: block !important;
    overflow: visible !important;
    min-height: 100px !important;
    height: auto !important;
  }
  #pg-users.on .card,
  #pg-users.on .card-body {
    overflow: visible !important;
    height: auto !important;
  }
  /* الجداول داخل صفحة المستخدمين تسكرول أفقياً */
  #pg-users .pro-table-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* باقي الجداول */
  .pro-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
}
