/*
 * The statement: every movement behind the balance. Stone world, like the costs screen next door,
 * and it follows that screen's conventions rather than its rules: its own template, because a
 * statement has five columns where the costs list has four, and the same stack-on-a-phone rule.
 *
 * Mobile-first at 360px. Five facts do not fit on one line at that width, so a row is a stack on a
 * phone with the amount and the running balance sharing the last line, and one line from 48rem up.
 * The running balance is the column a firm scans against its own bank record, so it stays tabular
 * and right-aligned at every width.
 */

.ledger__balance {
  font-size: var(--step-1);
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.ledger__balance strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ledger__entry {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: .15rem .75rem;
  padding-block: .6rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

a.ledger__entry:hover .ledger__concept,
a.ledger__entry:focus-visible .ledger__concept {
  text-decoration: underline;
}

.ledger__when,
.ledger__case,
.ledger__running {
  font-size: var(--step--1);
  color: var(--muted);
}

.ledger__when,
.ledger__amount,
.ledger__running {
  font-variant-numeric: tabular-nums;
}

.ledger__amount,
.ledger__running {
  text-align: right;
  white-space: nowrap;
}

/* Money in stands out from money out without relying on colour, which is not a distinction for
   every reader and is gone entirely when this page is printed in black. The sign is still in the
   text; the weight is what makes a credit findable while scanning the column. */
.ledger__amount--credit {
  font-weight: 600;
}

/* The carátula spans the row on a phone: it is the longest field and it wraps, and letting it share
   a line with the amount pushes the amount off the grid. */
.ledger__case {
  grid-column: 1 / -1;
}

.ledger__pages {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-block: 1.5rem;
  font-size: var(--step--1);
}

.ledger__page-of {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-inline: auto;
}

.ledger__back,
.ledger__download {
  margin-bottom: 1.5rem;
  font-size: var(--step--1);
}

@media (width >= 48rem) {
  .ledger__entry {
    grid-template-columns: 8rem minmax(0, 1fr) minmax(0, 1fr) 8rem 8rem;
    align-items: center;
  }

  .ledger__case {
    grid-column: auto;
  }
}

/* Attached to the firm's own reconciliation, so the chrome goes and no row is split across a page
   break. */
@media print {
  .app-bar,
  .ledger__download,
  .ledger__back,
  .ledger__pages {
    display: none;
  }

  .ledger__entry {
    break-inside: avoid;
  }
}
