/* Responsive breakpoints and the reduced-motion override. Loaded last: these
   rules win over the module files above at equal specificity, so their order
   relative to everything else must not change. */

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 0 0;
  }
}

@media (max-width: 640px) {
  .page-header-inner,
  .page-main,
  .page-footer-inner {
    padding-inline: var(--space-5);
  }
  .page-main {
    padding-block: var(--space-6) var(--space-8);
  }
  .card {
    padding: var(--space-5);
  }
  .balance-card {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-5);
  }
  .balance-side {
    align-items: flex-start;
    text-align: left;
  }
  .badge-row {
    justify-content: flex-start;
  }
  /* The balance stays one step above the stat tiles: at the same size it stops
     reading as the primary figure on the page. */
  .balance-value {
    font-size: var(--text-2xl);
    overflow-wrap: anywhere;
  }
  .stat-value {
    font-size: var(--text-xl);
  }
  .chart {
    height: 7.5rem;
    /* 30 columns share ~275px here, so a 4px gutter would eat more width than
       the bars themselves and adjacent days visually merge. */
    gap: 2px;
  }
  .ledger-row {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Stacked rows lose the right-aligned amount column, so pin the delta left
     and the running balance right to keep both scannable down the list. */
  /* Running balance left, delta right. Stacked rows lose the desktop amount
     column, and left-aligning the delta made magnitudes unscannable because
     "-9.053" and "-0.7815" then start at the same x. */
  .ledger-amounts {
    display: flex;
    align-items: baseline;
    flex-direction: row-reverse;
    justify-content: space-between;
    gap: var(--space-4);
    text-align: right;
  }
  .ledger-after {
    margin-top: 0;
  }
}

@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .brand-text {
    font-size: var(--text-base);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
