/* SPX 0DTE Backtests dashboard.
 *
 * Reuses the KPI-card look from trade-export-preview.css and the theme CSS
 * variables from style.css so the page tracks light/dark mode automatically.
 */

/* style.css (shared with the SPA) locks `body { height:100vh; overflow:hidden }`
   so the single-page chat never scrolls. This standalone page IS a normal
   scrolling document, so undo that lock (backtests.css loads after style.css,
   so this equal-specificity override wins). */
body {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

.backtests-page { padding: 0 1.25rem 2rem; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.kpi-card {
  background: var(--bg-tertiary, #1a1a1a);
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  opacity: 0.7;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.backtests-table {
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
}

.backtests-table thead th {
  white-space: nowrap;
  user-select: none;
}

.backtests-table td,
.backtests-table th {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

/* Sign-aware P/L coloring, driven off theme accent + a red var fallback. */
.pl-pos { color: var(--accent-color, #2ea043); }
.pl-neg { color: var(--danger-color, #e5534b); }

/* Distribution / risk-return chart grid. */
.backtests-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 0.75rem;
}

.chart-box {
  background: var(--bg-tertiary, #1a1a1a);
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.chart-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  opacity: 0.75;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.chart-plot {
  width: 100%;
  height: 300px;
}

/* Active table filter chip (set by clicking a risk/return point). */
.table-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-color, #2ea043);
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-weight: 600;
}

.filter-chip button {
  background: transparent;
  border: 0;
  color: #fff;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
}

.chart-plot { cursor: pointer; }

/* Glossary / data-dictionary at the bottom of the page. */
.backtests-glossary {
  margin-top: 2rem;
  border-top: 1px solid var(--border-color, #333);
  padding-top: 1rem;
}

.backtests-glossary h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.backtests-glossary .caveat {
  background: var(--bg-tertiary, #1a1a1a);
  border: 1px solid var(--border-color, #333);
  border-left: 3px solid var(--warning-color, #d29922);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.backtests-glossary dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.85rem;
  margin: 0;
}

.backtests-glossary dt {
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-primary);
}

.backtests-glossary dd {
  margin: 0;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .backtests-glossary dl { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .backtests-glossary dt { margin-top: 0.5rem; }
}


