﻿@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;600;700&display=swap');

/* ─── Design tokens ─── */
:root {
    --bg: #f0f2f5;
    --white: #ffffff;
    --line: #e4e8f0;
    --line2: #c8d0de;
    --txt: #1c2434;
    --muted: #64748b;
    --blue: #1a56db;
    --bluebg: #eff4ff;
    --bluebd: #bfdbfe;
    --green: #057a55;
    --greenbg: #def7ec;
    --greenbd: #84e1bc;
    --red: #c81e1e;
    --redbg: #fde8e8;
    --redbd: #f8b4b4;
    --amber: var(--fs-primary-ink-2);
    --amberbg: #fef3c7;
    --amberbd: #fcd34d;
    --purple: #5521b5;
    --purplebg: #edebfe;
    --purplebd: #c4b5fd;
    --r: 8px;
    --rs: 5px;
    --sh: 0 1px 3px rgba(0,0,0,.06);
    --ih: 34px;
    --bh: 34px;
    --fnt: 'Tajawal','Segoe UI',Tahoma,sans-serif;
}

/* ─── Page shell ─── */
.rinv-page {
    font-family: var(--fnt);
    background: var(--bg);
    color: var(--txt);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    padding: 6px;
    gap: 5px;
    overflow: hidden;
}

/* ═══════════════ 1. HEADER BAR ═══════════════ */
.rinv-hdr {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 0 14px;
    box-shadow: var(--sh);
}

.rinv-hdr-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--blue);
}

    .rinv-hdr-title::before {
        content: '';
        width: 4px;
        height: 20px;
        background: var(--blue);
        border-radius: 2px;
        flex-shrink: 0;
    }

/* ═══════════════════════════════════════════════════
   2. FORM PANEL + COLLAPSE
   ═══════════════════════════════════════════════════ */
.rinv-form {
    flex-shrink: 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh);
    overflow: hidden; /* desktop: يحافظ على border-radius */
}

.rinv-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    height: 30px;
    background: #fff !important;
    border: 1px solid #e4e8f0 !important;
    border-top: 3px solid var(--fs-primary) !important;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    gap: 8px;
}

    .rinv-form-header:hover {
        background: linear-gradient(180deg, #f0f5ff, #e8f0fe);
    }

.rinv-form-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--fs-primary-ink-2) !important;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

    .rinv-form-header-title::before {
        content: '';
        width: 3px;
        height: 13px;
        background: var(--fs-primary) !important;
        border-radius: 2px;
        flex-shrink: 0;
    }

.rinv-form-summary {
    display: none;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.rinv-form-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--fs-tint-4) !important;
    background: var(--fs-tint-1) !important;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

    .rinv-form-summary-chip .s-lbl {
        color: #64748b !important;
        font-weight: 500;
    }

    .rinv-form-summary-chip .s-val {
        color: var(--fs-primary-ink-3) !important;
        font-weight: 700;
    }

    .rinv-form-summary-chip.s-red .s-val {
        color: var(--red);
    }

    .rinv-form-summary-chip.s-green .s-val {
        color: var(--green);
    }

.rinv-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--rs);
    border: 1px solid var(--fs-tint-4) !important;
    background: var(--fs-tint-1) !important;
    cursor: pointer;
    color: var(--fs-primary) !important;
    font-size: 11px;
    transition: all .2s;
    flex-shrink: 0;
}

    .rinv-collapse-btn:hover {
        background: var(--fs-primary) !important;
        color: #fff !important;
        border-color: var(--fs-primary) !important;
    }

.rinv-collapse-icon {
    display: inline-block;
    transition: transform .28s ease;
    line-height: 1;
}

.rinv-form-body {
    max-height: 300px;
    overflow: hidden;
    transition: max-height .32s cubic-bezier(.4,0,.2,1), opacity .25s ease;
    opacity: 1;
}

.rinv-form.is-collapsed .rinv-form-body {
    max-height: 0 !important;
    opacity: 0;
}

.rinv-form.is-collapsed .rinv-collapse-icon {
    transform: rotate(180deg);
}

.rinv-form.is-collapsed .rinv-form-summary {
    display: flex;
}

.rinv-form.is-collapsed .rinv-form-header-title {
    display: none;
}

/* ── الجوال: is-collapsed يخفي بشكل قاطع ── */
@media (max-width: 768px) {
    .rinv-form.is-collapsed .rinv-form-body {
        display: none !important;
        max-height: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .rinv-form.is-collapsed .rinv-form-summary {
        display: flex !important;
    }

    .rinv-form.is-collapsed .rinv-form-header-title {
        display: none !important;
    }

    .rinv-form.is-collapsed .rinv-collapse-icon {
        transform: rotate(180deg) !important;
    }
}

/* ── صفوف الفورم ── */
.rinv-row,
.rinv-row-b {
    display: grid;
    grid-template-columns: 200px 100px 120px 160px 350px 1fr;
    min-height: 52px;
    overflow: hidden;
}

.rinv-row {
    border-bottom: 1px solid var(--line);
}

/* Customer Name spans first 3 columns so Mobile/SalesMan/Notes
   align exactly under Date / CostCenter / VAT columns */
.rinv-row-b .rinv-cell:has(.f-cu) {
    grid-column: span 3;
}

.rinv-row:last-child,
.rinv-row-b {
    border-bottom: none;
}

.rinv-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5px 10px;
    border-inline-end: 1px solid var(--line);
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}

    .rinv-cell:last-child {
        border-inline-end: none;
    }

[dir=rtl] .rinv-cell {
    border-inline-end: none;
    border-inline-start: 1px solid var(--line);
}

    [dir=rtl] .rinv-cell:last-child {
        border-inline-start: none;
    }

.rinv-cell-fill {
    grid-column: span 2;
    border-inline-end: none;
}

[dir=rtl] .rinv-cell-fill {
    border-inline-start: none;
}

.rinv-cell-extra {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: max-content;
}

.rinv-lbl {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    line-height: 1;
    flex-shrink: 0;
}

.rinv-cell-extra .rz-radio-group {
    display: flex !important;
    gap: 2px !important;
    flex-wrap: nowrap !important;
}

.rinv-cell-extra .rz-radio-group-item {
    margin: 0 !important;
}

    .rinv-cell-extra .rz-radio-group-item label {
        font-size: 12px !important;
        font-weight: 600 !important;
        padding: 3px 8px !important;
    }

.rinv-form .dxbl-text-edit,
.rinv-form .dxbl-spin-edit,
.rinv-form .dxbl-date-edit,
.rinv-form .dxbl-combobox {
    height: var(--ih) !important;
    min-height: var(--ih) !important;
    width: 100% !important;
    border: 1px solid var(--line2) !important;
    border-radius: var(--rs) !important;
    background: #fafbfd !important;
    box-shadow: none !important;
}

    .rinv-form .dxbl-text-edit:focus-within,
    .rinv-form .dxbl-spin-edit:focus-within,
    .rinv-form .dxbl-date-edit:focus-within,
    .rinv-form .dxbl-combobox:focus-within {
        border-color: var(--blue) !important;
        box-shadow: 0 0 0 2.5px rgba(26,86,219,.12) !important;
        background: #fff !important;
    }

