/* Maintenance logbook.
 *
 * The visual model is the logbook kept in a shop drawer, not a marketing page: a ruled
 * form on manila stock, small-caps mono labels, and ink that reads like a pen. Warm
 * paper and a rust accent rather than aft's gray-green. System fonts only -- the page
 * makes no third-party requests, which the CSP also enforces.
 */

:root {
  --paper: #ece2c6;
  --panel: #f7f1df;
  --ink: #2b2418;
  --mute: #6b5f48;
  --rule: #d2c39c;
  --rule-strong: #a08f66;
  --accent: #b4441c;
  /* The primary button and the due-soon margin: shop-tag gold, darker than aft's so
     it holds against manila. Text in it is ink. */
  --gold: #e3a92b;
  --gold-deep: #8a5a00;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas,
    monospace;

  --gutter: clamp(1rem, 4vw, 3rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Hidden means hidden, whatever display the element's own rule gave it. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  /* Tabular figures everywhere: meters and costs line up in columns. */
  font-variant-numeric: tabular-nums;
}

.sheet {
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--gutter) var(--gutter) 4rem;
}

/* ---- label vernacular -------------------------------------------------- */

/* Small caps mono labels are the form's voice. Used for every field label,
 * column head, and unit, and nowhere else. */
.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

/* One line of muted prose under a control or a list. */
.note {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--mute);
}

.note a {
  color: var(--ink);
}

/* ---- masthead ---------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--ink);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.masthead .expand {
  font-weight: 400;
  color: var(--mute);
  letter-spacing: 0.01em;
}

.masthead .label {
  margin-left: auto;
}

/* ---- account -----------------------------------------------------------

   Intentionally understated. Working without an account is the point of the tool,
   so sign-in reads as an available option rather than as the thing to do next. */

.account {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  color: var(--mute);
}

.account-actions {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* A text button: a link in everything but destination. */
.linky {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  color: var(--mute);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
}

.linky:hover {
  color: var(--ink);
  border-color: var(--rule-strong);
}

/* ---- footer ------------------------------------------------------------ */

.colophon {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--mute);
}

.colophon p {
  margin: 0 0 0.35rem;
  max-width: 40rem;
}

.colophon a {
  color: var(--ink);
}

/* ---- states ------------------------------------------------------------ */

.banner {
  padding: 0.75rem 1rem;
  margin: 1.25rem 0 0;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  font-size: 0.9375rem;
}

/* ---- page tabs --------------------------------------------------------- */

/* Several pages on one origin: navigation between documents, styled as file tabs on
 * the same sheet. Wraps rather than scrolling the page sideways on a phone. */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: -2px;
  border-bottom: 1px solid var(--rule);
}

.cards a {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  color: var(--mute);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}

.cards a:hover {
  color: var(--ink);
}

.cards a[aria-current="page"] {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--rule);
}

/* ---- section heads ----------------------------------------------------- */

/* A label over a 2px ink rule: the line a ruled form draws under a heading. */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 2rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--ink);
}

.head-tools {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.group-name {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.group-name:hover {
  text-decoration: underline;
}

/* ---- buttons ----------------------------------------------------------- */

/* The one primary action on a form. */
.save {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.65rem 1.1rem;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
}

.save:disabled {
  background: transparent;
  color: var(--rule-strong);
  border-color: var(--rule);
  cursor: not-allowed;
}

a.linky {
  display: inline-block;
  text-decoration: none;
}

.linky.danger:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---- forms ------------------------------------------------------------- */

.form {
  margin-top: 0.5rem;
}

.fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.field.wide {
  flex: 1 1 100%;
}

.fields .note {
  flex-basis: 100%;
  margin: 0;
}

/* Every typed or chosen control shares one skin. */
.form input:not([type="checkbox"]):not([type="radio"]),
.form select,
.form textarea {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.9375rem;
  padding: 0.4rem 0.5rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  max-width: 100%;
}

.form textarea {
  font-family: var(--sans);
  resize: vertical;
}

.form .num {
  width: 7rem;
  text-align: right;
}

.form .short {
  width: 5.5rem;
}

.form .wide input,
.form .wide textarea {
  width: 100%;
}

.pair {
  display: flex;
  gap: 0.4rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9375rem;
  cursor: pointer;
}

.check input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--ink);
}

.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 0;
}

.actions .msg {
  margin-right: auto;
  color: var(--accent);
}

/* ---- part lines -------------------------------------------------------- */

.parts {
  margin: 0;
  padding: 1rem 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}

.parts legend {
  padding: 0;
  margin-bottom: 0.4rem;
}

.part-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}

.part-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) 4rem 5.5rem 2rem;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.form .part-row input {
  width: 100%;
  min-width: 0;
}

