/* ─── History page ─────────────────────────────────────────────────────── */
/* Positions at the start of a past date. Builds on the shared page header  */
/* and .re_portfolio-table; only what is specific to this page lives here.  */

.history-date-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-sm) var(--spacing-md);
  margin: var(--spacing-md) 0 var(--spacing-sm);
}

.history-date-form .form-floating {
  margin-bottom: 0;
}

.history-date-input {
  width: 180px;
}

.history-date-input .form-control {
  border-radius: var(--radius-sm);
}

.history-date-input .form-control:focus {
  border-color: var(--color-green);
  box-shadow: 0 0 0 0.2rem var(--color-green-surface);
}

.history-date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs) 0;
}

.history-intro,
.history-totals-note {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 72ch;
  margin: 0 0 var(--spacing-md);
}

.history-totals-note {
  margin-top: var(--spacing-md);
}

.history-totals-note strong {
  color: var(--color-warning);
  font-weight: 600;
}

.history-date-error {
  font-size: var(--text-sm);
}

.history-window-notice .upgrade-cta-banner {
  margin-bottom: var(--spacing-md);
}

/* A price cell's second line: where the price came from. */
.history-source {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.history-no-price {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-warning);
  white-space: nowrap;
}

.history-portfolio,
.history-portfolio-inline,
.history-quantity-inline {
  font-size: var(--text-sm);
}

.history-table tfoot .history-total-row th,
.history-table tfoot .history-total-row td {
  border-top: 2px solid var(--color-grey-dark);
  font-weight: 700;
  color: var(--color-navy);
  padding-top: var(--spacing-sm);
  padding-bottom: var(--spacing-sm);
}

.history-empty {
  margin: var(--spacing-lg) 0;
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-md);
  border: 1px dashed var(--color-grey-dark);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.history-empty-icon {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
}

.history-empty-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: var(--spacing-xs);
}

.history-empty-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

@media (max-width: 576px) {
  .history-date-input {
    width: 100%;
  }
}

.history-price-inline {
  margin-top: var(--spacing-xs);
  font-size: var(--text-sm);
}

.history-price-inline .primary-price {
  font-weight: 500;
  color: var(--color-text-secondary);
}

@media (max-width: 575.98px) {
  .history-table th,
  .history-table td,
  .history-table tbody td:first-child {
    padding: var(--spacing-md) var(--spacing-sm);
  }
}