.rinv-form .dxbl-text-edit-input {
    height: var(--ih) !important;
    min-height: var(--ih) !important;
    padding: 0 8px !important;
    font-size: 12.5px !important;
    font-family: var(--fnt) !important;
    width: 100% !important;
}

.rinv-form .dxbl-text-edit-buttons .dxbl-btn,
.rinv-form .dxbl-spin-edit-buttons .dxbl-btn,
.rinv-form .dxbl-date-edit-buttons .dxbl-btn,
.rinv-form .dxbl-combobox-buttons .dxbl-btn {
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

.rinv-form .dxbl-text-edit .dxbl-btn-group,
.rinv-form .dxbl-spin-edit .dxbl-btn-group,
.rinv-form .dxbl-date-edit .dxbl-btn-group,
.rinv-form .dxbl-combobox .dxbl-btn-group {
    border-inline-start: 1px solid rgba(0,0,0,.07) !important;
    background: transparent !important;
}

[dir=rtl] .rinv-form .dxbl-text-edit .dxbl-btn-group,
[dir=rtl] .rinv-form .dxbl-spin-edit .dxbl-btn-group,
[dir=rtl] .rinv-form .dxbl-date-edit .dxbl-btn-group {
    border-inline-start: none !important;
    border-inline-end: 1px solid rgba(0,0,0,.07) !important;
}

.rinv-form .f-sn .dxbl-text-edit-input {
    color: var(--red) !important;
    font-weight: 700 !important;
    text-align: center !important;
}

.rinv-form .f-cu .dxbl-text-edit-input {
    color: var(--blue) !important;
    font-weight: 600 !important;
    text-align: center !important;
}

.rinv-form .f-dc .dxbl-text-edit-input {
    text-align: center !important;
}

.rinv-form-sep {
    width: 1px;
    height: 20px;
    background: var(--line2);
    flex-shrink: 0;
}

/* ═══════════════ 3. BALANCE STRIP ═══════════════ */
.rinv-bals {
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 6px;
    min-height: 34px;
}

.rinv-bal {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 3px 11px;
    font-size: 11.5px;
    box-shadow: var(--sh);
    white-space: nowrap;
}

    .rinv-bal .bv {
        font-weight: 700;
    }

.rinv-bal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ═══════════════ 4. GRID CARD ═══════════════ */
.rinv-grid-card {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh);
    overflow: hidden !important;
}

/* ══ GRID TOOLBAR ══ */
.rinv-gtb {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: var(--fs-tint-1);
    border-bottom: 1px solid var(--fs-tint-4);
    border-inline-start: 4px solid var(--fs-primary);
    box-shadow: 0 1px 4px rgba(var(--fs-primary-rgb),.1);
    min-height: 40px;
    flex-shrink: 0;
}

.rinv-branch {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rinv-bc-wrap {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: unset !important;
    display: flex !important;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--fs-tint-4);
    border-radius: 6px;
    height: 28px;
    overflow: hidden;
    transition: all .18s;
}

    .rinv-bc-wrap:focus-within {
        border-color: var(--fs-primary);
        box-shadow: 0 0 0 2px rgba(var(--fs-primary-rgb),.18);
    }

.rinv-bc-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--fs-primary);
    font-size: 13px;
}

.rinv-bc-field {
    flex: 1 !important;
    height: 28px !important;
    min-height: 28px !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

    .rinv-bc-field .dxbl-text-edit-input {
        font-size: 12px !important;
        font-weight: 600 !important;
        color: var(--fs-primary-ink-2) !important;
        letter-spacing: .4px !important;
        height: 28px !important;
        padding: 0 8px 0 0 !important;
        background: transparent !important;
    }

        .rinv-bc-field .dxbl-text-edit-input::placeholder {
            color: var(--fs-primary-soft-3) !important;
            font-weight: 400 !important;
            font-size: 11.5px !important;
        }

    .rinv-bc-field .dxbl-text-edit-buttons .dxbl-btn,
    .rinv-bc-field .dxbl-btn-group {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

/* ── Camera / Barcode-scan button ── */
.header-barcode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(135deg, var(--fs-primary) 0%, var(--fs-primary-deep) 100%);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background .18s, box-shadow .18s, transform .1s;
    padding: 0;
}

    .header-barcode-btn:hover {
        background: linear-gradient(135deg, var(--fs-primary-deep) 0%, var(--fs-primary-deeper) 100%);
        box-shadow: 0 2px 8px rgba(var(--fs-primary-deep-rgb),.40);
    }

    .header-barcode-btn:active {
        transform: scale(.93);
    }

    .header-barcode-btn i {
        pointer-events: none;
    }

.rinv-gtb-sep {
    width: 1px;
    height: 20px;
    background: var(--fs-tint-4);
    flex-shrink: 0;
}

/* ── Toolbar buttons ── */
.rinv-tb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 28px;
    border-radius: 6px;
    font-family: var(--fnt);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0 10px;
    letter-spacing: .2px;
    border: 1.5px solid transparent;
}

    .rinv-tb i {
        font-size: 10.5px;
    }

    .rinv-tb:disabled {
        opacity: .35;
        cursor: not-allowed;
        pointer-events: none;
    }

.rinv-tb-new {
    background: var(--fs-primary);
    border-color: var(--fs-primary-hover-3);
    color: #fff;
}

    .rinv-tb-new:hover {
        background: var(--fs-primary-hover-3);
        box-shadow: 0 2px 8px rgba(var(--fs-primary-rgb),.4);
        transform: translateY(-1px);
    }

    .rinv-tb-new:active {
        transform: translateY(0);
        box-shadow: none;
    }

.rinv-tb-cols {
    background: #fff;
    border-color: var(--fs-tint-4);
    color: var(--fs-primary-ink-2);
    width: 28px;
    padding: 0;
}

    .rinv-tb-cols:hover {
        background: var(--fs-primary);
        border-color: var(--fs-primary);
        color: #fff;
    }

.rinv-tb-del {
    padding: 0 10px;
    background: #fde8e8;
    border-color: #fca5a5;
    color: #c81e1e;
}

    .rinv-tb-del:not(:disabled):hover {
        background: #fee2e2;
        border-color: #f87171;
        transform: translateY(-1px);
    }

.has-sel .rinv-tb-del {
    background: #c81e1e;
    border-color: #b91c1c;
    color: #fff;
}

    .has-sel .rinv-tb-del:hover {
        background: #b91c1c;
        box-shadow: 0 2px 8px rgba(200,30,30,.35);
    }

.rinv-tb-cnt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    background: rgba(200,30,30,.15);
    color: #c81e1e;
}

.has-sel .rinv-tb-cnt {
    background: rgba(255,255,255,.25);
    color: #fff;
}

