/* ============ الخط: IBM Plex Sans Arabic مستضاف محلياً (رخصة OFL) ============ */
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/plex-arabic-400.woff2') format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/plex-arabic-500.woff2') format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/plex-arabic-600.woff2') format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/plex-arabic-700.woff2') format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/plex-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/plex-latin-500.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/plex-latin-600.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Ayar Plex'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/plex-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ============ أيار — تصميم زجاجي بأسلوب Apple ============ */
:root, [data-theme="violet"] {
  --bg1: #f6f1ff; --bg2: #ece3ff;
  --blob1: #a78bfa; --blob2: #c4b5fd; --blob3: #f0abfc;
  --primary: #7c3aed; --primary-2: #a855f7; --primary-soft: rgba(124, 58, 237, .12);
  --text: #1e1238; --muted: #6b6185;
  --glass: rgba(255, 255, 255, .55); --glass-strong: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .75); --line: rgba(80, 50, 140, .12);
  --shadow: 0 10px 40px rgba(76, 29, 149, .12);
  --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
  --input: rgba(255, 255, 255, .7);
}
[data-theme="dark"] {
  --bg1: #0f0a1f; --bg2: #1a1033;
  --blob1: #6d28d9; --blob2: #4c1d95; --blob3: #a21caf;
  --primary: #a78bfa; --primary-2: #c084fc; --primary-soft: rgba(167, 139, 250, .16);
  --text: #f3eeff; --muted: #a99dc9;
  --glass: rgba(35, 22, 66, .5); --glass-strong: rgba(40, 26, 76, .82);
  --glass-border: rgba(255, 255, 255, .1); --line: rgba(255, 255, 255, .08);
  --shadow: 0 10px 40px rgba(0, 0, 0, .4);
  --input: rgba(255, 255, 255, .06);
}
[data-theme="lavender"] {
  --bg1: #fbf8ff; --bg2: #f3edff;
  --blob1: #ddd6fe; --blob2: #e9d5ff; --blob3: #bfdbfe;
  --primary: #8b5cf6; --primary-2: #a78bfa; --primary-soft: rgba(139, 92, 246, .1);
  --text: #2a2140; --muted: #7c7396;
}
[data-theme="royal"] {
  --bg1: #efe7ff; --bg2: #e0d0ff;
  --blob1: #6d28d9; --blob2: #8b5cf6; --blob3: #4338ca;
  --primary: #5b21b6; --primary-2: #7c3aed; --primary-soft: rgba(91, 33, 182, .12);
  --text: #1b0f3a; --muted: #5d5280;
}
[data-theme="orchid"] {
  --bg1: #fff3fb; --bg2: #f7e8ff;
  --blob1: #e879f9; --blob2: #c084fc; --blob3: #f9a8d4;
  --primary: #a21caf; --primary-2: #c026d3; --primary-soft: rgba(162, 28, 175, .1);
  --text: #2e0f33; --muted: #7d5f84;
}
[data-theme="mono"] {
  --bg1: #ffffff; --bg2: #f7f5fb;
  --blob1: #ede9fe; --blob2: #f5f3ff; --blob3: #ede9fe;
  --primary: #6d28d9; --primary-2: #7c3aed; --primary-soft: rgba(109, 40, 217, .08);
  --text: #18122b; --muted: #6e6884;
  --glass: rgba(255, 255, 255, .85); --glass-strong: #fff;
  --glass-border: rgba(109, 40, 217, .1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Arabic", "Ayar Plex", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
/* فقاعات خلفية ملوّنة لإبراز تأثير الزجاج */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; animation: float 22s ease-in-out infinite; }
.bg-blobs span:nth-child(1) { width: 480px; height: 480px; background: var(--blob1); top: -120px; right: -80px; }
.bg-blobs span:nth-child(2) { width: 420px; height: 420px; background: var(--blob2); bottom: -140px; left: 10%; animation-delay: -7s; }
.bg-blobs span:nth-child(3) { width: 320px; height: 320px; background: var(--blob3); top: 40%; left: -100px; animation-delay: -14s; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,-30px) scale(1.08); } }

