:root {
  --blue: #0F766E; --blue-h: #115E59; --blue-soft: rgba(15, 118, 110, .10);
  --teal: #16A34A; --teal-soft: rgba(22, 163, 74, .10);
  --warn: #D97706; --warn-soft: rgba(217, 119, 6, .10);
  --danger: #DC2626; --danger-soft: rgba(220, 38, 38, .08);
  --bg: #F4F6FC; --card: #FFFFFF; --surface: #EBEEF8; --surface2: #DDE2F0;
  --bd: rgba(0, 0, 0, .08); --bd2: rgba(0, 0, 0, .14);
  --text: #0B0F1A; --text2: #4B5468; --text3: #9299AE;
  --r: 8px; --rl: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06); --shadow-md: 0 8px 24px rgba(15, 23, 42, .12);
  --side: 236px;
  font-family: "Noto Sans Arabic", system-ui, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-left: 1px solid var(--bd); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px; }
.side .brand { display: flex; flex-direction: column; align-items: center; padding: 4px 8px 14px; border-bottom: 1px solid var(--bd); margin-bottom: 10px; }
.side .brand img { width: 150px; }
.side .sect { font-size: 11.5px; color: var(--text3); padding: 12px 12px 4px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r); color: var(--text2); margin: 1px 0; }
.side a.nav i { font-size: 18px; }
.side a.nav:hover { background: var(--bg); color: var(--text); }
.side a.nav.on { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 58px; background: var(--card); border-bottom: 1px solid var(--bd); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.top h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.top .user { display: flex; align-items: center; gap: 8px; color: var(--text2); font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 600; }
.burger { display: none; }
.page { padding: 20px; max-width: 1400px; width: 100%; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--bd2); background: var(--card); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-h); }
.btn.green { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { color: var(--danger); border-color: rgba(220, 38, 38, .35); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.btn i { font-size: 17px; }
input, select, textarea { height: 38px; border: 1px solid var(--bd2); border-radius: var(--r); padding: 0 10px; background: #fff; width: 100%; }
textarea { height: 70px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input[type=checkbox] { width: 18px; height: 18px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text2); }
label.f.req > span::after { content: " *"; color: var(--danger); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.form .wide { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--text3); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 460px; }
.seg label { display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border: 1.5px solid var(--bd2); border-radius: var(--r); cursor: pointer; background: #fff; color: var(--text2); font-weight: 500; user-select: none; }
.seg label:hover { border-color: var(--blue); }
.seg label input { display: none; }
.seg label.on { border-color: var(--blue); background: var(--blue); color: #fff; }
.seg label:last-child.on { border-color: var(--text2); background: var(--text2); }
.seg.sm { grid-template-columns: auto auto; gap: 4px; }
.seg.sm label { height: 32px; padding: 0 12px; font-size: 13px; }
.seg.sm label.on { border-color: var(--blue); background: var(--blue); color: #fff; }
.calc { background: var(--teal-soft); color: var(--teal); border-radius: var(--r); padding: 8px 12px; font-size: 13px; }

/* ---------- cards & tables ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.card { background: var(--card); border: 1px solid var(--bd); border-radius: var(--rl); box-shadow: var(--shadow-sm); }
.card.pad { padding: 16px 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--bd); border-radius: var(--rl); padding: 14px 16px; }
.kpi .l { color: var(--text2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 22px; font-weight: 600; margin-top: 4px; }
.kpi .s { font-size: 12px; color: var(--text3); }
.kpi.blue .v { color: var(--blue); } .kpi.green .v { color: var(--teal); } .kpi.warn .v { color: var(--warn); } .kpi.red .v { color: var(--danger); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { background: #F8F9FD; color: var(--text2); font-weight: 500; text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--bd); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--bd); white-space: nowrap; }
table.t tbody tr:hover { background: #FAFBFF; }
table.t tfoot td { font-weight: 600; background: var(--surface); border-top: 1px solid var(--bd2); }
table.t tr.sub td { background: var(--blue-soft); font-weight: 600; }
table.t td.n, table.t th.n { text-align: left; font-variant-numeric: tabular-nums; }
table.t .pos { color: var(--teal); } table.t .neg { color: var(--danger); }
.empty { padding: 40px; text-align: center; color: var(--text3); }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; background: var(--surface); color: var(--text2); }
.badge.blue { background: var(--blue-soft); color: var(--blue); } .badge.green { background: var(--teal-soft); color: var(--teal); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.red { background: var(--danger-soft); color: var(--danger); }
.alert { border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.alert.warn { background: var(--warn-soft); color: #92400E; } .alert.ok { background: var(--teal-soft); color: #065F46; } .alert.info { background: var(--blue-soft); color: #1E3A8A; }
.bars .row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 110px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.bars .bar { height: 10px; border-radius: 6px; background: var(--surface); overflow: hidden; }
.bars .bar span { display: block; height: 100%; background: var(--blue); border-radius: 6px; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(11, 15, 26, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); border-radius: var(--rl); width: 100%; max-width: 760px; box-shadow: var(--shadow-md); }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--bd); }
.modal .mh h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal .mb { padding: 18px; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 18px; border-top: 1px solid var(--bd); background: #FAFBFF; border-radius: 0 0 var(--rl) var(--rl); }
.toasts { position: fixed; bottom: 18px; left: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: var(--r); box-shadow: var(--shadow-md); font-size: 13px; }
.toast.err { background: var(--danger); } .toast.ok { background: var(--teal); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--bd); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-md); }
.login img { width: 230px; display: block; margin: 0 auto 18px; }
.login .tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: var(--r); padding: 4px; margin-bottom: 16px; }
.login .tabs button { border: 0; background: transparent; height: 34px; border-radius: 6px; cursor: pointer; color: var(--text2); }
.login .tabs button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }
.login form { display: grid; gap: 12px; }
.login .btn { width: 100%; justify-content: center; height: 40px; }

/* ---------- صفحة الدخول: الفورم يمين والواجهة الترحيبية شمال ---------- */
.auth { display: grid; grid-template-columns: 440px minmax(0, 1fr); min-height: 100vh; background: #fff; }
.auth .login { flex-direction: column; display: flex; justify-content: center; align-items: center; background: #fff; }
.auth .login .box { border: 0; box-shadow: none; padding: 12px 8px; max-width: 360px; }
.auth .login img { width: 250px; margin: 0 0 26px; }
.auth-h { font-size: 26px; margin: 0 0 18px; color: var(--text); }
.auth .login .btn { height: 46px; font-size: 15px; }
.auth .login input { height: 44px; }
.auth-copy { margin-top: 24px; font-size: 12px; color: var(--text3); }
.hero { position: relative; overflow: hidden; color: #fff; padding: 40px 44px 32px; display: flex; flex-direction: column; gap: 22px;
  background: radial-gradient(circle at 15% 20%, rgba(45, 212, 191, .35), transparent 40%), radial-gradient(circle at 85% 85%, rgba(250, 204, 21, .18), transparent 40%), linear-gradient(135deg, #0F766E 0%, #115E59 45%, #0B3B4A 100%); }
.hero::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1.4px); background-size: 22px 22px; pointer-events: none; }
.hero > * { position: relative; }
.hero h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.4; }
.hero h1 span { color: #FDE68A; }
.hero-sub { margin: -14px 0 0; color: rgba(255, 255, 255, .82); font-size: 15px; }
.orbit { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 230px minmax(0, 1fr); align-items: center; gap: 18px; }
.orbit .col { display: grid; gap: 26px; }
.hf { display: flex; align-items: flex-start; gap: 12px; position: relative; animation: heroIn .6s both; animation-delay: var(--d); }
.orbit .col:not(.left) .hf { flex-direction: row; text-align: right; }
.orbit .col.left .hf { flex-direction: row-reverse; text-align: left; }
.hf-ic { flex: 0 0 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; color: #fff; background: var(--c);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .14), 0 10px 24px rgba(0, 0, 0, .22); }
.hf b { display: block; font-size: 16px; margin: 4px 0 4px; }
.hf b::after { content: ""; display: block; height: 2px; width: 70px; margin-top: 6px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8)); }
.orbit .col.left .hf b::after { margin-right: auto; background: linear-gradient(90deg, rgba(255, 255, 255, .8), transparent); }
.hf p { margin: 0; font-size: 12.5px; line-height: 1.7; color: rgba(255, 255, 255, .85); }
.hub { width: 230px; height: 230px; border-radius: 50%; display: grid; place-items: center; position: relative; border: 2px dashed rgba(255, 255, 255, .45); animation: spin 40s linear infinite; }
.hub::before { content: ""; position: absolute; inset: -18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); }
.hub-in { width: 180px; height: 180px; border-radius: 50%; background: #fff; color: #0F766E; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 0 0 10px rgba(255, 255, 255, .16), 0 20px 50px rgba(0, 0, 0, .3); animation: spin 40s linear infinite reverse; }
.hub-in .ti { font-size: 48px; }
.hub-in b { font-size: 20px; color: #0F172A; }
.hub-in span { font-size: 12px; color: #0F766E; }
.hero-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hc { background: var(--c); border-radius: 14px; padding: 16px 18px; box-shadow: 0 10px 24px rgba(0, 0, 0, .2); position: relative; overflow: hidden; }
.hc .ti { position: absolute; left: 12px; top: 10px; font-size: 44px; opacity: .25; }
.hc b { display: block; font-size: 16px; color: #FEF9C3; margin-bottom: 4px; }
.hc p { margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, .92); line-height: 1.6; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes heroIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hub, .hub-in, .hf { animation: none; } }
@media (max-width: 1250px) {
  .orbit { grid-template-columns: 1fr 1fr; }
  .orbit .hub { display: none; }
  .orbit .col.left .hf { flex-direction: row; text-align: right; }
  .orbit .col.left .hf b::after { margin-right: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8)); }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth .login { min-height: auto; padding: 32px 16px 24px; }
  .hero { padding: 28px 16px; }
  .hero h1 { font-size: 22px; }
  .orbit, .hero-cards { grid-template-columns: 1fr; }
}
.spinner { width: 28px; height: 28px; border: 3px solid var(--surface2); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- invoice ---------- */
.doc { background: #fff; max-width: 900px; margin: 0 auto; padding: 32px 36px; border: 1px solid var(--bd); border-radius: var(--rl); }
.doc .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px solid var(--blue); padding-bottom: 14px; margin-bottom: 16px; }
.doc .head img { width: 210px; }
.doc .head .co { font-size: 12.5px; color: var(--text2); line-height: 1.8; }
.doc h2.title { text-align: center; margin: 4px 0 16px; font-size: 20px; color: var(--blue); }
.doc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin-bottom: 16px; font-size: 13px; }
.doc .meta div b { color: var(--text2); font-weight: 500; margin-left: 6px; }
.doc .totals { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 16px; }
.doc .totals table { width: 320px; font-size: 13.5px; border-collapse: collapse; }
.doc .totals td { padding: 7px 10px; border-bottom: 1px solid var(--bd); }
.doc .totals tr:last-child td { font-weight: 700; background: var(--blue-soft); color: var(--blue); }
.doc .qr { width: 130px; height: 130px; }
.doc .foot { margin-top: 24px; font-size: 12px; color: var(--text3); text-align: center; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; right: 0; top: 0; z-index: 40; width: 260px; transform: translateX(105%); transition: transform .2s; box-shadow: var(--shadow-md); }
  .side.open { transform: none; }
  .burger { display: inline-flex; }
  .page { padding: 14px; }
  .top { padding: 0 12px; }
  .top .user span { display: none; }
  .doc { padding: 18px; }
  .doc .meta { grid-template-columns: 1fr; }
  .bars .row { grid-template-columns: 90px minmax(0, 1fr) 90px; }
}

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; font-size: 12px; }
  .side, .top, .toolbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card, .doc { border: 0; box-shadow: none; padding: 0; }
  table.t th { position: static; }
  table.t td, table.t th { padding: 5px 6px; }
  .print-only { display: block !important; }
  .print-head { display: flex !important; }
}
.print-only { display: none; }

/* ---------- dashboards & PDF ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; margin-bottom: 16px; }
.charts .wide { grid-column: 1 / -1; }
.chart-card h3 { font-size: 14px; }
h3.sec { font-size: 16px; font-weight: 600; margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); }
h3.sec .hint { font-weight: 400; }
.picker { margin-bottom: 14px; }
.picker .head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
table.t tbody tr.sel td { background: var(--danger-soft); }
/* قايمة منسدلة متعددة الاختيار */
.msel { position: relative; }
.msel-btn { width: 100%; height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--bd2); border-radius: var(--r); background: #fff; padding: 0 10px; cursor: pointer; text-align: right; }
.msel-btn .msel-txt { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msel-btn .msel-txt.ph { color: var(--text3); }
.msel-btn .ti { color: var(--text3); transition: transform .15s; }
.msel.open .msel-btn { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.msel.open .msel-btn .ti { transform: rotate(180deg); }
.msel-pop { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; min-width: 100%; width: 300px; max-width: 90vw; background: #fff; border: 1px solid var(--bd2); border-radius: var(--r); box-shadow: var(--shadow-md); padding: 8px; }
.msel-acts { display: flex; gap: 6px; margin: 8px 0; }
.msel-list { max-height: 240px; overflow-y: auto; display: grid; gap: 2px; }
.msel-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; user-select: none; }
.msel-opt:hover { background: var(--surface); }
.msel-opt.on { background: var(--blue-soft); color: var(--blue); }
.msel-opt input { width: 16px; height: 16px; margin: 0; }
.msel-opt .c { color: var(--text3); font-size: 12px; margin-right: auto; }
.picker .chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 190px; overflow-y: auto; }
.picker .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--bd2); border-radius: 999px; cursor: pointer; font-size: 13px; background: #fff; user-select: none; }
.picker .chip input { width: 15px; height: 15px; margin: 0; }
.picker .chip.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.picker .chip .c { color: var(--text3); font-size: 12px; }
body.pdf-mode .toolbar, body.pdf-mode .no-print { display: none !important; }
body.pdf-mode .print-only { display: block !important; }
body.pdf-mode .print-head { display: flex !important; }
body.pdf-mode .tbl-wrap { overflow: visible !important; }
body.pdf-mode table.t th { position: static; }
body.pdf-mode .card { box-shadow: none; }
body.pdf-mode .ti { display: none; }
@media (max-width: 900px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.print-head { align-items: center; justify-content: space-between; border-bottom: 2px solid var(--blue); padding-bottom: 8px; margin-bottom: 12px; }
.print-head img { width: 150px; }

/* لوحة التحكم: مربعات الاختصارات زي دفترة */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 120px; background: var(--card); border: 1px solid var(--bd); border-radius: var(--rl); color: var(--text); text-decoration: none; font-weight: 600; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile .ti { font-size: 38px; }
.tile.on { border-color: var(--blue); background: var(--blue-soft); }

/* ---------- شاشة البيع (بتاخد الشاشة كلها) ---------- */
body.full .side, body.full .top { display: none; }
body.full .shell { display: block; }
body.full .page { padding: 0; max-width: none; height: 100vh; }
.pos { display: grid; grid-template-columns: 380px minmax(0, 1fr); height: 100vh; background: var(--surface); }
.pos-cart { display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--bd); min-height: 0; }
.pos-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--bd); overflow-x: auto; }
.pos-tabs button { height: 34px; min-width: 46px; padding: 0 10px; border: 1px solid var(--bd2); border-radius: var(--r); background: #fff; cursor: pointer; font-weight: 600; white-space: nowrap; }
.pos-tabs button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pos-tabs button.on .badge { background: #fff; color: var(--blue); }
.pos-tabs .add { color: var(--blue); }
.pos-client { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--bd); }
.pos-client select { flex: 1; }
.pos-lines { flex: 1; overflow-y: auto; min-height: 0; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--bd); cursor: pointer; }
.pos-line .nm { grid-column: 1 / -1; font-weight: 600; }
.pos-line .qp { color: var(--text2); font-size: 13px; }
.pos-line .tt { font-weight: 700; }
.pos-line.on { background: var(--blue-soft); box-shadow: inset -4px 0 0 var(--blue); }
.pos-sum { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; padding: 10px 12px; border-top: 1px solid var(--bd); background: var(--surface); }
.pos-sum .tot { text-align: left; font-size: 17px; }
.pos-sum .tot b { font-size: 22px; color: var(--blue); }
.pos-acts { display: grid; grid-template-columns: repeat(4, 1fr) 52px; border-top: 1px solid var(--bd); }
.pos-acts button { height: 50px; border: 0; border-left: 1px solid var(--bd); background: #fff; cursor: pointer; font-size: 12.5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text); }
.pos-acts button .ti { font-size: 19px; color: var(--blue); }
.pos-acts button:disabled { opacity: .4; cursor: not-allowed; }
.pos-acts .del { background: var(--danger-soft); }
.pos-acts .del .ti { color: var(--danger); }
.pos-pay { height: 60px; border: 0; background: var(--teal); color: #fff; font-size: 19px; font-weight: 700; cursor: pointer; font-family: inherit; }
.pos-pay:disabled { background: var(--bd2); cursor: not-allowed; }
.pos-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pos-top { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--bd); flex-wrap: wrap; }
.pos-who { display: flex; flex-direction: column; line-height: 1.3; margin-left: 8px; }
.pos-who span { color: var(--text3); font-size: 12px; }
.pos-search { display: flex; gap: 0; min-width: 280px; flex: 0 1 460px; }
.pos-search select { width: 110px; border-radius: 0 var(--r) var(--r) 0; }
.pos-search input { flex: 1; border-radius: var(--r) 0 0 var(--r); border-right: 0; height: 40px; font-size: 15px; }
.pos-cats { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; scrollbar-width: thin; flex: 0 0 auto; }
.pos-cats button { flex: 0 0 auto; height: 40px; padding: 0 16px; border: 1.5px solid var(--c); color: var(--c); background: #fff; border-radius: 999px; cursor: pointer; font-weight: 600; font-family: inherit; }
.pos-cats button.on { background: var(--c); color: #fff; }
.pos-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; padding: 4px 12px 12px; align-content: start; min-height: 0; }
.pos-card { position: relative; display: flex; flex-direction: column; align-items: stretch; background: var(--card); border: 1px solid var(--bd); border-radius: var(--rl); padding: 8px; cursor: pointer; text-align: center; font-family: inherit; box-shadow: var(--shadow-sm); transition: transform .1s, box-shadow .1s; }
.pos-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--blue); }
.pos-card:active { transform: scale(.97); }
.pos-card img, .pos-card .ph { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.pos-card .ph { display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; }
.pos-card .nm { font-size: 13px; font-weight: 600; line-height: 1.35; min-height: 35px; }
.pos-card .pr { color: var(--blue); font-weight: 700; margin-top: 2px; }
.pos-card .stk { position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,.92); border-radius: 999px; padding: 0 7px; font-size: 11px; color: var(--text2); }
.pos-card.out { opacity: .55; }
.pos-card.out .stk { color: var(--danger); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.numpad button { height: 54px; font-size: 22px; border: 1px solid var(--bd2); background: #fff; border-radius: var(--r); cursor: pointer; font-family: inherit; }
.numpad button:active { background: var(--blue-soft); }
.pay-tot { text-align: center; font-size: 18px; margin-bottom: 12px; }
.pay-tot b { font-size: 32px; color: var(--blue); display: block; }
.pay-m { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.pay-m button { height: 64px; border: 1.5px solid var(--bd2); background: #fff; border-radius: var(--r); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-family: inherit; font-weight: 600; }
.pay-m button .ti { font-size: 22px; color: var(--blue); }
.pay-m button:disabled { opacity: .4; cursor: not-allowed; }
.pay-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-row input { height: 44px; font-size: 18px; text-align: center; }
.pay-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.pay-quick button { height: 40px; min-width: 70px; border: 1px solid var(--bd2); background: var(--surface); border-radius: var(--r); cursor: pointer; font-weight: 600; font-family: inherit; }
@media (max-width: 900px) {
  body.full .page { height: auto; }
  .pos { display: flex; flex-direction: column; height: auto; min-height: 100vh; }
  .pos-cart { order: 2; border-left: 0; border-top: 1px solid var(--bd); position: sticky; bottom: 0; box-shadow: 0 -6px 18px rgba(15, 23, 42, .08); }
  .pos-lines { max-height: 32vh; min-height: 60px; }
  .pos-grid { max-height: 56vh; }
  .pos-search { min-width: 0; flex: 1 1 100%; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .pay-m { grid-template-columns: repeat(2, 1fr); }
  .pay-row { grid-template-columns: 110px 1fr auto; }
}

/* ---------- الفاتورة المبسطة (80 مم) ---------- */
.rcpt { font-size: 11.5px; line-height: 1.5; color: #000; background: #fff; margin: 0 auto; }
.rcpt .rc-logo { display: block; max-width: 60%; max-height: 60px; margin: 0 auto 4px; }
.rcpt .rc-c { text-align: center; }
.rcpt .rc-t { text-align: center; font-weight: 700; font-size: 13px; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 3px 0; margin: 6px 0; }
.rcpt table { width: 100%; border-collapse: collapse; }
.rcpt .rc-m td { padding: 1px 0; }
.rcpt .rc-m td:last-child { text-align: left; }
.rcpt .rc-l th { border-bottom: 1px solid #000; font-weight: 700; padding: 3px 1px; text-align: right; }
.rcpt .rc-l td { padding: 3px 1px; vertical-align: top; border-bottom: 1px dotted #999; }
.rcpt .rc-l td.num, .rcpt .rc-l th:not(:first-child) { text-align: left; }
.rcpt .rc-n { font-size: 10px; color: #333; }
.rcpt .rc-tot { margin-top: 6px; }
.rcpt .rc-tot td { padding: 2px 0; }
.rcpt .rc-tot td:last-child { text-align: left; }
.rcpt .rc-big td { font-weight: 700; font-size: 14px; border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 4px 0; }
.rcpt .rc-qr { display: flex; justify-content: center; margin-top: 8px; }
#receipt-print { display: none; }
@media print {
  body.print-receipt > *:not(#receipt-print) { display: none !important; }
  body.print-receipt #receipt-print { display: block; }
  body.print-receipt { background: #fff; }
}