@import url('fonts.css');

/* ==========================================================================
   نظام نقاط البيع — الأنماط
   القسم 22: السرعة قبل الجمال · خط كبير وأزرار كبيرة · لا اعتماد على الفأرة.
   الجمال هنا خادم للسرعة لا منافس لها: تباين واضح، مساحات تتنفّس،
   وأهداف لمس لا تقلّ عن 44 بكسل.
   ========================================================================== */

/* ————————————————— الرموز: الوضع الفاتح ————————————————— */
:root {
  color-scheme: light;

  --bg:          #eef1f5;
  --bg-2:        #e6ebf1;
  --surface:     #ffffff;
  --surface-2:   #f7f9fb;
  --surface-3:   #eff3f7;
  --ink:         #0d1522;
  --ink-2:       #46566b;
  --muted:       #7b8b9e;
  --line:        #e0e6ed;
  --line-2:      #cbd5e0;

  --brand:       #0e6ba8;
  --brand-2:     #0a4f7d;
  --brand-3:     #073a5d;
  --brand-ink:   #ffffff;
  --brand-soft:  #e4eff8;
  --brand-ring:  rgba(14, 107, 168, .28);

  --ok:          #0a8f45;
  --ok-soft:     #e3f6ec;
  --warn:        #a86a12;
  --warn-soft:   #fdf2e0;
  --danger:      #c62f39;
  --danger-soft: #fbe9ea;
  --info:        #2a78d6;
  --info-soft:   #e6f0fc;

  /* لوحة الرسوم — مُتحقَّق منها لعمى الألوان (لا تُغيَّر بلا إعادة فحص) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --chart-surface: #ffffff;
  --chart-grid:    #e8edf2;
  --chart-axis:    #c3ccd6;
  --chart-ink:     #0d1522;
  --chart-ink-2:   #46566b;
  --chart-muted:   #7b8b9e;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(13, 21, 34, .05);
  --sh-2: 0 1px 2px rgba(13, 21, 34, .05), 0 6px 18px -6px rgba(13, 21, 34, .12);
  --sh-3: 0 12px 40px -12px rgba(13, 21, 34, .28);

  --tap: 44px;
  --nav-w: 240px;

  --font: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, -apple-system, Tahoma, sans-serif;
  --mono: 'IBM Plex Sans Arabic', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --fs: 15px;
}

/* ————————————————— الوضع الليلي ————————————————— */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:          #0a0f18;
    --bg-2:        #070b12;
    --surface:     #121a26;
    --surface-2:   #17202e;
    --surface-3:   #1e293a;
    --ink:         #eef3f9;
    --ink-2:       #b3c1d1;
    --muted:       #7e8fa3;
    --line:        #23303f;
    --line-2:      #314155;

    --brand:       #3d9ada;
    --brand-2:     #61b0e6;
    --brand-3:     #8ac6ef;
    --brand-ink:   #04121e;
    --brand-soft:  #12293c;
    --brand-ring:  rgba(61, 154, 218, .32);

    --ok:          #35c07a;
    --ok-soft:     #102b1e;
    --warn:        #e0a63c;
    --warn-soft:   #2c2213;
    --danger:      #f0616c;
    --danger-soft: #2e161a;
    --info:        #5aa2ea;
    --info-soft:   #12233a;

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --chart-surface: #121a26;
    --chart-grid:    #22303f;
    --chart-axis:    #3a4b5f;
    --chart-ink:     #eef3f9;
    --chart-ink-2:   #b3c1d1;
    --chart-muted:   #7e8fa3;

    --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
    --sh-2: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -8px rgba(0, 0, 0, .7);
    --sh-3: 0 16px 48px -16px rgba(0, 0, 0, .85);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f18; --bg-2: #070b12; --surface: #121a26; --surface-2: #17202e; --surface-3: #1e293a;
  --ink: #eef3f9; --ink-2: #b3c1d1; --muted: #7e8fa3; --line: #23303f; --line-2: #314155;
  --brand: #3d9ada; --brand-2: #61b0e6; --brand-3: #8ac6ef; --brand-ink: #04121e;
  --brand-soft: #12293c; --brand-ring: rgba(61,154,218,.32);
  --ok: #35c07a; --ok-soft: #102b1e; --warn: #e0a63c; --warn-soft: #2c2213;
  --danger: #f0616c; --danger-soft: #2e161a; --info: #5aa2ea; --info-soft: #12233a;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --chart-surface: #121a26; --chart-grid: #22303f; --chart-axis: #3a4b5f;
  --chart-ink: #eef3f9; --chart-ink-2: #b3c1d1; --chart-muted: #7e8fa3;
  --sh-1: 0 1px 2px rgba(0,0,0,.5);
  --sh-2: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px -8px rgba(0,0,0,.7);
  --sh-3: 0 16px 48px -16px rgba(0,0,0,.85);
}

