/* Deep ERP — ألوان ModernTheme في برنامج ويندوز (BrandBlue، Ink، Canvas). عربي RTL افتراضياً، وLTR بالإنجليزية. */
:root {
  --brand: #1559d6; --brand-600: #1047b0; --brand-50: #eaf1fd;
  --ink: #141b2a; --ink-deep: #0c111c; --on-ink: #e8edf5; --on-ink-muted: #94a3b8;
  --canvas: #f2f4f8; --surface: #fff; --surface-alt: #f8fafc;
  --border: #e2e8f0; --border-strong: #cbd5e1;
  --text: #17202e; --muted: #64748b;
  --ok: #16a34a; --info: #2563eb; --warn: #d97706; --danger: #dc2626;
  --ok-bg: #e8f7ee; --warn-bg: #fff4e5; --danger-bg: #fdecec; --info-bg: #eaf1fd;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --side: 264px; --top: 60px; --tap: 44px;
  --font: "Segoe UI", "Tahoma", "Noto Sans Arabic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.55 var(--font); color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:focus-visible, .input:focus-visible, .nav a:focus-visible { outline: 3px solid rgba(21,89,214,.35); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f5c2c2; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: var(--tap); height: var(--tap); padding: 0; border-radius: 10px; }
.input { width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(21,89,214,.15); }
textarea.input { min-height: 88px; resize: vertical; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted); }
label.field > span.req::after { content: " *"; color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; color: var(--text); }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* search with clear ✕ (زرّ المتصفّح مخفي: واحد فقط) */
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search .input { padding-inline-start: 38px; padding-inline-end: 38px; }
.search .ico { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; }
.search .clear:hover { background: var(--surface-alt); color: var(--text); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-alt); color: var(--muted); }
.badge.active, .badge.done, .badge.true { background: var(--ok-bg); color: var(--ok); }
.badge.trial, .badge.view { background: var(--info-bg); color: var(--info); }
.badge.expired, .badge.desktop { background: var(--warn-bg); color: var(--warn); }
.badge.suspended, .badge.missing { background: var(--danger-bg); color: var(--danger); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--ink); color: var(--on-ink); display: flex; flex-direction: column; z-index: 30; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--top); border-bottom: 1px solid rgba(255,255,255,.06); }
.side .brand img { width: 34px; height: 34px; border-radius: 9px; }
.side .brand b { font-size: 16px; }
.side .brand small { display: block; color: var(--on-ink-muted); font-size: 12px; font-weight: 400; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .filter { padding: 12px; }
.side .filter .input { background: var(--ink-deep); border-color: #263043; color: var(--on-ink); min-height: 38px; }
.side .side-branch { display: none; margin-top: 8px; }
.nav { padding: 4px 8px 24px; }
.nav details { border-radius: 10px; }
.nav summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 10px 10px; border-radius: 8px;
  color: var(--on-ink-muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; min-height: 40px; }
.nav summary::-webkit-details-marker { display: none; }
.nav summary::after { content: "▾"; transition: transform .15s; }
.nav details:not([open]) summary::after { transform: rotate(-90deg); }
html[dir="rtl"] .nav details:not([open]) summary::after { transform: rotate(90deg); }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border-radius: 8px; color: var(--on-ink); font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.on { background: var(--brand); color: #fff; }
.nav a .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--on-ink-muted); flex: 0 0 auto; }
.nav a.st-view .dot { background: #60a5fa; } .nav a.st-desktop .dot { background: #f59e0b; } .nav a.st-done .dot { background: #4ade80; }
.nav .home { margin-bottom: 6px; font-weight: 700; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.top .title { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top select.input { width: auto; min-width: 140px; min-height: 38px; }
.top .menu-btn { display: none; }
.content:focus { outline: none; }
.content { padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 12px 20px 0; border-radius: var(--radius); font-weight: 600; }
.banner.warn { background: var(--warn-bg); color: #92400e; border: 1px solid #fcd9a8; }
.banner.danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #f5c2c2; }
.banner .btn { margin-inline-start: auto; }

/* ---------- cards & KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card > header h2 { margin: 0; font-size: 16px; flex: 1; }
.card .body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
.kpi { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.kpi.ok::before { background: var(--ok); } .kpi.warn::before { background: var(--warn); } .kpi.danger::before { background: var(--danger); }
.kpi small { color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 26px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tile { display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 64px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; }
.tile:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.tile i { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-style: normal; font-size: 18px; flex: 0 0 auto; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bars div { flex: 1; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.bars div span { position: absolute; bottom: -20px; inset-inline: 0; text-align: center; font-size: 11px; color: var(--muted); }

/* ---------- toolbar & table ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.note { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-bg); color: #1e3a8a; margin-bottom: 14px; font-size: 14px; }
.note.warn { background: var(--warn-bg); color: #92400e; }
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { position: sticky; top: 0; background: var(--surface-alt); color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; user-select: none; }
.tbl th.sorted::after { content: " ▲"; } .tbl th.sorted.desc::after { content: " ▼"; }
.tbl tbody tr { cursor: pointer; } .tbl tbody tr:hover { background: var(--surface-alt); }
.tbl td.num { text-align: end; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; background: var(--surface-alt); }
.cards { display: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 0; color: var(--muted); font-size: 13px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef2f7, #f8fafc, #eef2f7); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- form drawer ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: flex; justify-content: flex-end; }
html[dir="rtl"] .drawer-bg { justify-content: flex-start; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,.15); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer header h3 { margin: 0; flex: 1; font-size: 17px; }
.drawer .body { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; grid-template-columns: 1fr 1fr; }
.drawer .body .wide { grid-column: 1 / -1; }
.drawer footer { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-alt); }
.drawer footer .spacer { flex: 1; }
.form-error { grid-column: 1 / -1; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.params { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; margin-bottom: 16px; }
.img-prev { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 80; display: grid; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-weight: 600; max-width: 360px; animation: slide .18s ease-out; }
.toast.err { background: var(--danger); } .toast.ok { background: var(--ok); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: radial-gradient(1200px 600px at 20% 10%, #1e40af 0%, transparent 60%), linear-gradient(160deg, var(--ink) 0%, var(--ink-deep) 100%);
  color: var(--on-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .art h1 { font-size: 38px; line-height: 1.2; margin: 0 0 12px; }
.auth .art p { color: var(--on-ink-muted); font-size: 17px; max-width: 460px; }
.auth .art ul { padding: 0; list-style: none; display: grid; gap: 10px; color: var(--on-ink); }
.auth .art li::before { content: "✓ "; color: #4ade80; font-weight: 700; }
.auth .panel { display: grid; place-items: center; padding: 32px 20px; }
.auth form, .auth .box { width: min(400px, 100%); display: grid; gap: 16px; }
.auth .logo { display: flex; align-items: center; gap: 12px; }
.auth .logo img { width: 48px; height: 48px; border-radius: 12px; }
.auth h2 { margin: 6px 0 0; font-size: 26px; }
.auth .sub { color: var(--muted); margin: 0; }
.pw { position: relative; } .pw .input { padding-inline-end: 48px; }
.pw button { position: absolute; inset-inline-end: 2px; top: 2px; bottom: 2px; width: 44px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.auth .err { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.auth .foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.landing-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- نقطة البيع (Frm_SalesPOS): ملء الشاشة، الأصناف بجانب السلّة، صفّ الحقول، شريط الأزرار ---------- */
body.pos-mode .side, body.pos-mode .top, body.pos-mode #banner { display: none; }
body.pos-mode .shell { grid-template-columns: 1fr; }
body.pos-mode .content { max-width: none; padding: 0; height: 100vh; }
.pos { height: 100vh; display: grid; grid-template-columns: minmax(300px, 42fr) 58fr; grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "top top" "cat cart" "fields fields" "bar bar" "status status"; background: var(--surface); }
.pos-top { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--brand); color: #fff; min-height: 52px; }
.pos-top .inv { display: flex; align-items: center; gap: 12px; background: #0f2d6b; margin-block: -6px; margin-inline-start: -12px; padding: 0 22px; align-self: stretch; }
.pos-top .inv small { color: #c7d5f5; font-weight: 600; } .pos-top .inv b { font-size: 20px; font-variant-numeric: tabular-nums; }
.pos-top .spacer { flex: 1; }
.pos-top .pf { color: #fff; } .pos-top .pf small { color: #d6e2fb; }
.pos-top select.input { min-height: 34px; padding: 2px 8px; border-color: transparent; color: var(--text); min-width: 150px; }
.pos-top .on-ink { color: #fff; font-size: 20px; } .pos-top .on-ink:hover { background: rgba(255,255,255,.15); color: #fff; border-color: transparent; }
.pf { display: grid; gap: 2px; min-width: 0; } .pf small { color: var(--muted); font-size: 12px; font-weight: 600; }
.pos .row { display: flex; gap: 6px; align-items: stretch; } .pos .row .input { flex: 1; min-width: 0; }

.pos-cat { grid-area: cat; display: grid; grid-template-rows: auto minmax(0, 1fr); border-inline-end: 1px solid var(--border); background: #eef1f7; min-height: 0; }
.pos-groups { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--border); }
.grp { flex: 0 0 132px; height: 96px; position: relative; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; padding: 0; background: #c9ced8; color: #fff; }
.grp img, .grp .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; font-size: 34px; color: #f6f7fa; }
.grp .gname { position: absolute; inset-inline: 0; bottom: 0; padding: 4px 8px; background: linear-gradient(transparent, rgba(0,0,0,.65)); font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grp.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(21,89,214,.25); }
.pos-items { overflow-y: auto; padding: 8px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); align-content: start; }
.itm { display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); cursor: pointer; padding: 0; min-height: 150px; text-align: center; }
.itm:hover { border-color: var(--brand); box-shadow: var(--shadow); } .itm:active { transform: scale(.98); }
.itm .ip { background: var(--brand-50); color: var(--brand); font-weight: 700; padding: 4px; font-variant-numeric: tabular-nums; }
.itm img, .itm .ph { width: 100%; height: 86px; object-fit: cover; display: grid; place-items: center; background: #d3d7de; color: #f3f4f6; font-size: 30px; }
.itm .iname { background: #5b6270; color: #fff; font-weight: 700; padding: 5px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pos-cart { grid-area: cart; display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; }
.pos-entry { display: grid; grid-template-columns: 1.1fr 1.3fr .8fr; gap: 10px; padding: 8px 12px; align-items: end; }
.cart-head { display: flex; align-items: center; gap: 10px; padding: 6px 12px; }
.cart-head h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.cart-head .count { min-width: 40px; padding: 4px 10px; border-radius: 6px; background: var(--brand-50); color: var(--brand); text-align: center; font-size: 15px; }
.cart-head .spacer { flex: 1; }
.cart-tbl { overflow: auto; min-height: 0; border-top: 1px solid var(--border); }
.pos-tbl th { cursor: default; text-align: center; } .pos-tbl td { text-align: center; padding: 8px 10px; }
.pos-tbl td.name { text-align: center; white-space: normal; font-weight: 600; }
.pos-tbl td.name .offer { display: block; color: var(--ok); font-weight: 600; font-size: 12px; }
.pos-tbl tbody tr { background: #e8eefb; } .pos-tbl tbody tr.sel { background: #cddcf8; }
.pos-tbl td.edit { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 4px; }
.pos-tbl td.tot { font-weight: 700; } .pos-tbl td.has-offer { color: var(--brand); }
.pos-tbl .del { width: 32px; height: 32px; border-radius: 50%; border: 0; background: #ef5350; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.pos-tbl .del[disabled] { opacity: .35; }
.pos-tbl input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); }

.pos-fields { grid-area: fields; display: grid; grid-template-columns: 110px 110px 1.4fr 1.2fr auto auto auto; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--border); align-items: end; }
.pos-fields output.big { display: block; min-height: 40px; padding: 6px 10px; border-radius: 6px; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.segs { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg { min-height: 40px; padding: 0 14px; border: 0; background: var(--surface); cursor: pointer; font-weight: 600; }
.seg.on { background: var(--brand-50); color: var(--brand); } .seg[disabled] { opacity: .5; cursor: default; }

.pos-bar { grid-area: bar; display: flex; align-items: stretch; min-height: 72px; background: var(--surface); border-top: 1px solid var(--border); }
.pos-bar .act { flex: 0 0 104px; border: 0; color: #fff; font-weight: 700; display: grid; place-items: center; align-content: center; gap: 4px; cursor: pointer; }
.pos-bar .act.finish { background: #16a34a; } .pos-bar .act.payb { background: var(--brand); }
.pos-bar .act:hover { filter: brightness(1.08); }
.pos-bar .grand-box { flex: 1 1 320px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; background: #0f2d6b; color: #fff; }
.pos-bar .grand-box small { color: #a9bce6; font-size: 16px; }
.pos-bar .grand { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pos-bar .tools { display: flex; flex: 0 1 auto; }
.tool { flex: 1 0 76px; border: 0; background: transparent; display: grid; place-items: center; align-content: center; gap: 2px; cursor: pointer; color: var(--text); font-weight: 600; font-size: 13px; padding: 4px; }
.tool:hover { background: var(--surface-alt); color: var(--brand); } .tool[disabled] { opacity: .4; cursor: not-allowed; }
.pi svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool .pi { color: var(--brand); }
.pos-status { grid-area: status; display: flex; gap: 24px; padding: 4px 12px; min-height: 26px; color: var(--muted); font-size: 13px; }
.pos-status b { color: var(--text); } .pos-status .alarm { color: var(--danger); font-weight: 700; }

.pos-modal { position: fixed; inset: 0; z-index: 70; background: rgba(15,23,42,.45); display: grid; place-items: center; padding: 16px; }
.pos-modal .box { width: min(380px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pos-modal .box.wide { width: min(720px, 100%); }
.pos-modal header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pos-modal header h3 { margin: 0; flex: 1; font-size: 17px; }
.pos-modal .mbody { padding: 16px; overflow-y: auto; }
.pos-modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-alt); }
.kp { display: grid; gap: 10px; } .kp-disp { font-size: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.kp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .kp-keys .btn { min-height: 54px; font-size: 20px; }
.pay-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pay-tiles div { padding: 10px; border-radius: 8px; background: var(--surface-alt); border: 1px solid var(--border); text-align: center; }
.pay-tiles small { color: var(--muted); display: block; } .pay-tiles b { font-size: 20px; font-variant-numeric: tabular-nums; }
.pay-methods { display: flex; flex-wrap: wrap; gap: 8px; } .pay-methods .btn { min-height: 52px; min-width: 110px; }
.pay-methods .btn.on { border: 3px solid var(--brand); background: var(--brand-50); color: var(--brand); }
.pay-lines { display: grid; gap: 4px; } .pay-lines .pl { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 6px; background: var(--surface-alt); }
.pay-lines .pl span { flex: 1; }
.picks { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.pick { display: grid; gap: 2px; text-align: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.pick:hover { border-color: var(--brand); } .pick span { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

/* الانتظار والطاولات (Frm_HoldInvoiceRestaurantsNew / Frm_HoldInvoice) */
.tables { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); max-height: 60vh; overflow-y: auto; }
.table-card { display: grid; place-items: center; gap: 4px; min-height: 110px; padding: 8px; border: 2px solid #bbf7d0; border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--ok); font-weight: 700; }
.table-card.busy { border-color: #fecaca; color: var(--danger); }
.table-card img { width: 100%; height: 64px; object-fit: cover; border-radius: 8px; }
.table-card:hover { box-shadow: var(--shadow); }
.hold-row { display: flex; align-items: center; gap: 10px; } .hold-row .grow { flex: 1; display: grid; gap: 2px; cursor: pointer; }
.tool { position: relative; } .tool .hc { position: absolute; top: 2px; inset-inline-end: 8px; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; line-height: 20px; }

/* فاتورة المشتريات (Frm_Purchase): الرأس والجدول بجانب الأصناف */
.pos.pur { grid-template-columns: 62fr minmax(280px, 38fr); grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "top top" "head cat" "lines cat" "info info" "bar bar" "status status"; }
.pur-head { grid-area: head; padding: 8px 12px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.pur-tax { display: flex; align-items: center; gap: 16px; } .pur-tax .spacer { flex: 1; } .pur-tax .check { min-height: 32px; font-size: 14px; }
.pur-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; } .pur-grid .wide { grid-column: 1 / -1; }
.pur-grid .pf { grid-template-columns: 118px 1fr; align-items: center; gap: 8px; }
.pur-grid .pf small { font-size: 13px; }
.pur-grid .input { min-height: 32px; padding: 2px 8px; } .pur-grid .btn.icon-btn { width: 32px; height: 32px; }
.pur-grid textarea.input { min-height: 34px; height: 34px; }
.pur-lines { grid-area: lines; min-height: 0; display: grid; }
.pur-cat { grid-area: cat; border-inline-end: 0; border-inline-start: 1px solid var(--border); }
.pur-tbl th { background: var(--brand); color: #fff; } .pur-tbl td, .pur-tbl th { padding: 6px 6px; }
.pur-tbl select.input.sm { min-height: 30px; padding: 2px 4px; width: auto; }
.pos-fields.pur-info { grid-area: info; grid-template-columns: auto 1fr 110px 130px 130px; }

@media (max-width: 1100px) {
  .pos-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pos-bar .tools .tool span { display: none; } .tool { flex-basis: 52px; }
}
@media (max-width: 820px) {
  .pos { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: auto auto auto auto auto auto;
    grid-template-areas: "top" "cart" "cat" "fields" "status" "bar"; }
  body.pos-mode .content { height: auto; }
  .pos-cat { max-height: 70vh; border-inline-end: 0; border-top: 1px solid var(--border); }
  .cart-tbl { max-height: 46vh; }
  .pos-entry { grid-template-columns: 1fr; }
  .pos-top { flex-wrap: wrap; } .pos-top .pf { flex: 1 1 40%; }
  .pos-fields { grid-template-columns: 1fr 1fr; }
  .pos-bar { position: sticky; bottom: 0; flex-wrap: wrap; z-index: 5; }
  .pos-bar .act { flex: 1 1 50%; min-height: 56px; } .pos-bar .grand-box { flex: 1 1 100%; order: -1; padding: 6px 16px; }
  .pos-bar .grand { font-size: 30px; } .pos-bar .tools { flex: 1 1 100%; overflow-x: auto; }
  .pay-tiles { grid-template-columns: repeat(2, 1fr); }
  .pos.pur { grid-template-columns: 1fr; grid-template-areas: "top" "head" "lines" "cat" "info" "status" "bar"; }
  .pur-grid { grid-template-columns: 1fr; } .pur-lines .cart-tbl { max-height: 50vh; } .pur-info { grid-template-columns: 1fr 1fr; }
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .2s; box-shadow: 8px 0 32px rgba(0,0,0,.25); }
  html[dir="rtl"] .side { transform: translateX(105%); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 25; }
  .top .menu-btn { display: inline-flex; }
}
@media (max-width: 720px) {
  .content { padding: 12px; }
  .banner { margin: 10px 12px 0; }
  .top { padding: 0 8px; gap: 6px; }
  .top .hide-sm { display: none; }
  .side .side-branch { display: block; }
  .top select.input { min-width: 0; max-width: 130px; }
  .tbl-wrap.as-cards { display: none; }
  .cards { display: grid; gap: 10px; }
  .cards .c { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 4px; }
  .cards .c b { font-size: 15px; }
  .cards .c div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
  .cards .c div span:last-child { color: var(--text); text-align: end; }
  .drawer .body { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .kpi b { font-size: 22px; }
  .toolbar .btn { flex: 1 1 auto; }
  .search { max-width: none; flex-basis: 100%; }
}
@media print {
  .side, .top, .toolbar, .banner, .pager, .params, .no-print { display: none !important; }
  .shell { display: block; } .content { padding: 0; } .tbl-wrap { border: 0; overflow: visible; }
  .tbl th { position: static; } body { background: #fff; }
}

/* ---------- السندات والقيد وصلاحيات الحسابات (acc.js) ---------- */
.acc-bar { gap: 8px; }
.acc-split { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.acc-side { max-height: calc(100vh - 220px); display: flex; flex-direction: column; }
.acc-tree { overflow-y: auto; padding: 6px 0; }
.acc-tree summary { padding: 8px 14px; cursor: pointer; font-weight: 700; }
.acc-tree a { display: block; padding: 6px 28px; color: var(--text); font-variant-numeric: tabular-nums; }
.acc-tree a:hover { background: var(--surface-alt); }
.acc-tree a.on { background: var(--brand-50); color: var(--brand); font-weight: 700; }
.acc-form { display: grid; gap: 12px; max-width: 760px; }
.acc-f { display: grid; gap: 4px; }
.acc-f > small { color: var(--muted); font-weight: 600; }
.acc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.acc-row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.acc-amount { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.acc-types { display: flex; gap: 24px; }
.acc-status { min-height: 24px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.acc-status.ok { color: var(--ok); } .acc-status.err { color: var(--danger); }
.acc-lookup { position: relative; }
.acc-drop { position: absolute; inset-inline: 0; top: calc(100% + 2px); z-index: 40; max-height: 280px; overflow-y: auto; min-width: 280px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.acc-opt { display: flex; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: start; cursor: pointer; }
.acc-opt:hover, .acc-opt.on { background: var(--brand-50); }
.acc-opt b { color: var(--muted); font-variant-numeric: tabular-nums; }
.acc-jhead { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.acc-no { font-size: 17px; }
.acc-inl { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.acc-inl.grow { flex: 1 1 320px; } .acc-inl.grow .input { flex: 1; }
.acc-state { flex-basis: 100%; }
.acc-lines { overflow: visible; }
.acc-jtbl td { padding: 4px 6px; white-space: normal; }
.acc-jtbl td:first-child { width: 40px; text-align: center; }
.acc-jtbl td.acc-acc { width: 34%; }
.acc-jtbl td:nth-child(4), .acc-jtbl td:nth-child(5) { width: 140px; }
.acc-jtbl .input { min-height: 36px; padding: 4px 8px; }
.acc-jtbl .input.num { text-align: end; font-variant-numeric: tabular-nums; }
.acc-jtbl tbody tr { cursor: default; }
.acc-totals { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; padding: 10px 14px; margin-top: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.acc-totals .spacer { flex: 1; }
.acc-totals b.ok { color: var(--ok); } .acc-totals b.bad { color: var(--danger); }
.acc-hint { display: block; margin-top: 8px; }
.acc-tpl { display: flex; gap: 8px; align-items: center; } .acc-tpl .pick { flex: 1; text-align: start; }
.acc-perm { max-height: calc(100vh - 330px); }
.acc-perm.off td { color: var(--muted); }
.acc-perm .acc-flag { width: 82px; text-align: center; }
.acc-perm input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.acc-perm tr.sel td { background: var(--brand-50); }
.acc-custom { color: var(--brand); font-weight: 600; }
.acc-print { display: none; }
@media (max-width: 820px) {
  .acc-split { grid-template-columns: 1fr; }
  .acc-side { max-height: 240px; }
  .acc-row4 { grid-template-columns: 1fr 1fr; }
}
@media print {
  body.acc-printing > *:not(.acc-print) { display: none !important; }
  body.acc-printing .acc-print { display: block; padding: 24px; font-size: 15px; }
  .acc-print h1 { text-align: center; font-size: 22px; margin: 0 0 18px; }
  .acc-print table { width: 100%; border-collapse: collapse; }
  .acc-print th, .acc-print td { border: 1px solid #999; padding: 10px; text-align: start; }
  .acc-print th { width: 28%; background: #f3f3f3; }
  .acc-sign { display: flex; justify-content: space-between; margin-top: 70px; }
  .acc-sign span { border-top: 1px solid #333; padding-top: 6px; width: 28%; text-align: center; }
}
.acc-grid tr.sel td { background: var(--brand-50); }

/* ---------- الموارد البشرية (hr.js) ---------- */
.hr-split { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 14px; align-items: start; }
.hr-editor .body { max-height: calc(100vh - 230px); overflow-y: auto; }
.hr-form { display: grid; gap: 10px; }
.hr-sheet { max-height: calc(100vh - 280px); }
.hr-sheet td { padding: 4px 6px; }
.hr-sheet .input { min-height: 36px; padding: 4px 8px; }
.hr-sheet tbody tr { cursor: default; }
.acc-bar b.ok { color: var(--ok); }
@media (max-width: 1100px) { .hr-split { grid-template-columns: 1fr; } }
@media print {
  body.acc-printing .hr-print table { margin-bottom: 18px; font-size: 13px; }
  body.acc-printing .hr-print .hr-slip { page-break-inside: avoid; width: 70%; }
  body.acc-printing .hr-print th { width: auto; }
  body.acc-printing .hr-print .hr-slip th { width: 45%; }
}

/* ---------- دورة المشتريات (proc.js) ---------- */
.proc-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 12px; }
.proc-head h2 { margin: 0; font-size: 20px; }
.proc-amount { text-align: end; } .proc-amount b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.proc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px 220px; gap: 12px; align-items: start; }
.proc-items .tbl-wrap { overflow: visible; }
.proc-items .input.over { color: var(--danger); font-weight: 700; }
.proc-tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.proc-tl li { display: grid; gap: 2px; padding-inline-start: 18px; position: relative; }
.proc-tl li::before { content: ""; position: absolute; inset-inline-start: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.proc-tl li.future { opacity: .55; } .proc-tl li.future::before { background: transparent; border: 2px solid var(--border-strong); }
.badge.st0 { background: var(--surface-alt); color: var(--muted); } .badge.st1 { background: var(--warn-bg); color: #92400e; }
.badge.st2, .badge.st5, .badge.st8 { background: var(--ok-bg); color: #166534; } .badge.st3 { background: var(--danger-bg); color: var(--danger); }
.badge.st6, .badge.st9 { background: var(--info-bg); color: #1e3a8a; }
.cmp-wrap td.cmp { white-space: nowrap; } .cmp-wrap td.best .input { background: var(--ok-bg); font-weight: 700; }
.cmp-wrap td.on { outline: 2px solid var(--brand); outline-offset: -2px; } .cmp-wrap .mark { color: var(--ok); margin-inline: 4px; }
.cmp-wrap .award.on { color: var(--brand); } .cmp-wrap tbody tr { cursor: default; }
@media (max-width: 1200px) { .proc-grid { grid-template-columns: 1fr; } }
.proc-items select.input { width: 120px; } .proc-items .tbl-wrap { overflow-x: auto; }
.input.over { color: var(--danger); font-weight: 700; }
/* شاشة التوزيع: الطلبات ثم المتاحون ثم الخارجون */
.del-board { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .del-board { grid-template-columns: 1fr; } }