/* ── Generic inv-btn ── */
.rinv-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: var(--bh);
    padding: 0 12px;
    border-radius: var(--rs);
    border: 1px solid;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .13s;
    font-family: var(--fnt);
}

    .rinv-btn:disabled {
        opacity: .45;
        cursor: not-allowed;
        pointer-events: none;
    }

    .rinv-btn.blue {
        background: #0f6cbd;
        border-color: var(--blue);
        color: #fff;
    }

        .rinv-btn.blue:hover {
            background: #1541b8;
        }

    .rinv-btn.dark {
        background: #1e293b;
        border-color: #1e293b;
        color: #fff;
    }

        .rinv-btn.dark:hover {
            background: #0f172a;
        }

    .rinv-btn.red {
        background: var(--redbg);
        border-color: var(--redbd);
        color: var(--red);
    }

        .rinv-btn.red:hover:not(:disabled) {
            background: #fbd5d5;
        }

    .rinv-btn.ghost {
        background: var(--white);
        border-color: var(--line2);
        color: var(--txt);
    }

        .rinv-btn.ghost:hover {
            background: var(--bg);
        }

    .rinv-btn.amber {
        background: var(--amberbg);
        border-color: var(--amberbd);
        color: var(--amber);
    }

        .rinv-btn.amber:hover {
            background: #fde68a;
        }

    .rinv-btn.green {
        background: var(--greenbg);
        border-color: var(--greenbd);
        color: var(--green);
    }

        .rinv-btn.green:hover {
            background: #bcf0da;
        }

/* ═══════════════ GRID BODY ═══════════════ */
.rinv-grid-body {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    position: relative;
}

.rinv-lp {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    overflow: hidden !important;
}

    .rinv-lp > .dxbl-loading-panel-area {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

.rinv-dg {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
}

    .rinv-dg.dxbl-grid {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow: hidden !important;
    }

/* ── Scroll containers ── */
.dxbl-scroll-viewer-content {
    direction: ltr !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
}

    .dxbl-scroll-viewer-content::-webkit-scrollbar {
        display: none !important;
    }

    .dxbl-scroll-viewer-content table {
        direction: rtl !important;
        min-width: max-content !important;
        overflow: visible !important;
    }

dxbl-virtual-scroll-viewer,
.dxbl-scroll-viewer {
    overflow: hidden !important;
    direction: ltr !important;
}

[dir=rtl] .dxbl-scroll-viewer-content {
    direction: ltr !important;
}

[dir=ltr] .dxbl-scroll-viewer-content {
    direction: ltr !important;
}

.rinv-dg .dxbl-grid-content,
.rinv-dg .dxbl-grid-scrollable,
.rinv-dg .dxbl-grid-data,
.dxbl-grid-content,
.dxbl-grid-scrollable,
.dxbl-grid-data {
    direction: ltr !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
}

    .rinv-dg .dxbl-grid-content table,
    .rinv-dg .dxbl-grid-scrollable table,
    .rinv-dg .dxbl-grid-data table,
    .dxbl-grid-content table,
    .dxbl-grid-scrollable table,
    .dxbl-grid-data table {
        direction: rtl !important;
        min-width: max-content !important;
    }

    /* ── Fix DevExpress overlay vertical scrollbar position in RTL mode ── */
    /* DevExpress JS sets style.right = _offsets.right (wrong in RTL).    */
    /* CSS !important overrides inline style → forces scrollbar to right edge */
    .rinv-dg .dxbl-scroll-viewer-vert-scroll-bar {
        right: 0 !important;
    }

    /* ── Scrollbar style ── */
    .rinv-dg .dxbl-grid-content::-webkit-scrollbar,
    .rinv-dg .dxbl-grid-scrollable::-webkit-scrollbar,
    .dxbl-grid-content::-webkit-scrollbar,
    .dxbl-grid-scrollable::-webkit-scrollbar {
        height: 8px !important;
        width: 8px !important;
    }

    .rinv-dg .dxbl-grid-content::-webkit-scrollbar-thumb,
    .rinv-dg .dxbl-grid-scrollable::-webkit-scrollbar-thumb,
    .dxbl-grid-content::-webkit-scrollbar-thumb,
    .dxbl-grid-scrollable::-webkit-scrollbar-thumb {
        background: var(--fs-primary) !important;
        border-radius: 6px !important;
        border: 2px solid var(--fs-tint-1) !important;
    }

    .rinv-dg .dxbl-grid-content::-webkit-scrollbar-track,
    .rinv-dg .dxbl-grid-scrollable::-webkit-scrollbar-track,
    .dxbl-grid-content::-webkit-scrollbar-track,
    .dxbl-grid-scrollable::-webkit-scrollbar-track {
        background: var(--fs-tint-7) !important;
        border-radius: 6px !important;
    }

/* ── Grid visual ── */
.rinv-grid-card .dxbl-grid {
    border: none !important;
    border-radius: 0 !important;
}

.rinv-grid-card .dxbl-grid-header-row th {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f9 100%) !important;
    border-bottom: none !important;
    padding: 0 !important;
    border-inline-end: 1px solid #e8eef5 !important;
}

    .rinv-grid-card .dxbl-grid-header-row th:last-child {
        border-inline-end: none !important;
    }

.rinv-grid-card .dxbl-grid-header {
    border-bottom: 2px solid var(--fs-tint-4) !important;
}

.rinv-grid-card .dxbl-grid-header-text {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    letter-spacing: .45px !important;
    padding: 7px 8px !important;
    display: block !important;
}

.rinv-grid-card .dxbl-grid-row td {
    border-bottom: 1px solid #f0f4f9 !important;
    border-inline-end: 1px solid #f0f4f9 !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    color: #1c2434 !important;
    vertical-align: middle !important;
    transition: background .1s !important;
}

    .rinv-grid-card .dxbl-grid-row td:last-child {
        border-inline-end: none !important;
    }

.rinv-grid-card .dxbl-grid-row:nth-child(even) td {
    background: #fafbfe !important;
}

.rinv-grid-card .dxbl-grid-row:hover td {
    background: var(--fs-tint-1) !important;
    cursor: pointer !important;
}

.rinv-grid-card .dxbl-grid-row:nth-child(even):hover td {
    background: var(--fs-tint-1) !important;
}

.rinv-grid-card .dxbl-grid-editing-row td {
    background: var(--fs-tint-7) !important;
    border-bottom: 1px solid var(--fs-tint-4) !important;
}

.rinv-grid-card .dxbl-grid-edit-cell {
    background: #fffaf4 !important;
    position: relative !important;
}

    .rinv-grid-card .dxbl-grid-edit-cell::after {
        content: '' !important;
        position: absolute !important;
        inset: 1px !important;
        border: 2px solid var(--fs-primary) !important;
        border-radius: 5px !important;
        pointer-events: none !important;
        z-index: 1 !important;
    }

.rinv-grid-card .dxbl-text-edit,
.rinv-grid-card .dxbl-spin-edit,
.rinv-grid-card .dxbl-date-edit {
    border: 1.5px solid var(--fs-tint-4) !important;
    border-radius: 5px !important;
    background: #fff !important;
    box-shadow: none !important;
    min-height: 26px !important;
    height: 26px !important;
}

    .rinv-grid-card .dxbl-text-edit:focus-within,
    .rinv-grid-card .dxbl-spin-edit:focus-within,
    .rinv-grid-card .dxbl-date-edit:focus-within {
        border-color: var(--fs-primary) !important;
        box-shadow: 0 0 0 2.5px rgba(var(--fs-primary-rgb),.18) !important;
        background: #fff !important;
    }

