{# 系统设置:CSS Tab(与 env 配置同方案) #}
<div class="settings-page full">
    <div class="env-config-head card">
        <h2>系统设置</h2>
        <p class="settings-env-hint env-config-head-hint">各区块说明见 <code>docs/系统设置说明.md</code>.</p>
    </div>

    {% if settings_tabs %}
    <div class="env-config-body card settings-config-body">
        {% for tab in settings_tabs %}
        <input type="radio" name="settings-section" id="settings-sec-{{ loop.index0 }}" class="env-tab-radio"{% if loop.first %} checked{% endif %}>
        {% endfor %}
        <div class="env-config-tabs" role="tablist" aria-label="系统设置分类">
            {% for tab in settings_tabs %}
            <label for="settings-sec-{{ loop.index0 }}" class="env-tab-btn" role="tab">{{ tab.title }}</label>
            {% endfor %}
        </div>
        <div class="env-config-panels">
            {% for tab in settings_tabs %}
            <section class="env-panel env-panel--{{ loop.index0 }} settings-tab-panel" role="tabpanel">
                {% if tab.key == 'nav' %}
                    {% include 'display_prefs_panel.html' %}
                {% elif tab.key == 'password' %}
                    {% include 'password_settings_panel.html' %}
                {% elif tab.key == 'transfer' %}
                    <h2>永续资金划转</h2>
                    <p class="settings-subcard-desc">子账户永续:资金账户与交易账户之间划转 USDT.</p>
                    {% include 'instance_transfer_panel.html' %}
                {% elif tab.key == 'export' %}
                    <h2>数据导出</h2>
                    <p class="settings-subcard-desc muted">CSV · v{{ instance_settings.data_export_version }}</p>
                    <div class="settings-export-links-inline settings-export-links-block">
                        <a href="/export/trade_records">交易记录</a>
                        <a href="/export/journal_entries">复盘记录</a>
                        <a href="/export/key_monitors">关键位(当前)</a>
                        <a href="/export/key_monitor_history">关键位历史</a>
                    </div>
                {% elif tab.key == 'options_swap' %}
                    <h2>币种兑换</h2>
                    {% include 'options_settings_swap.html' %}
                {% elif tab.key == 'options_transfer' %}
                    <h2>期权资金划转</h2>
                    {% include 'options_settings_transfer.html' %}
                {% endif %}
            </section>
            {% endfor %}
        </div>
    </div>
    {% endif %}

    {% if instance_settings.options_settings_enabled %}
    {% include 'options_settings_panel.html' %}
    {% endif %}
</div>
