/* PCC Ops — round 10 (G15): the printed traveler (js/travelerdoc.js). A paper form: black on white, Arial, US Letter.
   Everything is scoped under .tdoc / .tdoc-body and the named pages "tdoc" / "tdoc-wo" / "tdoc-qc", so linking this file in index.html changes
   nothing in the app and no other page's printing. The traveler itself opens in its own tab (or the Traveler page's viewer), which loads this file.
   r12 (B4): monday "Assembly WO" look (bordered cells, sign-off rows with an N/A column), 0.3 in / 0.32 in / 0.4 in margins and the full width,
   0.28 in write-in rows, light shading only (prints fine in black and white). CSS only: the server PDF (mods/traveler.py) blocks JS. */
@page tdoc { size: letter; margin: 0.3in 0.32in 0.4in;
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 7.5pt Arial, Helvetica, sans-serif; color: #333; }
  @bottom-left { font: 7.5pt Arial, Helvetica, sans-serif; color: #333; } }

/* r11 (A19): page 1 = Form 003 (work order), the QC data sheet = Form 006. Same sheet, two named pages, so each prints its own form
   number in the footer (the content strings are set inline by travelerdoc.js). */
@page tdoc-wo { size: letter; margin: 0.3in 0.32in 0.4in;
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 7.5pt Arial, Helvetica, sans-serif; color: #333; }
  @bottom-left { font: 7.5pt Arial, Helvetica, sans-serif; color: #333; } }
@page tdoc-qc { size: letter; margin: 0.3in 0.32in 0.4in;
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 7.5pt Arial, Helvetica, sans-serif; color: #333; }
  @bottom-left { font: 7.5pt Arial, Helvetica, sans-serif; color: #333; } }
.tdoc-page.tdoc-p1 { page: tdoc-wo; }
.tdoc-page.tdoc-qcs { page: tdoc-qc; }

.tdoc-body { margin: 0; background: #8e8e99; color: #000; }
.tdoc { font: 8.5pt/1.25 Arial, Helvetica, sans-serif; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.tdoc *, .tdoc *::before, .tdoc *::after { box-sizing: border-box; }
/* on screen each sheet is drawn as a Letter page with the print margins as padding */
.tdoc-page { page: tdoc; background: #fff; width: 8.5in; max-width: 100%; margin: 0 auto 18px; padding: 0.3in 0.32in 0.4in; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.tdoc-qcs { break-before: page; }

/* on-screen toolbar (never printed) */
.tdoc-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: 8.5in; margin: 0 auto 14px; padding: 10px 14px;
  background: #fff; border-radius: 0 0 10px 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, .2); font: 13px/1.3 Arial, Helvetica, sans-serif; }
.tdoc-bar-t { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.tdoc-bar-t b { font-size: 14px; } .tdoc-bar-t span { font-size: 12px; color: #444; }
.tdoc-sw { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tdoc-btn { height: 32px; padding: 0 14px; font: 600 13px Arial, Helvetica, sans-serif; border: 1px solid #b9b9c6; border-radius: 6px; background: #fff; color: #111; cursor: pointer; }
.tdoc-btn.primary { background: #3840EA; border-color: #3840EA; color: #fff; }
.tdoc-btn:disabled { opacity: .5; cursor: not-allowed; }
.tdoc-hint { flex-basis: 100%; margin: 0; font-size: 12px; color: #333; }

/* ── page header: logo · company + form title · form number + solder/flux badge · QR ── */
.tdoc-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tdoc-logo { flex: none; height: 0.62in; width: auto; display: block; }
.tdoc-mark { flex: none; width: 0.55in; height: 0.55in; background: #000; color: #fff; font: 900 11pt Arial, sans-serif; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.tdoc-hc { flex: 1; text-align: center; min-width: 0; }
.tdoc-co { font-size: 20pt; font-weight: 700; line-height: 1.05; color: #1f2d38; letter-spacing: -.01em; }
.tdoc-ti { font-size: 12.5pt; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; margin-top: 2px; color: #1f2d38; }
.tdoc-hr { flex: none; text-align: right; font-size: 8pt; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tdoc-form { color: #000; }
.tdoc-alloy { font-weight: 700; font-size: 9pt; background: #fff27a; border: 0.75pt solid #000; padding: 1px 6px; white-space: nowrap; }
.tdoc-qr { flex: none; line-height: 0; } .tdoc-qr svg { display: block; }
.tdoc-rh .tdoc-hd { margin-bottom: 4px; }
.tdoc-rh .tdoc-logo { height: 0.46in; } .tdoc-rh .tdoc-mark { width: 0.42in; height: 0.42in; font-size: 9pt; }
.tdoc-rh .tdoc-co { font-size: 15pt; } .tdoc-rh .tdoc-ti { font-size: 11pt; margin-top: 1px; }

/* ── bordered field cells (page 1 and the repeated data-sheet header) ── */
.tdoc-info { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1.5pt solid #000; }
.tdoc-info td { border: 0.75pt solid #000; padding: 2px 5px; vertical-align: top; overflow-wrap: anywhere; }
.tdoc-info td.big { font-size: 11pt; padding-top: 3px; padding-bottom: 3px; }
.tdoc-info td.big b { font-size: 11pt; }
.tdoc-c { min-height: 1.25em; } .tdoc-c b { font-weight: 700; }
.tdoc-info + .tdoc-info, .tdoc-info + .tdoc-log, .tdoc-log + .tdoc-info { margin-top: -1.5pt; }
.tdoc-h2 { font-size: 10.5pt; font-weight: 700; text-align: center; text-decoration: underline; background: #ececec; border: 1.5pt solid #000; border-top: 0; border-bottom: 0; padding: 2px; }
.tdoc-qinfo { font-size: 8pt; margin-bottom: 3px; }
.tdoc-qinfo td { padding: 1px 5px; }
.tdoc-qinfo td.big, .tdoc-qinfo td.big b { font-size: 9.5pt; }

/* page 1 = one full sheet: the floor-notes box takes the height that is left */
.tdoc-p1 { display: flex; flex-direction: column; min-height: 10.2in; }
.tdoc-p1 > * { flex: none; }
.tdoc-fill { flex: 1 1 auto !important; min-height: 0.62in; margin-top: 6px; border: 1.5pt solid #000; padding: 3px 6px 0; font-size: 8pt; display: flex; flex-direction: column; }
/* ruled write-in lines: real borders (a CSS gradient prints badly in some PDF viewers); absolutely placed, so they never make the box taller */
.tdoc-fill > i { flex: 1 1 0; display: block; min-height: 0.28in; position: relative; overflow: hidden; }
.tdoc-fill > i > u { position: absolute; inset: 0; display: block; }
.tdoc-fill > i s { display: block; height: 0.28in; border-bottom: 0.5pt solid #8a8a8a; }
.tdoc-fill b { font-size: 9pt; margin-right: 6px; } .tdoc-fill span { color: #333; }

/* tables: shipments (page 1), routing, shipping log */
.tdoc-log, .tdoc-route { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.tdoc-log { border: 1.5pt solid #000; table-layout: fixed; }
.tdoc-log th, .tdoc-log td, .tdoc-route th, .tdoc-route td { border: 0.75pt solid #000; padding: 1px 4px; text-align: left; vertical-align: top; }
.tdoc-log th, .tdoc-route th { background: #ececec; font-weight: 700; }
.tdoc-log th { text-align: center; }
.tdoc-log td { height: 0.27in; }
.tdoc-ship td:first-child { text-align: center; }
.tdoc-ship th:first-child, .tdoc-ship td:first-child { width: 0.95in; }
.tdoc-shlog { margin-top: -1.5pt; }
.tdoc-shlog col.tdoc-k0 { width: 0.6in; } .tdoc-shlog td:first-child { text-align: center; vertical-align: middle; }
.tdoc-shlog th.tdoc-lt { font-size: 9.5pt; }

/* routing: two columns side by side */
.tdoc-rcols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; align-items: start; }
.tdoc-route { font-size: 7.5pt; line-height: 1.2; table-layout: fixed; }
.tdoc-route td, .tdoc-route th { padding: 1.5px 3px; }
.tdoc-route th:nth-child(1) { width: 0.42in; } .tdoc-route th:nth-child(3) { width: 1.05in; } .tdoc-route th:nth-child(4) { width: 0.34in; } .tdoc-route th:nth-child(5) { width: 0.38in; }
.tdoc-route td.r, .tdoc-route th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tdoc-route tr { break-inside: avoid; }
.tdoc-route .tdoc-qc { font-size: 6.5pt; padding: 0 3px; }
.tdoc-unused { margin: 4px 0 0; font-size: 7.5pt; line-height: 1.3; color: #222; }
.tdoc-none { margin: 4px 0; }

/* ── QC data sheet: one table, so the header repeats on every printed page; each block is one unbreakable row ── */
.tdoc-sheet { width: 100%; border-collapse: collapse; }
.tdoc-sheet > thead > tr > td, .tdoc-sheet > tbody > tr > td { padding: 0; }
.tdoc-sec > td { padding: 6px 0 0 !important; }
.tdoc-sec.tdoc-cont > td { padding-top: 0 !important; }
.tdoc-sec, .tdoc-sec > td { break-inside: avoid; page-break-inside: avoid; }
.tdoc-rt > td { padding-top: 2px !important; }
.tdoc-bt { font-size: 9pt; font-weight: 700; text-align: center; margin-bottom: 2px; }
.tdoc-sh { display: flex; align-items: center; gap: 5px; font-size: 7.5pt; color: #222; margin: 0 0 2px; min-width: 0; }
.tdoc-n { flex: none; min-width: 16px; height: 15px; padding: 0 3px; border: 1pt solid #000; border-radius: 3px; font: 700 8pt Arial, sans-serif; color: #000; display: inline-flex; align-items: center; justify-content: center; }
.tdoc-qc { flex: none; font: 700 7.5pt Arial, sans-serif; color: #fff; background: #000; padding: 1px 4px; border-radius: 3px; }
.tdoc-sm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* a sign-off block = one bordered table: title row, sign-off rows (N/A box in the left column), Verify / check lines, notes */
.tdoc-blk { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1.5pt solid #000; }
.tdoc-sec.tdoc-cont .tdoc-blk { border-top-width: 0.75pt; }
.tdoc-sec.qc .tdoc-blk { border-width: 2.25pt; }
.tdoc-sec.qc.tdoc-cont .tdoc-blk { border-top-width: 0.75pt; }
.tdoc-blk col.tdoc-k0 { width: 0.6in; }
.tdoc-blk th, .tdoc-blk td { border: 0.75pt solid #000; }
.tdoc-ttl th { background: #ececec; font-size: 9pt; font-weight: 700; text-align: center; padding: 2px 4px; }
.tdoc-grp th { background: #d6d6d6; font-size: 9.5pt; font-weight: 700; text-align: center; padding: 2px 4px; }
.tdoc-so td { height: 0.28in; padding: 0 6px 3px; vertical-align: bottom; }
.tdoc-fl { display: flex; align-items: flex-end; gap: 3px; }
.tdoc-fl span { white-space: nowrap; }
.tdoc-fl i { flex: 1; border-bottom: 0.75pt solid #000; height: 1px; margin-bottom: 1px; min-width: 0.4in; }
.tdoc-c0 { font-size: 8pt; vertical-align: middle !important; padding: 2px 5px !important; }
.tdoc-c0 b { font-weight: 700; }
.tdoc-na { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 700; }
.tdoc-na i { display: inline-block; width: 10px; height: 10px; border: 0.75pt solid #000; }
.tdoc-tx td { padding: 3px 6px; vertical-align: middle; font-size: 8.5pt; line-height: 1.3; height: 0.24in; }
.tdoc-ck td { font-weight: 700; white-space: pre-wrap; }

/* the preview's two switches */
.tdoc-hide-rework .tdoc-x-rework, .tdoc-hide-extra .tdoc-x-extra { display: none; }

@media screen and (max-width: 860px) { .tdoc-page { padding: 16px; } .tdoc-rcols { grid-template-columns: 1fr; } }
@media print {
  .tdoc-body { background: #fff; }
  .tdoc-bar { display: none !important; }
  .tdoc-page { width: auto; margin: 0; padding: 0; box-shadow: none; }
}