.rinv-grid-card .dxbl-text-edit-input {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #7c3900 !important;
    min-height: 26px !important;
    height: 26px !important;
    padding: 0 6px !important;
    text-align: center !important;
    direction: ltr !important;
}

.rinv-grid-card .dxbl-text-edit-buttons .dxbl-btn,
.rinv-grid-card .dxbl-spin-edit-buttons .dxbl-btn,
.rinv-grid-card .dxbl-date-edit-buttons .dxbl-btn {
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

.rinv-grid-card .dxbl-text-edit .dxbl-btn-group,
.rinv-grid-card .dxbl-spin-edit .dxbl-btn-group {
    border-inline-start: 1px solid rgba(var(--fs-primary-rgb),.3) !important;
    background: transparent !important;
}

.rinv-grid-card .dxbl-grid-select-all,
.rinv-grid-card .dxbl-grid-selection-cell {
    background: transparent !important;
}

.rinv-grid-card .dxbl-grid-row.dxbl-grid-row-selected td {
    background: var(--fs-tint-7) !important;
    border-bottom-color: var(--fs-tint-4) !important;
}

.rinv-grid-card .dxbl-grid-row.dxbl-grid-row-selected:hover td {
    background: #ffe0b2 !important;
}

/* row-light-green — set on the cell element via GridElementType.DataCell */
.rinv-grid-card .row-light-green {
    background: #f0fdf4 !important;
    box-shadow: inset 3px 0 0 #10b981 !important;
}

.rinv-grid-card .dxbl-grid-footer-row td {
    background: linear-gradient(180deg, var(--fs-tint-7), var(--fs-tint-8)) !important;
    border-top: 2px solid var(--fs-primary) !important;
    font-weight: 800 !important;
    font-size: 11.5px !important;
    color: #7c3900 !important;
    padding: 5px 8px !important;
}

.rinv-grid-card ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.rinv-grid-card ::-webkit-scrollbar-thumb {
    background: var(--fs-primary);
    border-radius: 4px;
}

.rinv-grid-card ::-webkit-scrollbar-track {
    background: var(--fs-tint-1);
}

[dir=rtl] .rinv-grid-card .dxbl-grid td,
[dir=rtl] .rinv-grid-card .dxbl-grid th,
[dir=rtl] .rinv-grid-card .dxbl-grid .dxbl-grid-header-text {
    direction: rtl !important;
}

[dir=ltr] .rinv-grid-card .dxbl-grid td,
[dir=ltr] .rinv-grid-card .dxbl-grid th,
[dir=ltr] .rinv-grid-card .dxbl-grid .dxbl-grid-header-text {
    direction: ltr !important;
    text-align: left !important;
}

[dir=ltr] .dxbl-scroll-viewer-content {
    direction: ltr !important;
}

.rinv-dg td,
.rinv-dg th {
    overflow: hidden !important;
}

.dxbl-grid-column-resize-anchor {
    position: absolute !important;
    inset-inline-end: 0 !important;
    inset-inline-start: auto !important;
}

.rinv-dg .dxbl-grid-header {
    cursor: col-resize !important;
}

.rinv-dg .dxbl-grid-column-resize-anchor {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 6px !important;
    cursor: col-resize !important;
    background: transparent !important;
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    z-index: 10 !important;
}

    .rinv-dg .dxbl-grid-column-resize-anchor:hover {
        background: var(--fs-primary) !important;
        opacity: .5 !important;
    }

.rinv-dg .dxbl-grid-header-content {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* ── inv-grid-body scrollbar ── */
.rinv-grid-body {
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: #d1d5db #f1f5f9 !important;
}

    .rinv-grid-body::-webkit-scrollbar {
        width: 6px !important;
    }

    .rinv-grid-body::-webkit-scrollbar-thumb {
        background: #d1d5db !important;
        border-radius: 4px !important;
    }

    .rinv-grid-body::-webkit-scrollbar-track {
        background: #f1f5f9 !important;
    }

/* ═══════════════ 5. FOOTER ═══════════════ */
.rinv-footer {
    flex-shrink: 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: 0 -3px 12px rgba(0,0,0,.06);
    overflow: hidden;
}

.rinv-footer-inner {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.rinv-footer-left {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    border-inline-start: 1px solid #fce8cc;
    flex-shrink: 0;
    flex-wrap: wrap;
    background: #fff;
    border-inline-end: none;
    justify-content: space-between;
}

.rinv-footer-btns {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.rinv-footer-right {
    flex: 1;
    display: grid;
    /* ✦ 8 أعمدة (Total + Disc + Disc% + Fine + Fine% + Net + VAT + NetReturn) ✦
       غرامة المرتجع + نسبة الغرامة بنفس حجم الخصم ونسبة الخصم بالظبط.
       كل العناصر فى سطر واحد بدل سطرين. */
    grid-template-columns:
        1fr        /* tc-total */
        130px      /* tc-disc (input) */
        100px      /* tc-discp (input %) */
        130px      /* tc-fine (input — same as disc) */
        100px      /* tc-finep (input % — same as discp) */
        1fr        /* tc-net */
        1fr        /* tc-vat */
        1.2fr;     /* tc-netret (الصافى — الأبرز) */
    min-width: 0;
}

.rinv-tot-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-inline-end: 1px solid var(--line);
    min-width: 0;
    text-align: center;
    min-height: 62px;
    background: #fff !important;
}

    .rinv-tot-cell:last-child {
        border-inline-end: none;
    }

.rinv-tot-lbl {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    line-height: 1;
    margin-bottom: 4px;
}

.rinv-tot-val {
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -.3px;
}

.rinv-tot-cell.tc-total .rinv-tot-lbl {
    color: #3b5bdb;
}

.rinv-tot-cell.tc-total .rinv-tot-val {
    color: #1e293b !important;
    font-size: 15px !important;
    font-weight: 800 !important;
}

.rinv-tot-cell.tc-disc .rinv-tot-lbl {
    color: #e03131;
}

.rinv-tot-cell.tc-discp .rinv-tot-lbl {
    color: #e03131;
}

/* ✦ غرامة المرتجع + نسبة الغرامة → بنفس styling الخصم بالظبط ✦ */
.rinv-tot-cell.tc-fine .rinv-tot-lbl,
.rinv-tot-cell.tc-finep .rinv-tot-lbl {
    color: #e03131;
}

.rinv-tot-cell.tc-fine .dxbl-text-edit-input,
.rinv-tot-cell.tc-finep .dxbl-text-edit-input {
    font-weight: 600 !important;
    font-size: 13px !important;
    color: #c81e1e !important;
}

.rinv-tot-cell.tc-pts .rinv-tot-lbl {
    color: #6741d9;
}

.rinv-tot-cell.tc-pts .rinv-tot-val {
    color: #1e293b !important;
    font-size: 15px !important;
    font-weight: 800 !important;
}

.rinv-tot-cell.tc-vat .rinv-tot-lbl {
    color: var(--fs-primary-hover-4);
}

.rinv-tot-cell.tc-vat .rinv-tot-val {
    color: #1e293b !important;
    font-size: 15px !important;
    font-weight: 800 !important;
}

.rinv-tot-cell.tc-net {
    background: #fff !important;
    border-inline-start: 2px solid var(--fs-primary);
    border-inline-end: none;
}

    .rinv-tot-cell.tc-net .rinv-tot-lbl {
        color: #2f9e44;
        font-size: 11px;
        font-weight: 800;
    }

    .rinv-tot-cell.tc-net .rinv-tot-val {
        color: #1a6b2e;
        font-size: 24px !important;
        font-weight: 900 !important;
        letter-spacing: -.5px;
    }

.rinv-tot-cell .dxbl-spin-edit {
    width: 120px !important;
    height: 30px !important;
    min-height: 30px !important;
    border: 2px solid var(--redbd) !important;
    border-radius: 7px !important;
    background: #fff !important;
    box-shadow: none !important;
    margin-top: 3px;
}

.rinv-tot-cell .dxbl-text-edit-input {
    text-align: center !important;
    font-weight: 900 !important;
    font-size: 15px !important;
    color: var(--red) !important;
    min-height: 28px !important;
    padding: 0 6px !important;
    letter-spacing: -.2px !important;
}

.rinv-tot-cell.tc-disc .dxbl-text-edit-input,
.rinv-tot-cell.tc-discp .dxbl-text-edit-input {
    font-weight: 600 !important;
    font-size: 13px !important;
    color: #c81e1e !important;
}

.rinv-tot-cell .dxbl-spin-edit:focus-within {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px rgba(200,30,30,.12) !important;
}

.rinv-tot-cell .dxbl-spin-edit .dxbl-btn-group,
.rinv-tot-cell .dxbl-spin-edit .dxbl-btn {
    display: none !important;
}

.rinv-profit-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    border: 1.5px solid #fce8cc;
    background: #fff;
    color: #374151;
    margin-inline-start: auto;
}

    .rinv-profit-pill.profit-positive {
        background: #f0fdf4;
        border-color: #86efac;
        color: #15803d;
    }

    .rinv-profit-pill.profit-negative {
        background: #fef2f2;
        border-color: #fca5a5;
        color: #dc2626;
    }

.rinv-footer-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 4px;
    border-top: 1px solid var(--line);
    background: #fafbfd;
    flex-wrap: wrap;
}

.rinv-pts-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 4px 10px;
    background: #f8f9fa !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 6px;
}

