/* ===== أنيس المجد — الأنماط الأساسية (تعلوها طبقة الهوية theme.css المولَّدة) =====
   نستخدم الخصائص المنطقية (inline-start / inline-end) حتى تعمل الواجهة
   في الاتجاهين: العربية (RTL) والإنجليزية (LTR) بنفس الكود. */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #e3e7ee;
    --text: #1c2430;
    --muted: #66717f;
    /* 0.80 (M24): قيم احتياطية بهوية «ليل الصحراء» (كانت الزرقاء القديمة) — القيم الفعلية من theme.css */
    --primary: #14355f;
    --primary-dark: #0b1b33;
    --primary-soft: #e8eef7;
    --success: #1f8f4e;
    --danger: #c0392b;
    --sidebar-w: 264px;
    --topbar-h: 56px;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
    /* 0.76: خط الأرقام — أرقام الواجهة نفسها (IBM Plex) بعرض ثابت للخانات بدل خط الكود الأحادي العريض */
    --num-font: "IBM Plex Sans Arabic", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font: "IBM Plex Sans Arabic", "Cairo", "Segoe UI", "Helvetica Neue", Tahoma, Arial, "Noto Sans Arabic", sans-serif;
}
/* خط IBM Plex Sans Arabic (رخصة OFL) مضمّن مع البرنامج ليعمل بلا إنترنت — حديث وواضح للعربية والأرقام */
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* خط Cairo (رخصة OFL) مضمّن مع البرنامج ليعمل بلا إنترنت — أوضح للعربية والأرقام */
@font-face { font-family: "Cairo"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/cairo-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Cairo"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/cairo-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Cairo"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/cairo-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Cairo"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/cairo-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cairo"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/cairo-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cairo"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/cairo-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 16px; font-weight: 500; line-height: 1.7; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
input, select, textarea, button { font-weight: 500; }
b, strong, th, label.field > span, .cart-totals .grand, .row-total td { font-weight: 700; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.55rem; margin: 0 0 14px; font-weight: 700; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 1.12rem; margin: 0 0 10px; font-weight: 600; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: 0.9em; }
.lead { font-size: 1.1rem; }

/* ---------- الشريط العلوي ---------- */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 0 18px;
    position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800;
}
.brand-logo { height: 36px; width: auto; object-fit: contain; }
.brand-logo-lg { height: 72px; }
.topbar-sep { width: 1px; height: 24px; background: var(--border); }
.topbar-business { font-weight: 600; color: var(--muted); }
.topbar-spacer { flex: 1; }
.topbar-link { padding: 6px 10px; border-radius: 6px; color: var(--text); }
button.topbar-link { background: none; border: 0; font: inherit; cursor: pointer; }
.topbar-link:hover { background: var(--primary-soft); color: var(--primary); }
.topbar-link.lang { border: 1px solid var(--border); font-weight: 600; }

/* ---------- الهيكل: قائمة جانبية + محتوى ---------- */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
    border-inline-end: 1px solid var(--border);
    box-shadow: inset -1px 0 0 rgba(16,24,40,.03);
    padding: 12px 0;
    display: flex; flex-direction: column;
    flex-shrink: 0;
    position: sticky; top: var(--topbar-h); max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; scrollbar-width: thin;
}
.nav-list { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 4px; }
.nav-group { border-radius: 10px; margin: 2px 0; }
.nav-group.open { background: color-mix(in srgb, var(--primary) 4%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 7%, transparent); padding-bottom: 4px; }
.nav-group.has-active { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.nav-group-head {
    width: 100%; display: flex; align-items: center; gap: 10px; text-align: start;
    padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer;
    font: inherit; font-weight: 700; font-size: .95rem; color: #2a3546;
}
.nav-group-head:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--primary); }
.nav-group-head .nav-icon { color: var(--primary); }
.nav-chevron { margin-inline-start: auto; color: var(--muted); font-size: .8rem; }
.nav-group-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-inline-start: auto; }
.nav-group-dot + .nav-chevron { margin-inline-start: 6px; }
.nav-group-items { display: flex; flex-direction: column; gap: 1px; padding: 0 6px 2px 6px; }
.nav-group-items .nav-item { padding-inline-start: 34px; font-size: .92rem; position: relative; }
.nav-group-items .nav-item::before { content: ""; position: absolute; inset-inline-start: 22px; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: #c4ccd9; transform: translateY(-50%); }
.nav-group-items .nav-item.active::before { background: var(--primary); }
.nav-group-items .nav-item .nav-icon { display: none; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    color: var(--text); font-size: 0.97rem; font-weight: 600;
    transition: background .1s, color .1s;
}
.nav-item:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--primary); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 700; box-shadow: 0 2px 6px color-mix(in srgb, var(--primary) 25%, transparent); }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--muted); }
.nav-item.active .nav-icon { color: #fff; }
.nav-item:hover .nav-icon { color: var(--primary); }
.ico { vertical-align: -4px; }
.nav-bottom { margin-top: auto; border-top: 1px solid var(--border); padding: 10px 10px 0; }
.nav-customize { color: var(--primary); font-weight: 600; }

.content { flex: 1; padding: 24px 28px; max-width: 1480px; min-width: 0; overflow-x: auto; }
.main-plain { padding: 32px 20px; }
.page-narrow { max-width: 720px; margin: 0 auto; }

/* ---------- البطاقات ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card-link { display: block; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.card-link:hover { border-color: #b9cdf1; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 12%, transparent); transform: translateY(-1px); }
.card-title { font-weight: 600; font-size: 1.05rem; }
.card-sub { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.card-list { margin-bottom: 24px; }

/* ---------- النماذج ---------- */
.form { max-width: 960px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; flex: 1; }
.field > span { font-weight: 600; font-size: 0.9rem; color: #3b4452; }
.field-row { display: flex; gap: 14px; }
input, select, textarea {
    font: inherit; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--text); width: 100%;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent); }   /* 0.80 (M16): كان --primary-soft (تباين ~1.1:1) */
/* 0.80 (M16): حلقة تركيز ظاهرة لكل عنصر تفاعلي بلوحة المفاتيح (WCAG 2.4.7/1.4.11) — بلون التمييز الذهبي فتُرى على الفاتح والداكن */
:where(a, button, [role=button], [tabindex], summary, .btn, .nav-item, .chip, .tile):focus-visible { outline: 2px solid var(--accent, var(--primary)); outline-offset: 2px; }
.btn {
    font: inherit; font-weight: 600; cursor: pointer;
    padding: 9px 18px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow);
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--bg); border-color: #cfd6e0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-warn { background: #fff7e6; border-color: #e0a800; color: #7a5200; }
.error { color: var(--danger); margin-bottom: 10px; }
.toast {
    display: inline-block; background: #e6f6ec; color: var(--success);
    border: 1px solid #bfe6cc; border-radius: 6px; padding: 8px 14px; margin: 8px 0 12px; font-weight: 600;
}
.notice { background: #fff8e1; border: 1px solid #f3dd8a; border-radius: 6px; padding: 12px 14px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
.page-actions { display: flex; gap: 8px; }
.page-foot { margin-top: 20px; }
.h-icon { opacity: .7; margin-inline-end: 4px; }

/* ---------- الملخص ---------- */
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0 20px; }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 22px; min-width: 170px; box-shadow: var(--shadow);
}
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--primary); unicode-bidi: plaintext; letter-spacing: -.01em; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

