/* ═══════════════════════════════════════════════════════
   SearchDialog — search-dialog.css
   الـ shell يملأ الـ dialog كاملاً بـ flex column
   header ثابت + body يسكرول + footer ثابت
   ═══════════════════════════════════════════════════════ */

.sp-shell {
    --or:  var(--fs-primary);
    --or2: var(--fs-primary-hover-3);
    --orb: var(--fs-tint-1);
    --orl: var(--fs-tint-4);
    --txt: #1c2434;
    --mut: #64748b;
    --ln:  #e4e8f0;
    --ln2: #c8d0de;
    --wh:  #ffffff;
    --bg:  #f8fafc;
    --rs:  6px;
    --fnt: 'Tajawal','Segoe UI',Tahoma,sans-serif;

    font-family: var(--fnt);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ══ HEADER ══ */
.sp-head {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 10px;
    background: var(--orb);
    border-bottom: 1.5px solid var(--orl);
}

.sp-head-top {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sp-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--wh);
    border: 1px solid var(--orl);
    color: var(--mut);
    white-space: nowrap;
}

.sp-badge b           { color: var(--or2); font-weight: 800; }
.sp-badge-sel         { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.sp-badge-loading     { color: var(--or2); }

.sp-spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid var(--orl);
    border-top-color: var(--or);
    border-radius: 50%;
    animation: sp-spin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ── Search ── */
.sp-search-box {
    display: flex;
    align-items: center;
    background: var(--wh);
    border: 1.5px solid var(--orl);
    border-radius: var(--rs);
    height: 34px;
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s;
}

.sp-search-box:focus-within {
    border-color: var(--or);
    box-shadow: 0 0 0 2.5px rgba(var(--fs-primary-rgb),.18);
}

.sp-search-ico {
    flex-shrink: 0;
    margin: 0 8px;
    color: var(--or);
}

.sp-search {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 12.5px;
    font-family: var(--fnt);
    color: var(--txt);
    height: 100%;
    padding: 0;
    min-width: 0;
}

.sp-search::placeholder { color: var(--fs-primary-soft-3); font-size: 12px; }

.sp-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--mut);
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background .13s, color .13s;
    margin-inline-end: 2px;
}

.sp-clear:hover { background: var(--orl); color: var(--or2); }

/* ══ BODY ══ */
.sp-body {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    background: var(--wh);
}

/* ── Radzen grid overrides ── */
.sp-shell .rz-datatable,
.sp-shell .rz-data-grid {
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
}

.sp-shell .rz-datatable-thead th {
    background: linear-gradient(180deg,#f8fafc,#eef2f9) !important;
    border-bottom: 2px solid var(--orl) !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    letter-spacing: .4px !important;
    padding: 7px 10px !important;
    position: sticky;
    top: 0;
    z-index: 5;
    white-space: nowrap;
}

.sp-shell .rz-data-row td {
    font-size: 12.5px !important;
    padding: 7px 10px !important;
    border-bottom: 1px solid #f0f4f9 !important;
    color: var(--txt) !important;
    vertical-align: middle !important;
    cursor: pointer;
    transition: background .1s;
}

.sp-shell .rz-data-row:nth-child(even) td { background: #fafbfe; }
.sp-shell .rz-data-row:hover td           { background: var(--orb) !important; }

.sp-shell .sp-sel-row td {
    background: var(--fs-tint-7) !important;
    border-bottom-color: var(--orl) !important;
    font-weight: 700 !important;
}

.sp-shell .sp-sel-row td:first-child {
    box-shadow: inset 3px 0 0 var(--or);
}

/* ── Scrollbar ── */
.sp-body ::-webkit-scrollbar       { width: 5px; height: 5px; }
.sp-body ::-webkit-scrollbar-thumb { background: var(--or); border-radius: 4px; }
.sp-body ::-webkit-scrollbar-track { background: var(--orb); }

/* ── Empty state ── */
.sp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 20px;
    color: var(--mut);
    font-size: 13px;
}

/* ══ FOOTER ══ */
.sp-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg);
    border-top: 1.5px solid var(--ln);
}

.sp-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 34px;
    padding: 0 16px;
    border-radius: var(--rs);
    font-size: 12.5px;
    font-weight: 700;
    font-family: var(--fnt);
    cursor: pointer;
    transition: all .15s;
    border: 1.5px solid;
    white-space: nowrap;
}

