:root {
  --brand: #0B5D55; --brand-dark: #08443E; --side: #10302C; --gold: #F5B748;
  --ink: #13201E; --muted: #4B5B58; --line: #DDE4E2; --bg: #F3F5F4; --card: #fff;
  --danger: #B42318; --danger-bg: #FEF3F2; --warn: #B45309; --warn-bg: #FEF3C7;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 'IBM Plex Sans Arabic', system-ui, sans-serif; }
a { color: var(--brand); } a:hover { color: var(--brand-dark); }
input:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.hidden { display: none !important; }

/* شاشة الدخول: لوحة تعريف ونموذج */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-aside { flex: 1 1 380px; background: var(--side); color: #fff; padding: 48px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-aside h1 { font-size: 30px; line-height: 1.35; margin: 0 0 12px; }
.auth-aside p { color: #D7E5E2; margin: 0; max-width: 420px; }
.auth-aside ul { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; color: #D7E5E2; }
.auth-aside li::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-inline-end: 10px; }
.auth-aside small { color: #9DB8B3; }
.auth-aside.owner { background: #0D2724; }
.auth-main { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; margin: 0 0 4px; }
.auth-card .lead { color: var(--muted); margin: 0 0 28px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-size: 20px; display: block; }
.brand span { font-size: 13px; color: var(--gold); font-weight: 600; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field input { font: inherit; padding: 11px 12px; border: 1px solid #C9D3D0; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
.field input[dir=ltr] { text-align: left; }
.auth-card .field input[readonly] { background: #F2F6F5; color: #33403D; }
.pw { position: relative; }
.pw button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font: inherit; font-size: 13px; cursor: pointer; padding: 6px; }

.btn { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 12px 18px; cursor: pointer; background: var(--brand); color: #fff; width: 100%; }
.btn:hover { background: var(--brand-dark); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); width: auto; }

.alert { border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; font-size: 14px; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.switch { margin-top: 24px; color: var(--muted); font-size: 14px; text-align: center; }
/* «نسيت كلمة المرور؟» (162): الزر نفسه بخط بارز كعنوان الفقرة السابقة */
.switch .forgot-open { font-weight: 700; font-size: 15px; }

/* الصفحة بعد الدخول */
.top { background: var(--side); color: #fff; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top .btn.ghost { color: #fff; border-color: #2A5A54; }
.page { max-width: 1040px; margin: 0 auto; padding: 28px 16px; display: grid; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.card h3 { margin: 0 0 12px; font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat small { color: var(--muted); display: block; }
.stat b { font-size: 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 9px 8px; border-bottom: 1px solid #EEF2F1; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #E6F1EF; color: var(--brand); }
.pill.off { background: var(--danger-bg); color: var(--danger); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.muted { color: var(--muted); }

/* لوحة المالك: قائمة جانبية ومحتوى */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 280px; background: var(--side); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; }
.side-brand { padding: 0 8px 18px; }
body[data-page="home"] .side:not(.side-ready) a { visibility: hidden; }
.side a { padding: 10px 12px; border-radius: 8px; color: #D7E5E2; text-decoration: none; font-size: 15px; }
.side a:hover { background: #1B4540; color: #fff; }
.side a.active { background: #1F524B; color: #fff; font-weight: 600; }
.side hr { border: 0; border-top: 1px solid #2A5A54; margin: 8px 0; width: 100%; }
.side-label { color: var(--gold); font-size: 12px; font-weight: 600; padding: 8px 12px 2px; }
/* رموز القائمة الجانبية بلون وظيفتها، وروابط القائمة الفرعية بلون قسمها */
.side { --c-home: #0284C7; --c-accounts: #0D9488; --c-items: #D97706; --c-moves: #B45309; --c-invoices: #2563EB; --c-pos: #7C3AED; --c-vouchers: #16A34A;
  --c-cheques: #EA580C; --c-hr: #DB2777; --c-reports: #4F46E5; --c-statement: #0891B2; --c-profits: #65A30D; --c-drafts: #CA8A04; --c-notes: #E11D48;
  --c-chat: #9333EA; --c-users: #0E7490; --c-settings: #475569; --c-support: #C026D3; --c-m: #64748B; }
body[data-page] .side :is(a[data-nav="home"]) .tile-icon { color: var(--c-home); }
body[data-page] .side :is(a[data-nav="accounts"]) .tile-icon { color: var(--c-accounts); }
body[data-page] .side :is(a[data-nav="items"]) .tile-icon { color: var(--c-items); }
body[data-page] .side :is(a[data-nav="item-moves"]) .tile-icon { color: var(--c-moves); }
body[data-page] .side :is(a[data-nav="invoices"], [data-item="invoices"] .side-sub a) .tile-icon { color: var(--c-invoices); }
body[data-page] .side :is(a[data-nav="pos"]) .tile-icon { color: var(--c-pos); }
body[data-page] .side :is(a[data-nav="vouchers"], [data-item="vouchers"] .side-sub a) .tile-icon { color: var(--c-vouchers); }
body[data-page] .side :is(a[data-nav="cheques"], [data-item="cheques"] .side-sub a) .tile-icon { color: var(--c-cheques); }
body[data-page] .side :is(a[data-nav="hr"]) .tile-icon { color: var(--c-hr); }
body[data-page] .side :is(a[data-nav="reports"], [data-item="reports"] .side-sub a) .tile-icon { color: var(--c-reports); }
body[data-page] .side :is(a[data-nav="statement"]) .tile-icon { color: var(--c-statement); }
body[data-page] .side :is(a[data-nav="profits"], [data-item="profits"] .side-sub a) .tile-icon { color: var(--c-profits); }
body[data-page] .side :is(a[data-nav="drafts"]) .tile-icon { color: var(--c-drafts); }
body[data-page] .side :is(a[data-nav="notes"]) .tile-icon { color: var(--c-notes); }
body[data-page] .side :is(a[data-nav="chat"]) .tile-icon { color: var(--c-chat); }
body[data-page] .side :is(a[data-nav="users"]) .tile-icon { color: var(--c-users); }
body[data-page] .side :is(a[data-nav="settings"]) .tile-icon { color: var(--c-settings); }
body[data-page] .side :is(a[data-nav="support"]) .tile-icon { color: var(--c-support); }
body[data-page] .side :is(a[data-nav="m"]) .tile-icon { color: var(--c-m); }
/* ترتيب القائمة لكل مستخدم */
.side-order-btn { margin: 6px 12px 0; padding: 6px 10px; border: 1px dashed rgba(255, 255, 255, .25); border-radius: 8px; background: none; color: inherit; opacity: .75; font: inherit; font-size: 13px; cursor: pointer; text-align: start; }
.side-order-btn:hover { opacity: 1; }
.side-order-bar { margin: 6px 8px 0; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); display: grid; gap: 6px; font-size: 12.5px; }
.side-order-bar .link { color: inherit; opacity: .85; }
.side-ordering > :is(a[data-nav], .side-item) { outline: 1px dashed rgba(255, 255, 255, .25); outline-offset: -2px; border-radius: 8px; cursor: grab; }
.side-ordering :is(.side-sub, .side-caret) { display: none !important; }
.side-ordering .side-dragging { opacity: .45; }
.side-move { display: inline-flex; gap: 2px; margin-inline-start: auto; }
.side-move .icon-btn { width: 24px; height: 24px; padding: 0; color: inherit; background: rgba(255, 255, 255, .08); border: 0; border-radius: 6px; }
.side-item .side-move { position: absolute; inset-inline-end: 6px; top: 8px; }
body.side-mini .side-order-btn, body.side-mini .side-order-bar { display: none; }
.shell-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 28px; border-bottom: 1px solid var(--line); background: #fff; }
.bar h1 { font-size: 20px; margin: 0; }
.bar-user { color: var(--muted); font-size: 14px; }
.link { font: inherit; background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; }
.view { padding: 24px 28px 48px; display: grid; gap: 20px; align-content: start; outline: none; }
/* القائمة ثابتة بجانب المحتوى وتمرّر وحدها؛ وعلى الشاشات الضيقة درج ينزلق من اليمين (collect.js: initDrawer) */
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
.menu-btn { display: none; }
.side-backdrop { display: none; }
.side-close { display: none; }
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; width: min(84vw, 300px); max-width: none; height: auto;
    transform: translateX(100%); transition: transform .22s ease, visibility .22s; visibility: hidden; box-shadow: -8px 0 24px rgba(0,0,0,.18); }
  body.nav-open .side { transform: none; visibility: visible; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(16,32,30,.45); opacity: 0; pointer-events: none; transition: opacity .22s; }
  body.nav-open .side-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .bar { position: sticky; top: 0; z-index: 40; padding: 10px 16px; gap: 8px 12px; }
  .bar h1 { font-size: 18px; flex: 1; min-width: 0; }
  .bar-user { width: 100%; font-size: 13px; }
  .menu-btn { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; width: 42px; height: 42px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; flex: none; }
  .menu-btn span { display: block; height: 2px; border-radius: 2px; background: var(--ink); }
  .side-close { display: inline-flex; align-items: center; justify-content: center; flex: none; margin-inline-start: auto; width: 38px; height: 38px;
    border: 1px solid currentColor; border-radius: 10px; background: none; color: inherit; opacity: .8; cursor: pointer; font-size: 16px; line-height: 1; }
  .side-close:hover, .side-close:focus-visible { opacity: 1; }
  .view { padding: 16px 12px 40px; gap: 14px; }
  .card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .side, .side-backdrop { transition: none; } }
/* لا يتجاوز أي حقل أو جدول عرض الشاشة */
.view > *, .card, .field { min-width: 0; }
input, select, textarea { max-width: 100%; min-width: 0; }
/* الآيفون والآيباد (Safari على iOS وحده): خط الخانات 16px فلا يكبّر الصفحة تلقائياً عند الكتابة فيها */
@supports (-webkit-touch-callout: none) { input, select, textarea { font-size: max(16px, 1em); } }
/* خانات الأرقام بلا أسهم الزيادة والنقص في كل الموقع (الكتابة والأسهم في لوحة المفاتيح تبقى) */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.field input, .field select, .field textarea { width: 100%; box-sizing: border-box; }
input[type="datetime-local"], input[type="date"] { -webkit-appearance: none; appearance: none; min-height: 44px; }
/* حقل التاريخ بالترتيب يوم/شهر/سنة (web/dates.js): نص يُكتب فيه وزر التقويم، والحقل الأصلي مخفي بجانبه يحمل القيمة */
.dmy { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.field .dmy, .fee-grid .dmy, .move-grid .dmy, .j-head .dmy { display: block; }
.dmy > .dmy-text { min-height: 44px; padding-right: 34px; text-align: left; box-sizing: border-box; }
.dmy > .dmy-text.dmy-bad { border-color: var(--danger, #B42318); background: #FEF3F2; }
.dmy > .dmy-pick { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 4px; color: var(--muted); cursor: pointer; line-height: 0; border-radius: 6px; }
.dmy > .dmy-pick:hover:not(:disabled) { color: var(--brand); background: #EEF5F3; }
.dmy > .dmy-pick:disabled { cursor: default; opacity: .5; }
.dmy > input[data-dmy] { position: absolute !important; right: 0; bottom: 0; width: 1px !important; height: 1px !important; min-height: 0 !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }

.row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.svc-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; }
.btn.light { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.light:hover { background: #F8FAF9; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #F3C7C3; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 99px; padding: 6px 14px; cursor: pointer; }
.tabs button[aria-pressed=true] { background: var(--brand); color: #fff; border-color: var(--brand); }
.search { font: inherit; padding: 9px 12px; border: 1px solid #C9D3D0; border-radius: 8px; min-width: 220px; }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.soon { text-align: center; padding: 48px 16px; }
.soon h2 { margin: 0 0 8px; }

/* معالج إضافة شركة */
.steps { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; padding: 6px 12px 6px 6px; border-radius: 99px; background: #fff; border: 1px solid var(--line); }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #EEF2F1; font-weight: 600; }
.steps li.current { color: var(--ink); border-color: var(--brand); font-weight: 600; }
.steps li.current::before, .steps li.done::before { background: var(--brand); color: #fff; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.choice { text-align: start; font: inherit; color: inherit; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; display: grid; gap: 4px; }
.choice:hover { border-color: #9DB8B3; }
.choice[aria-pressed=true] { border-color: var(--brand); background: #F2F8F7; box-shadow: 0 0 0 1px var(--brand) inset; }
.choice b { font-size: 16px; }
.choice small { color: var(--muted); }
.summary { background: #F8FAF9; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; display: grid; gap: 4px; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; font: inherit; font-size: 13px; padding: 10px; border: 1px solid #C9D3D0; border-radius: 8px; background: #F8FAF9; min-width: 0; }
.alert.ok { background: #E6F1EF; color: var(--brand-dark); }
/* نموذج الفاتورة: الرجوع وزر الحفظ في رأسه، ثابتان أعلى الشاشة أثناء التمرير */
.form-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px; background: #fff; border: 1px solid var(--line, #E3E8E6); border-radius: 12px; box-shadow: 0 4px 14px rgba(16, 48, 44, .08); }
.form-top .back { margin: 0; }
.form-top .form-save .btn { min-width: 128px; }
.pill.trial { background: #E0ECFA; color: #1E3A8A; }
a.btn { display: inline-block; text-decoration: none; text-align: center; }
a.btn.block { display: block; }
a.btn:hover { color: #fff; }
/* الزر الفاتح رابطاً (فتح كنافذة): نصه يبقى داكناً عند المرور */
a.btn.light, a.btn.light:hover { color: var(--ink); }
a.btn.light:hover { color: var(--ink); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 12px; }

/* تفاصيل الشركة */
.back { font-size: 14px; }
.title { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta { margin: 0; font-size: 14px; }
.tabs [role=tab][aria-selected=true] { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs [role=tab] { font: inherit; font-size: 14px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 99px; padding: 6px 14px; cursor: pointer; }
.tab-body { display: grid; gap: 20px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.notes { width: 100%; font: inherit; padding: 10px; border: 1px solid #C9D3D0; border-radius: 8px; resize: vertical; }
.field input:disabled, .search:disabled, .notes:disabled { background: #F3F5F4; color: var(--muted); }
.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.module { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 6px; background: #fff; }
.module.changed { border-color: #F2D58A; background: #FFFBF0; }
.module .note { color: var(--muted); }
.module.changed .note { color: var(--warn); }
.switch-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.switch-row span { display: grid; gap: 2px; }
.switch-row small, .block { display: block; }
tr.changed td { background: #FFFBF0; }
.num { width: 110px; min-width: 0; }
.flash { font-size: 13px; padding: 4px 10px; border-radius: 6px; }
.flash.ok { background: #E6F1EF; color: var(--brand-dark); }
.flash.bad { background: var(--danger-bg); color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* فريق الإدارة */
.split { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.member-list { display: grid; gap: 6px; }
.member { text-align: start; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.member:hover { border-color: #9DB8B3; }
.member.current { border-color: var(--brand); background: #F2F8F7; box-shadow: 0 0 0 1px var(--brand) inset; }
.member small { color: var(--muted); }
.member .note { color: var(--warn); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
/* مفتاح ON / OFF للصلاحيات (بدل مربع الصح): مربع الاختيار نفسه بشكل مفتاح، فيبقى في النماذج والقراءة الصوتية (role="switch") */
.check.toggle { gap: 10px; }
.check.toggle input { appearance: none; -webkit-appearance: none; direction: ltr; position: relative; flex: none; width: 54px; height: 24px; margin: 0;
  border-radius: 999px; background: #A9B3AF; cursor: pointer; transition: background .15s; }
.check.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s; }
.check.toggle input::before { content: 'OFF'; position: absolute; top: 0; right: 7px; font: 700 10px/24px system-ui, sans-serif; letter-spacing: .3px; color: #fff; }
.check.toggle input:checked { background: var(--brand); }
.check.toggle input:checked::after { left: 33px; }
.check.toggle input:checked::before { content: 'ON'; right: auto; left: 8px; }
.check.toggle input:disabled { opacity: .45; cursor: not-allowed; }
.check.toggle input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.checks.toggles { gap: 10px 22px; }
/* حالة الصلاحية الفعلية للقراءة (عضو فريق المنصة: من الدور أو مخصصة له) */
.onoff { display: inline-block; flex: none; min-width: 44px; padding: 0 8px; border-radius: 999px; direction: ltr; text-align: center; font: 700 10px/22px system-ui, sans-serif; letter-spacing: .3px; color: #fff; background: #A9B3AF; }
.onoff.on { background: var(--brand); }
.label { font-weight: 600; font-size: 14px; }
.perm-group { margin-top: 14px; display: grid; gap: 6px; }
.perm-group h4 { margin: 0; font-size: 14px; color: var(--muted); }
.perm { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.perm.changed { background: #FFFBF0; }
.mark { font-weight: 700; text-align: center; }
.mark.yes { color: var(--brand); }
.mark.no { color: #9AA6A3; }
.small-select { min-width: 0; padding: 6px 8px; font-size: 13px; }

/* سجل النشاط */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.filters .search { min-width: 150px; }
/* البحث عن حساب ورقمه فوقه بجانب خانات التاريخ: الخانات كلها على سطر واحد من أسفلها، وبارتفاع واحد */
.filters:has(> .picker) { align-items: end; }
.filters > .picker .search, .filters > .dmy > .dmy-text, .filters > .st-field > .picker .search, .filters > .st-field > .dmy > .dmy-text { min-height: 44px; box-sizing: border-box; }
/* شريط فيه أسماء فوق الخانات (2026-11-13): الخانات والأزرار على سطر واحد من أسفلها */
.filters:has(> .st-field) { align-items: end; }
/* كشف الحساب (2026-11-09): خانة الحساب بعرض خانتي التاريخ؛ واسم كل خانة فوقها (2026-11-13) */
.st-filters { align-items: end; }
.st-field { display: flex; flex-direction: column; gap: 4px; max-width: 100%; min-width: 0; }
.st-field-name { color: var(--muted); font-size: 13px; font-weight: 600; }
.st-field.st-acc { width: 316px; }
/* التاريخان وعملة الكشف أصغر فيأتون مع الحساب و«عرض» في سطر واحد */
.st-field.st-day { width: 170px; }
.st-field > .picker, .st-field > .dmy, .st-field > .st-cur { width: 100%; min-width: 0; }
.st-field .picker .search, .st-field > .dmy > .dmy-text, .st-field > .st-cur { width: 100%; min-height: 44px; box-sizing: border-box; }
.st-filters > .btn { min-height: 44px; }
/* جدول أرصدة العملات في الكشف: كل عنوان فوق قيمته */
.st-curs th, .st-curs td { text-align: center; }
.st-curs th:first-child, .st-curs td:first-child { text-align: start; }
/* زر الترتيب في العنوان بعرض العمود ونصه في الوسط (كان بعرض 110px ونصه على اليمين فيبدو منحرفاً عن قيمته) */
.st-curs th:not(:first-child) .th-sort { width: 100%; justify-content: center; text-align: center; }
/* «اسم الحساب» ورقم الحساب على سطر واحد فوق الخانة: الاسم يميناً والرقم يساراً */
.st-field:has(> .picker) { position: relative; gap: 0; }
.st-field:has(> .picker) > .st-field-name { position: absolute; top: 0; inset-inline-start: 0; line-height: 20px; }
.st-field > .picker > .pick-meta { display: block; min-height: 20px; line-height: 20px; margin-bottom: 2px; text-align: left; direction: ltr; font-size: 13px; font-weight: 600; opacity: 1; }
.st-field-name { line-height: 20px; }
.log { display: grid; }
.log-row { border-bottom: 1px solid #EEF2F1; }
.log-head { width: 100%; font: inherit; color: inherit; text-align: start; background: none; border: 0; cursor: pointer; padding: 10px 6px;
  display: grid; grid-template-columns: 150px 70px minmax(100px, 160px) 1fr auto; gap: 10px; align-items: center; }
.log-head:hover { background: #F8FAF9; }
.log-detail { padding: 4px 12px 12px; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
@media (max-width: 820px) { .log-head { grid-template-columns: 1fr auto; } }
.alert.warn.row { display: flex; }

/* لوحة الشركة */
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick .btn { width: auto; }
.totals { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: flex-end; margin-top: 12px; }
.total { font-size: 18px; color: var(--brand); }
.group-row td { background: #F8FAF9; }
.member.done b { text-decoration: line-through; color: var(--muted); }
@media print { .side, .bar, .back, .actions, .btn { display: none !important; } .view { padding: 0; } }

/* الموظفون والدوام */
.bar-track { height: 8px; border-radius: 99px; background: #EEF2F1; overflow: hidden; margin: 8px 0 4px; }
.bar-fill { height: 100%; width: 0; background: var(--brand); border-radius: 99px; }

/* منشئ الوحدات */
.field-list { display: grid; gap: 8px; }
.field-item { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #FBFCFC; }
.field-row { display: grid; grid-template-columns: minmax(120px, 2fr) minmax(110px, 1.3fr) auto auto auto; gap: 8px; align-items: center; }
@media (max-width: 820px) { .field-row { grid-template-columns: 1fr 1fr; } }

.side-group { display: contents; }

.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }

/* الاختيار بالبحث: الرقم ومكانه في الشجرة بخط صغير هادئ فوق الاسم */
.picker { position: relative; display: grid; gap: 2px; min-width: 220px; }
.pick-meta { color: var(--muted); font-size: 11.5px; line-height: 1.3; letter-spacing: .2px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-list { position: absolute; inset-inline: 0; top: 100%; z-index: 30; margin: 4px 0 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 40, 36, .12); }
.pick-list li { display: grid; gap: 1px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.pick-list li.active, .pick-list li:hover { background: #EEF5F3; }
.pick-list li[aria-selected="true"] span { font-weight: 600; }
/* لوحة الكميات في سطر الفاتورة */
.stock-box { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #F7FAF9; display: grid; gap: 8px; font-size: 13px; }
.stock-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.stock-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.stock-list li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.stock-list li.current { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.stock-list .count { font-variant-numeric: tabular-nums; }

/* شجرة الحسابات */
.tree-name { display: flex; align-items: center; gap: 6px; padding-inline-start: calc(var(--depth, 0) * 22px); }
.tree-name[data-depth="1"] { --depth: 1; }
.tree-name[data-depth="2"] { --depth: 2; }
.tree-name[data-depth="3"] { --depth: 3; }
.tree-name[data-depth="4"] { --depth: 4; }
.tree-name[data-depth="5"] { --depth: 5; }
.tree-name[data-depth="6"] { --depth: 6; }
.tree-name[data-depth="7"] { --depth: 7; }
.tree-name[data-depth="8"] { --depth: 8; }
.tree-toggle { width: 22px; height: 22px; flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; border-radius: 6px; }
button.tree-toggle:hover { background: #EEF5F3; color: var(--brand); }
.pill.base { background: #EEF2F7; color: #3B4A63; font-size: 11px; }
/* بدل سمات style في الشاشات (سياسة المحتوى، B-admin-15) */
.pill.pill-ms { margin-inline-start: 8px; }
.fs-name[data-depth] { padding-inline-start: calc(12px + var(--depth, 0) * 18px); }
.fs-name[data-depth="1"] { --depth: 1; } .fs-name[data-depth="2"] { --depth: 2; } .fs-name[data-depth="3"] { --depth: 3; } .fs-name[data-depth="4"] { --depth: 4; }
.fs-name[data-depth="5"] { --depth: 5; } .fs-name[data-depth="6"] { --depth: 6; } .fs-name[data-depth="7"] { --depth: 7; } .fs-name[data-depth="8"] { --depth: 8; }
table.tree td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* إضافة الحسابات داخل الشجرة */
.row-add { margin-inline-start: 6px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--brand); font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s, transform .15s; }
table.tree tr:hover .row-add, .row-add:focus-visible { opacity: 1; }
.row-add:hover { background: var(--brand); color: #fff; border-color: var(--brand); transform: scale(1.08); }
@media (hover: none) { .row-add { opacity: 1; } }
tr.add-row td { background: #F2F8F7; border-bottom-color: #D7E7E3; vertical-align: top; }
tr.add-row .tree-name { flex-wrap: wrap; }
.add-code { width: 92px; font-variant-numeric: tabular-nums; }
.add-name { flex: 1; min-width: 200px; }
tr.add-row input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
tr.add-row input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: #E4EEEB; border-radius: 9px; }
.seg-btn { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg-btn.on { background: #fff; color: var(--brand-dark, var(--brand)); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 40, 36, .15); }
.add-hint, .add-error { font-size: 12px; margin-top: 6px; padding-inline-start: 28px; }
.add-hint { color: var(--muted); }
.add-error { color: var(--danger); }
.add-actions { display: flex; gap: 6px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 15px; color: var(--muted); }
.icon-btn.ok { background: var(--brand); border-color: var(--brand); color: #fff; }
.icon-btn:disabled { opacity: .5; cursor: wait; }
@keyframes just-added { from { background: #DDF1EA; } to { background: transparent; } }
tr.just-added td { animation: just-added 1.6s ease-out; }
.hint-line { margin: -6px 0 0; font-size: 13px; }

/* كشف الحساب على الشاشة بترتيب المطبوع: مربع الطرف والفترة، ثم الحركات وتحت الفاتورة أصنافها، وفي آخره المدين والدائن والرصيد */
/* مربع الحساب والفترة فوق «كشف المجموعة» (جدول بلا رأس مطبوع؛ كشف الحساب الواحد بلاه، رأسه فيه) */
.st-box { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; border: 1px solid var(--ink); border-radius: 4px; padding: 10px 16px; margin: 10px 0 12px; }
.st-box > div { display: grid; gap: 4px; }
/* «من تاريخ» و«إلى تاريخ» في عمودين: التاريخان يبدآن من النقطة نفسها (2026-11-09) */
.st-box > .st-dates { grid-template-columns: auto auto; column-gap: 10px; align-items: baseline; }
.st-box > .st-dates > div { display: contents; }
/* القيمة بجانب اسمها في عمود واحد: التواريخ (ltr) وعملة الكشف تبدأ من الحد نفسه */
.st-box > .st-dates b { text-align: right; }
/* «كم سعر تحويل العملة…؟»: 1 دولار = [السعر] دينار في سطر واحد */
.cr-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.cr-row > input { flex: 1; min-width: 0; }
/* «تحويل العملات» (كشاشة إتقان): الحسابان يميناً، والقيمة وفرق العملة والنتيجة وسطاً، والعملتان وقيمتاهما يساراً */
.xf-title { text-align: center; margin: 0 0 12px; }
/* كل صف بمحتوياته: من / إلى — الحساب، عملته، قيمتها، المبلغ — والأعمدة نفسها في الصفين */
.xf-row { display: grid; grid-template-columns: 44px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: end; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.xf-row-diff { border: 0; padding: 0 12px; }
/* صف العمولة مخفي كله حتى يُفعَّل «يوجد عمولة» */
.xf-row[hidden] { display: none; }
.xf-tag { align-self: center; font-weight: 700; color: var(--brand-dark); text-align: center; }
.xf-panel { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.xf-field { display: grid; gap: 4px; min-width: 0; }
/* الاسم فوق قيمته في الوسط، وحقل الحساب: الاسم مقابل رقم الحساب (مرة واحدة) */
.xf-label { display: flex; justify-content: center; gap: 8px; font-size: 13px; color: var(--muted); text-align: center; }
.xf-label.xf-acc { justify-content: space-between; }
.xf-code { color: var(--ink); font-weight: 600; }
.xf .picker > .pick-meta { display: none; }
.xf .xf-field > input, .xf .xf-field > select, .xf .xf-out { text-align: center; text-align-last: center; }
.xf .xf-field > input, .xf .xf-field > select, .xf .xf-field > textarea, .xf .xf-field > .picker, .xf .xf-field > div > .dmy, .xf .xf-field > div > .dmy > .dmy-text, .xf .xf-field .picker .search { width: 100%; max-width: none; min-width: 0; box-sizing: border-box; }
.xf-cur { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.xf-out { display: block; border: 1px solid var(--line); border-radius: 6px; padding: 8px; text-align: center; font-weight: 600; direction: ltr; min-height: 38px; }
.xf-hint { margin: 8px 0 0; }
.xf-bottom { margin-top: 12px; grid-template-columns: 220px 1fr; align-items: start; }
.xf-fee-toggle { align-self: center; }
.xf-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 12px; }
.xf-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; flex: 0 0 auto; min-width: 110px; }
@media (max-width: 760px) { .xf-row, .xf-bottom { grid-template-columns: 1fr; } .xf-row-diff > div:empty { display: none; } }

/* أزرار الطباعة والتصدير */
.export-bar { display: inline-flex; gap: 6px; }
.export-menu { position: relative; }
.export-menu summary { list-style: none; cursor: pointer; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 20; display: grid; gap: 4px; padding: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 40, 36, .12); min-width: 120px; }

/* المستند المطبوع: يُطبع وحده، بترتيب كشوفات إتقان. أنماطه (rp-) عامة لأن صفحات PDF تُرسم منها أيضاً */
#print-root { display: none; }
.rp-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rp-headcell { padding: 0 0 6px; border: 0; }
.rp-company { text-align: center; font-size: 24pt; font-weight: 800; letter-spacing: .5px; margin-bottom: 4mm; }
.rp-title { text-align: center; font-size: 14pt; margin-bottom: 4mm; }
.rp-box { display: flex; justify-content: space-between; gap: 10mm; border: 1.2px solid #000; padding: 4mm 6mm; }
/* رأس المطبوع: الأسماء في عمود والقيم في عمود يبدأ من الحد نفسه (اسم أطول لا يزيح قيمته) */
.rp-pairs { display: grid; gap: 2mm 4mm; grid-template-columns: max-content minmax(0, auto); justify-content: start; align-items: baseline; }
.rp-pair { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
@supports not (grid-template-columns: subgrid) { .rp-pair { display: flex; gap: 4mm; } }
.rp-label { color: #222; }
.rp-value { font-weight: 600; }
.rp-meta { display: flex; justify-content: space-between; font-size: 8pt; color: #333; margin-top: 2mm; }
.rp-printed { direction: ltr; }
.rp-cols th { background: #f2f2f2; font-weight: 600; padding: 2mm; border-bottom: 1px solid #bbb; text-align: start; }
.rp-table td { padding: 1.6mm 2mm; border-bottom: 1px solid #d5d5d5; vertical-align: middle; }
/* الأرقام من اليسار لليمين كما في كشوفات إتقان: «1431.00 -» */
.rp-table .num, .rp-sumval { text-align: center; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.rp-subhead td { background: #f6f6f6; font-weight: 600; font-size: 9.5pt; }
.rp-sub td { font-size: 9.5pt; color: #333; }
.rp-sub td:first-child { padding-inline-start: 6mm; }
.rp-gap td { border: 0; height: 4mm; }
/* سطر «المجموع» مضللاً في المطبوع (كشف المجموعة) */
.rp-sumrow td { background: #ececec; font-weight: 700; border-top: 1.2px solid #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rp-main, .rp-subhead, .rp-sub { break-inside: avoid; }
.rp-summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 6mm; margin-top: 5mm; break-inside: avoid; }
/* المربعات يساراً تحت عمود الرصيد، ومربعات «side» يميناً: الاسم بجانب مربعه، بعضها تحت بعض (كإتقان) */
.rp-sums { display: flex; gap: 6mm; margin-inline-start: auto; }
.rp-side { display: grid; grid-template-columns: auto auto; gap: 2mm 4mm; align-items: center; }
/* عمود في الوسط باسمه وقيمه (تاريخ الكشف ووحدة الصنف تحته) */
.rp-table .ctr { text-align: center; white-space: nowrap; }
.rp-sum { display: grid; text-align: center; gap: 1mm; }
.rp-sumval { border: 1.2px solid #000; padding: 1.5mm 5mm; min-width: 28mm; }
.rp-signs { display: flex; justify-content: space-around; margin-top: 18mm; break-inside: avoid; }
.rp-sign { border-top: 1px solid #000; padding-top: 2mm; min-width: 50mm; text-align: center; }
.rp-notes { margin-top: 8mm; font-size: 10pt; color: #333; break-inside: avoid; }
/* سندات القبض والصرف والقيد كإتقان (2026-11-13): خطوط كل الخلايا، ومجموع القيد في مربع تحت عموده */
.rp-grid .rp-cols th, .rp-grid td:not(.rp-headcell) { border: 1px solid #c8c8c8; text-align: center; }
.rp-grid .rp-total td { border: 0; padding-top: 2.5mm; }
.rp-grid .rp-total td.rp-boxed { border: 0; }
.rp-total td.rp-total-label { text-align: end; font-weight: 600; }
/* والفاتورة (بلا خطوط الخلايا): مجموع الكمية والمبالغ في مربعين تحت عموديهما */
.rp-total td { border: 0; padding-top: 2.5mm; }
.rp-total td.rp-boxed { border: 0; padding: 2.5mm 0 0; }
/* مربع المجموع بحدوده الأربعة (2026-11-13) */
.rp-boxv { display: block; border: 1.2px solid #000; padding: 1.5mm 2mm; text-align: center; }
.rp-vfoot { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; margin-top: 2mm; break-inside: avoid; }
.rp-vnote { display: flex; gap: 3mm; flex: 1; padding-top: 1mm; }
.rp-vnote-text { white-space: pre-wrap; }
.rp-vbox { border-collapse: collapse; width: 48%; table-layout: fixed; }
.rp-vbox th { background: #f2f2f2; font-weight: 400; border: 1px solid #c8c8c8; padding: 1.5mm 2mm; }
.rp-vbox td { border: 1px solid #c8c8c8; padding: 1.5mm 2mm; text-align: center; direction: ltr; }
.rp-stamp { margin-top: 10mm; text-align: left; padding-left: 30mm; break-inside: avoid; }
/* أصناف الفاتورة في «كشف الفواتير - مفصل»: عنوانها رمادي وأرقامها في الوسط */
.rp-subhead td:not(:first-child), .rp-sub td:not(:first-child) { text-align: center; }
.rp-subhead td { font-weight: 400; }
.rp-note { margin: 2mm 0; white-space: pre-wrap; }
.rp-logo img { max-height: 26mm; max-width: 120mm; }
/* معاينة قبل الطباعة (2026-11-13): صفحات المستند وحدها على خلفية رمادية كعارض PDF، وشريط بالعنوان و«طباعة» و«PDF» و«إغلاق» */
.rp-preview { position: fixed; inset: 0; width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #525659; color: var(--text); }
.rp-preview[open] { display: flex; flex-direction: column; }
.rp-preview::backdrop { background: rgba(0, 0, 0, .55); }
.rp-preview-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rp-preview-count { color: var(--muted); font-size: 13px; }
.rp-preview-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.rp-preview-pages { flex: 1; overflow: auto; padding: 16px 12px 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.rp-preview-pages .rp-page { flex: none; box-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
/* صفحة PDF: عرض A4 بالبكسل (96 نقطة في البوصة) بهوامش الطباعة نفسها */
.rp-page { width: 794px; height: 1123px; box-sizing: border-box; padding: 45px 38px 40px; background: #fff; color: #000;
  font: 10.5pt/1.45 Arial, "Segoe UI", sans-serif; position: relative; overflow: hidden; }
@media print {
  @page { size: A4; margin: 12mm 10mm 14mm; @bottom-center { content: "صفحة " counter(page) " من " counter(pages); font: 9pt Arial, sans-serif; color: #555; } }
  body.printing { background: #fff !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; color: #000; font: 10.5pt/1.45 Arial, "Segoe UI", sans-serif; }
}

/* هوية المطبوعات */
.brand-drop { border: 1.5px dashed #B9CFCA; border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; background: #FAFCFB; transition: border-color .15s, background .15s; }
.brand-drop:hover, .brand-drop:focus-visible, .brand-drop.over { border-color: var(--brand); background: #F2F8F7; outline: none; }
.brand-drop-empty, .brand-drop-has { display: grid; gap: 6px; justify-items: center; }
.brand-drop img { max-height: 90px; max-width: 100%; }
.brand-preview { border: 1px solid var(--line); border-radius: 10px; padding: 22px 18px; background: #fff; display: grid; gap: 10px; justify-items: center; color: #000; }
.brand-preview img { max-height: 90px; max-width: 100%; }
.brand-name { font-size: 26px; font-weight: 800; text-align: center; }
.brand-title { font-size: 16px; }
.brand-box { width: 100%; display: flex; justify-content: space-between; border: 1px solid #000; padding: 8px 12px; font-size: 13px; color: #333; }

/* مخزن السطر في الفاتورة */
.line-wh { min-width: 150px; }
td.short { color: var(--danger); font-weight: 700; }

/* شجرة الأصناف وحركاتها */
tr.add-row .add-unit { min-width: 90px; }
tr.add-row .add-cost { width: 100px; }
table.moves td.in { color: var(--brand); font-weight: 600; }
table.moves td.out { color: #9A3412; font-weight: 600; }
table.moves td.num, table.tree td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat.bad b { color: var(--danger); }

/* «+ إضافة» في نتائج البحث، والنافذة المنبثقة */
.pick-list li.pick-create { color: var(--brand); border-top: 1px dashed var(--line); margin-top: 2px; }
.pick-list li.pick-create.active, .pick-list li.pick-create:hover { background: #E6F1EF; }
dialog.modal { border: 0; border-radius: 14px; padding: 22px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(15, 40, 36, .25); color: inherit; }
dialog.modal::backdrop { background: rgba(16, 48, 44, .45); }
dialog.modal h3 { margin: 0 0 6px; }
/* نافذة التأكيد والتنبيه (confirmBox / alertBox / promptBox) بدل نوافذ المتصفح */
dialog.msg-box { width: min(440px, calc(100vw - 32px)); }
.msg-box-title { margin: 0 0 8px; font-size: 17px; }
.msg-box-text { margin: 0 0 14px; font-size: 15.5px; line-height: 1.8; white-space: pre-line; }
.msg-box input { width: 100%; margin-bottom: 4px; }
.msg-box-actions { justify-content: flex-start; gap: 8px; }
dialog.modal .row { justify-content: flex-end; gap: 8px; }

/* الفاتورة: ✕ في أول السطر، والخانات المعطلة حتى اختيار الصنف */
table.inv-lines td.line-del { width: 28px; padding-inline: 4px; }
table.inv-lines td.line-del .link { font-size: 15px; color: var(--muted); }
table.inv-lines td.line-del .link:hover { color: var(--danger); }
table.inv-lines input:disabled, table.inv-lines select:disabled { background: #F6F8F7; }

/* نافذة الصنف الجديد: أربع خانات متساوية */
dialog.modal .grid2.quad { grid-template-columns: 1fr 1fr; gap: 14px 16px; }
@media (max-width: 520px) { dialog.modal .grid2.quad { grid-template-columns: 1fr; } }

/* الوصول السريع */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-w, 150px), 1fr)); grid-auto-rows: minmax(var(--tile-h, 96px), auto); grid-auto-flow: dense; gap: 10px; margin-top: 12px; }
.tile { position: relative; display: grid; align-content: space-between; gap: 6px; min-height: 84px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: inherit; text-decoration: none; border-inline-start: 4px solid var(--accent, var(--brand));
  transition: transform .12s, box-shadow .12s, border-color .12s; text-align: start; font: inherit; cursor: pointer; }
a.tile:hover, a.tile:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 40, 36, .10); outline: none; border-color: var(--accent, var(--brand)); }
.tile b { font-size: 15px; }
.tile-group { color: var(--muted); font-size: 11px; }
.tile-soon { position: absolute; top: 8px; inset-inline-end: 8px; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: #F1F3F2; color: var(--muted); }
.tiles.editing .tile { cursor: grab; border-style: dashed; border-inline-start-style: solid; }
.tile.dragging { opacity: .45; }
.tile.over { box-shadow: 0 0 0 2px var(--accent, var(--brand)) inset; }
.tile-tools { display: flex; gap: 4px; }
.tile-tools button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; color: var(--muted); }
.tile-tools button:disabled { opacity: .35; cursor: default; }
.tile-tools .del:hover { color: var(--danger); border-color: var(--danger); }
.tile-add { border-style: dashed; place-content: center; text-align: center; color: var(--brand); border-inline-start-width: 1px; }
.tile-pool { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; border-inline-start: 3px solid var(--accent, var(--brand)); }
.g-cash { --accent: #0B5D55; } .g-inv { --accent: #2563EB; } .g-items { --accent: #B45309; } .g-cheques { --accent: #7C3AED; }
.g-reports { --accent: #0E7490; } .g-setup { --accent: #64748B; } .g-tools { --accent: #BE185D; }

/* الوصول السريع: الأحجام والرموز والسحب */
.tiles.size-s { --tile-w: 118px; --tile-h: 78px; }
/* عدد أعمدة يختاره المستخدم؛ على الهاتف يعود تلقائياً كي لا تضيق الأزرار */
.tiles.fixed-cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
@media (max-width: 600px) { .tiles.fixed-cols { grid-template-columns: repeat(auto-fill, minmax(var(--tile-w, 150px), 1fr)); } }
.tiles.size-s .tile b { font-size: 13px; }
.tiles.size-l { --tile-w: 190px; --tile-h: 120px; }
.tiles.size-l .tile b { font-size: 17px; }
.tile.span-w { grid-column: span 2; }
.tile.span-l { grid-column: span 2; grid-row: span 2; }
.tile.span-l b { font-size: 19px; }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-icon { color: var(--accent, var(--brand)); flex: none; }
.tile-badges { position: absolute; bottom: 8px; inset-inline-end: 8px; display: flex; gap: 4px; }
.tile-badges .tile-soon { position: static; }
.tiles.editing .tile { touch-action: none; user-select: none; }
.tile.dragging { opacity: .85; z-index: 5; box-shadow: 0 14px 30px rgba(15, 40, 36, .22); transition: none; cursor: grabbing; }
.tile.over { box-shadow: 0 0 0 2px var(--accent, var(--brand)) inset; background: #F6FAF9; }
.tile-tools button.on { color: #fff; background: var(--brand); border-color: var(--brand); }
.g-custom { --accent: #0F766E; }
.size-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.icon-pick button { height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.icon-pick button.on { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: #F2F8F7; }
/* شاشة في نافذة منبثقة */
dialog.screen-popup { width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; }
dialog.screen-popup.screen-wide { width: min(1240px, calc(100vw - 32px)); }
.screen-popup-head { position: sticky; top: 0; background: var(--card); padding: 14px 18px; border-bottom: 1px solid var(--line); z-index: 2; }
.screen-popup-head h3 { margin: 0; }
.screen-popup-body { padding: 16px 18px; display: grid; gap: 16px; }

/* ألوان الوصول السريع بحسب سيكولوجية الألوان: درجات هادئة غير مشبعة، لكل مجموعة لون يناسب معناها
   الصندوق: أخضر مريمي (المال والأمان) · الفواتير: أزرق هادئ (الثقة) · الأصناف: مغرة ترابية (الثبات والملموس)
   الشيكات: نيلي خافت (الجدية) · التقارير: فيروزي ناعم (الوضوح والتركيز) · التعريفات: رمادي مزرق (حياد)
   الأدوات: تراكوتا لطيف (الدفء دون إثارة) · الخدمة الخاصة: فيروزي عميق */
.g-cash { --accent: #3F7D62; } .g-inv { --accent: #4A6FA5; } .g-items { --accent: #A0773A; } .g-cheques { --accent: #6466A3; }
.g-reports { --accent: #3D8088; } .g-setup { --accent: #6B7C8F; } .g-tools { --accent: #B26A4E; } .g-custom { --accent: #3A7470; }
.tile { border-inline-start-width: 3px; border-color: #E6EBE9; box-shadow: 0 1px 2px rgba(20, 45, 40, .04); }
.tile .tile-icon { box-sizing: content-box; padding: 7px; border-radius: 11px; background: color-mix(in srgb, var(--accent, var(--brand)) 11%, #fff); }
a.tile:hover, a.tile:focus-visible { background: color-mix(in srgb, var(--accent, var(--brand)) 4%, #fff); box-shadow: 0 6px 16px rgba(20, 45, 40, .08); }
.tile b { color: #23332F; font-weight: 600; }
.tile-group { color: #8A9893; }
.tile-soon { background: #F3F4F1; color: #8A9893; font-weight: 500; }
.chip { border-inline-start-color: var(--accent, var(--brand)); }
.tile { border-inline-start-color: color-mix(in srgb, var(--accent, var(--brand)) 60%, #fff); }

/* تقارير الأرباح */
td.neg, td.neg b { color: var(--danger); }
tr.return-row td { background: #FBF7F5; }

/* سند القيد: المجاميع والتوازن */
.j-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }

/* سند القيد بترتيب إتقان */
.j-head { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1.3fr 1.5fr; gap: 0 14px; align-items: end; }
@media (max-width: 900px) { .j-head { grid-template-columns: 1fr 1fr; } }
.j-lines td.line-no { width: 34px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.j-lines input[aria-label="مدين"], .j-lines input[aria-label="دائن"] { width: 130px; }
.j-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.j-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.j-sum { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.j-sum label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.j-total { min-width: 120px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #FAFBFA; color: var(--ink, #1f2d2a);
  font-size: 15px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; direction: ltr; }
.j-head .field { min-width: 0; }
.j-head .field input, .j-head .field select { width: 100%; box-sizing: border-box; }

/* صلاحيات الموظف */
.access-add { max-width: 420px; }
.access-table td.center, .access-table th { text-align: center; }
.access-table td:first-child, .access-table th:first-child { text-align: start; }
.access-table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }

/* «تذكّرني» في صفحات الدخول */
.remember { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 16px; font-size: 14px; color: var(--muted, #5b6b69); }

/* أدوار جاهزة في شاشة المستخدمين */
.role-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 10px; }
.role-template { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.role-template p { margin: 0; font-size: 14px; }
.role-template small { font-size: 12px; line-height: 1.6; }
.role-template .btn { align-self: flex-start; margin-top: auto; }

/* وظيفة الموظف في خيارات الموظفين */
.job-title { display: flex; align-items: flex-end; gap: 12px; margin: 6px 0 14px; }
.job-title .field { flex: 1; max-width: 360px; margin: 0; }
/* داخل خانة النموذج يأخذ البحث والقائمة عرض الخانة لا حداً أدنى ثابتاً (يكسر الشاشات الضيقة) */
.field .search, .field .picker { min-width: 0; }
@media (max-width: 520px) { .search { min-width: 0; max-width: 100%; } }

/* ── التبويبات: عدة شاشات مفتوحة معاً ── */
.view { display: block; }
.view > .tab-pane { display: grid; gap: 20px; align-content: start; outline: none; }
.view > .tab-pane[hidden] { display: none; }
.tab-pane > * { min-width: 0; }
.tabbar { display: flex; align-items: flex-end; gap: 4px; padding: 8px 28px 0; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tab { display: flex; align-items: center; flex: 0 1 220px; min-width: 110px; background: #E8EEEC; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; }
.tab.on { background: #fff; position: relative; top: 1px; }
.tab-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; cursor: pointer; text-align: start; }
.tab.on .tab-main { color: var(--ink); font-weight: 600; }
.tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.tab-x { flex: none; width: 26px; height: 26px; margin-inline-end: 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.tab-x:hover { background: #DCE5E2; color: var(--ink); }
.tab-new { flex: none; width: 34px; height: 34px; margin-bottom: 4px; border: 1px dashed #B8C6C2; border-radius: 8px; background: none; color: var(--brand); font-size: 20px; cursor: pointer; }
.tab-new:hover { background: #fff; }
@media (max-width: 900px) {
  .tabbar { padding: 6px 10px 0; }
  .tabbar.single { display: none; }
  .tab { min-width: 96px; }
  .view > .tab-pane { gap: 14px; }
}

/* زر البحث الشامل في الشريط العلوي */
.search-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; margin-inline-start: auto; }
.search-btn:hover { border-color: #B8C6C2; color: var(--ink); }
.search-btn kbd { font: 12px/1 inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); direction: ltr; }
@media (max-width: 900px) { .search-btn kbd, .search-btn-text { display: none; } .search-btn { padding: 0; width: 42px; height: 42px; justify-content: center; font-size: 20px; } }

/* نافذة البحث الشامل */
dialog.gsearch { width: min(640px, 94vw); padding: 0; margin-top: 10vh; overflow: hidden; }
dialog.gsearch > .search { width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 17px; outline: none; min-width: 0; }
.gs-list { list-style: none; margin: 0; padding: 6px; max-height: min(60vh, 520px); overflow-y: auto; }
.gs-list li[role=option] { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.gs-list li[role=option].active { background: #E6F1EF; }
.gs-list li small { font-size: 12px; }
.gs-group { padding: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--gold); }
.gs-list li.muted { padding: 14px 12px; }

/* قائمة الاختصارات */
dialog.keys-help { width: min(760px, 94vw); }
.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-top: 8px; }
.keys-grid h4 { margin: 0 0 8px; color: var(--brand); }
.keys-grid dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; align-items: center; }
.keys-grid dt { white-space: nowrap; direction: ltr; text-align: end; }
.keys-grid dd { margin: 0; }
kbd { display: inline-block; font: 12px/1.4 ui-monospace, Consolas, monospace; padding: 2px 7px; border: 1px solid #C9D3D0; border-bottom-width: 2px; border-radius: 6px; background: #fff; }

/* المسودات غير المحفوظة ورسالة سريعة */
.draft-bar { display: grid; gap: 8px; }
.draft-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
/* نسخة جديدة منشورة: شريط ثابت أعلى الصفحة يطلب التحديث (collect.js: checkVersion) */
.update-bar { position: fixed; top: 12px; inset-inline-start: 50%; transform: translateX(50%); z-index: 95; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px); box-sizing: border-box; background: var(--gold); color: var(--ink); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
/* وضع الصيانة (لوحة مسؤول المنصة): شاشة كاملة فوق الصفحة في لوحة الشركة، وبطاقة المفتاح في إعدادات المنصة */
.maintenance-screen { position: fixed; inset: 0; z-index: 200; background: var(--bg, #F6F8F7); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.maintenance-screen h2 { margin: 0; color: var(--brand); }
.maintenance-screen p { margin: 0; max-width: 520px; font-size: 17px; line-height: 1.7; }
.maint-card.maint-on { border: 2px solid var(--gold); background: #FFF8E6; }
.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); z-index: 90; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
@media print { .tabbar, .search-btn, .toast { display: none !important; } }

/* ── القائمة الجانبية: أيقونات وطيّ ── */
.side a { display: flex; align-items: center; gap: 10px; }
.side a .tile-icon { flex: none; opacity: .85; }
.side-brand { display: flex; align-items: center; gap: 10px; }
.side-toggle { margin-inline-start: auto; width: 30px; height: 30px; border: 1px solid #2A5A54; border-radius: 8px; background: none; color: #D7E5E2; cursor: pointer; font-size: 13px; letter-spacing: -2px; }
.side-toggle:hover { background: #1B4540; color: #fff; }
@media (max-width: 900px) { .side-toggle { display: none; } }
@media (min-width: 901px) {
  body.side-mini .side { flex: 0 0 68px; max-width: 68px; padding-inline: 10px; }
  body.side-mini .side .side-text, body.side-mini .side-brand > div, body.side-mini .side-label { display: none; }
  body.side-mini .side-brand { flex-direction: column; padding-inline: 0; }
  body.side-mini .side-toggle { margin: 0; }
  body.side-mini .side a { justify-content: center; padding: 10px 0; }
}

/* ── الجدول الموحد ── */
.dt-box { display: grid; gap: 8px; }
.dt-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dt-tools .actions { align-items: center; }
.small-select { min-width: 0; padding: 6px 8px; font-size: 13px; }
.th-sort { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.th-sort:hover { color: var(--brand); }
/* كل الجداول (2026-11-13، بطلب صاحب النظام: «الأسماء مع القيم في كل الكشوفات»): العمود الرقمي عنوانه وقيمه ومجموعه في وسطه،
   وزر الترتيب بعرض العمود (كان بعرض 110px ونصه في بدايته فيبدو العنوان منحرفاً عن قيمه) */
th.num-col, td.num-col { text-align: center; }
th.num-col > .th-sort { width: 100%; justify-content: center; }
.th-arrow { font-size: 10px; color: var(--brand); }
.dt-filters th { padding-top: 0; }
.dt-filter { width: 100%; min-width: 60px; padding: 5px 8px; font-size: 13px; box-sizing: border-box; }
.dt-cols { position: relative; }
.dt-cols > summary { list-style: none; cursor: pointer; }
.dt-cols > summary::-webkit-details-marker { display: none; }
.dt-cols-list { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; min-width: 170px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.dt tfoot td { font-weight: 700; background: #F3F7F6; border-top: 2px solid var(--line); }
.dt-pager { display: flex; gap: 10px; align-items: center; justify-content: center; }
@media (min-width: 901px) {
  .dt-scroll { max-height: calc(100vh - 240px); overflow: auto; }
  .dt thead th { position: sticky; top: 0; z-index: 2; background: #fff; }
  .dt tfoot td { position: sticky; bottom: 0; z-index: 2; }
}

/* ── القائمة والتفاصيل جنباً إلى جنب ── */
.split-view { display: grid; gap: 16px; }
.split-panel .back { display: none; }
.split-head { margin-bottom: 8px; }
.split-head h3 { margin: 0; }
.split-body { display: grid; gap: 14px; }
.split-body .card { border: 0; padding: 0; }
@media (min-width: 1200px) {
  .split-view.open { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .split-view.open .split-panel { position: sticky; top: 12px; max-height: calc(100vh - 140px); overflow: auto; }
  .split-view tbody tr:has(a[href^="#/"]) { cursor: pointer; }
  .split-view tbody tr.selected td { background: #E6F1EF; }
}
@media (max-width: 1199px) { .split-view .split-panel { display: none; } }

/* ── لوحات الرئيسية ── */
.home-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.home-panel h3 { margin: 0; font-size: 16px; }
.kv-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
.kv-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.kv-list li:first-child { border-top: 0; }
.kv-list a { color: var(--ink); text-decoration: none; min-width: 0; }
.kv-list a:hover { color: var(--brand); }
.kv-list li.neg b { color: var(--danger); }
.kv-list b { white-space: nowrap; direction: ltr; }

/* ── جرس التنبيهات ── */
.bell { position: relative; }
.bell-btn { position: relative; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; }
.bell-btn .tile-icon { width: 20px; height: 20px; }
.bell-badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.bell-badge[hidden] { display: none; }
.bell-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 70; width: min(360px, 92vw); max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.16); }
.bell-panel[hidden] { display: none; }
.bell-head { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bell-list { list-style: none; margin: 0; padding: 6px; }
.bell-list a { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.bell-list a:hover { background: #F3F7F6; }
.bell-list a.urgent .tile-icon { color: var(--danger); }
.bell-text { display: grid; gap: 2px; min-width: 0; }
.bell-text small { color: var(--muted); font-size: 12px; }
.bell-empty { padding: 18px 14px; margin: 0; }
@media (max-width: 900px) { .bell-panel { position: fixed; top: 60px; inset-inline: 8px; width: auto; } }
@media print { .bell, .side-toggle, .dt-tools, .dt-pager, .dt-filters { display: none !important; } }
.bar .bell { margin-inline-start: auto; }
.bar .bell + .search-btn { margin-inline-start: 0; }

/* شاشات التعريف */
.branch-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.small-input { min-width: 0; width: 120px; padding: 5px 8px; font-size: 13px; }

/* مطابقة الكميات */
td.pos { color: var(--brand); font-weight: 600; }
td.neg { color: var(--danger); font-weight: 600; }

/* تفاصيل أمر الصيانة */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ── زر المستخدم في الشريط العلوي وقائمته ── */
.bar-user { position: relative; color: inherit; font-size: inherit; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); }
.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: #B8C6C2; background: #F8FAF9; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.avatar.big { width: 44px; height: 44px; font-size: 16px; }
.user-meta { display: grid; line-height: 1.25; text-align: start; }
.user-meta b { font-size: 14px; font-weight: 600; }
.user-meta small { font-size: 12px; color: var(--muted); }
.chev { color: var(--muted); font-size: 11px; }
.user-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 70; width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.16); padding: 8px; }
.user-menu[hidden] { display: none; }
.user-menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); }
.user-menu-head div { display: grid; }
.user-menu-head small { color: var(--muted); font-size: 12px; }
.user-menu-plan { display: flex; align-items: baseline; gap: 8px; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.user-menu-plan:empty { display: none; }
.user-menu-item { display: block; width: 100%; text-align: start; padding: 10px 8px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.user-menu-item:hover { background: #F3F7F6; }
.user-menu-item.danger { color: var(--danger); }
@media (max-width: 900px) {
  .bar-user { width: auto; }
  .user-meta, .chev { display: none; }
  .user-chip { padding: 3px; }
}

/* المرفقات */
.attachments.drop { outline: 2px dashed var(--brand); outline-offset: -6px; background: #F3F7F6; }
.att-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.att-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.att-list .att-name { font-weight: 600; text-align: start; }
.att-list small { margin-inline-start: auto; }

/* إعداد التحقق بخطوتين */
.steps-list { display: grid; gap: 14px; padding-inline-start: 20px; margin: 0; }
.steps-list li { display: grid; gap: 8px; }
.secret-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secret-box code { font: 600 16px/1.4 ui-monospace, Consolas, monospace; letter-spacing: 1px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; word-break: break-all; }
.recovery-codes { font: 15px/1.9 ui-monospace, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 0; columns: 2; }

/* مطابقة كشف البنك */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.rec-grid h3 { margin: 0 0 8px; }
.rec-grid tr.selected td { background: #E6F1EF; }
@media (max-width: 900px) { .rec-grid { grid-template-columns: 1fr; } }

/* قوائم الأسعار */
.price-in { max-width: 140px; }
.price-in.saved { border-color: var(--brand); box-shadow: 0 0 0 2px #CFE6E2; }

/* الرسائل القصيرة */
.sms-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; max-height: 260px; overflow-y: auto; margin-top: 8px; padding: 4px; }
.sms-preview { display: grid; gap: 8px; margin-top: 10px; }
.sms-bubble { background: #E6F1EF; border-radius: 14px 14px 4px 14px; padding: 8px 12px; max-width: 420px; display: grid; gap: 2px; }
textarea { font: inherit; line-height: 1.6; }
.sms-list small { margin-inline-start: 8px; }

/* نقطة البيع: عمودان (السلة والأصناف، ولوحة الدفع ثابتة)، وأزرار كبيرة تناسب اللمس */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.pos-main { display: grid; gap: 14px; min-width: 0; }
.pos-scan .search { font-size: 1.15rem; padding: 12px 14px; }
.pos-table { max-height: 46vh; overflow: auto; margin-top: 8px; }
.pos-lines .dt td { vertical-align: middle; }
.pos-lines .dt input.search { width: 96px; padding: 8px; font-size: 1rem; }
.pos-qty { display: flex; align-items: center; gap: 6px; }
.pos-qty input.search { width: 64px !important; text-align: center; }
.pos-step { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 1.15rem; line-height: 1; cursor: pointer; color: var(--ink); }
.pos-step:hover { border-color: var(--brand); color: var(--brand); }
.pos-step.danger:hover { border-color: var(--danger); color: var(--danger); }
.pos-line-total { font-weight: 700; white-space: nowrap; }
.pos-empty { padding: 28px 0 !important; }
.pos-last { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: #EAF5F2; color: var(--brand-dark); font-size: 15px; }
.pos-last.saving { background: #F3F5F4; color: var(--muted); }
.pos-last b { font-size: 17px; }
.pos-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; max-height: 30vh; overflow: auto; }
.pos-tile { display: grid; gap: 2px; text-align: start; padding: 10px 12px; min-height: 64px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); }
.pos-tile:hover, .pos-tile:focus-visible { border-color: var(--brand); background: #F2F8F7; }
.pos-tile:active { transform: scale(.98); }
.pos-tile span { font-weight: 600; font-size: 14px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pos-tile small { color: var(--muted); }
/* أنظمة نقطة البيع (159): أقسام الأصناف، وشريط المطعم، ونافذة الوزن، والطاولات */
.pos-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: thin; }
.pos-cats:empty { display: none; }
.pos-cat { flex: none; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.pos-cat[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.pos-order { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.pos-order-types { display: inline-flex; gap: 4px; }
.pos-order .btn { display: inline-flex; align-items: center; gap: 6px; }
.pos-delivery-fee { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.pos-delivery-fee input { width: 90px; }
.pos-order-types .btn[aria-pressed="true"], .pos-weight-mode .btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.pos-weight { width: min(360px, calc(100vw - 32px)); }
.pos-weight-mode { justify-content: flex-start; margin-bottom: 8px; }
.pos-weight-in { width: 100%; font-size: 28px; text-align: center; }
.pos-weight-eq { min-height: 22px; margin: 6px 0; text-align: center; }
.pos-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pos-keypad .btn { min-height: 52px; font-size: 22px; }
.pos-tables-dlg { width: min(640px, calc(100vw - 32px)); }
.pos-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; max-height: 60vh; overflow: auto; }
.pos-table-btn { display: grid; gap: 2px; place-items: center; min-height: 72px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; }
.pos-table-btn b { font-size: 22px; }
.pos-table-btn small { color: var(--muted); }
.pos-table-btn.busy { background: #FFF4E0; border-color: #F5B748; }
.pos-table-btn.current { outline: 3px solid var(--brand); outline-offset: 1px; }
.pos-side { position: sticky; top: 12px; display: grid; gap: 10px; }
.pos-total { white-space: nowrap; font-size: 2.6rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.pos-paid { font-size: 1.5rem; padding: 10px 12px; }
.pos-cash-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pos-cash { padding: 10px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.pos-cash:hover { border-color: var(--brand); color: var(--brand); }
.pos-change { font-size: 1.3rem; font-weight: 700; min-height: 1.4em; color: var(--brand-dark); }
.pos-change.neg { color: var(--danger); }
.pos-actions { display: grid; gap: 8px; }
.pos-actions .btn { width: 100%; justify-content: center; }
.pos-pay { min-height: 56px; font-size: 1.1rem; display: flex; gap: 10px; align-items: center; }
.pos-pay small { opacity: .7; font-size: 12px; border: 1px solid currentColor; border-radius: 6px; padding: 0 6px; }
.pos-settings summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.center { text-align: center; }
@media (max-width: 900px) { .pos { grid-template-columns: 1fr; } .pos-side { position: static; } .pos-table { max-height: none; } }
/* الإيصال الحراري: صفحة باسمها بعرض 80 مم، تُطبع من الصفحة نفسها */
@page receipt { size: auto; margin: 2mm; @bottom-center { content: none; } }
#print-root.receipt { page: receipt; width: 74mm; margin: 0 auto; font: 11pt/1.45 Tahoma, Arial, sans-serif; color: #000; }
#print-root.receipt hr { border: 0; border-top: 1px dashed #000; margin: 1.5mm 0; }
.rc-logo { display: block; margin: 0 auto 1mm; max-width: 40mm; max-height: 20mm; }
.rc-title { font-size: 14pt; font-weight: 700; text-align: center; }
.rc-c { text-align: center; font-size: 9pt; }
.rc-row { display: flex; justify-content: space-between; gap: 4mm; }
.rc-n { direction: ltr; white-space: nowrap; }
.rc-sub { font-size: 9.5pt; padding-bottom: 1mm; }
.rc-big { font-size: 13pt; font-weight: 700; }
.rc-foot { text-align: center; margin-top: 3mm; font-size: 10pt; }
@media print { body.printing-receipt #print-root.receipt { display: block; font: 11pt/1.45 Tahoma, Arial, sans-serif; } }
/* طباعة الشيك الصادر على نموذج الشيك (175×80 مم): التاريخ والمستفيد والمبلغ بالأرقام وبالحروف في مواضعها المعتادة */
@page cheque { size: 175mm 80mm; margin: 0; @bottom-center { content: none; } }
#print-root.cheque-form { page: cheque; position: relative; width: 175mm; height: 80mm; font: 11pt/1.3 Tahoma, Arial, sans-serif; color: #000; }
.cheque-form > div { position: absolute; }
.cf-date { top: 9mm; left: 14mm; direction: ltr; letter-spacing: 1px; }
.cf-payee { top: 25mm; right: 32mm; width: 110mm; }
.cf-figures { top: 24mm; left: 12mm; direction: ltr; font-weight: 700; }
.cf-words { top: 35mm; right: 24mm; width: 118mm; line-height: 7mm; }
@media print { body.printing-cheque #print-root.cheque-form { display: block; font: 11pt/1.3 Tahoma, Arial, sans-serif; } }

/* الرسوم البيانية: سلسلة واحدة بلون العلامة، الشبكة والمحاور خافتة، والنصوص بلون النص لا بلون السلسلة */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.chart-grid .chart-wide { grid-column: 1 / -1; }
@media (max-width: 800px) { .chart-grid { grid-template-columns: 1fr; } }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .chart-gridline { stroke: var(--line); stroke-width: 1; }
.chart .chart-base { stroke: #9AA9A6; stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; }
.chart-value { fill: var(--ink); font-size: 12px; font-weight: 600; }
.chart-bar { fill: var(--brand); }
.chart-bar.neg { fill: var(--danger); }
.chart-hit { fill: transparent; cursor: default; }
.chart-hit:hover { fill: rgba(11, 93, 85, .06); }
.chart-tip { position: fixed; z-index: 1000; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; line-height: 1.5; padding: 6px 10px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.chart-tip[hidden] { display: none; }
.chart-table { margin-top: 8px; font-size: 13px; }
.chart-table summary { color: var(--muted); cursor: pointer; }
.rank-bars { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.rank-bars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 10px; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rank-track { display: block; height: 10px; }
.rank-bar { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 2px; }
[dir=rtl] .rank-bar { border-radius: 4px 0 0 4px; }
.rank-bars b { font-size: 13px; color: var(--ink); }

/* صفحة كشف الحساب العامة للزبون */
body.public-statement { background: var(--bg); }
.ps-wrap { max-width: 900px; margin: 24px auto; padding: 0 16px; }
.ps-card { display: grid; gap: 16px; }
.ps-head { display: flex; align-items: center; gap: 14px; }
.ps-head h1 { margin: 0; font-size: 1.4rem; }
.ps-head p { margin: 0; }
.ps-logo { max-height: 56px; max-width: 140px; }
.ps-account { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 14px; background: #F2F8F7; border-radius: 10px; }
.ps-account > div { display: grid; }
.ps-account b { font-size: 1.15rem; }
.ps-filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.ps-filters .field { margin: 0; }
.ps-table { overflow-x: auto; }
.ps-table table { width: 100%; border-collapse: collapse; }
.ps-table th, .ps-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; }
.ps-table td.num { white-space: nowrap; }
.ps-foot { font-size: 13px; }
@media print { body.public-statement .ps-filters { display: none; } .ps-wrap { margin: 0; max-width: none; } .ps-card { box-shadow: none; border: 0; } }

/* ملصقات الباركود: تُطبع من الصفحة نفسها. ورقة A4 بشبكة، أو رول طابعة ملصقات بملصق في كل صفحة */
@page labels-sheet { size: A4; margin: 8mm; @bottom-center { content: none; } }
@page labels-roll50 { size: 50mm 30mm; margin: 0; @bottom-center { content: none; } }
@page labels-roll40 { size: 40mm 25mm; margin: 0; @bottom-center { content: none; } }
#print-root.labels { color: #000; font-family: Tahoma, Arial, sans-serif; }
#print-root.labels-sheet { page: labels-sheet; display: grid; grid-template-columns: repeat(auto-fill, 50mm); gap: 3mm; }
#print-root.labels-roll50 { page: labels-roll50; }
#print-root.labels-roll40 { page: labels-roll40; }
.labels .lbl { box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; break-inside: avoid; }
.labels-sheet .lbl { width: 50mm; height: 30mm; padding: 1.5mm 2mm; }
.labels-roll50 .lbl { width: 50mm; height: 30mm; padding: 1.5mm 2mm; break-after: page; }
.labels-roll40 .lbl { width: 40mm; height: 25mm; padding: 1mm 1.5mm; break-after: page; }
.labels .lbl-name { font-size: 9pt; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.labels .bc-svg { width: 44mm; height: 11mm; }
.labels-roll40 .bc-svg { width: 36mm; height: 9mm; }
.labels .lbl-code { font: 8pt monospace; direction: ltr; }
.labels .lbl-price { font-size: 10pt; font-weight: 700; }
.labels-roll40 .lbl-name, .labels-roll40 .lbl-price { font-size: 8pt; }
@media print { body.printing-labels #print-root.labels-sheet { display: grid; } body.printing-labels #print-root.labels-roll50, body.printing-labels #print-root.labels-roll40 { display: block; } }

/* مصاريف الفاتورة وربط المرتجع */
.charges { display: grid; gap: 8px; margin: 8px 0; }
.charge-row { display: grid; gap: 10px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; }
.charge-head { display: flex; justify-content: space-between; align-items: center; }
.charge-no { font-weight: 600; font-size: 13px; color: var(--muted); }
.charge-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
.charge-field { display: grid; gap: 4px; min-width: 0; grid-column: span 4; }
.charge-field.mid { grid-column: span 3; }
.charge-field.narrow { grid-column: span 2; }
.charge-label { font-size: 12px; color: var(--muted); }
.charge-field .search, .charge-field .picker { width: 100%; min-width: 0; }
/* سند الصرف: «شيكات مجيرة» — البحث بجانب الشرح، والقائمة تحته */
.endorse-head { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.endorse-head p { flex: 1 1 280px; margin: 0; }
.endorse-search { flex: 0 1 360px; min-width: 260px; }
.charge-tax { display: flex; gap: 8px; align-items: center; }
.charge-tax input[type=number] { flex: 1; min-width: 0; }
.charge-tax .check { font-size: 13px; white-space: nowrap; }
.charge-row .picker .pick-meta { display: none; }
@media (max-width: 1000px) { .charge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .charge-field, .charge-field.mid, .charge-field.narrow { grid-column: span 1; } }
@media (max-width: 560px) { .charge-grid { grid-template-columns: 1fr; } }
.charge-mode { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: grid; gap: 8px; margin-top: 8px; }
.charge-mode legend { font-weight: 600; padding: 0 6px; }
.span2 { grid-column: 1 / -1; }

/* وردية نقطة البيع ووضع المرتجع */
.pos-shift { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding: 8px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.pos-mode { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 10px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); }
.pos-mode input.search { width: 170px; }
.pos-total.neg { color: var(--danger); }
.pos-open { max-width: 640px; }
.shift-sum { display: grid; gap: 6px; margin: 10px 0; }
.shift-sum .row { padding: 4px 0; border-bottom: 1px dashed var(--line); }

.err-detail { max-height: 240px; overflow: auto; font-size: 12px; background: #F3F5F4; padding: 8px; border-radius: 8px; white-space: pre-wrap; }

/* الفوترة الإلكترونية: رمز QR في صفحة الفاتورة والمطبوعات */
.einvoice { display: flex; gap: 16px; align-items: center; }
.qr-box svg { display: block; }
.einvoice .hash { font-size: 11px; word-break: break-all; }
.rp-qr { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.rp-qr svg { width: 28mm; height: 28mm; }
.rp-qr-text { font-size: 8pt; color: #333; direction: rtl; }
.rc-qr { display: flex; justify-content: center; margin-top: 2mm; }
.rc-qr svg { width: 30mm; height: 30mm; }

.charge-amount { display: flex; gap: 4px; max-width: 220px; }
.charge-field .charge-amount input[type=number] { flex: 1; width: auto; min-width: 0; }
.charge-field .charge-amount select { width: 56px; flex: none; padding-inline: 6px; }

.pos-queue { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pos-last.queued { background: var(--warn-bg); color: var(--warn); }

.line-batch { display: flex; gap: 6px; margin-top: 4px; align-items: center; }
.line-batch input { padding: 4px 8px; font-size: 13px; }
.line-batch input[type=date], .line-batch .dmy-text { width: 150px; }

tr.row-warn td { background: var(--danger-bg); }

.onboard { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.onboard li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line, #E3E8E7); border-radius: 10px; }
.onboard li.done { opacity: .75; }
.onboard-mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line, #C9D2D0); display: grid; place-items: center; font-size: 14px; }
.onboard li.done .onboard-mark { background: #067647; border-color: #067647; color: #fff; }
.onboard-card .rank-track { margin: 8px 0; }

.charge-manual { display: grid; gap: 4px; grid-column: 1 / -1; }
.charge-manual label { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.charge-manual input { width: 120px; }
.meta > .link { margin-inline-start: 6px; }

/* سند القبض والصرف بالشيكات (على نمط إتقان): رأس، ثم تبويبات معلومات/شيكات/صور، ثم شريط الأوامر */
.voucher-head .voucher-title { margin: 0 0 12px; font-size: 18px; text-align: center; }
.voucher-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr 1.4fr; gap: 10px 14px; align-items: end; }
.voucher-grid .field { margin: 0; }
.voucher-body .tabs { margin-bottom: 14px; }
/* السندان بلا تمرير للصفحة: جداول الشيكات (الواردة والصادرة والمجيّرة والراجعة) تتمرر داخل مكانها، ورأس الجدول ثابت */
.voucher-body .vpanel .table-wrap { max-height: max(150px, calc(100vh - 560px)); overflow: auto; }
.voucher-body .vpanel thead th { position: sticky; top: 0; z-index: 2; background: var(--card, #fff); }
.voucher-body .vpanel tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--card, #fff); }
.view:has(> .voucher-head) { padding-bottom: 12px; }
/* صندوقا الملاحظات يأخذان ارتفاع خانات المبالغ ولا يزيدانه (حجمهما الذاتي صفر بجانبها؛ وتحتها في الشاشة الضيقة كما هما) */
@media (min-width: 901px) { .vnotes { contain: size; } }
/* الشاشة القصيرة (الحاسوب المحمول): السند أصغر قليلاً فيتسع بلا تمرير (body: تغلب قواعد السند التي بعدها في الملف) */
@media (max-height: 820px) {
  body .view:has(> .voucher-head) { padding-top: 10px; gap: 10px; }
  body :is(.voucher-head, .voucher-body).card { padding: 10px 16px; }
  body .voucher-head .voucher-title { margin: 0 0 4px; font-size: 16px; }
  body :is(.voucher-head, .voucher-body) :is(input:where(:not([type=checkbox], [type=radio], [type=file], [data-dmy])), select) { height: 34px; min-height: 34px; }
  body :is(.voucher-head, .voucher-body) .dmy > .dmy-text { min-height: 34px; }
  body :is(.voucher-head, .voucher-body) .field { gap: 2px; }
  body :is(.voucher-head, .voucher-body) .field label { font-size: 13px; }
  body .voucher-body .tabs { margin-bottom: 8px; }
  body .voucher-body .tabs [role=tab] { padding: 4px 12px; }
  body .vamounts { gap: 0; }
  body .vinfo { gap: 8px 24px; }
  body .vtotal { margin-top: 2px; padding-top: 4px; }
  body .voucher-bar { margin: 0; }
  body .voucher-bar .btn { height: 36px; }
  body .vbalance input { height: 34px; }
  body .voucher-body .vpanel .table-wrap { max-height: max(140px, calc(100vh - 460px)); }
  body .vnotes { gap: 6px; }
}
.vinfo { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px 28px; }
.vamounts { display: grid; gap: 4px; }
.vrow { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: end; }
.vrow .field, .vnotes .field { margin: 0; }
/* صندوقا الملاحظات بارتفاع خانات المبالغ بجانبهما: يبدآن معها وينتهيان معها، بالتساوي */
.vnotes { display: grid; gap: 12px; grid-template-rows: 1fr 1fr; }
.vnotes .field { grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.vnotes .field textarea { height: auto; min-height: 0; resize: none; }
.vinfo > .vtotal { grid-column: 1 / -1; }
.vnotes textarea, dialog.modal.wide textarea { width: 100%; resize: vertical; padding: 10px 12px; border: 1px solid #C9D3D0; border-radius: 8px; background: #fff; color: var(--ink); min-height: 92px; }
.vtotal { padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 6px; }
.chq-table td { padding: 4px; vertical-align: middle; }
.chq-table td input { width: 100%; min-width: 0; }
/* شيكات السند: كل عنوان في وسط عموده وقيمة خانته في وسطها، فيقع الاسم فوق القيمة (2026-11-13، بطلب صاحب النظام) */
.chq-table thead th { text-align: center; }
.chq-table td input, .chq-table td .dmy-text { text-align: center; }
/* أعمدة الشيكات بعرض ثابت مرتب: الرقم (أعرض)، البنك (ما بقي)، رقم الحساب، صاحب الشيك، الصور، الاستحقاق، القيمة */
.chq-table { width: 100%; min-width: 960px; table-layout: fixed; }
.chq-table th:nth-child(1) { width: 92px; }
.chq-table th:nth-child(2) { width: 16%; }
.chq-table th:nth-child(4) { width: 12%; }
.chq-table th:nth-child(5) { width: 14%; }
.chq-table th:nth-child(6) { width: 48px; }
.chq-table th:nth-child(7) { width: 150px; }
.chq-table th:nth-child(8) { width: 120px; }
.chq-table .dmy { display: block; }
.chq-table .chq-total td { padding: 10px 4px 2px; border-bottom: 0; font-weight: 600; }
.chq-table .chq-total td:first-child { text-align: left; color: var(--muted); }
.chq-table .chq-total td.num { padding-left: 12px; text-align: left; direction: ltr; }
.chq-table .bank-cell { align-items: center; }
.chq-table .bank-cell .picker { min-width: 0; }
.chq-table .bank-cell .icon-btn { margin-bottom: 0; }
/* سندا القبض والصرف: كل خانات الكتابة بشكل خانة البنك (حدود فاتحة وزوايا مستديرة) وبارتفاع واحد */
:is(.voucher-head, .voucher-body) :is(input:where(:not([type=checkbox], [type=radio], [type=file], [data-dmy])), select) {
  font: inherit; height: 42px; min-height: 42px; padding: 0 12px; border: 1px solid #C9D3D0; border-radius: 8px; background: #fff; color: var(--ink); box-sizing: border-box;
}
:is(.voucher-head, .voucher-body) :is(input, select):disabled { background: #F3F5F4; color: var(--muted); }
:is(.voucher-head, .voucher-body) .dmy > .dmy-text { min-height: 42px; padding-right: 34px; }
.chq-table .chq-no { color: var(--muted); font-weight: 600; text-align: center; width: 28px; }
.chq-list td .actions { flex-wrap: nowrap; }
/* شاشة «الشيكات»: الأعمدة والعناوين على سطر واحد بمسافات أضيق، والجدول يتمرر أفقياً داخل مكانه على الشاشة الضيقة */
.chq-list :is(th, td) { white-space: nowrap; padding-inline: 8px; }
.chq-list .table-wrap { overflow-x: auto; }
.chq-list td .actions { gap: 4px; }
/* عمود الأزرار ثابت على طرف الجدول فيبقى ظاهراً أثناء التمرير الأفقي */
.chq-list :is(th, td):last-child { position: sticky; left: 0; z-index: 1; background: var(--card, #fff); box-shadow: 6px 0 8px -6px rgba(16, 32, 28, .18) inset; }
.chq-list tr.changed td:last-child { background: #FFFBEB; }
.chq-list td .actions .btn { white-space: nowrap; }
.chq-pic { display: inline-flex; gap: 4px; align-items: center; }
.chq-pic.has { color: var(--brand); }
.voucher-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; margin: 12px 0; }
/* حفظ وجديد ورجوع بحجم واحد (الرابط كالزر) */
.voucher-bar .btn { width: auto; min-width: 104px; height: 42px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; text-decoration: none; }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
.chq-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; align-items: start; }
.chq-fields .field { margin: 0; }
.chq-images { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.chq-slot { display: grid; gap: 6px; }
.chq-slot .row { justify-content: space-between; }
.chq-frame { min-height: 150px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: var(--bg); }
.chq-frame img { width: 100%; max-height: 220px; object-fit: contain; cursor: zoom-in; display: block; }
@media (max-width: 900px) {
  .voucher-grid { grid-template-columns: 1fr 1fr; }
  .voucher-grid .vf-wide { grid-column: 1 / -1; }
  .vinfo { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .voucher-grid, .chq-images, .chq-fields { grid-template-columns: 1fr; }
  .vrow { grid-template-columns: 1fr; }
}
.ask-fields { display: grid; gap: 10px; }
.ask-fields textarea { width: 100%; padding: 10px 12px; border: 1px solid #C9D3D0; border-radius: 8px; resize: vertical; }
.ask-choices { display: grid; gap: 8px; }
/* تخصيص أقسام الرئيسية */
.section-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.section-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.section-list li.off { opacity: .55; }
.section-list .actions { display: flex; gap: 4px; }
.opt-tools { justify-content: flex-start; gap: 14px; margin: 6px 0 10px; }
.opt-group { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin-top: 8px; }
.opt-group > summary { cursor: pointer; padding: 6px 0; }

/* اسم البنك في جدول شيكات السند: بحث في البنوك المعرّفة وزر لقائمتها؛ والقائمة المنسدلة لا تُقصّ داخل الجدول على الشاشات العريضة */
.bank-cell { display: flex; gap: 4px; align-items: end; }
.bank-cell .picker { flex: 1; min-width: 150px; }
.bank-cell .icon-btn { flex: none; margin-bottom: 2px; }
.chq-table .picker > .pick-meta { display: none; }
@media (min-width: 900px) { .table-wrap:has(> .chq-table) { overflow: visible; } }
.bank-list { display: grid; gap: 4px; max-height: 340px; overflow-y: auto; margin-top: 10px; }
.bank-opt { display: flex; gap: 8px; align-items: center; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-align: start; cursor: pointer; font: inherit; }
.bank-opt:hover, .bank-opt:focus-visible { background: #EEF5F3; border-color: var(--brand); }
.bank-opt.pick-create { color: var(--brand); border-style: dashed; }
.danger-text { color: #B42318; }
/* رقم الحساب فوق خانات السند: على اليسار، بلا الرصيد */
.voucher-head .pick-meta, .vamounts .pick-meta { text-align: left; }
/* خانات المبالغ: اسم الخانة ورقم الحساب على سطر واحد، فيتحاذى مع «القيمة» بجانبه */
.vlabel { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.vlabel .pick-meta { flex: none; max-width: 50%; }
/* تعريف البنوك وقائمتها: الرمز أولاً، والفروع برموزها، والموقوف باهت */
.code-input { width: 80px; min-width: 0; text-align: left; }
.bank-code { min-width: 34px; color: var(--brand); text-align: left; }
.chip.off { opacity: .55; text-decoration: line-through; }
.chip-x { border: 0; background: none; padding: 0 2px; cursor: pointer; color: var(--muted); font: inherit; }
.muted-row td { opacity: .6; }
.branch-add { flex-wrap: nowrap; }
.branch-add .small-input { width: 72px; min-width: 0; }
.branch-list { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 230px; }

/* الشيكات الواردة والصادرة (كما في إتقان): رأس بالحساب والبحث والتاريخين، وجدول باختيار، وأسفل بالعدد والإجمالي والأزرار أو شريط النقل */
.box-grid { display: grid; grid-template-columns: 1.3fr 2fr 1.6fr 1fr 1fr; gap: 12px; align-items: end; }
.box-grid .field { margin: 0; }
.box-code { color: var(--brand); margin-inline-start: 8px; }
/* الشيكات غير المحصلة: الحساب ومن تاريخ فقط */
.uncol-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); max-width: 760px; }
.chq-box tbody tr.picked td .pill { background: #fff; }
/* أسفل شاشات الشيكات: العدد وتحته «حركات الشيك»، ثم إطار «إجمالي الشيكات» بصندوق لكل عملة، ثم الأزرار */
.chq-foot { align-items: flex-start; justify-content: flex-start; }
.chq-count { display: grid; gap: 12px; width: 150px; }
.chq-count .field { margin: 0; }
.chq-count .btn { width: 100%; }
.sum-box { border: 1px solid #C9D3D0; border-radius: 10px; padding: 12px 14px; margin: 0; display: flex; flex-wrap: wrap; gap: 12px; min-width: 0; }
.sum-box legend { padding: 0 8px; font-weight: 700; font-size: 14px; }
.sum-box .field { width: 160px; margin: 0; }
.sum-box .field label { font-weight: 500; font-size: 13px; color: var(--muted); text-align: center; }
/* اسم القيمة والقيمة في المنتصف (بطلب صاحب النظام) */
.sum-box .field input, .chq-count .field input, .chq-count .field input[dir=ltr] { text-align: center; }
.sum-box .field input[dir=ltr] { text-align: center; }
.chq-count .field label { text-align: center; }
.chq-foot .box-actions { margin-inline-start: auto; align-self: flex-end; }
.chq-box th.pick, .chq-box td.pick { width: 64px; white-space: nowrap; text-align: center; }
/* «المبلغ المسدَّد» من الشيك الراجع في السند (203): خانته في وسط عمودها تحت عنوانها */
.vpanel .chq-box td input.num { display: block; width: 100%; max-width: 130px; margin: 0 auto; text-align: center; box-sizing: border-box; }
/* مبالغ العملات جنب بعض، كلٌّ برقمه ورمزه (2026-11-13) */
.cur-amts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cur-amt { font-size: 12.5px; font-weight: 600; color: var(--ink-2, #33403D); background: var(--soft, #F1F4F4); border-radius: 999px; padding: 2px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* مربع «اختيار الكل» فوق مربعات السطور تماماً (2026-11-13) */
.chq-box th.pick input, .chq-box td.pick input { margin: 0; vertical-align: middle; }
/* زر «الإجراءات» يسار المبلغ: ناعم بلا إطار، بلون العلامة الخفيف (2026-11-13، بطلب صاحب النظام) */
.chq-box th.chq-act, .chq-box td.chq-act { width: 1%; white-space: nowrap; }
.chq-box td.chq-act .row-menu-btn { border: 0; border-radius: 999px; padding: 4px 12px; min-height: 0; font-size: 13px; font-weight: 500;
  background: var(--soft, #F1F4F4); color: var(--brand); box-shadow: none; }
.chq-box td.chq-act .row-menu-btn:hover, .chq-box td.chq-act .row-menu-btn[aria-expanded="true"] { background: var(--brand-soft, #E3F0EC); }
.chq-box tbody tr { cursor: default; }
.chq-box tbody tr.picked td { background: #E3F0EC; }
.chq-box tbody tr.deposited td:first-child { box-shadow: inset -3px 0 0 var(--gold); }
.box-foot { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: space-between; }
.box-stats { display: flex; flex-wrap: wrap; gap: 12px; }
.box-stats .field { margin: 0; width: 150px; }
.box-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.box-actions .btn { width: auto; min-width: 96px; display: inline-flex; gap: 6px; align-items: center; justify-content: center; text-decoration: none; }
.box-actions .btn.on { border-color: var(--brand); color: var(--brand); }
.cols-wrap { position: relative; }
.cols-pop { position: absolute; bottom: calc(100% + 6px); inset-inline-end: 0; z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 10px 14px; display: grid; gap: 4px; min-width: 190px; max-height: 360px; overflow-y: auto; }
.transfer-bar { display: grid; grid-template-columns: minmax(240px, 2fr) auto minmax(90px, .6fr) minmax(150px, 1fr) minmax(200px, 2fr); gap: 12px; align-items: end; flex: 1; min-width: 0; }
.transfer-bar .field { margin: 0; }
.returned-check { padding-bottom: 10px; white-space: nowrap; }
.adv-search { position: relative; }
.adv-close { position: absolute; top: 10px; inset-inline-end: 10px; }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(6, auto); grid-auto-flow: column; gap: 10px 24px; padding-top: 18px; }
.adv-grid .field { margin: 0; }
.adv-date { gap: 8px; align-items: center; flex-wrap: nowrap; }
.adv-date input { min-width: 0; }
@media (max-width: 900px) {
  .box-grid, .uncol-grid, .transfer-bar, .adv-grid { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
}
/* حركات الشيك: الحركة الملغاة بخط عليها، والتراجع باهت */
.chq-box tr.undone-row td { text-decoration: line-through; opacity: .6; }
.chq-box tr.undo-row td { color: var(--muted); font-style: italic; }
.moves-head { grid-template-columns: 1fr 1.6fr 1.2fr 1.4fr; }
/* رصيد الطرف قبل السند وبعده */
.vbalance { display: grid; grid-template-columns: repeat(3, 130px); gap: 10px; margin-inline-start: auto; align-items: end; }
.vbalance .field { margin: 0; }

/* المقاسات والألوان: صف لكل خاصية بقيمها، ومصفوفة التركيبات برصيدها، وخانات الكميات في الفاتورة */
.attr-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.attr-row:last-child { border-bottom: 0; }
.attr-name { min-width: 0; }
label.chip { cursor: pointer; }
.variant-matrix th, .variant-matrix td { text-align: center; }
.variant-matrix tbody th { text-align: start; background: var(--bg); white-space: nowrap; }
.variant-matrix td a { text-decoration: none; color: inherit; }
.variant-matrix .vq-in { width: 90px; min-width: 0; text-align: center; }
/* أرصدة مجموعة: قائمة الأعمدة والمخازن تنفتح للأسفل، والجدول بأعمدة المخازن */
.cols-pop-down { bottom: auto; top: calc(100% + 6px); }
.group-stock th, .group-stock td { white-space: nowrap; }

/* عروض الكميات: نموذج الإضافة، وسطر الفاتورة الذي أخذ سعر العرض */
.offer-grid { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 10px; align-items: end; }
.offer-grid .field { margin: 0; }
.offer-row input[aria-label="السعر"] { border-color: var(--gold); background: #FFF8E6; }
@media (max-width: 900px) { .offer-grid { grid-template-columns: 1fr 1fr; } }

/* عمولة الشيك: قسم اختياري بحقول منفصلة، وملخص المراجعة قبل الحفظ */
.fee-box { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 12px; display: grid; gap: 8px; }
/* شبكة ثابتة بأربعة أعمدة: كل خانة بالارتفاع نفسه، والعنوان سطر واحد، فلا تتزحزح الصفوف */
.fee-grid, .move-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; align-items: end; }
.fee-cell { min-width: 0; }
.fee-cell.span2 { grid-column: span 2; }
.fee-cell.span4 { grid-column: span 4; }
.fee-grid .field, .move-grid .field { margin: 0; }
.fee-grid .field > label, .move-grid .field > label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fee-grid input:not([type=radio]):not([type=checkbox]), .fee-grid select, .move-grid input, .move-grid select { width: 100%; height: 38px; box-sizing: border-box; }
.fee-radios label { white-space: nowrap; }
.fee-radios { display: flex; gap: 16px; align-items: center; height: 38px; }
.fee-toggle { font-weight: 600; }
.move-grid .span2 { grid-column: span 2; }
@media (max-width: 760px) { .fee-grid, .move-grid { grid-template-columns: 1fr 1fr; } .fee-cell.span4 { grid-column: span 2; } }
.summary-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0; }
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; font-weight: 600; }
/* إعفاء عمولات الشيكات المرتجعة وسدادها في سند القبض */
.fee-claims { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.fee-claims input { width: 110px; min-width: 0; }

/* ══ تحديث الواجهة: مسافات أقل، تبويبات عمل أوضح، اختصارات مبسطة، قائمة جانبية أوضح ══
   يتجاوز ما قبله؛ الألوان من متغيرات المشروع، والتركيز واضح، والحركة تُلغى حسب إعداد الجهاز */
:root { --radius: 10px; --side-ink: #E4EEEB; --side-hover: #1A4440; --side-active: #22564F; }

/* الترويسة وشريط التبويبات والمحتوى: أقرب لبعضها */
.bar { padding: 8px 20px; gap: 10px; min-height: 56px; }
.bar h1 { font-size: 18px; }
.tabbar { padding: 6px 16px 0; gap: 4px; scroll-padding-inline: 16px; }
.view { padding: 14px 20px 40px; gap: 14px; }
.view > .tab-pane { gap: 14px; }
.card { border-radius: 12px; }

/* رأس الرئيسية: الترحيب وزر التخصيص في سطر واحد */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.page-head .greet { margin: 0; color: var(--muted); font-size: 15px; }
.page-head .btn { display: inline-flex; align-items: center; gap: 6px; }

/* البحث الشامل: ظاهر بعرض مناسب */
.search-btn { min-width: 280px; justify-content: flex-start; padding: 8px 12px; border-radius: var(--radius); background: var(--bg); }
.search-btn .search-btn-text { flex: 1; text-align: start; }
.search-btn:hover, .search-btn:focus-visible { background: #fff; border-color: var(--brand); color: var(--ink); }
@media (max-width: 1100px) { .search-btn { min-width: 200px; } }

/* تبويبات العمل: النشط بخلفية بيضاء وخط علوي بلون الهوية، والإغلاق أوضح، والتمرير أفقي داخل الشريط */
.tab { flex: 0 1 210px; min-width: 120px; background: #E7EEEC; border-color: #D3DDDA; border-radius: 9px 9px 0 0; }
.tab:hover { background: #F1F5F4; }
.tab.on { background: #fff; border-color: var(--line); box-shadow: inset 0 3px 0 var(--brand); }
.tab.on .tab-main { color: var(--brand-dark); font-weight: 700; }
.tab-main { min-height: 38px; padding: 8px 12px; }
.tab-x { width: 28px; height: 28px; font-size: 13px; color: #56645F; }
.tab-x:hover, .tab-x:focus-visible { background: var(--danger-bg); color: var(--danger); }
.tab-new { width: 34px; height: 34px; border-style: solid; border-color: #C9D5D1; background: #fff; }
.tab-new:hover, .tab-new:focus-visible { border-color: var(--brand); }
.tabbar { scrollbar-width: thin; scrollbar-color: #C3CFCB transparent; }
.tabbar::-webkit-scrollbar { height: 6px; }
.tabbar::-webkit-scrollbar-thumb { background: #C3CFCB; border-radius: 3px; }

/* الوصول السريع: بطاقة = أيقونة واسم العملية، بلا اسم القسم؛ لون الفئة خفيف في الحد والأيقونة */
.quick-access > .row { gap: 8px; }
.quick-access h3 { margin: 0; font-size: 16px; }
.tiles { grid-auto-rows: auto; gap: 10px; margin-top: 10px; }
@media (min-width: 1200px) { .tiles.default-cols { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 601px) { .tiles.fixed-cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); } }
.tile { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px; border: 1px solid #E1E8E6; border-inline-start: 3px solid color-mix(in srgb, var(--accent, var(--brand)) 55%, #fff);
  border-radius: var(--radius); box-shadow: none; transition: border-color .15s, background-color .15s; }
a.tile:hover { transform: none; box-shadow: none; border-color: color-mix(in srgb, var(--accent, var(--brand)) 45%, #fff); background: color-mix(in srgb, var(--accent, var(--brand)) 5%, #fff); }
a.tile:focus-visible { transform: none; box-shadow: none; outline: 2px solid var(--brand); outline-offset: 2px; }
.tile .tile-icon { padding: 6px; border-radius: 9px; }
.tile-label { font-size: 14.5px; font-weight: 600; line-height: 1.35; color: #22322E; overflow-wrap: anywhere; min-width: 0; }
.tiles.size-s .tile { min-height: 48px; padding: 8px 10px; gap: 8px; }
.tiles.size-s .tile-label { font-size: 13px; }
.tiles.size-l .tile { min-height: 78px; }
.tiles.size-l .tile-label { font-size: 16px; }
.tile.span-l { flex-direction: column; align-items: flex-start; justify-content: center; }
.tile-badges { position: static; margin-inline-start: auto; }
.tiles.editing .tile { padding-top: 36px; }
.tiles.editing .tile-tools { position: absolute; top: 6px; inset-inline-end: 6px; }
.tiles.editing .tile-add { padding-top: 10px; justify-content: center; }

/* القائمة الجانبية: تباين أعلى، والقسم النشط بخلفية وعلامة جانبية، والإدارة والدعم مجموعة في الأسفل */
.side { padding: 16px 12px; gap: 2px; }
.side a { position: relative; color: var(--side-ink); padding: 9px 12px; font-size: 14.5px; }
.side a .tile-icon { opacity: 1; }
.side a:hover { background: var(--side-hover); color: #fff; }
.side a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.side a.active::before { content: ''; position: absolute; inset-block: 8px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--gold); }
.side a:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.side-admin { display: flex; flex-direction: column; gap: 2px; margin-top: auto; padding-top: 10px; border-top: 1px solid #2A5A54; }
.side-label { color: #A9C3BD; font-size: 12px; letter-spacing: .2px; padding: 4px 12px 4px; }
.side-toggle { font-size: 18px; letter-spacing: 0; line-height: 1; }
.side-tip { position: fixed; z-index: 80; transform: translateY(-50%); padding: 5px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; white-space: nowrap; pointer-events: none; }
.side-tip[hidden] { display: none; }
@media (min-width: 901px) {
  body.side-mini .side a.active::before { inset-inline-start: -10px; }
  body.side-mini .side-admin { padding-top: 6px; }
}

/* سطور الشيكات: الحذف والنسخ بجانب رقم السطر */
.chq-table .chq-no { width: auto; white-space: nowrap; }
.chq-tools { display: inline-flex; align-items: center; gap: 2px; }
.chq-tools .icon-btn { width: 26px; height: 26px; padding: 0; font-size: 12px; }
.chq-tools .chq-del:hover { color: var(--danger); }

/* الهاتف: لا تمرير أفقي للصفحة، والبحث أيقونة */
@media (max-width: 900px) {
  .bar { padding: 8px 12px; }
  .view { padding: 12px 12px 36px; }
  .tabbar { padding: 6px 8px 0; }
  .search-btn { min-width: 0; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 600px) { .tiles, .tiles.default-cols, .tiles.fixed-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* التركيز وتقليل الحركة */
a:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}

/* ── مساحة الشجرة (الحسابات والأصناف) كما في إتقان: الشجرة يميناً، وكلمات البحث ونتائجها يساراً، وشريط الأوامر أسفل ── */
.tree-ws { display: grid; grid-template-columns: minmax(0, var(--tree-col, 54fr)) 14px minmax(0, var(--side-col, 46fr)); grid-template-areas: "tree split side" "bar bar bar";
  gap: 14px 6px; align-items: start; }
/* المقسم بين الشجرة والبحث: يُسحب لتوسيع الشجرة أو تضييقها (company.js: treeWorkspace) */
.tree-split { grid-area: split; align-self: stretch; position: relative; cursor: col-resize; touch-action: none; border-radius: 6px; outline: none; }
.tree-split::before { content: ''; position: absolute; inset: 0 5px; border-radius: 3px; background: #D9E4E0; transition: background .15s; }
.tree-split::after { content: ''; position: sticky; top: 45%; display: block; margin: 40px auto 0; width: 6px; height: 36px; border-radius: 4px;
  background: radial-gradient(circle, #8FA8A2 1.2px, transparent 1.6px) center / 6px 6px repeat-y; }
.tree-split:hover::before, .tree-split:focus-visible::before, .tree-ws.resizing .tree-split::before { background: var(--brand); }
.tree-split:focus-visible { box-shadow: 0 0 0 2px rgba(11, 93, 85, .25); }
.tree-ws.resizing { user-select: none; cursor: col-resize; }

/* ── بطاقة الصنف (company.js: itemCard) ── */
.icard-head { display: grid; grid-template-columns: minmax(130px, 0.45fr) minmax(220px, 1.6fr) auto; gap: 12px 18px; align-items: end; }
.icard-head .field { margin: 0; }
.icard-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-bottom: 10px; }
.icard-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; margin-top: 14px; }
.icard-body > .card h3 { margin: 0 0 12px; }
.icard-body > .card h4 { margin: 14px 0 8px; font-size: 15px; }
.icard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; align-items: start; }
.icard-grid .field { margin-bottom: 10px; align-content: start; }
.icard-wide { grid-column: 1 / -1; }
/* الوحدات والأسعار والباركود بعرض البطاقة: ثلاثة أعمدة مريحة وأزرار الباركود في سطرها */
.icard-body > .icard-full { grid-column: 1 / -1; }
.icard-cols .actions { flex-wrap: nowrap; }
.icard-checks { display: grid; gap: 8px; align-content: center; padding-top: 18px; }
.icard-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.icard-cols h4 { margin-top: 0; }
.icard-cols .row input { flex: 1; min-width: 0; }
.icard-meta { margin-top: 12px; font-size: 13px; }
@media (max-width: 900px) {
  .icard-head, .icard-body { grid-template-columns: minmax(0, 1fr); }
}
.tree-pane { grid-area: tree; display: grid; gap: 8px; padding: 14px; }
.tree-pane > h3 { margin: 0; font-size: 16px; }
.tree-scroll { max-height: calc(100vh - 300px); min-height: 320px; overflow: auto; }
.tree-scroll thead th { position: sticky; top: 0; z-index: 2; background: #fff; }
.tree-side { grid-area: side; display: grid; gap: 14px; align-content: start; }
.tree-search { padding: 14px; }
.tree-search-label { display: grid; gap: 8px; font-weight: 600; color: var(--brand-dark); }
.tree-search-label input { width: 100%; max-width: none; font-size: 16px; padding: 10px 12px; background: #F3FAF7; border-color: #BFD8D1; }
.tree-search-label input:focus { background: #fff; }
.tree-results { padding: 0; overflow: hidden; }
.tree-results .table-wrap { max-height: calc(100vh - 420px); min-height: 180px; overflow: auto; }
.results { width: 100%; }
.results thead th { position: sticky; top: 0; z-index: 2; background: #F3F7F6; }
.results tbody tr[tabindex] { cursor: pointer; }
.results tbody tr[tabindex]:hover td { background: #F3F8F7; }
.results tbody tr[tabindex]:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.results td.empty { color: var(--muted); padding: 18px 12px; white-space: normal; }
.tree tbody tr { cursor: default; }
.tree tbody tr.sel td, .results tbody tr.sel td { background: #DCEEE9; }
.tree tbody tr.sel td:first-child, .results tbody tr.sel td:first-child { box-shadow: inset -3px 0 0 var(--brand); }
.tree-ws > .tree-bar { grid-area: bar; }
.tree-bar { position: sticky; bottom: 8px; z-index: 3; display: flex; justify-content: flex-start; }
.tree-bar-in { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 14px rgba(15, 40, 36, .08); }
.tree-bar-btn { display: grid; justify-items: center; gap: 4px; min-width: 84px; padding: 8px 10px; border: 1px solid #D5E2DE; border-radius: 10px; background: #F3F8F6; color: var(--brand-dark);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tree-bar-btn:hover:not(:disabled), .tree-bar-btn:focus-visible { background: var(--brand); border-color: var(--brand); color: #fff; }
.tree-bar-btn:disabled { opacity: .45; cursor: default; }
@media (max-width: 1100px) {
  .tree-ws { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "tree" "bar"; }
  .tree-split { display: none; }
  .tree-scroll, .tree-results .table-wrap { max-height: none; min-height: 0; }
}
@media (max-width: 600px) {
  .tree-bar-in { width: 100%; }
  .tree-bar-btn { flex: 1 1 30%; min-width: 0; }
}
.tree-pane .tree td:not(:nth-child(2)), .tree-pane .tree th { white-space: nowrap; }
/* أعمدة الشجرة: العنوان فوق قيمته تماماً (الرمز والأرقام كغيرها إلى اليمين)، والاسم لا يُكسر في عمود ضيق */
.tree-pane .tree :is(th, td) { text-align: right; }
.tree-pane .tree th:nth-child(2) { min-width: 180px; }

/* ── بطاقة الحساب (كما في إتقان): رأس بالصورة واللقب والاسم والرقم والنوع والأب ورقم الملف، وتبويبات، وشريط أوامر ── */
.acard-head { display: grid; grid-template-columns: 150px minmax(140px, 0.7fr) minmax(220px, 1.6fr) minmax(130px, 0.7fr); grid-template-rows: auto auto; gap: 12px 18px; align-items: end; }
.acard-head > .acard-photo { grid-row: span 2; }
.acard-head .field { margin: 0; }
.acard-name { font-size: 16px; background: #F3FAF7; }
.acard-photo { position: relative; width: 150px; height: 150px; border-radius: 12px; background: #E9EEF7; color: #6B7C8F; display: grid; place-items: center; overflow: hidden; }
.acard-photo img { width: 100%; height: 100%; object-fit: cover; }
.acard-photo-tools { position: absolute; inset-inline: 6px; bottom: 6px; display: flex; gap: 4px; justify-content: center; }
.acard-photo-tools .btn { padding: 3px 8px; font-size: 12px; }
.acard-parent { display: flex; gap: 6px; align-items: center; }
.acard-parent > .picker { flex: 1; min-width: 0; }
.acard-pcode { min-width: 56px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); font-size: 13px; text-align: center; }
.acard-group { grid-template-columns: minmax(120px, 0.5fr) minmax(240px, 1.6fr) 1fr; }
.acard-body { display: grid; gap: 14px; min-height: 380px; align-content: start; }
.acard-tabs { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.acard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 260px)); gap: 6px 36px; justify-content: center; padding: 18px 0; }
.acard-grid > div { display: grid; gap: 4px; align-content: start; }
.acard-grid textarea { min-height: 76px; }
.acard-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acard-check { margin-top: 28px; }
.acard-listpane { display: grid; gap: 12px; align-content: start; }
.acard-empty { text-align: center; padding: 40px 0; }
.acard-new { justify-self: start; }
.acard-groups { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.acard-groupbox { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #F7FAF9; }
.acard-groupbox .row { justify-content: space-between; }
.acard-bar { justify-content: flex-start; }
@media (max-width: 900px) {
  .acard-head { grid-template-columns: 1fr 1fr; }
  .acard-head > .acard-photo { grid-row: auto; grid-column: 1 / -1; justify-self: center; }
  .acard-grid { grid-template-columns: minmax(0, 1fr); padding: 8px 0; }
  .acard-groups { grid-template-columns: minmax(0, 1fr); }
  .acard-group { grid-template-columns: 1fr; }
}

/* تبويب «موظف» في بطاقة الحساب */
.acard-employee { display: grid; gap: 12px; justify-items: center; padding: 70px 0; }
.acard-emp-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.acard-emp-label { font-weight: 600; }
.acard-emp-code { width: 150px; }

/* ── هياكل التحميل (Skeleton) ──
   تظهر بتلاشٍ بعد 180ms فلا تومض في التحميل السريع، ولمعة خفيفة تتوقف مع prefers-reduced-motion؛ الأشكال مخفية عن قارئ الشاشة */
.skel-wrap { display: grid; gap: 14px; align-content: start; animation: skel-in .2s ease .18s both; }
.skel-shapes { display: contents; }
.skel-card { display: grid; gap: 12px; }
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, #E7EDEB 0%, #F2F5F4 40%, #E7EDEB 80%); background-size: 300% 100%; animation: skel-shine 1.4s ease-in-out infinite; }
.skel-line { height: 12px; }
.skel-line.skel-md { height: 16px; }
.skel-line.skel-lg { height: 22px; }
.skel-line.skel-input { height: 40px; border-radius: 8px; }
.skel-icon { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.skel-tile { cursor: default; }
.skel-table { display: grid; gap: 0; }
.skel-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 16px; padding: 12px 4px; border-top: 1px solid var(--line); }
.skel-row:first-child { border-top: 0; }
.skel-head .skel { background: #DCE5E2; animation: none; }
.skel-details { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 24px; }
.skel-details > div { display: grid; gap: 8px; }
.stats .stat .skel + .skel { margin-top: 8px; }
/* هيكل في حاوية تُملأ لاحقاً: يختفي تلقائياً حين يُضاف المحتوى */
.skel-pending:not(:only-child) { display: none; }
@keyframes skel-shine { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes skel-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } .skel-wrap { animation: none; } }
/* تحديث الشاشة نفسها: البيانات تبقى، وشريط رفيع أعلى التبويب */
.tab-pane.refreshing { position: relative; }
.tab-pane.refreshing::before { content: ''; position: sticky; top: 0; z-index: 5; display: block; height: 3px; margin-bottom: -3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: refresh-bar 1s linear infinite; }
@keyframes refresh-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { .tab-pane.refreshing::before { animation: none; background: var(--brand); opacity: .5; } }
/* حالة الفشل */
.state-error { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 36px 16px; }
.state-error h3 { margin: 0; }
.state-error .tile-icon { color: var(--danger); }
/* حالة «لا نتائج» أوضح من سطر رمادي */
p.empty { text-align: center; padding: 28px 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; margin: 0; }
/* لوحة التبويب تأخذ التركيز برمجياً بعد التحميل (لقارئ الشاشة ولوحة المفاتيح): بلا إطار، فالإطار للعناصر التفاعلية */
.tab-pane:focus, .tab-pane:focus-visible, .view:focus, .view:focus-visible { outline: none; }

/* ── المحادثات: قائمة المحادثات يميناً والمحادثة يساراً؛ على الهاتف واحدة منهما ── */
.side-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold); color: #3A2A00; font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; margin-inline-start: auto; }
body.side-mini .side a .side-badge { position: absolute; top: 2px; inset-inline-start: 34px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.chat { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; height: calc(100vh - 170px); min-height: 460px; }
.chat-side { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 10px; padding: 12px; overflow: hidden; }
.chat-side-tools { display: flex; gap: 8px; }
.chat-side-tools .btn { flex: 1; }
.chat-side .search { width: 100%; max-width: none; }
.chat-rooms { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.chat-room-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border: 0; border-radius: 10px; background: none; font: inherit; color: var(--ink); text-align: start; cursor: pointer; }
.chat-room-item:hover { background: #F2F6F5; }
.chat-room-item.on { background: #E3F0EC; }
.chat-room-item .avatar { width: 38px; height: 38px; flex: none; }
.avatar.company { background: var(--brand); color: #fff; }
.avatar.group { background: #E1E9F5; color: #3B5B8C; }
.chat-room-text { display: grid; min-width: 0; flex: 1; }
.chat-room-text b, .chat-room-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-room-meta { display: grid; justify-items: end; gap: 4px; flex: none; }
.chat-room-meta .side-badge { margin: 0; }
.chat-room { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-head-text { display: grid; min-width: 0; flex: 1; }
.chat-title { margin: 0; font-size: 16px; }
.chat-head-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back { display: none; }
.chat-msgs { overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; background: #F6F9F8; }
.chat-msgs:focus { outline: none; }
.chat-msg { max-width: min(72%, 560px); align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 7px 11px; }
.chat-msg.mine { align-self: flex-end; background: #DDEFE9; border-color: #C7E2D9; border-radius: 14px 14px 4px 14px; }
.chat-sender { display: block; font-size: 12.5px; color: var(--brand-dark); margin-bottom: 2px; }
.chat-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.chat-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 0 2px; opacity: 0; }
.chat-msg:hover .chat-del, .chat-del:focus-visible { opacity: 1; }
@media (hover: none) { .chat-del { opacity: .6; } }
.chat-day { align-self: center; margin: 8px 0 4px; padding: 3px 12px; border-radius: 999px; background: #E6ECEA; color: var(--muted); font-size: 12px; }
.chat-older { align-self: center; }
.chat-empty { text-align: center; margin: auto; }
.chat-status:not(:empty) { padding: 6px 14px; color: var(--danger); font-size: 13px; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-input { flex: 1; resize: none; min-height: 42px; max-height: 160px; padding: 10px 12px; border-radius: 12px; font: inherit; }
.chat-send { flex: none; height: 42px; }
.chat-pick { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; display: grid; gap: 2px; }
.chat-pick li > * { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.chat-pick-one { border: 0; background: none; font: inherit; cursor: pointer; text-align: start; }
.chat-pick li > *:hover { background: #F2F6F5; }
.avatar.small { width: 30px; height: 30px; font-size: 12px; flex: none; }
@media (max-width: 900px) {
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 150px); }
  .chat .chat-room { display: none; }
  .chat.in-room .chat-side { display: none; }
  .chat.in-room .chat-room { display: grid; }
  .chat-back { display: inline-flex; }
  .chat-msg { max-width: 85%; }
}
.avatar .tile-icon { color: inherit; padding: 0; background: none; }
.side a.active .tile-icon, .side a .tile-icon { color: currentColor; }
/* تنبيه رسالة محادثة جديدة داخل النظام: أعلى الشاشة بجانب الجرس، ويفتح المحادثة بالضغط */
.toast.chat-toast { top: 72px; bottom: auto; inset-inline-start: auto; inset-inline-end: 20px; transform: none; display: flex; gap: 10px; align-items: center; text-decoration: none; background: var(--brand); max-width: min(360px, calc(100vw - 32px)); animation: chat-toast-in .2s ease-out; }
.toast.chat-toast .tile-icon { color: inherit; background: none; padding: 0; }
.toast.chat-toast span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast.chat-toast b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.chat-toast small { opacity: .85; }
@keyframes chat-toast-in { from { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 600px) { .toast.chat-toast { inset-inline-end: 16px; inset-inline-start: 16px; max-width: none; } }
/* ثلاث خانات في صف (نافذة الصنف الجديد: الرمز والوحدة والتكلفة)، وخانة في صف على الهاتف */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr; } }

.ps-contacts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; }
/* كشف الحساب والفاتورة على الشاشة بشكل المطبوع: ورقة بيضاء، والسطر المرتبط بفاتورة يُنقر */
/* الكشف يُمرَّر مع الصفحة لا داخل إطار (2026-11-13، بطلب صاحب النظام: كان الإطار يخفي رأسه)، وعرضاً فقط على الشاشة الضيقة */
.rp-screen { background: #fff; color: #000; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; overflow-x: auto; margin-top: 8px; }
.rp-screen::-webkit-scrollbar { width: 10px; height: 10px; }
.rp-screen::-webkit-scrollbar-thumb { background: #b9c4c0; border-radius: 6px; }
.rp-screen .rp-table { min-width: 560px; }
.rp-screen .rp-company { font-size: 22px; }
/* «بدون ترويسة»: مكان الشعار فارغ في الطباعة (ورق مطبوع رأسه)، ولا فراغ على الشاشة */
.rp-company.rp-blank { min-height: 22mm; }
.rp-screen .rp-company.rp-blank { display: none; }
.rp-screen [data-href] { cursor: pointer; }
.rp-screen tr[data-href]:hover td, .rp-screen tr[data-href]:focus-visible td, .rp-screen .rp-pair[data-href]:hover { background: #EEF6F3; }
.rp-screen tr.rp-main[data-href] td:first-child, .rp-screen .rp-pair[data-href] .rp-value { text-decoration: underline; text-underline-offset: 3px; }

/* ══ تصميم الشركة الجديد: قائمة فاتحة قابلة للطي بقوائم فرعية، والنوافذ في الشريط العلوي، والرئيسية بالبطاقات ══
   خاص بصفحة الشركة (body[data-page="home"])؛ لوحة مسؤول المنصة باقية كما هي. يتجاوز ما قبله */
body[data-page="home"] { --soft: #F1F4F4; --soft-line: #E6EBEA; --ink-2: #33403D; --ink-3: #5B6765; background: #F7F8F8; }

/* لوحة مسؤول المنصة: القائمة بتصميم قائمة الشركة (المتغيرات نفسها، والعنوان الفرعي تحت «Collect»، وخط الفصل بين المجموعات) */
body[data-page="owner-home"] { --soft: #F1F4F4; --soft-line: #E6EBEA; --ink-2: #33403D; --ink-3: #5B6765; }
body[data-page="owner-home"] .side-brand span { display: block; color: #6B7775; font-size: 13px; font-weight: 500; }
body[data-page="owner-home"] .side hr { border: 0; border-top: 1px solid var(--soft-line); margin: 10px 4px; }
/* القائمة الجانبية (للشركة ولوحة مسؤول المنصة): خلفية بيضاء مائلة للرمادي، نص وأيقونات رمادية داكنة، والمحدد بخلفية رمادية فاتحة */
body:is([data-page="home"], [data-page="owner-home"]) .side { flex: 0 0 248px; max-width: 248px; background: #FAFBFB; color: var(--ink-2); border-inline-end: 1px solid var(--soft-line); padding: 18px 14px; gap: 2px; }
body:is([data-page="home"], [data-page="owner-home"]) .side-brand { padding: 2px 6px 18px; gap: 10px; }
body:is([data-page="home"], [data-page="owner-home"]) .side-brand b { color: #10302C; font-size: 22px; line-height: 1.2; }
body:is([data-page="home"], [data-page="owner-home"]) .side-brand span#company-name { display: block; color: #6B7775; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
body:is([data-page="home"], [data-page="owner-home"]) .side-toggle { flex: none; width: 34px; height: 34px; border: 1px solid #E2E7E6; border-radius: 50%; background: #fff; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; }
body:is([data-page="home"], [data-page="owner-home"]) .side-toggle:hover, body:is([data-page="home"], [data-page="owner-home"]) .side-toggle:focus-visible { background: var(--soft); color: var(--ink); }
body:is([data-page="home"], [data-page="owner-home"]) .side-toggle > span { display: none; }
body:is([data-page="home"], [data-page="owner-home"]) .side-toggle::before { content: '‹'; font-size: 20px; line-height: 1; margin-top: -2px; }
body:is([data-page="home"], [data-page="owner-home"]).side-mini .side-toggle::before { content: '›'; }
body:is([data-page="home"], [data-page="owner-home"]) .side a { color: var(--ink-2); padding: 10px 12px; border-radius: 10px; font-size: 15px; gap: 12px; }
body:is([data-page="home"], [data-page="owner-home"]) .side a .tile-icon { color: var(--ink-3); }
body:is([data-page="home"], [data-page="owner-home"]) .side a:hover { background: #F0F3F3; color: var(--ink); }
body:is([data-page="home"], [data-page="owner-home"]) .side a.active { background: #ECEFEF; color: #10302C; font-weight: 600; }
body:is([data-page="home"], [data-page="owner-home"]) .side a.active .tile-icon { color: #10302C; }
body:is([data-page="home"], [data-page="owner-home"]) .side a.active::before { display: none; }
body:is([data-page="home"], [data-page="owner-home"]) .side a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
body:is([data-page="home"], [data-page="owner-home"]) .side-admin { border-top: 1px solid var(--soft-line); }
body:is([data-page="home"], [data-page="owner-home"]) .side-label { color: #7A8583; }
body:is([data-page="home"], [data-page="owner-home"]) .side:not(.side-ready) .side-caret { visibility: hidden; }
/* القسم بقائمة فرعية: السهم بجانبه يفتحها ويطويها، وروابطها تحت خط جانبي */
.side-item { position: relative; display: flex; flex-direction: column; }
.side-item > a { padding-inline-end: 42px !important; }
.side-caret { position: absolute; top: 5px; inset-inline-end: 5px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.side-caret:hover, .side-caret:focus-visible { background: #E7ECEB; color: var(--ink); }
.side-caret .tile-icon { color: inherit; transition: transform .15s; }
.side-item.open .side-caret .tile-icon { transform: rotate(180deg); }
.side-sub { display: none; flex-direction: column; gap: 1px; margin-block: 2px 6px; margin-inline: 22px 0; padding-inline-start: 10px; border-inline-start: 1px solid #E2E7E6; }
.side-item.open .side-sub { display: flex; }
body:is([data-page="home"], [data-page="owner-home"]) .side-sub a { font-size: 14px; padding: 7px 10px; color: #4A5654; gap: 10px; }
body:is([data-page="home"], [data-page="owner-home"]) .side-item.sub-active > a.active { background: none; }
/* القائمة المطوية: أيقونات فقط، والقوائم الفرعية في قائمة منبثقة بجانب الأيقونة */
@media (min-width: 901px) {
  body:is([data-page="home"], [data-page="owner-home"]).side-mini .side { flex: 0 0 76px; max-width: 76px; padding-inline: 12px; }
  body:is([data-page="home"], [data-page="owner-home"]).side-mini .side-brand { gap: 12px; padding-bottom: 14px; }
  body.side-mini .side-caret, body.side-mini .side-sub { display: none !important; }
  body.side-mini .side-item > a { padding-inline-end: 0 !important; }
  body.side-mini .side-item.has-sub > a::after { content: ''; position: absolute; bottom: 7px; inset-inline-end: 9px; width: 5px; height: 5px; border-radius: 50%; background: #A3AEAC; }
}
.side-fly { position: fixed; z-index: 85; min-width: 210px; max-width: 280px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid #E3E8E7; border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 32, 30, .14); }
.side-fly[hidden] { display: none; }
.side-fly a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14px; }
.side-fly a .tile-icon { color: var(--ink-3); flex: none; }
.side-fly a:hover, .side-fly a:focus-visible { background: #F0F3F3; color: var(--ink); outline: none; }
.side-fly a:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.side-fly a.active { background: #ECEFEF; font-weight: 600; }
.side-fly .side-fly-head { font-weight: 700; color: var(--ink); border-bottom: 1px solid #EEF1F0; border-radius: 8px 8px 0 0; padding-bottom: 9px; margin-bottom: 2px; }

/* الشريط العلوي: النوافذ يميناً بجانب القائمة؛ ثم من اليمين: البحث، فالتنبيهات، فصورة الحساب واسمه في أقصى اليسار */
body[data-page="home"] .bar { background: #fff; border-bottom: 1px solid var(--soft-line); padding: 10px 18px; min-height: 66px; flex-wrap: nowrap; gap: 10px; }
body[data-page="home"] .bar > .menu-btn { order: -1; }
body[data-page="home"] .bar > h1 { order: 0; }
body[data-page="home"] .tabstrip { order: 1; }
body[data-page="home"] .search-btn { order: 2; }
body[data-page="home"] .bell { order: 3; }
body[data-page="home"] .bar-user { order: 4; }
@media (min-width: 901px) {
  /* اسم الشاشة في التبويب؛ العنوان يبقى لقارئ الشاشة */
  body[data-page="home"] .bar > h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.tabstrip { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
body[data-page="home"] .tabbar { flex: 0 1 auto; min-width: 0; padding: 2px; margin: 0; gap: 8px; align-items: center; background: none; border: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-padding-inline: 4px; }
body[data-page="home"] .tabbar::-webkit-scrollbar { display: none; }
body[data-page="home"] .tab { flex: 0 0 auto; min-width: 0; max-width: 230px; height: 46px; top: 0; background: #fff; border: 1px solid #E5E9E8; border-radius: 10px; box-shadow: none; }
body[data-page="home"] .tab:hover { background: #F7F9F9; }
body[data-page="home"] .tab.on { background: #F1F4F4; border-color: #D3DBD9; box-shadow: inset 0 -2px 0 var(--brand); }
body[data-page="home"] .tab-main { gap: 8px; min-height: 44px; padding: 0 12px; color: #3E4A48; font-size: 15px; }
body[data-page="home"] .tab-main .tile-icon { color: var(--ink-3); flex: none; }
body[data-page="home"] .tab.on .tab-main { color: var(--ink); font-weight: 600; }
body[data-page="home"] .tab.on .tab-main .tile-icon { color: var(--ink); }
body[data-page="home"] .tab-x { width: 26px; height: 26px; margin-inline-end: 8px; color: #6B7775; }
body[data-page="home"] .tab-new { flex: none; width: 46px; height: 46px; margin: 0; border: 1px solid #E5E9E8; border-radius: 10px; background: #fff; color: var(--ink-2); font-size: 24px; line-height: 1; }
body[data-page="home"] .tab-new:hover, body[data-page="home"] .tab-new:focus-visible { background: var(--soft); border-color: #C9D3D1; }
.tab-more-wrap { position: relative; flex: none; }
.tab-more-wrap:has(> .tab-more[hidden]) { display: none; }
.tab-more { height: 46px; display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; border: 1px solid #E5E9E8; border-radius: 10px; background: #fff; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tab-more[hidden] { display: none; }
.tab-more .tile-icon { color: inherit; }
.tab-more:hover, .tab-more[aria-expanded="true"] { background: var(--soft); }
.tab-more-list { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 75; min-width: 240px; max-width: min(320px, 90vw); max-height: 60vh; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid #E3E8E7; border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 32, 30, .14); }
.tab-more-list[hidden] { display: none; }
.tab-more-list button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: inherit; font-size: 14px; text-align: start; cursor: pointer; }
.tab-more-list button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-more-list button .tile-icon { color: var(--ink-3); }
.tab-more-list button:hover, .tab-more-list button:focus-visible { background: #F0F3F3; outline: none; }
.tab-more-list button.on { background: #ECEFEF; font-weight: 600; }
/* البحث والتنبيهات رموزاً، والحساب: الصورة الرمزية و«أهلاً بك» والاسم */
body[data-page="home"] .search-btn { min-width: 0; width: 42px; height: 42px; padding: 0; margin: 0; justify-content: center; border: 0; border-radius: 10px; background: none; color: var(--ink-2); flex: none; }
body[data-page="home"] .search-btn .search-btn-text, body[data-page="home"] .search-btn kbd { display: none; }
body[data-page="home"] .search-btn .tile-icon { color: inherit; }
body[data-page="home"] .search-btn:hover, body[data-page="home"] .search-btn:focus-visible { background: var(--soft); color: var(--ink); }
body[data-page="home"] .bell { flex: none; }
body[data-page="home"] .bell-btn { width: 42px; height: 42px; border: 0; background: none; color: var(--ink-2); }
body[data-page="home"] .bell-btn:hover, body[data-page="home"] .bell-btn[aria-expanded="true"] { background: var(--soft); }
body[data-page="home"] .bell-btn .tile-icon { color: inherit; }
body[data-page="home"] .bell-badge { top: 2px; inset-inline-end: 2px; }
body[data-page="home"] .bar-user { flex: none; }
body[data-page="home"] .user-chip { border: 0; border-radius: 12px; background: none; padding: 4px 6px; gap: 10px; }
body[data-page="home"] .user-chip:hover, body[data-page="home"] .user-chip[aria-expanded="true"] { background: var(--soft); }
body[data-page="home"] .user-chip .avatar { width: 42px; height: 42px; font-size: 15px; background: #13201E; }
body[data-page="home"] .user-hello { color: #7A8583; font-size: 12.5px; }
body[data-page="home"] .user-meta b { font-size: 15px; color: var(--ink); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-page="home"] .user-meta #sub-line { display: none; }
body[data-page="home"] .chev { font-size: 12px; }

/* الهاتف والشاشات الضيقة: النوافذ في سطر تحت الشريط (تُخفى إن كانت واحدة)، والعنوان ظاهر */
@media (max-width: 900px) {
  body[data-page="home"] .bar { flex-wrap: wrap; padding: 8px 12px; min-height: 0; row-gap: 8px; }
  body[data-page="home"] .bar > h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body[data-page="home"] .tabstrip { order: 10; flex: 1 0 100%; }
  body[data-page="home"] .tabstrip.single { display: none; }
  body[data-page="home"] .tab, body[data-page="home"] .tab-new, body[data-page="home"] .tab-more { height: 40px; }
  body[data-page="home"] .tab-new { width: 40px; }
  body[data-page="home"] .tab-main { min-height: 38px; font-size: 14px; }
  body[data-page="home"] .tab { max-width: 180px; }
  body[data-page="home"] .bar-user { width: auto; }
  body[data-page="home"] .side { max-width: none; }
  body[data-page="home"] .side-toggle { display: none; }
}

/* ── الرئيسية ── */
body[data-page="home"] .card { border-radius: 16px; border-color: #E8ECEB; }
.home-hero { justify-content: flex-start; gap: 14px 20px; }
.home-hello { flex: 0 1 auto; min-width: 0; }
.home-hello h2 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.home-hello p { margin: 4px 0 0; font-size: 15px; color: #6B7775; }
.page-head .home-customize { width: auto; flex: none; padding: 10px 16px; border-radius: 12px; background: #fff; border: 1px solid #E3E8E7; color: var(--ink-2); font-weight: 500; gap: 8px; }
.home-customize .tile-icon { color: var(--ink-3); }
.home-customize:hover, .home-customize:focus-visible { background: var(--soft); }
.home-date { margin-inline-start: auto; display: flex; align-items: center; gap: 14px; min-width: 250px; padding: 12px 18px; background: #fff; border: 1px solid #E8ECEB; border-radius: 14px; }
.home-date b { display: block; font-size: 15px; font-weight: 600; }
.home-date .greet { margin: 0; color: #6B7775; font-size: 13.5px; }
.head-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 11px; background: #E9F6EF; color: #1F8A5B; }
.head-icon .tile-icon { color: inherit; padding: 0 !important; background: none !important; }
.head-icon.star { background: none; color: #F5B748; width: 30px; }
.head-icon.star .tile-icon { fill: currentColor; }
.home-date .head-icon { background: var(--soft); color: var(--ink-2); }
.home-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
.home-grid > * { grid-column: span 6; min-width: 0; margin: 0; }
.home-grid > .hs-3 { grid-column: span 3; }
@media (min-width: 1200px) {
  .home-grid > .hs-4 { grid-column: span 4; }
  .home-grid > .hs-2 { grid-column: span 2; }
}
@media (max-width: 900px) { .home-grid > *, .home-grid > .hs-3 { grid-column: 1 / -1; } .home-grid { gap: 14px; } }
.home-card-head, .quick-access > .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.home-card-head h3, .home-card-title h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 19px; font-weight: 700; }
.home-card-title { display: grid; gap: 2px; }
.home-card-title small { font-size: 13px; padding-inline-start: 40px; }
.more-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #E3E8E7; border-radius: 10px; background: #fff; color: var(--brand); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.more-link .tile-icon { color: inherit; }
.more-link:hover, .more-link:focus-visible { background: #F3F8F6; }
/* الإجراءات المفضلة: كل قسم في لوحة، وكل إجراء سطر ملوّن برمزه واسمه ووصفه */
.fav-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 16px; }
.fav-group { padding: 14px; border: 1px solid #EDF0EF; border-radius: 14px; background: #FCFDFD; }
.fav-group h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.fav-group-icon { display: inline-flex; color: var(--ink-2); }
.fav-group-icon .tile-icon { color: inherit; padding: 0 !important; background: none !important; }
.fav-list { display: grid; gap: 10px; }
.fav-list .tile { --tone: #1F8A5B; --tone-bg: #E9F6EF; display: flex; flex-direction: row; align-items: center; gap: 14px; min-height: 76px; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--tone-bg); color: var(--ink); text-decoration: none; }
.fav-list .tile:nth-child(3n+2) { --tone: #2F6FD0; --tone-bg: #EAF1FC; }
.fav-list .tile:nth-child(3n) { --tone: #D9822B; --tone-bg: #FDF2E7; }
.fav-list .tile > .tile-icon { box-sizing: content-box; padding: 10px; border-radius: 11px; background: color-mix(in srgb, var(--tone) 15%, #fff); color: var(--tone); }
.fav-list a.tile:hover { background: color-mix(in srgb, var(--tone) 16%, #fff); border: 0; }
.fav-list a.tile:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }
.fav-list .tile.span-w, .fav-list .tile.span-l { grid-column: auto; grid-row: auto; flex-direction: row; align-items: center; min-height: 92px; }
.tile-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.fav-list .tile-label { font-size: 16px; font-weight: 600; color: var(--ink); }
.tile-desc { color: #6B7775; font-size: 13px; line-height: 1.4; }
.tile-go { margin-inline-start: auto; display: inline-flex; color: var(--ink-2); flex: none; }
/* عدد الشيكات التي اقترب موعدها: قبل السهم في الإجراءات المفضلة، وبجانب الرابط في القائمة الجانبية */
.tile-count { margin-inline-start: auto; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px; background: #E8590C; color: #fff; font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 2px 6px rgba(232, 89, 12, .3); font-variant-numeric: tabular-nums; }
.tile-count[hidden] { display: none; }
.tile-count:not([hidden]) + .tile-go { margin-inline-start: 6px; }
.side-badge.due { background: #E8590C; color: #fff; }
.side-badge[hidden] { display: none; }
.tile .tile-go .tile-icon { padding: 0; background: none; color: inherit; }
.fav-groups.size-s .tile { min-height: 54px; padding: 8px 12px; }
.fav-groups.size-s .tile-desc { display: none; }
.fav-groups.size-s .tile-label { font-size: 14px; }
.fav-groups.size-l .tile { min-height: 92px; }
.fav-groups.size-l .tile-label { font-size: 17px; }
.tiles .tile-desc, .tiles .tile-go { display: none; }
.fav-empty { margin: 0; padding: 18px 0; text-align: center; grid-column: 1 / -1; }
/* ملخص اليوم */
.home-summary .sum-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.home-summary.hs-6 .sum-list { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.sum-row { --tone: #1F8A5B; --tone-bg: #E9F6EF; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 14px 16px; background: #fff; border: 1px solid #EDF0EF; border-radius: 14px; }
.sum-row.tone-blue { --tone: #2F6FD0; --tone-bg: #EAF1FC; }
.sum-row.tone-orange { --tone: #D9822B; --tone-bg: #FDF2E7; }
.sum-row.tone-violet { --tone: #6A5BD6; --tone-bg: #EFEDFC; }
.sum-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px; background: var(--tone-bg); color: var(--tone); }
.sum-icon .tile-icon { color: inherit; }
.sum-text { display: grid; gap: 2px; flex: 1 1 8em; min-width: 8em; }
.stat.sum-row .sum-text small { display: block; color: var(--ink); font-size: 15.5px; font-weight: 600; }
.sum-text .muted { font-size: 13px; }
/* القيمة لا تتداخل مع النص: إن ضاق المربع نزلت إلى سطر تحته في طرفه */
.stat.sum-row b { flex: none; width: auto; margin-inline-start: auto; font-size: 17px; white-space: nowrap; direction: ltr; }
/* اللوحات وحالة الفراغ */
.home-panel .kv-list { margin-top: 0; }
.home-empty { display: grid; justify-items: center; gap: 10px; padding: 14px 8px 6px; text-align: center; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--soft); color: var(--ink-3); }
.empty-icon .tile-icon { color: inherit; }
.home-empty p { margin: 0; color: var(--ink-2); font-weight: 600; }
@media (max-width: 900px) {
  .home-hello h2 { font-size: 22px; }
  .home-date { margin-inline-start: 0; min-width: 0; width: 100%; }
}

/* زر الرجوع إلى الشاشة الأم: زر مستقل في سطره (لا رابط نصي)، بسهم واسم الشاشة */
body:is([data-page="home"], [data-page="owner-home"]) .back { justify-self: start; align-self: start; display: inline-flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%;
  padding: 8px 14px 8px 16px; border: 1px solid #E3E8E7; border-radius: 10px; background: #fff; color: var(--ink-2); font: inherit; font-size: 14.5px; font-weight: 500;
  text-decoration: none; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 32, 30, .04); transition: background-color .15s, border-color .15s; }
body:is([data-page="home"], [data-page="owner-home"]) .back .tile-icon { color: inherit; flex: none; }
body:is([data-page="home"], [data-page="owner-home"]) .back:hover, body:is([data-page="home"], [data-page="owner-home"]) .back:focus-visible { background: var(--soft); border-color: #C9D3D1; color: var(--ink); }
body:is([data-page="home"], [data-page="owner-home"]) .back[hidden] { display: none; }
body:is([data-page="home"], [data-page="owner-home"]) .card.soon .back { margin-top: 6px; }
body:is([data-page="home"], [data-page="owner-home"]) .split-panel .back { display: none; }
/* ملخص اليوم: لون التنبيه (الشيكات المتأخرة)، والقيمة السالبة، وزر تخصيص البنود */
.sum-row.tone-red { --tone: #B42318; --tone-bg: #FEF3F2; }
.stat.sum-row.neg b { color: var(--danger); }
.home-summary .sum-edit { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #E3E8E7; border-radius: 10px; background: #fff; color: var(--ink-3); }
.home-summary .sum-edit .tile-icon { color: inherit; }
.home-summary .sum-edit:hover, .home-summary .sum-edit:focus-visible { background: var(--soft); color: var(--ink); }
/* تنبيه بعد الحفظ (شيكات بتاريخ استحقاق قديم): لون التحذير ويتسع لنصه */
.toast.warn { background: #B45309; max-width: min(620px, calc(100vw - 32px)); line-height: 1.6; }

/* ── صفحات الدخول والتفعيل (login.html للشركة، وowner.html لمسؤول المنصة، وactivate.html لتفعيل الحساب): لوحة تعريف خضراء بزخرفة ورسم زجاجي، ونموذج على خلفية كريمية بأيقونات داخل الحقول.
   أيقونتا «إظهار كلمة المرور» وسهم «دخول» من CSS: نصّا الزرين يبقيان (يغيّرهما collect.js) ويُقرآن لقارئ الشاشة ── */
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) { background: #F7F4EE; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside {
  position: relative; overflow: hidden; padding: 30px clamp(28px, 3.5vw, 52px) 24px; gap: 18px; justify-content: flex-start;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='none' stroke='white' stroke-opacity='.045' stroke-width='1.2'%3E%3Ccircle cx='0' cy='0' r='80'/%3E%3Ccircle cx='160' cy='0' r='80'/%3E%3Ccircle cx='0' cy='160' r='80'/%3E%3Ccircle cx='160' cy='160' r='80'/%3E%3Ccircle cx='80' cy='80' r='80'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 160px 160px,
    radial-gradient(ellipse 62% 42% at 46% 60%, rgba(30, 160, 118, .34), transparent 72%),
    linear-gradient(165deg, #0B3B32 0%, #072C25 55%, #06261F 100%);
}
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand { gap: 12px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand svg { width: 52px; height: 52px; box-shadow: 0 8px 20px rgba(0, 0, 0, .28); border-radius: 13px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand b { font-size: 26px; line-height: 1.1; letter-spacing: .2px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand span { font-size: 17px; font-weight: 700; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-intro h1 { font-size: clamp(28px, 2.7vw, 40px); line-height: 1.38; font-weight: 700; margin: 4px 0 10px; max-width: 9.4em; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-intro p { font-size: clamp(14px, 1.1vw, 17px); color: #D3E6DF; max-width: 30em; }
/* الرسم: ثلاث بطاقات زجاجية متتالية ومدار بنقطة ذهبية */
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-art { position: relative; height: clamp(170px, 17vw, 240px); margin: 0; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-orbit { position: absolute; inset: 8% 0 0 2%; width: 98%; height: 92%; overflow: visible; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-orbit ellipse { fill: none; stroke: rgba(112, 226, 182, .55); stroke-width: 2; vector-effect: non-scaling-stroke; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-card {
  position: absolute; width: 29%; aspect-ratio: 1.24; border-radius: 18px;
  background: linear-gradient(150deg, rgba(160, 240, 210, .46), rgba(48, 160, 124, .26) 55%, rgba(20, 110, 84, .3));
  border: 1px solid rgba(214, 255, 238, .34); box-shadow: 0 26px 50px rgba(0, 18, 12, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
  transform: perspective(900px) rotateY(16deg) rotate(-5deg); backdrop-filter: blur(6px);
}
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-card.c3 { left: 48%; top: 2%; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-card.c2 { left: 36%; top: 17%; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-card.c1 { left: 22%; top: 34%; padding: 15% 0 0 11%; direction: ltr; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-card i { display: block; height: 9px; border-radius: 6px; background: rgba(225, 255, 244, .5); width: 58%; margin-bottom: 11px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-card i + i { width: 46%; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .art-dot { position: absolute; left: 61%; top: 61%; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px rgba(245, 183, 72, .18), 0 0 22px rgba(245, 183, 72, .7); }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points { margin: 0; gap: 12px; font-size: clamp(14px, 1.1vw, 16px); color: #EAF4F0; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points li { display: flex; align-items: center; gap: 10px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points li::before {
  width: 21px; height: 21px; margin: 0; flex: none; border-radius: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='12' fill='%23F5B748'/%3E%3Cpath d='M7 12.4l3.3 3.2L17 9' fill='none' stroke='%230A3A31' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* المحتوى (العنوان والرسم والنقاط) في وسط اللوحة بين الشعار و«©» على الشاشات الطويلة */
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-intro { margin-top: auto; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points { margin-bottom: auto; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside > small { margin-top: 0; align-self: flex-start; color: #D3E6DF; font-weight: 600; font-size: 13px; }

/* النموذج */
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-main { padding: 32px 24px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card { max-width: 440px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card h2 { font-size: clamp(26px, 2.2vw, 32px); font-weight: 700; text-align: center; margin: 0 0 4px; color: #10201C; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .lead { text-align: center; font-size: clamp(14px, 1.1vw, 16px); color: #5D6A66; margin: 0 0 26px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field { gap: 6px; margin-bottom: 15px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field label { font-size: 14px; font-weight: 700; color: #13201E; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field input:not([type=checkbox]) {
  height: 46px; padding: 0 14px; font-size: 15px; border: 1px solid #D6DAD4; border-radius: 9px; background: #fff;
  box-shadow: 0 1px 2px rgba(16, 40, 35, .05); text-align: right; transition: border-color .15s, box-shadow .15s;
}
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field input::placeholder { color: #6A7470; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field input:not([type=checkbox]):focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 93, 85, .16); }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .field input[readonly] { background: #F1F4F2; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field .hint { font-size: 12.5px; color: #5D6A66; margin-top: -1px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .with-icon { position: relative; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .with-icon input, body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .pw input { padding-left: 46px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 21px; height: 21px; fill: none; stroke: #4A5551; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .pw button { inset-inline-end: auto; left: 6px; width: 38px; height: 38px; padding: 0; font-size: 0; color: #4A5551; border-radius: 8px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .pw button::before {
  content: ''; display: block; width: 21px; height: 21px; margin: auto; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* كلمة المرور ظاهرة: عين مشطوبة */
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .pw:has(input[type=text]) button::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
}
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .pw button:hover { color: var(--brand); background: #F1F5F3; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .remember { gap: 10px; margin: 2px 0 20px; font-size: 14px; color: #33403D; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .check { gap: 10px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .check input {
  appearance: none; -webkit-appearance: none; width: 19px; height: 19px; margin: 0; flex: none; border: 1.6px solid #59645F; border-radius: 5px; background: #fff; cursor: pointer;
}
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .check input:checked {
  background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  border-color: var(--brand);
}
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .check input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .btn[type=submit] { position: relative; height: 50px; border-radius: 9px; font-size: 17px; font-weight: 700; background: #0C4A40; box-shadow: 0 6px 14px rgba(8, 60, 52, .18); }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .btn[type=submit]:hover { background: #083B33; }
/* «الذهاب إلى الدخول» بعد التفعيل: رابط بشكل زر «دخول» نفسه */
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card a.btn { display: flex; align-items: center; justify-content: center; position: relative; height: 50px; border-radius: 9px; font-size: 17px; font-weight: 700;
  background: #0C4A40; color: #fff; text-decoration: none; box-shadow: 0 6px 14px rgba(8, 60, 52, .18); }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card a.btn:hover { background: #083B33; color: #fff; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card :is(.btn[type=submit], a.btn)::after {
  content: ''; position: absolute; left: 20px; top: 50%; width: 21px; height: 21px; transform: translateY(-50%); background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12H5M11 6l-6 6 6 6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12H5M11 6l-6 6 6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .switch { margin-top: 22px; padding-top: 18px; border-top: 1px solid #DCD6CA; font-size: 14px; color: #5D6A66; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .switch b { display: block; font-size: 15px; color: #13201E; margin-bottom: 2px; }
body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .switch a { font-weight: 700; }

/* تابلت: اللوحتان متجاورتان بمسافات أصغر */
@media (max-width: 1100px) {
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside { padding: 28px 28px 22px; gap: 16px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand svg { width: 46px; height: 46px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand b { font-size: 24px; }
}
/* تابلت عمودي وهاتف: اللوحة الخضراء رأس مختصر فوق النموذج، بلا الرسم */
@media (max-width: 860px) {
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth { grid-template-columns: 1fr; min-height: 0; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside { padding: 24px 24px 26px; gap: 14px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-art, body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside > small { display: none; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-intro h1 { font-size: 24px; max-width: none; margin: 4px 0 6px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 15px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points li { gap: 8px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points li::before { width: 20px; height: 20px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-main { padding: 32px 24px 40px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .lead { margin-bottom: 30px; }
}
@media (max-width: 560px) {
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside { padding: 20px 16px 22px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand svg { width: 46px; height: 46px; border-radius: 12px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand b { font-size: 24px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-aside .brand span { font-size: 16px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-intro h1 { font-size: 22px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-intro p, body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-points { display: none; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-main { padding: 26px 16px 32px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card h2 { font-size: 24px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .lead { font-size: 14px; margin-bottom: 20px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .field input:not([type=checkbox]) { height: 46px; font-size: 16px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .auth-card .btn[type=submit] { height: 50px; font-size: 17px; }
  body:is([data-page="login"], [data-page="owner-login"], [data-page="activate"]) .remember { font-size: 15px; }
}

/* جداول الشيكات (صندوق الشيكات وقائمة الشيكات): القيم والعناوين في وسط الخلية (رقم الشيك، رقم الحساب، قيمة العملة، المبلغ…) */
.chq-box th, .chq-box td, .chq-list th, .chq-list td { text-align: center; }
.chq-list td .actions, .chq-box td .actions { justify-content: center; }
/* عناوين الأعمدة الرقمية (الرقم، المبلغ): زر الترتيب يحمل .num فيأخذ عرض 110px ونصه في بدايته؛ في جداول الشيكات يتوسّط */
.chq-box th .th-sort, .chq-list th .th-sort { width: auto; justify-content: center; }

/* قائمة «إجراءات ▾» لصف في جدول (الشيكات): زر واحد بموقع ثابت، والقائمة مثبتة فوق الصفحة؛ وعلى الهاتف لوحة من الأسفل */
.row-menu-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.row-menu-btn .caret { font-size: 11px; line-height: 1; opacity: .7; }
.row-menu-btn[aria-expanded="true"] { background: var(--soft, #F1F4F4); }
.row-menu-cell { white-space: nowrap; }
tr.row-click { cursor: pointer; }
.row-menu { position: fixed; z-index: 90; min-width: 170px; max-width: min(280px, 92vw); max-height: 70vh; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid #E3E8E7; border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 32, 30, .16); }
.row-menu [role="menuitem"] { display: block; padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink-2, #33403D); font: inherit; font-size: 14px; text-align: start; text-decoration: none; cursor: pointer; }
.row-menu [role="menuitem"]:hover, .row-menu [role="menuitem"]:focus-visible { background: var(--soft, #F1F4F4); outline: none; }
.row-menu [role="menuitem"].danger { color: var(--danger); }
.row-menu [role="menuitem"].danger:hover, .row-menu [role="menuitem"].danger:focus-visible { background: #FDF0EF; }
.row-menu-sep { height: 1px; margin: 4px 6px; background: #E9EDEC; }
.row-menu-shade { position: fixed; inset: 0; z-index: 89; background: rgba(16, 32, 30, .35); }
.row-menu.sheet { inset: auto 0 0 0; max-width: none; min-width: 0; max-height: 75vh; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(16, 32, 30, .18); }
.row-menu.sheet [role="menuitem"] { padding: 14px 16px; font-size: 16px; text-align: center; }
.row-menu-title { padding: 4px 8px 10px; text-align: center; font-weight: 700; color: var(--ink); border-bottom: 1px solid #E9EDEC; margin-bottom: 4px; }
.row-menu-cancel { margin-top: 8px; padding: 13px; border: 1px solid #E3E8E7; border-radius: 12px; background: #fff; color: var(--ink-2, #33403D); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }

/* سند القبض أو الصرف عند التعديل: الشيك الذي تحرّك مقفل بكل خاناته حتى يُتراجع عن حركاته */
.chq-table tr.chq-locked td { background: #F6F7F7; }
.chq-table tr.chq-locked input:disabled { color: var(--ink-2, #33403D); background: transparent; cursor: not-allowed; }
.chq-lock { font-size: 13px; }

/* بطاقة الحساب، «مرتبط بحساب»: رقم الأب في مربعه، فلا يُكرَّر صغيراً فوق الاختيار (كان يُنزل الحقل عن مستوى جاره)، والمربع بارتفاع الحقل */
.acard-parent > .picker > .pick-meta { display: none; }
.acard-parent { align-items: stretch; }
.acard-parent > .acard-pcode { display: flex; align-items: center; justify-content: center; }
.acard-plabel { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.acard-lcode { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ── «الموظفون والدوام» (2026-11-07): رأس الصفحة، والتبويبات، والبحث و«تصفية» و«عرض» فوق الجداول، وقائمة «⋯» ── */
.ui-icon { flex: none; display: block; }
.hr-page { display: grid; gap: 20px; align-content: start; min-width: 0; }
.hr-page > * { min-width: 0; }
body:has(#view > .tab-pane:not([hidden]) > .hr-page) #view-title, body:has(#view > .hr-page) #view-title { visibility: hidden; }
.hr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.hr-head-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hr-head-title h2 { margin: 0; font-size: 30px; line-height: 1.25; font-weight: 700; color: var(--ink); }
.hr-head-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: #E9EFEE; color: var(--brand); flex: none; }
.hr-head-actions .btn { display: inline-flex; align-items: center; gap: 10px; width: auto; padding: 13px 26px; border-radius: 12px; font-size: 17px; }
.hr-page > .tabs { gap: 10px; }
.hr-page > .tabs [role=tab] { padding: 8px 20px; font-size: 15px; color: var(--ink-2, #33403D); border-color: #E3E8E7; }
.hr-page > .tabs [role=tab][aria-selected=true] { color: #fff; border-color: var(--brand); font-weight: 600; }
.hr-page .card { border-color: #E6EBEA; border-radius: 16px; padding: 16px; }
.hr-page .card > h3 { padding: 4px 4px 0; }

.dt-tools-search { align-items: stretch; gap: 12px; }
.dt-search { position: relative; flex: 1 1 320px; max-width: 520px; display: flex; align-items: center; }
.dt-search .ui-icon { position: absolute; inset-inline-start: 14px; color: var(--muted); pointer-events: none; }
.dt-search input { font: inherit; width: 100%; box-sizing: border-box; padding: 11px 46px 11px 14px; padding-inline: 46px 14px; border: 1px solid #DDE4E2; border-radius: 12px; background: #fff; color: var(--ink); }
.dt-search input::placeholder { color: #7A8784; }
.dt-tools-search .actions { gap: 12px; align-items: stretch; }
.dt-tools-search .actions > .btn, .dt-tools-search .dt-cols > summary { display: inline-flex; align-items: center; gap: 8px; height: 100%; min-height: 46px; box-sizing: border-box; padding: 8px 20px; border-radius: 12px; font-size: 15px; font-weight: 500; border-color: #DDE4E2; }
.dt-tools-search .actions > .btn[aria-pressed=true] { border-color: var(--brand); color: var(--brand); background: #F2F8F7; }
.dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 0 4px; }
.dt-box-search .table-wrap { margin-top: 4px; }
.dt-box-search .dt thead th, .dt-box-search table thead th { background: #F2F4F4; color: var(--ink); font-size: 15px; font-weight: 600; padding: 14px 16px; border-bottom: 0; }
.dt-box-search .dt thead tr:first-child th:first-child { border-start-start-radius: 12px; border-end-start-radius: 12px; }
.dt-box-search .dt thead tr:first-child th:last-child { border-start-end-radius: 12px; border-end-end-radius: 12px; }
.dt-box-search .dt-filters th { background: #F7F8F8; padding: 8px 10px; }
.dt-box-search .th-sort { font-weight: 600; color: var(--ink); }
.dt-box-search .dt td { padding: 13px 16px; border-bottom-color: #EEF1F0; vertical-align: middle; font-size: 15px; }
.dt-box-search .dt tbody tr:last-child td { border-bottom: 0; }

.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #EAF0EF; color: var(--brand); flex: none; }
.person b { font-size: 16px; }
.pill.kind { padding: 5px 16px; font-size: 14px; font-weight: 500; background: #E3EEEC; color: var(--brand-dark); }
.pill.none { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; font-size: 13px; font-weight: 500; background: #F1F3F3; color: var(--muted); }
.hr-page .pill { padding: 4px 14px; font-size: 13px; }

.row-menu-dots { justify-content: center; min-width: 48px; height: 36px; padding: 0 12px; border-radius: 10px; border-color: #DDE4E2; font-size: 20px; line-height: 1; letter-spacing: 1px; font-weight: 700; color: var(--ink); }
.row-menu [role="menuitem"] { display: flex; align-items: center; gap: 12px; }
.row-menu [role="menuitem"] .ui-icon { color: var(--muted); }
.row-menu [role="menuitem"].danger .ui-icon { color: var(--danger); }
.row-menu.sheet [role="menuitem"] { justify-content: center; }
@media (max-width: 700px) {
  .hr-head-title h2 { font-size: 23px; }
  .hr-head-ico { width: 44px; height: 44px; }
  .hr-head-actions, .hr-head-actions .btn { width: 100%; justify-content: center; }
  .dt-search { max-width: none; flex-basis: 100%; }
}

/* ── الفاتورة بتخطيط إتقان (2026-11-07): رأس بخمس خانات، وتبويبات، وشريط ثابت بالمجاميع والأزرار ── */
.inv-page { display: grid; gap: 14px; align-content: start; min-width: 0; }
.inv-page > * { min-width: 0; }
.inv-title { margin: 0; font-size: 22px; color: var(--ink); }
.inv-headcard { padding: 14px 16px; }
.inv-head5 { display: grid; grid-template-columns: minmax(220px, 2.2fr) minmax(110px, 1fr) minmax(110px, 1fr) minmax(150px, 1.3fr) minmax(190px, 1.4fr); gap: 10px 12px; align-items: end; }
.inv-head5 .field { margin: 0; }
.inv-tabs { gap: 8px; }
.inv-tabs [role=tab] { padding: 8px 20px; font-size: 15px; }
.inv-body { min-height: 260px; }
.inv-body > [hidden] { display: none !important; }
.inv-disc { gap: 8px; flex-wrap: nowrap; }
.inv-disc select { min-width: 150px; }
.inv-disc input { max-width: 140px; }
.inv-foot { position: sticky; bottom: 8px; z-index: 5; display: flex; align-items: stretch; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; box-shadow: 0 -4px 18px rgba(16, 32, 30, .08); }
.inv-foot-totals { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 8px; flex: 1 1 460px; }
.inv-foot-box { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #F7F9F8; text-align: center; }
.inv-foot-box small { color: var(--muted); font-size: 12px; }
.inv-foot-box b { font-size: 17px; }
.inv-foot-box:last-child { background: #E6F1EF; border-color: #CFE3DF; }
.inv-foot-box:last-child b { color: var(--brand-dark); font-size: 19px; }
.inv-foot-actions { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.inv-foot-actions .btn { width: auto; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 76px; padding: 8px 12px; font-size: 13px; }
.inv-foot-actions .inv-save { min-width: 96px; font-size: 15px; }
@media (max-width: 900px) {
  .inv-head5 { grid-template-columns: 1fr 1fr; }
  .inv-head5 > :first-child { grid-column: 1 / -1; }
  .inv-foot { position: static; }
  .inv-foot-totals { grid-template-columns: repeat(2, 1fr); }
  .inv-foot-actions { width: 100%; }
  .inv-foot-actions .btn { flex: 1 1 0; }
}
.inv-foot-box[hidden] { display: none; }
.inv-foot-totals:has(> .inv-foot-box[hidden]) { grid-template-columns: minmax(160px, 260px); justify-content: start; }
/* القيمة في وسط خانتها تحت اسمها، والأزرار بحجم واحد (2026-11-07) */
.inv-foot-box { justify-items: center; align-content: center; text-align: center; }
.inv-foot-box small, .inv-foot-box b { display: block; width: 100%; text-align: center; }
.inv-foot-actions .btn, .inv-foot-actions .inv-save { width: 88px; min-width: 88px; height: 64px; padding: 6px 8px; font-size: 14px; font-weight: 600; flex: none; }
.inv-foot-actions .btn .ui-icon { width: 22px; height: 22px; }
.inv-foot { align-items: center; }
@media (max-width: 900px) { .inv-foot-actions .btn, .inv-foot-actions .inv-save { width: auto; min-width: 0; flex: 1 1 0; } }
/* زر سند الفاتورة في شريط تبويباتها (يفتح السند في نافذة منبثقة) */
.inv-pay-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 15px; font-weight: 600; padding: 8px 18px; border-radius: 99px; border: 1px solid var(--brand); background: #F2F8F7; color: var(--brand); cursor: pointer; }
.inv-pay-btn:hover { background: var(--brand); color: #fff; }

/* ── الفاتورة بتصميم المرجع (2026-11-07، فواتير البيع والشراء ومردوداتها): الشكل والمسافات والترتيب فقط، والعناصر والوظائف نفسها.
   أحجام مضغوطة (بطلب صاحب الشركة): خطوط 14–15 وخانات 36–38 بكسل، مريحة للنقر دون تكبير ── */
.inv-page { gap: 10px; }
/* الرأس: زر الرجوع يمين العنوان، ثم أيقونة النوع والعنوان */
.inv-page > .inv-top { justify-content: flex-start; gap: 12px; padding: 8px 14px; margin-bottom: 0; }
.inv-top .back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.inv-top .back:hover { border-color: var(--brand); color: var(--brand); }
.inv-top .hr-head-title { gap: 10px; }
.inv-top .hr-head-title h2 { font-size: 21px; }
.inv-top .hr-head-ico { width: 38px; height: 38px; border-radius: 10px; }
.inv-top .hr-head-ico .ui-icon { width: 22px; height: 22px; }
/* بيانات الفاتورة: عنوان كل خانة بأيقونته، والطرف أعرضها، وفواصل خفيفة بينها */
.inv-page .inv-headcard { padding: 10px 14px; }
.inv-page .inv-head5 { gap: 8px 0; align-items: end; }
.inv-page .inv-head5 > .field { padding-inline: 10px; gap: 4px; }
.inv-page .inv-head5 > .field + .field { border-inline-start: 1px solid var(--line); }
.inv-page .inv-head5 > .field:first-child { padding-inline-start: 0; }
.inv-page .inv-head5 > .field:last-child { padding-inline-end: 0; }
.inv-page .inv-head5 .field label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink); }
.inv-page .inv-head5 .field label .ui-icon { width: 16px; height: 16px; color: var(--muted); flex: none; }
.inv-page .inv-head5 .vlabel { align-items: center; }
.inv-page .inv-head5 .vlabel .pick-meta { font-size: 13px; font-weight: 600; color: var(--muted); opacity: 1; text-align: left; direction: ltr; }
.inv-page .inv-head5 input, .inv-page .inv-head5 select { min-height: 38px; font-size: 15px; border-radius: 8px; }
/* التبويبات والمحتوى في بطاقة واحدة؛ والسند في طرفها الآخر */
.inv-page .inv-main { padding: 10px 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.inv-page .inv-main > * { min-width: 0; }
.inv-page .inv-tabs { gap: 8px; align-items: center; }
.inv-page .inv-tabs [role=tab] { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 16px; border-radius: 8px; font-size: 15px; font-weight: 600; color: var(--ink); border-color: var(--line); }
.inv-page .inv-tabs [role=tab] .ui-icon, .inv-page .inv-tabs .inv-pay-btn .ui-icon { width: 17px; height: 17px; }
.inv-page .inv-tabs [role=tab] .ui-icon { color: var(--muted); }
.inv-page .inv-tabs [role=tab][aria-selected=true], .inv-page .inv-tabs [role=tab][aria-selected=true] .ui-icon { color: #fff; }
.inv-page .inv-tabs .inv-pay-btn { margin-inline-start: auto; min-height: 38px; padding: 0 16px; border-radius: 8px; font-size: 15px; gap: 7px; background: #fff; }
.inv-page .inv-tabs .inv-pay-btn:hover { background: var(--brand); color: #fff; }
.inv-page .inv-body { min-height: 200px; }
/* محتوى التبويبات بلا بطاقة داخل بطاقة */
.inv-page .inv-body > .card { border: 0; box-shadow: none; padding: 0; margin: 0; background: transparent; }
.inv-page .inv-body > .grid2 { gap: 2px 16px; }
.inv-page .inv-body .field { margin-bottom: 10px; gap: 4px; }
.inv-page .inv-body .field > label { font-size: 14px; }
/* جدول الأصناف: رأس رمادي واضح، والأرقام في الوسط */
.inv-page .table-wrap { border: 1px solid var(--line); border-radius: 10px; }
.inv-page table.inv-lines { font-size: 14.5px; }
.inv-page table.inv-lines th { background: #F3F5F4; color: var(--ink); font-weight: 700; font-size: 14.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.inv-page table.inv-lines td { padding: 5px 8px; vertical-align: middle; }
.inv-page table.inv-lines tbody tr:last-child td { border-bottom: 0; }
.inv-page table.inv-lines input, .inv-page table.inv-lines select { min-height: 36px; font-size: 15px; border-radius: 7px; }
.inv-page table.inv-lines input.num { text-align: center; }
.inv-page table.inv-lines td.avail { color: var(--brand); font-weight: 700; font-size: 15px; text-align: center; }
.inv-page table.inv-lines td.avail.short { color: var(--danger); }
.inv-page table.inv-lines td.line-total { font-size: 15px; font-weight: 600; white-space: nowrap; }
.inv-page table.inv-lines td.line-del { width: 36px; text-align: center; }
.inv-page table.inv-lines td.line-del .link { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: var(--danger); }
.inv-page table.inv-lines td.line-del .link .ui-icon { width: 18px; height: 18px; }
.inv-page table.inv-lines td.line-del .link:hover { background: var(--danger-bg); }
.inv-page table.inv-lines .btn.small { padding: 5px 10px; font-size: 13px; }
.inv-page .btn.inv-add { width: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 16px; border: 1px solid var(--brand); border-radius: 8px; color: var(--brand); font-size: 14.5px; }
.inv-page .btn.inv-add:hover { background: #F2F8F7; }
.inv-page .row.mt:has(> .inv-add) { margin-top: 10px; }
/* الشريط السفلي: الإجمالي واضح في جهة، والأزرار بأيقونة وكلمة في سطر، والحفظ بارز */
.inv-page .inv-foot { padding: 8px 14px; gap: 10px; }
.inv-page .inv-foot-totals { flex: 0 1 auto; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(118px, auto); gap: 6px; }
.inv-page .inv-foot-box { padding: 5px 12px; border-radius: 10px; gap: 0; }
.inv-page .inv-foot-box small { font-size: 12.5px; }
.inv-page .inv-foot-box b { font-size: 16px; }
.inv-page .inv-foot-box:last-child { min-width: 190px; }
.inv-page .inv-foot-box:last-child b { font-size: 21px; line-height: 1.3; white-space: nowrap; }
.inv-page .inv-foot-totals:has(> .inv-foot-box[hidden]) { grid-template-columns: none; }
.inv-page .inv-foot-actions { gap: 8px; align-items: center; }
.inv-page .inv-foot-actions .btn, .inv-page .inv-foot-actions .inv-save { flex-direction: row; gap: 7px; width: auto; min-width: 96px; height: 40px; padding: 0 14px; border-radius: 8px; font-size: 15px; font-weight: 600; }
.inv-page .inv-foot-actions .inv-save { min-width: 116px; }
.inv-page .inv-foot-actions .btn .ui-icon { width: 17px; height: 17px; }
@media (max-width: 1100px) {
  .inv-page .inv-foot-actions .btn, .inv-page .inv-foot-actions .inv-save { min-width: 0; padding: 0 12px; }
}
@media (max-width: 900px) {
  .inv-page > .inv-top { gap: 10px; padding: 8px 12px; }
  .inv-top .hr-head-title h2 { font-size: 19px; }
  .inv-page .inv-headcard, .inv-page .inv-main { padding: 10px 12px; }
  .inv-page .inv-head5 { gap: 8px 10px; }
  .inv-page .inv-head5 > .field, .inv-page .inv-head5 > .field + .field { padding-inline: 0; border-inline-start: 0; }
  .inv-page .inv-tabs [role=tab], .inv-page .inv-tabs .inv-pay-btn { min-height: 38px; padding: 0 12px; font-size: 14.5px; }
  .inv-page .inv-foot-totals { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); width: 100%; }
  .inv-page .inv-foot-box:last-child { min-width: 0; grid-column: 1 / -1; }
  .inv-page .inv-foot-totals:has(> .inv-foot-box[hidden]) { grid-template-columns: 1fr; }
  .inv-page .inv-foot-actions .btn, .inv-page .inv-foot-actions .inv-save { flex: 1 1 0; height: 40px; }
}
@media (max-width: 560px) {
  .inv-page .inv-head5 { grid-template-columns: 1fr; }
  .inv-page .inv-tabs .inv-pay-btn { margin-inline-start: 0; width: 100%; justify-content: center; }
  .inv-page .inv-foot-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .inv-page .inv-foot-actions .btn { width: 100%; }
}
/* محتوى المصاريف والمعلومات بأحجام الفاتورة نفسها */
.inv-page .inv-body .charge-row input:not([type=checkbox]), .inv-page .inv-body .charge-row select, .inv-page .inv-body .charge-row .picker input { min-height: 36px; font-size: 14.5px; border-radius: 7px; }
.inv-page .inv-body .charge-label { font-size: 13px; font-weight: 600; }
.inv-page .inv-body .charge-row { border-radius: 10px; }
.inv-page .inv-body > .card > .btn.small.light, .inv-page .inv-body > .grid2 .btn.small.light { min-height: 36px; padding: 0 14px; border-radius: 8px; font-size: 14.5px; }
.inv-page .inv-body > .grid2 input:not([type=checkbox]), .inv-page .inv-body > .grid2 select { min-height: 38px; font-size: 15px; border-radius: 8px; }
.inv-page .inv-body .dmy > .dmy-text, .inv-page .inv-head5 .dmy > .dmy-text { min-height: 38px; }
@media (max-width: 900px) { .inv-page table.inv-lines td:nth-child(2) { min-width: 200px; } }
/* عرض متوسط (لابتوب صغير أو جهاز لوحي أفقي): الرأس في صفين دون خروج عن البطاقة */
@media (max-width: 1280px) and (min-width: 901px) {
  .inv-page .inv-head5 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 0; }
  .inv-page .inv-head5 > .field:nth-child(4) { grid-column: 1; padding-inline-start: 0; border-inline-start: 0; }
  .inv-page .inv-head5 > .field:nth-child(5) { grid-column: 2 / -1; padding-inline-end: 0; }
  .inv-page .inv-head5 > .field:nth-child(3) { padding-inline-end: 0; }
}
/* الخصم أكبر من قيمة الفاتورة: الخانة حمراء ورسالة تحتها، ولا يُحفظ */
.inv-page .inv-disc input.bad { border-color: var(--danger); background: var(--danger-bg); }
.inv-page .inv-disc-msg { display: block; margin-top: 4px; color: var(--danger); font-size: 13px; font-weight: 600; }
.inv-page .inv-disc-msg[hidden] { display: none; }
/* مجموعا القبض والصرف ومجموعا البيع والشراء فوق القائمة */
.sum-boxes { margin: 4px 0 12px; }
.sum-boxes .stat b { display: block; font-size: 22px; color: var(--brand-dark); white-space: nowrap; }
.sum-boxes .sum-draft { display: block; margin-top: 4px; font-size: 13.5px; }
/* تاريخا الفلتر «من» و«إلى» جنباً إلى جنب في سطر واحد بعنوان قصير لكل منهما */
.filters .filter-date { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 250px; min-width: 210px; margin: 0; }
.filters .filter-date > span { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.filters .filter-date > .dmy, .filters .filter-date > input { flex: 1 1 auto; min-width: 0; }
.filters .filter-date .dmy-text { width: 100%; min-width: 0; }
@media (max-width: 560px) { .filters .filter-date { flex: 1 1 100%; } }
.inv-page .inv-foot-box.bad { background: var(--danger-bg); border-color: #F5C2BE; }
.inv-page .inv-foot-box.bad b { color: var(--danger); }
/* المؤشر لا يختفي تحت الشريط السفلي الثابت ولا تحت الرأس الثابت عند الانتقال بـ Enter أو Tab */
.inv-page input, .inv-page select, .inv-page textarea { scroll-margin-bottom: 110px; scroll-margin-top: 80px; }
/* عناوين أعمدة الأصناف فوق قيمها (2026-11-07): الأعمدة الرقمية والمخزن في الوسط كقيمها، والصنف في أول الخانة؛ وخانات الكمية
   والبونص والسعر أضيق قليلاً فيتسع الجدول في بطاقته بلا تمرير أفقي */
.inv-page table.inv-lines th { text-align: center; }
.inv-page table.inv-lines th:nth-child(2) { text-align: start; }
.inv-page table.inv-lines td.line-total { text-align: center; }
.inv-page table.inv-lines input.num { width: 92px; }
.inv-page table.inv-lines .line-wh { min-width: 140px; }
/* المجموع في صندوق مغلق بحجم خانات السطر (لا يُكتب فيه)، والكمية فوق المتوفر حمراء */
.inv-page table.inv-lines .line-total-box { display: inline-flex; align-items: center; justify-content: center; min-width: 96px; min-height: 36px; padding: 0 10px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 7px; background: #F3F5F4; color: var(--ink); font-weight: 700; font-size: 15px; white-space: nowrap; cursor: default; user-select: text; }
.inv-page table.inv-lines input.short { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); font-weight: 700; }
/* الفاتورة: بلا سطر «رمز الصنف · المتوفر» فوق اسم الصنف المختار (يبقى في نتائج البحث)، وصندوق المجموع بحجم خانات السطر */
.inv-page table.inv-lines .picker > .pick-meta { display: none; }
.inv-page table.inv-lines .line-total-box { width: 104px; min-width: 104px; height: 36px; min-height: 36px; padding: 0 6px; font-size: 14.5px; font-weight: 600; }
.inv-page table.inv-lines td.line-total { width: 112px; }
/* زر «بطاقة الصنف» في نافذة الكميات: ناعم بجانب «إغلاق» */
dialog.modal .stk-card-btn { width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; color: var(--brand); border-color: #CFE3DF; background: #F2F8F7; }
dialog.modal .stk-card-btn:hover { background: #E6F1EF; border-color: var(--brand); }
.inv-page table.inv-lines .line-total-box { height: 44px; min-height: 44px; }
dialog.modal .stk-actions { gap: 8px; align-items: center; }
dialog.modal .stk-actions .btn { width: auto; flex: 0 0 auto; padding: 8px 16px; }
/* رقم السطر بجانب اسم الصنف */
.inv-page table.inv-lines td.line-no { width: 34px; padding-inline: 4px; text-align: center; color: var(--muted); font-weight: 700; font-size: 14px; }
/* علامة «!» بجانب عنوان الخانة: التنبيه عند المرور أو الضغط */
.hint-mark { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-inline-start: 6px; padding: 0; border: 0; border-radius: 50%;
  background: #FEF3C7; color: #B45309; font: 700 11px/1 inherit; cursor: help; vertical-align: middle; }
.hint-mark:hover, .hint-mark:focus-visible { background: #FDE68A; outline: none; }
/* قائمة السندات بتصميم إتقان وألوان Collect: بطاقة فلاتر بست خانات، والجدول ببحثه، وشريط ثابت بالأزرار والمجموعين */
.vlist-page .vlist-filters { padding: 10px 14px; }
.vlist-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 12px; align-items: end; }
.vlist-grid .field { margin: 0; gap: 4px; }
.vlist-grid .field > label { font-size: 14px; font-weight: 700; color: var(--ink); }
.vlist-grid input, .vlist-grid select, .vlist-grid .dmy > .dmy-text { min-height: 38px; font-size: 15px; border-radius: 8px; }
.vlist-page .vlist-main { padding: 10px 14px; }
.vlist-title { margin: 0 0 6px; font-size: 16px; }
.vlist-search { display: inline-flex; align-items: center; gap: 8px; }
.vlist-search .search { min-width: 300px; min-height: 36px; }
.vlist-page .vlist-foot .inv-foot-box small.sum-draft { font-size: 11.5px; color: var(--muted); }
@media (max-width: 1100px) { .vlist-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .vlist-grid { grid-template-columns: 1fr 1fr; } .vlist-search, .vlist-search .search { min-width: 0; width: 100%; } }
.vlist-grid .picker > .pick-meta { display: none; }
/* المجموعان بحجم ولون واحد */
.vlist-page .vlist-foot .inv-foot-box, .vlist-page .vlist-foot .inv-foot-box:last-child { min-width: 180px; background: #E6F1EF; border-color: #CFE3DF; }
.vlist-page .vlist-foot .inv-foot-box b, .vlist-page .vlist-foot .inv-foot-box:last-child b { font-size: 19px; color: var(--brand-dark); }
.vlist-grid input:not([type=checkbox]), .vlist-grid select, .vlist-grid .dmy > .dmy-text { height: 40px; min-height: 40px; box-sizing: border-box; }
/* عناوين جدول السندات فوق قيمها: في الوسط، والبيان والحساب والملاحظة في أول الخانة */
.vlist-page .dt-box th, .vlist-page .dt-box td { text-align: center; }
.vlist-page .dt-box th > button { justify-content: inherit; }
/* صندوق المجموع لا يخرج نصه عن إطاره (الرقم الطويل يُقصّ بنقاط، وكاملاً عند المرور) */
.inv-page table.inv-lines .line-total-box { display: inline-block; line-height: 42px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; text-align: center; }
.inv-page .inv-foot-box b { overflow-wrap: anywhere; }
/* قائمة الفواتير بنمط السندات: سبع خانات فلترة، والأعمدة النصية (البيان والحساب والملاحظة) في أول الخانة */
.ilist-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 1280px) { .ilist-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) { .ilist-grid { grid-template-columns: 1fr 1fr; } }
/* قائمتا السندات والفواتير: كل عنوان في وسط عموده فوق قيمته، والقيم في الوسط (بقرار صاحب الشركة) */
.vlist-page .dt-box th > * { margin-inline: auto; }
/* قائمتا السندات والفواتير: اسم العمود (زر الترتيب) في وسط عموده فوق قيمته، وسهم الترتيب لا يزيحه؛ والحالة والأرقام والتاريخ في سطر واحد */
.vlist-page .dt-box th > .th-sort { display: inline-flex; justify-content: center; width: auto; margin-inline: auto; position: relative; }
.vlist-page .dt-box th > .th-sort .th-arrow { position: absolute; inset-inline-end: -14px; }
.vlist-page .dt-box td .pill, .vlist-page .dt-box td.num, .vlist-page .dt-box td:nth-child(9) { white-space: nowrap; }
.vlist-page .dt-box td:nth-child(2) { white-space: nowrap; }
/* رصيد الطرف في سند القبض والصرف (قبل / المبلغ / بعد) بتصميم «إجمالي مدين / إجمالي دائن» في سند القيد (2026-11-07):
   بطاقة بإطار، والاسم صغيراً خافتاً، والقيمة عريضة في وسط صندوقها */
.vbalance { grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.vbalance .field { gap: 4px; }
.vbalance .field > label { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.vbalance input, body .vbalance input { height: 36px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #FAFBFA;
  color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1; font-size: 15px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; cursor: default; }
.vbalance { grid-template-columns: repeat(3, minmax(120px, 150px)); width: max-content; max-width: 100%; }
.vbalance .field input.num, body .vbalance .field input.num { text-align: center; }
@media (max-width: 600px) { .vbalance { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; } }
/* مستندات القيد: أزرار التصدير في الشريط السفلي بحجم أزراره */
.vlist-foot .inv-foot-actions .export-bar { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.vlist-foot .inv-foot-actions .export-bar .btn { min-width: 0; }
/* مستندات القيد: «طباعة» في الشريط السفلي بحجم أزراره، وقائمتها (طباعة، PDF، Excel، Word) تنفتح إلى أعلى */
.vlist-foot .j-print .export-menu summary { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 8px; font-size: 15px; font-weight: 600; }
.vlist-foot .j-print .export-pop { top: auto; bottom: calc(100% + 6px); }
.vlist-foot .j-print .export-pop .btn { width: 100%; height: auto; min-width: 0; padding: 6px 12px; font-size: 14px; }
.box-grid .picker > .pick-meta { display: none; }
.box-stats .field:nth-child(3) { width: 180px; }
/* مستند حركة الشيك: من حساب وتاريخ الحركة وإلى حساب في صف، ونافذتا تغيير التاريخ والمرفقات */
.mv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mv-grid .vlabel { display: flex; justify-content: space-between; align-items: center; }
.mv-grid .vlabel .pick-meta { font-size: 13px; font-weight: 600; color: var(--brand); }
.mv-grid input:disabled { color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1; background: #FAFBFA; }
dialog.mv-date { width: min(380px, calc(100vw - 32px)); text-align: center; }
dialog.mv-date .dmy, dialog.mv-date input { width: 100%; }
dialog.mv-date .mv-date-range { margin: 8px 0 0; font-size: 13px; }
dialog.mv-date .row { justify-content: center; gap: 10px; }
dialog.mv-date .row .btn { width: auto; min-width: 120px; }
dialog.mv-files { width: min(640px, calc(100vw - 32px)); }
@media (max-width: 600px) { .mv-grid { grid-template-columns: 1fr; } }

/* نقطة البيع: الخصم بمبلغ أو نسبة (2026-11-08) */
.pos-disc { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 8px; }
.pos-disc .pos-disc-kind { font-size: 1.2rem; text-align: center; }

/* الفواتير: شريط تمرير داخل جدول الأصناف، ورأس الجدول ثابت أثناء التمرير (2026-11-08) */
.inv-page .inv-items-scroll { max-height: max(240px, calc(100vh - 470px)); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.inv-page .inv-items-scroll thead th { position: sticky; top: 0; z-index: 3; }
.inv-page .inv-items-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.inv-page .inv-items-scroll::-webkit-scrollbar-thumb { background: #B9C6C2; border-radius: 8px; border: 2px solid #fff; }
.inv-page .inv-items-scroll::-webkit-scrollbar-thumb:hover { background: #8FA39D; }

/* نقطة البيع: اسم كل خانة فوق قيمتها (2026-11-08): الكمية والسعر والمجموع في الوسط، والصنف في أول السطر */
.pos-lines .dt th { text-align: center; }
.pos-lines .dt th.pos-item, .pos-lines .dt td.pos-item { text-align: start; }
.pos-lines .dt td.pos-no, .pos-lines .dt th.pos-no { width: 34px; padding-inline: 4px; color: var(--muted); font-weight: 700; }
.pos-lines .dt td { text-align: center; }
.pos-lines .dt td.pos-qty { display: table-cell; }
.pos-lines .dt td.pos-qty > * { vertical-align: middle; }
.pos-lines .dt td.pos-qty input.search { margin-inline: 6px; }
.pos-lines .dt input.search { text-align: center; }
.pos-lines .dt .pos-del { width: 44px; padding-inline: 4px; }
.pos-lines .dt td.pos-qty { white-space: nowrap; }

/* نقطة البيع (2026-11-08): لوحة الدفع بطول الشاشة، محتواها يتمرر وأزرار الدفع ثابتة في أسفلها فتُرى دائماً؛ وأحجام أصغر قليلاً،
   وأزرار الوردية واضحة بإطارها وأيقونتها */
.pos-side { display: flex; flex-direction: column; gap: 0; max-height: calc(100vh - 150px); padding-bottom: 0; }
.pos-side-body { display: grid; gap: 10px; overflow-y: auto; min-height: 0; padding-inline-end: 2px; padding-bottom: 8px; }
.pos-total-box { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pos-total { font-size: 2.2rem; }
.pos-paid { font-size: 1.2rem; padding: 8px 10px; }
.pos-cash { padding: 8px 4px; }
.pos-change:empty { display: none; }
.pos-side .pos-actions { position: sticky; bottom: 0; background: var(--card, #fff); border-top: 1px solid var(--line); padding: 10px 0 14px; margin-top: auto; }
.pos-pay { min-height: 50px; }
.pos-shift-actions { gap: 8px; }
.pos-shift-actions .btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-weight: 600; border: 1px solid var(--line); }
.pos-shift-actions .btn:hover { border-color: var(--brand); color: var(--brand); }
.pos-shift-actions .btn.danger { color: var(--danger); border-color: #EBC4BF; }
.pos-shift-actions .btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.pos-shift-actions .pos-mode-btn { color: var(--brand); border-color: var(--brand); }
@media (max-width: 900px) { .pos-side { max-height: none; } .pos-side-body { overflow: visible; } }
/* أزرار الوردية في صف واحد يلتف، لا مكدّسة بعرض الشاشة */
.pos-shift .pos-shift-actions { display: flex; flex-direction: row; flex-wrap: wrap; width: auto; }
.pos-shift .pos-shift-actions .btn { width: auto; flex: 0 0 auto; }
/* اسم الصنف في سطر واحد بمحاذاة عنوانه وفي وسط السطر عمودياً، والطويل يُختصر بنقاط (الاسم كاملاً عند المرور) */
.pos-lines .dt td.pos-item { min-width: 96px; }
.pos-lines .dt td.pos-item b { display: block; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4; }
.pos-lines .dt td, .pos-lines .dt th { padding-inline: 6px; }
/* شاشات متوسطة (القائمة الجانبية مفتوحة): لوحة دفع أضيق وأزرار وخانات أصغر فيتسع الجدول بلا تمرير أفقي */
@media (min-width: 901px) and (max-width: 1366px) {
  .pos { grid-template-columns: minmax(0, 1fr) 290px; gap: 10px; }
  .pos-step { width: 30px; height: 32px; font-size: 1rem; border-radius: 8px; }
  .pos-qty input.search { width: 44px !important; padding: 6px 2px !important; }
  .pos-lines .dt input.search { width: 70px; padding: 6px; }
  .pos-lines .dt td.pos-qty input.search { margin-inline: 3px; }
  .pos-total { font-size: 1.9rem; }
  .pos-lines .dt td, .pos-lines .dt th { padding-inline: 4px; }
  .pos-lines .dt td.pos-item b { max-width: 120px; }
  .pos-lines .dt .pos-del { width: 34px; }
  .pos-lines .dt td.pos-del .pos-step { width: 30px; }
}

/* نقطة البيع بطول الشاشة (2026-11-08): السلة تتمرر داخلها، وقسم «الأصناف» تحتها ولوحة الدفع ظاهران دائماً مهما كثرت الأصناف.
   --pos-top موضع الصفحة الفعلي (يضعه pos() عند الرسم وتغيير حجم النافذة) */
@media (min-width: 901px) {
  .pos { --pos-h: max(440px, calc(100vh - var(--pos-top, 170px))); }
  .pos-main { height: var(--pos-h); display: flex; flex-direction: column; gap: 12px; }
  .pos-main > .pos-lines { flex: 1 1 auto; min-height: 220px; display: flex; flex-direction: column; }
  .pos-lines .pos-table { flex: 1 1 auto; min-height: 120px; max-height: none; }
  .pos-main > section:not(.pos-lines) { flex: 0 0 auto; padding-block: 12px; }
  .pos-main > section:not(.pos-lines) h3 { margin: 0 0 8px; }
  /* صفّان من أزرار الأصناف (وأكثر في الشاشات العالية)، والباقي بالتمرير داخل القسم */
  .pos-tiles { max-height: clamp(72px, calc(100vh - 630px), 210px); min-height: 72px; }
  .pos-tile { min-height: 56px; padding: 8px 10px; }
  .pos-side { max-height: var(--pos-h); }
  /* سطور السلة أقصر فيظهر منها أكثر */
  .pos-lines .dt td { padding-block: 3px; }
  .pos-lines .dt th { padding-block: 6px; }
  .pos-lines .pos-step { height: 32px; }
  .pos-lines .dt input.search { padding-block: 5px; }
  .pos-scan .search { padding: 9px 12px; font-size: 1.05rem; }
  .pos-main > .pos-lines { padding-block: 12px; }
}
/* القائمة الجانبية مضبوبة (2026-11-08، بطلب صاحب الشركة): قسم «الأصناف» يرتفع إلى يمين السلة عموداً بطولها كله، ويعود تحتها
   حين تُفتح القائمة (body.side-mini من setSideMini في collect.js) */
@media (min-width: 1101px) {
  body.side-mini .pos-main { flex-direction: row; align-items: stretch; }
  body.side-mini .pos-main > .pos-lines { flex: 1 1 auto; min-width: 0; }
  body.side-mini .pos-main > section:not(.pos-lines) { order: -1; flex: 0 0 clamp(200px, 18vw, 300px); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
  body.side-mini .pos-main > section:not(.pos-lines) .pos-tiles { flex: 1 1 auto; max-height: none; min-height: 0; align-content: start;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  body.side-mini .pos-main > section:not(.pos-lines) .pos-cats { flex-wrap: wrap; overflow: visible; }
}

/* نقطة البيع: الصنف المضاف يُميَّز لحظة، وسطر «أُضيف: …» تحت البحث (2026-11-08) */
.pos-lines .dt tr.pos-flash td { background: #DDF1EB; transition: background .2s; }
.pos-lines .dt tr td { transition: background 1s; }
.pos-added { min-height: 1.5em; margin-top: 6px; font-size: 14px; color: var(--brand-dark); }
.pos-added:empty { min-height: 0; margin: 0; }

/* نقطة البيع: «فاتورة جديدة» والفواتير المعلّقة (2026-11-08) */
.pos-shift-actions .btn.pos-new-btn { background: var(--brand); color: #fff; border-color: var(--brand); }
.pos-shift-actions .btn.pos-new-btn:hover { background: var(--brand-dark); color: #fff; }
.pos-held { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 14px; }
.pos-held:empty { display: none; }
.pos-held-chip { display: inline-flex; align-items: center; border: 1px solid var(--warn, #C98A1B); border-radius: 999px; background: var(--warn-bg, #FFF6E5); overflow: hidden; }
.pos-held-open { border: 0; background: none; padding: 5px 10px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.pos-held-open:hover { text-decoration: underline; }
.pos-held-del { border: 0; border-inline-start: 1px solid var(--line); background: none; padding: 5px 9px; cursor: pointer; color: var(--danger); font: inherit; }
.pos-held-del:hover { background: var(--danger-bg); }

/* علامة «نقطة البيع» على الفاتورة (148) */
.pos-tag { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; background: #E7F0FB; color: #2A5DA8; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.pos-tag .ui-icon { width: 13px; height: 13px; }

/* «فواتير الوردية» في نقطة البيع (148) */
dialog.pos-docs { width: min(940px, 96vw); }
dialog.pos-docs .row { justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
dialog.pos-docs select.search { max-width: 360px; }
.pos-docs-list { max-height: min(60vh, 520px); overflow: auto; margin-top: 8px; }
.pos-docs-list thead th { position: sticky; top: 0; z-index: 1; background: #F3F5F4; }
.pos-docs-list td { vertical-align: middle; }
.pos-docs-list .actions { flex-wrap: nowrap; }
.pos-docs-foot { font-weight: 600; }
.pos-docs-list th, .pos-docs-list td { text-align: center; }
.pos-docs-list th:nth-child(2), .pos-docs-list td:nth-child(2), .pos-docs-list th:nth-child(4), .pos-docs-list td:nth-child(4) { text-align: start; }
.pos-docs-list .actions { justify-content: center; }
.pos-docs-foot .btn { width: auto; min-width: 110px; }
/* فلتر «المصدر» (148): ثمانية فلاتر في صف واحد في الشاشة العريضة */
@media (min-width: 1281px) { .ilist-grid:has(> :nth-child(8)) { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.auto-code { background: #F3F5F4 !important; color: var(--muted); cursor: default; }
/* وحدة السطر في نقطة البيع (2026-11-08) */
.pos-lines .dt select.pos-unit { display: block; margin-top: 3px; padding: 2px 6px; min-height: 28px; font-size: 13px; width: auto; max-width: 160px; }
.pos-offer { display: inline-block; margin-inline-start: 6px; padding: 0 7px; border-radius: 999px; background: #FFF1DC; color: #9A5B00; font-size: 11.5px; font-weight: 700; vertical-align: middle; }
/* خصم السطر في نقطة البيع (2026-11-08) */
.pos-line-disc { margin-inline-start: 6px; padding: 0 7px; min-height: 22px; border: 1px dashed var(--line); border-radius: 6px; background: #fff; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; vertical-align: middle; }
.pos-line-disc:hover { border-color: var(--brand); color: var(--brand); }
.pos-line-disc.on { border-style: solid; border-color: #E9B44C; background: #FFF6E5; color: #9A5B00; font-weight: 700; }
/* الدفعات الأخرى وحركة النقد في نقطة البيع (150) */
.pos-others { display: grid; gap: 6px; }
.pos-other { display: grid; grid-template-columns: 1fr 1.3fr 1fr 32px; gap: 6px; align-items: center; }
.pos-other .search { min-width: 0; padding: 6px 8px; }
dialog.pos-move { width: min(480px, 94vw); }
dialog.pos-move .seg { margin: 6px 0 10px; }
.msg-box-text { white-space: pre-line; }

/* نقطة البيع (2026-11-08): الوحدة في عمودها بجانب الكمية، والخصم في عموده بعد السعر */
.pos-lines .dt td.pos-unit-cell { white-space: nowrap; }
.pos-lines .dt select.pos-unit { display: inline-block; margin: 0; min-height: 32px; padding: 3px 6px; font-size: 13.5px; max-width: 120px; }
.pos-unit-name { display: inline-block; min-width: 40px; padding: 4px 8px; border-radius: 7px; background: #F3F5F4; color: var(--ink); font-size: 13.5px; }
.pos-lines .dt td.pos-disc-cell { white-space: nowrap; }
.pos-lines .dt td.pos-disc-cell .pos-line-disc { margin: 0; min-height: 32px; min-width: 64px; padding: 3px 8px; font-size: 13.5px; border-radius: 7px; }
.pos-lines .dt td.pos-disc-cell .pos-line-disc.on { font-variant-numeric: tabular-nums; }
@media (min-width: 901px) and (max-width: 1366px) {
  .pos { grid-template-columns: minmax(0, 1fr) 270px; }
  .pos-lines .dt select.pos-unit { max-width: 92px; font-size: 13px; }
  .pos-lines .dt td.pos-disc-cell .pos-line-disc { min-width: 54px; padding: 3px 5px; }
  .pos-lines .dt td.pos-item b { max-width: 100px; }
  .pos-lines .dt input.search { width: 62px; }
}
/* قائمة الوحدة بعرضها لا بعرض العمود */
.pos-lines .dt td.pos-unit-cell select.pos-unit { width: 112px !important; min-width: 0 !important; max-width: 112px !important; }
.pos-lines .dt th:nth-child(5), .pos-lines .dt td.pos-unit-cell { width: 120px; }
.pos-keys { margin: 0; font-size: 13px; } .pos-keys kbd { font-size: 12px; }
/* نافذة خصم السطر في نقطة البيع (2026-11-08) */
dialog.pos-ldisc { width: min(420px, 94vw); }
dialog.pos-ldisc .seg { margin: 8px 0 10px; }
dialog.pos-ldisc input.pos-paid { width: 100%; box-sizing: border-box; min-width: 0; }
.pos-ldisc-prev { display: grid; gap: 4px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #FAFBFA; }
.pos-ldisc-prev .row { justify-content: space-between; }
.pos-ldisc-net { border-top: 1px dashed var(--line); padding-top: 6px; font-size: 1.05rem; }
.pos-ldisc-limit { margin: 4px 0 0; font-size: 12.5px; }
dialog.pos-ldisc .row.mt { justify-content: flex-end; gap: 8px; }

/* لوحة الدفع في نقطة البيع مرتبة (2026-11-08): الإجمالي في صندوق بارز ومعه الباقي، ثم أقسام الزبون والخصم والدفع بعناوين صغيرة */
.pos-side-body { gap: 12px; }
.pos-total-box { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid #CFE3DD; border-bottom: 1px solid #CFE3DD; border-radius: 12px; background: #EEF6F3; }
.pos-total-label { font-size: 13px; font-weight: 700; color: var(--brand-dark); }
.pos-total-box .pos-total { margin: 2px 0; }
.pos-total-box > .muted { font-size: 12.5px; }
.pos-total-box .pos-change { font-size: 1.05rem; margin-top: 4px; padding-top: 6px; border-top: 1px dashed #CFE3DD; }
.pos-total-box .pos-change:empty { display: none; }
.pos-sec { display: grid; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.pos-sec:last-child { border-bottom: 0; }
.pos-sec-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.pos-sec-customer .field { margin: 0; }
.pos-sec-customer .field > label, .pos-sec-customer .vlabel { font-size: 13px; font-weight: 700; color: var(--muted); }
.pos-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; gap: 8px; margin: 0; }
.pos-row > span { font-size: 14px; font-weight: 600; color: var(--ink); }
.pos-row .search { min-width: 0; width: 100%; box-sizing: border-box; }
.pos-side .pos-disc .search { min-width: 0; }
.pos-side .pos-paid { font-size: 1.15rem; padding: 8px 10px; }
.pos-side .pos-cash-row { gap: 6px; }
.pos-side .pos-cash { padding: 7px 4px; font-size: 14px; }
.pos-side .check { font-size: 13.5px; }
.pos-side .pos-settings { font-size: 13px; }
/* اللوحة كلها صفوف «عنوان | خانة» (2026-11-08) */
.pos-row { grid-template-columns: 64px minmax(0, 1fr); }
.pos-row .picker, .pos-row .pick { min-width: 0; }
.pos-row .picker input, .pos-row .pick input { min-width: 0; width: 100%; box-sizing: border-box; }
.pos-sec { gap: 7px; padding-bottom: 9px; }
.pos-side .pos-cash-row { grid-template-columns: repeat(3, 1fr); }
.pos-side .pos-cash { padding: 5px 4px; font-size: 13.5px; border-radius: 8px; }
.pos-side .pos-actions { display: grid; gap: 6px; }
.pos-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pos-actions-row .btn { min-height: 42px; width: 100%; justify-content: center; }
.pos-actions-row .pos-pay { min-height: 42px; font-size: 14px; }
.pos-actions-row .pos-pay small { display: none; }
dialog.pos-ldisc .row.mt { flex-wrap: nowrap; }
dialog.pos-ldisc .row.mt .btn { width: auto; flex: 1 1 0; }
/* أزرار الدفع: ثلاثة صغيرة في صف (2026-11-08) */
.pos-side .pos-actions.pos-actions-3 { grid-template-columns: 1.15fr 1fr 0.75fr; gap: 6px; padding: 8px 0 10px; }
.pos-side .pos-actions-3 .btn, .pos-side .pos-actions-3 .pos-pay { min-height: 40px; height: 40px; padding: 4px 6px; font-size: 13.5px; gap: 4px; width: 100%; justify-content: center; white-space: nowrap; }
.pos-side .pos-actions-3 .pos-pay small { font-size: 10px; padding: 0 3px; border-radius: 4px; }

/* صندوق الإجمالي أصغر (2026-11-08): «الإجمالي» والمبلغ في سطر واحد، والقطع والتفصيل تحتهما بخط صغير */
.pos-total-box { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; row-gap: 0; padding: 7px 12px; border-radius: 10px; }
.pos-total-box .pos-total-label { font-size: 13px; }
.pos-total-box .pos-total { margin: 0; justify-self: end; font-size: 1.6rem; line-height: 1.2; }
.pos-total-box > .muted, .pos-total-box .pos-change { grid-column: 1 / -1; }
.pos-total-box > .muted { font-size: 12px; line-height: 1.4; }
.pos-total-box .pos-change { font-size: 0.95rem; margin-top: 2px; padding-top: 4px; }
@media (min-width: 901px) and (max-width: 1366px) { .pos-total-box .pos-total { font-size: 1.45rem; } }

/* خانات لوحة الدفع بارتفاع وخط واحد (2026-11-08): الزبون والخصم ونوعه والنقد والبطاقة */
.pos-side .pos-row .search, .pos-side .pos-disc .search, .pos-side .pos-row .pos-paid {
  height: 40px; min-height: 40px; box-sizing: border-box; padding: 6px 10px; font-size: 15px; line-height: 1.2; border-radius: 8px;
}
.pos-side .pos-row input.num, .pos-side .pos-disc input.num { font-size: 16px; font-weight: 600; text-align: center; }
.pos-side .pos-disc { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 6px; align-items: center; }
.pos-side .pos-disc .pos-disc-kind { padding: 4px 2px; text-align: center; text-align-last: center; font-size: 15px; font-weight: 700; color: var(--brand-dark); background: #F3F5F4; cursor: pointer; }
.pos-side .pos-row > span { align-self: center; }

/* محاذاة اللوحة كلها (2026-11-08): عمود للعناوين (64px) وعمود للخانات؛ وأزرار النقد والدفعات الأخرى والخيارات تحت عمود الخانات */
.pos-side { --pos-lbl: 64px; }
.pos-side .pos-row { grid-template-columns: var(--pos-lbl) minmax(0, 1fr); gap: 8px; }
.pos-side .pos-cash-row, .pos-side .pos-others, .pos-side .pos-sec > .check { margin-inline-start: calc(var(--pos-lbl) + 8px); }
.pos-side .pos-cash-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.pos-side .pos-cash { height: 32px; padding: 0 4px; font-size: 13.5px; }
.pos-side .pos-others .link { justify-self: start; font-size: 13.5px; padding: 2px 0; }
.pos-side .pos-sec > .check { display: flex; align-items: center; gap: 6px; font-size: 13.5px; margin-top: -2px; }
.pos-side .pos-sec > .check input { margin: 0; }
.pos-side .pos-settings { padding: 2px 0; }
.pos-side .pos-settings summary { font-size: 13px; }
.pos-side .pos-settings .field { margin-top: 6px; }
.pos-ldisc-limit.over { color: var(--danger); font-weight: 700; }

/* صندوق الإجمالي (2026-11-08): «الإجمالي» وتحته المبلغ، وبجانبه «الباقي للزبون» بالأحمر وتحته المبلغ؛ والتفصيل تحتهما */
.pos-total-box { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; column-gap: 10px; }
.pos-total-col { display: grid; gap: 0; }
.pos-total-box .pos-total { justify-self: start; }
.pos-total-box .pos-change { grid-column: auto; display: grid; gap: 0; margin: 0; padding: 0 10px 0 0; border-top: 0; border-inline-start: 1px dashed #CFE3DD; min-height: 0; }
.pos-total-box .pos-change:empty { display: block; border: 0; }
.pos-change-label { font-size: 13px; font-weight: 700; color: var(--danger); }
.pos-change-amt { font-size: 1.45rem; font-weight: 800; line-height: 1.2; color: var(--ink); }
.pos-change.neg .pos-change-amt { color: var(--danger); }
.pos-change-note { font-size: 11.5px; color: var(--muted); }
.pos-total-box > .muted { grid-column: 1 / -1; }
.pos-total-box > .muted:empty { display: none; }

/* «سجل الورديات» في نقطة البيع (2026-11-08) */
dialog.pos-log { width: min(1180px, 97vw); }
dialog.pos-log > .row:first-child { justify-content: space-between; }
.pos-log-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 6px 0 4px; }
.pos-log-filters .field { margin: 0; min-width: 150px; }
.pos-log-list { max-height: min(62vh, 560px); overflow: auto; }
.pos-log-list thead th { position: sticky; top: 0; z-index: 1; background: #F3F5F4; text-align: center; white-space: nowrap; }
.pos-log-list td { text-align: center; vertical-align: middle; white-space: nowrap; }
.pos-log-list .actions { justify-content: center; flex-wrap: nowrap; }
.pos-log-foot { justify-content: space-between; font-weight: 600; }
.pos-log-foot .btn { width: auto; }
.pos-diff-up { color: #9A5B00; }

/* المبلغ الكبير داخل صندوقه (2026-11-08): الخط بطول الرقم، ولا يخرج أبداً */
.pos-total-col, .pos-total-box .pos-change { min-width: 0; overflow: hidden; }
.pos-total-box .pos-total, .pos-change-amt { white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 100%; }
.pos-total-box .pos-total[data-len="l"], .pos-change-amt[data-len="l"] { font-size: 1.15rem; }
.pos-total-box .pos-total[data-len="xl"], .pos-change-amt[data-len="xl"] { font-size: 0.95rem; }
.pos-total-box .pos-total[data-len="xxl"], .pos-change-amt[data-len="xxl"] { font-size: 0.8rem; }
/* صندوق الإجمالي والباقي (2026-11-08): لا يأخذ عرض .num الثابت (110px)، بل عرض عموده كله، فلا يخرج المبلغ منه */
.pos-total-box .pos-total, .pos-total-box .pos-change, .pos-change-amt, .pos-change-label, .pos-change-note { width: auto; }
.pos-total-box .pos-total { justify-self: stretch; }
.pos-total-box .pos-change { grid-template-columns: minmax(0, 1fr); }
/* رقم أطول من الصندوق حتى بأصغر خط: يلتف على سطرين داخل الصندوق (2026-11-08) */
.pos-total-box .pos-total.wrap, .pos-change-amt.wrap { white-space: normal; overflow-wrap: anywhere; word-break: break-all; line-height: 1.15; }
/* «الباقي للزبون» مبلغه مميز بالأحمر، و«خصم: …» بلونه (2026-11-08) */
.pos-change-amt { color: var(--danger); font-weight: 800; }
.pos-total-box .pos-disc-sum { color: #C2410C; font-weight: 700; }
/* نقد بعملة أجنبية في نقطة البيع (153): العملة بجانب خانة النقد، ثم السعر والصندوق والمعادل بالشيقل */
.pos-cash-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; min-width: 0; }
.pos-cash-in .pos-cur { width: auto; min-width: 0; padding-inline: 6px; }
.pos-fx { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; align-items: center; margin-inline-start: 64px; font-size: 12.5px; }
.pos-fx.hidden { display: none; }
.pos-fx-rate { display: flex; align-items: center; gap: 4px; }
.pos-fx-rate input { width: 84px; min-width: 0; }
.pos-fx select { min-width: 0; width: 100%; }
.pos-fx-eq { grid-column: 1 / -1; font-weight: 700; color: var(--brand-dark); }
.pos-fx-eq:empty { display: none; }
/* اختيار العملة بجانب «نقداً» صغير ومضغوط (2026-11-08) */
.pos-cash-in .pos-cur { font-size: 12px; font-weight: 600; width: 88px; max-width: 88px; padding: 0 2px 0 4px; }
/* إشارة العملة واسمها في لوحة الدفع أصغر (2026-11-08): بتحديد أعلى من خانات اللوحة (.pos-side .pos-row .search بخط 15px) */
.pos-side .pos-row .pos-cash-in .pos-cur { font-size: 12px; font-weight: 600; width: 88px; max-width: 88px; padding: 4px 2px 4px 4px; text-align: center; text-align-last: center; }
.pos-side .pos-disc { grid-template-columns: minmax(0, 1fr) 48px; }
.pos-side .pos-disc .pos-disc-kind { font-size: 12px; font-weight: 700; width: 48px; min-width: 48px; padding: 4px 2px 4px 4px; }
/* خيار قائمة بخانات (العملات المسموح بها في نقطة البيع، 157) */
.opt-list { display: flex; flex-wrap: wrap; gap: 4px 14px; }
/* القوائم المالية (2026-11-09): عناوين الأقسام، والحسابات بشجرتها، والمجاميع، والسطور البارزة (مجمل الربح وصافيه) */
.fs-table tr.fs-head td { font-weight: 800; background: var(--soft, #F1F4F4); padding-top: 12px; }
.fs-table tr.fs-group td { font-weight: 700; }
.fs-table tr.fs-total td { font-weight: 700; border-top: 1px solid var(--line); background: #F3F7F6; }
/* سطر المجموع في جدول (كشف المجموعة): مضلل كمجموع الجداول */
.dt tr.fs-total td { font-weight: 700; background: #F3F7F6; border-top: 2px solid var(--line); }
.fs-table tr.fs-key td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--line); }
.fs-table td.num { white-space: nowrap; }
/* جدول الشركات في لوحة المنصة (2026-11-09): كل قيمة تحت عنوانها في الوسط وبلا التفاف، واسم الشركة من اليمين؛ ورقم الصف بلون حالته */
.co-table th, .co-table td { text-align: center; white-space: nowrap; vertical-align: middle; }
.co-table th:nth-child(2), .co-table td:nth-child(2) { text-align: start; }
.co-table .actions { flex-wrap: nowrap; justify-content: center; }
.co-n { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px; font-weight: 700; font-size: 13px; color: #fff; background: #6B7A77; }
.co-n.co-active { background: #1E8E4F; }
.co-n.co-suspended { background: #C62828; }
.co-n.co-trial { background: #2B6CB0; }
.co-n.co-readonly, .co-n.co-expired, .co-n.co-overdue { background: #C98A04; }

/* الأنظمة حسب النشاط في لوحة المنصة (2026-11-12): بطاقات، وخيارات النظام مجموعةً مجموعة مع شريط «حفظ التغييرات» */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.sys-card { display: flex; flex-direction: column; gap: 4px; margin: 0; color: inherit; text-decoration: none; transition: box-shadow .15s, border-color .15s; }
.sys-card:hover, .sys-card:focus-visible { color: inherit; border-color: var(--brand); box-shadow: 0 6px 18px rgba(16, 48, 44, .1); }
.sys-card.off { opacity: .7; }
.sys-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sys-card-head b { font-size: 16px; }
.sys-desc { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sys-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sys-nums b { color: var(--ink); }
.sys-opts { display: grid; grid-template-columns: minmax(190px, 240px) 1fr; gap: 18px; align-items: start; margin-top: 8px; }
.sys-cats { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 72px; }
.sys-cat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: start; cursor: pointer; font: inherit; color: inherit; }
.sys-cat:hover { background: var(--bg); }
.sys-cat.current { background: #E6F2F0; color: var(--brand); font-weight: 600; }
.sys-cat:disabled { opacity: .4; cursor: default; }
.sys-dot { display: inline-block; width: 7px; height: 7px; margin-inline-start: 6px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
.sys-panel h3 { margin-top: 0; }
.sys-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(130px, auto); gap: 8px 16px; align-items: center; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.sys-row:last-child { border-bottom: 0; }
.sys-row.dirty { background: var(--warn-bg); }
.sys-row-ctl { display: flex; align-items: center; gap: 12px; }
.sys-row-src { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sys-savebar { position: sticky; bottom: 12px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; background: #fff; border: 1px solid var(--brand); border-radius: 12px; box-shadow: 0 8px 24px rgba(16, 48, 44, .16); }
@media (max-width: 760px) {
  .sys-opts { grid-template-columns: 1fr; }
  .sys-cats { position: static; flex-direction: row; overflow-x: auto; }
  .sys-cat { white-space: nowrap; }
  .sys-row { grid-template-columns: 1fr; }
  .sys-row-src { align-items: flex-start; }
}

/* بلاطات ملونة (2026-11-14): لون المجموعة خلفية، والرمز والاسم أبيض في الوسط، والمجموعات كتل متجاورة بعنوان صغير */
.quick-access .solid .tile { background: color-mix(in srgb, var(--accent, var(--brand)) 90%, #000); color: #fff; border: 0; border-radius: 10px; box-shadow: none;
  display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; min-height: 104px; padding: 12px 10px; }
.quick-access .solid .tile .tile-icon, .quick-access .solid .fav-list .tile > .tile-icon { background: none; padding: 0; color: #fff; }
.quick-access .solid .tile b, .quick-access .solid .fav-list .tile-label { color: #fff; font-weight: 600; }
.quick-access .solid .tile-text { flex: none; justify-items: center; }
.quick-access .solid .tile-desc, .quick-access .solid .tile-go { display: none; }
.quick-access .solid a.tile:hover, .quick-access .solid a.tile:focus-visible { background: color-mix(in srgb, var(--accent, var(--brand)) 76%, #000); transform: translateY(-2px);
  outline: 2px solid #fff; outline-offset: -5px; border: 0; }
.quick-access .solid .tile-count { position: absolute; top: 8px; inset-inline-end: 8px; margin: 0; }
.quick-access .solid .tile-soon { background: rgba(255, 255, 255, .22); color: #fff; }
.quick-access .fav-groups.solid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 18px; }
.quick-access .solid .fav-group { background: none; border: 0; padding: 0; }
.quick-access .solid .fav-group h4 { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.quick-access .solid .fav-list { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 6px; }
.quick-access .solid .fav-list .tile.span-w, .quick-access .solid .fav-list .tile.span-l { grid-column: span 2; min-height: 104px; }
.quick-access .fav-groups.solid.size-s .tile { min-height: 80px; padding: 8px; }
.quick-access .fav-groups.solid.size-l .tile { min-height: 132px; }
.quick-access .tiles.solid.editing .tile { outline: 2px dashed rgba(255, 255, 255, .65); outline-offset: -5px; min-height: 128px; align-content: start; }
/* التعديل: أدوات الزر شريط في أعلاه والاسم تحته، والأعمدة بعرض يتسع لها (لا ستة أعمدة ضيقة بجانب ملخص اليوم) */
@media (min-width: 601px) { .quick-access .tiles.solid.editing { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.quick-access .tiles.solid.editing .tile-tools { order: -1; }
.quick-access .tiles.solid .tile-add { background: transparent; color: var(--brand); border: 1px dashed var(--line); }
.quick-access .tiles.solid .tile-add b { color: var(--brand); }
.quick-access .solid .tile-tools { justify-content: center; flex-wrap: wrap; }
/* صفحات الإجراءات */
.home-pages { margin-top: 12px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
.home-pages button { flex: none; }
.home-pages .page-tool { color: var(--brand); border-style: dashed; }
.tile-page { height: 26px; max-width: 110px; border-radius: 7px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 12px; color: var(--ink, #1f2d2a); }
/* تعديل البطاقات بأعمدة ثابتة (2026-11-15، الافتراضي ستة أعمدة بصفحات): أدوات الزر أعرض من البطاقة فكانت تغطي زر الإزالة في البطاقة
   المجاورة؛ في التعديل أعمدة تتسع للأدوات كما في البلاطات، والأدوات داخل البطاقة دائماً */
@media (min-width: 601px) { .quick-access .tiles.editing:not(.solid) { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.quick-access .tiles.editing:not(.solid) .tile-tools { inset-inline-start: 6px; justify-content: flex-end; }
.quick-access .tiles.editing:not(.solid) .tile-page { min-width: 0; flex: 0 1 110px; }
/* نافذة الأقسام الموحّدة: بنود «ملخص اليوم» متداخلة تحته */
.section-list li { flex-wrap: wrap; }
.section-list .section-row { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-list.sub { flex: 1 1 100%; margin: 4px 0 2px; padding-inline-start: 18px; border-inline-start: 2px solid var(--line); }
/* مجموعة «أساسية»: أزرق ليلي هادئ يميّزها عن بقية المجموعات */
.g-basic { --accent: #34506B; }
/* إعدادات طباعة أرصدة المخزون وكميات الأصناف: الأعمدة سطراً سطراً */
.export-pop.stock-print { display: grid; gap: 6px; min-width: 210px; max-height: 60vh; overflow: auto; }
.export-pop.stock-print hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
/* تكلفة الوحدة: الرقم وتحته كمية القطعة التالية، وزر التفاصيل صغير بجانبه */
.unit-cost { display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 8px; }
.unit-cost .unit-cost-more { padding: 1px 8px; font-size: 12px; }
tr.row-warn td { background: #FFF8EC; }
/* إعدادات الطباعة: زر «تم» في آخر القائمة */
.print-settings .print-settings-done { justify-self: start; margin-top: 4px; }