/* ---------- شاشة التخصيص ---------- */
.module-group { margin: 22px 0; }
.module-group h2 { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: .06em; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.module-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.module-card:hover { border-color: var(--primary); }
.module-card.on { border-color: var(--primary); background: var(--primary-soft); }
.module-card.locked { cursor: default; opacity: .8; }
.module-card input { width: 18px; height: 18px; margin-top: 3px; flex-shrink: 0; accent-color: var(--primary); }
.module-icon { font-size: 1.2rem; width: 26px; text-align: center; }
.module-text { display: flex; flex-direction: column; }
.module-name { font-weight: 600; }
.module-desc { color: var(--muted); font-size: 0.82rem; }

/* ---------- وحدة قيد الإنشاء ---------- */
.placeholder {
    text-align: center; padding: 60px 20px; color: var(--muted);
    background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.placeholder-icon { font-size: 3rem; margin-bottom: 8px; opacity: .5; }

/* ---------- خطأ Blazor ---------- */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--warn-soft, #fff3cd); color: var(--warn-text, #5c4400); border-top: 1px solid var(--warn-line, #ffeeba); padding: 12px 20px; z-index: 1000;   /* 0.80 (M17): كان بلا لون نص فيرث النص الفاتح ليلًا */
}
#blazor-error-ui a { color: inherit; font-weight: 700; text-decoration: underline; margin-inline-start: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; inset-inline-end: 12px; top: 10px; }

/* ---------- شاشات صغيرة ---------- */
.nav-toggle, .nav-backdrop { display: none; }
@media (max-width: 800px) {
    /* القائمة الجانبية تصبح درجًا منزلقًا يُفتح بزر ☰ بدل أن تدفع المحتوى إلى الأسفل */
    .shell { flex-direction: column; }
    .nav-toggle { display: inline-flex; align-items: center; gap: 6px; position: sticky; top: var(--topbar-h); z-index: 40; align-self: flex-start;
        margin: 8px 12px 0; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font: inherit; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; }
    .sidebar { position: fixed; top: var(--topbar-h); bottom: 0; inset-inline-start: 0; width: min(290px, 84vw); max-height: none; z-index: 60;
        display: none; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: navIn .18s ease; }
    .shell.nav-open .sidebar { display: flex; }
    .shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; top: var(--topbar-h); background: rgba(15,23,42,.35); z-index: 50; }
    .field-row { flex-direction: column; gap: 0; }
    .content { padding: 12px; }
    /* الجداول العريضة تُسحب أفقيًا بدل أن تكسر الصفحة */
    input, select, textarea { font-size: 16px; }   /* يمنع آيفون من التكبير التلقائي عند الكتابة */
    .topbar { gap: 6px; padding: 0 8px; }
    .topbar .brand-only { height: 34px; }
    .topbar-sep { display: none; }
    .topbar-user .user-name { display: none; }   /* 0.80: قائمة المستخدم تبقى (فيها الخروج) — الاسم فقط يُخفى */
    .topbar-business { min-width: 0; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
    .topbar-spacer { flex: 0 0 0; }
    .topbar-link { padding: 6px 6px; white-space: nowrap; }
    /* الشريط العلوي كان أعرض من الشاشة فيتسع إطار الصفحة كله وينزاح المحتوى — نخفي التسميات ونمنع الاتساع */
    .topbar { overflow-x: clip; }
    .topbar .tb-label { display: none; }
    .shell, .content, main { max-width: 100vw; }

}

/* ---------- الجداول ---------- */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.grid th, .grid td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid th { background: #f8f9fc; font-size: 0.86rem; color: #4a5567; font-weight: 700; letter-spacing: .01em; }
.grid tbody tr:hover { background: #f7f9fd; }
.grid .num, .grid th.num { text-align: end; white-space: nowrap; unicode-bidi: plaintext; }
.grid .center { text-align: center; }
.grid .row-group td { background: #f8f9fb; font-weight: 600; }
.grid .row-inactive td { color: var(--muted); }
.grid .row-total td { font-weight: 700; background: var(--primary-soft); border-top: 2px solid var(--primary); }
.grid .row-subtotal td { font-weight: 700; border-top: 1px solid #c9d3e3; }
.grid .row-section td { font-weight: 700; background: var(--bg); text-transform: uppercase; font-size: 0.82rem; color: var(--muted); letter-spacing: .05em; }
.grid .row-net td { font-size: 1.05rem; }
.grid .col-code { width: 110px; }
.grid .col-type { width: 130px; }
.grid .col-actions { width: 80px; text-align: end; white-space: nowrap; }
.grid a { color: var(--text); }
.grid a:hover { color: var(--primary); text-decoration: underline; }
.grid.lines input, .grid.lines select { padding: 6px 8px; }
.grid.lines input.num { min-width: 92px; width: 100%; font-size: 1rem; font-variant-numeric: tabular-nums; }
.grid.lines td { padding: 4px 6px; }
.grid.lines input.num { text-align: end; }
.mono { font-family: var(--num-font); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1; letter-spacing: 0; unicode-bidi: plaintext; }
.indent { display: inline-block; width: calc(var(--lvl, 0) * 18px); }
.tag { display: inline-block; font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); margin-inline-start: 6px; vertical-align: middle; }
.tag-off { background: #f1f1f1; color: var(--muted); }
.ok { color: var(--success); font-weight: 600; }
.bad { color: var(--danger); font-weight: 600; }

/* ---------- شريط الأدوات ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0 14px; }
.search { max-width: 340px; }
.period { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field.inline { margin: 0; flex: none; }
.field.inline > span { font-size: 0.78rem; color: var(--muted); }
.field.inline input, .field.inline select { width: auto; min-width: 150px; padding: 7px 9px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 12px; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.btn-mini { padding: 3px 8px; font-size: 0.85rem; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.confirm-inline { display: inline-flex; gap: 8px; align-items: center; color: var(--danger); font-weight: 600; }
.actions { display: flex; gap: 10px; align-items: center; }
.form.wide { max-width: none; }
textarea { resize: vertical; }

/* ---------- اللوحة الجانبية (Drawer) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 50; }
.drawer {
    position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100%);
    background: var(--surface); box-shadow: -4px 0 24px rgba(0,0,0,.15); z-index: 51;
    display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer-head-btns { display: inline-flex; gap: 4px; }
/* تغيير عرض اللوحة: مقبض على الحافة الحرة (بداية السطر: يسار اللوحة في العربية) + وضع التكبير على كامل الشاشة */
.drawer { max-width: 100vw; min-width: min(360px, 100vw); }
.drawer-resize { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 10px; cursor: col-resize; z-index: 2; display: flex; align-items: center; justify-content: center; color: var(--muted); opacity: .35; transition: opacity .15s, background .15s; }
.drawer-resize span { font-size: 14px; line-height: 1; pointer-events: none; }
.drawer-resize:hover, body.drawer-resizing .drawer-resize { opacity: 1; background: color-mix(in srgb, var(--primary, #1f3a5f) 12%, transparent); }
body.drawer-resizing { cursor: col-resize; user-select: none; }
body.drawer-resizing iframe { pointer-events: none; }
.drawer.drawer-max { width: 100vw !important; }
.drawer.drawer-max .drawer-resize { display: none; }
@media (max-width: 720px) { .drawer-resize { display: none; } }
.drawer-head h2 { margin: 0; }
.drawer-body { padding: 18px; overflow: auto; flex: 1; }
.drawer-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }

/* ---------- التقارير والطباعة ---------- */
.report-cards .card-link { margin-bottom: 10px; }
.report.statement td:last-child { width: 200px; }
.print-only { display: none; }
.report-title { text-align: center; margin-bottom: 16px; }
.report-title h1 { margin: 0; font-size: 1.3rem; }
.report-title h2 { margin: 4px 0; font-size: 1.1rem; }
.report-title p { margin: 0; color: var(--muted); }
@media print {
    .topbar, .sidebar, .no-print, #blazor-error-ui { display: none !important; }
    .print-only { display: block; }
    .shell { display: block; }
    .content { padding: 0; max-width: none; }
    body { background: #fff; font-size: 12px; }
    .grid { border: none; }
    .grid th, .grid td { padding: 4px 6px; }
    a { color: inherit; text-decoration: none; }
}

/* ---------- الملخص (إضافات) ---------- */
.stat-link { color: var(--text); display: block; }
.stat-link:hover { border-color: var(--primary); }
.stat-good .stat-value { color: var(--success); }
.stat-bad .stat-value { color: var(--danger); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid.compact td { padding: 6px 8px; }
.grid.compact { border: none; margin-bottom: 10px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- المبيعات ---------- */
.mt { margin-top: 24px; }
.badge { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: #e6f6ec; color: var(--success); }
.badge-warn { background: #fff4e0; color: #b26a00; }
.badge-due { background: #fdecea; color: var(--danger); }
.badge-draft { background: #eef0f4; color: var(--muted); }
.badge-off { background: #f1f1f1; color: var(--muted); text-decoration: line-through; }
.status-filter { width: auto; }
.grid.lines td select + input.line-desc { margin-top: 4px; font-size: 0.85rem; }
/* 0.85: تاريخ الصلاحية تحت الصنف المرتجع */
.line-expiry { display: flex; align-items: center; gap: 6px; margin-top: 4px; } .line-expiry input { font-size: 0.85rem; padding: 2px 6px; height: auto; min-height: 0; width: auto; }
.totals-row { display: flex; gap: 24px; align-items: flex-start; margin-top: 16px; }
.totals-row .field { flex: 1; }
.totals { min-width: 340px; border-collapse: collapse; }
.totals td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.totals tr.grand td { font-weight: 700; font-size: 1.05rem; background: var(--primary-soft); }
.totals td.num { text-align: end; }

/* ---------- نموذج الفاتورة للطباعة ---------- */
.print-page { padding: 16px; background: #e9ecf1; min-height: 100vh; }
.print-toolbar { max-width: 210mm; margin: 0 auto 12px; display: flex; gap: 8px; }
.invoice-sheet {
    background: #fff; width: 210mm; min-height: 280mm; margin: 0 auto; padding: 14mm 12mm;
    box-shadow: 0 2px 12px rgba(0,0,0,.12); font-size: 12px; color: #111; display: flex; flex-direction: column;
}
.inv-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--acc, #1f5fbf); padding-bottom: 10px; }
.inv-seller { display: flex; gap: 12px; align-items: flex-start; }
.inv-logo { max-height: 78px; max-width: 150px; object-fit: contain; }
.inv-header-note { color: var(--acc, #1f5fbf); font-weight: 600; }
.inv-biz { font-size: 1.35rem; font-weight: 700; }
.inv-biz-en { font-size: 1rem; font-weight: 600; color: #333; }
.inv-title-box { text-align: center; align-self: center; }
.inv-title { font-size: 1.3rem; font-weight: 700; color: var(--acc, #1f5fbf); }
.inv-title-other { font-size: 0.95rem; color: #555; }
.inv-draft { margin-top: 6px; color: #c0392b; border: 2px dashed #c0392b; padding: 2px 8px; font-weight: 700; display: inline-block; }
.inv-qr svg { width: 110px; height: 110px; }
.inv-meta { display: flex; gap: 16px; margin: 12px 0; }
.meta { flex: 1; border-collapse: collapse; }
.meta th, .meta td { padding: 4px 8px; border: 1px solid #dde; text-align: start; vertical-align: top; }
.meta th { background: #f3f5f8; font-weight: 600; width: 45%; }
.meta .meta-head { background: color-mix(in srgb, var(--acc, #1f5fbf) 12%, #fff); color: var(--acc, #1f5fbf); text-align: center; width: auto; }
.inv-lines { width: 100%; border-collapse: collapse; margin-top: 6px; }
.inv-lines th, .inv-lines td { border: 1px solid #cdd3dc; padding: 5px 6px; text-align: center; }
.inv-lines th { background: var(--acc, #1f5fbf); color: #fff; font-weight: 600; font-size: 0.8rem; }
.inv-lines .th-other { font-weight: 400; opacity: .85; font-size: 0.72rem; }
.inv-lines .start { text-align: start; }
.inv-foot { display: flex; justify-content: space-between; gap: 24px; margin-top: 14px; }
.inv-terms { flex: 1; }
.inv-totals { min-width: 300px; border-collapse: collapse; }
.inv-totals th, .inv-totals td { padding: 5px 8px; border: 1px solid #cdd3dc; }
.inv-totals th { background: #f3f5f8; text-align: start; font-weight: 600; }
.inv-totals td { text-align: end; }
.inv-totals .th-other { font-weight: 400; color: #666; font-size: 0.72rem; }
.inv-totals tr.grand th, .inv-totals tr.grand td { background: color-mix(in srgb, var(--acc, #1f5fbf) 12%, #fff); font-weight: 700; font-size: 1rem; }
.inv-sign { display: flex; justify-content: space-around; gap: 24px; margin-top: 28px; text-align: center; font-size: .85em; color: #444; }
.inv-sign > div { min-width: 180px; }
.sign-line { border-bottom: 1px solid #888; height: 28px; margin-bottom: 4px; }
.inv-bank { white-space: pre-line; }
/* قالب حديث: شريط ملوّن في الرأس */
.tpl-modern .inv-head { background: var(--acc); color: #fff; padding: 12px 14px; border-radius: 10px; border-bottom: none; }
.tpl-modern .inv-head .small, .tpl-modern .inv-biz-en, .tpl-modern .inv-title-other, .tpl-modern .inv-header-note { color: #fff; opacity: .92; }
.tpl-modern .inv-title { color: #fff; }
.tpl-modern .inv-logo { background: #fff; border-radius: 6px; padding: 3px; }
.tpl-modern .inv-lines th { border-color: var(--acc); }
.tpl-modern .meta th { background: color-mix(in srgb, var(--acc) 10%, #fff); }
/* قالب بسيط: بلا تعبئات، خطوط رفيعة */
.tpl-minimal .inv-head { border-bottom: 1px solid #333; }
.tpl-minimal .inv-lines th { background: none; color: #111; border-bottom: 2px solid #111; }
.tpl-minimal .inv-lines th, .tpl-minimal .inv-lines td { border-left: none; border-right: none; border-color: #ddd; }
.tpl-minimal .meta th { background: none; }
.tpl-minimal .inv-totals tr.grand th, .tpl-minimal .inv-totals tr.grand td { background: none; border-top: 2px solid #111; }
.tpl-minimal .inv-title { color: #111; }
@media print { .tpl-modern .inv-head, .inv-lines th, .inv-totals tr.grand th, .inv-totals tr.grand td, .meta th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.inv-end { margin-top: auto; padding-top: 16px; text-align: center; border-top: 1px solid #dde; }
/* 0.81: كثافة متغيرة حسب عدد السطور (الصنف يُحدَّد في SalesDocPaper) — تُطبّق على الشاشة والطباعة.
   d0 (≤10 سطور): الحجم المختار في الإعدادات مع هوامش أضيق كي تبقى الفاتورة القصيرة في صفحة واحدة.
   d1 (≤22): خط 10.5px — d2 (≤40): 9.5px مع رأس أصغر — d3 (>40): 8.5px */
.invoice-sheet.inv-d0 .inv-meta { margin: 8px 0; }
.invoice-sheet.inv-d0 .inv-foot { margin-top: 8px; }
.invoice-sheet.inv-d0 .inv-sign { margin-top: 14px; }
.invoice-sheet.inv-d0 .inv-end { padding-top: 8px; }
.invoice-sheet.inv-d1, .invoice-sheet.inv-d2, .invoice-sheet.inv-d3 { line-height: 1.3; }
.invoice-sheet.inv-d1 { font-size: 10.5px !important; }
.invoice-sheet.inv-d2 { font-size: 9.5px !important; }
.invoice-sheet.inv-d3 { font-size: 8.5px !important; }
.invoice-sheet.inv-d1 .inv-lines th, .invoice-sheet.inv-d1 .inv-lines td { padding: 3px 4px; }
.invoice-sheet.inv-d2 .inv-lines th, .invoice-sheet.inv-d2 .inv-lines td { padding: 2px 3px; }
.invoice-sheet.inv-d3 .inv-lines th, .invoice-sheet.inv-d3 .inv-lines td { padding: 1px 3px; }
.invoice-sheet.inv-d1 .inv-lines th, .invoice-sheet.inv-d2 .inv-lines th, .invoice-sheet.inv-d3 .inv-lines th { font-size: 0.78rem; }
.invoice-sheet.inv-d2 .inv-lines .th-other, .invoice-sheet.inv-d3 .inv-lines .th-other { display: none; }
.invoice-sheet.inv-d1 .meta th, .invoice-sheet.inv-d1 .meta td, .invoice-sheet.inv-d2 .meta th, .invoice-sheet.inv-d2 .meta td, .invoice-sheet.inv-d3 .meta th, .invoice-sheet.inv-d3 .meta td { padding: 2px 6px; }
.invoice-sheet.inv-d1 .inv-totals th, .invoice-sheet.inv-d1 .inv-totals td, .invoice-sheet.inv-d2 .inv-totals th, .invoice-sheet.inv-d2 .inv-totals td, .invoice-sheet.inv-d3 .inv-totals th, .invoice-sheet.inv-d3 .inv-totals td { padding: 3px 6px; }
.invoice-sheet.inv-d1 .inv-meta, .invoice-sheet.inv-d2 .inv-meta, .invoice-sheet.inv-d3 .inv-meta { margin: 6px 0; }
.invoice-sheet.inv-d1 .inv-foot, .invoice-sheet.inv-d2 .inv-foot, .invoice-sheet.inv-d3 .inv-foot { margin-top: 6px; }
.invoice-sheet.inv-d1 .inv-sign, .invoice-sheet.inv-d2 .inv-sign, .invoice-sheet.inv-d3 .inv-sign { margin-top: 10px; }
.invoice-sheet.inv-d1 .inv-sign .sign-line, .invoice-sheet.inv-d2 .inv-sign .sign-line, .invoice-sheet.inv-d3 .inv-sign .sign-line { height: 18px; }
.invoice-sheet.inv-d1 .inv-end, .invoice-sheet.inv-d2 .inv-end, .invoice-sheet.inv-d3 .inv-end { padding-top: 6px; }
.invoice-sheet.inv-d2 .inv-logo, .invoice-sheet.inv-d3 .inv-logo { max-height: 54px; max-width: 110px; }
.invoice-sheet.inv-d2 .inv-qr svg, .invoice-sheet.inv-d3 .inv-qr svg { width: 84px; height: 84px; }
.invoice-sheet.inv-d2 .inv-head, .invoice-sheet.inv-d3 .inv-head { padding-bottom: 6px; }
.invoice-sheet.inv-d2 .inv-biz, .invoice-sheet.inv-d3 .inv-biz { font-size: 1.15rem; }
.invoice-sheet.inv-d2 .inv-title, .invoice-sheet.inv-d3 .inv-title { font-size: 1.1rem; }
@page { size: A4; margin: 10mm; }   /* 0.81: كان 12mm — هامش أضيق يتسع لمزيد من السطور */
@media print {
    /* سفاري يطبع صفحة بيضاء أو يقطع المحتوى إذا كان الهيكل flex بارتفاع نسبة من الشاشة — نحوّله إلى كتل عادية عند الطباعة */
    html, body { height: auto !important; overflow: visible !important; }
    .print-page { padding: 0; background: #fff; min-height: auto; display: block; }
    .invoice-sheet { display: block; box-shadow: none; width: auto; min-height: auto; margin: 0; padding: 0; }
    .voucher { min-height: auto; }
    .inv-end { margin-top: 12px; }
    .inv-lines th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    /* 0.81: الصفوف الصغيرة لا تُجبر على الانتقال معًا؛ التوقيع والمجاميع فقط تبقى كتلة واحدة */
    .inv-foot { break-inside: avoid; page-break-inside: avoid; }
    .inv-lines thead { display: table-header-group; }
    .inv-lines tr, .voucher-amount, .inv-sign, .inv-meta { break-inside: avoid; page-break-inside: avoid; }
}

/* ---------- وحدات الأصناف والملصقات ---------- */
h3.sub { margin: 16px 0 6px; font-size: 0.95rem; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.with-btn { display: flex; gap: 6px; align-items: center; }
.with-btn input, .with-btn select { flex: 1; min-width: 0; }
.btn-plus { padding: 0 8px; font-weight: 800; line-height: 1.6; flex: 0 0 auto; }
.unit-row { display: grid; grid-template-columns: 1.3fr 0.7fr 0.9fr 0.9fr 1.6fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.unit-row input { padding: 7px 8px; }
.unit-head { margin-bottom: 8px; }
.scan-box { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.scan-box input { max-width: 380px; }
.scan-box .scan-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); white-space: nowrap; }
.scan-box .scan-label svg { color: var(--accent, var(--primary)); flex: none; }
.scan-input { font-family: inherit; }
.scan-input:not(:placeholder-shown) { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; direction: ltr; text-align: start; }
.scan-input::placeholder { font-family: inherit; direction: inherit; }
.labels { display: flex; flex-wrap: wrap; gap: 8px; max-width: 210mm; margin: 0 auto; }
.label { width: 58mm; border: 1px dashed #bbb; padding: 4px 6px; text-align: center; background: #fff; font-size: 11px; page-break-inside: avoid; }
.label-biz { font-size: 9px; color: #555; }
.label-name { font-weight: 700; }
.label-unit { margin-bottom: 2px; }
.label svg { width: 100%; height: auto; }
@media print { .label { border: none; } }

.line-bc { font-size: 0.7rem; color: #555; }
.inv-warn { font-size: 0.7rem; color: #b26a00; max-width: 140px; margin-top: 4px; }

.row-neg td { background: #fff5f5; }

/* ---------- نقاط البيع ---------- */
.pos-open { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.pos-open .card { width: 420px; }
.pos { display: flex; flex-direction: column; height: 100vh; height: 100dvh; margin: -16px; background: var(--bg); }   /* 0.80 (M18): 100dvh — في Safari/iPad يشمل 100vh شريط العنوان فيختفي زر الدفع */
.pos-bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pos-body { display: flex; flex: 1; min-height: 0; }
.pos-items { flex: 1; display: flex; flex-direction: column; padding: 12px; min-width: 0; min-height: 0; }
.pos-search input { font-size: 1.1rem; padding: 12px; }
/* سطر تلميح اختصارات الكاشير تحت خانة البحث */
.pos-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.pos-keys kbd { font-size: .72rem; padding: 0 5px; }
.pos-cats { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font: inherit; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; overflow: auto; flex: 1; min-height: 0; align-content: start; padding-bottom: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: start; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 6px; min-height: 96px; }
.tile:hover { border-color: var(--primary); box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 18%, transparent); }   /* 0.80 (M24): كان أزرق الهوية القديمة الثابت */
.tile:active { background: var(--primary-soft); }
/* أسماء الأصناف أوضح وتُقصّ بعد ثلاثة أسطر */
.tile-name { font-weight: 600; font-size: .98rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-price { color: var(--primary); font-weight: 700; font-family: ui-monospace, monospace; font-size: 1.05rem; }
@media (max-width: 800px) { .pos-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }
.tile-units { display: flex; flex-wrap: wrap; gap: 4px; }
.unit-chip { font-size: 0.72rem; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.unit-chip:hover { background: var(--primary-soft); border-color: var(--primary); }
.pos-cart { width: 400px; background: var(--surface); border-inline-start: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.cart-head h2 { margin: 0; }
.cart-customer { margin: 8px 12px; width: auto; }
.ss.cart-customer { width: calc(100% - 24px); }
.cart-lines { flex: 1; overflow: auto; padding: 0 12px; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); outline: none; }
/* سطر السلة المحدد بلوحة المفاتيح (+ / − تغيّر الكمية) */
.cart-line:focus-visible { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); border-radius: 6px; }
.drawer:focus { outline: none; }
.cl-name { font-weight: 600; }
.cl-qty { display: flex; align-items: center; gap: 2px; }
.cl-qty input { width: 58px; padding: 4px; text-align: center; }
.cl-total { min-width: 70px; text-align: end; font-weight: 600; }
.cart-totals { padding: 10px 12px; border-top: 1px solid var(--border); }
.cart-totals > div { display: flex; justify-content: space-between; padding: 3px 0; }
.cart-totals .grand { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.btn-pay { margin: 0 12px 12px; padding: 16px; font-size: 1.2rem; }
.pay-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--surface); border-radius: 12px; padding: 22px; width: min(560px, 95vw); z-index: 60; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.pay-row { display: flex; gap: 12px; }
.pay-row label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.pay-row input.big { font-size: 1.6rem; padding: 10px; text-align: end; }
.pay-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.pay-summary > div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 1.05rem; }
.pay-summary .ok { color: var(--success); font-weight: 700; font-size: 1.3rem; }
.pos-flash { position: fixed; bottom: 20px; inset-inline-start: 20px; background: #e6f6ec; color: var(--success); border: 1px solid #bfe6cc; padding: 10px 16px; border-radius: 8px; font-weight: 600; z-index: 40; }

/* ---------- إيصال حراري 80mm ---------- */
.receipt-toolbar { max-width: 80mm; }
.receipt { width: 80mm; margin: 0 auto; background: #fff; padding: 6mm 4mm; font-size: 12px; font-family: var(--font); color: #000; }
.receipt hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }
.r-center { text-align: center; }
.r-biz { font-weight: 700; font-size: 15px; }
.r-title { text-align: center; font-weight: 700; margin: 8px 0; }
.r-row { display: flex; justify-content: space-between; gap: 8px; }
.r-line { margin: 4px 0; }
.r-total { font-weight: 700; font-size: 14px; border-top: 1px solid #000; padding-top: 4px; margin-top: 4px; }
.r-qr { text-align: center; margin: 10px 0 6px; }
.r-qr svg { width: 34mm; height: 34mm; }
@media print {
    .receipt { width: 72mm; padding: 0; }
    .pos { display: none; }
    body:has(.receipt) { background: #fff; }
    /* مقاس ورق الإيصال (80/58مم) يُحدَّد في صفحة الإيصال نفسها لأنه يجب أن يأتي بعد قاعدة A4 العامة */
}

/* ---- الموظفون والرواتب ---- */
.row-off td { color: var(--muted); }
.table-scroll { overflow-x: auto; max-width: 100%; scrollbar-width: thin; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: #c5cbd6; border-radius: 4px; }
.grid.payroll { font-size: 0.8rem; white-space: nowrap; }
.grid.payroll th, .grid.payroll td { padding: 5px 5px; }
.grid.payroll input { width: 62px; padding: 4px 5px; font-size: 0.8rem; }
.grid.payroll input.days { width: 55px; }
.payslip { border: 1px solid #ccc; border-radius: 8px; padding: 18px 22px; margin: 0 auto 18px; max-width: 760px; page-break-after: always; background: #fff; }
.payslip:last-child { page-break-after: auto; }
.payslip-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #333; padding-bottom: 10px; margin-bottom: 12px; }
.payslip-head h1 { font-size: 1.2rem; margin: 0; }
.payslip-head h2 { font-size: 1rem; margin: 4px 0 0; color: var(--muted); }
.payslip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.payslip table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.payslip td { padding: 4px 6px; border-bottom: 1px solid #eee; }
.payslip .row-total td { font-weight: 700; border-top: 2px solid #333; border-bottom: none; }
.payslip-net { margin-top: 14px; font-size: 1.15rem; font-weight: 700; display: flex; justify-content: space-between; border: 2px solid #333; padding: 8px 12px; border-radius: 6px; }
.payslip-sign { display: flex; justify-content: space-between; margin-top: 36px; color: var(--muted); font-size: 0.85rem; }
@media print { .payslip { border: none; max-width: none; } }

/* ---- تسجيل الدخول والمستخدمون ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 1.3rem; font-weight: 700; }
.login-box h1 { font-size: 1.15rem; margin: 6px 0 18px; color: var(--muted); font-weight: 600; }
.topbar-user { color: var(--muted); font-size: .9rem; margin-inline-end: 8px; }
.perm-grid { display: grid; grid-template-columns: 1fr; gap: 3px 12px; margin: 6px 0 14px; }
.perm-grid label { font-size: .88rem; display: flex; gap: 8px; align-items: center; }
.perm-grid label input, .perm-biz-head input { width: 16px; height: 16px; flex: none; accent-color: var(--primary); }
.perm-biz { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.perm-biz-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }

/* ---------- هيئة الزكاة ---------- */
.zatca-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; }

/* ---------- حقل التاريخ الميلادي ---------- */
.date-input { display: inline-flex; align-items: stretch; width: 100%; position: relative; }
.date-input .date-text { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; padding-right: 34px; text-align: left; }
.date-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.date-btn:hover { background: var(--primary-soft); color: var(--primary); }
.cal-backdrop { position: fixed; inset: 0; z-index: 70; }
.cal { position: absolute; top: calc(100% + 4px); inset-inline-start: 0;   /* 0.78→0.80: في العربية يفتح إلى اليسار (كان left:0 فيدخل تحت القائمة) */ z-index: 71; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.15); padding: 8px 10px; width: 260px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cal-title { font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: .72rem; color: var(--muted); padding: 2px 0; }
.cal-day { border: none; background: transparent; border-radius: 6px; padding: 5px 0; cursor: pointer; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; color: var(--text); }
.cal-day:hover { background: var(--primary-soft); }
.cal-day.today { font-weight: 700; color: var(--primary); }
.cal-day.sel { background: var(--primary); color: #fff; }
.cal-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.cal-hijri { font-size: .78rem; color: var(--muted); direction: rtl; }
.date-hijri { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.export-btns { display: inline-flex; gap: 6px; }

/* ---------- الكاشير: تعليق وإرجاع ---------- */
.hold-prompt { display: flex; gap: 6px; padding: 6px 10px; background: var(--primary-soft); }
.hold-prompt input { flex: 1; }
.held-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }

/* ---------- اختيار وحدات الملصقات ---------- */
.label-units { max-width: 720px; margin: 0 auto 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.label-unit-row { display: grid; grid-template-columns: auto 1.6fr 1.2fr .8fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.label-unit-row:last-of-type { border-bottom: none; }
.lu-copies input { width: 64px; padding: 4px 6px; margin-inline-start: 4px; }
.label-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }

/* ---------- لوحة الاختصارات ---------- */
.palette { position: fixed; top: 12vh; left: 50%; transform: translateX(-50%); width: min(640px, 94vw); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.2); padding: 16px 18px; z-index: 60; }
.palette h2 { margin: 0 0 10px; font-size: 1.05rem; }
.palette-input { width: 100%; font-size: 1.1rem; padding: 10px 12px; }
.palette-list { max-height: 50vh; overflow: auto; margin-top: 8px; }
.palette-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette-row.on, .palette-row:hover { background: var(--primary-soft); }
.palette-row b { flex: 1; }
.palette-go { color: var(--muted); font-size: .8rem; }
kbd { display: inline-block; padding: 1px 7px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: #f7f8fa; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.check-field .check { display: inline-flex; align-items: center; gap: 6px; padding: 9px 0; white-space: nowrap; }
.ai-reader label.btn input { display: none; }

.ok-box { background: #e6f6ec; color: var(--success); border-color: #bfe7cc; }
.shift-list .badge-due { }

/* ---------- إعدادات الشعار والسندات ---------- */
.logo-row { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.logo-box { width: 160px; height: 90px; border: 1px dashed var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #fff; }
.logo-box img { max-width: 150px; max-height: 80px; object-fit: contain; }
.check-grid { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.voucher { min-height: 150mm; }
/* جدول بنود سند الصرف: بعرض الورقة كاملًا، البيان يأخذ المساحة المتبقية والأرقام في سطر واحد */
.voucher .inv-lines { width: 100%; }
.pay-lines th:nth-child(1), .pay-lines td:nth-child(1) { width: 34%; }
.pay-lines th:nth-child(2), .pay-lines td:nth-child(2) { width: auto; }
.pay-lines td.mono { white-space: nowrap; width: 1%; }
.pay-lines td, .pay-lines th { padding: 6px 8px; }
.voucher .inv-sign { margin-top: 36px; }
/* شاشة إدخال بنود سند الصرف: خانة البيان لا تضيق */
.pay-lines-edit td:nth-child(1) { width: 32%; min-width: 220px; }
.pay-lines-edit td:nth-child(2) { min-width: 220px; }
.voucher-amount { margin: 16px 0; border: 2px solid var(--acc, #1f5fbf); border-radius: 8px; padding: 10px 14px; }
.va-num { display: flex; justify-content: space-between; font-size: 1.3em; font-weight: 700; }
.va-label { font-size: .75em; font-weight: 600; color: #555; }
.va-words { margin-top: 6px; font-weight: 600; }
.r-logo { max-width: 55mm; max-height: 22mm; object-fit: contain; }
.settings-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin: 8px 0 18px; }
.settings-links .card-link { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.settings-links .ico { color: var(--primary); flex-shrink: 0; }
td.mono { white-space: nowrap; }
/* ---------- صفحة المنشآت (بسيطة على نسق Manager: عنوان + زر إضافة + قائمة صفوف) ---------- */
.biz-page { max-width: 680px; }
.biz-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.biz-head h1 { margin-bottom: 0; }
.biz-add { position: relative; flex-shrink: 0; margin-top: 4px; }
.biz-menu-backdrop { position: fixed; inset: 0; z-index: 20; }
.biz-add-menu {
    position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 21; min-width: 260px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm, 10px);
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(16,24,40,.15)); padding: 6px; display: flex; flex-direction: column;
}
.biz-add-item {
    display: block; width: 100%; text-align: start; font: inherit; font-weight: 600; color: var(--text);
    background: none; border: 0; border-radius: 8px; padding: 9px 12px; cursor: pointer;
}
.biz-add-item:hover { background: var(--primary-soft); color: var(--primary); }
.biz-create { margin-bottom: 18px; }
.biz-create .field { margin-bottom: 8px; }
.biz-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.biz-row { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); position: relative; flex-wrap: wrap; }
.biz-row:last-child { border-bottom: 0; }
.biz-row:hover { background: var(--surface-2, var(--bg)); }
.biz-row-link { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; color: var(--text); }
.biz-row-link:hover .biz-name { color: var(--primary); }
.biz-name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-meta { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.biz-row-error { flex-basis: 100%; padding: 0 18px 10px; }
.biz-del {
    font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 10px; margin-inline-end: 8px;
    border-radius: 999px; opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.biz-row:hover .biz-del, .biz-del:focus-visible { opacity: 1; }
.biz-del:hover { background: rgba(192,57,43,.1); color: var(--danger); }
.biz-empty { text-align: center; padding: 28px 16px; border: 1px dashed var(--border-strong, var(--border)); border-radius: var(--radius); margin-bottom: 18px; }
.biz-empty p { margin: 0 0 12px; }
.biz-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 26px; font-size: .92rem; font-weight: 600; }
.biz-foot a { color: var(--muted); }
.biz-foot a:hover { color: var(--primary); }
.biz-lic { margin-top: 8px; }
/* 0.76: بحث المنشآت + مربع «حركة اليوم» الجانبي لصاحب الحساب */
.biz-page.has-daily { max-width: 1180px; }
.biz-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.biz-page.has-daily .biz-layout { grid-template-columns: minmax(0, 1fr) 460px; }
.biz-search { position: relative; margin-bottom: 10px; display: flex; align-items: center; }
.biz-search input { width: 100%; padding-inline-start: 36px; padding-inline-end: 64px; }
.biz-search-ico { position: absolute; inset-inline-start: 12px; color: var(--muted); font-size: 1.2rem; pointer-events: none; }
.biz-search-count { position: absolute; inset-inline-end: 12px; font-variant-numeric: tabular-nums; }
.biz-daily { position: sticky; top: calc(var(--topbar-h, 56px) + 12px); padding: 14px 16px; margin: 0; }
.biz-daily-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.biz-daily-title { display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.biz-daily-nav { font: inherit; font-size: 1.2rem; line-height: 1; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; }
.biz-daily-nav:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }
.biz-daily-nav:disabled { opacity: .35; cursor: default; }
.biz-daily-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.biz-daily-totals > div { display: flex; flex-direction: column; gap: 1px; background: var(--primary-soft); border-radius: var(--radius-sm, 10px); padding: 8px 10px; }
.biz-daily-totals .k { font-size: .78rem; font-weight: 600; color: var(--muted); }
.biz-daily-totals .v { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.biz-daily-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.biz-daily-table th { font-size: .75rem; color: var(--muted); font-weight: 600; text-align: start; padding: 4px 2px; border-bottom: 1px solid var(--border); }
.biz-daily-table th.num, .biz-daily-table td.num { text-align: end; }
.biz-daily-table td { padding: 5px 2px; border-bottom: 1px solid var(--border); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-daily-table tr:last-child td { border-bottom: 0; }
.biz-daily-table tr.quiet td { color: var(--muted); }
.biz-daily-table a { color: inherit; font-weight: 600; }
.biz-daily-table a:hover { color: var(--primary); }
.biz-daily-more { display: block; margin-top: 10px; font-weight: 600; }
@media (max-width: 900px) {
    .biz-page.has-daily .biz-layout { grid-template-columns: minmax(0, 1fr); }
    .biz-daily { position: static; order: -1; }
}
@media (max-width: 560px) {
    .biz-head { flex-direction: column; align-items: stretch; }
    .biz-add .btn { width: 100%; }
    .biz-add-menu { inset-inline: 0; }
    .biz-row-link { flex-direction: column; align-items: flex-start; gap: 2px; }
    .biz-del { opacity: 1; }
}
.danger-card { border-color: #e8b4ae; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

/* الملخص: رسوم بيانية وتنبيهات */
.chart { width: 100%; height: auto; display: block; }
.chart .bar-a { fill: var(--primary); opacity: .9; }
.chart .bar-b { fill: #b8a06a; opacity: .9; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: inherit; }
.chart .axis-line { stroke: var(--border); stroke-width: 1; }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--muted); margin-top: 6px; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.legend .sw-a { background: var(--primary); } .legend .sw-b { background: #b8a06a; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 1fr 2fr auto; gap: 10px; align-items: center; }
.hbar-track { display: block; height: 12px; background: var(--primary-soft); border-radius: 6px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.alerts-card { margin: 14px 0; border-inline-start: 4px solid #d9822b; }
.alerts-card.alerts-ok { border-inline-start-color: #2e9e5b; display: flex; align-items: center; gap: 14px; padding: 10px 18px; }   /* فارغة: سطر واحد مضغوط */
.alerts-card.alerts-ok h2 { margin: 0; font-size: 1rem; }
.alerts-card.alerts-ok p { margin: 0; }
.alert-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

/* شريط الترخيص */
.lic-banner { display: block; text-align: center; padding: 6px 12px; font-size: .9rem; font-weight: 600; text-decoration: none; }
.lic-trial { background: #eef3ff; color: #2b4db3; border-bottom: 1px solid #c9d6f5; }
.lic-warn { background: #fff7e6; color: #8a5a00; border-bottom: 1px solid #f0c36d; }
.lic-bad { background: #fdecec; color: #a12c2c; border-bottom: 1px solid #f2b8b8; }
.lic-key { width: 100%; font-family: monospace; font-size: .8rem; min-height: 90px; direction: ltr; }

/* سطور الفواتير: زر + في آخر السطر الأخير، وبيان السطر اختياري */
.btn-addline { margin-inline-start: 4px; font-weight: 700; }
.lines-foot { display: flex; gap: 14px; align-items: center; }
.lines-foot .check.small { font-size: 0.82rem; color: var(--muted, #6b7280); margin: 0; }

/* ---------- بوابة العملاء ---------- */
.portal-page { min-height: 100vh; background: var(--bg); }
.portal-box { max-width: 480px; margin: 80px auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; text-align: center; }
.portal-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.portal-brand { display: flex; align-items: center; gap: 12px; }
.portal-brand img { height: 44px; width: auto; object-fit: contain; }
.portal-biz { font-weight: 700; font-size: 1.1rem; }
.portal-user { display: flex; align-items: center; gap: 14px; }
.portal-body { max-width: 1000px; margin: 0 auto; padding: 20px 20px 40px; }
.portal-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: 18px 0 16px; }
.portal-tabs a { padding: 9px 14px; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.portal-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--surface); }
.portal-tabs a:hover { background: var(--surface); }
.stat-value.neg { color: var(--danger); }
.portal-foot { text-align: center; }
.portal-link-box { display: flex; gap: 8px; align-items: center; }
.portal-link-box input { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; direction: ltr; }
@media print { .portal-head, .portal-tabs, .stats, .portal-foot, .toolbar { display: none !important; } .portal-body { max-width: none; padding: 0; } }

/* ---------- قائمة بحث أثناء الكتابة ---------- */
.ss { position: relative; width: 100%; }
.ss.ss-filter { width: 220px; }   /* 0.73: اختيار الطرف داخل شريط التصفية */
.ss-input { width: 100%; padding-inline-end: 28px; }
.ss-disabled .ss-input { background: #f4f6fa; }
.ss-caret { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: .8rem; }
.ss-clear { position: absolute; inset-inline-end: 24px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 4px; }
.ss-list { position: absolute; z-index: 40; top: calc(100% + 4px); inset-inline-start: 0; min-width: 100%; max-width: 520px; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(16,24,40,.14); }
.ss-opt { padding: 7px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-size: .93rem; line-height: 1.4; }
.ss-opt.hi { background: var(--primary-soft); }
.ss-opt.sel .ss-label { color: var(--primary); font-weight: 600; }
.ss-empty { color: var(--muted); }
.ss-sub { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: .8rem; white-space: nowrap; unicode-bidi: plaintext; }
.ss-none { padding: 8px 12px; color: var(--muted); font-size: .85rem; }
.grid.lines .ss-input { min-width: 0; }
.with-btn .ss { flex: 1; }
.unit-row .ss.grow3 { flex: 3; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin: 12px 0; }
.pager-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; } .pager-info { display: flex; align-items: center; gap: 12px; } .pager-info select { padding: 2px 6px; min-height: 28px; }

/* ---------- المرفقات ---------- */
.attachments { margin: 14px 0; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px; background: #fbfcfe; }
.att-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.att-upload { position: relative; overflow: hidden; cursor: pointer; }
.att-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.att-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.att-list li { display: flex; align-items: center; gap: 10px; }
.att-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.att-icon { width: 40px; text-align: center; font-size: 1.3rem; }
.att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .row-warn td { background: #fff9ec; }
.stat.warn .stat-value { color: #b7791f; }

/* ---------- معالج الإعداد ---------- */
.wizard { max-width: 860px; }
.wiz-steps { display: flex; gap: 8px; margin: 10px 0 18px; }
.wiz-step { flex: 1; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.wiz-step.active { border-color: var(--primary); color: var(--primary); }
.wiz-step.done { color: var(--success); }
.wiz-num { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.wiz-step.active .wiz-num { background: var(--primary); color: #fff; }
.wiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.wiz-tile { font: inherit; text-align: start; background: var(--surface); border: 2px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s, box-shadow .12s; }
.wiz-tile:hover { border-color: #b9cdf1; }
.wiz-tile.sel { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.wiz-icon { font-size: 1.6rem; }
.wizard .page-actions { display: flex; justify-content: space-between; margin-top: 16px; }
.center { text-align: center; }
.perm-table { margin: 6px 0 14px; }
.perm-table td.center input { transform: scale(1.1); }

/* قوائم الأسعار: قائمة جانبية + تفاصيل */
.split { display: grid; grid-template-columns: minmax(260px, 1fr) 2.2fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.grid tr.clickable { cursor: pointer; }
.grid tr.clickable:hover td { background: var(--hover, rgba(0,0,0,.03)); }
.grid tr.row-sel td { background: var(--accent-soft, rgba(37,99,235,.08)); font-weight: 600; }
.toolbar .spacer { flex: 1; }
.toolbar label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: .92em; white-space: nowrap; }
.good { color: var(--ok, #15803d); }
.stats.compact { margin: 8px 0 12px; } .stats.compact .stat { padding: 8px 14px; min-width: 110px; }
.grid .row-bad td { background: #fdecec; }
.lot-btn { font-size: .8rem; padding: 2px 6px; margin-inline-start: 4px; }
.lot-btn.has { background: #e8f3ff; border-color: #b9cdf1; }
.receipt.r58 { width: 58mm; font-size: 11px; padding: 4mm 2mm; }
@media print { .receipt.r58 { width: 52mm; } }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #eef4ff; border: 1px solid #b9cdf1; border-radius: 8px; padding: 8px 12px; margin: 8px 0; position: sticky; top: 0; z-index: 5; }
.bulk-bar .spacer { flex: 1; }
.grid th.col-sel, .grid td.col-sel { width: 34px; text-align: center; }
.grid td.col-sel input, .grid th.col-sel input { width: 17px; height: 17px; cursor: pointer; }
.grid tr.row-sel td { background: #eef4ff; }

/* عرض المستند بعد الحفظ بشكله المطبوع (على طريقة Manager) */
.doc-view { background: #e9ecf1; border-radius: 10px; padding: 14px; overflow-x: auto; }
.doc-view-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-view .invoice-sheet { margin: 0 auto; box-shadow: 0 4px 18px rgba(0,0,0,.12); min-height: auto; }
.doc-view-extra { margin-top: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
@media (max-width: 900px) { .doc-view .invoice-sheet { width: 100%; padding: 10mm 6mm; } }

/* صفحة الترخيص والاشتراك */
.brand-only { height: 44px; }
.lic-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; margin-bottom: 16px; }
@media (max-width: 800px) { .lic-hero { grid-template-columns: 1fr; } }
.lic-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; margin-bottom: 8px; }
.lic-ok .lic-badge { background: #e6f6ec; color: #15803d; } .lic-warn .lic-badge { background: #fff4d6; color: #8a5a00; } .lic-bad .lic-badge { background: #fdecec; color: #a12c2c; }
.lic-msg { font-size: 1.05rem; font-weight: 600; margin-bottom: 10px; }
.lic-days { font-size: 1rem; color: var(--muted); } .lic-days b { font-size: 2.4rem; color: var(--text); font-family: var(--mono, monospace); margin-inline-end: 6px; }
.lic-bar { height: 10px; background: #e9edf5; border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.lic-bar-fill { height: 100%; border-radius: 999px; background: #15803d; } .lic-warn .lic-bar-fill { background: #e0a020; } .lic-bad .lic-bar-fill { background: #d33; }
.lic-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; align-content: start; font-size: .92rem; }
.lic-facts dt { color: var(--muted); } .lic-facts dd { margin: 0; }
.lic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .lic-grid { grid-template-columns: 1fr; } }
.lic-contact { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.lic-foot { text-align: center; margin: 34px 0 10px; } .lic-foot img { height: 64px; opacity: .9; }

/* قوائم البحث داخل جداول السطور: لا تقصّها حدود الجدول */
.grid.lines, .grid:has(.ss-list) { overflow: visible; }
.grid.lines td { overflow: visible; }
.ss-list { z-index: 60; }

.ss-opt:hover { background: var(--primary-soft, #eef3ff); }

.tenant-banner { border-radius: 8px; margin-bottom: 14px; border: 1px solid; }

/* ملصقات الباركود الجماعية */
.lbl-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; flex-wrap: wrap; }
.lbl-opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.lbl-opts .inline { display: inline-flex; gap: 6px; align-items: center; font-size: .9em; }
.lbl-table { margin-bottom: 8px; }
.labels-50 .label { width: 50mm; font-size: 10px; }
.labels-38 .label { width: 38mm; font-size: 9px; padding: 2px 4px; }
.labels-38 .label-biz { display: none; }

/* جداول القوائم الرئيسية (الأصناف / العملاء / الموردون): صفوف أوضح، عنوان بارز، وحدات متعددة بأسطر مرتبة */
.list-table th { position: sticky; top: 0; z-index: 2; background: #f3f5fa; border-bottom: 2px solid #dfe5f0; padding: 10px 12px; }
.list-table td { padding: 10px 12px; vertical-align: top; }
.list-table tbody tr:nth-child(even) td { background: #fbfcfe; }
.list-table tbody tr:hover td { background: #f1f5fd; }
.list-table .row-sel td { background: #eef3ff !important; }
.list-table .row-title { font-weight: 600; font-size: 1rem; }
.list-table .col-sel { width: 36px; text-align: center; }
.list-table .col-sel input { width: 16px; height: 16px; accent-color: var(--primary); }
.list-table .col-actions .btn-mini { opacity: .55; }
.list-table tbody tr:hover .col-actions .btn-mini { opacity: 1; }
.unit-line { line-height: 1.7; white-space: nowrap; }
.unit-line.small { color: #556; }
.row-multi .unit-line:first-child { border-bottom: 1px dashed #e3e8f1; }
.items-table td.num { font-size: .98rem; }
.bal-due { color: var(--danger); font-weight: 600; }
.bal-credit { color: var(--success); font-weight: 600; }
.calc-hint { margin-inline-start: auto; cursor: help; border: 1px dashed var(--border); border-radius: 6px; padding: 2px 8px; }
.items-table td:nth-child(3) { min-width: 200px; }
.items-table .muted.small.mono { white-space: nowrap; direction: ltr; text-align: end; }
.pl-cats { margin-bottom: 12px; padding: 10px 14px; }
.pl-cats h3.sub { margin-top: 0; }

/* جرس الإشعارات */
.bell-wrap { position: relative; }
.bell { position: relative; font-size: 1.05rem; }
.bell-count { position: absolute; top: -2px; inset-inline-end: -4px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; padding: 0 5px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; }
.bell.has { color: var(--primary); }
.bell-backdrop { position: fixed; inset: 0; z-index: 39; }
.bell-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 380px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(16,24,40,.18); z-index: 40; max-height: 70vh; overflow: auto; }
.bell-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.bell-head .spacer { flex: 1; }
.bell-item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.bell-item:hover { background: var(--primary-soft); }
.bell-item.unread { background: #fffbea; border-inline-start: 3px solid var(--primary); }
.bell-title { font-weight: 600; }
.bell-body { margin-top: 2px; }
.list-table .row-unread td { background: #fffbea !important; }
.sub-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 12px; }
@media (max-width: 640px) { .sub-plans { grid-template-columns: 1fr; } }
.sub-plan { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; background: var(--surface); }
.sub-plan.hi { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.sub-name { font-weight: 700; }
.sub-price b { font-size: 1.6rem; color: var(--primary); }
.sub-price small { color: var(--muted); }

/* لوحة رصيد الطرف وربح المستند (على الشاشة فقط) */
.doc-insights { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; justify-content: flex-end; }
.doc-insights .di-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; min-width: 260px; background: var(--surface); box-shadow: var(--shadow); }
.doc-insights .di-profit { border-color: var(--success-line, #cfe6d6); background: var(--success-soft, #f6fbf7); }
.doc-insights .di-title { font-weight: 600; margin-bottom: 6px; }
.doc-insights .totals { width: 100%; }
.doc-insights .good { color: var(--success); font-weight: 600; } .doc-insights .bad { color: var(--danger); }
@media print { .doc-insights { display: none !important; } }
/* السطر المختصر لرصيد الطرف في شاشة التحرير: أعلى الجدول وبعيدًا عن مجاميع الفاتورة */
.doc-insights-inline { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin: -4px 0 10px; padding: 6px 12px; border: 1px dashed var(--border); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 70%, transparent); font-size: .9rem; color: var(--muted); }
.doc-insights-inline .dii-k { opacity: .85; } .doc-insights-inline .dii-sep { opacity: .5; margin: 0 4px; } .doc-insights-inline .dii-label { font-weight: 600; color: var(--text); }
.doc-insights-inline b { color: var(--text); } .doc-insights-inline .good { color: var(--success); } .doc-insights-inline .bad { color: var(--danger); }
@media print { .doc-insights-inline { display: none !important; } }

@keyframes navIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ===== نافذة إعادة الاتصال ===== */
.reconnect-modal { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(15, 23, 42, .45); align-items: center; justify-content: center; padding: 16px; }
.reconnect-modal.components-reconnect-show, .reconnect-modal.components-reconnect-failed, .reconnect-modal.components-reconnect-rejected { display: flex; }
/* 0.80 (M26): الانقطاع اللحظي (شبكات الجوال) لا يغطي الشاشة فورًا — الطبقة تظهر بعد ~1.5 ثانية فقط إن استمر الانقطاع */
.reconnect-modal.components-reconnect-show { animation: rcDelay 1.6s steps(1, end) both; }
@keyframes rcDelay { from { visibility: hidden; opacity: 0; } to { visibility: visible; opacity: 1; } }
.reconnect-box { background: var(--surface, #fff); color: var(--text, #111); border-radius: 12px; padding: 22px 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.reconnect-box p { margin: 8px 0 14px; color: var(--muted, #555); }
/* 0.85: أزرار وضع الشبكة الضعيفة: «فعّل» في وضع WebSocket فقط، و«إلغاؤه» في وضع Long Polling فقط */
.reconnect-box .rc-weak, .reconnect-box .rc-weak-off { display: none; margin-top: 10px; }
html[data-net="ws"] .reconnect-box .rc-weak { display: inline-flex; }
html[data-net="lp"] .reconnect-box .rc-weak-off { display: inline-flex; }
.reconnect-box .rc-unsaved { color: var(--warn-text, #8a5a00); background: var(--warn-soft, #fff6e0); border-radius: 8px; padding: 8px 10px; }
.reconnect-box .rc-show, .reconnect-box .rc-failed, .reconnect-box .rc-rejected { display: none; }
.components-reconnect-show .rc-show, .components-reconnect-failed .rc-failed, .components-reconnect-rejected .rc-rejected { display: block; }
.rc-spin { width: 34px; height: 34px; margin: 0 auto 12px; border: 4px solid var(--border, #dbe4f3); border-top-color: var(--primary); border-radius: 50%; animation: rcspin 1s linear infinite; }
@keyframes rcspin { to { transform: rotate(360deg); } }
@media print { .reconnect-modal { display: none !important; } }

@media (max-width: 800px) {
    /* الكاشير على الجوال: الأصناف في الأعلى والسلة تحتها */
    .print-page:has(.pos) { padding: 0; }
    .pos { height: auto; min-height: 100vh; min-height: 100dvh; margin: 0; padding-bottom: 64px; }   /* 0.80: مكان للشريط السفلي الثابت */
    .pos-bar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
    .pos-body { flex-direction: column; }
    .pos-items { padding: 8px; max-height: 55vh; }
    .pos-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }   /* 0.78: 130 (كانت تتغلب على 110 من كتلة ملحقة) */
    .pos-cart { width: auto; border-inline-start: 0; border-top: 1px solid var(--border); }
    .grid { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .grid td, .grid th { padding: 8px 10px; }
    .card { min-width: 0; max-width: 100%; overflow-x: auto; }
    .page-actions { flex-wrap: wrap; }
}

/* تنبيهات وثائق الموظفين */
.doc-alerts { border-inline-start: 4px solid #e0a100; background: #fffaf0; margin-bottom: 14px; }
.doc-alerts ul { margin: 8px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.mt-s { margin-top: 10px; }
details.mt-s > summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.hijri-line { font-size: .85em; color: #555; font-family: var(--font); }

/* دليل المستخدم */
.help-page .search { width: 100%; margin: 8px 0 12px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.help-toc a { background: var(--primary-soft); color: var(--primary); padding: 4px 12px; border-radius: 999px; font-size: .88rem; text-decoration: none; }
.help-sec { margin-bottom: 14px; scroll-margin-top: calc(var(--topbar-h) + 10px); }
.help-sec h2 { margin-top: 0; }
.help-sec ol { padding-inline-start: 22px; display: grid; gap: 6px; }
.help-tip { background: #fffaf0; border-inline-start: 3px solid #e0a100; padding: 8px 12px; border-radius: 6px; margin-bottom: 0; }
.help-link { font-weight: 800; font-size: 1.05rem; }
.today-dates { font-weight: 400; font-size: .9rem; margin-inline-start: 8px; }

/* هوية المنشأة في الشريط العلوي، وتوقيع البرنامج أسفل القائمة */
.biz-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.biz-brand .topbar-business { color: var(--text); font-weight: 700; font-size: 1.02rem; }
.biz-logo { height: 38px; max-width: 120px; width: auto; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.biz-initial { width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font); }
.pos-bar .biz-logo { height: 32px; } .pos-bar .biz-initial { width: 32px; height: 32px; font-size: .95rem; }
.powered-by { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px; color: var(--muted); font-size: .8rem; text-decoration: none; opacity: .8; }
.powered-by:hover { opacity: 1; color: var(--primary); }
.powered-by img { height: 22px; width: auto; filter: grayscale(30%); }
@media (max-width: 800px) {
    .biz-brand { flex: 1 1 auto; }
    .biz-logo { height: 30px; max-width: 80px; } .biz-initial { width: 30px; height: 30px; font-size: .9rem; }
    .biz-brand .topbar-business { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .biz-brand.has-logo .topbar-business { display: none; }   /* على الجوال: الشعار يكفي عن الاسم */
    .biz-brand.has-logo .biz-logo { max-width: 130px; }
}
.warn-card { border-color: #d9a441; background: color-mix(in srgb, #d9a441 10%, transparent); }

/* حدود الخطأ داخل المنشأة (0.53): بطاقة بدل شريط «حدث خطأ غير متوقع» الذي يُنهي الجلسة */
.error-boundary { border-color: var(--danger); max-width: 640px; margin: 24px auto; }
.error-boundary h2 { margin-top: 0; color: var(--danger); }
.error-boundary .btn { margin-inline-end: 8px; }

/* 0.60: مراجعة قراءة الذكاء الاصطناعي */
.ai-review td { vertical-align: top; }
.ai-review .ai-new { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-review .ai-new input:first-child { flex: 1 1 12em; min-width: 10em; }

/* 0.60: زر وأيقونة الذكاء الاصطناعي ونافذة التقدّم */
.btn-ai { display: inline-flex; align-items: center; gap: 6px; color: #5b3fd6; border: 1px solid rgba(91,63,214,.35); background: linear-gradient(180deg, rgba(91,63,214,.08), rgba(91,63,214,.02)); }
.btn-ai:hover { background: rgba(91,63,214,.14); border-color: rgba(91,63,214,.6); }
.btn-ai.disabled { opacity: .6; pointer-events: none; }
.ai-icon { vertical-align: -3px; }
.ai-progress h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; color: #5b3fd6; }
.ai-steps { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.ai-steps li.now { color: var(--text); font-weight: 600; }
.ai-steps li.done { color: #1a7f4b; }
.ai-steps li.err { color: #b42318; }
.ai-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px solid currentColor; font-size: .85rem; flex: none; }
.ai-steps li.now .ai-dot { border-top-color: transparent; animation: rcspin .9s linear infinite; }
.ai-steps li.done .ai-dot { background: #1a7f4b; color: #fff; border-color: #1a7f4b; }
.ai-steps li.err .ai-dot { background: #b42318; color: #fff; border-color: #b42318; }
.ai-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ai-progress .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }

/* 0.70 نقل الأعمال السابقة: شريط التقدّم، شارة «منقولة»، وبطاقة المستند المنقول */
.imp-bar { height: 12px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 6px 0 8px; }
.imp-bar > div { height: 100%; background: linear-gradient(90deg, var(--primary), #5b3fd6); border-radius: 999px; transition: width .3s ease; }
.imp-indeterminate > div { width: 35% !important; animation: impslide 1.2s ease-in-out infinite; }
@keyframes impslide { 0% { margin-inline-start: -35%; } 100% { margin-inline-start: 100%; } }
.imp-running { display: flex; flex-direction: column; gap: 4px; }
.badge-imp { background: rgba(91,63,214,.12); color: #5b3fd6; }
.ai-tag { background: rgba(91,63,214,.12); color: #5b3fd6; display: inline-flex; align-items: center; gap: 3px; }
.ai-on { color: #5b3fd6; }
.imp-card { border: 1px dashed rgba(91,63,214,.45); border-radius: 12px; padding: 16px 18px; background: var(--surface); max-width: 820px; }
.imp-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-card-head h2 { margin: 0; font-size: 1.15rem; }
.imp-table th { width: 22%; color: var(--muted); font-weight: 500; text-align: start; }
@media (max-width: 640px) { .imp-table th { width: auto; } }

/* زر إظهار كلمة المرور */
/* كلمة المرور نص لاتيني يبدأ من اليسار: الحاوية LTR فتبقى العين على اليمين بالخصائص المنطقية نفسها (بدل right/left الفيزيائية في 0.78) */
.pw-wrap { position: relative; display: flex; align-items: center; direction: ltr; }
.pw-wrap > input { flex: 1; padding-inline-end: 42px !important; padding-inline-start: 12px; width: 100%; }
.pw-wrap > input::placeholder { direction: rtl; }
[dir="ltr"] .pw-wrap > input::placeholder { direction: ltr; }
.login-box .btn-ghost[href="/signup"] { white-space: normal; line-height: 1.4; padding: 9px 14px; border-radius: 18px; }
.pw-eye { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 4px; cursor: pointer; color: var(--muted); display: inline-flex; border-radius: 6px; }
.pw-eye:hover { color: var(--text); background: var(--surface-2); }
.pw-eye .eye-off { display: none; }
.pw-eye.is-shown .eye-off { display: block; }
.pw-eye.is-shown .eye-open { display: none; }

/* خصم السطر: نسبة أو مبلغ (0.62) */
.grid.lines td.disc-cell { white-space: nowrap; }
.grid.lines td.disc-cell input.num { min-width: 64px; width: calc(100% - 58px); display: inline-block; vertical-align: middle; }
.grid.lines select.disc-mode, .totals select.disc-mode { width: 54px; padding: 6px 4px; margin-inline-start: 2px; vertical-align: middle; font-size: 0.85rem; }
.totals .doc-disc { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.totals tr.settle td select, .totals tr.settle td input { min-width: 160px; }

/* خيار «المبالغ شاملة الضريبة» بجوار عنوان البنود */
h2 .inc-vat-toggle { font-size: .85rem; font-weight: 500; margin: 0 14px 0; vertical-align: middle; }
.line-party { margin-top: 2px; }

/* اقتراحات الزوار (لوحة المدير) */
.suggestions .sug { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; background: var(--surface); }
.suggestions .sug summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.suggestions .sug-body { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; }
.suggestions .sug-text { white-space: pre-wrap; background: var(--surface-2, #f6f7fa); padding: 8px 10px; border-radius: 6px; }
.suggestions .sug-done { opacity: .8; } .suggestions .sug-rejected { opacity: .6; }

/* ===== مراجعة التنسيقات (0.64): أماكن كتابة أوسع في كل الشاشات =====
   - أعمدة الرقم/الوحدة/النسبة ضيقة بطبيعتها، وعمود الصنف/الحساب/البيان يأخذ ما تبقى من العرض كاملًا
   - خانات الإدخال داخل الجداول تملأ خليتها، ولا تنكسر الأرقام على سطرين */
.grid.lines { table-layout: auto; }
.grid.lines td input:not(.num), .grid.lines td select, .grid.lines td .ss { width: 100%; min-width: 0; }
.grid.lines td input.num, .grid.lines td select.num { min-width: 96px; }
.grid.lines th.num { white-space: nowrap; }
.grid.lines td.num, .grid.lines td.mono { white-space: nowrap; }
.grid.lines td:first-child { min-width: 220px; }
.grid.lines td input { padding: 8px 10px; }
/* الحقول العادية: ارتفاع مريح وعرض كامل داخل عمودها */
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
.field textarea { min-height: 84px; }
/* ورقة الفاتورة/السند: عمود الصنف والبيان يتمدد، والأرقام في سطر واحد */
.inv-lines th.start, .inv-lines td.start { width: auto; }
.inv-lines td.mono { white-space: nowrap; }
.inv-lines td, .inv-lines th { padding: 6px 8px; }
.alloc-lines { width: 60%; }
/* القوائم (الجداول العامة): البيان لا يُقطع بعلامة …، بل يلتف على سطرين عند الحاجة */
@media (min-width: 801px) {
    .grid td { white-space: normal; overflow-wrap: anywhere; }
    .grid td.num, .grid td.mono, .grid td.col-actions { white-space: nowrap; overflow-wrap: normal; }
}
@media (min-width: 1400px) { .content { padding: 28px 40px; } }

/* 0.71: رصيد المخزن بجوار الصنف في فاتورة البيع */
.stock-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 0.72rem; line-height: 1.4; padding: 1px 8px; border-radius: 999px; background: var(--primary-soft, #eef3f8); color: var(--muted, #556); border: 1px solid transparent; white-space: nowrap; }
.stock-pill b { font-weight: 700; color: var(--text, #223); font-variant-numeric: tabular-nums; }
.stock-pill .sp-ico { opacity: .7; }
.stock-pill .sp-arrow { opacity: .6; margin: 0 2px; }
/* 0.80 (M17): ألوان التنبيه من رموز الثيم (تتبدل في الوضع الليلي) */
.stock-pill.zero { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.stock-pill.zero b:last-child { color: var(--warn-text); }
.stock-pill.neg { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.stock-pill.neg b:last-child { color: var(--danger-text); }
/* 0.71: جدول تعديل صفوف النقل قبل الاعتماد */
.mig-edit td input, .mig-edit td select { width: 100%; min-width: 70px; font-size: 0.82rem; padding: 3px 6px; }
.mig-edit td.num input { text-align: end; }
.mig-edit tr.row-bad td { background: var(--danger-soft); }
.mig-edit tr.row-dup td { opacity: .55; }
.mig-edit tr.row-skip td { opacity: .4; text-decoration: line-through; }
.mig-edit .err { color: #b42318; font-size: 0.72rem; display: block; }
.mig-examples table.grid th { white-space: nowrap; }
.excel-like th { background: var(--surface-2, #e9eef3); color: var(--text); border: 1px solid var(--border-strong, #c9d2dc) !important; }
.excel-like td { border: 1px solid var(--border, #dfe5ec) !important; white-space: nowrap; }
.mig-examples h3 { margin-top: 14px; font-size: 0.95rem; }

/* 0.73: جدول اشتراكات العملاء — صف واحد لكل حساب، عدد المنشآت رقم يُفتح عند الحاجة */
.grid.tenants td { vertical-align: top; }
.grid.tenants td.num { white-space: nowrap; }
.inline-details { display: inline-block; }
.inline-details > summary { cursor: pointer; list-style: none; display: inline; text-decoration: underline dotted; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] > summary { text-decoration: none; }
.inline-details > div { text-align: start; white-space: nowrap; }

/* 0.73: ملخص الحسابات في صفحة الملخص — عمودان: الميزانية وقائمة الدخل، كل حساب رابط لكشفه */
.acct-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.acct-summary-head h2 { margin: 0; }
.acct-summary-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct-summary-tools select { padding: 4px 8px; width: auto; min-width: 0; }
.acct-summary-tools label { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.acct-summary-tools label input { width: auto; margin: 0; }
.acct-summary-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 10px; }
.acct-summary-cols h3 { margin: 6px 0 8px; font-size: 1rem; }
.acct-table thead th { background: var(--surface-2, rgba(0,0,0,.04)); font-weight: 700; }
.acct-table td a { color: var(--text); text-decoration: none; display: inline-block; }
.acct-table td a:hover { color: var(--primary); text-decoration: underline; }
.acct-table .acct-group td { color: var(--muted); font-weight: 600; font-size: .85rem; padding-top: 6px; }
.acct-table td.num a { display: block; }
.acct-net td { font-weight: 700; }
@media (max-width: 900px) { .acct-summary-cols { grid-template-columns: 1fr; } }

/* 0.74: صفحة الترخيص للمدير أوسع (جدول الاشتراكات) مع تمرير أفقي للجدول عند الضيق */
.page-narrow.lic-admin { max-width: 1180px; }
.lic-admin .table-scroll { overflow-x: auto; }
/* جدول اشتراكات العملاء: عرض أدنى مع تمرير أفقي بدل تكديس الأعمدة */
.grid.tenants { min-width: 1180px; }
.grid.tenants th, .grid.tenants td { white-space: nowrap; }
.grid.tenants td:first-child b { word-break: normal; white-space: nowrap; }
.grid.tenants td .col-actions { flex-wrap: nowrap; }

/* 0.75: ملخص الحسابات — أرقام أصغر بخط ثابت العرض ومحاذاة يمنى موحّدة وفواصل آلاف، صفوف أقصر، ولا التفاف للمبالغ */
.acct-table { font-size: .9rem; }
.acct-table th, .acct-table td { padding: 4px 8px; line-height: 1.35; }
.acct-table td.num, .acct-table th.num { font-family: var(--num-font); font-size: .88rem; font-weight: 500; font-variant-numeric: tabular-nums lining-nums; letter-spacing: 0; white-space: nowrap; width: 1%; text-align: end; direction: ltr; }
.acct-table thead th.num { font-size: .9rem; font-weight: 700; }
.acct-table td:first-child { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-table td:first-child .muted.mono { font-size: .75rem; }
.acct-table .acct-group td { font-size: .8rem; padding-top: 8px; }
.acct-net td { font-size: .95rem; }
.acct-summary-cols h3 { font-size: .98rem; }

/* ---------- 0.75: صفحة إعدادات المنشأة — تبويبات + شريط حفظ ثابت ---------- */
/* overflow-x:auto على .content يجعلها حاوية تمرير فيتعطّل sticky؛ clip يقصّ بلا إنشاء حاوية تمرير */
.content:has(.settings-page) { overflow-x: clip; }
.settings-page { max-width: 1040px; }
.settings-page .settings-links { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 4px 0 12px; }
.settings-page .settings-links .card-link { padding: 8px 12px; margin: 0; gap: 10px; min-width: 0; }
.settings-page .settings-links .card-link > div { min-width: 0; }
.settings-page .settings-links .card-title { font-size: .95rem; line-height: 1.4; }
.settings-page .settings-links .card-sub { margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1000px) { .settings-page .settings-links { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.settings-tabs {
    position: sticky; top: var(--topbar-h); z-index: 9;
    display: flex; gap: 4px;
    margin: 0 0 14px; padding: 6px 0 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.settings-tab {
    flex: 0 0 auto; font: inherit; font-weight: 600; font-size: .93rem; white-space: nowrap; cursor: pointer;
    padding: 8px 14px; margin-bottom: -1px;
    color: var(--muted); background: transparent;
    border: 1px solid transparent; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0;
    transition: color .12s, background .12s, border-color .12s;
}
.settings-tab:hover { color: var(--primary); background: var(--primary-soft); }
.settings-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.settings-tab.active { color: var(--primary); background: var(--surface); border-color: var(--border); border-bottom: 2px solid var(--primary); }

.settings-form { max-width: none; }
.settings-pane[hidden] { display: none !important; }
.settings-pane {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 4px 20px 72px; box-shadow: var(--shadow);   /* فراغ أسفل النموذج حتى لا يغطي شريط الحفظ الحقل الأخير */
}
.settings-pane h3.sub { margin: 16px 0 2px; font-size: 1rem; }
.settings-pane > h3.sub:first-child, .settings-danger > h3.sub:first-child { margin-top: 12px; }
.settings-pane h3.sub + p.muted.small { margin: 0 0 8px; }
.settings-pane p.muted.small { font-size: .88rem; margin: 2px 0 8px; line-height: 1.6; }
.settings-pane .field { margin-bottom: 10px; gap: 4px; min-width: 0; flex: 1 1 200px; }
.settings-pane .field > span { font-size: .9rem; }
.settings-pane .field-row { gap: 6px 14px; flex-wrap: wrap; align-items: flex-start; }
.settings-pane .field-row > .check { align-self: center; margin: 14px 0 8px; }
.settings-pane .field-btn { flex: 0 0 auto; }
.settings-pane .field-row > .field:only-child { max-width: calc(50% - 7px); }
.settings-pane > p:has(> a.btn) { margin: 4px 0 6px; }
.settings-pane .check { margin-bottom: 8px; }
.settings-pane .check-grid { gap: 2px 22px; margin-bottom: 4px; }
.settings-pane .check-col { display: flex; flex-direction: column; align-items: flex-start; }
.settings-pane .check-col .check { margin-bottom: 6px; }
.settings-pane .logo-row { margin-top: 6px; }
.settings-pane .notice { margin-bottom: 10px; }
.settings-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; margin: 10px 0; background: var(--surface-2, var(--bg)); }
.settings-box > summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.settings-box[open] > summary { margin-bottom: 6px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.settings-danger { margin-top: 18px; border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border)); border-radius: 8px; padding: 0 14px 6px; }
.settings-danger h3.sub { color: var(--danger); }

.settings-actionbar {
    position: sticky; bottom: 0; z-index: 9;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 14px; padding: 8px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -4px 16px rgba(16,24,40,.08);
}
.settings-actionbar .btn-primary { min-width: 150px; }
.settings-actionbar-msg { margin: 0; font-weight: 600; font-size: .92rem; line-height: 1.5; }
.settings-actionbar .toast.settings-actionbar-msg { padding: 5px 12px; }

@media (max-width: 900px) {
    .settings-pane .field { flex-basis: 180px; }
}
@media (max-width: 800px) {
    /* زر ☰ ثابت أيضًا تحت الشريط العلوي — ننزل التبويبات تحته */
    .settings-tabs { top: calc(var(--topbar-h) + 48px); margin-inline: -12px; padding-inline: 12px; box-shadow: 0 -48px 0 var(--bg); }
    .settings-pane { padding: 4px 12px 72px; }
    /* الشريط الخلفي (box-shadow) فوق التبويبات يملأ الفراغ حول زر ☰؛ البطاقات فوقه حتى لا يغطيها قبل الالتصاق */
    .settings-tabs { z-index: 8; }
    .settings-page .settings-links { grid-template-columns: 1fr 1fr; gap: 6px; position: relative; z-index: 9; }
    .settings-page .settings-links .card-link { padding: 6px 10px; gap: 8px; }
    .settings-page .settings-links .card-title { font-size: .88rem; }
    .settings-page .settings-links .card-sub { display: none; }
    .settings-pane .field-row { flex-direction: column; gap: 0; }
    .settings-pane .field-row > .field { flex-basis: auto; width: 100%; }
    .settings-pane .field-row > .field:only-child { max-width: none; }
    .settings-pane .field[style*="max-width"], .settings-pane .field-row input[style*="max-width"] { max-width: none !important; }
    .settings-actionbar { margin-inline: -12px; border-radius: 0; padding: 8px 12px; }
    .settings-actionbar .btn-primary { flex: 0 0 auto; }
}

/* 0.75: alignment — رأس العمود وخلاياه على محاذاة واحدة.
   السبب: unicode-bidi:plaintext على .num و.mono كان يقلب اتجاه خلية الرقم/التاريخ إلى LTR،
   فصار "end" للأرقام = اليمين و"start" للتواريخ = اليسار، بينما رؤوسها العربية في الجهة المقابلة.
   الآن: الخلية معزولة (isolate) والمحاذاة تُحسب من اتجاه الصفحة لا من محتوى الخلية. */
.grid th.num, .grid td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; unicode-bidi: isolate; }
.grid td.mono, .grid th.mono { unicode-bidi: isolate; }
/* الأرقام تُكتب LTR (ليبقى السالب "-1,234.00" سليمًا) لكنها تلتصق بنهاية السطر العربي (اليسار) مثل رأسها */
[dir="rtl"] .grid td.num { direction: ltr; text-align: left; }
[dir="rtl"] .grid th.num { text-align: left; }
.grid td.num input, .grid td.num .ss-input { text-align: end; }
[dir="rtl"] .grid td.num input, [dir="rtl"] .grid td.num .ss-input { direction: ltr; text-align: left; }
/* التواريخ والأرقام المرجعية: LTR معزولة، وتبقى في بداية السطر (اليمين) تحت رأسها */
[dir="rtl"] .grid td.mono:not(.num) { direction: ltr; text-align: right; }
.grid.lines th { padding: 6px 6px; }
/* ملخص الحسابات اختار محاذاة يمنى موحّدة للرأس والخلايا */
[dir="rtl"] .grid.acct-table td.num, [dir="rtl"] .grid.acct-table th.num { text-align: right; }
/* td.lines-foot كان display:flex فيخرج من شبكة الجدول ويضيق في عمود واحد (يلتف «إضافة سطر») — نعيده خلية تمتد على colspan */
.grid td.lines-foot { display: table-cell; white-space: nowrap; }
.grid td.lines-foot > * { display: inline-flex; vertical-align: middle; margin-inline-end: 14px; }
/* القوائم المنسدلة داخل خلية رقمية تبقى RTL حتى لا يُقصّ نصها العربي (بدون ضريبة…) من بدايته */
[dir="rtl"] .grid td.num select { direction: rtl; }
/* جدول توزيع السند على الفواتير: العمود الأول رقم فاتورة لا قائمة حسابات، فلا يحتاج 220px — كان يدفع الجدول خارج الشاشة في النوافذ الضيقة */
.grid.lines.rcv-alloc td:first-child { min-width: 0; }
.grid.lines.rcv-alloc td.num input.num { min-width: 96px; }

/* 0.76: تنسيق موحّد للأرقام في كل الجداول والبطاقات (الملخص، القيود، الأصول، الموظفين، الأصناف، التقارير…):
   خط الواجهة بأرقام متساوية العرض (تصطف الفواصل العشرية تحت بعضها)، وزن متوسط، وحجم أصغر قليلًا من النص */
.grid td.num, .grid td.mono, .grid th.num, input.num, .totals td.num, .stat-value, .kpi-value, .tile-price, .ss-sub {
    font-family: var(--num-font); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1; letter-spacing: 0;
}
.grid td.num, .grid td.mono { font-size: .93em; font-weight: 500; }
.grid .row-total td.num, .grid .row-subtotal td.num, .grid tr.row-total td.mono, .grid td.num b, .totals tr:last-child td.num { font-weight: 700; }
.grid td.num { direction: ltr; }
.stat-value { font-size: 1.5rem; letter-spacing: 0; }
/* الجوال: بطاقات الأرقام بطاقتان في كل صف بعرض كامل بدل بطاقات متفاوتة العرض بجانبها فراغ */
@media (max-width: 800px) {
    .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { min-width: 0; padding: 14px 14px; }
    .stat-value { font-size: 1.35rem; }
}

/* 0.76: واجهة التخصيص — شريط علوي ثابت، مجموعات في بطاقات، ومفتاح تبديل لكل وحدة */
.cz-intro { margin-bottom: 12px; }
.cz-bar { position: sticky; top: calc(var(--topbar-h, 56px) + 6px); z-index: 6; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 16px; }
.cz-count { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.cz-count b { font-size: 1.35rem; font-family: var(--num-font); font-variant-numeric: tabular-nums; color: var(--primary); }
.cz-dirty { font-size: .78rem; font-weight: 700; color: var(--warn, #b7791f); background: rgba(183,121,31,.12); border-radius: 999px; padding: 2px 10px; }
.cz-search { flex: 1; min-width: 180px; }
.cz-search input { width: 100%; }
.cz-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cz-groups { display: grid; gap: 14px; }
.cz-group { padding: 14px 16px; margin: 0; }
.cz-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cz-group-head h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.cz-group-count { font-family: var(--num-font); font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface-2, var(--bg)); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-variant-numeric: tabular-nums; }
.cz-group-toggle { font: inherit; font-size: .82rem; font-weight: 600; color: var(--primary); background: none; border: 0; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.cz-group-toggle:hover { background: var(--primary-soft); }
.cz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cz-card { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm, 10px); padding: 10px 12px; cursor: pointer;
    background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s; }
.cz-card:hover { border-color: var(--primary); }
.cz-card.on { border-color: var(--primary); background: var(--primary-soft); }
.cz-card.locked { cursor: default; }
.cz-icon { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2, var(--bg)); color: var(--muted); }
.cz-card.on .cz-icon { background: var(--primary); color: #fff; }
.cz-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.cz-name { font-weight: 700; }
.cz-desc { color: var(--muted); font-size: .8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cz-switch { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong, #c9cdd4); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.cz-switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: inset-inline-start .15s; }
.cz-switch:checked { background: var(--primary); }
.cz-switch:checked::after { inset-inline-start: 19px; }
.cz-switch:disabled { opacity: .55; cursor: default; }
.cz-switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 640px) {
    .cz-bar { top: calc(var(--topbar-h, 56px) + 2px); }
    .cz-actions { width: 100%; } .cz-actions .btn-primary { flex: 1; }
    .cz-grid { grid-template-columns: 1fr; }
}

/* 0.76: شاشة السيولة النقدية */
.liq-stats .liq-main { border-color: var(--primary); }
.liq-stats .liq-main .stat-value { font-size: 1.8rem; }
.liq-accounts { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 14px; }
.liq-acc { font: inherit; display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; color: var(--text); }
.liq-acc:hover { border-color: var(--primary); }
.liq-acc.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.liq-acc-name { font-weight: 600; font-size: .88rem; }
.liq-acc-bal { font-family: var(--num-font); font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; }
.liq-acc-bal.neg, .stat-value.neg { color: var(--danger); }
.liq-period { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 4px 0 14px; }
.liq-period > div { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm, 10px); padding: 8px 12px; }
.liq-period .k { font-size: .78rem; color: var(--muted); font-weight: 600; }
.liq-period .v { font-family: var(--num-font); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; }
.liq-period .good .v, .liq-in { color: var(--success); }
.liq-period .bad .v, .liq-out { color: var(--danger); }
.liq-period .strong { border-color: var(--primary); }
.liq-chart { padding: 12px 14px; margin-bottom: 14px; }
.liq-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.liq-chart .legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.liq-chart .legend .sw { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-inline-end: 5px; vertical-align: middle; }
.liq-sw-line { background: var(--primary); } .liq-sw-in { background: var(--success); } .liq-sw-out { background: var(--danger); }
.chart .liq-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .liq-bar-in { fill: var(--success); opacity: .55; }
.chart .liq-bar-out { fill: var(--danger); opacity: .5; }
.chart .liq-hit { fill: transparent; }
.chart .liq-hit:hover { fill: var(--primary); }
.liq-range { font-weight: 500; margin-inline-start: 8px; font-family: var(--num-font); }

/* 0.77: فرز الأعمدة بالضغط على العنوان */
.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.grid th.sortable:hover { color: var(--primary); }
.grid th.sortable .sort-ind { font-size: .85em; opacity: .65; margin-inline-start: 6px; }   /* كان باهتًا جدًا (35%) */
.grid th.sortable.sort-active { color: var(--accent-dark, var(--primary)); }
.grid th.sortable.sort-active .sort-ind { opacity: 1; color: var(--accent-dark, var(--primary)); }
.grid th.sortable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 4px; }
/* 0.77: طريقة السداد لم تُختر بعد — تمييز الحقل حتى يختار المستخدم قبل الإصدار */
select.settle-unchosen { border-color: var(--warn, #d9a21b); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn, #d9a21b) 18%, transparent); }
/* 0.77: شريط مراجعة الوردية */
.pos-review-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* 0.77: سعران للبيع في الكاشير */
.tile-min { display: block; font-size: .72rem; margin-top: -2px; }
.cl-price-edit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cl-price-edit input { width: 88px; padding: 2px 6px; font-size: .9rem; text-align: end; font-variant-numeric: tabular-nums; }
.cl-price-edit .pos-range { font-size: .72rem; opacity: .8; white-space: nowrap; }
/* 0.77: مربع حركة اليوم — أربع خانات (مبيعات/مشتريات/صندوق/بنك) وسطر إجمالي */
.biz-daily-table .biz-daily-total td { font-weight: 700; border-top: 1px solid var(--border); }
.biz-daily-table td.num a { color: inherit; }
/* 0.77: خانات مربع حركة اليوم بارتفاع واحد — العنوان سطر، الرقم سطر، الشرح سطر — فتصطف الأرقام أفقيًا، والرقم محاذٍ لجهة النص */
.biz-daily-totals > div { display: grid; grid-template-rows: auto auto auto; align-content: start; }
.biz-daily-totals .k, .biz-daily-totals .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.biz-daily-totals .v { line-height: 1.4; text-align: start; unicode-bidi: plaintext; }
.biz-daily-table th.num, .biz-daily-table td.num { text-align: end; direction: ltr; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* 0.77: رابط فرعي في القائمة الجانبية (الورديات تحت نقاط البيع) */
.nav-group-items .nav-item.nav-sub, .nav-item.nav-sub { padding-inline-start: 46px; font-size: .92em; }
.nav-group-items .nav-item.nav-sub::before { inset-inline-start: 34px; }
.nav-group-items .nav-item { font-size: .95rem; color: var(--side-text); }
.pos-review-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
/* 0.77: جدول حركة اليوم بخمسة أعمدة — المربع أعرض (460px)، الأرقام لا تخرج عن حدوده، واسم المنشأة يُقصّ بنقاط */
.biz-daily-table { table-layout: fixed; font-size: .8rem; }
.biz-daily-table th:first-child, .biz-daily-table td:first-child { width: 34%; }
.biz-daily-table th.num, .biz-daily-table td.num { width: 16.5%; padding-inline-start: 4px; }
.biz-daily-table td.num, .biz-daily-table th.num { overflow: hidden; text-overflow: ellipsis; }
.biz-daily-table td.num.neg { color: var(--danger); }
.biz-daily-table td.num .dash { opacity: .35; }
.biz-daily-table th.num { font-size: .72rem; }
@media (max-width: 1100px) { .biz-page.has-daily .biz-layout { grid-template-columns: minmax(0, 1fr); } .biz-daily { position: static; } }
/* 0.77: زر إخفاء مربع حركة اليوم */
.biz-daily-close { font: inherit; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; margin-inline-start: 4px; }
.biz-daily-close:hover { color: var(--danger); background: var(--primary-soft); }
/* 0.77: القائمة الجانبية تكبر مع الشاشة — كانت ثابتة 264px فتبدو صغيرة بجوار صفحة ملخص واسعة على الشاشات الكبيرة */
@media (min-width: 1500px) {
    :root { --sidebar-w: 300px; }
    .nav-item { font-size: 1.04rem; padding: 10px 12px; gap: 12px; }
    .nav-group-head { font-size: 1.02rem; padding: 10px 12px; }
    .nav-group-items .nav-item { padding-inline-start: 38px; }   /* حجم الخط موحّد .95rem (القاعدة العامة) */
    .nav-icon { width: 22px; height: 22px; }
    .nav-list { padding: 6px 12px; gap: 3px; }
}
@media (min-width: 1900px) {
    :root { --sidebar-w: 336px; }
    .nav-item { font-size: 1.1rem; padding: 11px 14px; }
    .nav-group-head { font-size: 1.08rem; }
    .nav-icon { width: 24px; height: 24px; }
}
/* 0.77: صفحات التقارير المجمّعة — المنتقي بعرض مريح، والتقرير بعرض كامل بلا سحب أفقي، وطباعة بالعرض */
.page-narrow.wide { max-width: 1200px; }
.page-narrow.wide.cons-report { max-width: none; }
.cons-report .table-scroll { overflow: visible; }
.cons-report .grid { width: 100%; font-size: .9rem; }
.cons-report .grid td, .cons-report .grid th { padding: 7px 10px; }
.cons-report .grid td.num, .cons-report .grid th.num { white-space: nowrap; }
@media print {
    .cons-report { padding: 0; }
    .cons-report .grid { font-size: 9pt; }
    .cons-report .grid td, .cons-report .grid th { padding: 3px 6px; }
    .cons-report .print-only { display: block; }
}
.cons-report { page: consWide; }
@page consWide { size: A4 landscape; margin: 10mm; }

/* 0.80 (M24): كتلة «0.78: إصلاحات مراجعة التنسيق» المُلحقة هنا وُزّعت على قواعدها الأصلية (التقويم، القائمة الجانبية، الكاشير،
   الإعدادات، الترخيص، كلمة المرور، الفرز، الجوال). يبقى هنا ما ليس له قاعدة أصلية: ارتفاع موحّد للحقول وعرض القوائم في صفوف الحقول. */
/* ارتفاع موحّد لكل الحقول في النماذج (كانت بين 37 و47 بكسل في الصفحة الواحدة) */
.form :where(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]):not([type=hidden]), select),
.card :where(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]):not([type=hidden]), select),
.toolbar :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select),
.filters :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select) { height: 40px; }
.grid.lines :where(input:not([type=checkbox]):not([type=radio]), select), .btn-mini ~ :where(input, select) { height: 36px; }
.date-input .date-text { height: 40px; }
.grid.lines .date-input .date-text { height: 36px; }
/* قائمة «نوع الفاتورة» وما شابهها كانت تأخذ سدس العرض فيُقصّ النص */
.field-row .field:has(> select) { flex: 0 1 auto; min-width: 240px; }
.field-row .field.check-field { flex: 0 0 auto; }
/* مربع «شامل الضريبة» بجوار سعر البيع/الشراء في بطاقة الصنف */
.field select.inc-vat-select { margin-top: 4px; font-size: .86rem; color: var(--muted); height: 32px; padding: 0 8px; }

/* ===== 0.80: مكوّنات جولة إصلاح الواجهة ===== */
/* أيقونات SVG: محاذاة مع النص، والأيقونات الاتجاهية تنعكس في العربية (M12) */
.ico { vertical-align: -0.18em; flex-shrink: 0; }
[dir="rtl"] .ico-flip { transform: scaleX(-1); }
.btn .ico, .topbar-link .ico, .topbar-user .ico { margin-inline-end: 2px; }
/* حالة فارغة / غير موجود (M14) */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 16px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); margin: 12px 0; }
.empty-state .empty-ico { color: var(--accent, var(--primary)); opacity: .8; }
.empty-state .empty-title { font-weight: 700; color: var(--text); margin: 4px 0 0; }
.empty-state .empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
/* حوار تأكيد مركزي (حارس التعديلات، حذف المنشأة) */
.modal-backdrop { z-index: 80; }
.confirm-modal { position: fixed; z-index: 81; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg, 0 14px 40px rgba(0,0,0,.25)); padding: 18px 20px; margin: 0; }
.confirm-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 12px; }
.drawer-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--warn-soft); color: var(--warn-text); border-bottom: 1px solid var(--warn-line); }
.drawer-more > summary { cursor: pointer; color: var(--primary); font-weight: 600; margin: 6px 0 10px; }
/* قائمة المستخدم في الشريط العلوي (M15) */
.user-wrap { position: relative; }
.topbar-user { background: none; border: 0; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 6px; color: var(--text); }
.topbar-user:hover { background: var(--primary-soft); }
.user-panel { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 91; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.2)); padding: 6px; display: flex; flex-direction: column; }
.user-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: start; width: 100%; text-decoration: none; }
.user-item:hover, .user-item:focus-visible { background: var(--primary-soft); color: var(--primary); }
.inline-form { display: contents; margin: 0; }
/* حقل التاريخ غير الصالح (H4) */
.date-input.invalid .date-text { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.date-error { display: block; color: var(--danger-text, var(--danger)); font-size: .78rem; margin-top: 3px; }
/* شريط مسودة محفوظة بعد انتهاء الجلسة (H5) */
.draft-bar { position: fixed; z-index: 95; bottom: 12px; inset-inline-start: 12px; max-width: min(560px, calc(100vw - 24px)); max-height: 60vh; overflow: auto; background: var(--warn-soft); color: var(--warn-text); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.2)); display: flex; gap: 10px; align-items: flex-start; }
.draft-bar details { flex: 1; } .draft-bar summary { cursor: pointer; font-weight: 600; }
.draft-bar table { margin-top: 8px; background: var(--surface); color: var(--text); }
/* الكاشير على الشاشات الضيقة: شريط سفلي ثابت للسلة والدفع (M18) */
.pos-cartbar { display: none; }
@media (max-width: 800px) {
    .pos-cartbar { display: flex; position: fixed; z-index: 30; inset-inline: 0; bottom: 0; align-items: center; gap: 10px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(0,0,0,.12); }
    .pos-cartbar .mono { flex: 1; font-weight: 700; font-size: 1.1rem; text-align: center; }
    .pos-cartbar .btn-primary { padding: 10px 18px; }
    .pos-cart { scroll-margin-top: 8px; }
}
/* أحجام مساعدة بدل style="width:…" المضمّنة */
/* 0.85: صف جزء من التسديد المجزّأ: الطريقة + الحساب + المبلغ + حذف */
.split-part { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .split-part > select { flex: 0 0 auto; width: auto; min-width: 110px; } .split-part > .ss { flex: 1 1 150px; min-width: 130px; } .split-part > input.num { flex: 0 0 110px; }
.w-110 { width: 110px; } .w-130 { width: 130px; } .mw-420 { max-width: 420px; }
/* احترام تقليل الحركة (L9): القائمة المنزلقة، الدوّار، شريط الاستيراد، الحركات العامة */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .reconnect-modal.components-reconnect-show { animation: rcDelay 1.6s steps(1, end) both !important; }   /* التأخير ليس حركة — يبقى */
}
@media print { .pos-cartbar, .draft-bar, .confirm-modal, .modal-backdrop { display: none !important; } }
/* 0.80 (L5): زر الفرز داخل رأس العمود يرث مظهر العنوان */
.grid th.sortable .sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; font: inherit; color: inherit; }
.grid th.sortable .sort-btn:focus-visible { outline: 2px solid var(--accent, var(--primary)); outline-offset: 2px; border-radius: 4px; }
.grid th.num.sortable .sort-btn { justify-content: flex-end; }
/* 0.80 (M17): صندوق تنبيه بلون التحذير من رموز الثيم — بديل للأنماط المضمّنة الفاتحة الثابتة (مثل Zatca.razor) */
.notice-warn { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-text); border-radius: var(--radius-sm, 8px); padding: 10px 14px; }
/* 0.80 (M14): هيكل التحميل في بوابة الصلاحيات (AuthGate) بدل الصفحة الفارغة */
.gate-skeleton { padding: 24px 16px; display: grid; gap: 12px; max-width: 900px; }
.gate-skeleton .sk { background: color-mix(in srgb, var(--muted, #888) 18%, transparent); border-radius: 8px; animation: sk-pulse 1.2s ease-in-out infinite; }
.gate-skeleton .sk-title { height: 28px; width: 40%; }
.gate-skeleton .sk-line { height: 14px; width: 80%; }
.gate-skeleton .sk-line.short { width: 55%; }
.gate-skeleton .sk-block { height: 180px; width: 100%; }
@keyframes sk-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gate-skeleton .sk { animation: none; } }
/* 0.79: مهام ما بعد التحديث (الإعدادات) */
.put-list { display: grid; gap: 8px; margin: 8px 0 14px; }
.put-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: var(--surface); }
.put-item.pending { border-inline-start: 4px solid var(--warn, #b7791f); }
.put-text { flex: 1 1 320px; min-width: 0; }
.put-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* 0.86: حقل الطرف (عميل/مورد) تحت حساب الذمم في سطر القيد */
.grid.lines .line-party { margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.grid.lines .line-party .search-select, .grid.lines .line-party .ss { flex: 1; min-width: 0; }

/* 0.87: تقرير اليومية */
.daily-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.daily-toolbar .seg { display: inline-flex; gap: 0; }
.daily-toolbar .seg .btn { border-radius: 0; }
.daily-toolbar .seg .btn:first-child { border-start-start-radius: 999px; border-end-start-radius: 999px; }
.daily-toolbar .seg .btn:last-child { border-start-end-radius: 999px; border-end-end-radius: 999px; }
.daily-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-top: 12px; }
.daily-sec { min-width: 0; overflow-x: auto; }
.daily-sec h2 { margin-top: 0; font-size: 1.05rem; }
.daily-sec h3.sub { margin: 12px 0 6px; font-size: .95rem; }
.daily-sec table.grid { width: 100%; }
.daily-result { grid-column: 1 / -1; }
.card-feature { border-inline-start: 4px solid var(--accent, #c9a14a); }
@media (max-width: 900px) { .daily-grid { grid-template-columns: 1fr; } }
@media print { .daily-grid { display: block; } .daily-sec { break-inside: avoid; margin-bottom: 10px; } }

/* 0.87: شريط تصفية كشوف الحسابات */
.ledger-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 8px 0; }
.ledger-filter input[type=search] { min-width: 220px; }
.ledger-filter input.amt { width: 110px; }
.ledger-filter .flt-note { flex-basis: 100%; }

/* 0.87: جدول فواتير الاشتراكات لمالك البرنامج */
.vendor-inv { margin-top: 18px; }
.vendor-inv-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.vendor-inv-head h2 { margin: 0; font-size: 1.1rem; display: flex; gap: 6px; align-items: center; }
.vendor-inv-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vendor-inv-tools .seg { display: inline-flex; }
.vendor-inv-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.vendor-inv-totals > div { background: var(--surface-2, rgba(0,0,0,.03)); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.vendor-inv-totals .k { font-size: .8rem; color: var(--muted); }
.vendor-inv-totals .v { font-size: 1.1rem; font-weight: 700; }
.vendor-inv-scroll { overflow-x: auto; }
@media (max-width: 700px) { .vendor-inv-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 0.87: موازنة جهاز الشبكة عند إغلاق الوردية */
.pos-slip { border: 1px dashed var(--border, rgba(0,0,0,.15)); border-radius: 12px; padding: 10px 12px; margin: 8px 0 12px; }
.pos-slip-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.pos-slip .attachments { margin-top: 6px; }

/* 0.87: بطاقة «تمت العملية بنجاح» الواضحة */
.ok-pop { position: fixed; top: 18px; inset-inline: 0; margin-inline: auto; width: min(520px, calc(100vw - 32px)); z-index: 9999;
    display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px;
    background: var(--surface, #fff); color: var(--text, #1c2a3a); border: 2px solid var(--success, #1f8a4c);
    box-shadow: 0 18px 48px rgba(0,0,0,.22); transform: translateY(-140%); opacity: 0; pointer-events: none;
    transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .25s; }
.ok-pop.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.ok-pop-ico { flex: 0 0 52px; width: 52px; height: 52px; }
.ok-pop-ico svg { width: 52px; height: 52px; fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.ok-pop-ico circle { stroke: var(--success, #1f8a4c); fill: color-mix(in srgb, var(--success, #1f8a4c) 14%, transparent); }
.ok-pop-ico path { stroke: var(--success, #1f8a4c); stroke-dasharray: 40; stroke-dashoffset: 40; }
.ok-pop.show .ok-pop-ico path { animation: okDraw .5s .15s ease-out forwards; }
@keyframes okDraw { to { stroke-dashoffset: 0; } }
.ok-pop-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ok-pop-title { font-size: 1.15rem; color: var(--success, #1f8a4c); }
.ok-pop-text { color: var(--muted, #5b6675); font-size: .95rem; overflow-wrap: anywhere; }
.ok-pop-x { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted, #5b6675); padding: 0 4px; }
@media (prefers-reduced-motion: reduce) { .ok-pop { transition: opacity .2s; transform: none; } .ok-pop.show .ok-pop-ico path { animation: none; stroke-dashoffset: 0; } }
@media print { .ok-pop { display: none !important; } }
.inv-biz-legal { opacity: .85; margin-top: 1px; }

/* ---------- 0.88: ملصقات الباركود حسب القالب (LabelSheet) ---------- */
.lbl-wrap { margin: 0 auto; }
.lbl-roll .lbl-page { display: flex; flex-wrap: wrap; gap: 4mm; justify-content: center; }
.lbl-sheet .lbl-page { justify-content: center; margin: 0 auto 6mm; width: max-content; }
.lblx { box-sizing: border-box; padding: 1mm 1.5mm; overflow: hidden; display: flex; flex-direction: column; justify-content: center; text-align: center; line-height: 1.15; background: #fff; color: #000; border: 1px dashed #bbb; color-scheme: light; }
.lblx-biz { font-size: .8em; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lblx-name { font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lblx-name-en { font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lblx-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lblx-price { font-weight: 800; font-size: 1.15em; }
.lblx-bars { margin-top: .6mm; }
.lblx-digits { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; letter-spacing: .4px; }
.lblx-meta { font-size: .8em; }
.lbl-preview .lblx { box-shadow: 0 1px 6px rgba(0,0,0,.18); border-style: solid; }
.lbl-designer { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 18px; align-items: start; }
.lbl-designer .lbl-preview-box { background: var(--surface-2, #f4f4f4); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow: auto; min-height: 160px; }
@media (max-width: 860px) { .lbl-designer { grid-template-columns: 1fr; } }
@media print {
    .lblx { border: none !important; box-shadow: none !important; }
    .lbl-roll .lbl-page { display: block; }
    .lbl-roll .lblx { break-after: page; page-break-after: always; margin: 0; }
    .lbl-roll .lblx:last-child { break-after: auto; page-break-after: auto; }
    .lbl-sheet .lbl-page { break-after: page; page-break-after: always; margin: 0; }
    .lbl-sheet .lbl-page:last-child { break-after: auto; page-break-after: auto; }
}

/* 0.89: عنوان الدخول الخاص — صفحة دخول باسم المشترك وحقل الاسم.النطاق */
.login-tenant { flex-direction: column; gap: 6px; text-align: center; }
.login-tenant .biz-logo-lg { height: 64px; max-width: 200px; }
.login-tenant .biz-initial.biz-logo-lg { width: 60px; height: 60px; font-size: 1.6rem; }
.login-tenant-name { font-size: 1.15rem; font-weight: 700; }
.sub-input { display: flex; align-items: center; gap: 4px; }
.sub-input input { flex: 1; min-width: 0; text-align: left; }
.sub-input .muted { white-space: nowrap; font-size: .9rem; }

/* 0.89: صف العميل في الكاشير — الاختيار + زر عميل جديد */
.cart-customer-row { display: flex; align-items: center; gap: 6px; margin: 8px 12px; }
.cart-customer-row .cart-customer, .cart-customer-row .ss.cart-customer { margin: 0; width: auto; flex: 1 1 auto; min-width: 0; }

/* 0.89 (مراجعة): جدول فواتير الاشتراكات — كان النص يتكسّر حرفًا حرفًا في عمودي العميل والبيان؛ الآن يتسع الجدول للبطاقة:
   الأرقام والتواريخ في سطر واحد، والعميل والبيان يلتفّان على الكلمات، والتمرير الأفقي عند الضيق الشديد فقط */
.vendor-inv-scroll table { table-layout: auto; width: 100%; }
.vendor-inv-scroll th, .vendor-inv-scroll td { white-space: nowrap; vertical-align: top; }
.vendor-inv-scroll td:nth-child(3), .vendor-inv-scroll th:nth-child(3) { white-space: normal; min-width: 150px; word-break: keep-all; overflow-wrap: normal; }
.vendor-inv-scroll td:nth-child(4), .vendor-inv-scroll th:nth-child(4) { white-space: normal; min-width: 200px; word-break: keep-all; overflow-wrap: normal; font-size: .85rem; }
.vendor-inv-scroll td:nth-child(8) { white-space: normal; min-width: 70px; }
