/* =====================================================================
   NaziSystem — نظام المظاهر
   كل الالوان والقياسات متغيرات؛ كل مظهر يغيّر المتغيرات فقط.
   المظاهر: stone (الافتراضي) — ledger — navy — night
   ===================================================================== */

/* ---------- الخطوط (محلية، بدون انترنت) ---------- */
@font-face { font-family: "Ava Sans"; font-weight: 400; font-display: swap; src: url(/fonts/plex-arabic-400.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: "Ava Sans"; font-weight: 500; font-display: swap; src: url(/fonts/plex-arabic-500.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: "Ava Sans"; font-weight: 600; font-display: swap; src: url(/fonts/plex-arabic-600.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: "Ava Sans"; font-weight: 700; font-display: swap; src: url(/fonts/plex-arabic-700.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: "Ava Sans"; font-weight: 400; font-display: swap; src: url(/fonts/plex-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Ava Sans"; font-weight: 500; font-display: swap; src: url(/fonts/plex-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Ava Sans"; font-weight: 600; font-display: swap; src: url(/fonts/plex-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Ava Sans"; font-weight: 700; font-display: swap; src: url(/fonts/plex-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Ava Kufi"; font-weight: 600; font-display: swap; src: url(/fonts/kufi-arabic-600.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Ava Kufi"; font-weight: 700; font-display: swap; src: url(/fonts/kufi-arabic-700.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Ava Sans"; font-weight: 400; font-display: swap; src: url(/fonts/plex-latinext-400.woff2) format("woff2"); unicode-range: U+0100-0130, U+0132-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0; }
@font-face { font-family: "Ava Sans"; font-weight: 500; font-display: swap; src: url(/fonts/plex-latinext-500.woff2) format("woff2"); unicode-range: U+0100-0130, U+0132-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0; }
@font-face { font-family: "Ava Sans"; font-weight: 600; font-display: swap; src: url(/fonts/plex-latinext-600.woff2) format("woff2"); unicode-range: U+0100-0130, U+0132-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0; }
@font-face { font-family: "Ava Sans"; font-weight: 700; font-display: swap; src: url(/fonts/plex-latinext-700.woff2) format("woff2"); unicode-range: U+0100-0130, U+0132-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0; }
@font-face { font-family: "Ava Kufi"; font-weight: 600; font-display: swap; src: url(/fonts/kufi-latinext-600.woff2) format("woff2"); unicode-range: U+0100-0130, U+0132-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0; }
@font-face { font-family: "Ava Kufi"; font-weight: 700; font-display: swap; src: url(/fonts/kufi-latinext-700.woff2) format("woff2"); unicode-range: U+0100-0130, U+0132-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0; }
@font-face { font-family: "Ava Kufi"; font-weight: 600; font-display: swap; src: url(/fonts/kufi-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Ava Kufi"; font-weight: 700; font-display: swap; src: url(/fonts/kufi-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }

/* ---------- المظهر الافتراضي: حجر (Stone) ---------- */
:root {
  --bg: #ECEEEA;
  --panel: #FFFFFF;
  --panel-2: #F5F6F3;          /* رؤوس الجداول والتذييل */
  --ink: #1F2A2E;
  --ink-2: #3A4649;
  --muted: #69736F;
  --line: #DCE0D8;
  --line-2: #C3C9BF;           /* حدود الحقول */
  --field: #FFFFFF;
  --field-ro: #FFFFFF;          /* الحقول المحسوبة = نفس الحقول العادية */
  --brand: #0E6E6A;
  --brand-2: #128680;
  --brand-ink: #FFFFFF;
  --brand-soft: #E1EFEC;
  --accent: #0E6E6A;
  --side: #2F393B;
  --side-2: #3A4547;
  --side-ink: #D3DAD7;
  --side-mute: #93A09C;
  --side-on: rgba(79, 179, 172, .22);
  --side-bar: #4FB3AC;
  --ok: #1E7D4F;
  --ok-soft: #E3F2EA;
  --warn: #9A6514;
  --warn-soft: #FBF1DF;
  --bad: #B3261E;
  --bad-soft: #FBE9E7;
  --focus: rgba(18, 134, 128, .22);
  --hover: #F2F4F0;
  --sel: #E6F1EF;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow: 0 1px 0 rgba(20, 30, 28, .04);
  --shadow-pop: 0 12px 32px rgba(20, 30, 28, .18);
  --login-bg: #1C2324;
  --rule: double 3px var(--ink-2);
  --font: "Ava Sans", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-title: "Ava Kufi", "Ava Sans", "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  color-scheme: light;
}

/* ---------- دفتر (Ledger): اخضر محاسبي، السالب احمر ---------- */
[data-theme="ledger"] {
  --bg: #EEF0EA; --panel: #FFFFFF; --panel-2: #F4F6F0; --ink: #1B2A21; --ink-2: #2F4436; --muted: #66756B;
  --line: #D7DED3; --line-2: #BCC7B8;
  --brand: #2F6B45; --brand-2: #3A8256; --brand-soft: #E3EFE6; --accent: #2F6B45;
  --side: #215640; --side-2: #2A6449; --side-ink: #DCEADF; --side-mute: #9FC1AA; --side-on: rgba(255, 255, 255, .10); --side-bar: #9FD3AE;
  --bad: #A4262C; --bad-soft: #FAE8E8; --focus: rgba(47, 107, 69, .22); --hover: #F1F5EF; --sel: #E5F0E7;
  --login-bg: #133524;
}
/* ---------- كحلي ونحاسي (Navy & Brass) ---------- */
[data-theme="navy"] {
  --bg: #EDEFF3; --panel: #FFFFFF; --panel-2: #F4F5F8; --ink: #18213A; --ink-2: #2D3856; --muted: #67708A;
  --line: #DADEE7; --line-2: #BEC4D2;
  --brand: #1E3A6B; --brand-2: #284C88; --brand-soft: #E4E9F3; --accent: #A87B2D;
  --side: #213560; --side-2: #2A416F; --side-ink: #D6DDEB; --side-mute: #97A5C2; --side-on: rgba(168, 123, 45, .18); --side-bar: #C99A4B;
  --focus: rgba(40, 76, 136, .22); --hover: #F2F4F8; --sel: #E7ECF5;
  --login-bg: #111C33;
}
/* ---------- ليلي (Night) ---------- */
[data-theme="night"] {
  --bg: #13181F; --panel: #1B222B; --panel-2: #212A35; --ink: #E3E8EE; --ink-2: #BAC4CF; --muted: #8E9AA8;
  --line: #2C3643; --line-2: #3A4656; --field: #151B23; --field-ro: #151B23;
  --brand: #3D86C6; --brand-2: #5FA8E6; --brand-ink: #FFFFFF; --brand-soft: #1E3045; --accent: #5FA8E6;
  --side: #1A222C; --side-2: #232D39; --side-ink: #C8D1DB; --side-mute: #7D8A99; --side-on: rgba(95, 168, 230, .14); --side-bar: #5FA8E6;
  --ok: #4CC38A; --ok-soft: #173326; --warn: #E0A84A; --warn-soft: #33281A; --bad: #F07167; --bad-soft: #3A1E1E;
  --focus: rgba(95, 168, 230, .28); --hover: #222B36; --sel: #1F3247;
  --shadow: none; --shadow-pop: 0 14px 36px rgba(0, 0, 0, .5);
  --login-bg: #0B0F14;
  color-scheme: dark;
}
[data-size="lg"] { font-size: 15.5px; }
[data-size="sm"] { font-size: 13px; }

/* ---------- الاساسيات ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 700; letter-spacing: 0; }
.num, td.num, th.num { text-align: left; direction: ltr; font-variant-numeric: tabular-nums lining-nums; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
::selection { background: var(--sel); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- تسجيل الدخول ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background-color: var(--login-bg);
  /* سطور دفتر الحسابات */
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 32px);
}
.login-card { width: 380px; max-width: 100%; background: var(--panel); border-radius: var(--radius-lg); padding: 34px 30px 28px; box-shadow: 0 24px 60px rgba(0,0,0,.35); border-top: 4px solid var(--brand); }
.login-card h1 { margin: 0; font-size: 26px; color: var(--ink); }
.login-card p { margin: 2px 0 24px; color: var(--muted); }
.login-card .logo { width: 52px; height: 52px; border-radius: 46% 54% 50% 50% / 55% 48% 52% 45%; background: radial-gradient(circle at 34% 30%, #fff, #e3e6e1 55%, #b7beb5); box-shadow: inset -4px -6px 10px rgba(0,0,0,.14), 0 4px 10px rgba(0,0,0,.18); margin-bottom: 16px; }
.login-card input { padding: 10px 12px; }
.login-card .btn.p { padding: 11px; font-weight: 600; }

/* ---------- الهيكل ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 0 0 18px; overflow-y: auto; height: 100vh; position: sticky; top: 0; scrollbar-width: thin; scrollbar-color: var(--side-2) transparent; }
.side .brand { padding: 18px 18px 16px; font-family: var(--font-title); font-weight: 700; font-size: 19px; line-height: 1.35; color: #fff; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--side-2); margin-bottom: 6px; }
.side .brand .dot { flex: none; width: 30px; height: 30px; border-radius: 46% 54% 50% 50% / 55% 48% 52% 45%; background: radial-gradient(circle at 34% 30%, #fff, #dfe3dd 58%, #a9b1a7); box-shadow: inset -2px -3px 5px rgba(0,0,0,.18); }
.side .grp { margin-top: 2px; padding: 2px 0; }
.side .grp + .grp { border-top: 1px solid color-mix(in srgb, var(--side-2) 70%, transparent); }
/* عناوين المجموعات: خط كوفي عريض وواضح */
.side .grp > .gt { padding: 11px 16px 11px 14px; font-family: var(--font-title); font-size: 15.5px; font-weight: 700; color: #fff; cursor: pointer; display: flex; align-items: center; gap: 11px; user-select: none; letter-spacing: 0; }
.side .grp > .gt:hover { background: rgba(255,255,255,.04); }
.side .grp > .gt .ic { width: 21px; height: 21px; flex: none; stroke: var(--side-bar); }
.side .grp > .gt .chev { margin-inline-start: auto; color: var(--side-mute); font-size: 12px; transition: transform .15s; }
.side .grp.closed > .gt .chev { transform: rotate(90deg); }
.side .grp.closed .links { display: none; }
.side .links { padding-bottom: 6px; }
.side a { display: block; padding: 7px 16px 7px 12px; margin: 1px 10px; padding-inline-start: 40px; color: var(--side-ink); border-radius: 6px; font-size: 14.5px; font-weight: 500; position: relative; }
.side a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.on { background: var(--side-on); color: #fff; font-weight: 700; }
.side a.on::before { content: ''; position: absolute; inset-inline-start: 20px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--side-bar); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 22px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; min-height: 58px; }
.top .title { font-family: var(--font-title); font-weight: 700; font-size: 18px; flex: 1; color: var(--ink); }
.top .who { color: var(--muted); font-size: 12.5px; }
.top .rate { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.top .menu-btn, .top .more-btn { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions .who-m { display: none; }
.content { padding: 20px 22px 48px; max-width: 1500px; width: 100%; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 264px; z-index: 30; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow-pop); }
  .side.open { transform: none; }
  .top .menu-btn { display: inline-flex; }
  .top { padding: 8px 12px; flex-wrap: wrap; }
  .top .who { display: none; }
  .content { padding: 14px 12px 40px; }
}

/* ---------- البطاقات ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 15px; color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > .f { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.row > .f.grow { flex: 1; min-width: 200px; }
.row > .f.sm { min-width: 90px; width: 110px; }
label.l { font-size: 12px; font-weight: 500; color: var(--muted); }

/* ---------- الحقول: كل الحقول (بما فيها المحسوبة للقراءة فقط) بنفس الشكل ---------- */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 7px 10px; background: var(--field); outline: none; width: 100%;
  min-height: 36px; transition: border-color .12s, box-shadow .12s;
}
input:hover:not([readonly]):not(:disabled), select:hover:not(:disabled), textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--focus); }
input[readonly] { background: var(--field-ro); cursor: default; }
input[readonly]:focus { box-shadow: none; border-color: var(--line-2); }
input:disabled, select:disabled, textarea:disabled { opacity: .75; background: var(--panel-2); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; vertical-align: -3px; }
input.num { font-variant-numeric: tabular-nums lining-nums; }
select { appearance: none; -webkit-appearance: none; padding-inline-start: 10px; padding-inline-end: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238A948F' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: left 10px center; background-size: 12px 12px; background-repeat: no-repeat; }

/* ---------- الازرار ---------- */
.btn { border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--radius); padding: 7px 14px; min-height: 36px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: var(--muted); }
.btn.p { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.p:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(1.08); }
.btn.bad, .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line-2)); }
.btn.bad:hover, .btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 3px 10px; min-height: 28px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .sp { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag, .pill { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; background: var(--brand-soft); color: var(--ink-2); font-weight: 500; }
.tag.void { background: var(--bad-soft); color: var(--bad); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---------- الجداول ---------- */
.tbl-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
table.t th { background: var(--panel-2); position: sticky; top: 0; font-weight: 600; font-size: 12.5px; color: var(--ink-2); z-index: 1; border-bottom-color: var(--line-2); }
table.t tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 45%, transparent); }
table.t tbody tr:hover td { background: var(--hover); }
table.t tr.click { cursor: pointer; }
table.t tfoot td { background: var(--panel-2); font-weight: 700; position: sticky; bottom: 0; border-top: var(--rule); border-bottom: 0; }
table.t tr.void td { color: var(--muted); text-decoration: line-through; opacity: .7; }
table.t td.num.neg, table.t td .neg { color: var(--bad); }
[data-theme="ledger"] table.t td.num { font-weight: 500; }
table.lines td { padding: 4px 6px; }
table.lines input { padding: 5px 8px; min-height: 32px; }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* ---------- المؤشرات ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px 12px; box-shadow: var(--shadow); border-inline-start: 3px solid var(--accent); }
.kpi .k { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .v { font-size: 23px; font-weight: 700; margin-top: 4px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; direction: ltr; border-bottom: 1px solid var(--line-2); }
.bars .b { flex: 1; background: var(--brand-2); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; opacity: .85; }
.bars .b:hover { background: var(--brand); opacity: 1; }
.bars .b:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 2px 7px; border-radius: 4px; font-size: 11px; white-space: nowrap; margin-bottom: 4px; }

/* ---------- البحث المنسدل ---------- */
.combo { position: relative; }
.combo .dd { position: absolute; top: calc(100% + 3px); inset-inline: 0; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); max-height: 300px; overflow: auto; z-index: 20; box-shadow: var(--shadow-pop); }
.combo .dd div { padding: 7px 11px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.combo .dd div:last-child { border-bottom: 0; }
.combo .dd div.hl, .combo .dd div:hover { background: var(--sel); }
.combo .dd small { color: var(--muted); font-variant-numeric: tabular-nums; }
/* اسم مكتوب ولم يُختر من القائمة */
.combo.invalid input { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.combo.invalid::after { content: 'اختر الاسم من القائمة'; position: absolute; top: 100%; inset-inline-start: 2px; font-size: 11.5px; color: var(--bad); margin-top: 2px; }
/* كومبوبوكس بجدول (ت / الاسم / المدينة) */
.combo.has-arrow input { padding-inline-end: 34px; }
.combo-arrow { position: absolute; inset-inline-end: 1px; top: 1px; bottom: 1px; width: 32px; border: 0; border-inline-start: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; }
[dir=rtl] .combo-arrow { border-radius: var(--radius) 0 0 var(--radius); }
.combo-arrow:hover { background: var(--hover); color: var(--ink); }
.combo .dd.grid { max-height: 340px; min-width: 320px; padding: 0; }
.combo .dd.grid .dd-head, .combo .dd.grid .dd-row { display: grid; gap: 10px; padding: 7px 11px; align-items: center; }
.combo .dd.grid .dd-head { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: var(--ink-2); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line-2); cursor: default; }
.combo .dd.grid .dd-row { border-bottom: 1px solid var(--line); cursor: pointer; }
.combo .dd.grid .dd-row:nth-child(odd) { background: color-mix(in srgb, var(--panel-2) 50%, transparent); }
.combo .dd.grid .dd-row.hl, .combo .dd.grid .dd-row:hover { background: var(--sel); }
.combo .dd.grid .dd-head:hover { background: var(--panel-2); }
.combo .dd.grid .dd-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo .dd.grid .num { color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; direction: ltr; }

/* ---------- النوافذ ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 18, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); width: 640px; max-width: calc(100vw - 32px); max-height: 92vh; overflow: auto; box-shadow: var(--shadow-pop); }
.modal.wide { width: 980px; }
.modal .mh { padding: 15px 20px; border-bottom: 1px solid var(--line); font-family: var(--font-title); font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal .mb { padding: 18px 20px; }
.modal .mf { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-start; background: var(--panel-2); position: sticky; bottom: 0; z-index: 3; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.grid2 .f, .grid3 .f { display: flex; flex-direction: column; gap: 5px; }
.perm-grid { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px 16px; align-items: center; }
.perm-grid .h { font-weight: 600; color: var(--muted); font-size: 12px; }

/* ---------- الاشعارات ---------- */
#toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-pop); max-width: 440px; border-inline-start: 4px solid var(--brand-2); }
.toast.err { background: var(--bad); color: #fff; border-inline-start-color: rgba(0,0,0,.25); }
.toast.ok { background: var(--ok); color: #fff; border-inline-start-color: rgba(0,0,0,.2); }
.toast.warn { background: var(--warn); color: #fff; border-inline-start-color: rgba(0,0,0,.2); }

/* ---------- محرر الفاتورة ---------- */
/* المجموع / الصافي / المتبقي بنفس شكل وحجم حقل الكمية تماماً */
.doc-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; padding-top: 14px; border-top: var(--rule); }
.doc-totals .f { display: flex; flex-direction: column; gap: 5px; }
.doc-totals input { text-align: left; direction: ltr; font-variant-numeric: tabular-nums lining-nums; }
.doc-totals .big input { font-weight: 700; }
.scan { font-size: 15px; padding: 9px 12px !important; min-height: 42px !important; border-color: var(--brand-2) !important; }

/* ---------- الباركودات الفرعية ---------- */
.subcodes { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-2); padding: 14px; }
.subcodes-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.subcodes-head h4 { margin: 0 0 4px; font-size: 14px; }
.subcodes-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.subcodes-add input.scan { flex: 1; min-width: 220px; }
.subcodes-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.subcodes-table th { background: var(--panel-2); text-align: start; font-size: 12.5px; color: var(--ink-2); padding: 7px 8px; border-bottom: 1px solid var(--line-2); }
.subcodes-table td { border-bottom: 1px solid var(--line); }
.subcodes-table input { direction: ltr; text-align: left; }

/* ---------- اختيار المظهر ---------- */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.theme-card { border: 2px solid var(--line); border-radius: var(--radius-lg); padding: 0; background: var(--panel); cursor: pointer; text-align: start; overflow: hidden; }
.theme-card:hover { border-color: var(--muted); }
.theme-card.on { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--focus); }
.theme-card .sw { display: grid; grid-template-columns: 34% 1fr; height: 84px; }
.theme-card .sw .s1 { display: flex; flex-direction: column; gap: 5px; padding: 10px 8px; }
.theme-card .sw .s1 i { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); }
.theme-card .sw .s1 i:nth-child(2) { width: 70%; }
.theme-card .sw .s2 { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.theme-card .sw .s2 b { display: block; height: 22px; border-radius: 4px; border: 1px solid rgba(0,0,0,.08); }
.theme-card .sw .s2 em { display: block; width: 46%; height: 9px; border-radius: 3px; }
.theme-card .nm { display: block; padding: 8px 12px 10px; font-weight: 600; color: var(--ink); }
.theme-card .ds { display: block; padding: 0 12px 10px; font-size: 12px; color: var(--muted); }

/* ---------- شريط التحديث ---------- */
.upd-bar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); max-width: calc(100vw - 24px); }
.upd-bar .btn { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

/* ---------- حساب معرض ---------- */
.sr-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-inline-start: 4px solid var(--accent); }
.sr-head h2 { margin: 0 0 2px; font-size: 22px; }
.sr-bal { text-align: end; }
.big-num { font-size: 26px; font-weight: 700; direction: ltr; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); margin: 4px 0 14px; }
.tab { border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 8px 14px; border-radius: var(--radius) var(--radius) 0 0; cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: -1px; }
.tab:hover { color: var(--ink); background: var(--hover); }
.tab.on { background: var(--panel); color: var(--ink); border-color: var(--line-2); }