.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  border-radius: 22px;
}

/* ---------- تخطيط ---------- */
.app { display: flex; min-height: 100vh; gap: 18px; padding: 18px; }
.sidebar {
  width: 240px; flex-shrink: 0; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 18px; height: calc(100vh - 36px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-logo {
  width: 44px; height: 44px; flex: none; display: block; object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(124, 58, 237, .28));
}
.brand-logo.login-logo { width: 88px; height: 88px; margin: 0 auto 10px; animation: logo-in .7s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes logo-in { from { opacity: 0; transform: scale(.6) rotate(-25deg); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .brand-logo.login-logo { animation: none; } }
.brand b { font-size: 19px; display: block; }
.brand small { color: var(--muted); font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 13px;
  color: var(--text); text-decoration: none; font-weight: 500; transition: .2s;
}
.nav a:hover { background: var(--primary-soft); }
.nav a.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 18px var(--primary-soft); }
.nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar .spacer { flex: 1; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 12px; }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.content { display: flex; flex-direction: column; gap: 18px; }
.menu-btn { display: none; }

/* ---------- عناصر ---------- */
.card { padding: 20px; }
.card h3 { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.hidden { display: none !important; }

.stat { padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.stat .ic { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.stat .ic svg { width: 24px; height: 24px; }
.stat b { font-size: 22px; display: block; }
.stat span { color: var(--muted); font-size: 13px; }

#sync-status { display: flex; align-items: center; justify-content: center; gap: 6px; }
#sync-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
#sync-status.offline .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }

.btn {
  border: none; cursor: pointer; font: inherit; font-weight: 600; border-radius: 12px; padding: 10px 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: .18s;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 18px var(--primary-soft); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: rgba(220, 38, 38, .1); color: var(--danger); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 14px 22px; font-size: 17px; border-radius: 15px; }
.btn.icon { padding: 8px; }
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--input); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 13px; width: 100%; outline: none; transition: .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field { margin-bottom: 12px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.input-icon input { padding-right: 38px; }

.seg { display: inline-flex; background: var(--primary-soft); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; font: inherit; padding: 7px 14px; border-radius: 10px; cursor: pointer; color: var(--text); font-weight: 500; }
.seg button.on { background: var(--glass-strong); box-shadow: 0 2px 8px rgba(0,0,0,.08); color: var(--primary); font-weight: 700; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--primary-soft); }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.badge.ok { background: rgba(22, 163, 74, .12); color: var(--ok); }
.badge.warn { background: rgba(217, 119, 6, .13); color: var(--warn); }
.badge.danger { background: rgba(220, 38, 38, .12); color: var(--danger); }

.thumb { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary); font-weight: 700; flex-shrink: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty svg { width: 46px; height: 46px; opacity: .5; }

/* ---------- نافذة منبثقة ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 10, 40, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s; }
.modal { width: min(760px, 100%); max-height: 92vh; overflow: auto; padding: 24px; background: var(--glass-strong); animation: pop .25s cubic-bezier(.2,.9,.3,1.2); }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 12px 20px; border-radius: 14px; background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow); border: 1px solid var(--glass-border); font-weight: 600; animation: pop .25s; }
.toast.err { color: var(--danger); }

/* ---------- دفعات (تواريخ متعددة) ---------- */
.batch-row { display: grid; grid-template-columns: 1.1fr 1.2fr .8fr .9fr auto; gap: 8px; align-items: end; padding: 10px; border-radius: 14px; background: var(--primary-soft); margin-bottom: 8px; }
.batch-row label { margin-bottom: 3px; font-size: 12px; }

/* ---------- كاشير ---------- */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 18px; align-items: start; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pos-item { padding: 12px; cursor: pointer; text-align: center; transition: .18s; border-radius: 18px; }
.pos-item:hover { transform: translateY(-3px); }
.pos-item .thumb { width: 100%; height: 86px; margin-bottom: 8px; font-size: 26px; border-radius: 13px; }
.pos-item b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-item .price { color: var(--primary); font-weight: 700; }
.pos-item.out { opacity: .45; }
.cart { position: sticky; top: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 36px); }
.cart-items { overflow: auto; flex: 1; min-height: 120px; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.cart-line .nm { flex: 1; min-width: 0; }
.cart-line .nm b { display: block; font-size: 14px; }
.qty { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); border-radius: 10px; padding: 2px; }
.qty button { border: none; background: var(--glass-strong); width: 26px; height: 26px; border-radius: 8px; cursor: pointer; font-weight: 700; color: var(--primary); }
.qty input { width: 42px; text-align: center; padding: 3px; border: none; background: transparent; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-size: 22px; font-weight: 800; color: var(--primary); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.scan-box input { font-size: 17px; padding: 14px 44px 14px 14px; }

/* ---------- باركود ---------- */
.barcode-box { background: #fff; color: #000; border-radius: 12px; padding: 10px; display: inline-block; text-align: center; }
.barcode-box svg { display: block; max-width: 100%; }
.labels-print { display: flex; flex-wrap: wrap; gap: 8px; }
.label-item { width: 200px; border: 1px dashed #ccc; padding: 6px; text-align: center; background: #fff; color: #000; font-size: 11px; }
.label-item b { display: block; font-size: 12px; }
#scanner-video { width: 100%; border-radius: 16px; background: #000; max-height: 340px; object-fit: cover; }

/* ---------- ثيمات ---------- */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.theme-opt { padding: 12px; border-radius: 16px; cursor: pointer; border: 2px solid transparent; text-align: center; font-weight: 600; }
.theme-opt.on { border-color: var(--primary); }
.theme-opt .sw { height: 54px; border-radius: 12px; margin-bottom: 8px; }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.bar-chart .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .b i { width: 100%; max-width: 38px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--primary-2), var(--primary)); min-height: 4px; transition: height .5s; }
.bar-chart .b small { color: var(--muted); font-size: 11px; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }

/* ---------- تسجيل الدخول ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); padding: 32px 28px; text-align: center; animation: pop .35s cubic-bezier(.2,.9,.3,1.2); }
.login-card .input-icon svg { right: 13px; }
.login-card input { padding: 13px 40px 13px 14px; }

/* ---------- كشف حساب ---------- */
.balance { font-size: 26px; font-weight: 800; }
.balance.due { color: var(--danger); }
.balance.clear { color: var(--ok); }
.pick-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; background: var(--glass-strong); }
.pick-list div { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pick-list div:hover { background: var(--primary-soft); }
.cust-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--primary-soft); }

/* ---------- طباعة ---------- */
#print-area { display: none; }
@media print {
  body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; color: #000; }
  .receipt { width: 76mm; font-size: 12px; margin: 0 auto; }
  .receipt table td, .receipt table th { padding: 3px 2px; border-bottom: 1px dashed #999; color: #000; }
}

/* ================= تجاوب: آيباد وموبايل ================= */
.tabbar, .scrim, .cart-fab, .cart-close { display: none; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
.sidebar { height: calc(100dvh - 36px); }
.cart { max-height: calc(100dvh - 36px); }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
@media (hover: none) {
  .btn:hover, .pos-item:hover, .p-card:hover { transform: none; filter: none; }
  tbody tr:hover { background: transparent; }
}
/* أجهزة اللمس: أهداف ضغط أكبر + منع تكبير iOS التلقائي عند الكتابة */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; padding: 7px 12px; }
  .btn.icon { min-width: 44px; }
  .btn.sm.icon { min-width: 38px; }
  .qty button { width: 34px; height: 34px; }
  .seg button { padding: 9px 14px; }
  .nav a { padding: 13px; }
}

/* ---- آيباد (عمودي وأفقي) وشاشات متوسطة: شريط جانبي بالأيقونات ---- */
@media (max-width: 1180px) and (min-width: 761px) {
  .app { padding: 14px; gap: 14px; }
  .sidebar { width: 76px; padding: 16px 10px; top: 14px; height: calc(100dvh - 28px); align-items: center; }
  .sidebar .brand { padding: 0 0 14px; }
  .sidebar .brand > div:last-child, .nav a span, #sync-status, #user-box .grow { display: none; }
  .nav a { justify-content: center; padding: 13px; }
  #user-box .list-item { flex-direction: column; gap: 6px; padding: 0; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
}
/* ---- الكاشير على الآيباد والموبايل: السلة كلوح منبثق من الأسفل ---- */
@media (max-width: 1100px) {
  .pos { grid-template-columns: 1fr; }
  .pos-products { padding-bottom: 90px; }
  .cart {
    position: fixed; inset: auto 0 0 0; top: auto; z-index: 45; max-height: 88dvh; border-radius: 26px 26px 0 0;
    background: var(--glass-strong); transform: translateY(105%); transition: transform .35s cubic-bezier(.2,.9,.3,1);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .cart.open { transform: none; box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
  .cart-close { display: inline-flex; }
  .cart-fab {
    display: flex; position: fixed; z-index: 44; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom));
    width: min(520px, calc(100% - 28px)); align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 20px; border: none; border-radius: 18px; font: inherit; font-weight: 700; font-size: 16px; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 10px 30px rgba(76,29,149,.35);
  }
  .cart-fab svg { width: 22px; height: 22px; }
  .cart-fab .count { background: rgba(255,255,255,.25); border-radius: 99px; padding: 2px 10px; }
  body.cart-open .scrim { display: block; }
}
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(20,10,40,.3); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
body.cart-open .scrim { z-index: 44; }

/* ---- موبايل ---- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { padding: 10px; gap: 10px; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .main, .content { gap: 12px; }
  /* الشريط الجانبي يصبح لوحاً منبثقاً من زر "المزيد" */
  .sidebar {
    position: fixed; right: 10px; top: 10px; z-index: 46; height: calc(100dvh - 20px); width: min(290px, 82vw);
    transform: translateX(120%); transition: transform .3s cubic-bezier(.2,.9,.3,1); background: var(--glass-strong); overflow-y: auto;
  }
  .sidebar.open { transform: none; }
  body.nav-open .scrim { display: block; z-index: 45; }
  .menu-btn { display: none; }
  /* شريط تبويبات سفلي بأسلوب iOS */
  .tabbar {
    display: flex; position: fixed; z-index: 42; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 6px; justify-content: space-around; border-radius: 24px;
  }
  .tabbar a, .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; border-radius: 16px;
    color: var(--muted); text-decoration: none; font: inherit; font-size: 11px; font-weight: 600; background: none; border: none; cursor: pointer;
  }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .active { color: var(--primary); background: var(--primary-soft); }
  .topbar { padding: 12px 14px; flex-wrap: wrap; position: sticky; top: 10px; z-index: 30; }
  .topbar h1 { font-size: 19px; }
  .topbar .sub { display: none; }
  #top-actions { width: 100%; }
  #top-actions:empty { display: none; }
  #top-actions .btn { flex: 1; }
  .card { padding: 15px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid { gap: 12px; }
  .stat { padding: 13px; gap: 10px; }
  .stat .ic { width: 40px; height: 40px; border-radius: 12px; }
  .stat b { font-size: 17px; }
  .stat span { font-size: 12px; }
  .seg { display: flex; flex-wrap: wrap; width: 100%; }
  .seg button { white-space: nowrap; flex: 1 1 auto; }
  .row > .input-icon.grow:not(.scan-box) { flex-basis: 100%; }
  .row > select { width: 100% !important; }
  .batch-row { grid-template-columns: 1fr 1fr; }
  .batch-row > button { grid-column: 1 / -1; }
  .pos-products { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
  .pos-item .thumb { height: 74px; }
  .cart-fab { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .pos-products { padding-bottom: 150px; }
  /* النوافذ المنبثقة تصبح ألواحاً من الأسفل */
  .modal-back { align-items: end; padding: 0; }
  .modal, .modal.sm { width: 100%; max-height: 92dvh; border-radius: 26px 26px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: sheet .3s cubic-bezier(.2,.9,.3,1); }
  .themes { grid-template-columns: repeat(2, 1fr); }
  /* الجداول تتحول إلى بطاقات */
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { padding: 10px 4px; border-bottom: 1px solid var(--line); }
  .table-wrap tr:last-child { border-bottom: none; }
  .table-wrap td { border: none; padding: 5px 4px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: right; flex-shrink: 0; }
  .table-wrap td[data-label=""]::before, .table-wrap td:not([data-label])::before { display: none; }
  .table-wrap td[data-label=""], .table-wrap td:not([data-label]) { justify-content: flex-start; }
  .table-wrap td input { max-width: 60%; width: 60% !important; }
  .table-wrap td[colspan] { justify-content: center; }
  .toast-wrap { bottom: calc(96px + env(safe-area-inset-bottom)); width: calc(100% - 30px); }
}
@keyframes sheet { from { transform: translateY(100%); } }
@media (max-width: 380px) { .pos-products { grid-template-columns: 1fr 1fr; } .tabbar a, .tabbar button { font-size: 10px; } }

/* أقسام الكاشير: صف واحد قابل للتمرير على الموبايل */
@media (max-width: 700px) {
  .pos > *, .pos .content, .pos .card { min-width: 0; }
  .cat-row { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-inline: -4px; padding: 2px 4px 4px; scroll-snap-type: x proximity; }
  .cat-row::-webkit-scrollbar { display: none; }
  .cat-row > .btn { flex: 0 0 auto; scroll-snap-align: start; }
}

.img-pick { flex-wrap: nowrap; }
.img-thumb { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* أزرار جدول المنتجات عمودياً على الآيباد حتى لا تختفي خارج الجدول */
@media (min-width: 701px) and (max-width: 1000px) { .acts { flex-direction: column; gap: 6px; } .col-code { display: none; } }
.img-thumb svg { width: 22px; height: 22px; }

/* ================= الرسوم البيانية ================= */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; }
.ch-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.ch-ax { fill: var(--muted); font-size: 11px; }
.ch-val { fill: var(--text); font-size: 10.5px; font-weight: 700; }
.ch-center { fill: var(--text); font-size: 22px; font-weight: 700; }
.ch-track { stroke: var(--primary-soft); }
.ch-empty { color: var(--muted); text-align: center; padding: 30px 0; font-size: 14px; }
.ch-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: -4px 0 8px; font-size: 12.5px; color: var(--muted); }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend i, .ch-dlegend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.ch-donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.ch-donut svg { flex-shrink: 0; }
.ch-dlegend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 8px; }
.ch-dlegend div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ch-dlegend .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-dlegend small { color: var(--muted); min-width: 40px; text-align: left; }
.ch-hbars { display: flex; flex-direction: column; gap: 12px; }
.hb-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 5px; }
.hb-rank { width: 20px; height: 20px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.hb-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-top b { font-size: 13px; white-space: nowrap; }
.hb-track { height: 8px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; display: flex; }
.hb-track i { display: block; height: 100%; border-radius: 99px; }
.hb-sub { color: var(--muted); font-size: 11.5px; display: block; margin-top: 3px; }
.ch-heat { display: grid; gap: 4px; font-size: 11px; align-items: center; }
.ch-heat i { display: block; height: 26px; border-radius: 6px; }
.ch-heat .hh { color: var(--muted); text-align: center; white-space: nowrap; font-size: 10px; }
.ch-heat .hr { color: var(--muted); padding-left: 6px; white-space: nowrap; }

/* ================= صفحة التقارير ================= */
.rep-bar { display: flex; flex-direction: column; gap: 12px; }
.rep-tabs button { font-weight: 600; }
.rep-range { display: flex; flex-direction: column; gap: 10px; }
.rep-range .small svg { width: 14px; height: 14px; vertical-align: -2px; }
.rep-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--input); color: var(--text); font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 99px; cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--primary); }
.chip.on { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; font-weight: 600; }
.rep-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.rep-kpis .stat b { white-space: nowrap; }
.rep-kpis .stat > div:last-child { min-width: 0; }
.stat .delta { display: inline-block; font-style: normal; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-top: 4px; direction: ltr; }
.stat .delta.up { background: rgba(22, 163, 74, .12); color: var(--ok); }
.stat .delta.down { background: rgba(220, 38, 38, .1); color: var(--danger); }
.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.rep-grid .card { margin: 0; }
.rep-card.wide { grid-column: 1 / -1; }
.rep-card h3 { margin-top: 0; }
.rep-ch { min-height: 60px; }
.table-wrap tr.tot td { background: var(--primary-soft); font-weight: 700; }
@media (max-width: 900px) { .rep-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .rep-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .rep-presets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding: 2px 4px; }
  .rep-presets::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  .ch-heat .hh { font-size: 8.5px; }
  .ch-heat i { height: 22px; }
}