/* ————————————————— الأساس ————————————————— */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01';
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.3; font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
hr, .hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* الأرقام دائمًا بعرض ثابت: أعمدة المبالغ يجب أن تصطفّ */
.num, .kpi-value, .pos-total, td.num, th.num, input[type="number"],
.mono, kbd, .u-role { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1, 'ss01'; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-ring); }

/* شريط تمرير رفيع لا يقطع التصميم */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); }
.sm { font-size: .82rem; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
.spacer { flex: 1 1 auto; }
.hint { font-size: .8rem; color: var(--muted); line-height: 1.55; }
.ro { padding: 9px 12px; background: var(--surface-3); border-radius: var(--r-sm); font-weight: 600; }
.req { color: var(--danger); }

/* ————————————————— الهيكل ————————————————— */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.app-nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.nav-logo {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: var(--brand-ink); border-radius: 11px; font-size: 19px;
  box-shadow: var(--sh-1);
}
.nav-shop { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-nav nav { padding: 10px 10px 24px; display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; font-size: .93rem;
  min-height: 40px; position: relative;
  transition: background .13s ease, color .13s ease;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; inset-inline-start: -10px; inset-block: 8px;
  width: 3px; border-radius: var(--r-pill); background: var(--brand);
}
.nav-ico { font-size: 1.02rem; width: 22px; text-align: center; flex: 0 0 22px; }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.app-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; min-height: 60px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.head-title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.nav-toggle { display: none; }

.user-chip { display: flex; flex-direction: column; line-height: 1.25; text-align: start; }
.u-name { font-weight: 600; font-size: .9rem; }
.u-role { font-size: .74rem; color: var(--muted); }

.app-body { padding: 20px; max-width: 1500px; width: 100%; margin: 0 auto; flex: 1 1 auto; }

@media (max-width: 900px) {
  /* القائمة المنزلقة تقف خارج الشاشة بالإزاحة، وبلا هذا القصّ تصنع
     شريط تمرير أفقيًا على الجوّال — وهو أسوأ عيب في واجهة كاشير باليد */
  html, body { overflow-x: clip; }
  .app-shell { overflow-x: clip; }
  .app-nav {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60;
    transform: translateX(100%); transition: transform .2s ease; box-shadow: var(--sh-3);
    visibility: hidden;
  }
  html[dir="ltr"] .app-nav { transform: translateX(-100%); }
  body.nav-open .app-nav { transform: none; visibility: visible; }
  .nav-toggle { display: inline-flex; }
  .app-body { padding: 14px; }
  .app-head { padding: 8px 12px; gap: 7px; }
  .app-head .chip { white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .app-head .user-chip { display: none; }
  .head-title { font-size: .98rem; }
  .pos-right { padding: 14px; }
  .pos-scan input[type="text"] { min-height: 50px; font-size: 1rem; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
  .kpi-value { font-size: 1.22rem; }
  .page-head h1 { font-size: 1.25rem; }
}

/* ————————————————— البطاقات ————————————————— */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--sh-1);
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -2px 0 12px;
}
.card-head h3 { margin: 0; }
.card-actions { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(370px, 1fr)); align-items: start; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); align-items: start; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }

