html[data-page="strategy-history"] body {
  background: var(--color-canvas);
}

.history-main {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.history-hero {
  display: grid;
  gap: 22px;
  margin-bottom: 28px;
}

.history-back {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.history-back:active,
.history-primary-action:active {
  transform: scale(.98);
}

.history-hero-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}

.history-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--color-accent-hover);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .14em;
}

.history-hero h1 {
  margin: 0;
  color: var(--color-text);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 720;
  letter-spacing: -.045em;
  line-height: 1.08;
}

.history-hero p {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 1.65;
}

.history-metadata {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.history-metadata span,
.history-count {
  padding: 6px 9px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.history-summary article {
  min-height: 124px;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface-elevated);
}

.history-summary span,
.history-summary small {
  display: block;
  color: var(--color-text-tertiary);
  font-size: 12px;
  font-weight: 600;
}

.history-summary strong {
  display: block;
  margin-top: 18px;
  color: var(--color-text);
  font-size: 26px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}

.history-summary small {
  margin-top: 4px;
}

.return-positive { color: var(--color-up-strong) !important; }
.return-negative { color: var(--color-down-strong) !important; }

.history-records {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface-elevated);
  overflow: hidden;
}

.history-section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding: 21px 22px;
  border-bottom: 1px solid var(--color-border);
}

.history-section-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -.025em;
}

.history-section-heading p {
  max-width: 780px;
  margin: 6px 0 0;
  color: var(--color-text-tertiary);
  font-size: 12px;
  line-height: 1.55;
}

.history-table-wrap {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.history-table {
  width: 100%;
  min-width: 1360px;
  table-layout: fixed;
  border-collapse: collapse;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.history-table th,
.history-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: right;
  white-space: nowrap;
}

.history-table th {
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.35;
  white-space: normal;
}

.history-table th:nth-child(1) { width: 8%; }
.history-table th:nth-child(2) { width: 11%; }
.history-table th:nth-child(3),
.history-table th:nth-child(4) { width: 9%; }
.history-table th:nth-child(5) { width: 5%; }
.history-table th:nth-child(6) { width: 6%; }
.history-table th:nth-child(7),
.history-table th:nth-child(8) { width: 7%; }
.history-table th:nth-child(9),
.history-table th:nth-child(10) { width: 8%; }
.history-table th:nth-child(n+11) { width: 5.5%; }
.history-table td:nth-child(4),
.history-table td:nth-child(10) { white-space: normal; }

.history-table th:first-child,
.history-table td:first-child,
.history-table th:nth-child(2),
.history-table td:nth-child(2) {
  text-align: left;
}

.history-table tbody tr:last-child td { border-bottom: 0; }
.history-table tbody tr:hover { background: color-mix(in srgb, var(--color-accent) 3%, transparent); }
.history-week { color: var(--color-text); font-weight: 700; }

.history-inline-badge,
.history-action,
.history-execution-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  font-size: 10px;
  font-weight: 700;
}

.history-inline-badge { margin-left: 6px; }
.history-table td:first-child .history-inline-badge {
  display: flex;
  width: fit-content;
  margin: 4px 0 0;
}
.history-action.buy { color: var(--color-up-strong); background: var(--color-up-soft); }
.history-action.sell { color: var(--color-down-strong); background: var(--color-down-soft); }
.history-action.rebalance,
.history-execution-status.pending { color: var(--color-accent-hover); background: var(--color-accent-soft); }

.history-mobile-list { display: none; }

.history-risk-note,
.history-access-state {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
}

.history-risk-note {
  margin-top: 16px;
  padding: 17px 18px;
}

.history-risk-note strong { font-size: 12px; }
.history-risk-note p {
  margin: 5px 0 0;
  color: var(--color-text-tertiary);
  font-size: 11px;
  line-height: 1.65;
}

.history-access-state {
  display: grid;
  max-width: 560px;
  justify-items: center;
  margin: 54px auto 0;
  padding: 38px 28px;
  text-align: center;
}

.history-state-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--color-accent-hover);
  background: var(--color-accent-soft);
  font-size: 15px;
  font-weight: 750;
}

.history-access-state h2 {
  margin: 16px 0 0;
  font-size: 20px;
  letter-spacing: -.025em;
}

.history-access-state p {
  max-width: 400px;
  margin: 8px 0 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.history-primary-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  color: var(--color-primary-contrast);
  background: var(--color-primary);
  font-size: 13px;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 900px) {
  .history-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .history-main {
    width: min(100% - 28px, 620px);
    padding: 24px 0 38px;
  }

  .history-hero { gap: 17px; margin-bottom: 22px; }
  .history-hero-row { display: grid; gap: 18px; }
  .history-hero h1 { font-size: 32px; }
  .history-hero p { font-size: 14px; }
  .history-metadata { justify-content: flex-start; }
  .history-summary { gap: 9px; margin-bottom: 20px; }
  .history-summary article { min-height: 108px; padding: 16px; }
  .history-summary strong { margin-top: 14px; font-size: 22px; }
  .history-section-heading { padding: 18px 16px; }
  .history-section-heading p { font-size: 11px; }
  .history-table-wrap { display: none; }
  .history-mobile-list { display: grid; gap: 10px; padding: 12px; }

  .history-week-card {
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-canvas);
  }

  .history-week-card-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
  }

  .history-week-card-head strong { font-size: 14px; }
  .history-week-card-head p {
    margin: 3px 0 0;
    color: var(--color-text-tertiary);
    font-size: 11px;
  }

  .history-week-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    margin: 16px 0 0;
  }

  .history-week-card-grid div { min-width: 0; }
  .history-week-card-grid span {
    display: block;
    color: var(--color-text-tertiary);
    font-size: 10px;
  }

  .history-week-card-grid strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .history-week-card-execution {
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-tertiary);
    font-size: 11px;
    line-height: 1.55;
  }
}

@media (max-width: 430px) {
  .history-summary { grid-template-columns: 1fr 1fr; }
  .history-summary article { min-height: 102px; padding: 14px; }
  .history-summary strong { font-size: 19px; }
  .history-section-heading { display: grid; gap: 10px; }
  .history-count { width: fit-content; }
}

@media (prefers-reduced-motion: reduce) {
  .history-back,
  .history-primary-action { transition: none; }
}
