.rotation-research-root {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 22px;
}

.rotation-research-card,
.rotation-panel,
.rotation-chart,
.rotation-metric,
.rotation-empty {
  min-width: 0;
  box-sizing: border-box;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e6e8f1);
  border-radius: 16px;
  box-shadow: 0 8px 26px rgba(25, 30, 60, .055);
}

.rotation-research-card {
  padding: 22px;
  border-top: 4px solid #7c3aed;
}

.rotation-research-head,
.rotation-panel-head,
.rotation-chart-head,
.rotation-run-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.rotation-research-head h2,
.rotation-panel-head h3 {
  margin: 4px 0 6px;
  color: var(--text-primary, #17192b);
}

.rotation-research-head p,
.rotation-panel-head p {
  margin: 0;
  color: var(--text-secondary, #73788c);
  line-height: 1.65;
}

.rotation-research-kicker {
  color: #7c3aed;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rotation-safety-badge {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(16, 185, 129, .12);
  color: #059669;
  font-size: 12px;
  font-weight: 800;
}

.rotation-safety-strip,
.rotation-gates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rotation-safety-strip {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(16, 185, 129, .065);
}

.rotation-safety-strip span,
.rotation-gates span {
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.rotation-safety-strip span,
.rotation-gates .pass {
  color: #047857;
  background: rgba(16, 185, 129, .11);
}

.rotation-gates .fail {
  color: #dc2626;
  background: rgba(239, 68, 68, .11);
}

.rotation-flow {
  display: grid;
  grid-template-columns: repeat(11, auto);
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0;
  padding: 14px;
  overflow-x: auto;
  border: 1px solid rgba(124, 58, 237, .15);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, .045), rgba(16, 185, 129, .04));
}

.rotation-flow div {
  min-width: 96px;
  text-align: center;
}

.rotation-flow strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: #7c3aed;
  color: #fff;
  font-size: 12px;
}

.rotation-flow span {
  color: var(--text-primary, #25283c);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.rotation-flow i {
  color: #a78bfa;
  font-style: normal;
}

.rotation-control-grid {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(180px, .7fr);
  gap: 14px;
  align-items: end;
}

.rotation-control-grid label,
.rotation-advanced-grid label {
  display: grid;
  gap: 7px;
}

.rotation-control-grid label > span,
.rotation-advanced-grid label > span {
  color: var(--text-secondary, #73788c);
  font-size: 12px;
  font-weight: 700;
}

.rotation-advanced {
  grid-column: 1 / -1;
  padding: 11px 13px;
  border: 1px solid var(--border, #e6e8f1);
  border-radius: 12px;
}

.rotation-advanced summary {
  color: #7c3aed;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.rotation-advanced-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 13px;
}

.rotation-run-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.rotation-preset-note {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  color: var(--text-secondary, #73788c);
  font-size: 12px;
}

.rotation-preset-note strong {
  color: #7c3aed;
}

.rotation-empty {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 22px;
  place-content: center;
  text-align: center;
  color: var(--text-secondary, #73788c);
}

.rotation-empty strong {
  color: var(--text-primary, #25283c);
}

.rotation-empty.loading {
  border-color: rgba(124, 58, 237, .35);
}

.rotation-empty.completed {
  min-height: 64px;
  border-color: rgba(16, 185, 129, .35);
  background: rgba(16, 185, 129, .045);
}

.rotation-empty.error {
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .045);
}

#rotationResearchResult {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.rotation-run-meta {
  flex-wrap: wrap;
  padding: 0 4px;
  color: var(--text-secondary, #73788c);
  font-size: 11px;
}

.rotation-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.rotation-metric {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 17px;
  border-top: 3px solid #10b981;
}

.rotation-metric span,
.rotation-metric small {
  color: var(--text-secondary, #73788c);
  font-size: 12px;
}

.rotation-metric strong {
  color: var(--text-primary, #17192b);
  font-size: clamp(19px, 2vw, 28px);
}

.rotation-metric.hero {
  border-top-color: #7c3aed;
  background: linear-gradient(145deg, rgba(124, 58, 237, .085), var(--card-bg, #fff));
}

.rotation-metric.hero.good strong { color: #059669; }
.rotation-metric.hero.warn strong { color: #d97706; }
.rotation-metric.hero.bad strong,
.rotation-metric.loss strong { color: #dc2626; }

.rotation-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.rotation-chart {
  padding: 15px;
}

.rotation-chart-head strong {
  color: var(--text-primary, #17192b);
  font-size: 13px;
}

.rotation-chart-head span {
  color: var(--text-secondary, #73788c);
  font-size: 12px;
}

.rotation-chart svg {
  display: block;
  width: 100%;
  height: 175px;
  margin-top: 10px;
  border-radius: 9px;
  background-image:
    linear-gradient(rgba(130, 135, 155, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(130, 135, 155, .08) 1px, transparent 1px);
  background-size: 25% 25%;
}

.rotation-panel {
  padding: 18px;
}

.rotation-gates {
  margin: 14px 0;
}

.rotation-table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border, #e6e8f1);
  border-radius: 12px;
}

.rotation-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 12px;
}

.rotation-table th,
.rotation-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border, #e6e8f1);
  text-align: left;
  vertical-align: top;
}

.rotation-table th {
  color: var(--text-secondary, #73788c);
  background: rgba(130, 135, 155, .055);
  font-weight: 800;
  white-space: nowrap;
}

.rotation-table td {
  color: var(--text-primary, #25283c);
}

.rotation-table td small {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary, #9296a7);
}

.rotation-table tbody tr:hover {
  background: rgba(124, 58, 237, .035);
}

.event-table {
  max-height: 620px;
  overflow: auto;
}

.event-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.rotation-score,
.rotation-side {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.rotation-score.pass,
.rotation-side.buy {
  color: #047857;
  background: rgba(16, 185, 129, .11);
}

.rotation-score.fail,
.rotation-side.sell {
  color: #dc2626;
  background: rgba(239, 68, 68, .11);
}

.rotation-count {
  flex: 0 0 auto;
  color: var(--text-secondary, #73788c);
  font-size: 12px;
}

.rotation-wallet-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.rotation-wallet {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--border, #e6e8f1);
  border-radius: 11px;
  background: rgba(130, 135, 155, .025);
}

.rotation-wallet strong {
  color: #7c3aed;
  font-size: 12px;
}

.rotation-wallet span,
.rotation-wallet small {
  color: var(--text-secondary, #73788c);
  font-size: 11px;
}

.rotation-wallet small.effective { color: #059669; }
.rotation-wallet small.dust { color: #d97706; }

.rotation-notes {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px dashed rgba(124, 58, 237, .3);
  border-radius: 12px;
  color: var(--text-secondary, #73788c);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .rotation-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rotation-chart-grid { grid-template-columns: 1fr; }
  .rotation-advanced-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rotation-wallet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .rotation-research-card,
  .rotation-panel {
    padding: 14px;
    border-radius: 13px;
  }

  .rotation-research-head,
  .rotation-panel-head {
    display: grid;
  }

  .rotation-safety-badge {
    width: fit-content;
  }

  .rotation-flow {
    justify-content: start;
    max-width: 100%;
  }

  .rotation-control-grid,
  .rotation-summary-grid,
  .rotation-advanced-grid,
  .rotation-wallet-grid {
    grid-template-columns: 1fr;
  }

  .rotation-run-actions {
    display: grid;
  }

  .rotation-preset-note {
    display: grid;
  }

  .rotation-chart svg {
    height: 145px;
  }

  .rotation-table {
    min-width: 780px;
  }
}