.sp-btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.sp-btn-cancel { background: var(--wh); border-color: var(--ln2); color: var(--mut); }
.sp-btn-cancel:hover { background: #fde8e8; border-color: #fca5a5; color: #c81e1e; }

.sp-btn-ok {
    background: var(--or);
    border-color: var(--or2);
    color: #fff;
    min-width: 90px;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(var(--fs-primary-rgb),.3);
}

.sp-btn-ok:hover:not(:disabled) {
    background: var(--or2);
    box-shadow: 0 3px 10px rgba(var(--fs-primary-rgb),.45);
    transform: translateY(-1px);
}

/* ══ Mobile ══ */
@media (max-width: 600px) {
    .sp-foot { flex-wrap: wrap; }
    .sp-btn  { flex: 1; justify-content: center; }
}


/* ═══════════════════════════════════════════════════════
   order-search.css — يُضاف إلى App.razor بعد search-dialog.css
   يغطي فقط العناصر الإضافية الخاصة بـ OrderPageSearch
   ═══════════════════════════════════════════════════════ */

/* ── Toolbar row ── */
.op-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Date range input ── */
.op-date-wrap {
    display: flex;
    align-items: center;
    background: var(--wh);
    border: 1.5px solid var(--orl);
    border-radius: var(--rs);
    height: 34px;
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s;
    flex-shrink: 0;
    min-width: 220px;
}

    .op-date-wrap:focus-within {
        border-color: var(--or);
        box-shadow: 0 0 0 2.5px rgba(var(--fs-primary-rgb),.18);
    }

.op-date-ico {
    flex-shrink: 0;
    margin: 0 8px;
    color: var(--or);
}

.op-date-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 12.5px;
    font-family: var(--fnt, 'Tajawal','Segoe UI',Tahoma,sans-serif);
    color: var(--txt);
    height: 100%;
    padding: 0 8px 0 0;
    min-width: 0;
    cursor: pointer;
}

/* ── Search button ── */
.op-search-btn {
    flex-shrink: 0;
    min-width: 100px;
}

/* ── Quick filter — يمتد لملء المساحة المتبقية ── */
.op-filter-wrap {
    flex: 1;
    min-width: 160px;
    max-width: 280px;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .op-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .op-date-wrap,
    .op-filter-wrap,
    .op-search-btn {
        width: 100%;
        max-width: 100%;
        min-width: unset;
    }
}

/* ═══════════════════════════════════════════════════════
   account-page.css — أضفه بعد search-dialog.css في App.razor
   زر "Clear selection" الإضافي فقط
   ═══════════════════════════════════════════════════════ */

.sp-clear-sel {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #fde8e8;
    border: 1px solid #fca5a5;
    color: #c81e1e;
    cursor: pointer;
    transition: background .13s, border-color .13s;
    white-space: nowrap;
    font-family: var(--fnt, 'Tajawal','Segoe UI',Tahoma,sans-serif);
}

    .sp-clear-sel:hover {
        background: #fbd5d5;
        border-color: #f87171;
    }

.rz-dialog-mask {
    z-index: 200000 !important;
}

.rz-dialog-wrapper {
    z-index: 200001 !important;
}

.rz-dialog {
    z-index: 200002 !important;
}

/* ═══════════════════════════════════════════════════════
   أضف في نهاية search-dialog.css
   يصلح ظهور الكالندر خلف الـ dialog
   ═══════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════
   أضف في نهاية search-dialog.css
   ═══════════════════════════════════════════════════════ */

/* الكالندر داخل الـ dialog wrapper */
.rz-dialog-wrapper .daterangepicker {
    z-index: 210000 !important;
    position: absolute !important;
}

/* fallback — لو مش شغال parentEl */
.daterangepicker {
    z-index: 210000 !important;
}


/* ═══════════════════════════════════════════════════════
   أضف في نهاية search-dialog.css
   ألوان الـ grid داخل sp-shell — header + rows + footer
   ═══════════════════════════════════════════════════════ */

