/* ── Page-level: scrolling vertical layout ── */
.container { max-width: none; padding: 24px; display: flex; flex-direction: column; box-sizing: border-box; }
.box { margin-bottom: 24px; }

/* ── Box 1: Backtest Config (existing styles) ── */
.backtest-layout { display: flex; gap: 24px; min-height: 0; }
.backtest-left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.backtest-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.backtest-left .card, .backtest-right .card { flex: 1; display: flex; flex-direction: column; margin-bottom: 0; overflow: hidden; }
.backtest-right .runs-list { flex: 1; overflow-y: auto; max-height: 600px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #8b949e; }
.form-group select, .form-group input {
    width: 100%; padding: 8px 12px; background: #0d1117; border: 1px solid #30363d;
    border-radius: 6px; color: #e6edf3; font-size: 14px;
}
.form-group select:focus, .form-group input:focus { outline: none; border-color: #58a6ff; }
.params-container { margin-top: 12px; padding: 12px; background: #0d1117; border-radius: 6px; }
.param-row { display: flex; gap: 12px; margin-bottom: 8px; align-items: center; }
.param-row label { min-width: 120px; font-size: 13px; }
.param-row input, .param-row select { flex: 1; }
.btn { padding: 10px 20px; background: #238636; border: none; border-radius: 6px;
    color: #fff; font-size: 14px; cursor: pointer; width: 100%; }
.btn:hover { background: #2ea043; }
.btn:disabled { background: #30363d; cursor: not-allowed; }
.date-row { display: flex; gap: 12px; }
.date-row .form-group { flex: 1; margin-bottom: 0; }
.symbol-section { background: #0d1117; border-radius: 6px; padding: 12px; }
.publisher-row { display: flex; gap: 8px; margin-bottom: 12px; }
.publisher-row select { flex: 1; }
.preset-row { display: flex; gap: 8px; align-items: center; background: #0d1117; border-radius: 6px; padding: 8px 12px; }
.preset-row select { flex: 1; }
.preset-row input { flex: 1; }
.preset-row .btn-sm { padding: 6px 12px; font-size: 12px; width: auto; cursor: not-allowed; }
.preset-row .btn-secondary { background: #30363d; }
.preset-row .btn-secondary.active { background: #238636; cursor: pointer; }
.preset-row .btn-secondary.active:hover { background: #2ea043; }
.preset-row .btn-danger { background: #30363d; }
.preset-row .btn-danger.active { background: #30363d; color: #f85149; cursor: pointer; }
.preset-row .btn-danger.active:hover { background: #30363d; color: #ff7b72; }
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.search-row input { flex: 1; }
.search-results { max-height: 150px; overflow-y: auto; border: 1px solid #30363d; border-radius: 4px; margin-bottom: 12px; }
.search-results:empty { display: none; }
.search-result { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid #21262d; cursor: pointer; }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: #161b22; }
.search-result .symbol { font-family: monospace; }
.selected-symbols { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; max-height: 150px; overflow-y: auto; }
.selected-tag { display: inline-flex; align-items: center; gap: 4px; background: #238636; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-family: monospace; }
.selected-tag .remove { cursor: pointer; opacity: 0.7; }
.selected-tag .remove:hover { opacity: 1; }
.selected-label { font-size: 13px; color: #8b949e; margin-bottom: 6px; }
.section-header { font-size: 14px; color: #8b949e; margin-bottom: 6px; margin-top: 8px; }
.runs-list { display: flex; flex-direction: column; gap: 12px; }
.run-item { background: #0d1117; border: 1px solid #30363d; border-radius: 6px; padding: 12px; display: flex; gap: 12px; align-items: flex-start; }
.run-item.selected { border-color: #58a6ff; }
.run-checkbox { flex-shrink: 0; margin-top: 2px; width: 16px; height: 16px; accent-color: #58a6ff; cursor: pointer; }
.run-content { flex: 1; min-width: 0; }
.run-content.clickable { cursor: pointer; }
.run-content.clickable:hover { opacity: 0.8; }
.run-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.run-name { font-family: monospace; font-size: 13px; color: #e6edf3; }
.run-id { color: #8b949e; font-size: 11px; margin-left: 6px; }
.run-status { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }
.run-status.running { background: #9e6a03; color: #fff; }
.run-status.queued { background: #6e7681; color: #fff; }
.run-status.completed { background: #238636; color: #fff; }
.run-status.failed { background: #da3633; color: #fff; }
.run-status.cancelled { background: #30363d; color: #8b949e; }
.run-status.error { background: #da3633; color: #fff; }
.run-meta { font-size: 12px; color: #8b949e; }
.run-meta.with-progress { margin-bottom: 8px; }
.progress-bar { height: 6px; background: #30363d; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: #58a6ff; transition: width 0.3s ease; }
.progress-fill.completed { background: #238636; }
.progress-fill.error { background: #da3633; }
.empty-runs { text-align: center; padding: 48px 24px; color: #8b949e; }
.empty-runs p { font-size: 14px; }
.runs-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #30363d; }
.runs-toolbar .select-all-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #8b949e; cursor: pointer; }
.runs-toolbar .select-all-label input { width: 16px; height: 16px; accent-color: #58a6ff; cursor: pointer; }
.btn-delete { padding: 6px 12px; background: #da3633; border: none; border-radius: 6px; color: #fff; font-size: 13px; cursor: pointer; }
.btn-delete:hover { background: #f85149; }
.btn-delete:disabled { background: #30363d; cursor: not-allowed; color: #8b949e; }

/* ── Box 2: Analysis run selection ── */
.settings-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.settings-group { display: flex; align-items: center; gap: 8px; }
.settings-group label { font-size: 13px; color: #8b949e; font-weight: 500; white-space: nowrap; }
.settings-group select { padding: 6px 10px; background: #0d1117; border: 1px solid #30363d; border-radius: 6px; color: #e6edf3; font-size: 13px; cursor: pointer; }
.settings-group select:focus { outline: none; border-color: #58a6ff; }
.settings-group select#run-select { min-width: 250px; }

/* ── Box 3: Symbol Performance (from performance.css) ── */
#box-symbol-perf .symbol-input-wrapper { position: relative; }
#box-symbol-perf .symbol-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: #161b22; border: 1px solid #30363d; border-radius: 6px; max-height: 200px; overflow-y: auto; z-index: 100; display: none; margin-top: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
#box-symbol-perf .symbol-suggestions.show { display: block; }
#box-symbol-perf .symbol-suggestion { padding: 8px 12px; cursor: pointer; font-size: 13px; color: #e6edf3; }
#box-symbol-perf .symbol-suggestion:hover { background: #21262d; }
#box-symbol-perf .symbol-suggestion.selected { background: #388bfd33; color: #58a6ff; }
#box-symbol-perf input[type="text"] { padding: 8px 12px; background: #0d1117; border: 1px solid #30363d; border-radius: 6px; color: #e6edf3; font-size: 13px; min-width: 200px; }
#box-symbol-perf input[type="text"]:focus { outline: none; border-color: #58a6ff; box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15); }
#box-symbol-perf input[type="text"]::placeholder { color: #484f58; }
.charts-row { display: flex; gap: 16px; flex: 1; min-height: 0; margin-top: 16px; }
.chart-card { flex: 1; background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; min-width: 0; }
.chart-card h3 { margin: 0 0 12px 0; font-size: 14px; font-weight: 500; color: #8b949e; }
.chart-card .chart-content { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.chart-card img { max-width: 100%; max-height: 100%; height: auto; border-radius: 4px; background: #fff; }
.chart-loading { color: #484f58; font-size: 13px; }
.empty-message { text-align: center; padding: 48px 24px; color: #484f58; font-size: 14px; }
@media (max-width: 900px) { .charts-row { flex-direction: column; } }

/* ── Box 4: Trades (from chart.css) ── */
.empty-content { text-align: center; padding: 48px 24px; color: #8b949e; }
.empty-content p { font-size: 14px; }
#box-trades .settings-box { background: #0d1117; border: 1px solid #30363d; border-radius: 6px; padding: 16px; margin-bottom: 16px; }
#box-trades .settings-box .settings-group { flex: 1; }
#box-trades .settings-group input[type="number"] { width: 80px; padding: 6px 10px; background: #161b22; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 13px; }
#box-trades .settings-group input[type="number"]:focus { outline: none; border-color: #58a6ff; }
#box-trades .settings-group input#trades-symbol-filter { width: 180px; padding: 6px 10px; background: #161b22; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 13px; }
#box-trades .settings-group input#trades-symbol-filter:focus { outline: none; border-color: #58a6ff; }
#box-trades .settings-group input#trades-symbol-filter::placeholder { color: #8b949e; }
.trades-table-container { }
.trades-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.trades-table th { position: sticky; top: 0; background: #161b22; padding: 10px 12px; text-align: left; color: #8b949e; font-weight: 500; border-bottom: 1px solid #30363d; cursor: pointer; user-select: none; white-space: nowrap; }
.trades-table th:hover { color: #e6edf3; }
.trades-table th .sort-icon { margin-left: 4px; opacity: 0.5; }
.trades-table th.sorted .sort-icon { opacity: 1; }
.trades-table td { padding: 10px 12px; border-bottom: 1px solid #21262d; color: #e6edf3; white-space: nowrap; }
.trades-table tr:hover td { background: #21262d; }
.trades-table .symbol { font-family: monospace; }
.trades-table .number { font-family: monospace; text-align: right; }
.trades-table .direction { font-weight: 500; }
.trades-table .direction.long { color: #3fb950; }
.trades-table .direction.short { color: #f85149; }
.trades-table .pnl { font-weight: 500; font-family: monospace; }
.trades-table .pnl.positive { color: #3fb950; }
.trades-table .pnl.negative { color: #f85149; }
.trades-table tr.data-row { cursor: pointer; }
.trades-table tr.chart-row { display: none; }
.trades-table tr.chart-row.expanded { display: table-row; }
.trades-table tr.chart-row td { padding: 16px; background: #0d1117; }
.empty-table { text-align: center; padding: 48px 24px; color: #8b949e; }
.chart-container { position: relative; text-align: center; }
.chart-container img { max-width: 100%; height: auto; border-radius: 4px; }

/* Indicator settings panel */
.indicator-settings-panel { background: #0d1117; border: 1px solid #30363d; border-radius: 6px; margin-bottom: 16px; }
.indicator-settings-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; user-select: none; color: #8b949e; font-size: 13px; font-weight: 500; }
.indicator-settings-body { display: block; padding: 0 16px 16px; }
.chart-settings-controls { display: flex; align-items: center; gap: 24px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #21262d; }
.chart-settings-controls .settings-group select { padding: 4px 8px; background: #161b22; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 12px; cursor: pointer; }
.chart-settings-controls .settings-group select:focus { outline: none; border-color: #58a6ff; }
.chart-settings-controls .settings-group input[type="number"] { width: 80px; padding: 4px 8px; background: #161b22; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 12px; }
.indicator-settings-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.indicator-settings-table th { padding: 8px 10px; text-align: left; color: #8b949e; font-weight: 500; border-bottom: 1px solid #30363d; }
.indicator-settings-table td { padding: 6px 10px; border-bottom: 1px solid #21262d; color: #e6edf3; }
.indicator-settings-table select { padding: 4px 8px; background: #161b22; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 12px; cursor: pointer; }
.indicator-settings-table select:focus { outline: none; border-color: #58a6ff; }
.indicator-settings-table input[type="checkbox"] { cursor: pointer; }
.indicator-settings-table input[type="number"] { width: 50px; padding: 4px 6px; background: #161b22; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 12px; }
.indicator-settings-table .ind-name { font-family: monospace; font-size: 12px; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-option { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.fill-between-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.fill-between-row select, .fill-between-row input { padding: 4px 8px; background: #161b22; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 12px; }
.fill-between-row .btn-sm { padding: 4px 10px; background: #21262d; border: 1px solid #30363d; border-radius: 4px; color: #e6edf3; font-size: 12px; cursor: pointer; }
.fill-between-row .btn-sm:hover { background: #30363d; }
.fill-between-row .btn-sm.btn-danger { color: #f85149; }
.fill-between-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid #21262d; }
.fill-between-section label { font-size: 13px; color: #8b949e; font-weight: 500; }