.rinv-pts-lbl {
    font-size: 11.5px;
    font-weight: 600;
    color: #475569 !important;
    white-space: nowrap;
}

.rinv-pts-val {
    font-size: 12px;
    font-weight: 800;
    color: #1e293b !important;
}

.rinv-stats {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex: 1;
}

    .rinv-stats::-webkit-scrollbar {
        display: none;
    }

[dir=rtl] .rinv-stats {
    flex-direction: row-reverse;
}

.rinv-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    border: 1px solid var(--line2);
    white-space: nowrap;
    font-size: 11px;
    flex-shrink: 0;
    background: var(--white);
}

    .rinv-chip .ck {
        color: var(--muted);
        font-weight: 500;
    }

    .rinv-chip .cv {
        font-weight: 800;
        color: var(--txt);
    }

    .rinv-chip.profit-positive {
        background: #f0fdf4 !important;
        border-color: #86efac !important;
    }

        .rinv-chip.profit-positive .k, .rinv-chip.profit-positive .v {
            color: #15803d !important;
        }

    .rinv-chip.profit-negative {
        background: #fef2f2 !important;
        border-color: #fca5a5 !important;
    }

        .rinv-chip.profit-negative .k, .rinv-chip.profit-negative .v {
            color: #dc2626 !important;
        }

/* ── Action buttons ── */
.rinv-abtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--rs);
    border: 1px solid;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .13s;
    font-family: var(--fnt);
}

    .rinv-abtn:disabled {
        opacity: .45;
        cursor: not-allowed;
        pointer-events: none;
    }

    .rinv-abtn.a-new {
        background: var(--white);
        border-color: var(--line2);
        color: var(--txt);
    }

        .rinv-abtn.a-new:hover {
            background: var(--bg);
        }

    .rinv-abtn.a-save {
        background: var(--fs-primary);
        border-color: var(--fs-primary-hover-3);
        color: #fff;
        min-width: 90px;
        justify-content: center;
        box-shadow: 0 2px 6px rgba(var(--fs-primary-rgb),.3);
    }

        .rinv-abtn.a-save:hover:not(:disabled) {
            background: var(--fs-primary-hover-3);
            box-shadow: 0 3px 10px rgba(var(--fs-primary-rgb),.45);
            transform: translateY(-1px);
        }

    .rinv-abtn.a-edit {
        background: var(--amberbg);
        border-color: var(--amberbd);
        color: var(--amber);
    }

        .rinv-abtn.a-edit:hover {
            background: #fde68a;
        }

    .rinv-abtn.a-print {
        background: var(--white);
        border-color: var(--line2);
        color: var(--txt);
    }

        .rinv-abtn.a-print:hover {
            background: var(--bg);
        }

    .rinv-abtn.a-del {
        background: #c81e1e;
        border-color: #b91c1c;
        color: #fff;
    }

        .rinv-abtn.a-del:hover {
            background: #c81e1e;
            border-color: #b91c1c;
            color: #fff;
        }

/* ── Misc ── */
.rinv-invbar {
    overflow-x: auto !important;
    scrollbar-width: none !important;
}

    .rinv-invbar::-webkit-scrollbar {
        display: none !important;
    }

.rinv-invbar2 {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: thin !important;
    scrollbar-color: #d1d5db #f1f5f9 !important;
}

    .rinv-invbar2::-webkit-scrollbar {
        height: 4px !important;
        display: block !important;
    }

    .rinv-invbar2::-webkit-scrollbar-thumb {
        background: #d1d5db !important;
        border-radius: 4px !important;
    }

    .rinv-invbar2::-webkit-scrollbar-track {
        background: #f1f5f9 !important;
    }

.dxbl-text-edit-input {
    overflow: hidden !important;
    scrollbar-width: none !important;
}

    .dxbl-text-edit-input::-webkit-scrollbar {
        display: none !important;
    }

/* ═══════════════════════════════════════════
   6. RESPONSIVE
   ═══════════════════════════════════════════ */
/* ═══════════════════════════════════════════
   6. RESPONSIVE
   ═══════════════════════════════════════════ */

/* ── 1024px Tablet ── */
@media (max-width: 1024px) {
    .rinv-row,
    .rinv-row-b {
        grid-template-columns: minmax(140px,180px) 80px minmax(100px,120px) minmax(120px,150px) minmax(200px,300px) 1fr;
    }
}