.part-head {
  margin-bottom: 0.2rem;
}

/* ---- the due list ------------------------------------------------------ */

.group {
  margin-top: 1.75rem;
}

.group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--ink);
}

details.group > summary {
  cursor: pointer;
  list-style: none;
}

details.group > summary::-webkit-details-marker {
  display: none;
}

details.group .show::after {
  content: "[show]";
}

details.group[open] .show::after {
  content: "[hide]";
}

.due-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* One task per row, the state in the left margin: rust is late, gold is close,
 * a dashed rule is never done -- neutral, because a task nobody has done yet is
 * not an alarm. */
.due-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 0.25rem 1rem;
  padding: 0.7rem 0 0.7rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  border-left: 4px solid var(--rule);
}

.due-row[data-state="overdue"] {
  border-left-color: var(--accent);
}

.due-row[data-state="soon"] {
  border-left-color: var(--gold);
}

.due-row[data-state="ok"] {
  border-left-color: var(--rule-strong);
  border-left-width: 1px;
}

.due-row[data-state="never"] {
  border-left: 2px dashed var(--rule-strong);
}

.due-main {
  min-width: 0;
}

.due-what {
  display: block;
}

.due-int {
  display: block;
  font-size: 0.8125rem;
  color: var(--mute);
}

.due-when {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: right;
}

.due-row[data-state="overdue"] .due-when {
  color: var(--accent);
}

.due-row[data-state="soon"] .due-when {
  color: var(--gold-deep);
}

.due-row[data-state="never"] .due-when,
.due-row[data-state="ok"] .due-when {
  color: var(--mute);
  font-weight: 400;
}

/* The Done form opens under its row, across the full width. */
.quick {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding: 0 0.75rem;
  background: var(--panel);
  border: 1px solid var(--rule);
}

.quick .fields {
  padding: 0.75rem 0;
}

.quick .actions {
  padding: 0.5rem 0 0.75rem;
}

.empty-state {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border-left: 3px solid var(--accent);
}

.empty-state p {
  margin: 0 0 1rem;
  max-width: 36rem;
}

/* ---- ledgers ----------------------------------------------------------- */

.ledger-section {
  margin-top: 0.5rem;
}

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* A ledger line is a link to the record. Columns are flex items with fixed bases, so
 * every page's ledger lines up whichever columns it shows. */
.ledger-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.875rem;
}

.ledger-row:hover {
  background: var(--panel);
}

.ledger li[data-editing="true"] .ledger-row {
  background: var(--panel);
  box-shadow: -0.5rem 0 0 var(--gold), 0.5rem 0 0 var(--panel);
}

/* Rows that carry a due state take the due list's margin. */
.ledger li[data-state] .ledger-row {
  padding-left: 0.6rem;
  border-left: 3px solid var(--rule);
}

.ledger li[data-state="overdue"] .ledger-row {
  border-left-color: var(--accent);
}

.ledger li[data-state="soon"] .ledger-row {
  border-left-color: var(--gold);
}

.ledger li[data-state="never"] .ledger-row {
  border-left-style: dashed;
}

.ledger li[data-state="none"] .ledger-row {
  color: var(--mute);
}

.l-date {
  flex: 0 0 6.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mute);
}