/* ================= نافذة التصدير ================= */
.exp-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.exp-opt { border: 1.5px solid var(--line); background: var(--input); color: var(--text); font: inherit; border-radius: 18px; padding: 18px 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: .18s; }
.exp-opt:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.exp-opt:disabled { opacity: .55; cursor: wait; }
.exp-opt small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.exp-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .5px; margin-bottom: 4px; }
.exp-ic.pdf { background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 8px 20px rgba(239, 68, 68, .3); }
.exp-ic.xls { background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 8px 20px rgba(22, 163, 74, .3); }
.exp-all { color: var(--text); gap: 8px; margin-bottom: 8px; font-size: 14px; }
.exp-status { min-height: 22px; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.exp-status svg { width: 16px; height: 16px; vertical-align: -3px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--primary-soft); border-top-color: var(--primary); display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= تحسينات المنتج والجرد ================= */
.margin-hint { grid-column: 1 / -1; font-size: 13px; margin: -6px 0 12px; display: flex; align-items: center; gap: 6px; min-height: 0; }
.margin-hint:empty { display: none; }
.margin-hint svg { width: 16px; height: 16px; flex-shrink: 0; }
.margin-hint.good { color: var(--ok); }
.margin-hint.low { color: var(--warn); }
.margin-hint.bad { color: var(--danger); font-weight: 600; }
.inv-progress { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.inv-progress .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; }
.inv-progress .bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .3s; }
#sync-status.saving .dot { background: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }

/* ================= صفحات PDF (تُرسم خارج الشاشة) ================= */
.pdf-host { position: fixed; top: 0; left: -20000px; z-index: -1; pointer-events: none; }
.pdf-page {
  --primary: #7c3aed; --primary-2: #a855f7; --primary-soft: rgba(124, 58, 237, .1); --text: #1e1238; --muted: #6b6185; --line: #ebe5f7;
  --ok: #16a34a; --warn: #d97706; --danger: #dc2626; --input: #fff;
  width: 794px; height: 1123px; background: #fff; color: var(--text); box-sizing: border-box; padding: 34px 40px 22px;
  display: flex; flex-direction: column; font-family: 'Ayar Plex', Tahoma, sans-serif; font-size: 12.5px; margin-bottom: 20px; overflow: hidden;
}
.pdf-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 2px solid var(--primary); margin-bottom: 16px; }
.pdf-brand { display: flex; align-items: center; gap: 10px; }
.pdf-brand b { font-size: 16px; display: block; }
.pdf-brand small, .pdf-title small { color: var(--muted); font-size: 11px; display: block; }
.pdf-logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 20px; }
img.pdf-logo { width: 46px; height: 46px; background: none; border-radius: 0; object-fit: contain; }
.pdf-title { text-align: left; }
.pdf-title b { font-size: 17px; color: var(--primary); display: block; }
.pdf-body { flex: 1; overflow: hidden; min-height: 0; }
.pdf-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.pdf-block { margin-bottom: 16px; }
.pdf-block h3 { font-size: 13.5px; margin: 0 0 8px; color: var(--text); }
.pdf-block h3 small { color: var(--muted); font-weight: 400; }
.pdf-sec { font-size: 16px; color: var(--primary); margin: 4px 0 0; padding: 8px 12px; background: var(--primary-soft); border-radius: 10px; }
.pdf-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pdf-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: linear-gradient(135deg, #faf7ff, #fff); }
.pdf-kpi small { color: var(--muted); font-size: 11px; display: block; }
.pdf-kpi b { font-size: 16px; display: block; margin-top: 2px; }
.pdf-delta { font-size: 10.5px; font-weight: 700; direction: ltr; display: inline-block; margin-top: 2px; }
.pdf-delta.up { color: var(--ok); } .pdf-delta.down { color: var(--danger); }
.pdf-chart { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.pdf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pdf-col { min-width: 0; }
.pdf-row .ch-donut { flex-direction: column; gap: 10px; }
.pdf-row .ch-donut svg { width: 150px; height: 150px; }
.pdf-row .ch-dlegend { width: 100%; min-width: 0; }
.pdf-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.pdf-table th { background: var(--primary); color: #fff; font-weight: 600; padding: 7px 6px; text-align: right; }
.pdf-table th:first-child { border-radius: 0 8px 0 0; } .pdf-table th:last-child { border-radius: 8px 0 0 0; }
.pdf-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pdf-table tr:nth-child(even) td { background: #fbf9ff; }
.pdf-table .n { white-space: nowrap; }
.pdf-table tr.tot td { background: var(--primary-soft); font-weight: 700; color: #4c1d95; border-bottom: none; }
.pdf-empty { text-align: center; color: var(--muted); padding: 16px !important; }
.pdf-note { font-size: 12px; }

/* ================= إحساس التطبيق ================= */
/* منع تصرفات المتصفح: تكبير بالنقر المزدوج، السحب المطاطي، تحديد النص والقائمة عند الضغط المطوّل */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; }
body { overscroll-behavior-y: none; }
img { -webkit-user-drag: none; }
@media (pointer: coarse) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, select, [contenteditable], .selectable, .selectable * { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
  /* ضغط الأزرار والبطاقات مثل التطبيقات */
  .btn, .tabbar a, .tabbar button, .nav a, .pos-item, .list-item, .stat, .theme-opt, .seg button, .cart-fab, .exp-opt, [data-cid] {
    transition: transform .12s ease, background-color .2s, opacity .2s;
  }
  .btn:active, .nav a:active, .seg button:active, .exp-opt:active, [data-cid]:active { transform: scale(.96); }
  .tabbar a:active, .tabbar button:active { transform: scale(.9); }
  .pos-item:active, .list-item:active, .stat:active, .theme-opt:active { transform: scale(.97); }
  .cart-fab:active { transform: translateX(-50%) scale(.97); }
}

/* شاشة الافتتاح */
#splash {
  position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(120% 80% at 50% 0%, #efe6ff 0%, #f8f4ff 55%, #fff 100%);
  transition: opacity .4s ease, transform .4s ease;
}
[data-theme="dark"] #splash { background: radial-gradient(120% 80% at 50% 0%, #2a1650 0%, #140c26 70%); }
#splash img { width: 96px; height: 96px; filter: drop-shadow(0 14px 26px rgba(124,58,237,.35)); animation: splash-pop .6s cubic-bezier(.2,.9,.3,1.3) both; }
#splash b { font-size: 26px; color: #4c1d95; letter-spacing: .5px; animation: splash-pop .6s .08s cubic-bezier(.2,.9,.3,1.3) both; }
#splash i { width: 34px; height: 4px; border-radius: 9px; background: linear-gradient(90deg, transparent, #a78bfa, transparent); background-size: 200% 100%; animation: splash-bar 1s linear infinite; margin-top: 8px; }
#splash.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
@keyframes splash-pop { from { opacity: 0; transform: scale(.7); } }
@keyframes splash-bar { to { background-position: -200% 0; } }

/* مؤشر الاتصال العائم */
#net-pill {
  position: fixed; z-index: 60; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: rgba(124,58,237,.92); color: #fff; box-shadow: 0 8px 24px rgba(76,29,149,.3); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: pill-in .35s cubic-bezier(.2,.9,.3,1.2); max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis;
}
#net-pill.warn { background: rgba(217,119,6,.94); box-shadow: 0 8px 24px rgba(146,64,14,.3); }
#net-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; flex: none; animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pill-in { from { opacity: 0; transform: translate(-50%, -16px); } }
@keyframes pulse-dot { 50% { opacity: .35; } }

/* اسحب للتحديث */
#ptr {
  position: fixed; z-index: 55; top: calc(4px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -60px);
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; opacity: 0;
  background: var(--glass-strong); box-shadow: 0 8px 22px rgba(76,29,149,.22); pointer-events: none;
  transition: opacity .2s, transform .25s cubic-bezier(.2,.8,.2,1);
}
#ptr img { width: 30px; height: 30px; transition: transform .2s; }
#ptr.ready img { transform: scale(1.18); }
#ptr.spin img { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* مقبض اللوح السفلي */
.sheet-grab { display: none; }
@media (max-width: 760px) {
  .sheet-grab { display: block; width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: -8px auto 12px; flex: none; }
  .modal { overscroll-behavior: contain; }
  .modal-back { transition: background .2s; }
}

/* انتقال الصفحات */
.view-enter { animation: view-in .32s cubic-bezier(.2,.8,.2,1); }
@keyframes view-in { from { opacity: 0; transform: translateY(10px) scale(.995); } }
@media (prefers-reduced-motion: reduce) { .view-enter, #splash img, #splash b, #net-pill { animation: none; } }

/* العنوان الكبير على الموبايل يصغر عند النزول */
@media (max-width: 760px) {
  .app { padding-top: calc(10px + env(safe-area-inset-top)); }
  .topbar { top: calc(8px + env(safe-area-inset-top)); transition: padding .25s ease, box-shadow .25s ease, background-color .25s; }
  .topbar h1 { font-size: 26px; transition: font-size .25s ease; letter-spacing: -.2px; }
  body.scrolled .topbar { padding-top: 8px; padding-bottom: 8px; background: var(--glass-strong); box-shadow: 0 8px 24px rgba(76,29,149,.12); }
  body.scrolled .topbar h1 { font-size: 18px; }
  body.scrolled #top-actions { margin-top: -2px; }
  .hide-sm { display: none; }
  .sidebar { top: calc(10px + env(safe-area-inset-top)); height: calc(100dvh - 20px - env(safe-area-inset-top)); }
}

/* بطاقة تثبيت التطبيق */
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; }
.install-card img { flex: none; filter: drop-shadow(0 6px 12px rgba(124,58,237,.25)); }
.install-card .grow { min-width: 0; }
.nav-install { color: var(--primary) !important; }
.ios-steps { display: grid; gap: 12px; }
.ios-step { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--primary-soft); line-height: 1.7; }
.ios-step .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 700; }
.ios-ic { display: inline-grid; place-items: center; vertical-align: middle; width: 30px; height: 30px; border-radius: 9px; background: var(--glass-strong); color: #0a84ff; }

/* وضع الكاشير بملء الشاشة */
body.pos-focus .sidebar, body.pos-focus .tabbar, body.pos-focus .topbar h1, body.pos-focus .topbar .sub, body.pos-focus .menu-btn { display: none !important; }
body.pos-focus .topbar { padding: 6px 8px; justify-content: flex-end; }
body.pos-focus #top-actions { width: auto; }
body.pos-focus #top-actions .btn { flex: none; }
body.pos-focus .app { padding-bottom: 18px; }
@media (max-width: 760px) {
  body.pos-focus .app { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  body.pos-focus .cart-fab { bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.pos-focus .pos-products { padding-bottom: 90px; }
}
body.pos-focus .pos-item .thumb { height: 92px; }
@media (max-width: 1100px) {
  body.pos-focus .topbar {
    position: fixed; top: auto; right: auto; left: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 46;
    padding: 0; background: none; border: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  body.pos-focus #pos-focus { min-width: 50px; height: 50px; border-radius: 50%; background: var(--glass-strong); box-shadow: 0 8px 22px rgba(76,29,149,.25); }
  body.pos-focus #pos-focus .hide-sm { display: none; }
  body.pos-focus #top-actions > :not(#pos-focus) { display: none; }
  body.pos-focus .app { padding-top: calc(10px + env(safe-area-inset-top)); }
}
