/* What the paycheck bill planner (/paycheck-bill-planner) adds to style.css and tools.css, which load first: the
   bill rows, one block per check, the month beside them and the sheet as it prints. Every colour is one of the
   site's tokens, so the page follows the site into dark mode and tools.css turns the sheet to ink on paper. */

/* A rule that sets display would otherwise win over the hidden attribute. */
.tool [hidden] { display: none; }

/* How you're paid on the first line, then your pay and the month to plan: three columns, two on a phone. */
.tool .bp-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 22px; align-items: end; }
.bp-form > label { min-width: 0; }
.bp-form > label > input, .bp-form > label > select { width: 100%; min-width: 0; }
.bp-form > .bp-take { grid-column: 1; }
.tool input::placeholder { color: var(--quiet); opacity: 1; }
.tool input[aria-invalid="true"] { border-color: var(--gold-ink); background: var(--gold-soft); }

/* Your bills: a row each, under one line of column headings. */
.bp-bills { grid-column: 1 / -1; min-width: 0; margin-top: 6px; padding-top: 20px; border-top: 1px solid var(--card-line); }
.doc .bp-bills h2 { margin: 0; padding: 0; font: 600 1.05rem/1.3 var(--sans); letter-spacing: 0; }
.doc .bp-sample { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; color: var(--muted); font-size: 0.93rem; }
.bp-sample span { flex: 1 1 260px; }
.tool .bp-sample button { min-height: 40px; font-size: 0.9rem; }
.bp-table { margin-top: 16px; }
.bp-head, .bp-bill { display: grid; grid-template-columns: minmax(0, 1fr) 8rem 5rem 5.5rem 5.75rem; gap: 10px; align-items: center; }
.bp-head { align-items: end; padding: 0 2px 6px; font: 600 0.8rem/1.25 var(--sans); color: var(--quiet); }
.bp-head span:nth-child(4) { text-align: center; }
.bp-rows { display: grid; gap: 10px; }
.bp-bill input[type="text"] { width: 100%; min-width: 0; }
.bp-amount input, .bp-day input { font-variant-numeric: lining-nums tabular-nums; }
.tool .bp-split { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; font-weight: 400; cursor: pointer; }
/* The tick box is drawn here, so it keeps the site's colours in dark mode. */
.tool .bp-split input { appearance: none; -webkit-appearance: none; display: grid; place-content: center; flex: none; width: 24px; height: 24px; min-height: 0; margin: 0; padding: 0; border: 1.5px solid var(--quiet); border-radius: 6px; background: var(--bg); cursor: pointer; }
.tool .bp-split input::before { content: ""; width: 6px; height: 11px; margin-top: -3px; border: solid var(--bg); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); opacity: 0; }
.tool .bp-split input:checked { border-color: var(--ink); background: var(--ink); }
.tool .bp-split input:checked::before { opacity: 1; }
.tool .bp-remove { padding: 0 10px; font-weight: 500; font-size: 0.9rem; }
.tool button:disabled { opacity: 0.5; cursor: default; }
.bp-full { align-self: center; color: var(--muted); font-size: 0.9rem; }
/* A row's own labels are read aloud here and shown on a phone, where the headings are gone. */
.bp-lab { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.doc .bp-hint { margin-top: 14px; color: var(--muted); font-size: 0.9rem; }
.tool .bp-bills .actions { margin-top: 14px; }

/* The plan: the checks down the left, the month beside them. */
.bp-plan { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 22px 28px; align-items: start; margin-top: 20px; }
.doc .bp-skip { margin-top: 10px; padding: 8px 12px; background: var(--gold-soft); border-radius: 8px; font-size: 0.93rem; }
.bp-checks { display: grid; gap: 14px; min-width: 0; }
.bp-check { min-width: 0; background: var(--bg); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 14px 16px 12px; }
/* A check from before the month starts. */
.bp-check.before { border-style: dashed; border-color: var(--chip-line); }
.doc .bp-check h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0; font: 600 1.02rem/1.3 var(--sans); letter-spacing: 0; }
.bp-check h3 small { font-weight: 500; font-size: 0.84rem; color: var(--gold-ink); }
.doc .bp-check ul { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.97rem; line-height: 1.4; }
.doc .bp-check li { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 7px 0; border-top: 1px solid var(--card-line); }
.bp-check .what { min-width: 0; overflow-wrap: anywhere; }
.bp-check .what small { margin-left: 6px; color: var(--quiet); font-size: 0.84rem; white-space: nowrap; }
.bp-check .amt, .bp-total .amt { margin-left: auto; padding-left: 8px; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.doc .bp-check li.other { color: var(--muted); font-size: 0.88rem; }
.doc .bp-check p { display: flex; align-items: baseline; margin: 0; padding: 7px 0 0; font-size: 0.97rem; line-height: 1.4; }
.doc .bp-check .bp-sum { padding-top: 8px; border-top: 1px solid var(--ink); font-weight: 600; }
.doc .bp-check .bp-left { color: var(--muted); }
.doc .bp-check .bp-none { padding: 8px 0 2px; color: var(--muted); }
/* A check whose bills come to more than it brings in. */
.bp-check.short { border-color: var(--gold-ink); }
.doc .bp-check.short .bp-left { margin: 8px -8px 0; padding: 6px 8px; border-radius: 6px; background: var(--gold-soft); color: var(--ink); font-weight: 700; }
/* The box to tick when a bill is paid: on paper only. */
.bp-box { display: none; }

/* The month: bigger days than the year calendars, the ring on a payday (tools.css) and a dot under a due day. */
.bp-side { min-width: 0; }
.doc .bp-cal .cal-month caption { padding-bottom: 8px; font-size: 1rem; }
.doc .bp-cal .cal-month caption small { color: var(--quiet); font-weight: 500; font-size: 0.9rem; }
.doc .bp-cal .cal-month th, .doc .bp-cal .cal-month td { height: 40px; font-size: 0.86rem; }
.doc .bp-cal .cal-month thead th { height: 24px; font-size: 0.74rem; }
.doc .bp-cal .cal-month td { position: relative; }
.doc .bp-cal .cal-month td > span:first-child { width: 27px; height: 27px; }
/* The dot is drawn with a border, so it prints when backgrounds are left out. */
.doc .bp-cal .cal-month td.due::after { content: ""; position: absolute; left: 50%; bottom: 0; margin-left: -2.5px; border: 2.5px solid var(--ink); border-radius: 50%; }
.doc .bp-key { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; padding: 0 0 0 4px; list-style: none; color: var(--muted); font-size: 0.84rem; }
.doc .bp-key li { display: flex; align-items: center; gap: 7px; margin: 0; }
.bp-key span { flex: none; box-sizing: border-box; }
.bp-key .payday { width: 17px; height: 17px; border: 1.5px solid var(--gold-ink); border-radius: 50%; background: var(--gold-soft); }
.bp-key .due { margin: 0 6px; border: 2.5px solid var(--ink); border-radius: 50%; }
.doc .bp-total { display: flex; align-items: baseline; margin: 14px 0 0; padding: 10px 4px 0; border-top: 1px solid var(--card-line); font-weight: 600; font-size: 0.93rem; }

/* A narrow screen: the month goes under the checks, and a bill takes two lines with its own labels. */
@media (max-width: 720px) {
  .tool .bp-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .bp-form > .bp-wide, .bp-form > .bp-take { grid-column: 1 / -1; }
  .bp-plan { grid-template-columns: minmax(0, 1fr); }
  .bp-side { max-width: 320px; }
  .bp-head { display: none; }
  .bp-rows { gap: 0; }
  /* The name and Remove on one line; under them the amount after a $, the due day and the tick box, each named
     beside its field so a bill stays two lines tall. */
  .bp-bill { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name name remove" "amount day split"; gap: 8px 10px; padding: 10px 0; border-top: 1px solid var(--card-line); }
  .bp-name { grid-area: name; }
  .bp-amount { grid-area: amount; }
  .bp-day { grid-area: day; }
  .bp-split { grid-area: split; }
  .bp-remove { grid-area: remove; justify-self: end; }
  .tool .bp-amount, .tool .bp-day { display: flex; align-items: center; gap: 5px; }
  .bp-amount::before { content: "$"; color: var(--quiet); font-weight: 500; }
  .bp-bill input[type="text"] { padding-inline: 9px; }
  .bp-bill .bp-day input { flex: none; width: 2.7rem; }
  .bp-day .bp-lab, .bp-split .bp-lab { position: static; width: auto; height: auto; overflow: visible; clip-path: none; color: var(--quiet); font-weight: 500; font-size: 0.78rem; line-height: 1.2; }
  /* Beside the box there is room for "Split"; the rest of its label is still read aloud. */
  .bp-more { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tool .bp-split { justify-content: flex-start; gap: 6px; }
}
/* The narrowest phones: the tick box takes a line of its own, with its whole label. */
@media (max-width: 359px) {
  .bp-bill { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name remove" "amount day" "split split"; }
  .bp-more { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
}

/* The sheet: headed with the month, each check with a box to tick beside every bill, the month to the right. */
@media print {
  .doc .bp-sheet-title { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; margin: 0; padding: 0; font-size: 26pt; line-height: 1.05; }
  .bp-sheet-title small { display: block; margin-top: 4pt; font: 400 11pt/1.3 var(--sans); letter-spacing: 0; }
  .doc .bp-basis { margin-top: 2pt; color: var(--muted); font-size: 9.5pt; }
  .doc .tool .answer { margin-top: 10pt; font-size: 12pt; }
  /* Two columns that fill evenly: the checks in date order down the first and on down the second, then the month.
     Five weekly checks and the one before them still fit the page. */
  .bp-plan { display: block; column-count: 2; column-gap: 20pt; margin-top: 12pt; }
  .bp-checks { display: block; }
  .bp-side { max-width: none; padding-top: 2pt; }
  .bp-check { margin-bottom: 7pt; padding: 5pt 8pt 4pt; border-width: 0.75pt; border-color: var(--ink); border-radius: 3pt; background: none; }
  .bp-check.before { border-color: var(--ink); }
  .doc .bp-check h3 { font-size: 10.5pt; }
  .bp-check h3 small { font-size: 8.5pt; }
  .doc .bp-check ul { margin-top: 3pt; font-size: 9.5pt; }
  .doc .bp-check li { gap: 6pt; padding: 2.5pt 0; }
  .doc .bp-check li.other, .bp-check .what small { font-size: 8.5pt; }
  .doc .bp-check p { padding-top: 2.5pt; font-size: 9.5pt; }
  .doc .bp-check .bp-sum { padding-top: 3pt; border-top-width: 0.75pt; }
  .doc .bp-check.short .bp-left { margin: 0; padding: 2.5pt 0 0; border-radius: 0; background: none; }
  .bp-check .bp-box { display: block; flex: none; align-self: center; width: 8pt; height: 8pt; border: 0.9pt solid var(--ink); border-radius: 1pt; }
  .doc .bp-cal .cal-month caption { font-size: 10.5pt; padding-bottom: 4pt; }
  .doc .bp-cal .cal-month caption small { font-size: 9.5pt; }
  .doc .bp-cal .cal-month th, .doc .bp-cal .cal-month td { height: 22pt; font-size: 8.5pt; }
  .doc .bp-cal .cal-month thead th { height: 14pt; font-size: 7.5pt; }
  .doc .bp-cal .cal-month td > span:first-child { width: 15pt; height: 15pt; }
  .doc .bp-cal .cal-month td.due::after { margin-left: -1.5pt; border-width: 1.5pt; }
  .doc .bp-key { margin-top: 8pt; font-size: 8.5pt; }
  .bp-key .payday { width: 11pt; height: 11pt; }
  .bp-key .due { border-width: 1.6pt; }
  .doc .bp-total { margin-top: 9pt; padding-top: 6pt; font-size: 9.5pt; }
}
