<% 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 %>
<%# Pending→posted reconciliation %>
<% if has_pending_reconciled? %>
<%= helpers.icon "check-circle", size: "sm", color: "success" %>
<%= t("provider_sync_summary.health.pending_reconciled", count: pending_reconciled) %>
<% if pending_reconciled_details.any? %>
<%= t("provider_sync_summary.health.view_reconciled") %>
<% pending_reconciled_details.each do |detail| %>
<%= detail["account_name"] %>: <%= detail["pending_name"] %>
<% end %>
<% end %>
<% end %>
<%# Duplicate suggestions needing review %>
<% if has_duplicate_suggestions_created? %>
<%= helpers.icon "alert-triangle", size: "sm", color: "warning" %>
<%= t("provider_sync_summary.health.duplicate_suggestions", count: duplicate_suggestions_created) %>
<% if duplicate_suggestions_details.any? %>
<%= t("provider_sync_summary.health.view_duplicate_suggestions") %>
<% duplicate_suggestions_details.each do |detail| %>
<%= detail["account_name"] %>: <%= detail["pending_name"] %> → <%= detail["posted_name"] %>
<% end %>
<% end %>
<% end %>
<%# Stale pending transactions (auto-excluded) %>
<% if has_stale_pending? %>
<%= helpers.icon "clock", size: "sm", color: "warning" %>
<%= t("provider_sync_summary.health.stale_pending", count: stale_pending_excluded) %>
<% if stale_pending_details.any? %>
<%= t("provider_sync_summary.health.view_stale_pending") %>
<% stale_pending_details.each do |detail| %>
<%= detail["account_name"] %>: <%= t("provider_sync_summary.health.stale_pending_count", count: detail["count"]) %>
<% end %>
<% end %>
<% end %>
<%# Stale unmatched pending (need manual review) %>
<% if has_stale_unmatched_pending? %>
<%= helpers.icon "help-circle", size: "sm" %>
<%= t("provider_sync_summary.health.stale_unmatched", count: stale_unmatched_pending) %>
<% if stale_unmatched_details.any? %>
<%= t("provider_sync_summary.health.view_stale_unmatched") %>
<% stale_unmatched_details.each do |detail| %>
<%= detail["account_name"] %>: <%= t("provider_sync_summary.health.stale_unmatched_count", count: detail["count"]) %>
<% end %>
<% end %>
<% 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 %>