/* ————————————————— الأزرار ————————————————— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 0 16px;
  font: inherit; font-weight: 600; font-size: .92rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .13s ease, border-color .13s ease, transform .08s ease, box-shadow .13s ease;
  box-shadow: var(--sh-1);
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  border-color: var(--brand-2); color: var(--brand-ink);
  box-shadow: 0 1px 2px var(--brand-ring), var(--sh-1);
}
.btn.primary:hover { background: linear-gradient(180deg, var(--brand-2), var(--brand-3)); }

.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); background: var(--danger); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(.94); background: var(--ok); }

.btn.ghost { background: transparent; border-color: var(--line); box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.ghost.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 34%, transparent); }
.btn.ghost.danger:hover { background: var(--danger-soft); }

.btn.big { min-height: 54px; font-size: 1.05rem; padding: 0 26px; width: 100%; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: .82rem; border-radius: 7px; }

.inline-form { display: inline-flex; gap: 5px; align-items: center; margin: 0; }

/* ————————————————— الحقول ————————————————— */
input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 0 12px;
  min-height: var(--tap);
  width: 100%;
  transition: border-color .13s ease, box-shadow .13s ease, background .13s ease;
}
textarea { padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.6; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
input[type="checkbox"], input[type="radio"] {
  width: 19px; height: 19px; min-height: 0; accent-color: var(--brand);
  margin: 0; flex: 0 0 auto; cursor: pointer;
}
input[type="file"] { padding: 9px 12px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); opacity: .7; cursor: not-allowed; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(12px) calc(50% + 1px), calc(17px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-start: 30px;
}
select[multiple] { background-image: none; padding: 8px; min-height: 140px; }
.mini { min-height: 34px; padding: 0 8px; font-size: .87rem; width: auto; min-width: 74px; }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid .full, .form-row.full { grid-column: 1 / -1; }
.form-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row > label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.form-row.check { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-row.check > label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); cursor: pointer; }
.form-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: .9rem; }
.stack { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.stack > label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 16px;
  box-shadow: var(--sh-1);
}
.filters .fld { display: flex; flex-direction: column; gap: 5px; }
.filters label { font-size: .77rem; color: var(--muted); font-weight: 600; }
.filters input, .filters select { min-width: 145px; width: auto; }

/* ————————————————— الجداول ————————————————— */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface);
  box-shadow: var(--sh-1); margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: .91rem; }
thead th {
  text-align: start; font-weight: 600; font-size: .8rem;
  color: var(--muted); letter-spacing: .01em;
  background: var(--surface-2);
  padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s ease; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: end; }
tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line); }
.empty-cell { text-align: center; color: var(--muted); padding: 34px 12px !important; }

tr.row-void td { opacity: .5; text-decoration: line-through; }
tr.row-danger td { background: var(--danger-soft); }
tr.row-warn   td { background: var(--warn-soft); }
tr.row-ok     td { background: var(--ok-soft); }
tr.row-danger:hover td, tr.row-warn:hover td, tr.row-ok:hover td { filter: brightness(.98); }

/* ————————————————— بطاقات الأرقام ————————————————— */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 15px;
  box-shadow: var(--sh-1); position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; inset-block-start: 0; inset-inline: 0;
  height: 3px; background: var(--line);
}
.kpi.ok::before     { background: var(--ok); }
.kpi.warn::before   { background: var(--warn); }
.kpi.danger::before { background: var(--danger); }
.kpi-label { font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.kpi-value { font-size: 1.42rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.kpi-sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }

.kv { display: grid; gap: 1px; background: var(--line); border-radius: var(--r-sm); overflow: hidden; }
.kv > div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 13px; background: var(--surface); }
.kv span { color: var(--muted); font-size: .87rem; }
.kv b { font-weight: 600; text-align: end; }

.row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.row.grand { border-top: 1px solid var(--line); margin-top: 7px; padding-top: 10px; font-size: 1.05rem; }

/* ————————————————— الشارات والرقائق ————————————————— */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: var(--r-pill);
  font-size: .78rem; font-weight: 600; line-height: 1.75;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid transparent;
}
.badge.ok, .chip.ok         { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .chip.warn     { background: var(--warn-soft); color: var(--warn); }
.badge.danger, .chip.danger { background: var(--danger-soft); color: var(--danger); }
.badge.err, .chip.err       { background: var(--danger-soft); color: var(--danger); }
.chip { min-height: 32px; text-decoration: none; }
.chip:hover { text-decoration: none; filter: brightness(.96); }

kbd {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line-2);
  border-block-end-width: 2px; font-size: .82rem; font-weight: 600;
}

