/* Invoices (ui/invoices.js, ui/payments.js, ui/lines.js, ui/doc.js): the list, the form, the invoice page, the dialogs and the printed invoice, in Wave's look
   (V, 11 Oct 2026: "make sure the UI/UX looks the same as wavesapp"; Claude outputs/2026-10-11 Wave screen survey.md, Invoices and Visual style).
   Page-specific rules only: the tokens and the shared parts (strip, filters, seg, split button, menus, dialogs, pager, empty state) live in app.css.
   The line editor (.lines, .l-row ...) and the totals box are shared with the estimate and recurring forms, so they are styled once, here.
   Sizes are used by name (var(--type-*)); motion is transform and opacity only, under 300 ms, and the global reduced-motion rule switches it off. */

/* ---- small shared bits ---- */
.icon-btn{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;min-height:32px;padding:0;border-radius:50%;color:var(--text-secondary);transition:background 120ms var(--ease),color 120ms var(--ease),transform 140ms var(--ease)}
.icon-btn:active{transform:matrix(.97,0,0,.97,0,0)}
.icon-btn:disabled{opacity:.35;cursor:default;transform:none}
@media (hover:hover) and (pointer:fine){.icon-btn:not(:disabled):hover{background:var(--accent-soft);color:var(--accent)}}
.help{color:var(--text-secondary);font-size:var(--type-s)}
.dlg-body>.lbl{font-size:var(--type-xs);font-weight:700;color:var(--text-secondary)}
.send-form>.lbl{font-size:var(--type-xs);font-weight:700;color:var(--text-secondary)}
.soft{color:var(--text-tertiary);font-size:var(--type-s)}
.ok-note{color:var(--ok-ink);font-weight:600;font-size:var(--type-s)}
.circle-btn.flip svg{transform:rotate(180deg)}
.circle-btn[disabled]{opacity:.4;cursor:default}
.icon{flex:none}
.spin{flex:none;width:16px;height:16px;border-radius:50%;border:2px solid var(--line-strong);border-top-color:var(--accent);animation:inv-spin 300ms linear infinite}
@keyframes inv-spin{to{transform:rotate(360deg)}}
.note.pdf-note{display:flex;align-items:center;gap:10px}
.note.pdf-note:empty{display:none}

/* ---- the list ---- */
.strip .strip-foot{flex:1 0 100%;display:flex;align-items:center;gap:6px;padding:8px 24px;border-top:1px solid var(--divider);color:var(--text-secondary);font-size:var(--type-s)}
@media (max-width:719px){.strip .strip-foot{padding:8px 18px}}
.list-card{gap:14px}
.wave-filters{grid-template-columns:repeat(2,minmax(0,1fr));align-items:end}
.wave-filters .search-box{grid-column:1 / -1}
@media (min-width:960px){.wave-filters{grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1.3fr)}.wave-filters .search-box{grid-column:auto}}
.search-box{position:relative;display:flex;align-items:center;min-width:0}
.search-box input{padding-right:76px}
.search-box .icon-btn{position:absolute;top:4px}
.search-box .icon-btn:last-child{right:4px}
.search-box .icon-btn:nth-last-child(2){right:36px}
.seg-row{display:flex;justify-content:center;padding-top:14px;border-top:1px solid var(--divider)}
.tab-panel{display:flex;flex-direction:column;gap:14px;min-width:0}
.th-sort{display:inline-flex;align-items:center;gap:4px;padding:0;min-height:0;font:inherit;letter-spacing:inherit;text-transform:inherit;color:inherit;text-align:inherit}
.th-sort .sort-caret{transition:transform 140ms var(--ease)}
.th-sort .sort-caret.up{transform:rotate(180deg)}
.table tr.row-click{cursor:pointer}
.table td.late-text{color:var(--bad-ink);font-weight:600}
.wave-list td.name{color:var(--text-primary)}
.wave-list td.act{padding-left:12px}
.pager .per-page{display:inline-flex;align-items:center;gap:8px}
.pager .range{min-width:56px;text-align:right}
.tbl-empty:empty{display:none}
@media (max-width:959px){
  .wave-list tr.row-click{cursor:default}
  .table.inv.wave-list td.act{grid-column:1 / -1;text-align:left;padding-left:0;width:auto}
  .wave-list td.act .act-cell{justify-content:flex-start}
  .seg-row .seg button{padding:0 12px}
}

