{# 统一顶栏:状态 + 筛选(上)· 统计条(下) #}
<div class="instance-header-panel card">
    <div class="instance-header-toolbar">
        <div class="instance-header-toolbar-filter">
            <span class="list-window-label" title="列表按 UTC 时间筛选,默认本月">UTC {{ list_window.label }}</span>
            <label class="list-window-preset">预设
                <select id="win-preset-select" onchange="toggleListWindowCustom()">
                    <option value="utc_this_month" {% if list_window.preset == 'utc_this_month' %}selected{% endif %}>本月</option>
                    <option value="utc_last3m" {% if list_window.preset == 'utc_last3m' %}selected{% endif %}>近3月</option>
                    <option value="utc_last6m" {% if list_window.preset == 'utc_last6m' %}selected{% endif %}>近6月</option>
                    <option value="all" {% if list_window.preset == 'all' %}selected{% endif %}>全部</option>
                    <option value="utc_today" {% if list_window.preset == 'utc_today' %}selected{% endif %}>UTC 当日</option>
                    <option value="utc_last24h" {% if list_window.preset == 'utc_last24h' %}selected{% endif %}>近 24 小时</option>
                    <option value="utc_last7d" {% if list_window.preset == 'utc_last7d' %}selected{% endif %}>近 7 天</option>
                    <option value="custom" {% if list_window.preset == 'custom' %}selected{% endif %}>自定义</option>
                </select>
            </label>
            <span id="win-custom-range" class="list-window-custom" style="{% if list_window.preset != 'custom' %}display:none{% endif %}">
                <label>起 <input type="datetime-local" id="win-from-utc" value="{{ list_window.start_utc.strftime('%Y-%m-%dT%H:%M') }}"></label>
                <label>止 <input type="datetime-local" id="win-to-utc" value="{{ list_window.end_utc.strftime('%Y-%m-%dT%H:%M') }}"></label>
            </span>
            <button type="button" class="list-window-apply" onclick="applyListWindow()">应用</button>
            <span class="list-window-hint" title="统计分析页按北京时间 {{ stats_bundle.stats_reset_hour|default(reset_hour) }}:00 切交易日">统计切日 {{ stats_bundle.stats_reset_hour|default(reset_hour) }}:00</span>
        </div>
        <div class="instance-header-toolbar-end">
            <div class="instance-toolbar-status">
                <div class="exchange-tag">{{ exchange_display }}</div>
                {% if trade_policy.badge_text %}
                <span class="trade-policy-badge" title="账户交易限制(.env)">{{ trade_policy.badge_text }}</span>
                {% endif %}
                {% include 'force_close_header_badge.html' %}
                <span class="risk-status-badge risk-status-{{ risk_status.status|default('normal') }}" id="account-risk-badge" role="status" title="{{ risk_status.reason|default('', true) }}" data-status-label="{{ risk_status.status_label|default('正常') }}"{% if risk_status.freeze_until_ms %} data-freeze-until-ms="{{ risk_status.freeze_until_ms }}"{% endif %}>{{ risk_status.status_label|default('正常') }}</span>
            </div>
            {% include 'instance_theme_toggle.html' %}
        </div>
    </div>
    <div class="instance-header-stats-wrap instance-desktop-only">
        {% include 'instance_header_stats.html' %}
    </div>
</div>
