:root {
  color-scheme: dark;
  --bg: #0b111c;
  --panel: #111b2a;
  --panel2: #152133;
  --line: #25344a;
  --text: #e4edf7;
  --muted: #8d9eb4;
  --gold: #d7b77b;
  --teal: #59c8b1;
  --purple: #b599e7;
  --red: #ee8994;
  --blue: #79abef;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.5 -apple-system,
    BlinkMacSystemFont,
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
select,
input {
  outline-offset: 3px;
}
button,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #142034;
}
button {
  padding: 8px 12px;
  cursor: pointer;
  min-height: 36px;
}
button:hover {
  border-color: #61748f;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #181b20;
  font-weight: 650;
}
button.small {
  padding: 4px 9px;
  min-height: 30px;
  font-size: 12px;
}
.top {
  height: 62px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  background: #101a28;
  border-bottom: 1px solid var(--line);
}
.brand {
  background: var(--gold);
  color: #1d2430;
  font-weight: 800;
  padding: 5px 7px;
  border-radius: 4px;
}
.brand-name {
  font-weight: 650;
  letter-spacing: 0.3px;
}
.crumb {
  color: var(--muted);
  margin-left: 14px;
}
.prototype-tag {
  margin-left: auto;
  color: #dac38e;
  background: #302a1d;
  border: 1px solid #625333;
  border-radius: 4px;
  font-size: 12px;
  padding: 4px 9px;
}
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 62px);
}
aside {
  background: #0f1826;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
}
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  margin: 0 0 7px;
}
h1 {
  font-size: 24px;
  margin: 0 0 6px;
  letter-spacing: 0.3px;
}
h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 650;
}
h3 {
  font-size: 13px;
  margin: 0;
  font-weight: 550;
}
.muted {
  color: var(--muted);
}
.small-text {
  font-size: 12px;
}
.field {
  margin-top: 22px;
}
.field-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
select {
  width: 100%;
  padding: 10px 11px;
}
.dataset-info {
  display: block;
  font-size: 11px;
  line-height: 1.8;
  margin-top: 8px;
  color: var(--muted);
}
.dataset-info span {
  display: block;
}
.selected-period {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.search {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c1521;
  color: var(--text);
}
.selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}
.selection-actions button {
  flex: 1 1 calc(50% - 4px);
  white-space: nowrap;
  min-width: 0;
}
.symbol-list {
  height: 262px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px;
  background: #0c1521;
}
.symbol-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 6px;
  cursor: pointer;
  border-radius: 4px;
}
.symbol-item:hover {
  background: #19283b;
}
.symbol-item input {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
}
.symbol-item strong {
  font-weight: 550;
  font-size: 13px;
}
.symbol-item span:last-child {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.symbol-item .has-trade {
  color: var(--teal) !important;
}
.config-rule {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.config-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  margin-top: 9px;
}
.config-row span:first-child {
  color: var(--muted);
}
.run-button {
  width: 100%;
  margin-top: 24px;
  height: 42px;
}
.prototype-note {
  font-size: 11px;
  line-height: 1.8;
  color: #8d9aab;
  margin: 10px 0 0;
}
.main {
  padding: 23px 26px 34px;
  min-width: 0;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.status {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.status b {
  color: var(--teal);
  font-weight: 500;
}
.notice {
  font-size: 12px;
  background: #172233;
  border: 1px solid #2a3c55;
  color: #a8b8cd;
  padding: 9px 12px;
  border-radius: 5px;
  margin-top: 18px;
}
.notice.dirty {
  border-color: #675b3b;
  color: #dcc58f;
  background: #252219;
}
.section-tabs {
  display: flex;
  gap: 23px;
  margin: 18px 0 17px;
  border-bottom: 1px solid var(--line);
}
.section-tabs a {
  color: var(--muted);
  padding: 9px 0;
  text-decoration: none;
  font-size: 13px;
}
.section-tabs a:first-child {
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.metric {
  padding: 16px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 123px;
}
.metric .label {
  font-size: 12px;
  color: var(--muted);
}
.metric strong {
  font-size: 26px;
  display: block;
  letter-spacing: 0.3px;
  margin: 6px 0 3px;
  font-variant-numeric: tabular-nums;
}
.metric .comparison {
  font-size: 11px;
  color: var(--purple);
}
.positive {
  color: var(--teal);
}
.negative {
  color: var(--red);
}
.metric-help {
  font-size: 10px;
  color: #78899f;
  margin-top: 5px;
}
.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 17px 18px;
  min-width: 0;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.legend {
  display: flex;
  gap: 13px;
  color: var(--muted);
  font-size: 11px;
}
.legend span:before {
  content: '';
  display: inline-block;
  width: 15px;
  border-top: 2px solid;
  vertical-align: middle;
  margin-right: 5px;
}
.legend .human {
  color: var(--teal);
}
.legend .system {
  color: var(--purple);
}
.legend .system:before {
  border-top-style: dashed;
}
.equity {
  height: 230px;
  position: relative;
}
.equity svg {
  width: 100%;
  height: 100%;
  display: block;
}
.equity-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  font-size: 12px;
  gap: 6px;
}
.equity-empty strong {
  font-weight: 500;
  color: var(--text);
  font-size: 15px;
}
.equity-foot {
  color: var(--muted);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.mix-row {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.mix-row:last-child {
  border-bottom: 0;
}
.mix-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.mix-line span:last-child {
  font-variant-numeric: tabular-nums;
}
.mix-bar {
  height: 4px;
  border-radius: 3px;
  background: #223147;
  margin: 9px 0 5px;
  overflow: hidden;
}
.mix-bar i {
  height: 100%;
  display: block;
  background: var(--gold);
  border-radius: 3px;
}
.mix-small {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.run-meta {
  display: flex;
  gap: 23px;
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
.run-meta b {
  font-weight: 500;
  color: #bdcadb;
}
.trade-section {
  margin-top: 22px;
}
.trade-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.trade-section-title > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.count-pill {
  padding: 2px 8px;
  border: 1px solid #35445a;
  border-radius: 20px;
  color: var(--muted);
  font-size: 11px;
}
.replay-layout {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  gap: 14px;
}
.trade-table-wrap {
  padding: 0;
  overflow: hidden;
}
.table-scroll {
  max-height: 455px;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  background: #162235;
  color: var(--muted);
  font-size: 11px;
  font-weight: 450;
}
th,
td {
  text-align: right;
  padding: 10px 12px;
  border-bottom: 1px solid #223047;
}
th:first-child,
td:first-child {
  text-align: left;
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover {
  background: #18273b;
}
tbody tr.selected {
  background: #1c2c40;
  border-left: 2px solid var(--gold);
}
td strong {
  font-weight: 600;
}
td small {
  font-size: 10px;
  color: var(--muted);
  display: block;
}
.direction {
  font-size: 10px;
  padding: 2px 5px;
  background: #203b39;
  color: var(--teal);
  border-radius: 3px;
}
.direction.down {
  background: #3d2830;
  color: #e9a2ab;
}
.detail {
  padding-bottom: 12px;
}
.detail-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.detail-title {
  font-size: 14px;
}
.detail-caption {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}
.layers {
  display: flex;
  gap: 4px;
  align-items: flex-start;
}
.layers button {
  font-size: 11px;
  min-height: 27px;
  padding: 4px 8px;
}
.layers button.active {
  background: #30425b;
  border-color: #617b9d;
  color: #e9eff7;
}
.chart-shell {
  height: 267px;
  position: relative;
  margin-top: 10px;
  background: #0d1725;
  border: 1px solid #213149;
  border-radius: 4px;
  overflow: hidden;
}
.chart-shell canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
.chart-readout {
  font-size: 10px;
  color: var(--muted);
  min-height: 18px;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.chart-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.chart-controls span {
  margin-right: auto;
  font-size: 10px;
  color: var(--muted);
}
.chart-controls button {
  font-size: 11px;
  padding: 3px 8px;
  min-height: 26px;
}
.events {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  max-height: 117px;
  overflow: auto;
}
.event {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 9px;
  font-size: 11px;
  padding: 4px 0;
  color: #a3b4ca;
}
.event b {
  font-weight: 450;
  font-variant-numeric: tabular-nums;
}
.event-label {
  color: #c8d6e7;
}
.event.replay .event-label {
  color: var(--teal);
}
.empty-row {
  padding: 30px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.empty-detail {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 365px;
  flex-direction: column;
  color: var(--muted);
  gap: 8px;
}
.empty-detail strong {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}
.footnote {
  margin-top: 16px;
  color: #72849d;
  font-size: 11px;
  line-height: 1.8;
}
.report-source {
  font-size: 11px;
  color: #7c8ea6;
  text-decoration: none;
}
.report-source:hover {
  color: var(--blue);
}
.screen-reader {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
[hidden] {
  display: none !important;
}
@media (min-width: 1800px) {
  .replay-layout {
    grid-template-columns: 420px minmax(0, 1fr);
  }
}
@media (max-width: 1250px) {
  .layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  aside {
    padding: 21px 14px;
  }
  .main {
    padding: 21px 18px;
  }
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .replay-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .table-scroll {
    max-height: 240px;
  }
  .chart-shell {
    height: 320px;
  }
  .detail-heading {
    margin-top: 0;
  }
}
@media (max-width: 900px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .groups {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .mix-row {
    padding: 10px 0;
    border: 0;
  }
  .page-heading {
    align-items: flex-start;
  }
  .status {
    font-size: 11px;
    max-width: 150px;
  }
  .top {
    padding: 0 18px;
  }
  .crumb {
    display: none;
  }
  .prototype-tag {
    font-size: 10px;
  }
  .metric strong {
    font-size: 23px;
  }
}
@media (max-width: 680px) {
  .top {
    height: 55px;
    padding: 0 12px;
    gap: 9px;
  }
  .brand-name {
    font-size: 12px;
  }
  .prototype-tag {
    padding: 3px 6px;
  }
  .layout {
    display: block;
  }
  .main {
    padding: 19px 12px;
  }
  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px 12px;
  }
  .field {
    margin-top: 13px;
  }
  .symbol-list {
    height: 145px;
  }
  .config-rule {
    display: none;
  }
  .run-button {
    margin-top: 13px;
  }
  .prototype-note {
    margin: 7px 0 0;
  }
  .page-heading h1 {
    font-size: 21px;
  }
  .page-heading {
    gap: 10px;
  }
  .status {
    max-width: 110px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .metric {
    padding: 13px 12px;
    min-height: 113px;
  }
  .metric strong {
    font-size: 24px;
  }
  .metric-help {
    font-size: 10px;
  }
  .notice {
    margin-top: 13px;
  }
  .panel {
    padding: 14px 12px;
  }
  .chart-grid {
    gap: 10px;
  }
  .panel-heading {
    align-items: flex-start;
  }
  .legend {
    gap: 10px;
    font-size: 10px;
  }
  .groups {
    display: block;
  }
  .mix-row {
    border-bottom: 1px solid var(--line);
  }
  .equity {
    height: 220px;
  }
  .trade-section-title {
    gap: 8px;
  }
  .trade-section-title > div {
    gap: 8px;
  }
  .report-source {
    font-size: 10px;
  }
  .detail-heading {
    display: block;
  }
  .layers {
    margin-top: 9px;
  }
  .chart-shell {
    height: 280px;
  }
  .run-meta {
    gap: 8px 17px;
  }
  .footnote {
    font-size: 10px;
  }
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #181b2040;
  border-top-color: #181b20;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 7px;
  vertical-align: -2px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.chart-pan {
  width: 135px;
  max-width: 25%;
  accent-color: var(--gold);
}
.replay-layout.expanded {
  grid-template-columns: 1fr;
}
.replay-layout.expanded .table-scroll {
  max-height: 185px;
}
.replay-layout.expanded .chart-shell {
  height: 560px;
}
.detail-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.detail-tools button {
  font-size: 11px;
  min-height: 29px;
  padding: 4px 8px;
}
.validation-source {
  font-size: 11px;
  color: var(--muted);
  padding-top: 7px;
}
.chart-readout {
  overflow-wrap: anywhere;
}
.chart-controls {
  flex-wrap: wrap;
}
.chart-controls .range-label {
  margin-right: 0;
}
.chart-controls .chart-pan {
  margin-right: 0;
}
.chart-empty-note {
  padding: 25px 0;
  color: var(--muted);
  font-size: 12px;
}
.events .event {
  cursor: pointer;
}
.events .event:hover {
  background: #192638;
}
@media (max-width: 680px) {
  .replay-layout.expanded .chart-shell {
    height: 430px;
  }
  .chart-pan {
    width: 100%;
    max-width: 100%;
  }
  .detail-tools {
    margin-top: 9px;
  }
  .status {
    max-width: 140px;
  }
}
.validation-progress {
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}
.validation-progress::before {
  content: '';
  display: block;
  width: 30%;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  animation: validation-sweep 1s ease-in-out infinite;
}
@keyframes validation-sweep {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(335%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .validation-progress::before,
  .spinner {
    animation: none;
  }
}

.back-link {
  margin-left: auto;
  color: var(--gold);
  text-decoration: none;
  padding: 6px 0;
}
.back-link:hover {
  text-decoration: underline;
}
.dataset-info strong {
  color: var(--text);
  display: block;
  font-weight: 500;
}
