abled' : ''}`;
                const color = categoryColors[category];
                const categoryDataItem = categoryMap.get(category);
                const percentage = categoryDataItem ? ` (${categoryDataItem.percentage.toFixed(1)}%)` : '';
                const amount = categoryDataItem ? formatCurrency(categoryDataItem.total) : '';
                item.innerHTML = `
                    <div class="color-box" style="background-color: ${color}"></div>
                    <div class="legend-text">
    