.l-asset {
  flex: 0 0 9rem;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Basis 0 and fixed neighbors: every row's columns start at the same place,
 * whatever the text in them. */
.l-what {
  flex: 1 1 0;
  min-width: 0;
}

.l-task {
  color: var(--mute);
  font-size: 0.8125rem;
}

.l-flag {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
}

.l-parts {
  flex: 0 0 11rem;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.l-cost,
.l-meter {
  flex: 0 0 5rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-align: right;
}

.l-by {
  flex: 0 0 3rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* P: transcribed from paper. */
.l-src {
  flex: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.l-due {
  flex: 0 1 auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-align: right;
}

.task-row .l-asset,
.asset-row .l-asset {
  flex-basis: 12rem;
}

.empty-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
  color: var(--mute);
  font-size: 0.875rem;
}

.task-group .section-head {
  margin-top: 1.5rem;
}

.archived {
  margin-top: 1.5rem;
}

.archived summary {
  cursor: pointer;
  padding-bottom: 0.4rem;
}

/* ---- asset identity ---------------------------------------------------- */

.ident {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}

.ident dt {
  display: block;
}

.ident dd {
  margin: 0.15rem 0 0;
  font-family: var(--mono);
  font-weight: 600;
}

/* ---- parts report ------------------------------------------------------ */

.part-report-head,
.part-report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3rem 4rem 5.5rem 6.5rem;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
}

.part-report-head {
  padding: 0.5rem 0 0.3rem;
  border-bottom: 1px solid var(--rule-strong);
}

.part-report-head span:not(:first-child) {
  text-align: right;
}

.part-report-row {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  list-style: none;
  font-size: 0.875rem;
}

.part-report-row::-webkit-details-marker {
  display: none;
}

.r-ref b {
  font-family: var(--mono);
}

.r-text {
  margin-left: 0.5rem;
  color: var(--mute);
}

.r-count,
.r-qty,
.r-cost,
.r-last {
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-align: right;
}

.r-assets {
  grid-column: 1 / -1;
  font-size: 0.8125rem;
  color: var(--mute);
}

.part-ref[open] > .part-report-row {
  background: var(--panel);
}

.uses {
  margin: 0 0 0.75rem 1.25rem;
}

.uses .ledger-row {
  font-size: 0.8125rem;
}

/* ---- print center ------------------------------------------------------ */

.choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 1rem 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
}

.choice legend {
  padding: 0;
  margin-bottom: 0.4rem;
}

.controls .actions .msg {
  color: var(--mute);
}

/* The preview scrolls inside itself: a sheet of Letter is wider than a phone, and
 * the page must not scroll sideways. */
.preview {
  margin-top: 1.5rem;
  padding: 1rem;
  overflow-x: auto;
  background: var(--rule);
  border: 1px solid var(--rule-strong);
}

/* ---- printed forms -----------------------------------------------------

   Inches, because paper is. Every line is a border: backgrounds do not print by
   default. Black ink, lines no thinner than 0.5pt, labels #444.

   The band heights here are forms.js's BANDS and ROW; it counts how many ruled rows
   fit a page from them, so change them together. */

.pf {
  color: #000;
  font-family: var(--sans);
  font-size: 9pt;
  line-height: 1.25;
}

.pf-page {
  margin: 0 auto 1rem;
  padding: 0.5in;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.pf[data-paper="letter"][data-orient="portrait"] .pf-page {
  width: 8.5in;
  min-height: 11in;
}

.pf[data-paper="letter"][data-orient="landscape"] .pf-page {
  width: 11in;
  min-height: 8.5in;
}

.pf[data-paper="a4"][data-orient="portrait"] .pf-page {
  width: 210mm;
  min-height: 297mm;
}

.pf[data-paper="a4"][data-orient="landscape"] .pf-page {
  width: 297mm;
  min-height: 210mm;
}

.pf table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.pf-label {
  display: block;
  font-family: var(--mono);
  font-size: 6.5pt;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #444;
}

.pf-value {
  display: block;
  font-size: 10pt;
  font-weight: 600;
}

/* The header band: title, form number, and what the sheet covers. */
.pf-head {
  height: 1in;
  border-bottom: 1.5pt solid #000;
}

.pf .pf-head td {
  border: 0;
  vertical-align: bottom;
  padding: 0 0.08in 0.05in 0;
}

.pf-head .pf-label {
  display: inline-block;
  margin-right: 0.3em;
}

.pf-head .pf-value {
  display: inline;
}

.pf-title {
  font-size: 14pt;
  font-weight: 800;
}

.pf-id {
  text-align: right;
}

.pf-id .pf-value {
  font-family: var(--mono);
  font-size: 12pt;
}

.pf-blank {
  display: inline-block;
  height: 1em;
  margin: 0 0.4em 0 0.1em;
  border-bottom: 0.75pt solid #000;
  vertical-align: baseline;
}

.pf-blank.short {
  width: 0.45in;
}

.pf-blank.long {
  width: 1.3in;
}

/* The grid's band grows with its meter lines, so it is not a fixed height. */
.pf-head.grid-head {
  height: auto;
  margin-bottom: 0.12in;
}

.pf-head.grid-head td {
  padding-top: 0.06in;
}

.pf-meter td:first-child {
  font-weight: 700;
}

/* Column heads repeat on every printed page; a row never splits across two. */
.pf thead {
  display: table-header-group;
}

.pf tr {
  break-inside: avoid;
}

.pf th {
  height: 0.35in;
  padding: 0 0.04in;
  font-family: var(--mono);
  font-size: 6.5pt;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #444;
  text-align: left;
  vertical-align: bottom;
  border: 0.75pt solid #000;
  border-bottom-width: 1.5pt;
}

.pf td {
  border: 0.75pt solid #000;
}

/* ---- ledger and logbook ---- */

.pf-ledger col.c-date { width: 0.8in; }
.pf-ledger col.c-asset { width: 1.05in; }
.pf-ledger col.c-parts { width: 1.85in; }
.pf-ledger col.c-cost { width: 0.65in; }
.pf-ledger col.c-meter { width: 0.7in; }
.pf-ledger col.c-by { width: 0.45in; }

.pf-ledger td {
  height: 0.3in;
  padding: 0 0.04in;
  font-size: 8pt;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-ledger td.c-cost,
.pf-ledger td.c-meter {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pf-foot {
  height: 0.9in;
}

.pf-foot td {
  vertical-align: bottom;
  padding: 0.04in 0.08in;
  text-align: right;
  border: 0;
  border-bottom: 0.75pt solid #000;
}

.pf-foot td + td {
  border-left: 0.75pt solid #000;
}

.pf-foot .pf-value {
  font-size: 11pt;
  font-variant-numeric: tabular-nums;
}

/* ---- checklist grid ---- */

.pf-grid th.c-task,
.pf-grid td.c-task {
  width: 2.4in;
}

.pf-grid[data-kind="month"] th.c-task,
.pf-grid[data-kind="month"] td.c-task {
  width: 1.9in;
}

.pf-grid .c-by,
.pf-grid .c-note {
  width: 0.45in;
}

.pf-grid th.c-day {
  text-align: center;
  padding: 0;
  font-size: 7pt;
  color: #000;
  letter-spacing: 0;
}

.pf-dn {
  display: block;
  font-size: 5.5pt;
  color: #444;
}

.pf-grid td {
  height: 0.38in;
}

.pf-grid td.c-task {
  padding: 0.03in 0.05in;
  vertical-align: top;
}

.t-title {
  display: block;
  font-weight: 700;
}

.t-int,
.t-proc {
  display: block;
  font-size: 6.5pt;
  color: #444;
}

.t-proc {
  font-style: italic;
}

/* Not due that day: an x, in text, so it prints without background graphics. */
.pf-grid td.na {
  text-align: center;
  vertical-align: middle;
  font-family: var(--mono);
  font-size: 7pt;
  color: #444;
}

.pf-grid tr.grp td {
  height: auto;
  padding: 0.05in 0.05in 0.02in;
  font-weight: 800;
  font-size: 9pt;
  border-top: 1.5pt solid #000;
}

.pf-grid tr.empty td {
  padding: 0.2in;
  text-align: center;
  color: #444;
}

.pf-defects {
  margin-top: 0.2in;
}

.pf-line {
  height: 0.3in;
  border-bottom: 0.75pt solid #000;
}

.pf-review {
  margin-top: 0.2in;
}

.pf-review .pf-label {
  display: inline-block;
}

/* ---- print -------------------------------------------------------------

   Only the form. Everything around it hides, and nothing that holds the table is a
   flex or grid box: Chrome does not fragment those across pages reliably. */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .sheet {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .masthead,
  .cards,
  .controls,
  .account,
  .colophon {
    display: none !important;
  }

  .preview {
    margin: 0;
    padding: 0;
    overflow: visible;
    background: none;
    border: 0;
  }

  /* As specific as the screen sizes above, or their min-height spills a blank page. */
  .pf[data-paper][data-orient] .pf-page {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    break-after: page;
  }

  .pf[data-paper][data-orient] .pf-page:last-child {
    break-after: auto;
  }
}

/* ---- phone ------------------------------------------------------------- */

@media (max-width: 34rem) {
  .cards a {
    padding: 0.5rem 0.55rem;
    letter-spacing: 0.08em;
  }

  .due-row {
    grid-template-columns: 1fr auto;
  }

  .due-when {
    grid-column: 1;
    text-align: left;
  }

  .due-row .done {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .ledger-row {
    flex-wrap: wrap;
    gap: 0.1rem 0.6rem;
  }

  .ledger-row .l-asset {
    flex: 1 1 auto;
  }

  .ledger-row .l-what {
    flex-basis: 100%;
    order: 3;
  }

  .ledger-row .l-parts {
    flex: 1 1 0;
    order: 4;
  }

  .ledger-row .l-cost,
  .ledger-row .l-meter {
    flex: 0 0 auto;
    order: 5;
  }

  /* Who, on the date line: a phone row is two lines, not three. */
  .ledger-row .l-by,
  .ledger-row .l-src {
    flex: 0 0 auto;
    order: 2;
  }

  /* An empty column holds no place on a wrapped line. */
  .ledger-row > span:empty {
    display: none;
  }

  /* A task or asset line leads with its name. */
  .task-row .l-what,
  .asset-row .l-what {
    order: 0;
  }

  .ledger-row .l-due {
    flex-basis: 100%;
    order: 6;
    text-align: left;
  }

  .part-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2rem;
  }

  .part-row .p-qty,
  .part-row .p-cost {
    grid-row: 2;
  }

  .part-head {
    display: none;
  }

  .part-report-head {
    display: none;
  }

  .part-report-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .r-ref {
    grid-column: 1 / -1;
  }

  .r-qty {
    display: none;
  }

  .form .num {
    width: 6rem;
  }
}