/* ---------- تبويب الشركة / المعارض ---------- */
.scope-tabs { margin: 0 0 16px; }
.scope-tabs .tab { font-size: 15px; padding: 9px 22px; }
.scope-tabs .tab.on.company { box-shadow: inset 0 3px 0 var(--brand); }
.scope-tabs .tab.on.showroom { box-shadow: inset 0 3px 0 var(--warn); }
.card > .scope-tabs { margin-top: -4px; }
.sec-title { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); }
.total-card { border-inline-start: 3px solid var(--brand); }

/* ---------- القوائم ---------- */
.tag.scope-co { background: var(--brand-soft); color: var(--ink-2); }
.tag.scope-show { background: var(--warn-soft); color: var(--warn); }
.clip { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
table.t td input[type=checkbox] { cursor: pointer; }

/* ---------- اسعار البيع ونوع المشتري ---------- */
.price-grid { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-2); padding: 14px; }
.price-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.price-head h4 { margin: 0; font-size: 14px; }
.price-grid .pl > label.l { color: var(--ink-2); font-weight: 600; }
.price-grid .pl input { border-inline-start: 3px solid var(--accent); }
.buyer-note:empty { display: none; }
.buyer-note { display: inline-block; padding: 5px 12px; border-radius: var(--radius); background: var(--brand-soft); color: var(--ink-2); font-weight: 600; font-size: 13px; }
.buyer-note.k-showroom { background: var(--warn-soft); color: var(--warn); }
.internal-card { border-inline-start: 3px solid var(--warn); }