/* ── Header ── */
.sp-shell .rz-datatable-thead th {
    background: linear-gradient(180deg, #f8fafc, #eef2f9) !important;
    border-bottom: 2px solid var(--orl) !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    letter-spacing: .4px !important;
    padding: 7px 10px !important;
    white-space: nowrap;
}

/* ── Rows ── */
.sp-shell .rz-data-row td {
    font-size: 12.5px !important;
    padding: 7px 10px !important;
    border-bottom: 1px solid #f0f4f9 !important;
    color: var(--txt) !important;
    vertical-align: middle !important;
    cursor: pointer;
    transition: background .1s;
}

.sp-shell .rz-data-row:nth-child(even) td {
    background: #fafbfe;
}

.sp-shell .rz-data-row:hover td {
    background: var(--orb) !important;
}

/* ── Selected row ── */
.sp-shell .sp-sel-row td {
    background: var(--fs-tint-7) !important;
    border-bottom-color: var(--orl) !important;
    font-weight: 700 !important;
}

    .sp-shell .sp-sel-row td:first-child {
        box-shadow: inset 3px 0 0 var(--or);
    }

/* ── Footer totals row ── */
.sp-shell .rz-datatable-tfoot td,
.sp-shell .rz-grid-table tfoot td {
    background: linear-gradient(180deg, var(--fs-tint-7), var(--fs-tint-8)) !important;
    border-top: 2px solid var(--or) !important;
    font-weight: 800 !important;
    font-size: 12px !important;
    color: #7c3900 !important;
    padding: 6px 10px !important;
}

/* ── Scrollbar ── */
.sp-body ::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.sp-body ::-webkit-scrollbar-thumb {
    background: var(--or);
    border-radius: 4px;
}

.sp-body ::-webkit-scrollbar-track {
    background: var(--orb);
}

/* ── Radio items ── */
.price-radio-erp .dxbl-radiogroup-item,
.price-radio-erp .dxbl-radio-group-item {
    gap: 4px !important;
}

/* ── Label text ── */
.price-radio-erp label,
.price-radio-erp .dxbl-text {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: var(--fs-primary-ink-2) !important;
    font-family: 'Tajawal','Segoe UI',Tahoma,sans-serif !important;
    cursor: pointer !important;
    transition: color .15s !important;
}

/* ── Radio circle — unchecked ── */
.price-radio-erp .dxbl-radio input[type="radio"],
.price-radio-erp input[type="radio"] {
    accent-color: var(--fs-primary) !important;
    width: 15px !important;
    height: 15px !important;
    cursor: pointer !important;
}

/* ── Checked state — highlight label ── */
.price-radio-erp .dxbl-radiogroup-item:has(input:checked) label,
.price-radio-erp .dxbl-radio-group-item:has(input:checked) label,
.price-radio-erp .dxbl-radiogroup-item:has(input:checked) .dxbl-text,
.price-radio-erp input:checked + label {
    color: var(--fs-primary) !important;
}

/* ── ReadOnly ── */
.price-radio-erp.dxbl-disabled label,
.price-radio-erp.dxbl-disabled .dxbl-text {
    color: #c8d0de !important;
    cursor: not-allowed !important;
}



/* ══════════════════════════════════════════════════════════════════════
   اختيار العميل/المورد على الموبيل (CustSuppSearchDialog): كروت بدل الجدول
   ▸ ضغطة على الكارت = اختيار وقفل، فزرار «تأكيد» ملوش لازمة هنا
   ▸ الديسكتوب: الكروت مخفية والجدول زى ما هو
   ══════════════════════════════════════════════════════════════════════ */
.sp-cards { display: none; }
@media (max-width: 768px) {
    .sp-shell:has(.sp-cards) .sp-body > :not(.sp-cards) { display: none !important; }
    .sp-shell:has(.sp-cards) .sp-foot { display: none !important; }
    .sp-cards {
        display: block;
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 4px 2px 12px;
    }
    .sp-card {
        display: flex;
        align-items: center;
        gap: 12px;
        width: calc(100% - 8px);
        height: 62px;
        margin: 4px;
        padding: 0 12px;
        border: 1px solid var(--fs-tint-5);
        border-radius: 12px;
        background: #fff;
        text-align: start;
        font-family: inherit;
        cursor: pointer;
    }
    .sp-card:active { background: var(--fs-tint-1); border-color: rgba(var(--fs-primary-rgb), .5); }
    .sp-av {
        flex: 0 0 40px; height: 40px; border-radius: 50%;
        display: grid; place-items: center;
        background: rgba(var(--fs-primary-rgb), .1); color: var(--fs-primary);
        font-weight: 800; font-size: 15px;
    }
    .sp-cb { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
    .sp-cn { font-weight: 700; font-size: 15px; color: #04252D; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sp-cs { display: flex; gap: 12px; font-size: 12.5px; color: #6B8A91; white-space: nowrap; overflow: hidden; }
    .sp-cs i { color: #9AB3B9; margin-inline-end: 3px; }
    .sp-cbal { margin-inline-start: auto; font-weight: 700; color: #04252D; }
    .sp-cbal.neg { color: #C62828; }
    .sp-cchev { color: #9AB3B9; font-size: 18px; }
    [dir="ltr"] .sp-cchev { transform: scaleX(-1); }
}

/* قاعدة فاضية تمتص أى بقايا تعليق قبلها */
.mc-css-guard {}

/* ══════════════════════════════════════════════════════════════════════
   نوافذ الاختيار — الشكل الجديد (Cards=true، فاتورة المبيعات) 2026-11-08
   كمية الفروع · الوحدات · فتح فاتورة · مركز التكلفة
   ▸ موبيل: كروت (.mc-list) بدل الجدول — الجدول بيستخبى
   ▸ ديسكتوب: الجدول زى ما هو + ملخّص/فترات سريعة، والنافذة على قد المحتوى (CssClass mc-dialog)
   ══════════════════════════════════════════════════════════════════════ */
.mc-list { display: none; }
@media (max-width: 768px) {
    .sp-shell.mc-cards .sp-body { display: none !important; }
    .sp-shell.mc-cards .sp-foot .sp-btn-ok { display: none !important; }
    .sp-shell.mc-cards .sp-badge-sel { display: none !important; }
    .sp-shell.mc-cards .mc-list { display: block; flex: 1 1 auto; overflow-y: auto; padding: 4px 12px 8px; -webkit-overflow-scrolling: touch; }
}
.mc-row {
    display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 8px; padding: 11px 12px;
    border: 1px solid #E3ECEF; border-radius: 12px; background: #fff; font-family: inherit; text-align: start; color: #04252D;
}
button.mc-row { cursor: pointer; }
.mc-row.is-sel { border-color: var(--fs-primary); background: var(--fs-tint-1); box-shadow: 0 0 0 3px rgba(var(--fs-primary-rgb), .08); }
.mc-radio { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #C5D6DB; }
.mc-row.is-sel .mc-radio { border: 7px solid var(--fs-primary); }
.mc-ic { flex: 0 0 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--fs-tint-2); color: var(--fs-primary); font-size: 19px; }
.mc-ic-sn { flex-basis: 48px; font-size: 13px; font-weight: 800; }
.mc-b { flex: 1; min-width: 0; }
.mc-b b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-b small { display: block; font-size: 12px; color: #6B8A91; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-b small em { font-style: normal; }
.mc-num { flex: 0 0 auto; text-align: end; font-weight: 800; font-size: 15px; white-space: nowrap; }
.mc-num small { display: block; font-size: 10.5px; color: #6B8A91; font-weight: 600; }
.mc-num-2 { font-size: 13px; color: #6B8A91; }
.mc-num.is-ok { color: #0E7C66; font-size: 18px; }
.mc-num.is-bad { color: #B91C1C; font-size: 18px; }
.is-warn, .mc-b small .is-warn { color: #B45309; font-weight: 700; }
.mc-pill { display: inline-block; margin-inline-start: 4px; padding: 0 7px; border-radius: 20px; background: #ECFDF5; color: #0E7C66; font-size: 11px; font-weight: 800; }
.mc-pill.is-credit { background: #FEF2F2; color: #B91C1C; }
.mc-none { text-align: center; color: #8AA3AA; padding: 24px 0; }

/* ملخّص كمية الفروع (موبيل وديسكتوب) */
.mc-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px 12px 4px; }
.mc-kpis > div { background: #F7FAFB; border-radius: 12px; padding: 8px 10px; text-align: center; }
.mc-kpis span { display: block; font-size: 11.5px; color: #6B8A91; font-weight: 700; }
.mc-kpis b { display: block; font-size: 19px; color: #04252D; }
.mc-kpis .is-warn b { color: #B45309; }

/* فترات سريعة + الإجمالى (فتح فاتورة) */
.mc-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px 6px; }
.mc-presets button {
    border: 1px solid #E3ECEF; border-radius: 20px; background: #fff; color: #6B8A91;
    padding: 5px 12px; font-family: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer;
}
.mc-presets button.on { background: var(--fs-primary); border-color: var(--fs-primary); color: #fff; }
.mc-presets-sum { margin-inline-start: auto; font-size: 12.5px; color: #6B8A91; }
.mc-presets-sum b { color: #04252D; font-size: 14px; }

/* ديسكتوب: النافذة على قد المحتوى بدل الطول الثابت */
@media (min-width: 769px) {
    .mc-dialog .sp-shell { height: auto !important; max-height: 72vh; }
    .mc-dialog .sp-body { height: auto !important; max-height: calc(72vh - 200px); min-height: 110px; }
}
/* الاسم والتفاصيل يلفّوا على سطرين بدل ما يتقصوا (أسماء مراكز التكلفة الطويلة، التكلفة فى الوحدات) */
.mc-b b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mc-b small { white-space: normal; }
