.backtest-workspace {
  max-width: 1376px;
}
.backtest-workspace .heading-band {
  padding: 28px 0 22px;
  align-items: center;
}
.backtest-workspace .heading-band h1 {
  font-size: 26px;
}
.model-status {
  font-size: 11px;
  color: #716022;
  background: #f2eedb;
  padding: 5px 9px;
  border-radius: 3px;
  white-space: nowrap;
}
.investment-warning {
  display: flex;
  gap: 12px;
  background: #fbf6e9;
  border-block: 1px solid #eadcba;
  padding: 14px 18px;
  margin: 20px 0;
  color: #67521c;
  font-size: 12px;
}
.investment-warning svg {
  width: 19px;
  height: 19px;
  flex: none;
  margin-top: 2px;
}
.investment-warning strong {
  font-weight: 650;
}
.investment-warning p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.8;
}
.backtest-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 34px;
  padding: 0 0 36px;
}
.parameters {
  border-right: 1px solid var(--line);
  padding-right: 25px;
  min-width: 0;
}
.parameter-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.parameter-section:first-child {
  padding-top: 4px;
}
.parameter-section h2,
.results-section h2 {
  font-size: 16px;
  margin: 0 0 16px;
  font-weight: 650;
}
.parameter-section .section-heading h2,
.results-section .section-heading h2 {
  margin: 0;
}
.parameter-section .section-heading {
  margin-bottom: 14px;
}
.segmented {
  display: flex;
  gap: 3px;
  background: #e9eeea;
  border-radius: 5px;
  padding: 3px;
  height: 38px;
}
.segmented button {
  border: 0;
  color: var(--muted);
  background: transparent;
  flex: 1;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}
.segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 3px #163e1914;
}
.model-detail {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  margin: 10px 0 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
  margin-top: 12px;
}
.field input,
.field select {
  height: 36px;
  min-width: 0;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid #cbd7ce;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.field input:disabled {
  background: #edf1ee;
  color: #6d7b72;
}
.duration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.parameter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 10px;
}
.parameter-grid .field {
  margin-top: 10px;
}
.run-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.run-button {
  height: 38px;
  background: var(--green);
  color: #fff;
  border: 1px solid var(--green);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 12px;
  font-weight: 600;
}
.run-button:hover {
  background: #115239;
}
.run-button svg,
.icon-button svg {
  width: 16px;
  height: 16px;
}
.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd7ce;
  border-radius: 4px;
  background: #fff;
  color: var(--green);
  flex: none;
}
.run-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.advanced-parameters summary,
.secondary-metrics summary,
.trade-details summary,
.model-disclosure summary {
  font-size: 12px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 550;
}
.advanced-parameters summary {
  font-size: 13px;
}
.checkbox-list {
  display: grid;
  gap: 9px;
  margin-top: 15px;
}
.checkbox-list label,
.checkbox-line {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  font-size: 11px;
  color: var(--muted);
}
input[type="checkbox"] {
  accent-color: var(--green);
  flex: none;
  margin-top: 3px;
}
.checkbox-line {
  margin-top: 15px;
}
.research-output {
  min-width: 0;
}
.results-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.results-section:first-child {
  padding-top: 4px;
}
.results-section .section-heading {
  margin-bottom: 17px;
}
.headline-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  min-height: 78px;
}
.headline-metrics .metric {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}
.headline-metrics .metric:last-child {
  border-right: 0;
}
.metric .name {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.metric .val {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.5;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric .val.positive {
  color: var(--green);
}
.metric .val.negative {
  color: #ac3c43;
}
.secondary-metrics {
  margin-top: 15px;
}
.secondary-metrics summary {
  font-size: 11px;
  color: var(--muted);
}
.other-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.other-metrics .val {
  font-size: 16px;
}
.data-source {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.8;
  margin-top: 15px;
  overflow-wrap: anywhere;
}
.chart-toolbar {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.chart-toolbar button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 0 0 10px;
}
.chart-toolbar button[aria-selected="true"] {
  border-bottom-color: var(--green);
  color: var(--green);
  font-weight: 600;
}
.chart-section canvas {
  display: block;
  width: 100%;
  height: 320px;
  max-width: 100%;
}
.table-scroll {
  overflow: auto;
  max-width: 100%;
  overscroll-behavior-x: contain;
  border-top: 1px solid var(--line);
}
.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.table-scroll th {
  text-align: right;
  font-weight: 550;
  color: var(--muted);
  background: #edf2ee;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
}
.table-scroll td {
  text-align: right;
  padding: 11px;
  border-bottom: 1px solid var(--line);
}
.table-scroll th:first-child,
.table-scroll td:first-child {
  text-align: left;
}
.table-scroll tbody tr:hover {
  background: #edf3ef;
}
.positive {
  color: var(--green);
}
.negative {
  color: #ac3c43;
}
.trades {
  max-height: 420px;
  margin-top: 15px;
}
.trades th {
  position: sticky;
  top: 0;
}
.trades td:last-child {
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trade-details summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.trade-details summary:before {
  content: "▸";
  margin-right: 8px;
}
.trade-details[open] summary:before {
  content: "▾";
}
.trade-details summary span {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  margin-left: auto;
}
.model-disclosure ul {
  padding-left: 20px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
}
.model-disclosure li {
  margin: 7px 0;
}
.status-message {
  padding: 11px 14px;
  margin-bottom: 18px;
  background: #fceef0;
  border-left: 3px solid #ac3c43;
  color: #87343c;
  font-size: 12px;
}
.status-message[data-state="loading"] {
  background: #eef4ef;
  border-color: #16674a;
  color: #16674a;
}
nav a[aria-current="page"] {
  color: var(--green);
  font-weight: 600;
}
.backtest-workspace button:hover:not(:disabled) {
  filter: brightness(0.96);
}
@media (max-width: 1100px) {
  .backtest-layout {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 24px;
  }
  .parameters {
    padding-right: 20px;
  }
  .headline-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .headline-metrics .metric:nth-child(2) {
    border-right: 0;
  }
  .other-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .backtest-workspace .heading-band {
    padding: 24px 0 18px;
    align-items: flex-start;
  }
  .backtest-workspace .heading-band h1 {
    font-size: 24px;
  }
  .model-status {
    display: inline-block;
    margin-top: 12px;
  }
  .investment-warning {
    padding: 12px;
    margin: 16px 0 22px;
    gap: 9px;
  }
  .investment-warning p {
    font-size: 11px;
  }
  .backtest-layout {
    display: block;
  }
  .parameters {
    border-right: 0;
    padding-right: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 22px;
  }
  .parameter-section:first-child {
    grid-column: 1/-1;
  }
  .parameter-section {
    padding: 18px 0;
  }
  .parameter-grid {
    display: block;
  }
  .parameter-section:first-child .field {
    margin-top: 10px;
  }
  .research-output {
    margin-top: 24px;
  }
  .chart-section canvas {
    height: 280px;
  }
  .results-section .section-note {
    display: block;
    font-size: 10px;
  }
  .other-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .headline-metrics .val {
    font-size: 23px;
  }
  .backtest-workspace .section-heading {
    gap: 8px;
  }
  .chart-toolbar {
    gap: 20px;
  }
  .backtest-workspace footer {
    gap: 12px;
  }
}
@media (max-width: 380px) {
  .parameters {
    grid-template-columns: 1fr;
  }
  .parameter-grid {
    display: grid;
  }
  .parameter-section:first-child {
    grid-column: auto;
  }
  .headline-metrics .val {
    font-size: 21px;
  }
  .investment-warning strong {
    font-size: 11px;
  }
}
.parameter-drawer {
  min-width: 0;
}
.parameter-drawer > summary {
  display: none;
}
@media (max-width: 760px) {
  .parameter-drawer > summary {
    display: list-item;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .parameter-drawer[open] > summary {
    margin-bottom: 16px;
  }
}
