<%= helpers.icon "chevron-right", class: "group-open:transform group-open:rotate-90" %> <%= t("provider_sync_summary.title") %>
<% if last_synced_at %> <%= t("provider_sync_summary.last_sync", time_ago: last_synced_ago) %> <% end %>
<%# Accounts section - always shown if we have account stats %> <% if total_accounts > 0 || stats.key?("total_accounts") %>

<%= t("provider_sync_summary.accounts.title") %>

<%= t("provider_sync_summary.accounts.total", count: total_accounts) %> <%= t("provider_sync_summary.accounts.linked", count: linked_accounts) %> <%= t("provider_sync_summary.accounts.unlinked", count: unlinked_accounts) %> <% if institutions_count.present? %> <%= t("provider_sync_summary.accounts.institutions", count: institutions_count) %> <% end %>
<% end %> <%# Transactions section - shown if provider collects transaction stats %> <% if has_transaction_stats? %>

<%= t("provider_sync_summary.transactions.title") %>

<%= t("provider_sync_summary.transactions.seen", count: tx_seen) %> <%= t("provider_sync_summary.transactions.imported", count: tx_imported) %> <%= t("provider_sync_summary.transactions.updated", count: tx_updated) %> <%= t("provider_sync_summary.transactions.skipped", count: tx_skipped) %>
<% end %> <%# Holdings section - shown if provider collects holdings stats %> <% if has_holdings_stats? %>

<%= t("provider_sync_summary.holdings.title") %>

<%= t("provider_sync_summary.holdings.#{holdings_label_key}", count: holdings_count) %>
<% end %> <%# Health section - always shown %>

<%= t("provider_sync_summary.health.title") %>

<% if rate_limited? %> <%= t("provider_sync_summary.health.rate_limited", time_ago: rate_limited_ago || t("provider_sync_summary.health.recently")) %> <% end %> <% if has_errors? %> <%= t("provider_sync_summary.health.errors", count: total_errors) %> <% elsif import_started? %> <%= t("provider_sync_summary.health.errors", count: 0) %> <% else %> <%= t("provider_sync_summary.health.errors", count: 0) %> <% end %>
<%# Data quality warnings %> <% if has_data_quality_issues? %>
<% if data_warnings > 0 %>
<%= helpers.icon "alert-triangle", size: "sm", color: "warning" %> <%= t("provider_sync_summary.health.data_warnings", count: data_warnings) %>
<% end %> <% if notices > 0 %>
<%= helpers.icon "info", size: "sm" %> <%= t("provider_sync_summary.health.notices", count: notices) %>
<% end %>
<% if data_quality_details.any? %>
<%= t("provider_sync_summary.health.view_data_quality") %>
<% data_quality_details.each do |detail| %>

"><%= detail["message"] %>

<% end %>
<% end %> <% end %>