.fast-micro-history-panel {
  min-height: 24rem;
}

.fast-micro-history-shell {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.fast-micro-history-heading {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.fast-micro-history-heading h4,
.fast-micro-history-heading p {
  margin: 0;
}

.fast-micro-history-heading p {
  color: var(--muted);
  margin-top: 0.35rem;
}

.fast-micro-history-actions,
.fast-micro-history-pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fast-micro-history-actions button,
.fast-micro-history-pagination button {
  min-height: 2.45rem;
  white-space: nowrap;
}

.fast-micro-history-summary {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(9rem, 1fr));
  margin: 0;
}

.fast-micro-history-summary div {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  min-height: 4.1rem;
  padding: 0.7rem 0.85rem;
}

.fast-micro-history-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fast-micro-history-summary dd {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin: 0.35rem 0 0;
}

.fast-micro-history-summary dd small {
  color: var(--muted);
  display: block;
  font-size: 0.7rem;
  margin-top: 0.2rem;
}

.fast-micro-history-filters {
  align-items: end;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(7rem, 9rem) minmax(12rem, 18rem) minmax(10rem, 14rem) 1fr;
}

.fast-micro-history-filters label {
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 0.35rem;
}

.fast-micro-history-filters input,
.fast-micro-history-filters select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  color: var(--text);
  min-height: 2.55rem;
  padding: 0.55rem 0.7rem;
}

.fast-micro-history-filters > span {
  color: var(--muted);
  font-size: 0.82rem;
  justify-self: end;
  padding-bottom: 0.65rem;
}

.fast-micro-history-table-wrap {
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  max-width: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
}

.fast-micro-history-table {
  background: var(--surface);
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
  width: 174rem;
}

.fast-micro-history-table th,
.fast-micro-history-table td {
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  height: 4.35rem;
  overflow: hidden;
  padding: 0.7rem 0.75rem;
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.fast-micro-history-table th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 3;
}

.fast-micro-history-table tbody tr:last-child td {
  border-bottom: 0;
}

.fast-micro-history-table td:nth-child(4),
.fast-micro-history-table th:nth-child(4) {
  left: 0;
  position: sticky;
  z-index: 2;
}

.fast-micro-history-table td:nth-child(6),
.fast-micro-history-table th:nth-child(6) {
  left: 25rem;
  position: sticky;
  z-index: 2;
}

.fast-micro-history-table td:nth-child(4),
.fast-micro-history-table td:nth-child(6) {
  background: var(--surface);
}

.fast-micro-history-table th:nth-child(4),
.fast-micro-history-table th:nth-child(6) {
  z-index: 4;
}

.fast-micro-history-table td strong,
.fast-micro-history-table td small,
.fast-micro-history-table td span {
  display: block;
}

.fast-micro-history-table td small {
  color: var(--muted);
  font-size: 0.7rem;
  margin-top: 0.2rem;
}
.fast-micro-history-table .fast-micro-history-exit { white-space: normal; line-height: 1.35; }

.fast-micro-history-col-1,
.fast-micro-history-col-2 { width: 11.5rem; }
.fast-micro-history-col-3 { width: 7.5rem; }
.fast-micro-history-col-4 { width: 10rem; }
.fast-micro-history-col-6 { width: 11.5rem; }
.fast-micro-history-col-8 { width: 8rem; }
.fast-micro-history-col-9 { width: 9rem; }
.fast-micro-history-col-10 { width: 10rem; }
.fast-micro-history-col-11,
.fast-micro-history-col-12 { width: 11rem; }
.fast-micro-history-col-13 { width: 12rem; }
.fast-micro-history-col-14 { width: 10rem; }
.fast-micro-history-col-15 { width: 10rem; }
.fast-micro-history-col-16 { width: 8rem; }
.fast-micro-history-col-17 { width: 9rem; }

.fast-micro-history-table td.fast-micro-history-profit {
  background: var(--success-bg);
}

.fast-micro-history-table td.fast-micro-history-loss {
  background: var(--danger-bg);
}

.fast-micro-history-profit {
  color: var(--pnl-profit);
  font-weight: 700;
}

.fast-micro-history-loss {
  color: var(--pnl-loss);
  font-weight: 700;
}

.fast-micro-history-state,
.fast-micro-history-active {
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-block !important;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.38rem 0.55rem;
}

.fast-micro-history-state--profit {
  color: var(--pnl-profit);
}

.fast-micro-history-state--loss {
  color: var(--pnl-loss);
}

.fast-micro-history-state--neutral,
.fast-micro-history-active {
  color: var(--muted);
}

.fast-micro-history-empty,
.fast-micro-history-notice {
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}

.fast-micro-history-notice {
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  margin: 0 0 0.75rem;
}

.fast-micro-history-notice--error {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--red) 45%, var(--border));
  color: var(--red);
}

.fast-micro-history-pagination {
  justify-content: flex-end;
}

.fast-micro-history-pagination span {
  color: var(--muted);
  font-size: 0.82rem;
  min-width: 7rem;
  text-align: center;
}

@media (max-width: 900px) {
  .fast-micro-history-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .fast-micro-history-summary {
    grid-template-columns: repeat(2, minmax(8rem, 1fr));
  }

  .fast-micro-history-filters {
    grid-template-columns: 1fr 1fr;
  }

  .fast-micro-history-filters > span {
    grid-column: 1 / -1;
    justify-self: start;
    padding-bottom: 0;
  }
}

.fast-micro-history-table .fast-micro-history-col-18 { width: 9rem; }
.fast-micro-history-table [data-fast-micro-history-close] { min-height: 2.2rem; }
/* Group the current and realized results compactly at the right, clear of the sticky identity columns. */
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-table { width: 195rem; }
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-12 { width: 12rem; }
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-13 { width: 10rem; }
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-14 { width: 8rem; }
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-15 { width: 10rem; }
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-16 { width: 8rem; }
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-17,
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-18 { width: 9rem; }
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-19,
[data-fast-micro-history-mode="LIVE"] .fast-micro-history-col-20 { width: 8rem; }

.fast-micro-history-col-5 { width: 15rem; }
.fast-micro-history-col-7 { width: 8rem; }