/* ————————————————— التنبيهات ————————————————— */
.alert {
  padding: 12px 15px; border-radius: var(--r); margin-bottom: 15px;
  border: 1px solid transparent; font-weight: 500;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.alert.ok   { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.alert.err  { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 26%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.alert b { font-weight: 700; }
.alert .btn { margin-inline-start: auto; }

.flashes {
  position: fixed; inset-block-start: 14px; inset-inline: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.flash {
  pointer-events: auto; max-width: min(560px, 92vw);
  padding: 12px 18px; border-radius: var(--r); box-shadow: var(--sh-3);
  font-weight: 600; border: 1px solid transparent;
  animation: flash-in .22s cubic-bezier(.2, .9, .3, 1.2);
}
.flash.ok   { background: var(--ok-soft);     color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash.err  { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash.warn { background: var(--warn-soft);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
@keyframes flash-in { from { transform: translateY(-10px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-ico { font-size: 2.6rem; margin-bottom: 8px; opacity: .8; }
.empty h3 { color: var(--ink-2); }

.danger-zone { border-color: color-mix(in srgb, var(--danger) 32%, var(--line)); }
.danger-zone .card-head h3 { color: var(--danger); }

/* ————————————————— التبويبات ————————————————— */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 5px; box-shadow: var(--sh-1);
}
.tab {
  padding: 8px 15px; border-radius: var(--r-sm); font-weight: 600; font-size: .89rem;
  color: var(--ink-2); min-height: 38px; display: inline-flex; align-items: center;
  transition: background .13s ease, color .13s ease;
}
.tab:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.tab.active { background: var(--brand); color: var(--brand-ink); }
.tab.active:hover { background: var(--brand-2); }

/* ————————————————— الترقيم ————————————————— */
.pager { display: flex; gap: 5px; justify-content: center; align-items: center; margin: 18px 0; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: .88rem;
}
.pager a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.pager .cur { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pager .gap { border: 0; background: none; color: var(--muted); min-width: 26px; }

/* ————————————————— شاشة الدخول ————————————————— */
.login-body {
  background:
    radial-gradient(1100px 620px at 82% -12%, var(--brand-soft), transparent 62%),
    radial-gradient(900px 520px at 8% 108%, var(--surface-3), transparent 60%),
    var(--bg);
  min-height: 100vh; min-height: 100dvh;
}
.login-wrap { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 22px; }
.login-card {
  width: min(420px, 100%);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 34px 30px;
  box-shadow: var(--sh-3);
  display: flex; flex-direction: column; gap: 9px; text-align: center;
}
.login-card h1 { margin: 0; font-size: 1.42rem; }
.login-card > label { text-align: start; font-size: .84rem; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.login-card .btn { margin-top: 18px; }
.login-card .alert { text-align: start; }
.login-logo {
  width: 66px; height: 66px; margin: 0 auto 6px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  border-radius: 20px; font-size: 32px; color: var(--brand-ink);
  box-shadow: 0 8px 26px -8px var(--brand-ring);
}

/* ————————————————— شاشة الكاشير ————————————————— */
/* ثلاث مناطق: حقل المسح، قائمة الأصناف، لوحة الإجمالي والدفع.
   على الجوّال يصعد الإجمالي فوق القائمة: الكاشير يحتاج الرقم والزرّ في
   يده لا بعد تمرير عشرة أصناف. */
.pos-wrap {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 392px;
  grid-template-areas: "scan side" "list side";
}
.pos-scan  { grid-area: scan; }
.pos-left  { grid-area: list; padding: 14px; }
.pos-right { grid-area: side; position: sticky; top: 76px; padding: 16px; }

@media (max-width: 1080px) {
  .pos-wrap { grid-template-columns: 1fr; grid-template-areas: "scan" "side" "list"; }
  .pos-right { position: static; }
}

.pos-scan { display: flex; gap: 9px; padding: 12px 14px; margin-bottom: 0; align-items: center; }
.pos-scan input[type="text"] {
  flex: 1 1 auto; font-size: 1.1rem; font-weight: 600; min-height: 54px;
  background: var(--surface-2); border-width: 2px;
}
.pos-scan input[type="number"] { flex: 0 0 92px; width: 92px; }
.pos-scan input[type="text"]:focus { background: var(--surface); }
.pos-scan .btn { flex: 0 0 auto; min-height: 54px; }

/* أعمدة سلّة الكاشير مضبوطة صراحةً: بلا ذلك يبتلع حقلا الكمية والسعر
   العرض كلّه ويُلفّ اسم الصنف كلمةً في كل سطر، وهو أسوأ ما يمكن أن يراه
   كاشير مستعجل. */
.cart-table { table-layout: fixed; width: 100%; }
.cart-table td, .cart-table th { padding: 7px 8px; }
.cart-table col.c-no    { width: 34px; }
.cart-table col.c-name  { width: auto; }
.cart-table col.c-qty   { width: 88px; }
.cart-table col.c-price { width: 96px; }
.cart-table col.c-disc  { width: 152px; }
.cart-table col.c-net   { width: 104px; }
.cart-table col.c-del   { width: 44px; }
.cart-table td:nth-child(2) { white-space: normal; word-break: break-word; }
.cart-table .inline-form { gap: 3px; flex-wrap: nowrap; }
.cart-table .mini { width: 100%; min-width: 0; padding: 0 6px; }
.cart-table select.mini { padding-inline-start: 20px; padding-inline-end: 4px;
  background-position: 7px calc(50% + 1px), 12px calc(50% + 1px); }
.cart-table .inline-form input.mini { flex: 1 1 66px; }
.cart-table .inline-form select.mini { flex: 0 0 62px; }
/* على الجوّال يصير كل سطر بطاقة مستقلّة: جدول بسبعة أعمدة على شاشة 390
   بكسل يضغط اسم الصنف حتى يصير حرفًا في كل سطر، وهو غير قابل للاستعمال. */
@media (max-width: 700px) {
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: auto; }
  .cart-table { table-layout: auto; }
  .cart-table colgroup, .cart-table thead { display: none; }
  .cart-table tbody tr {
    border: 1px solid var(--line); border-radius: var(--r);
    padding: 10px 12px; margin: 0 0 8px; background: var(--surface); position: relative;
  }
  .cart-table tbody tr:hover td { background: transparent; }
  .cart-table td { border: 0 !important; padding: 4px 0 !important;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: start; }
  .cart-table td::before {
    content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; flex: 0 0 auto;
  }
  .cart-table td.c-idx { display: none; }
  .cart-table td.c-nm { padding-bottom: 8px !important; font-size: 1rem; display: block;
    padding-inline-end: 42px !important; }
  .cart-table td.c-nm::before { content: none; }
  /* زرّ الحذف في الطرف المقابل لاتجاه القراءة حتى لا يجلس فوق اسم الصنف */
  .cart-table td.c-del { position: absolute; inset-block-start: 8px; inset-inline-end: 10px; padding: 0 !important; }
  .cart-table td.c-del::before { content: none; }
  .cart-table .inline-form { width: auto; }
  .cart-table .mini { width: auto; min-width: 78px; }
  .cart-table .inline-form input.mini { flex: 0 0 78px; }
  .cart-table .inline-form select.mini { flex: 0 0 66px; }
  .cart-table .empty-cell { display: block; }
  /* زرّ الدفعة يلتفّ سطرًا بنصف عرض فيبدو مقطوعًا — نجعله سطرًا كاملاً */
  .pay-grid > .btn { flex: 1 1 100%; }
  .quick-cash .btn { flex: 1 1 70px; }
}

.pos-totals { display: flex; flex-direction: column; gap: 1px; margin-bottom: 14px; }
.pos-totals .row { font-size: .93rem; }
.pos-totals .row span:first-child { color: var(--muted); }
.pos-total { font-size: 2.05rem; font-weight: 700; letter-spacing: -.03em; color: var(--brand); line-height: 1.15; }

.pay-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.pay-row {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 11px; font-size: .89rem;
}
.pay-row .num { margin-inline-start: auto; font-weight: 700; }

.pay-form { margin-bottom: 12px; }
.pay-grid { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 9px; }
.pay-grid > input, .pay-grid > select { flex: 1 1 130px; width: auto; min-width: 0; }
.pay-grid > .btn { flex: 0 0 auto; }

.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-cash .btn { flex: 1 1 62px; min-height: 40px; padding: 0 8px; }

.commit-form { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }

.pos-more { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; background: var(--surface-2); }
.pos-more > summary {
  padding: 11px 14px; cursor: pointer; font-weight: 600; font-size: .9rem;
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px;
}
.pos-more > summary::before { content: '▸'; transition: transform .15s ease; color: var(--muted); }
.pos-more[open] > summary::before { transform: rotate(-90deg); }
.pos-more > summary::-webkit-details-marker { display: none; }
.pos-more > *:not(summary) { padding-inline: 14px; }
.pos-more > *:last-child { padding-bottom: 12px; }

.pos-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pos-actions > * { flex: 1 1 108px; }
.pos-actions .btn { width: 100%; }

.held-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .87rem; }
.held-row:last-child { border-bottom: 0; }
.held-row > span:first-child { flex: 1 1 auto; }

.match-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
  background: var(--warn-soft); border-radius: var(--r); padding: 11px 13px; }
.match-list .btn { justify-content: space-between; width: 100%; }

.promo-box { background: var(--ok-soft); border-radius: var(--r-sm); padding: 10px 13px; margin-bottom: 12px; color: var(--ok); }
.done-bar { position: sticky; top: 66px; z-index: 15; }

.denoms { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); margin-bottom: 14px; }
.denom { display: flex; align-items: center; gap: 7px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 5px 10px; }
.denom > span { font-weight: 700; color: var(--muted); min-width: 34px; font-variant-numeric: tabular-nums; }
.denom input { min-height: 34px; }

/* ————————————————— الصلاحيات ————————————————— */
.perm-group { border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 9px; background: var(--surface-2); }
.perm-group > summary { padding: 11px 14px; cursor: pointer; font-weight: 600; min-height: 44px;
  display: flex; align-items: center; }
.perm-grid { display: grid; gap: 7px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); padding: 4px 14px 14px; }
.perm-row { display: flex; align-items: center; gap: 11px; font-size: .87rem;
  padding: 5px 0; border-bottom: 1px solid var(--line); }
.perm-row > span:first-child { flex: 1 1 auto; }

.days-pick { display: flex; gap: 12px; flex-wrap: wrap; }

/* ————————————————— الرسوم ————————————————— */
.chart { display: block; width: 100%; height: auto; direction: ltr; }
/* الحلقة مربّعة: بلا حدّ أقصى تتمدّد بعرض البطاقة فتبتلع الشاشة */
.chart-donut { max-width: 268px; margin-inline: auto; }
.chart-spark { max-width: 130px; }
.chart-empty { text-align: center; padding: 42px 16px; color: var(--muted); font-size: .9rem; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 10px; font-size: .8rem; color: var(--ink-2); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ————————————————— محتوى نصّي ————————————————— */
.steps { padding-inline-start: 20px; margin: 0; }
.steps li { margin-bottom: 9px; }
.faq dt { font-weight: 700; margin-top: 13px; color: var(--ink); }
.faq dd { margin: 3px 0 0; color: var(--ink-2); padding-inline-start: 12px;
  border-inline-start: 2px solid var(--line); }

.notif { border-inline-start: 3px solid var(--line); }
.notif.read { opacity: .62; }

/* ————————————————— الطباعة ————————————————— */
@media print {
  .no-print, .app-nav, .app-head, .filters, .pager, .form-actions, .flashes, .tabs { display: none !important; }
  .app-shell, .app-main { display: block; }
  .app-body { padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 12px; }
  .card, .table-wrap, .kpi { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  thead th { background: #f2f2f2 !important; position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
