#backtest { --backtest-surface: linear-gradient(120deg, #16281ed0, #102118d0); --backtest-border: #a7bfad2e; color: #e3e8e2; }
#backtest .backtest-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin-bottom: 24px; }
body.dashboard-wallpaper #backtest .backtest-heading h2 {
  display: inline-block; margin: 0 0 20px; font: 400 clamp(54px, 6.5vw, 88px)/1.08 'Times New Roman', Times, serif; letter-spacing: -2px;
  background: linear-gradient(110deg, #fff 5%, #fff 25%, #edcea2 45%, #ffe3bc 60%, #fff 85%); background-size: 260% 100%; background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: analysis-title-shimmer 7s ease-in-out infinite alternate;
}
#backtest .backtest-intro { max-width: 760px; margin: 0 0 28px; color: #aeb8b2; font-size: 22px; line-height: 1.45; }
#backtest .backtest-categories { display: flex; gap: 12px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
#backtest .backtest-categories .nav-btn { min-width: 130px; padding: 14px 24px; border: 1px solid var(--backtest-border); border-radius: 100px; color: #b4bdb7; background: var(--backtest-surface); font-size: 15px; font-weight: 400; box-shadow: none; }
#backtest .backtest-categories .nav-btn:hover { border-color: #fbd9b080; color: #fbd9b0; }
#backtest .backtest-categories .nav-btn.active { background: #fbd9b0; color: #152017; border-color: #ffe5c4; font-weight: 500; }
#backtest .panel-box { background: var(--backtest-surface); border: 1px solid var(--backtest-border); border-radius: 24px; color: #e3e8e2; padding: 26px; box-shadow: inset 0 1px 0 #ffffff05; }
#backtest .backtest-form { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
#backtest .backtest-form label { color: #aeb8b2; font-weight: 400; font-size: 15px; gap: 10px; }
#backtest .backtest-field-control { display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 14px; background: #091a1270; border: 1px solid #a7bfad40; border-radius: 14px; }
#backtest .backtest-field-control:focus-within { border-color: #fbd9b0; box-shadow: 0 0 0 2px #fbd9b018; }
#backtest .backtest-field-control > svg { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: #fbd9b0; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#backtest .backtest-field-control :is(input, .glass-select-trigger) { color: #edf0eb; background: transparent; border: 0; box-shadow: none; padding: 12px 0; height: auto; min-height: 48px; border-radius: 0; font-size: 16px; font-weight: 400; backdrop-filter: none; outline: none; color-scheme: dark; }
#backtest .backtest-field-control input { flex: 1; min-width: 0; }
#backtest .backtest-field-control .glass-select { flex: 1; min-width: 0; }
#backtest #backtest-run { position: relative; grid-column: 1 / -1; padding: 17px 48px; min-height: 58px; background: #fbd9b0; color: #152017; border: 1px solid #ffe5c4; border-radius: 100px; font-size: 18px; font-weight: 500; transition: transform .2s ease, background .2s ease; }
#backtest #backtest-run:hover:not(:disabled) { background: #ffe5c4; transform: scale(1.01); }
#backtest #backtest-run > span { position: absolute; right: 24px; font-size: 24px; line-height: 1; }
#backtest .backtest-advanced-toggle { margin-top: 24px; padding: 16px 0; width: 100%; text-align: left; background: transparent; border: 0; border-top: 1px solid #a7bfad24; color: #c3cec6; font-size: 15px; }
#backtest #backtest-advanced-toggle::after { content: ''; width: 9px; height: 9px; border-right: 2px solid #fbd9b0; border-bottom: 2px solid #fbd9b0; transform: rotate(45deg); transition: transform .2s ease; flex-shrink: 0; }
#backtest #backtest-advanced-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
#backtest .backtest-note { color: #aeb8b2; font-weight: 400; }
#backtest .backtest-status { color: #fbd9b0; font-weight: 400; }
#backtest .backtest-status.is-error { color: #ff8b83; }
#backtest .backtest-results-title { font: 400 46px/1.2 'Times New Roman', Times, serif; color: #fbd9b0; margin: 32px 0 20px; }
#backtest .backtest-summary { gap: 16px; }
#backtest .backtest-metric { min-width: 0; padding: 22px; transition: border-color .2s ease, transform .2s ease; }
#backtest .backtest-metric:hover { border-color: #fbd9b080; transform: translateY(-2px); }
#backtest .backtest-metric span { color: #aeb8b2; min-height: 2.6em; font-size: 14px; line-height: 1.3; }
#backtest .backtest-metric strong { font-size: 27px; font-weight: 400; color: #edf0eb; }
#backtest :is(.backtest-chart-panel, .backtest-table-panel) h3 { color: #e3e8e2; font-size: 22px; font-weight: 400; letter-spacing: -.3px; }
#backtest .backtest-chart-panel > h3 { border-color: #a7bfad24; }
#backtest .backtest-chart { background: transparent; }
#backtest .backtest-table-scroll { border: 1px solid #a7bfad24; border-radius: 16px; }
#backtest .backtest-table { margin: 0; color: #e3e8e2; }
#backtest .backtest-table thead { background: #fbd9b0d9; }
#backtest .backtest-table th { color: #152017; background: transparent; font-weight: 400; text-transform: none; letter-spacing: 0; }
#backtest .backtest-table td { color: #e3e8e2; border-color: #a7bfad1f; }
#backtest .backtest-table tbody tr:hover { background: #fbd9b008; }
#backtest :is(.backtest-table-panel button, .strategy-admin-fields > button) { color: #152017; background: #fbd9b0; border-color: #ffe5c4; border-radius: 100px; }
#backtest .backtest-pagination { color: #fbd9b0; }
#backtest .backtest-pagination button:disabled { visibility: hidden; }
#backtest .backtest-report pre { color: #c5d0c8; background: #08170f80; border-color: #a7bfad24; }
#backtest :is(.backtest-admin summary, .backtest-report summary) { color: #fbd9b0; }
#backtest :is(.strategy-admin-fields, .backtest-indicator-fields) label { color: #b4bdb7; }
#backtest :is(.strategy-admin-fields input, .strategy-admin-fields textarea, .backtest-indicator-fields input, .strategy-admin-fields .glass-select-trigger) { color: #e3e8e2; background: #091a1270; border-color: #a7bfad40; color-scheme: dark; }
#backtest :is(button, input, select):focus-visible { outline: 2px solid #fbd9b0; outline-offset: 3px; }
#backtest .backtest-field-control input:focus-visible { outline: none; }
body .backtest-select-menu { color: #e3e8e2; background: linear-gradient(145deg, #1c3024ef, #0e2118f5); border-color: #fbd9b04d; box-shadow: 0 14px 40px #0005, inset 0 1px 0 #fff0dc15; }
body .backtest-select-menu .glass-select-option.is-active { background: #fbd9b014; box-shadow: inset 0 0 0 1px #fbd9b050; }
body .backtest-select-menu .glass-select-option[aria-selected="true"] { background: #fbd9b0d9; color: #152017; }
#backtest .modebar-btn path { fill: #aeb8b2; }
@media (max-width: 800px) { #backtest .backtest-form { grid-template-columns: 1fr; } #backtest .backtest-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { #backtest .backtest-intro { font-size: 18px; } #backtest .backtest-categories { width: 100%; gap: 8px; } #backtest .backtest-categories .nav-btn { flex: 1; min-width: 0; padding: 12px; font-size: 13px; } #backtest .panel-box { padding: 18px; } #backtest .backtest-metric strong { font-size: 23px; } #backtest .backtest-results-title { font-size: 38px; } }
@media (prefers-reduced-motion: reduce) { body.dashboard-wallpaper #backtest .backtest-heading h2 { animation: none; } #backtest #backtest-run, #backtest .backtest-metric { transform: none; transition: none; } }
#backtest #backtest-run::after { content: '→'; position: absolute; right: 24px; font-size: 24px; line-height: 1; }
#backtest #backtest-run:disabled::after { content: ''; }
#backtest .backtest-metric-icon { display: grid; place-items: center; width: 40px; height: 40px; color: #fbd9b0; }
#backtest .backtest-metric-icon svg { width: 28px; height: 28px; }
#backtest .backtest-metric .pnl-positive,
#backtest .backtest-metric .pnl-negative { color: #edf0eb !important; }
#backtest .backtest-field-control .glass-date { flex: 1; min-width: 0; }
#backtest .backtest-field-control .glass-date-trigger { min-height: 48px; padding: 12px 0; border: 0; border-radius: 0; color: #edf0eb; background: transparent; box-shadow: none; backdrop-filter: none; font-size: 16px; }
#backtest .backtest-field-control .glass-date-trigger > svg { display: none; }
#backtest .backtest-field-control .glass-date-trigger:hover { color: #fbd9b0; background: transparent; }
body .glass-date-panel { background: #14271cf5; color: #e3e8e2; border-color: #fbd9b066; box-shadow: 0 16px 55px #0005, inset 0 1px 0 #fff0dc15; }
body .glass-date-panel button { color: #e3e8e2; }
body .glass-date-panel button:hover:not(:disabled) { background: #fbd9b018; }
body .glass-date-panel input { background: #091a1270; border-color: #a7bfad40; color: #e3e8e2; }
body .glass-date-panel .glass-date-weekdays { color: #aeb8b2; }
body .glass-date-panel .glass-date-grid button[aria-pressed="true"], body .glass-date-panel .date-apply { background: #fbd9b0; color: #152017; }
body .glass-date-panel :is(button, input):focus-visible { outline-color: #fbd9b0; }
#backtest #backtest-advanced-toggle {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin: 0;
  padding: 16px 18px; min-height: 54px; border: 1px solid #fbd9b066; border-radius: 16px;
  color: #e3e8e2; background: #1b302480; box-shadow: inset 0 1px 0 #fff0dc12;
  transition: background .2s ease, border-color .2s ease;
}
#backtest #backtest-advanced-toggle[hidden] { display: none; }
#backtest #backtest-advanced-toggle::after { margin-left: auto; float: none; font-size: 18px; }
#backtest #backtest-advanced-toggle:hover:not(:disabled) { background: #fbd9b014; border-color: #fbd9b0; }
#backtest #backtest-advanced { grid-column: 1 / -1; }
#backtest .backtest-results-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
#backtest .backtest-results-heading .backtest-results-title { margin: 0; }
#backtest .backtest-inflation-toggle { min-height: 42px; padding: 10px 16px; border: 1px solid #fbd9b080; border-radius: 12px; background: #223c2cb3; color: #fbd9b0; font: inherit; font-size: var(--type-label); text-transform: none; letter-spacing: 0; cursor: pointer; transition: background .2s ease, color .2s ease; }
#backtest .backtest-inflation-toggle[aria-pressed="true"] { background: #fbd9b0; color: #152017; }
#backtest .backtest-inflation-toggle:hover:not(:disabled) { border-color: #ffe5c4; box-shadow: inset 0 1px 0 #fff4e240; }
#backtest .backtest-inflation-toggle:focus-visible { outline: 2px solid #fbd9b0; outline-offset: 3px; }
#backtest .backtest-inflation-toggle[hidden] { display: none; }

.ema-search-results { margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(250,215,172,.16); min-width: 0; }
.ema-search-results h3 { margin: 0 0 12px; }
.ema-search-results label { max-width: 260px; margin-bottom: 16px; }
.ema-search-results .backtest-table { min-width: 720px; }
.ema-search-results button { white-space: nowrap; padding: 8px 16px; }
.ema-admin-editor { margin-bottom: 24px; }
.ema-admin-editor summary { cursor: pointer; color: var(--accent, #fad7ac); }
#ema-admin-form { display: grid; gap: 16px; margin-top: 20px; }
#ema-admin-form label { display: grid; gap: 8px; min-width: 0; }
#ema-admin-form textarea { width: 100%; box-sizing: border-box; resize: vertical; padding: 14px; color: #e3e8e3; background: #0d2118; border: 1px solid rgba(250,215,172,.28); border-radius: 14px; font: 13px/1.55 monospace; }

#backtest #backtest-indicator-reset,
#backtest #backtest-ema-search,
#backtest #backtest-ema-cancel {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 48px; margin-top: 14px; padding: 12px 20px;
  border: 1px solid rgba(251,217,176,.5); border-radius: 16px;
  background: rgba(251,217,176,.075); color: #fbd9b0;
  font-weight: 500; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(251,217,176,.08);
  transition: background .2s ease, border-color .2s ease;
}
#backtest #backtest-ema-search { background: rgba(251,217,176,.15); border-color: rgba(251,217,176,.7); }
#backtest #backtest-indicator-reset:hover:not(:disabled),
#backtest #backtest-ema-search:hover:not(:disabled),
#backtest #backtest-ema-cancel:hover:not(:disabled) { background: rgba(251,217,176,.22); border-color: #fbd9b0; }
#backtest #backtest-ema-cancel[hidden] { display: none; }
#backtest #backtest-ema-cancel { background: transparent; }
#backtest #backtest-ema-search[hidden] { display: none; }

/* EMA results share the platform's green surfaces and peach controls. */
#backtest .ema-search-results { padding-top: 24px; }
#backtest .ema-search-results > label { display: grid; gap: 8px; width: min(100%, 240px); max-width: none; }
#backtest .ema-search-results .glass-select { width: 100%; }
#backtest .ema-search-results .glass-select-trigger {
  min-height: 44px; padding: 11px 16px; border-radius: 14px;
  color: #fbd9b0; background: #10251b; border: 1px solid #fbd9b052;
  box-shadow: inset 0 1px 0 #fff0dc08; font-size: 14px; font-weight: 500;
  text-shadow: none; backdrop-filter: none;
}
#backtest .ema-search-results .glass-select-trigger:hover:not(:disabled),
#backtest .ema-search-results .glass-select-trigger[aria-expanded="true"] { background: #1a3023; border-color: #fbd9b099; }
#backtest .ema-search-results .backtest-table-scroll { background: #0c1e1540; border-color: #fbd9b024; }
#backtest .ema-search-results .backtest-table { width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
#backtest .ema-search-results .backtest-table thead { background: #fbd9b014; }
#backtest .ema-search-results .backtest-table th { color: #fbd9b0; padding: 14px 16px; font-size: 12px; line-height: 1.45; white-space: normal; border-bottom: 1px solid #fbd9b026; }
#backtest .ema-search-results .backtest-table td { padding: 13px 16px; line-height: 1.45; border-color: #a7bfad1c; }
#backtest .ema-search-results .backtest-table td:first-child { color: #edf0eb; }
#backtest .ema-search-results .backtest-table td:last-child { width: 1%; }
#backtest .ema-search-results .ema-apply-button {
  min-height: 36px; padding: 8px 16px; border-radius: 100px;
  color: #fbd9b0; background: #fbd9b012; border: 1px solid #fbd9b066;
  font: inherit; font-weight: 500; white-space: nowrap; box-shadow: inset 0 1px 0 #fff0dc08;
  cursor: pointer; transition: background .18s ease, border-color .18s ease, color .18s ease;
}
#backtest .ema-search-results .ema-apply-button:hover:not(:disabled) { color: #152017; background: #fbd9b0; border-color: #ffe5c4; }
#backtest .ema-search-results .ema-apply-button:disabled { opacity: .5; cursor: default; }
@media (max-width: 520px) {
  #backtest .ema-search-results .backtest-table { font-size: 13px; }
  #backtest .ema-search-results .backtest-table :is(th, td) { padding: 12px; }
}
