        window.renderAbstractItemsTable = function() {
            const tbody = document.getElementById('ab-items-tbody');
            if (!tbody) return;
            tbody.innerHTML = '';

            let currentWorksTotal = 0;
            let prevWorksTotal = 0;
            let totalWorksTotal = 0;

            (window.currentAbstractItems || []).forEach((it, index) => {
                const currentQty = parseFloat(it.current_qty) || 0;
                const prevQty = parseFloat(it.prev_qty) || 0;
                const totalQty = prevQty + currentQty;
                const price = parseFloat(it.price) || 0;

                const currentVal = currentQty * price;
                const prevVal = prevQty * price;
                const totalVal = totalQty * price;

                currentWorksTotal += currentVal;
                prevWorksTotal += prevVal;
                totalWorksTotal += totalVal;

                tbody.innerHTML += `
                    <tr>
                        <td style="text-align:center;">
                            <button class="action-btn btn-delete" onclick="window.removeAbstractItem(${index})" style="padding: 2px 5px; margin-bottom: 5px;">â‌Œ</button>
                        </td>
                        <td><input type="text" value="${it.name || ''}" onchange="window.updateAbstractItem(${index}, 'name', this.value)" style="width:100%; border:none; background:transparent; color:#fff; font-weight:bold;"></td>
                        <td style="text-align:center;"><input type="text" value="${it.unit || ''}" onchange="window.updateAbstractItem(${index}, 'unit', this.value)" style="width:50px; border:none; background:transparent; color:#fff; text-align:center;"></td>
                        <td style="text-align:center;"><input type="number" step="any" value="${price}" onchange="window.updateAbstractItem(${index}, 'price', this.value)" style="width:70px; border:none; background:transparent; color:#fff; text-align:center;"></td>
                        <td style="text-align:center;"><input type="number" step="any" value="${prevQty}" onchange="window.updateAbstractItem(${index}, 'prev_qty', this.value)" style="width:60px; border:none; background:transparent; color:#aaa; text-align:center;"></td>
                        <td style="text-align:center;"><input type="number" step="any" value="${currentQty}" onchange="window.updateAbstractItem(${index}, 'current_qty', this.value)" style="width:70px; border:1px solid var(--primary); background:rgba(0,0,0,0.3); color:#fff; font-weight:bold; padding:5px;"></td>
                        <td style="text-align:center; color:#ff9800; font-weight:bold;">${totalQty}</td>
                        <td style="text-align:center; color:#aaa;">${prevVal.toLocaleString('en-US')}</td>
                        <td style="text-align:center; color:var(--primary); font-weight:bold;">${currentVal.toLocaleString('en-US')}</td>
                        <td style="text-align:center; color:#4caf50; font-weight:bold;">${totalVal.toLocaleString('en-US')}</td>
                    </tr>
                `;
            });

            // طھط­ط¯ظٹط« ط§ظ„ط¥ط¬ظ…ط§ظ„ظٹط§طھ
            const currWorksEl = document.getElementById('ab-current-works');
            if (currWorksEl) currWorksEl.innerText = currentWorksTotal.toLocaleString('en-US');
            
            if (typeof window.calculateAbstractTotals === 'function') window.calculateAbstractTotals();
        };

        // 3. ط¯ظˆط§ظ„ ط§ظ„طھط­ط¯ظٹط« ظˆط§ظ„ط¥ط¶ط§ظپط©
        window.updateAbstractItem = function(index, field, value) {