/* ---------- صفحة المبرمج ---------- */
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pv-group { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; background: var(--panel-2); }
.pv-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pv-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; font-size: 13.5px; }
.pv-item.off span { color: var(--muted); text-decoration: line-through; }
.side .brand { cursor: default; user-select: none; -webkit-tap-highlight-color: transparent; }
.dev-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
.dev-grid + .kpis, .kpis + .dev-grid { margin-top: 0; }
.dev-grid:last-child { grid-template-columns: 1fr 1fr; }
@media (max-width: 980px) { .dev-grid, .dev-grid:last-child { grid-template-columns: 1fr; } }
.dev-card { text-align: center; }
.dev-card .row { text-align: start; }
.qr-box { display: grid; place-items: center; min-height: 236px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 8px; }
.qr-box svg.qr { display: block; max-width: 100%; height: auto; }
.qr-empty { color: #69736F; padding: 30px 10px; }
.qr-note { margin-top: 6px; word-break: break-all; direction: ltr; }
.dev-id { margin-top: 12px; display: grid; gap: 2px; }
.dev-id .num { text-align: center; }
input.ltr { direction: ltr; text-align: left; }
.dev-id .dev-name { font-family: var(--font-title); font-weight: 700; font-size: 17px; }
table.kv { width: 100%; border-collapse: collapse; }
table.kv th, table.kv td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
table.kv th { width: 38%; color: var(--muted); font-weight: 500; font-size: 13px; }
table.kv td.num { direction: ltr; text-align: left; word-break: break-all; }
.pdoc.dev-print { text-align: center; padding-top: 30mm; }
.pdoc.dev-print h2 { margin: 14px 0 4px; font-size: 24px; }

/* ---------- الطباعة (ثابتة: ابيض واسود مهما كان المظهر) ---------- */
#print-area { display: none; }
@media print {
  @page { margin: 10mm; }
  body { background: #fff; color: #000; }
  #app, #toasts, .modal-bg { display: none !important; }
  #print-area { display: block; }
}
.pdoc { font-size: 13px; color: #000; font-family: var(--font); }
.pdoc .ph { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
.pdoc .ph h2 { margin: 0; font-size: 20px; }
.pdoc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin-bottom: 10px; }
.pdoc table { width: 100%; border-collapse: collapse; }
.pdoc th, .pdoc td { border: 1px solid #444; padding: 4px 6px; text-align: start; }
.pdoc th { background: #eee; }
.pdoc .tot { margin-top: 10px; display: flex; justify-content: flex-end; }
.pdoc .tot table { width: auto; min-width: 260px; }
.pdoc .foot { margin-top: 24px; text-align: center; font-size: 12px; }
.pdoc .sign { margin-top: 40px; display: flex; justify-content: space-around; }
.pdoc.r80 { width: 72mm; font-size: 11px; }
.pdoc.r80 .meta { grid-template-columns: 1fr; }
.pdoc.r80 th, .pdoc.r80 td { border: none; border-bottom: 1px dashed #777; padding: 2px; }

/* ---------- العمل بدون انترنت ---------- */
.net { border: 1px solid var(--line-2); background: var(--panel); border-radius: 20px; padding: 3px 12px; min-height: 30px; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.net::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.net.off { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.net.off::before { background: var(--warn); box-shadow: none; }
.net.busy::before { background: var(--brand-2); box-shadow: 0 0 0 3px var(--focus); }
.tag.wait { background: var(--warn-soft); color: var(--warn); }
.offline-note { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); border-radius: var(--radius); padding: 9px 13px; margin-bottom: 12px; }
.offline-panel h3 { color: var(--warn); }

/* =====================================================================
   الموبايل / الايفون
   ===================================================================== */
.login-card { width: 100%; max-width: 380px; }
@supports (height: 100dvh) { .login-wrap { min-height: 100dvh; } .side { height: 100dvh; } }
@media (max-width: 900px) {
  .top { padding-top: max(8px, env(safe-area-inset-top)); padding-inline: max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-left)); }
  .side { padding-top: env(safe-area-inset-top); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  /* شريط علوي بسطر واحد */
  .top { flex-wrap: nowrap; gap: 8px; min-height: 54px; }
  .top .title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .top .net { padding: 3px 9px; font-size: 12px; flex: none; }
  .top .menu-btn, .top .more-btn { display: inline-flex; min-width: 40px; min-height: 40px; padding: 0; font-size: 18px; flex: none; }
  .top-actions { display: none; position: absolute; top: calc(100% + 4px); inset-inline-end: 10px; z-index: 40; flex-direction: column; align-items: stretch;
    background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 8px; min-width: 190px; }
  .top-actions.open { display: flex; }
  .top-actions .btn { min-height: 42px; justify-content: flex-start; font-size: 15px; }
  .top-actions .who-m { display: block; color: var(--muted); font-size: 12.5px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .content { padding: 12px 10px calc(40px + env(safe-area-inset-bottom)); }
  .card { padding: 14px 12px; border-radius: var(--radius); }
  /* الايفون يكبّر الصفحة عند لمس حقل خطه اقل من 16px */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-height: 42px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; font-size: 13.5px; }
  /* الفلاتر: حقلان في كل سطر */
  .row { gap: 10px; }
  .row > .f, .row > .f.sm { flex: 1 1 calc(50% - 5px); min-width: 0; width: auto; }
  .row > .f.grow { flex-basis: 100%; }
  .toolbar { gap: 6px; }
  .toolbar .sp { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 11px; }
  .kpi .v { font-size: 18px; }
  .kpi .k { font-size: 11.5px; }
  .scope-tabs .tab { flex: 1; text-align: center; padding: 10px 8px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs .tab { white-space: nowrap; }
  .tbl-wrap { max-height: none; }
  table.t th, table.t td { padding: 8px 9px; font-size: 13.5px; }
  /* سطور الفاتورة / التحويل / الجرد كبطاقات */
  table.lines thead { display: none; }
  table.lines, table.lines tbody { display: block; width: 100%; }
  table.lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px; border-bottom: 1px solid var(--line-2); position: relative; }
  table.lines tbody tr:nth-child(even) td { background: transparent; }
  table.lines td { display: flex; flex-direction: column; gap: 2px; padding: 0 !important; border: 0 !important; white-space: normal; font-size: 14px; }
  table.lines td[data-label]::before { content: attr(data-label); font-size: 11px; color: var(--muted); }
  table.lines td, table.lines td.num, [dir=ltr] table.lines td.num { text-align: start; direction: inherit; }
  table.lines td:first-child { position: absolute; top: 8px; inset-inline-end: 10px; color: var(--muted); background: var(--panel-2); border-radius: 999px !important; min-width: 26px; height: 26px; align-items: center; justify-content: center; font-size: 12px; }
  table.lines td:first-child::before { display: none; }
  table.lines td:nth-child(2) { grid-column: 1 / -1; padding-inline-end: 36px !important; }
  table.lines td:last-child { grid-column: 1 / -1; align-items: flex-end; }
  table.lines td:last-child::before { display: none; }
  table.lines td input { width: 100% !important; }
  table.lines td.empty, table.lines tr:has(td.empty) { display: block; }
  .doc-totals { grid-template-columns: 1fr 1fr; gap: 10px; }
  /* النوافذ: ملء الشاشة */
  .modal-bg { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; max-width: 100%; max-height: 100dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal .mf { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal .mb { padding: 14px 12px; }
  .themes { grid-template-columns: 1fr 1fr; }
  .subcodes-add input.scan { min-width: 0; flex-basis: 100%; }
  .sr-head { padding: 12px; }
  .big-num { font-size: 22px; }
  #toasts { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .upd-bar { bottom: calc(10px + env(safe-area-inset-bottom)); }
  .dev-grid { grid-template-columns: 1fr !important; }
  .pv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) { .kpis { grid-template-columns: 1fr; } }

/* =====================================================================
   اللغات اللاتينية (English / Türkçe): اتجاه من اليسار لليمين
   ===================================================================== */
.lang-sw { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.lang-sw .btn { min-width: 74px; justify-content: center; }
.lang-sw .btn.on { background: var(--brand); color: var(--on-brand, #fff); border-color: var(--brand); }
.top-actions .lang-sw { margin: 0; flex-wrap: nowrap; }
.top-actions .lang-sw .btn { min-width: 0; }
@media (max-width: 640px) { .top-actions .lang-sw { padding: 2px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; } .top-actions .lang-sw .btn { flex: 1; min-height: 36px; font-size: 13px; justify-content: center; } }
[dir=ltr] .num, [dir=ltr] td.num, [dir=ltr] th.num, [dir=ltr] .doc-totals input, [dir=ltr] table.kv td.num { text-align: right; }
[dir=ltr] .kpi .v, [dir=ltr] .kpi .s { text-align: left; }
[dir=ltr] select { background-position: right 10px center; }
[dir=ltr] body { letter-spacing: 0; }
:lang(en) .combo.invalid::after { content: 'Pick a name from the list'; }
:lang(tr) .combo.invalid::after { content: 'Listeden bir ad seçin'; }
@media (max-width: 900px) {
  [dir=ltr] .side { inset: 0 auto 0 0; transform: translateX(-100%); }
  [dir=ltr] .side.open { transform: none; }
}
/* ايقونة البرنامج المختارة من صفحة المبرمج */
.brand-img { object-fit: cover; display: block; }
.login-card img.logo { background: none; box-shadow: none; border-radius: 22%; }
.side .brand img.dot { background: none; box-shadow: none; border-radius: 24%; }
/* صفحة المبرمج: الاسم والايقونة */
.brand-choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.brand-opt { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 86px; padding: 8px 4px; border: 2px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); cursor: pointer; font: inherit; font-size: 12px; color: var(--ink-2); }
.brand-opt.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.brand-opt.up b { width: 56px; height: 56px; border-radius: 13px; border: 2px dashed var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--muted); }
.brand-opt span { text-align: center; line-height: 1.25; }
.brand-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.brand-swatches .sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-2); cursor: pointer; padding: 0; }
.brand-swatches .sw.on { outline: 3px solid var(--brand); outline-offset: 2px; }
.brand-pv { display: grid; grid-template-columns: 1fr auto; gap: 18px; margin: 16px 0 6px; align-items: start; }
.pv-desk { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: var(--radius-lg); background: var(--panel-2); border: 1px solid var(--line); }
.pv-tab { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px 9px 0 0; padding: 7px 12px; max-width: 280px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-short { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 96px; padding: 8px; border-radius: 8px; background: #1E5FA8; color: #fff; font-size: 12px; text-align: center; }
.pv-phone { width: 150px; height: 150px; border-radius: 26px; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #3a5a8c, #8a4f7d); }
.pv-app { display: flex; flex-direction: column; align-items: center; gap: 5px; color: #fff; font-size: 12px; font-family: -apple-system, "Ava Sans", sans-serif; }
.pv-app canvas { border-radius: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
@media (max-width: 640px) { .brand-pv { grid-template-columns: 1fr; } .brand-opt { width: 76px; } }
/* صفحة المبرمج: حذف البيانات */
.wipe-card { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.wipe-card h3 { color: var(--bad); }
.wipe-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 14px; }
.wipe-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--panel); }
.wipe-row:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); }
.wipe-row .nm { flex: 1; font-size: 13.5px; }
.wipe-plan { margin: 6px 0 12px; padding-inline-start: 20px; line-height: 1.9; }
.wipe-word { font-size: 18px; text-align: center; max-width: 220px; }
/* المعارض: بحث عن الستوك */
label.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; align-self: end; padding-bottom: 9px; }
.warn-txt { color: #B86A00; font-weight: 600; }
table.t tr.row-short td { background: color-mix(in srgb, var(--bad) 7%, transparent); }
table.t tr.row-extra td { background: color-mix(in srgb, #F0A020 12%, transparent); }
ol.steps { margin: 10px 0 0; padding-inline-start: 20px; line-height: 1.9; }
/* مسح الباركود بالكاميرا */
.combo.has-cam input { padding-inline-end: 46px; }
.combo .cam-btn { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); min-height: 0; height: 32px; width: 38px; padding: 0; justify-content: center; font-size: 17px; border-color: transparent; background: transparent; }
.combo .cam-btn:hover { background: var(--panel-2); }
.cam-bg { position: fixed; inset: 0; z-index: 200; background: rgba(10, 14, 16, .72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.cam-box { background: var(--panel); border-radius: var(--radius-lg); width: min(560px, 100%); overflow: hidden; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.cam-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.cam-count { font-weight: 500; font-size: 13.5px; color: var(--muted); }
.cam-view { position: relative; background: #000; aspect-ratio: 4 / 3; }
.cam-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; left: 10%; right: 10%; top: 25%; bottom: 25%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); transition: border-color .15s; pointer-events: none; }
.cam-frame.hit { border-color: #3BD07A; }
.cam-status { padding: 10px 14px; font-size: 14px; min-height: 42px; color: var(--ink-2); direction: auto; }
.cam-status.ok { color: var(--ok, #1F8A4C); font-weight: 600; }
.cam-status.bad { color: var(--bad); font-weight: 600; }
.cam-foot { display: flex; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.cam-foot .sp { flex: 1; }
@media (max-width: 640px) { .cam-bg { padding: 0; align-items: stretch; } .cam-box { border-radius: 0; width: 100%; height: 100%; } .cam-view { flex: 1; aspect-ratio: auto; } }
fieldset.pos-set { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 14px 4px; margin-top: 14px; }
fieldset.pos-set legend { padding: 0 6px; font-weight: 700; color: var(--brand); }
/* ===================== الكاشير ===================== */
.pos-top { display: flex; flex-direction: column; gap: 10px; }
.pos-top > .f { max-width: 320px; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.pos-main { padding: 14px; }
.pos-bar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pos-bar .f { margin: 0; min-width: 180px; }
.pos-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.pos-seg .btn { border: 0; border-radius: 0; min-width: 84px; justify-content: center; }
.pos-mode { font-weight: 700; padding: 6px 14px; border-radius: 999px; font-size: 14px; }
.pos-mode.sale { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pos-mode.return { background: var(--bad-soft); color: var(--bad); }
.pos-scan .combo input { font-size: 18px; min-height: 50px; }
.pos-tbl { margin-top: 10px; max-height: calc(100dvh - 300px); }
.pos-lines td { vertical-align: middle; }
.pos-name { font-weight: 600; font-size: 15px; }
.pos-qty { display: inline-flex; align-items: center; gap: 8px; }
.pos-qty b { min-width: 28px; text-align: center; font-size: 16px; }
.btn.pos-q { min-width: 38px; min-height: 38px; padding: 0; justify-content: center; font-size: 18px; font-weight: 700; }
.pos-price { max-width: 120px; }
.pos-lt { font-weight: 700; font-size: 15px; }
.pos-empty { padding: 40px 10px !important; font-size: 15px; }
.pos-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.pos-total { font-family: var(--font-title); font-size: 34px; font-weight: 700; text-align: center; padding: 14px 6px; border-radius: var(--radius-lg); background: var(--panel-2); border: 1px solid var(--line); letter-spacing: .3px; }
.pos-kv { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); }
.pos-big-inp { font-size: 22px !important; min-height: 52px; text-align: center; }
.pos-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-quick .btn { flex: 1 1 auto; justify-content: center; min-height: 40px; }
.pos-change { text-align: center; font-size: 20px; font-weight: 700; min-height: 30px; color: var(--ok); }
.pos-change.neg { color: var(--bad); }
.btn.pos-pay { min-height: 64px; font-size: 20px; justify-content: center; font-weight: 700; }
.pos-row2 { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.pos-row2 .btn { justify-content: center; }
.pos-recent { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.pos-rc { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; font-size: 13.5px; }
.pos-rc.void span { text-decoration: line-through; color: var(--muted); }
.pos-ret { align-items: end; margin-bottom: 8px; }
.pos-orig { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.pos-orig-lines { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pos-open { max-width: 460px; }
.btn.pos-big-btn { min-height: 52px; font-size: 18px; padding: 0 28px; }
table.shift-kv td { padding: 6px 8px; }
table.shift-kv tr.big td { font-weight: 700; font-size: 16px; border-top: 2px solid var(--line-2); }
@media (max-width: 1000px) { .pos { grid-template-columns: 1fr; } .pos-side { position: static; } .pos-tbl { max-height: none; } }
/* ايصال الكاشير 80 / 58 ملم */
.pdoc.rcpt { font-size: 12px; margin: 0 auto; }
.pdoc.rcpt.r80 { width: 72mm; }
.pdoc.rcpt.r58 { width: 48mm; font-size: 10.5px; }
.rcpt .rc-head { text-align: center; border-bottom: 1px dashed #000; padding-bottom: 4px; margin-bottom: 4px; }
.rcpt .rc-logo { width: 14mm; height: 14mm; object-fit: contain; display: block; margin: 0 auto 2px; }
.rcpt .rc-co { font-weight: 700; font-size: 1.25em; }
.rcpt .rc-title { text-align: center; font-weight: 700; margin: 3px 0; }
.rcpt .rc-title b { font-size: 1.3em; }
.rcpt .rc-meta { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dashed #000; padding-bottom: 3px; margin-bottom: 3px; }
.rcpt table { width: 100%; border-collapse: collapse; }
.rcpt th, .rcpt td { border: none !important; padding: 2px 0 !important; background: none !important; }
.rcpt .rc-lines td { border-bottom: 1px dotted #999 !important; vertical-align: top; }
.rcpt .rc-name { font-weight: 600; }
.rcpt .rc-q { font-size: .92em; }
.rcpt .rc-amt { text-align: end; white-space: nowrap; padding-inline-start: 4px !important; }
.rcpt .rc-tot { margin-top: 4px; }
.rcpt .rc-tot td:last-child { text-align: end; }
.rcpt .rc-tot tr.big td { font-weight: 700; font-size: 1.3em; border-top: 1px solid #000 !important; padding-top: 3px !important; }
.rcpt .rc-sub { text-align: center; font-size: .92em; margin-top: 2px; }
.rcpt .rc-foot { text-align: center; margin-top: 6px; border-top: 1px dashed #000; padding-top: 4px; }
.rcpt .sign { margin-top: 18px; }
/* تبويبا القائمة: الشركة | المعارض */
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 12px 10px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.side-tabs:empty { display: none; }
.side-tabs .st { border: 0; background: transparent; color: rgba(255, 255, 255, .72); font: inherit; font-weight: 700; font-size: 14.5px; padding: 9px 6px; border-radius: 9px; cursor: pointer; }
.side-tabs .st:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.side-tabs .st.on { background: var(--bar); color: #10201F; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.side-tabs .st.showroom.on { background: #E6B45A; color: #2A1E05; }

/* =====================================================================
   الكاشير الجديد (pos-core.js) — شبكة المواد يميناً، الوصل كورقة ايصال يساراً
   ===================================================================== */
.pos-pick { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.pos-pick .f { max-width: 320px; margin: 0; }
.pz { --pz-off: 150px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: minmax(0, 1fr) auto; gap: 12px;
  height: calc(100dvh - var(--pz-off)); min-height: 520px; }
.pz.compact { --pz-off: 78px; }
.pz-cat { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.pz-sbar { display: flex; align-items: center; gap: 10px; }
.pz-sfield { flex: 1; display: flex; gap: 6px; }
.pz-search { flex: 1; font-size: 17px !important; min-height: 50px; padding-inline: 14px !important; border-radius: var(--radius-lg) !important; }
.pz-sfield .cam-btn { min-width: 50px; min-height: 50px; justify-content: center; }
.pz-count { white-space: nowrap; }
.pz-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; align-items: center; scrollbar-width: thin; }
.pz-chip { border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.pz-chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pz-only { margin-inline-start: auto; white-space: nowrap; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.pz-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; align-content: start; padding: 2px; }
.pz-tile { display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 10px 11px 9px; min-height: 104px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); font: inherit; transition: border-color .12s, transform .06s; }
.pz-tile:hover { border-color: var(--brand-2); }
.pz-tile:active { transform: scale(.98); }
.pz-tile:focus-visible { outline: 3px solid var(--focus); border-color: var(--brand); }
.pz-t-name { font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pz-t-code { font-size: 12px; color: var(--muted); direction: ltr; text-align: end; }
.pz-t-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.pz-t-price { color: var(--ok); font-size: 16px; }
.pz-t-stock { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pz-tile.out { background: var(--panel-2); }
.pz-tile.out .pz-t-stock { color: var(--bad); }
.pz-more { grid-column: 1 / -1; justify-content: center; }
.pz-empty-grid { grid-column: 1 / -1; padding: 40px 10px; text-align: center; color: var(--muted); }

/* الوصل: ورقة ايصال حقيقية بحافة مسننة */
.pz-cart { display: flex; flex-direction: column; min-height: 0; gap: 8px; grid-row: 1 / 3; grid-column: 2; }
.pz-paper { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 18px 16px 14px;
  background: var(--panel); border: 1px solid var(--line); border-top: 0; position: relative; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 1px 0 var(--line); }
.pz-paper::before { content: ''; position: sticky; top: -18px; display: block; height: 8px; margin: -18px -16px 4px; flex: none;
  background: linear-gradient(-45deg, transparent 5px, var(--panel) 0) 0 0 / 10px 8px repeat-x, linear-gradient(45deg, transparent 5px, var(--panel) 0) 0 0 / 10px 8px repeat-x, var(--bg); }
.pz-head { text-align: center; padding-bottom: 9px; border-bottom: 1px dashed var(--line-2); }
.pz-head-t { font-family: var(--font-title); font-size: 17px; font-weight: 700; }
.pz-head-m { display: flex; justify-content: center; gap: 14px; color: var(--muted); margin-top: 2px; }
.pz-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pz-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; flex: none; }
.pz-seg-b { border: 0; background: var(--panel); color: var(--ink-2); font: inherit; font-weight: 600; padding: 7px 18px; cursor: pointer; }
.pz-seg-b.sm { padding: 4px 10px; font-size: 13px; }
.pz-seg-b + .pz-seg-b { border-inline-start: 1px solid var(--line-2); }
.pz-seg-b.on { background: var(--brand); color: var(--brand-ink); }
.pz-seg-b:disabled { opacity: .45; cursor: not-allowed; }
.pz.is-return .pz-seg-b.on:nth-child(2) { background: var(--bad); }
.pz-seller { max-width: 170px; min-height: 34px; font-size: 13px; }
.pz-party { flex: 1; display: flex; align-items: center; gap: 8px; border: 1px dashed var(--line-2); background: var(--panel-2); color: var(--ink); border-radius: var(--radius);
  padding: 7px 12px; font: inherit; cursor: pointer; text-align: start; }
.pz-party:hover { border-color: var(--brand-2); }
.pz-party-n { flex: 1; font-weight: 600; }
.pz-party-b { font-size: 13px; color: var(--bad); }
.pz-x { font-size: 18px; line-height: 1; padding: 0 4px; color: var(--muted); }
.pz-x:hover { color: var(--bad); }
.pz-ret { display: flex; gap: 6px; }
.pz-ret[hidden] { display: none; }
.pz-ret input { flex: 1; min-width: 0; }
.pz-orig-in { border: 1px dashed var(--bad); border-radius: var(--radius); padding: 8px; background: var(--bad-soft); }
.pz-orig-lines { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pz-lines { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 120px; }
.pz-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 84px 26px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dotted var(--line-2); }
.pz-l-name { font-weight: 600; line-height: 1.3; }
.pz-l-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pz-l-x { opacity: .6; }
.pz-lprice { width: 92px; min-height: 28px !important; padding: 2px 6px !important; font-size: 13px !important; }
.pz-qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.pz-qty b { min-width: 30px; text-align: center; font-size: 15px; }
.pz-q { width: 32px; height: 32px; border: 0; background: var(--panel-2); color: var(--ink); font-size: 18px; font-weight: 700; cursor: pointer; }
.pz-q:hover { background: var(--hover); }
.pz-lt { text-align: end; font-size: 15px; }
.pz-del { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; width: 26px; height: 26px; border-radius: var(--radius); }
.pz-del:hover { color: var(--bad); background: var(--bad-soft); }
.pz-empty { margin: auto 0; text-align: center; padding: 26px 8px; }
.pz-empty-t { font-family: var(--font-title); font-size: 18px; color: var(--ink-2); margin-bottom: 4px; }
.pz-tot { border-top: 1px dashed var(--line-2); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.pz-kv { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--ink-2); }
.pz-dctl { display: flex; gap: 6px; align-items: center; flex: 1; justify-content: center; }
.pz-disc { width: 90px; min-height: 30px !important; padding: 2px 8px !important; }
.pz-netrow { display: flex; justify-content: space-between; align-items: baseline; border-top: 3px double var(--ink-2); padding-top: 8px; margin-top: 2px; }
.pz-netrow > span { font-family: var(--font-title); font-size: 16px; font-weight: 700; }
.pz-net { font-family: var(--font-title); font-size: 34px; font-weight: 700; color: var(--ok); letter-spacing: .2px; line-height: 1.1; }
.pz.is-return .pz-net { color: var(--bad); }
.pz.is-return .pz-paper { box-shadow: inset 0 3px 0 var(--bad); }
.pz-pay { display: flex; flex-direction: column; gap: 6px; }
.pz-pay[hidden], .pz-quick[hidden] { display: none; }
.pz-paid { font-size: 20px !important; min-height: 48px; text-align: center; }
.pz-quick { display: flex; flex-wrap: wrap; gap: 5px; }
.pz-quick .btn { flex: 1 1 auto; justify-content: center; min-height: 36px; padding: 0 8px; }
.pz-change { text-align: center; font-size: 17px; font-weight: 700; min-height: 24px; color: var(--ok); }
.pz-change.neg { color: var(--bad); }
.pz-change.warn { color: var(--warn); }
.pz-actions { display: flex; flex-direction: column; gap: 6px; }
.btn.pz-save { min-height: 62px; justify-content: center; gap: 12px; font-size: 20px; font-weight: 700; background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.pz-save:hover { filter: brightness(1.06); }
.pz.is-return .btn.pz-save { background: var(--bad); border-color: var(--bad); }
.pz-save kbd { font: inherit; font-size: 13px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: rgba(255,255,255,.18); }
.pz-act2 { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.pz-act2 .btn { justify-content: center; }
.pz-foot { grid-column: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 2px 0; border-top: 1px solid var(--line); }
.pz-keys { display: flex; gap: 12px; flex-wrap: wrap; }
.pz-k { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); }
.pz-k kbd { font: inherit; font-size: 12px; font-weight: 700; min-width: 30px; text-align: center; padding: 2px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--panel); direction: ltr; }
.pz-info { margin-inline-start: auto; }
.pz-plist { display: flex; flex-direction: column; margin-top: 8px; max-height: 55vh; overflow-y: auto; }
.pz-prow { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; text-align: start; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; cursor: pointer; }
.pz-prow:hover, .pz-prow:focus-visible { background: var(--sel); }
.pz-recent { display: flex; flex-direction: column; }
.pz-rc { display: grid; grid-template-columns: 70px 54px 1fr auto auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pz-rc.void > span, .pz-rc.void > b { text-decoration: line-through; color: var(--muted); }
@media (max-width: 1100px) { .pz { grid-template-columns: minmax(0, 1fr) 350px; } }
@media (max-width: 860px) {
  .pz, .pz.compact { display: flex; flex-direction: column; height: auto; }
  .pz-grid { max-height: 46vh; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pz-paper { overflow: visible; }
  .pz-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pz-tile { transition: none; } .pz-tile:active { transform: none; } }

/* ===== تطبيق الكاشير المستقل (/cashier/) ===== */
body.cashier-app { background: var(--bg); }
.ca-card { text-align: start; }
.ca-shop { font-family: var(--font-title); font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.ca-code { width: 100%; font-size: 30px !important; letter-spacing: 6px; text-align: center; padding: 12px !important; margin: 6px 0 4px; }
.ca-err { min-height: 20px; margin: 8px 0; }
.btn.ca-btn { width: 100%; justify-content: center; padding: 11px; font-size: 16px; }
.ca-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.ca-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 14px;
  background: var(--side); color: var(--side-ink); }
.ca-bar .btn.sm { background: transparent; color: var(--side-ink); border-color: rgba(255,255,255,.22); }
.ca-bar .btn.sm:hover { background: var(--side-2); }
.ca-brand { display: flex; align-items: center; gap: 9px; font-size: 16px; color: #fff; }
.ca-brand .dot, .ca-brand img { width: 24px; height: 24px; }
.ca-user { color: var(--side-mute); font-size: 13px; }
.ca-net { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; }
.ca-net.on { background: rgba(79, 179, 172, .22); color: #CFEDEA; }
.ca-net.off { background: var(--warn); color: #fff; }
.ca-host { padding: 12px 14px 10px; }
.ca-open { display: flex; justify-content: center; padding-top: 6vh; }
.ca-msg { max-width: 520px; margin: 8vh auto; }
@media print { .ca-bar { display: none !important; } }
.dv-steps { margin: 8px 0 14px; padding-inline-start: 22px; line-height: 1.9; }
.dv-add { align-items: end; gap: 10px; flex-wrap: wrap; }
.dv-add .f { margin: 0; min-width: 200px; }
.dv-code { font-family: var(--font-title); font-size: 44px; font-weight: 700; letter-spacing: 8px; text-align: center; padding: 16px; margin: 10px 0;
  background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: var(--radius-lg); color: var(--brand); }
.dv-act { display: inline-flex; gap: 6px; }
.pz-foot .pz-info { flex-basis: auto; } @media (max-width: 1400px) { .pz-info { display: none; } }

/* ===== 2.17.1: الكاشير يملأ الشاشة بالضبط — الوصل: اعلى ثابت، السطور تتمرر، الحساب والدفع ثابتان بالاسفل ===== */
.content:has(.pz) { padding-top: 12px; padding-bottom: 8px; max-width: none; }
.pz { height: auto; min-height: 420px; gap: 10px; grid-template-columns: minmax(0, 1fr) 380px; }
.pz-picker select { min-height: 50px; max-width: 220px; font-weight: 600; }
.pz-sbar { gap: 8px; }
.pz-cart { gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); overflow: hidden; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06)); }
.pz-paper { flex: 1 1 auto; min-height: 0; overflow: hidden; border: 0; border-radius: 0; box-shadow: none; padding: 12px 14px 0; gap: 7px; }
.pz-paper::before { position: static; margin: -12px -14px 2px; }
.pz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; text-align: start; padding-bottom: 7px; }
.pz-head-t { font-size: 18px; white-space: nowrap; }
.pz-head-m { margin: 0; gap: 10px; white-space: nowrap; overflow: hidden; }
.pz-ctl { display: flex; gap: 8px; align-items: stretch; }
.pz-ctl .pz-seg-b { padding: 6px 14px; }
.pz-party { min-width: 0; padding: 6px 10px; }
.pz-party-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-ctl2 { display: flex; align-items: center; gap: 8px; }
.pz-ctl2 .pz-seller { flex: 1; max-width: none; min-height: 32px; }
.pz-lines { flex: 1 1 auto; min-height: 60px; overflow-y: auto; margin: 0 -14px; padding: 0 14px; border-top: 1px dashed var(--line-2); }
.pz-line { padding: 7px 0; grid-template-columns: minmax(0, 1fr) auto 78px 24px; gap: 6px; }
.pz-l-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-q { width: 30px; height: 30px; }
.pz-empty { padding: 14px 6px; }
.pz-bottom { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px 14px 8px; border-top: 1px dashed var(--line-2); background: var(--panel); }
.pz-tot { border: 0; padding: 0; gap: 4px; }
.pz-kv { min-height: 30px; }
.pz-dctl { justify-content: flex-start; }
.pz-netrow { padding-top: 4px; margin-top: 0; align-items: center; }
.pz-net { font-size: 30px; }
.pz-payrow { display: flex; gap: 8px; align-items: stretch; }
.pz-payrow .pz-seg-b { padding: 0 14px; }
.pz-paid { flex: 1; min-width: 0; min-height: 42px; font-size: 18px !important; }
.pz-quick { flex-wrap: nowrap; gap: 4px; }
.pz-quick .btn { flex: 1 1 0; min-width: 0; min-height: 32px; padding: 0 4px; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.pz-change { font-size: 15px; min-height: 20px; }
.pz-actions { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 6px; padding: 0 14px 12px; background: var(--panel); }
.btn.pz-save { min-height: 0; height: auto; font-size: 19px; gap: 10px; white-space: nowrap; padding: 0 10px; line-height: 1.2; }
.pz-save span { white-space: nowrap; }
.pz-act2 { display: flex; flex-direction: column; gap: 6px; }
.pz-act2 .btn { min-height: 34px; padding: 0 6px; font-size: 13px; white-space: nowrap; }
.pz-foot { flex-wrap: nowrap; padding-top: 6px; min-width: 0; }
.pz-keys { flex-wrap: nowrap; gap: 10px; overflow: hidden; min-width: 0; flex: 1; }
.pz-k { white-space: nowrap; font-size: 12.5px; }
.pz-info { margin-inline-start: 0; white-space: nowrap; display: inline; }
.pz-foot .btn { white-space: nowrap; }
/* شاشات قصيرة (لابتوب، او متصفح مكبّر) */
@media (max-height: 720px) and (min-width: 861px) {
  .pz-search { min-height: 42px; font-size: 15px !important; }
  .pz-sfield .cam-btn, .pz-picker select { min-height: 42px; min-width: 42px; }
  .pz-tile { min-height: 88px; padding: 8px 9px 7px; }
  .pz-net { font-size: 25px; }
  .pz-paid { min-height: 36px; font-size: 16px !important; }
  .pz-kv { min-height: 26px; }
  .pz-quick .btn { min-height: 28px; }
  .pz-act2 .btn { min-height: 30px; }
  .pz-head-t { font-size: 16px; }
}
@media (max-width: 1180px) and (min-width: 861px) { .pz { grid-template-columns: minmax(0, 1fr) 340px; } .pz-actions { grid-template-columns: minmax(0, 1fr) 104px; } .pz-keys .pz-k:nth-child(n+5) { display: none; } }
@media (max-width: 860px) {
  .pz-cart { overflow: visible; }
  .pz-paper { overflow: visible; }
  .pz-lines { overflow: visible; }
  .pz-actions { grid-template-columns: 1fr; }
  .btn.pz-save { min-height: 56px; }
  .pz-act2 { flex-direction: row; } .pz-act2 .btn { flex: 1; }
  .pz-foot { flex-wrap: wrap; }
  .pz-picker { flex-basis: 100%; } .pz-picker select { max-width: none; width: 100%; }
  .pz-sbar { flex-wrap: wrap; }
}
/* زر ملء الشاشة */
.fs-btn { gap: 5px; }
.fs-btn .fs-ic { font-size: 15px; line-height: 1; }
.fs-btn.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
@media (max-width: 1280px) and (min-width: 641px) { .top .fs-btn .fs-tx { display: none; } }
.pz-change:empty { display: none; }
.pz-head { align-items: center; }
.pz-head .pz-seller { width: auto; max-width: 170px; min-height: 32px; }
.pz-head-m { justify-content: flex-start; }
.pz-dtog { border: 0; background: none; color: var(--brand); font: inherit; font-size: 12.5px; cursor: pointer; padding: 2px 6px; margin-inline-start: auto; margin-inline-end: 8px; border-radius: var(--radius); }
.pz-dtog:hover { background: var(--sel); }
.pz-dtog[hidden], .pz-dk[hidden] { display: none; }
.pz-kv > span:first-child { white-space: nowrap; }
.pz-lprice { width: 84px; } @media (max-width: 1180px) { .pz-lprice { width: 72px; font-size: 12.5px !important; } }
/* 2.17.3: الباركود ظاهر في البطاقات وسطور الوصل، والرمز بجانبه */
.pz-code { display: inline-block; font-size: 11.5px; line-height: 1.5; padding: 0 6px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.pz-t-code { display: flex; align-items: center; gap: 6px; justify-content: space-between; direction: rtl; text-align: start; }
.pz-t-code .num { direction: ltr; overflow: hidden; text-overflow: ellipsis; }
.pz-l-sub { flex-wrap: wrap; row-gap: 3px; }
.pz-l-bc { direction: ltr; color: var(--ink-2); font-size: 12.5px; }
.pz-lprice { width: 96px; }
@media (max-width: 1180px) { .pz-lprice { width: 84px; } }
.subcodes-table tr.main-row td { background: var(--sel); }
.main-bc-wrap { display: flex; align-items: center; gap: 6px; }
.main-bc-wrap .main-bc { flex: 1; min-width: 0; font-weight: 600; background: transparent; }
.pz-line { grid-template-columns: minmax(0, 1fr) auto 96px 24px; grid-template-areas: "nm nm lt dl" "sb qt pr dl"; row-gap: 4px; align-items: center; }
.pz-line .pz-l-name { grid-area: nm; }
.pz-line .pz-lt { grid-area: lt; }
.pz-line .pz-del { grid-area: dl; align-self: start; }
.pz-line .pz-l-sub { grid-area: sb; margin: 0; flex-wrap: wrap; }
.pz-line .pz-qty { grid-area: qt; }
.pz-line .pz-l-pr { grid-area: pr; text-align: end; }
.pz-line .pz-lprice { width: 100%; }
.pz-line .pz-lprice-t { color: var(--muted); font-size: 12.5px; }
@media (max-width: 1180px) { .pz-line { grid-template-columns: minmax(0, 1fr) auto 84px 22px; } }
.pz-line .pz-l-sub { flex-wrap: nowrap; gap: 4px; overflow: hidden; } .pz-line .pz-l-bc { font-size: 12px; letter-spacing: -.1px; } .pz-line .pz-code { padding: 0 4px; font-size: 11px; }
.dev-sec { margin-top: 14px; }
.dev-sec-t { margin: 0 0 8px; font-family: var(--font-title); }

/* ===== 2.17.9: جدول السطور — ادخال الباركود في الجدول + صفوف اقل ارتفاعاً وعرضاً ===== */
@media (min-width: 641px) {
  table.t.lines th { padding: 5px 6px; }
  table.t.lines td { padding: 2px 5px; line-height: 1.25; }
  table.t.lines input:not([type=checkbox]), table.t.lines select { min-height: 28px !important; height: 28px; padding: 2px 7px !important; font-size: 13.5px; }
  table.t.lines .btn.sm { min-height: 26px; height: 26px; padding: 0 8px; }
  table.t.lines input.bc-in { width: 150px !important; font-weight: 600; }
  table.t.lines input.qty-in { width: 72px !important; }
  table.t.lines td input.num:not(.bc-in):not(.qty-in) { width: 92px !important; }
  table.t.lines td.nm { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
}
table.t.lines tr.new-line td { background: var(--panel-2); border-bottom: 0; }
table.t.lines tr.new-line .bc-in { border-style: dashed; border-color: var(--brand-2); background: var(--panel); }
table.t.lines tr.new-line .bc-in:focus { border-style: solid; }
table.t.lines .new-hint { white-space: normal; }
table.t.lines .bc-in:focus, table.t.lines .qty-in:focus { box-shadow: 0 0 0 2px var(--focus); }
@media (max-width: 640px) { table.t.lines tr.new-line td.new-hint { display: none; } }

/* ===== 2.17.10: جدول السطور كجدول بيانات (Data grid): الخانات تظهر كنص، تُحرَّر بالنقر، وصف ابيض وصف فضي ===== */
@media (min-width: 641px) {
  table.t.lines { border-collapse: collapse; }
  table.t.lines tbody tr.line-row td, table.t.lines tbody tr.new-line td { background: var(--panel); border-bottom: 1px solid var(--line); height: 34px; }
  table.t.lines tbody tr.line-row:nth-child(even) td { background: color-mix(in srgb, var(--ink) 5%, var(--panel)); }   /* فضي فاتح */
  table.t.lines tbody tr.line-row:hover td { background: var(--sel); }
  table.t.lines tbody tr.line-row:focus-within td { background: color-mix(in srgb, var(--brand) 9%, var(--panel)); }
  /* الخانة تبدو نصاً عادياً، وعند المرور اطار خفيف، وعند التحرير خلفية بيضاء واطار ملون */
  table.t.lines tr.line-row input:not([type=checkbox]) {
    border: 1px solid transparent !important; background: transparent !important; box-shadow: none !important;
    border-radius: 4px; font-size: 14px; color: var(--ink); cursor: text;
  }
  table.t.lines tr.line-row input:not([type=checkbox]):hover { border-color: var(--line-2) !important; }
  table.t.lines tr.line-row input:not([type=checkbox]):focus { border-color: var(--brand) !important; background: var(--panel) !important; box-shadow: 0 0 0 2px var(--focus) !important; }
  table.t.lines tr.line-row input:disabled { color: var(--ink); -webkit-text-fill-color: var(--ink); }
  table.t.lines tr.line-row input.qty-in, table.t.lines tr.line-row td input.num:not(.bc-in) { text-align: center; }
  html[dir=rtl] table.t.lines input.bc-in { text-align: right; }
  html[dir=ltr] table.t.lines input.bc-in { text-align: left; }
  table.t.lines tr.line-row input.bc-in { font-weight: 500; letter-spacing: .2px; }
  table.t.lines tr.line-row .btn.sm.bad { min-height: 24px; height: 24px; padding: 0 7px; background: transparent; }
  table.t.lines tr.new-line td { background: var(--panel); }
  table.t.lines tr.new-line .bc-in { background: var(--panel) !important; }
}

/* ===== 2.17.11: تكبير النافذة (مثل تعريف المواد) لملء الشاشة وظهور كل محتوياتها ===== */
.modal .mh-tools { display: inline-flex; gap: 4px; }
.modal .mh-max, .modal .mh-x { border: 1px solid transparent; background: none; color: var(--ink-2); width: 32px; height: 32px; border-radius: var(--radius); font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.modal .mh-max:hover, .modal .mh-x:hover { background: var(--hover); border-color: var(--line); }
.modal .mh-x { font-size: 22px; }
.modal .mh { user-select: none; }
.modal-bg.max { padding: 10px; }
.modal.max, .modal.wide.max { width: calc(100vw - 20px); max-width: none; height: calc(100dvh - 20px); max-height: none; display: flex; flex-direction: column; overflow: hidden; }
.modal.max .mb { flex: 1; overflow: auto; }
.modal.max .mh, .modal.max .mf { flex: none; position: static; }
/* في النافذة المكبرة: حقول تعريف المادة اربعة في الصف لتظهر كلها */
@media (min-width: 1200px) { .modal.max .grid3 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .modal.max .price-grid .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .modal .mh-max { display: none; } }

/* ===== 2.18: اقتراح التعبئة، اغلاق اليوم، ملصقات الباركود ===== */
.warn-t { color: var(--warn); font-weight: 600; }
.dc-sec { margin: 18px 0 8px; font-family: var(--font-title); }
.dc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.dc-shop h3 { margin: 0 0 8px; }
.dc-shifts { margin-top: 10px; }
.dc .kv td { padding: 4px 6px; }
@media print { .dc .dc-grid { grid-template-columns: 1fr 1fr; } .dc .card { break-inside: avoid; box-shadow: none; } }
.lb-opts { align-items: end; gap: 14px; }
.lb-opts .chk { padding-bottom: 10px; }
.lb-sample { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lb-sample .lb { outline: 1px dashed var(--line-2); background: #fff; }
.lb { box-sizing: border-box; padding: 1.2mm 1.8mm; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; color: #000; background: #fff; direction: rtl; font-family: var(--font-body, inherit); }
.lb-co { font-size: 6.5pt; text-align: center; font-weight: 700; white-space: nowrap; overflow: hidden; }
.lb-name { font-size: 7.5pt; line-height: 1.15; text-align: center; font-weight: 600; max-height: 2.3em; overflow: hidden; }
.lb-bars { width: 100%; display: block; fill: #000; }
.lb-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 2mm; font-size: 7pt; direction: ltr; }
.lb-bc { letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.lb-code { border: .2mm solid #000; padding: 0 1mm; border-radius: .6mm; font-weight: 700; }
.lb-price { font-size: 8.5pt; white-space: nowrap; }
@media print {
  .lb-print.roll .lb { break-after: page; page-break-after: always; }
  .lb-print.roll .lb:last-child { break-after: auto; page-break-after: auto; }
  .lb-a4 { display: grid; justify-content: center; align-content: start; padding-top: 4mm; break-after: page; page-break-after: always; }
  .lb-a4:last-child { break-after: auto; page-break-after: auto; }
}
.wipe-tabs { margin: 4px 0 12px; }
.wipe-h { margin: 14px 0 6px; font-size: 14px; color: var(--ink-2); }
.wipe-shop .f { max-width: 340px; margin: 0; }
.wipe-row.master { background: color-mix(in srgb, var(--warn) 6%, var(--panel)); }
.btn.wipe-all { opacity: .85; }

/* 2.19: اعمار الديون + واتساب */
.ag-old { font-weight: 700; }
.ag-kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.nowrap { white-space: nowrap; }
.btn.wa { border-color: #25a35a; color: #1c7c45; }
.btn.wa:hover:not([disabled]) { background: #e9f7ef; }
.btn.wa[disabled] { opacity: .45; }
.st-sum { margin: 6px 0 10px; }

/* 2.19: العروض */
.pz-promos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 12px; border-bottom: 1px dashed var(--line-2); font-size: 12.5px; }
.pz-promo-t { color: var(--muted); font-weight: 600; }
.pz-promo { background: var(--hover); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 9px; font-weight: 600; }
.pz-l-promo { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--ok); font-size: 12.5px; font-weight: 600; }
.promo-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; max-height: 210px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius); }
.promo-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.promo-chips .chip { display: inline-flex; gap: 6px; align-items: center; background: var(--hover); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 4px 2px 10px; }
.promo-chips .chip-x { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; }
.promo-desc { margin: 4px 0 10px; }
.promo-form .row + .row { margin-top: 10px; }

/* 2.19: تجربة استرجاع النسخة */
.bv-head { padding: 10px 12px; border-radius: var(--radius); margin: 10px 0 6px; border: 1px solid var(--line-2); }
.bv-head.ok { background: var(--ok-soft); border-color: var(--ok); }
.bv-head.bad { background: var(--bad-soft); border-color: var(--bad); }
.bv-head.warn { background: var(--warn-soft); border-color: var(--warn); }
.bv-steps { margin: 6px 0 10px; padding-inline-start: 20px; line-height: 1.8; }
.bv-run { font-weight: 600; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-2); border-top-color: var(--ok); border-radius: 50%; animation: bvspin 0.8s linear infinite; vertical-align: -1px; }
@keyframes bvspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* 2.19: التحقق بخطوتين */
.otp-in { font-size: 24px; letter-spacing: 6px; text-align: center; width: 100%; padding: 10px; }
.otp-form .otp-t { margin: 4px 0 6px; font-size: 20px; }
.otp-form .otp-in { margin-top: 6px; }
.tfa-steps { padding-inline-start: 20px; line-height: 1.9; margin: 0 0 10px; }
.tfa-qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.tfa-qr svg { background: #fff; border-radius: 8px; border: 1px solid var(--line-2); }
.tfa-key { display: inline-block; font-size: 15px; letter-spacing: 1px; padding: 6px 8px; background: var(--hover); border-radius: 6px; margin-top: 4px; }
.tfa-on { color: var(--ok); font-weight: 700; }
.rc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.rc-grid code { font-size: 17px; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 6px; text-align: center; }

/* 2.19: مقارنة المحلات + الربح حسب الماركة */
:root { --cmp-rgb: 31, 122, 90; }
[data-theme="night"] { --cmp-rgb: 76, 195, 138; }
table.t.cmp td.cmp-c { vertical-align: top; }
.cmp-ch { font-size: 11.5px; font-weight: 600; margin-top: 2px; }
.pb-bar { position: relative; min-width: 140px; height: 20px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.pb-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: rgba(var(--cmp-rgb), .35); }
.pb-fill.neg { background: color-mix(in srgb, var(--bad) 35%, transparent); }
.pb-v { position: relative; padding-inline: 6px; font-size: 12px; line-height: 20px; }
table.t.cmp { table-layout: fixed; }
table.t.cmp th:first-child { width: 22%; }
@media (max-width: 760px) { table.t.cmp { table-layout: auto; min-width: 560px; } }
.ds-where { display: flex; flex-wrap: wrap; gap: 4px; }
.ds-where .chip { background: var(--hover); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 8px; font-size: 12px; white-space: nowrap; }

/* 2.19.1: قفل البرنامج */
body.ava-locked #app { filter: blur(14px); pointer-events: none; user-select: none; }
.lock-bg { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: rgba(20, 24, 26, .45); padding: 16px; }
.lock-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 26px 24px 18px; width: min(380px, 100%); box-shadow: 0 18px 50px rgba(0,0,0,.25); text-align: center; }
.lock-card h2 { margin: 6px 0 4px; font-size: 20px; }
.lock-card input { width: 100%; margin-top: 12px; padding: 10px; font-size: 16px; }
.lock-card .btn.p { width: 100%; justify-content: center; padding: 10px; }
.lock-ic { font-size: 30px; }
.lock-err { min-height: 20px; margin: 8px 0; }
.lock-out { margin-top: 12px; }
@media print { body.ava-locked #app { filter: none; } .lock-bg { display: none; } }

/* 2.19.2: شريط الاشتراك */
.lic-bar { position: sticky; top: 0; z-index: 8000; padding: 8px 14px; font-weight: 600; font-size: 13.5px; text-align: center; border-bottom: 1px solid; }
.lic-bar.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.lic-bar.grace { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.lic-bar.readonly { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
@media print { .lic-bar { display: none; } }
.lic-q { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.lic-card .tag { display: inline-block; width: auto; }
/* NaziSystem: جرس اشعارات الاخطاء */
.alert-bell { border-radius: 20px; min-height: 30px; }
.alert-bell.has-err { background: var(--neg-soft, #fde8e8); color: var(--neg, #c0392b); border-color: currentColor; font-weight: 700; animation: bellpulse 2s ease-in-out 3; }
.alert-bell.has-warn { background: var(--warn-soft); color: var(--warn); border-color: currentColor; }
@keyframes bellpulse { 50% { transform: scale(1.08); } }
