%= turbo_stream_from @account %>
<% series = @account.series(period: @period) %>
<% trend = series.trend %>
<%= tag.div id: dom_id(@account), class: "space-y-4" do %>
<%= render permitted_accountable_partial(@account, "header"), account: @account %>
<%= button_to sync_account_path(@account), method: :post, class: "flex items-center gap-2", title: "Sync Account" do %>
<%= lucide_icon "refresh-cw", class: "w-4 h-4 text-gray-500 hover:text-gray-400" %>
<% end %>
<%= render "menu", account: @account %>
<% if @account.highest_priority_issue %>
<%= render partial: "issues/issue", locals: { issue: @account.highest_priority_issue } %>
<% end %>
<% if @account.asset? %>
<%= tag.p t(".total_value"), class: "text-sm font-medium text-gray-500" %>
<% else %>
<%= tag.p t(".total_owed"), class: "text-sm font-medium text-gray-500" %>
<% end %>
<%= render permitted_accountable_partial(@account, "tooltip"), account: @account if @account.investment? %>
<%= tag.p format_money(@account.value), class: "text-gray-900 text-3xl font-medium" %>
<% if trend.direction.flat? %>
<%= tag.span t(".no_change"), class: "text-gray-500" %>
<% else %>
<%= tag.span format_money(trend.value), style: "color: #{trend.color}" %>
<%= tag.span "(#{trend.percent}%)", style: "color: #{trend.color}" %>
<% end %>
<%= tag.span period_label(@period), class: "text-gray-500" %>
<%= form_with url: account_path(@account), method: :get, data: { controller: "auto-submit-form" } do |form| %>
<%= period_select form: form, selected: @period.name %>
<% end %>
<%= render "shared/line_chart", series: @account.series(period: @period) %>
<%= render permitted_accountable_partial(@account, "tabs"), account: @account, selected_tab: params[:tab] %>
<% end %>