/* Print pages (#11): loading sheet, route sheet, delivery challan. Plain black on white, one column, no app chrome. */
.print-sheet { max-width: 70rem; }
.print-sheet .sheet-meta { display: flex; flex-wrap: wrap; }
.print-sheet .sheet-meta div { min-width: 8rem; }
.print-sheet .sheet-meta dt { font-size: var(--text-sm); color: var(--ink-3); }
.print-sheet .sheet-meta dd { margin: 0; font-weight: 600; }
.print-sheet h2 { font-size: var(--text-lg); }
.print-sheet .sign { display: flex; gap: var(--space-xl); margin-top: 3rem; }
.print-sheet .sign div { flex: 1; border-top: 1px solid var(--ink); padding-top: var(--space-2xs); font-size: var(--text-sm); }
.trip-list { list-style: none; padding: 0; display: grid; }
.trip-list li { display: flex; flex-wrap: wrap; align-items: center; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.trip-list b { margin-right: auto; }

.print-only { display: none; }

@page { size: A4; margin: 10mm; }
@media print {
  .sidebar, .season, .skip, .toast, .no-print, .pbar, .pbar-close { display: none !important; }
  .print-only { display: block !important; }
  .print-head p { margin: 0 0 4mm; }
  .print-head .print-title { margin: 0 0 2mm; font-size: 20pt; font-weight: 700; }
  .app { display: block !important; min-height: 0; }
  .main-col { display: block; padding-bottom: 0 !important; }
  html, body, main, .print-sheet, .table-wrap { background: #fff !important; color: #000 !important; }
  main { padding: 0 !important; overflow: visible !important; }
  .print-sheet { max-width: none; font-size: 12pt; }
  .print-sheet .sheet-meta dt { color: #000; }
  .table-wrap { border: 0; overflow: visible; }
  .print-sheet table { border-collapse: collapse; width: 100%; }
  .print-sheet th, .print-sheet td { border: 1px solid #000; padding: 2mm 3mm; color: #000; background: #fff; }
  .print-sheet tr, .print-sheet .stop { break-inside: avoid; }
  .print-sheet a { color: #000; text-decoration: none; }
}

/* Bill of Supply (#12): A4 or a narrow thermal roll. Its own named page takes the paper the printer has. */
.bill-sheet { page: bill; }
@page bill { size: auto; margin: 4mm 4mm 7mm; } /* #917: the bottom margin holds "Page x of y" (margin box below) */
@page bill-hi { size: auto; margin: 4mm 4mm 7mm; }
@page bill { @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt Mukta, sans-serif; color: #000; } }
@page bill-hi { @bottom-right { content: "पृष्ठ " counter(page) " / " counter(pages); font: 8pt Mukta, sans-serif; color: #000; } }
.bill-sheet:has([data-print-lang="hi"]) { page: bill-hi; } /* a Hindi bill gets the Hindi page label; a day or trip print on A4 or A5 is one job per bill (see data-job below); on a roll there is no label */
.bill-sheet:has(.bill-page) { page: bill; }
/* #917 (owner, "Count per bill"): print-bar.ts prints a range of bills as one job per bill (data-job on the sheet, data-job-now on the bill of this job),
   so each bill counts its own pages. The page label follows the language of the bill that is printing. */
@media print { .bill-sheet[data-job] .bill-page:not([data-job-now]) { display: none; } .bill-sheet[data-job] .bill-page { break-before: auto; } }
.bill-sheet[data-job]:not(:has([data-job-now] [data-print-lang="hi"])) { page: bill; }
.bill-sheet[data-job]:has([data-job-now] [data-print-lang="hi"]) { page: bill-hi; }
.bill-sheet .bill-head { text-align: center; }
.bill-sheet .bill-head h1 { margin: 0; }
.bill-sheet .bill-note { font-size: var(--text-sm); margin: var(--space-2xs) 0; }
.bill-sheet .bill-seller { margin: 0; }
.bill-sheet .bill-address { white-space: pre-line; }
.bill-sheet .bill-terms { white-space: pre-line; overflow-wrap: anywhere; font-size: 0.85em; } /* #447: terms of the bill day */
.bill-sheet .bill-head .sheet-meta { justify-content: center; margin: var(--space-2xs) 0 0; }
/* #959 (billing): the bill is one closed box grid, like a supplier invoice. Each header value is its own bordered cell, so the email and the GSTIN
   cannot run together; name and phone, and bill number and date, never share a cell. A cell draws its right and bottom line and is pulled over the
   next one by 1px; the row clips the extra line, so there is no double or broken line. */
.bill-sheet .bill-box { border: 1px solid #000; box-sizing: border-box; max-width: 100%; width: 100%; color: #000; font-size: 11pt; }
.bill-sheet .bill-box .bill-head { padding: 0; }
.bill-sheet .bill-box .bill-head > :not(.bb-contact) { padding: 0 2mm; }
.bill-sheet .bill-box .bill-head h1 { padding-top: 1mm; }
.bill-sheet .bill-box .bill-head .bill-address { padding-bottom: 1mm; }
.bill-sheet .bb-cell { border-right: 1px solid #000; border-bottom: 1px solid #000; margin: 0 -1px -1px 0; padding: 1mm 2mm; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; text-align: left; }
.print-sheet .bill-box .sheet-meta .bb-cell { min-width: 0; }
.bill-sheet .bb-cell dt { font-size: 0.75em; color: #000; }
.bill-sheet .bb-cell dd { margin: 0; font-weight: 600; }
.bill-sheet .bb-contact .bb-cell dd { font-size: 0.9em; }
.bill-sheet .bill-box .bb-contact { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; overflow: hidden; margin: 0; border-top: 1px solid #000; }
.bill-sheet .bill-box .bb-ref { display: flex; align-items: stretch; gap: 0; overflow: hidden; }
.bill-sheet .bill-box .bb-ref .sheet-meta { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin: 0; overflow: hidden; }
.bill-sheet .bill-box .bb-ref .bill-party { flex: 1 1 58%; min-width: 0; }
.bill-sheet .bill-box .bb-ref .bill-ref { flex: 1 1 42%; min-width: 0; border-left: 1px solid #000; }
.bill-sheet .bill-box .table-wrap { border: 0; margin: 0; overflow: visible; background: transparent; }
.bill-sheet .bill-box .bill-lines { border-collapse: collapse; width: 100%; margin: 0; }
.bill-sheet .bill-box .bill-lines th, .bill-sheet .bill-box .bill-lines td { border: 1px solid #000; padding: 1mm 1.5mm; color: #000; background: transparent; }
.bill-sheet .bill-box .bill-lines :is(th, td):first-child { border-left: 0; }
.bill-sheet .bill-box .bill-lines :is(th, td):last-child { border-right: 0; }
.bill-sheet .bill-box .bill-lines tbody td { border-top: 0; border-bottom: 0; } /* only the vertical lines run through the lines of items */
.bill-sheet .bill-box .bill-lines tfoot tr:last-child td { border-bottom: 0; }
.bill-sheet .bill-box :is(th, td).n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; } /* #959: Qty, Rate, Amount and the totals are right-aligned, heads too, so the decimals line up */
.bill-sheet .bill-box .bill-lines .bb-sno { width: 9mm; text-align: center; }
.bill-sheet .bill-box .bill-close { padding: 1mm 2mm; }
.bill-sheet .bill-ref dd { overflow-wrap: anywhere; }
.bill-sheet .bill-party dd { overflow-wrap: anywhere; }
.bill-sheet tfoot th { text-align: right; }
.bill-sheet .bill-lines .bill-close-row td { padding: 0; border-width: 1px 0 0; background: transparent; } /* #917: the amount in words and the signature are the last row of the totals, drawn without the totals shading */
/* #917 (owner): signature line. It shares a row with the amount in words, right under the totals, so it adds almost no height and a bill that fitted one A4 page still does.
   A blank space above a rule, then the label (Hindi and English on one line for a Hindi bill). */
.bill-sheet .bill-close { display: flex; flex-wrap: wrap; align-items: flex-end; break-inside: avoid; }
.bill-sheet .bill-close .bill-words { flex: 1 1 60mm; }
.bill-sheet .bill-sign { flex: 0 0 auto; margin-top: 7mm; font-size: 9pt; }
.bill-sheet .bill-sign span { display: block; min-width: 55mm; border-top: 1px solid currentColor; padding-top: 0.5mm; text-align: center; }
.bill-sheet .bill-sign .bill-hi, .bill-sheet .bill-sign .bill-en { display: inline; font-size: inherit; line-height: inherit; }
@media print {
  .bill-sheet tfoot { display: table-row-group; } /* #917 (owner): the totals rows print once, after the last line, not on every page */
  /* #917: the totals rows and the words-and-signature row stay together on one page. There is no chain from the last item row to the totals: with the column heads repeated, Chromium then splits the totals from the signature anyway. */
  .bill-sheet p.bill-total, .bill-sheet .bill-lines tfoot tr:not(:last-child) { break-after: avoid; }
  .bill-sheet tfoot tr, .bill-sheet .bill-pay, .bill-sheet .bill-terms, .bill-sheet .bill-greeting, .bill-sheet .bill-words { break-inside: avoid; }
}
.bill-sheet .bill-hi, .bill-sheet .bill-en { display: block; overflow-wrap: anywhere; }
.bill-sheet .bill-hi { font-size: 1.25em; line-height: 1.3; }
.bill-sheet .bill-en { font-size: 0.8em; }
.bill-sheet .bill-mod { font-size: 0.85em; padding-left: 1em; }
.bill-sheet .bill-pay th { white-space: normal; } /* a long label wraps inside an 80 mm roll */
.bill-sheet .bill-total, .bill-sheet .bill-words { font-weight: 700; }
.bill-sheet .bill-greeting { text-align: center; overflow-wrap: anywhere; } /* D9: print-time line */
/* #174 row 131: a cancelled trade bill. A thick border prints in black and white too; no colour is needed. */
.bill-sheet .bill-cancelled { border: 3px solid currentColor; padding: var(--space-sm); margin: var(--space-md) 0; font-size: 1.2em; text-align: center; overflow-wrap: anywhere; }
/* #621 (row 347): the compact bill always prints on an 80 mm roll; height fixed as in print-pos80.css (#341). */
.bill-sheet:has(.bill-compact) { page: bill-compact; }
@page bill-compact { size: 80mm 3000mm; margin: 3mm; }
.bill-compact { max-width: 74mm; font-size: 9pt; }
.bill-compact .sheet-meta div { flex: 1 1 100%; }
.bill-compact .sheet-meta dd { overflow-wrap: anywhere; }
.bill-compact .bc-line { border-top: 1px dashed currentColor; padding: 0.5mm 0; break-inside: avoid; }
.bill-compact .bc-item, .bill-compact .bc-calc span:first-child { overflow-wrap: anywhere; min-width: 0; }
.bill-compact .bc-calc { display: flex; justify-content: space-between; gap: 2mm; }
.bill-compact .bc-calc .n { white-space: nowrap; }
.bill-compact .bc-sum { width: 100%; }
.bill-compact .bc-sum th { text-align: right; white-space: normal; }
@media print and (max-width: 100mm) {
  .print-sheet { font-size: 9pt; }
  .print-sheet th, .print-sheet td { padding: 0.5mm 1mm; }
  .print-sheet .sheet-meta { margin-bottom: var(--space-2xs); }
  .print-sheet .sheet-meta div { min-width: 0; }
}

/* All bills of a trip in one print job (#176): one page per bill. */
@media print { .bill-page + .bill-page { break-before: page; } }

/* Credit note print (#12 C): each labelled value on its own line, also at 360 px and on an 80 mm roll. */
.bill-sheet .cn-fields div { flex: 1 1 100%; }
.bill-sheet .cn-fields dd { overflow-wrap: anywhere; }

/* Print destination of the device (#181). A4 has no class and no rule here. Rolls: the page width comes from <style id="print-dest-page">. */
@media print {
  .pd-pos80 .print-sheet, .pd-roll6 .print-sheet { font-size: 9pt; }
  .pd-pos80 .print-sheet th, .pd-pos80 .print-sheet td { padding: 0.5mm 1mm; }
  .pd-roll6 .print-sheet { font-size: 11pt; }
  .pd-pos80 .print-sheet .sheet-meta { margin-bottom: var(--space-2xs); }
  .pd-pos80 .print-sheet .sheet-meta div { min-width: 0; }
  .pd-pos80 .print-sheet .sign, .pd-roll6 .print-sheet .sign { flex-direction: column; gap: 2rem; }
}

/* Parcel stickers (slice Q, #420). On screen a grid of cards. On paper: A4 label sheets (3 columns) and single-label printers
   (one sticker per page when the page is label-sized: the sticker keeps its own size and breaks after itself). */
.sticker-sheet { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.sticker { display: flex; justify-content: space-between; align-items: center; border: 1px dashed var(--rule); border-radius: var(--radius); background: #fff; color: #000; }
.sticker-text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.sticker-no { font-size: var(--text-lg); }
.sticker-of { font-size: var(--text-lg); }
.sticker .qr { width: 7.5rem; height: auto; flex: none; border: 0; }
@media print {
  .sticker-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
  .sticker { break-inside: avoid; page-break-inside: avoid; border: 1px solid #000; border-radius: 0; height: 38mm; padding: 2mm; font-size: 10pt; color: #000; }
  .sticker .qr { width: 30mm; }
  .sticker-no, .sticker-of { font-size: 12pt; }
}
/* Month-end health part (#654): a test row and its band stay together on the A4 page. */
@media print { .me-health li, .me-health h3 { break-inside: avoid; } .me-health h3 { break-after: avoid; } }
.bill-copy { text-align: right; font-weight: 600; margin: 0 0 var(--space-xs); }
.bill-sheet .bill-box .bb-total { margin: 0; padding: 1mm 2mm; border-top: 1px solid #000; text-align: right; } /* #959: the credit amount row of a credit note */