/* ══════════════════════════════════════════
   768px — Mobile
   ══════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Page */
    .rinv-page {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 5px !important;
        gap: 5px !important;
    }

    /* Form */
    .rinv-form {
        overflow: visible !important;
    }

    .rinv-form-body {
        max-height: none !important;
        overflow: visible !important;
        opacity: 1 !important;
        transition: none !important;
    }

    /* Form rows → 2 أعمدة */
    .rinv-row, .rinv-row-b {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        min-height: auto !important;
        overflow: visible !important;
        border-bottom: none !important;
    }

    .rinv-cell {
        flex: unset !important;
        border-inline-end: 1px solid var(--line) !important;
        border-inline-start: none !important;
        border-bottom: 1px solid var(--line) !important;
        box-sizing: border-box !important;
        padding: 6px 10px !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    /* العمود الثاني بدون border-inline-end */
    .rinv-row .rinv-cell:nth-child(2n),
    .rinv-row-b .rinv-cell:nth-child(2n) {
        border-inline-end: none !important;
    }

    /* inv-cell-extra و fill → عرض كامل */
    .rinv-cell-extra {
        grid-column: span 2 !important;
        flex-wrap: wrap !important;
        white-space: normal !important;
        min-width: unset !important;
        padding: 6px 10px !important;
        gap: 8px !important;
        border-inline-end: none !important;
        border-bottom: 1px solid var(--line) !important;
        width: 100% !important;
    }

    .rinv-cell-fill {
        grid-column: span 2 !important;
        border-inline-end: none !important;
        border-inline-start: none !important;
        width: 100% !important;
    }

    /* Customer name cell → عرض كامل */
    .rinv-cell:has(.f-cu) {
        grid-column: span 2 !important;
        border-inline-end: none !important;
    }

    /* الـ inputs عرض كامل */
    .rinv-row .dxbl-text-edit, .rinv-row .dxbl-combobox,
    .rinv-row .dxbl-spin-edit, .rinv-row .dxbl-date-edit,
    .rinv-row-b .dxbl-text-edit, .rinv-row-b .dxbl-combobox,
    .rinv-row-b .dxbl-spin-edit, .rinv-row-b .dxbl-date-edit {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Font 16px يمنع zoom iOS */
    .rinv-row input, .rinv-row-b input,
    .rinv-form .dxbl-text-edit-input,
    .rinv-form .dxbl-spin-edit input {
        font-size: 16px !important;
    }

    /* ── Balance strip — scroll أفقي ── */
    .rinv-bals {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 4px 8px !important;
        gap: 6px !important;
    }

        .rinv-bals::-webkit-scrollbar {
            display: none !important;
        }

    .rinv-bal {
        flex-shrink: 0 !important;
        font-size: 11px !important;
        padding: 3px 9px !important;
    }

    /* ── Grid card ── */
    .rinv-grid-card {
        flex: 0 0 auto !important;
        height: 52vh !important;
        min-height: 260px !important;
        max-height: 52vh !important;
    }

    .rinv-grid-body {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    /* ── Grid Toolbar ── */
    .rinv-gtb {
        flex-direction: column-reverse !important;
        align-items: stretch !important;
        gap: 5px !important;
        padding: 6px 8px !important;
        min-height: auto !important;
    }

    .rinv-gtb-actions {
        display: flex !important;
        width: 100% !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        gap: 5px !important;
    }

    .rinv-tb-new {
        flex: 1 !important;
        justify-content: center !important;
    }

    .rinv-bc-zone {
        width: 100% !important;
    }

    .rinv-bc-wrap {
        width: 100% !important;
        max-width: 100% !important;
    }

    .rinv-gtb-sep {
        display: none !important;
    }

    /* ══ Mobile totals — يظهر فوق الأزرار ══ */
    .rinv-mob-totals {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        background: #fff !important;
        border-radius: 10px !important;
        border: 1.5px solid var(--fs-primary) !important;
        padding: 8px 10px !important;
        margin: 0 0 0 0 !important;
    }

    .rinv-mob-tot-row {
        display: flex !important;
        gap: 5px !important;
        flex-wrap: nowrap !important;
    }

    .rinv-mob-tot-cell {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        flex: 1 !important;
        min-width: 60px !important;
        background: #fafafa !important;
        border-radius: 6px !important;
        padding: 5px 6px !important;
        border: 1px solid #f0e8dc !important;
    }

    .rinv-mob-lbl {
        font-size: 9.5px !important;
        color: #64748b !important;
        font-weight: 600 !important;
        margin-bottom: 2px !important;
    }

    .rinv-mob-val {
        font-size: 13px !important;
        font-weight: 900 !important;
        color: #1c2434 !important;
    }

        .rinv-mob-val.red {
            color: #dc2626 !important;
        }

    .rinv-mob-net {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: linear-gradient(135deg, var(--fs-primary), #f59e0b) !important;
        border-radius: 8px !important;
        padding: 8px 14px !important;
    }

    .rinv-mob-net-lbl {
        font-size: 13px !important;
        font-weight: 700 !important;
        color: rgba(255,255,255,.9) !important;
    }

    .rinv-mob-net-val {
        font-size: 22px !important;
        font-weight: 900 !important;
        color: #fff !important;
        letter-spacing: -.5px !important;
    }

    /* ── صف الحقول القابلة للتعديل ── */
    .rinv-mob-edit-row {
        display: flex !important;
        align-items: stretch !important;
        gap: 0 !important;
        background: var(--fs-tint-1) !important;
        border: 1.5px solid var(--fs-tint-4) !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    .rinv-mob-edit-cell {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        flex: 1 !important;
        padding: 5px 8px !important;
        min-width: 0 !important;
        gap: 3px !important;
    }

    .rinv-mob-edit-sep {
        width: 1px !important;
        background: var(--fs-tint-4) !important;
        flex-shrink: 0 !important;
        align-self: stretch !important;
    }

    /* الـ SpinEdit داخل mobile totals */
    .rinv-mob-spin {
        width: 100% !important;
        height: 30px !important;
        min-height: 30px !important;
        border: 1.5px solid var(--fs-tint-4) !important;
        border-radius: 6px !important;
        background: #fff !important;
        box-shadow: none !important;
    }

        .rinv-mob-spin .dxbl-text-edit-input {
            font-size: 15px !important;
            font-weight: 800 !important;
            color: #c81e1e !important;
            text-align: center !important;
            height: 30px !important;
            min-height: 30px !important;
            padding: 0 6px !important;
        }

        .rinv-mob-spin .dxbl-spin-edit-buttons,
        .rinv-mob-spin .dxbl-btn-group {
            display: none !important;
        }

        .rinv-mob-spin:focus-within {
            border-color: var(--fs-primary) !important;
            box-shadow: 0 0 0 2.5px rgba(var(--fs-primary-rgb),.18) !important;
        }

    /* ── Footer ── */
    .rinv-footer-inner {
        flex-direction: column !important;
        gap: 0 !important;
    }

    /* إجماليات Desktop مخفية → Mobile totals تحل محلها */
    .rinv-footer-right {
        display: none !important;
    }

    /* أزرار → grid 3 أعمدة */
    .rinv-footer-left {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5px !important;
        padding: 8px !important;
        border-inline-start: none !important;
        border-top: 1px solid var(--line) !important;
        border-bottom: none !important;
        background: #fff !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .rinv-abtn {
        width: 100% !important;
        height: 38px !important;
        font-size: 12px !important;
        padding: 0 6px !important;
        justify-content: center !important;
        border-radius: 8px !important;
        gap: 4px !important;
    }

    /* Footer bottom */
    .rinv-footer-bottom {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    .rinv-pts-wrap {
        width: 100% !important;
        box-sizing: border-box !important;
        flex-wrap: wrap !important;
    }

    .rinv-stats {
        width: 100% !important;
    }

    .rinv-tot-val {
        font-size: 14px;
    }

    .rinv-tot-cell.tc-net .rinv-tot-val {
        font-size: 18px !important;
    }

    .rinv-tot-cell {
        min-height: 52px;
        padding: 6px 8px;
    }

        .rinv-tot-cell .dxbl-spin-edit {
            width: 100px !important;
        }
}

/* ── 600px ── */
@media (max-width: 600px) {
    .rinv-tb-del span:not(.rinv-tb-cnt) {
        display: none;
    }

    .rinv-tb-del {
        padding: 0 8px;
    }

    .rinv-bc-ico {
        width: 24px;
        font-size: 12px;
    }
}

/* ══════════════════════════════════════════
   480px — Small Mobile
   ══════════════════════════════════════════ */
@media (max-width: 480px) {
    .rinv-page {
        padding: 3px !important;
        gap: 3px !important;
    }

    /* عمود واحد */
    .rinv-row, .rinv-row-b {
        grid-template-columns: 1fr !important;
    }

    .rinv-cell,
    .rinv-cell-fill,
    .rinv-cell-extra {
        grid-column: span 1 !important;
        border-inline-end: none !important;
    }

    .rinv-row .rinv-cell:nth-child(2n),
    .rinv-row-b .rinv-cell:nth-child(2n) {
        border-inline-end: none !important;
    }

    /* إخفاء summary chips في header */
    .rinv-form-summary {
        display: none !important;
    }

    /* Grid card */
    .rinv-grid-card {
        height: 45vh !important;
        max-height: 45vh !important;
        min-height: 220px !important;
    }

    /* أزرار: عمودان */
    .rinv-footer-left {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* حفظ وجديد عرض كامل */
    .rinv-abtn.a-save, .rinv-abtn.a-new {
        grid-column: span 2 !important;
    }

    .rinv-abtn {
        height: 36px !important;
        font-size: 11.5px !important;
    }

    .rinv-mob-tot-row {
        flex-wrap: wrap !important;
    }

    .rinv-mob-tot-cell {
        min-width: 80px !important;
    }

    .rinv-tot-val {
        font-size: 13px;
    }

    .rinv-tot-cell.tc-net .rinv-tot-val {
        font-size: 16px !important;
    }

    .rinv-tot-lbl {
        font-size: 9.5px;
    }

    .rinv-tot-cell {
        min-height: 46px;
        padding: 5px 6px;
    }

        .rinv-tot-cell .dxbl-spin-edit {
            width: 90px !important;
        }

    .rinv-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .rinv-pts-wrap {
        width: 100%;
        box-sizing: border-box;
    }

    .rinv-stats {
        width: 100%;
    }

    .rinv-tb-new, .rinv-tb-del {
        flex: 1;
        justify-content: center;
    }

    .rinv-tb-cols {
        flex-shrink: 0;
    }

    .rinv-branch {
        display: none;
    }

    .rinv-bc-wrap {
        max-width: 100%;
        flex: 1 1 100%;
    }

    .rinv-gtb {
        flex-wrap: wrap;
        gap: 5px;
    }

        .rinv-gtb > div:last-child {
            width: 100%;
            justify-content: flex-start;
            margin-inline-start: 0 !important;
        }
}

/* ══ Mobile totals — مخفي على Desktop ══ */
.rinv-mob-totals {
    display: none;
}

/* barcode text*/

/* ── الـ Wrap: أضف border أكثر وضوحاً وخلفية خفيفة ── */
.rinv-bc-wrap {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: unset !important;
    border: 2px solid var(--fs-primary) !important; /* ← border برتقالي دائماً */
    border-radius: 8px !important;
    background: #fff9f0 !important; /* ← خلفية دافئة خفيفة */
    transition: all .18s;
}

    /* ── عند الـ Focus: أقوى ── */
    .rinv-bc-wrap:focus-within {
        border-color: var(--fs-primary-hover-3) !important;
        box-shadow: 0 0 0 3px rgba(var(--fs-primary-rgb),.30); /* ← glow أوسع */
        background: var(--fs-tint-7) !important;
    }

/* ── الأيقونة: خلفية ملونة لتبرز ── */
.rinv-bc-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px !important; /* ← أكبر */
    background: var(--fs-primary) !important; /* ← خلفية برتقالية */
    color: #fff !important; /* ← أيقونة بيضاء */
    width: 36px !important;
    min-width: 36px !important;
    border-radius: 6px 0 0 6px !important; /* ← زوايا مدورة على اليسار */
    align-self: stretch;
}


/* end barcode text*/

/*item stattices*/
.rinv-chip-qty {
    background: rgba(37,99,235,.07);
    border-color: rgba(37,99,235,.20);
}

.rinv-chip-allqty {
    background: rgba(14,165,233,.07);
    border-color: rgba(14,165,233,.20);
}

    .rinv-chip-qty .k, .rinv-chip-allqty .k {
        color: #1d4ed8;
    }

    .rinv-chip-qty .v, .rinv-chip-allqty .v {
        color: #1e3a8a;
    }

    .rinv-chip-qty i, .rinv-chip-allqty i {
        color: #2563eb;
    }

/* مجموعة الموقع - رمادي */
.rinv-chip-loc {
    background: rgba(100,116,139,.07);
    border-color: rgba(100,116,139,.18);
}

    .rinv-chip-loc .k {
        color: #475569;
    }

    .rinv-chip-loc .v {
        color: #1e293b;
    }

    .rinv-chip-loc i {
        color: #64748b;
    }

/* مجموعة الأسعار - برتقالي */
.rinv-chip-p1 {
    background: rgba(var(--fs-primary-rgb),.10);
    border-color: rgba(var(--fs-primary-rgb),.28);
}

.rinv-chip-p2 {
    background: rgba(168,85,247,.07);
    border-color: rgba(168,85,247,.20);
}

.rinv-chip-p3 {
    background: rgba(34,197,94,.07);
    border-color: rgba(34,197,94,.20);
}

.rinv-chip-last {
    background: rgba(245,158,11,.08);
    border-color: rgba(245,158,11,.22);
}

    .rinv-chip-p1 .k, .rinv-chip-last .k {
        color: var(--fs-primary-ink-2);
    }

    .rinv-chip-p1 .v, .rinv-chip-last .v {
        color: #78350f;
    }

    .rinv-chip-p1 i, .rinv-chip-last i {
        color: var(--fs-primary);
    }

/* مجموعة التكلفة - أحمر خفيف */
.rinv-chip-lc {
    background: rgba(239,68,68,.06);
    border-color: rgba(239,68,68,.18);
}

.rinv-chip-ac {
    background: rgba(22,163,74,.07);
    border-color: rgba(22,163,74,.20);
}

.rinv-chip-disc {
    background: rgba(244,63,94,.06);
    border-color: rgba(244,63,94,.16);
}

    .rinv-chip-lc .k, .rinv-chip-disc .k {
        color: #991b1b;
    }

    .rinv-chip-lc .v, .rinv-chip-disc .v {
        color: #7f1d1d;
    }

    .rinv-chip-lc i, .rinv-chip-disc i {
        color: #ef4444;
    }

/* كمية سالبة — تحذير أحمر */
.rinv-chip-danger {
    background: rgba(239,68,68,.10) !important;
    border-color: rgba(239,68,68,.35) !important;
    animation: pulse-danger .8s ease-in-out 3;
}

    .rinv-chip-danger .k {
        color: #991b1b !important;
    }

    .rinv-chip-danger .v {
        color: #7f1d1d !important;
        font-weight: 900 !important;
    }

    .rinv-chip-danger i {
        color: #ef4444 !important;
    }

@keyframes pulse-danger {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239,68,68,.0);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(239,68,68,.20);
    }
}
/* end iten stat*/

/* رصيد العميل والحد الإئتمانى*/
/* ── Credit Limit Progress Bar ── */
.rinv-credit-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 3px 10px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    min-width: 160px;
    box-shadow: var(--sh);
}

.rinv-credit-bar-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1;
}

.rinv-credit-bar-track {
    height: 5px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.rinv-credit-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease, background .3s ease;
    min-width: 4px;
}

/* موبايل */
@media (max-width: 768px) {
    .rinv-credit-bar-wrap {
        min-width: 130px;
    }
}

/*نهايه*/

/* سعر 1 و2 3*/



.price-seg {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.price-seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
    line-height: 1;
}

    .price-seg-btn i {
        font-size: 11px;
    }

    .price-seg-btn:hover:not(:disabled) {
        background: #fff;
        color: var(--fs-primary);
        box-shadow: 0 1px 4px rgba(0,0,0,.08);
    }

    /* الزر المحدد */
    .price-seg-btn.active {
        background: var(--fs-primary);
        color: #fff;
        box-shadow: 0 2px 6px rgba(var(--fs-primary-rgb),.40);
    }

        .price-seg-btn.active i {
            color: #fff;
        }

/* حالة ReadOnly */
.price-seg--readonly .price-seg-btn {
    cursor: default;
    opacity: .75;
}

    .price-seg--readonly .price-seg-btn.active {
        background: #94a3b8;
        box-shadow: none;
    }

/* موبايل */
@media (max-width: 768px) {
    .price-seg-btn {
        padding: 4px 9px;
        font-size: 11px;
    }
}


/* نهاية 1و2 و3*/


/* ════════════════════════════════════════════════════════════════════════
   ═══ RETURN INVOICE — Compact 2-Row Layout (specific overrides) ═══
   ────────────────────────────────────────────────────────────────────────
   شاشة المرتجع ليها 11 خلية فى Row A + 6 خلايا فى Row B. الـ default grid
   (6 columns) كان بيخلى Row A تـ wrap لـ 2 سطور، النتيجة 4 سطور إجمالاً.
   الـ overrides دى بتخلى كل صف فى سطر واحد → 2 سطور بس زى شاشة المبيعات.
   ──────────────────────────────────────────────────────────────────────── */

/* ROW A — 11 خلية فى سطر واحد (widths نهائية) */
.rinv-row.rinv-row--return {
    grid-template-columns:
        160px   /* 1. Return# */
         90px   /* 2. Search 1 */
        110px   /* 3. Invoice# */
         90px   /* 4. Search 2 */
        115px   /* 5. PrevYear Invoice */
         95px   /* 6. YearID */
        105px   /* 7. Invoice Type */
        100px   /* 8. DocCode */
        135px   /* 9. Invoice Date */
        1fr     /* 10. Cost Center → يملا كل المساحة الفاضية ✓ */
        130px;  /* 11. ISVISA */
}

/* ROW B — 6 خلية فى سطر واحد (widths نهائية) */
.rinv-row-b.rinv-row-b--return {
    grid-template-columns:
        290px   /* 1. Customer Name */
        140px   /* 2. Mobile */
        180px   /* 3. SalesMan */
        180px   /* 4. SalesMan Extra */
        1fr     /* 5. Notes → يملا الفراغ ✓ */
        1fr;    /* 6. Notes2 / البيان → يملا الفراغ ✓ */
}

/* ✦ override الافتراضى الذى يجعل rinv-cell-fill يأخذ عمودين ✦
   فى شاشة المرتجع، الـ Notes2 (.rinv-cell-fill) يأخذ عمود واحد فقط
   عشان الصف يفضل 6 خلايا فى سطر واحد. */
.rinv-row-b--return .rinv-cell-fill {
    grid-column: span 1 !important;
}

/* ✦ نفس الشئ للعميل — الـ customer cell عمود واحد (مش 3) ✦ */
.rinv-row-b--return .rinv-cell:has(.f-cu) {
    grid-column: span 1 !important;
}

/* ✦ rinv-cell-full ما يأخذش span — يفضل عمود واحد ✦ */
.rinv-row--return .rinv-cell-full,
.rinv-row-b--return .rinv-cell-full {
    grid-column: auto;
}

/* ── Responsive: على الشاشات الأصغر (1440px↓) ── */
@media (max-width: 1440px) {
    /* (2026-11-20) التاريخ 120→140 ونوع الفاتورة 95→110 (كانوا بيتقصوا «…6/11/20» و«نقد…»)
       و«فيزا» 115→85 (مربع اختيار بس) — الفرق بيتاخد من مركز التكلفة (1fr) */
    .rinv-row.rinv-row--return {
        grid-template-columns:
            145px 80px 100px 80px 105px 85px 110px 90px 140px 1fr 85px;
    }
    .rinv-row-b.rinv-row-b--return {
        grid-template-columns: 260px 125px 160px 160px 1fr 1fr;
    }
}

/* ── Tablet (1024px↓): grid أقل compact ── */
@media (max-width: 1024px) {
    .rinv-row.rinv-row--return {
        grid-template-columns:
            minmax(120px,140px) minmax(65px,80px) minmax(95px,110px) minmax(65px,80px)
            minmax(95px,110px) minmax(75px,90px) minmax(85px,100px) minmax(85px,100px)
            minmax(105px,125px) minmax(160px,180px) minmax(100px,115px);
    }
    .rinv-row-b.rinv-row-b--return {
        grid-template-columns: 230px 110px 140px 140px 160px 160px;
    }
}