/* ---- the form ---- */
.collapse{background:var(--bg-panel);border:1px solid var(--divider);border-radius:var(--radius)}
.collapse-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;padding:0 18px;text-align:left;font-weight:700;color:var(--text-secondary);border-radius:var(--radius)}
.collapse-bar .collapse-caret{transition:transform 160ms var(--ease-out)}
.collapse-bar[aria-expanded=true] .collapse-caret{transform:rotate(90deg)}
.collapse-body{padding:4px 18px 18px;display:flex;flex-direction:column;gap:10px}
.biz-bar{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
.biz-left{display:flex;flex-direction:column;gap:2px;color:var(--text-secondary)}
.biz-name{font-weight:700;color:var(--text-primary)}
.biz-right{display:flex;flex-direction:column;gap:10px}
.biz-right input{text-align:right}
.biz-right .title-in{font-size:var(--type-xxl);font-weight:400;min-height:52px}
@media (min-width:960px){.biz-bar{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}
.inv-form{gap:20px}
@media (min-width:960px){.inv-form .top{grid-template-columns:minmax(0,1fr) minmax(0,420px);gap:32px}}
.cust-card{background:var(--bg-panel-2);border-radius:var(--radius-sm);padding:12px 14px;line-height:1.45;color:var(--text-secondary)}
.cust-card strong{display:block;color:var(--text-primary)}
.add-link{display:inline-flex;align-items:center;gap:8px}
.wave-meta{gap:10px}
.wave-meta .field{flex-direction:row;align-items:center;gap:12px}
.wave-meta .field>.lbl{flex:0 0 132px;text-align:right}
.wave-meta .field>input,.wave-meta .field>.due-wrap{flex:1 1 auto;min-width:0}
.due-wrap{display:flex;flex-direction:column;gap:4px}
@media (max-width:719px){.wave-meta .field{flex-direction:column;align-items:stretch;gap:6px}.wave-meta .field>.lbl{flex:none;text-align:left}}
.l-tab{display:flex}
.tab-btn{display:inline-flex;align-items:center;gap:8px;padding:0 14px;background:var(--bg-panel-2);border-radius:var(--radius-xs) var(--radius-xs) 0 0}
.collapse-body textarea:disabled{background:var(--bg-panel-2);color:var(--text-secondary);resize:none}
.card-tags,.card-files{gap:12px}
.file-box{display:flex;flex-direction:column;gap:12px}
.dropzone{width:100%;display:flex;flex-direction:column;align-items:center;gap:4px;padding:28px 16px;border:2px dashed var(--line-strong);border-radius:var(--radius);background:var(--bg-panel);color:var(--text-secondary);transition:background 120ms var(--ease),border-color 120ms var(--ease),transform 140ms var(--ease)}
.dropzone:active{transform:matrix(.99,0,0,.99,0,0)}
.dropzone .drop-t{font-weight:600;color:var(--text-primary)}
.dropzone .drop-s{font-size:var(--type-s)}
.file-box.over .dropzone{background:var(--accent-soft);border-color:var(--accent)}
@media (hover:hover) and (pointer:fine){.dropzone:hover{background:var(--bg-panel-2)}}
.chips{list-style:none;display:flex;flex-wrap:wrap;gap:8px}
.chip{display:inline-flex;align-items:center;gap:8px;max-width:100%;min-width:0;padding:4px 12px;border:1px solid var(--divider);border-radius:var(--pill);background:var(--bg-panel-2)}
.chip-n{min-width:0;overflow-wrap:anywhere;text-align:left}
.chip-s{flex:none;color:var(--text-tertiary);font-size:var(--type-s)}
.form-foot{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}

/* ---- the line editor: Wave's items table ---- */
.lines{display:flex;flex-direction:column;gap:0}
.l-head{display:none}
.l-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 10px;padding:12px 0;border-top:1px solid var(--divider);align-items:center}
.l-item{grid-column:1 / -1;display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px;min-width:0}
.l-item>select{flex:1 1 180px;min-width:0}
.l-item>input{flex:3 1 220px;min-width:0}
.l-act{grid-column:1 / -1;display:flex;justify-content:flex-end;align-items:center;gap:4px}
.l-sub{grid-column:1 / -1;display:flex;align-items:center;gap:8px;color:var(--text-secondary);font-size:var(--type-s)}
.l-sub select{width:auto;min-height:32px;padding:0 10px;color:var(--text-secondary)}
.l-sub .kind-fixed{min-height:32px;font-weight:600}
.l-sub-k{font-weight:700}
.l-sub .btn.quiet{margin-left:auto}
.l-item>textarea{flex:3 1 220px;min-width:0;min-height:var(--hit);resize:vertical}
.amt{text-align:right;color:var(--text-primary)}
.l-cell{display:flex;flex-direction:column;gap:4px;min-width:0}
.l-lbl{font-size:var(--type-s);font-weight:700;color:var(--text-secondary);overflow-wrap:anywhere}
.l-cell .amt{display:flex;align-items:center;justify-content:flex-end;min-height:var(--hit)}
.l-add{display:flex;gap:12px;flex-wrap:wrap;padding-top:8px}
.l-add .btn{display:inline-flex;align-items:center;gap:8px}
@media (min-width:960px){
  .l-cell{display:contents}   /* the head carries the words here, and the boxes are the grid's own cells */
  .l-cell-empty{display:block}   /* a discount in percent has no quantity box: its place stays */
  .l-lbl{display:none}
  .l-head,.l-row{grid-template-columns:minmax(0,1fr) 96px 120px 120px 112px;gap:8px 10px}   /* the last cell: Move up, Move down, Remove (3 x 32 px and two 4 px gaps) */
  .l-head{display:grid;align-items:center;padding:10px 12px;border-bottom:0;border-radius:var(--radius-xs);background:#e9eef2;color:var(--text-secondary);font-size:var(--type-xs);font-weight:700}
  .l-row{padding:12px}
  .l-item{grid-column:auto;flex-wrap:nowrap;align-items:flex-start}
  .l-item>select{flex:0 1 190px}
  .l-act{grid-column:auto}
  .l-sub{padding-left:2px}
}
.totals{align-items:flex-end;padding-top:6px}
.totals dl{min-width:min(100%,300px);grid-template-columns:1fr auto;gap:8px 28px}
.totals dt{color:var(--text-secondary)}
.totals dd{color:var(--text-primary)}
.totals .due{padding-top:10px;border-top:1px solid var(--divider);font-weight:700;color:var(--text-primary)}
.totals .cur{color:var(--text-secondary);font-size:var(--type-s)}

/* ---- Customize this invoice (Edit columns) ---- */
.col-group{border:0;display:flex;flex-direction:column;gap:0;min-width:0}
.col-group legend{padding:0 0 4px}
.check.other{flex-wrap:wrap}
.check.other input[type=text]{flex:1 1 140px;width:auto;height:var(--hit);min-height:var(--hit);padding:0 12px}

/* ---- Record a payment ---- */
.money-in{display:flex;align-items:stretch}
.money-sign{display:flex;align-items:center;padding:0 12px;border:1px solid var(--line-strong);border-right:0;border-radius:var(--radius-sm) 0 0 var(--radius-sm);background:var(--bg-panel-2);color:var(--text-secondary)}
.money-in input{border-top-left-radius:0;border-bottom-left-radius:0}
.pay-list{list-style:none;display:flex;flex-direction:column;gap:10px}
.pay-list li{display:flex;flex-direction:column;gap:2px}
.pay-line{color:var(--text-secondary)}
.pay-links{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.pay-links .rowlink{min-height:0;line-height:1.35}

/* ---- the invoice page ---- */
.draft-banner{display:flex;align-items:center;justify-content:space-between;gap:12px 20px;flex-wrap:wrap;padding:14px 20px;background:#fff5cf;border:1px solid #ecd982;border-radius:var(--radius)}
.draft-text{font-weight:600}
.draft-act,.banner-act{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.timeline{display:flex;flex-direction:column}
.tl-card{position:relative;display:flex;align-items:flex-start;gap:16px;padding-bottom:16px}
.tl-card:not(:last-child)::before{content:"";position:absolute;left:19px;top:44px;bottom:4px;width:2px;background:var(--divider)}
.tl-dot{position:relative;z-index:1;flex:none;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--accent-soft);color:var(--accent)}
.tl-body{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:8px;padding:16px 20px;background:var(--bg-panel);border:1px solid var(--divider);border-radius:var(--radius)}
.tl-card.off .tl-dot{background:var(--grey-bg);color:var(--text-tertiary)}
.tl-card.off .tl-body{background:var(--bg-panel-2);color:var(--text-secondary)}
.tl-line{color:var(--text-secondary)}
.timeline .step-act{padding-top:4px}
.attach{display:flex;flex-direction:column;gap:8px;padding-top:6px;border-top:1px solid var(--divider)}
.attach-h{display:flex;align-items:center;justify-content:space-between;gap:12px}
@media (max-width:519px){.tl-card{gap:10px}.tl-body{padding:14px}}

/* ---- Send invoice ---- */
.send-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:20px}
@media (min-width:760px){.send-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}
.send-form{display:flex;flex-direction:column;gap:12px;min-width:0}
.send-pre{display:flex;flex-direction:column;gap:10px;min-width:0;padding:16px;background:var(--bg-panel-2);border-radius:var(--radius)}
.to-row{display:flex;align-items:flex-start;gap:8px}
.to-list{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:8px}
.mail{display:flex;flex-direction:column;gap:12px;padding:18px;background:#fff;border:1px solid var(--divider);border-radius:var(--radius-sm);overflow-wrap:anywhere}
.mail-biz{padding-bottom:10px;border-bottom:1px solid var(--divider);font-weight:700}
.mail-sum{font-size:var(--type-l)}
.mail-msg{white-space:pre-wrap}
.mail-ref{color:var(--text-secondary)}
/* the two tabs (Via email, More options) and their panes; More options holds Wave's Download PDF card and its line "Ready to send? Launch email" */
.send-tabs{align-self:flex-start}
.send-pane{display:flex;flex-direction:column;gap:14px;min-width:0}
.send-card{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:16px;border:1px solid var(--divider);border-radius:var(--radius)}
.send-card-t{font-weight:700}
.send-card-s{color:var(--text-secondary);font-size:var(--type-s)}
.send-ready{line-height:1.45}
/* the preview of the email, as lib/clientpage.js emailHtml draws it: the business over a rule, then centred Invoice #N, Amount due, the figure, Due on and (an app invoice
   only; a Wave import's plain email has none) the View invoice button in the invoice's own accent (--mail-accent, set from the model), then the message. The button is a
   picture of the email's, not a control. */
.mail-email{gap:16px}
.mail-email .mail-biz{padding-bottom:16px;text-align:center;font-size:var(--type-l);font-weight:600}
.mail-card{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center}
.mail-email .mail-ref{margin-bottom:12px;color:var(--text-primary);font-size:var(--type-m);font-weight:600}
.mail-due,.mail-on{color:var(--text-secondary);font-size:var(--type-s)}
.mail-email .mail-sum{font-size:var(--type-xl);font-weight:700;line-height:1.2}
.mail-on{margin-bottom:16px}
.mail-btn{display:inline-block;padding:12px 32px;border-radius:var(--pill);background:var(--mail-accent,var(--accent));color:var(--mail-on-accent,#fff);font-size:var(--type-m);font-weight:600;line-height:1.25}
.mail-email .mail-msg{line-height:1.5}
.preview-dlg{min-width:0;overflow:auto}

/* ---- the printed invoice: Wave's "Contemporary" page (white, a thin border and a soft shadow, about 820 px wide, the accent #7F7F7F on the items header) ---- */
.paper{max-width:820px;width:100%;justify-self:center;padding:40px 44px;gap:26px;border-radius:var(--radius-xs);background:#fff;color:#182127;font-size:var(--type-s);line-height:1.45;box-shadow:0 0 0 1px var(--divider),0 6px 20px rgba(24,33,39,.08)}
.paper .p-head{display:flex;justify-content:flex-end;padding-bottom:20px;border-bottom:1px solid var(--divider)}
.paper .p-title{display:flex;flex-direction:column;align-items:flex-end;gap:2px;text-align:right;min-width:0;max-width:100%}
.paper .p-word{font-size:36px;font-weight:300;line-height:1.1;letter-spacing:-.54px;text-transform:uppercase;color:#182127;overflow-wrap:anywhere}
.paper .p-summary{color:#515f66;white-space:pre-line}
.paper .p-project{font-weight:700;color:#182127;white-space:pre-line;overflow-wrap:anywhere}
.paper .p-from{display:flex;flex-direction:column;align-items:flex-end;margin-top:10px;line-height:1.45}
.paper .p-from strong{font-weight:700}
.paper .p-meta{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,340px);gap:24px;align-items:start}
.paper .p-cap{display:block;font-weight:700;color:#515f66}
.paper .p-to{display:flex;flex-direction:column;min-width:0;overflow-wrap:anywhere}
.paper .p-name{font-weight:700}
.paper .p-dates{display:grid;grid-template-columns:auto minmax(0,1fr);gap:0;text-align:left;align-content:start}
.paper .p-dates dt{padding:4px 14px 4px 10px;text-align:right;font-weight:700;color:#182127}
.paper .p-dates dd{padding:4px 10px 4px 0;overflow-wrap:anywhere}
.paper .p-dates dt.due,.paper .p-dates dd.due{background:#eef1f4;font-weight:700;color:#182127}
.paper .p-dates dt.due{border-radius:var(--radius-xs) 0 0 var(--radius-xs)}
.paper .p-dates dd.due{border-radius:0 var(--radius-xs) var(--radius-xs) 0}
.paper .p-lines{width:100%;border-collapse:collapse}
.paper .p-lines th{background:var(--paper-accent,#7f7f7f);color:var(--paper-on-accent,#fff);text-align:left;padding:9px 12px;font-weight:600}   /* the two properties are set on the page by ui/doc.js from settings.accentColor */
/* Browsers print without background colours unless the page asks for them: with no fill the header words (white or light) would print almost invisible on white, and the grey Amount Due row would go. These three are the only fills of today's look; the design adds two more (the band and the accent bar, below), which ask the same. */
.paper .p-lines th,.paper .p-dates dt.due,.paper .p-dates dd.due{-webkit-print-color-adjust:exact;print-color-adjust:exact}
.paper .p-lines td{padding:10px 12px 2px;vertical-align:top;border-bottom:0}
.paper .p-lines th.n,.paper .p-lines td.n{text-align:right;font-variant-numeric:tabular-nums}
.paper .p-lines th.c,.paper .p-lines td.c{text-align:center;font-variant-numeric:tabular-nums}
.paper .p-item{overflow-wrap:anywhere}
.paper .p-kind{font-weight:700}
.paper .p-when{color:#515f66;font-weight:400}
.paper .p-desc{color:#182127;white-space:pre-line}
.paper .p-totals{display:grid;grid-template-columns:minmax(0,1fr) auto;justify-self:end;gap:6px 18px;width:min(100%,430px);padding-top:14px;border-top:1px solid var(--divider);text-align:right;align-content:start}
.paper .p-totals dt{color:#182127;overflow-wrap:anywhere}
.paper .p-totals dd{font-variant-numeric:tabular-nums}
.paper .p-totals .strong{font-weight:700}
.paper .p-notes,.paper .p-pay,.paper .p-files{display:flex;flex-direction:column;gap:2px;color:#182127}
.paper .p-notes .p-cap,.paper .p-pay .p-cap,.paper .p-files .p-cap{color:#182127}
.paper .p-memo{white-space:pre-line;overflow-wrap:anywhere}
.paper .p-footer{display:flex;flex-direction:column;border-top:1px solid var(--divider);padding-top:12px;color:#515f66;font-size:var(--type-s);line-height:1.45;overflow-wrap:anywhere}
/* Invoice design (spec 2026-10-16): one class on the page per style that is not the default (ui/doc.js variantClasses), so none of these rules touch today's page.
   The logo in its box (Small 2, Medium 3, Large 4 grid columns wide; 3, 4, 5 baselines tall, the PDF's LOGO_BOX at 4/3 px per pt), never stretched. Not under .paper:
   the statement screen (ui/statements.js) draws the same box above the business name. */
.p-logo{display:block;flex:none;object-fit:contain;object-position:left top;max-width:100%}
.p-logo.s{width:99px;height:56px}
.p-logo.m{width:156px;height:75px}
.p-logo.l{width:213px;height:93px}
.paper .p-head.has-logo{align-items:flex-start;gap:24px}
.paper:not(.hs-centered) .p-head .p-logo{margin-right:auto}   /* the logo at the left pushes the title flush right; a picture that cannot be read hides its box and the title stays where it is today */
.paper.hs-centered .p-head{flex-direction:column;align-items:center;justify-content:flex-start}
.paper.hs-centered .p-logo{object-position:center bottom}   /* a wide picture sits just above the title, as in the PDF (its box there is only as tall as the picture) */
.paper.hs-centered .p-title{align-items:center;text-align:center}
.paper.hs-centered .p-from{align-items:center}
.paper.hs-band .p-head{background:var(--paper-accent);color:var(--paper-on-accent);padding:20px 24px;border-bottom:0;border-radius:var(--radius-xs);align-items:center}
.paper.hs-band .p-word,.paper.hs-band .p-project,.paper.hs-band .p-summary{color:var(--paper-on-accent)}
.paper.hs-band .p-logo{object-position:left center}   /* on the band's centre line with the title */
.paper .p-under{margin-top:-12px;padding-bottom:20px;border-bottom:1px solid var(--divider);text-align:right}   /* the business under the band, right aligned, close to it, then the header's rule as in the PDF */
.paper.ps-billRight .p-meta{grid-template-columns:minmax(0,340px) minmax(0,1fr)}
.paper.ps-billRight .p-to{order:2}
.paper.ps-billRight .p-dates{order:1}
.paper.is-ruled .p-lines th{background:none;color:var(--paper-accent-ink);border-bottom:2px solid var(--paper-accent)}
.paper.is-minimal .p-lines th{background:none;color:#515f66;border-bottom:1px solid var(--divider)}
.paper.is-minimal .p-lines td{border-bottom:1px solid var(--divider);padding-bottom:10px}
.paper.is-minimal .p-lines tbody tr:last-child td{border-bottom:0}   /* as the PDF: a hairline under the header and between rows; the totals draw their own rule */
/* The accent bar is one fill across the due row, inside the totals block: the label reaches over the 18px column gap of .p-totals, and every figure keeps the bar's 8px inset,
   so the due figure lines up with the figures above (the PDF pads every totals cell the same way). */
.paper.ts-accentBar .p-totals dd{padding-right:8px}
.paper.ts-accentBar .p-totals .p-due{background:var(--paper-accent);color:var(--paper-on-accent);padding-top:4px;padding-bottom:4px}
.paper.ts-accentBar .p-totals dt.p-due{margin-right:-18px;padding-left:8px;padding-right:18px;border-radius:var(--radius-xs) 0 0 var(--radius-xs)}
.paper.ts-accentBar .p-totals dd.p-due{border-radius:0 var(--radius-xs) var(--radius-xs) 0}
.paper.hs-band .p-head,.paper.ts-accentBar .p-totals .p-due{-webkit-print-color-adjust:exact;print-color-adjust:exact}
@media (max-width:719px){
  .paper{padding:24px 16px;gap:20px}
  .paper .p-word{font-size:28px}
  .paper .p-meta{grid-template-columns:minmax(0,1fr)}
  .paper .p-totals{width:100%}
  .paper.ps-billRight .p-meta{grid-template-columns:minmax(0,1fr)}
  .paper .p-head.has-logo{flex-direction:column;align-items:stretch}   /* the logo above the title; the title keeps its full width, so its words stay flush right */
  .paper.hs-centered .p-head.has-logo{align-items:center}
}
@media (max-width:519px){
  /* The figure columns take the width of their widest figure (a figure never wraps), the item column takes what is left and its text wraps (.p-item breaks anywhere), as the PDF does.
     A fixed share of the width (24 percent each) was about 65 px of text on a phone: a five digit amount ran out of its column into the next one. */
  .paper .p-lines th,.paper .p-lines td{padding-left:6px;padding-right:6px}
  .paper .p-lines td.n,.paper .p-lines td.c{white-space:nowrap}
  .paper{overflow-x:auto}   /* the last resort on the narrowest phones (320 px, long column words or a seven digit amount): the sheet scrolls on its own, the page never does and no figure is cut */
}
@media print{
  .timeline,.draft-banner,.strip,.pdf-note,.page-head,.fcount,.list-card,.action-box,.form-foot,.no-print{display:none!important}   /* .no-print: the Payments panel of the invoice page */
  .paper{box-shadow:none;padding:0;max-width:none}
}
