/* ── Layout ── */
#box_strategies {
  margin-top: 32px;
  margin-bottom: 32px;
}

/* ── Header ── */
#strat_header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

#strat_name {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid var(--color-greyLight);
  border-radius: 10px;
  padding: 0px 12px;
  background: var(--color-white);
  cursor: pointer;
  height: 40px;
}

#strategySelect {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-black);
  background: transparent;
  cursor: pointer;
  outline: none;
  width: 240px;
  overflow-x: hidden;
  background-image: url(/static/img/icon_arrow.png);
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 12px auto;
  padding-right: 24px;
}

#strat_tabs {
  display: flex;
  background: #ebebeb;
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
  height: 40px;
}

.strat-tab {
  padding: 6px 18px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-greyDark);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.strat-tab:hover {
  color: var(--color-black);
}

.strat-tab.active {
  background: var(--color-white);
  color: var(--color-black);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ── Empty state ── */
#strat_empty {
  padding: 360px 0;
  text-align: center;
  color: var(--color-greyMedium);
  font-size: 14px;
}

/* ── Live chart ── */
#live_loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 640px;
}

.live-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-greyLight);
  border-top-color: #ff9960;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#box_live_chart {
  background: var(--color-white);
  border: 1px solid var(--color-greyLight);
  border-radius: 16px;
  overflow: hidden;
}

.chart-pane {
  position: relative;
}

.chart-pane-label {
  position: absolute;
  top: 6px;
  left: 12px;
  font-size: 11px;
  color: var(--color-greyMedium);
  z-index: 2;
  pointer-events: none;
}

/* ── Performance ── */
#box_pnl_chart {
  background: var(--color-white);
  border: 1px solid var(--color-greyLight);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  height: 480px;
  padding: 24px;
  box-sizing: border-box;
}

#box_performance {
  background: var(--color-white);
  border: 1px solid var(--color-greyLight);
  border-radius: 16px;
  overflow: hidden;
  padding: 24px;
}

#perf_table {
  width: 100%;
  border-collapse: collapse;
}

#perf_table th {
  text-align: right;
  padding: 10px 20px;
  font-size: 12px;
  color: var(--color-greyMedium);
  font-weight: 600;
  border-bottom: 1px solid var(--color-greyLight);
}

#perf_table th:first-child {
  text-align: left;
}

#perf_table td {
  padding: 14px 20px;
  font-size: 14px;
  color: var(--color-black);
  border-bottom: 1px solid var(--color-greyLight);
  text-align: right;
}

#perf_table td.metric-name {
  text-align: left;
  color: var(--color-greyDark);
  font-size: 14px;
}

#perf_table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Code ── */
#box_code {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  padding: 24px;
}

#code_display {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: #333;
  overflow-x: auto;
  white-space: pre;
  font-family: "JetBrains Mono", "Fira Code", "Menlo", "Courier New", monospace;
  max-height: 600px;
  overflow-y: auto;
}

/* ── RWD ── */
@media (max-width: 1300px) {
  #box_strategies {
    margin-top: 0px;
  }

  #strategySelect {
    width: 324px;
  }

  #box_pnl_chart {
    height: 360px;
  }
}

@media (max-width: 768px) {
  #box_pnl_chart {
    height: 320px;
    padding: 12px;
  }

  #box_performance {
    padding: 12px;
  }

  #box_code {
    padding: 12px;
  }
}
