<%= t("reports.transactions_breakdown.table.category") %>
<%= link_to reports_path(amount_sort_params), class: "inline-flex items-center gap-1 hover:text-primary" do %>
<%= t("reports.transactions_breakdown.table.amount") %>
<% if current_sort_by == "amount" %>
<%= icon(current_sort_direction == "desc" ? "chevron-down" : "chevron-up", class: "w-3 h-3") %>
<% end %>
<% end %>
<%= t("reports.transactions_breakdown.table.percentage") %>
<% groups.each_with_index do |group, idx| %>
<%= render "reports/category_row",
item: group,
total: total,
color_class: color_class,
level: :category
%>
<% if idx < group.size - 1 %>
<%= render "shared/ruler", classes: "mx-3 lg:mx-4" %>
<% end %>
<%# Render subcategories if present %>
<% if group[:subcategories].present? && group[:subcategories].any? %>
<% group[:subcategories].each_with_index do |subcategory, idx| %>
<%= render "reports/category_row",
item: subcategory,
total: total,
color_class: color_class,
level: :subcategory
%>
<% end %>
<% if idx < group.size - 1 %>
<%= render "shared/ruler", classes: "mx-3 lg:mx-4" %>
<% end %>
<% end %>
<% end %>