/* Post block 7: mini sheet (inc/post-blocks/sheet.php). Phone first. The sheet is a
   real grid on every width: the post's table rules and the phone card-stacking in
   inc/content-tables.php skip tc-pb- tables (DEV-W243); it scrolls in __scroll. */
.tc-pb-sheet {
  margin: 28px 0;
  padding: 20px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  font-family: var(--sans);
  max-width: 100%;
  box-sizing: border-box;
}
.tc-pb-sheet__cap { margin: 0 0 4px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.tc-pb-sheet__hint { margin: 0 0 12px; font-size: 14px; color: var(--ink-muted); }
.tc-pb-sheet__hint[hidden] { display: none; }
.tc-pb-sheet__cap + .tc-pb-sheet__scroll { margin-top: 12px; }
/* A wide sheet scrolls inside the block, never the page. */
.tc-pb-sheet__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tc-pb-sheet__t { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.35; margin: 0; }
.tc-pb-sheet__t th,
.tc-pb-sheet__t td { border: 1px solid var(--rule); padding: 6px 8px; text-align: left; vertical-align: middle; color: var(--ink); background: transparent; }
.tc-pb-sheet__t thead th { background: var(--paper); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); font-weight: 400; }
.tc-pb-sheet__t tbody th { font-weight: 400; }
.tc-pb-sheet__t .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Column heads wrap: a two-word head held on one line ("Amount due", "Business use") was the
   widest thing in its column and pushed the answer column out of a 390 phone (2026-11-18). */
.tc-pb-sheet__t thead th.n { white-space: normal; vertical-align: bottom; }
.tc-pb-sheet__t td.is-in { padding: 4px; }
.tc-pb-sheet__t tr.tot th,
.tc-pb-sheet__t tr.tot td { font-weight: 600; background: var(--paper); }
/* The server prints a span, JS swaps in an input of the same box: no shift. */
.tc-pb-sheet__in {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 6.5em;
  height: 44px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  color: var(--ink);
  font: 400 16px/42px var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
input.tc-pb-sheet__in:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.tc-pb-sheet .over { color: var(--danger, #B4442F); }
/* An input whose "over" is true (pay under the minimums, a use above 100%): the typed value and its box. */
.tc-pb-sheet td.over .tc-pb-sheet__in { color: var(--danger, #B4442F); border-color: var(--danger, #B4442F); }
.tc-pb-sheet__bar { display: flex; height: 14px; border-radius: var(--radius-sm); overflow: hidden; margin: 14px 0 8px; background: var(--rule-soft); }
.tc-pb-sheet__bar span { flex: 0 0 auto; transition: flex-basis var(--dur); }
.tc-pb-sheet__bar .t-ink { background: var(--ink); }
.tc-pb-sheet__bar .t-gold { background: var(--gold); }
.tc-pb-sheet__bar .t-ship { background: var(--ship); }
.tc-pb-sheet__bar .t-rest { background: var(--rule-soft); }
.tc-pb-sheet__msg { margin: 0; font-size: 15px; color: var(--ink); min-height: 1.4em; }
.tc-pb-sheet__cta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--ink-muted); }
.tc-pb-sheet__cta .btn { min-height: 44px; box-sizing: border-box; text-decoration: none; }
@media (min-width: 721px) {
  .tc-pb-sheet { padding: 24px; }
  .tc-pb-sheet__t th, .tc-pb-sheet__t td { padding: 8px 10px; }
  .tc-pb-sheet__t td.is-in { padding: 4px 6px; }
}
@media (prefers-reduced-motion: reduce) { .tc-pb-sheet__bar span { transition: none; } }
/* Four or more columns on a phone (check register): tighter box so the last
   column, usually the answer, shows without a sideways scroll. Measured
   DEV-W249: 385px needed vs 300px at 390; this fits 316 at 390 and 286 at 360. */
@media (max-width: 720px) {
  .tc-pb-sheet:has(thead th:nth-child(4)) { padding: 16px 12px; }
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__t th,
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__t td { padding: 6px 4px; }
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__t thead th { font-size: 11px; letter-spacing: .03em; }
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__t td.is-in { padding: 3px; }
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__in { min-width: 3.6em; padding: 0 5px; }
  /* A per cent is three digits; a long label word ("photography") breaks with a hyphen.
     Airbnb expenses needed 303px against 286 at 360 before these two (2026-11-18). */
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) td.is-pct .tc-pb-sheet__in { min-width: 2.9em; }
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__t tbody th { -webkit-hyphens: auto; hyphens: auto; }
}
/* A 360 phone: labels and results one size down (inputs stay 16px, no iOS zoom). */
@media (max-width: 380px) {
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__t { font-size: 14px; }
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) .tc-pb-sheet__in { min-width: 3.3em; }
  .tc-pb-sheet:has(thead th:nth-child(4)):not(.tc-pb-sheet--wide) td.is-pct .tc-pb-sheet__in { min-width: 2.7em; }
}
/* Six or more columns (debt snowball, 2026-11-18): no phone holds them (the snowball needs
   ~480px against 334 at 390), so under 721px each row becomes a card: its label on top, every
   cell under its own column name (data-col, printed by sheet.php), three to a line. The
   server prints tc-pb-sheet--wide, so the first paint is already the card layout. A five-column
   spec is measured at 360 before it ships. */
@media (max-width: 720px) {
  .tc-pb-sheet--wide .tc-pb-sheet__scroll { overflow: visible; }
  .tc-pb-sheet--wide .tc-pb-sheet__t,
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody { display: block; }
  .tc-pb-sheet--wide .tc-pb-sheet__t thead { display: none; }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 0; border-top: 1px solid var(--rule); }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody tr:first-child { border-top: 0; padding-top: 4px; }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody th { grid-column: 1 / -1; padding: 0; border: 0; font-weight: 600; }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody td { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; min-width: 0; padding: 0; border: 0; text-align: left; white-space: normal; }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody td:empty { display: none; }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody td::before { content: attr(data-col); font-size: 11px; line-height: 1.25; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); font-weight: 400; }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody td.is-in { padding: 0; }
  .tc-pb-sheet--wide .tc-pb-sheet__in { min-width: 0; text-align: left; }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody tr.tot { margin-top: 4px; padding: 12px 8px; background: var(--paper); border-top: 0; border-radius: var(--radius-sm); }
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody tr.tot th,
  .tc-pb-sheet--wide .tc-pb-sheet__t tbody tr.tot td { background: transparent; }
}
/* On a desktop post column (~496px inside the block) the six-plus-column table stays a table, set tighter. */
@media (min-width: 721px) {
  .tc-pb-sheet--wide .tc-pb-sheet__t { font-size: 14px; }
  .tc-pb-sheet--wide .tc-pb-sheet__t th,
  .tc-pb-sheet--wide .tc-pb-sheet__t td { padding: 6px; }
  .tc-pb-sheet--wide .tc-pb-sheet__t td.is-in { padding: 3px; }
  .tc-pb-sheet--wide .tc-pb-sheet__t thead th { font-size: 11px; letter-spacing: .03em; }
  .tc-pb-sheet--wide .tc-pb-sheet__in { min-width: 3.4em; padding: 0 6px; }
}
