/* Print sheets.

   Two audiences in one stylesheet: the screen, where somebody checks the sheet before printing, and
   the paper. The @media print block at the end is what makes the second work - it drops the toolbar,
   removes the page's own margins in favour of the printer's, and forces black on white regardless of
   the theme, because a dark-theme sheet sent to a printer wastes a cartridge and is unreadable.

   Deliberately NOT using the app's colour tokens for the sheet body. A printed document is black
   text on white paper in every theme, and inheriting --cim360-text would make the output depend on
   what the operator happened to have selected.

   THIS FILE IS EXEMPT FROM THE THEMING SWEEP, and the exemption is load-bearing rather than
   tidiness. A bulk "replace #fff with var(--cim360-card)" ran over it on 2026-09-19 and rewrote
   the @media print rule below to `background: var(--cim360-card) !important` - which in dark mode
   is the near-black card, so every sheet an operator in dark mode printed would have come out as
   a full page of near-black with near-black text on it. The comment directly above that rule says
   in as many words what it exists to prevent, and the sweep rewrote it anyway, because a sweep
   does not read comments.

   The split down this file is therefore:

     lines up to the sheet body   ON SCREEN ONLY - the toolbar and sheet switcher, hidden at
                                  print, and correct to theme with tokens
     the sheet body and @media    PAPER - literal, always, no var() of ours anywhere in it

   Test-Cim360Theming.ps1 and R-078 both skip this directory for the same reason. If a literal in
   here is ever reported as a finding, the reporter is wrong. */

.sop-print {
    max-width: 210mm;
    margin: 0 auto;
    padding: 16px;
}

/* ---- the on-screen toolbar, which never prints ---- */

.sop-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
}

.sop-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--cim360-primary);
    border-radius: 6px;
    background: var(--cim360-primary-surface);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.sop-bar-title {
    /* An h1 on the batch print tabs (1.3.1), drawn exactly as the span it replaced. */
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    line-height: inherit;
    color: var(--cim360-text-muted);
}


/* The sheet switcher. Pushed to the right of the bar so the Print button stays where it was for
   anyone who already knows where to click. On screen only - .sop-bar is hidden at print, which is
   what keeps a paper acknowledgement from carrying a row of links to other sheets. */
.sop-bar-sheets {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.sop-bar-sheet {
    padding: 6px 12px;
    border: 1px solid var(--cim360-border);
    border-radius: 6px;
    background: #fff;
    color: var(--cim360-text);
    font-size: 13px;
    text-decoration: none;
}

.sop-bar-sheet:hover {
    background: var(--cim360-surface-2);
}

/* The current sheet reads as pressed rather than merely tinted: this is a switcher, and a reader
   arriving on a deep link needs to see which of the two they are on without comparing shades. */
.sop-bar-sheet.is-current {
    border-color: var(--cim360-primary);
    background: color-mix(in srgb, var(--cim360-primary) 10%, transparent);
    color: color-mix(in srgb, var(--cim360-primary) 72%, var(--cim360-text-strong));
    font-weight: 600;
}

.sop-loading {
    padding: 32px 0;
    text-align: center;
    color: var(--cim360-text-muted);
}

/* ---- the sheet ---- */

.sop-sheet {
    background: #fff;
    color: #101828;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    padding: 24px;
    font-size: 12px;
    line-height: 1.45;
}

/* The company letterhead (Cim360PrintLetterhead), above the masthead on every sheet that leaves the building.
   The logo box is the layouts' own - 1.5in by 0.6in - and the block beside it is a flex item rather than a
   fixed column, so with no logo it starts at the margin and nothing is left where a logo would be. DEV-1111. */
.sop-letterhead {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid #d0d5dd;
}

.sop-lh-logo {
    display: block;
    max-width: 1.5in;
    max-height: 0.6in;
    object-fit: contain;
}

.sop-lh-company p {
    margin: 0;
}

.sop-lh-name {
    font-size: 15px;
    font-weight: 700;
}

.sop-lh-address {
    white-space: pre-line;
}

/* pre-wrap keeps the gap between "Reg:" and "VAT:" that the layouts print; HTML would collapse it to one space. */
.sop-lh-line {
    color: #344054;
    white-space: pre-wrap;
}

.sop-masthead {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #101828;
}

.sop-mast-kind {
    margin: 0;
    font-size: 22px;
    letter-spacing: .02em;
}

.sop-mast-ref {
    margin: 4px 0 0;
    font-family: inherit;
    font-size: 14px;
}

.sop-mast-meta {
    margin: 0;
    display: grid;
    gap: 2px;
    min-width: 180px;
}

.sop-mast-meta div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.sop-mast-meta dt {
    color: #667085;
}

.sop-mast-meta dd {
    margin: 0;
    font-weight: 600;
}

.sop-parties {
    display: flex;
    gap: 32px;
    padding: 16px 0;
    border-bottom: 1px solid #eaecf0;
}

.sop-parties h2 {
    margin: 0 0 4px;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #667085;
}

.sop-parties p {
    margin: 0;
    max-width: 42ch;
}

.sop-sub {
    color: #667085;
}

.sop-carrier {
    padding: 12px 0;
    border-bottom: 1px solid #eaecf0;
}

.sop-carrier dl {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 32px;
}

.sop-carrier dt {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #667085;
}

.sop-carrier dd {
    margin: 0;
    font-weight: 600;
}

/* ---- the line table ---- */

.sop-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.sop-table thead th {
    text-align: left;
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #667085;
    border-bottom: 1px solid #101828;
    padding: 6px 8px;
}

.sop-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #eaecf0;
    vertical-align: top;
}

/* Rows are kept off page breaks. A despatch line split across two sheets is the classic printing
   fault on documents like these, and it is one line of CSS to prevent. */
.sop-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

.sop-w-seq { width: 44px; }
.sop-w-num { width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
.sop-w-bin { width: 120px; }
.sop-w-trace { width: 130px; }
.sop-w-tick { width: 56px; text-align: center; }

.sop-code {
    display: block;
    font-family: inherit;
    font-weight: 600;
}

.sop-desc {
    display: block;
    color: #475467;
}

.sop-mono {
    font-family: inherit;
}

/* The picker's tick box, printed empty for a pen. */
.sop-tick {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid #101828;
    border-radius: 2px;
}

/* ---- totals ---- */

.sop-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.sop-totals dl {
    margin: 0;
    min-width: 260px;
    display: grid;
    gap: 4px;
}

.sop-totals div {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.sop-totals dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.sop-total-gross {
    border-top: 1px solid #101828;
    padding-top: 6px;
    font-weight: 700;
    font-size: 14px;
}

.sop-totals-wide dl {
    min-width: 320px;
}

/* ---- notes and states ---- */

/* A second section on one sheet - the picking list's back orders. The parties' heading style, with
   room above it. DEV-485. */
.sop-subhead {
    margin: 18px 0 6px;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #667085;
}

.sop-note {
    margin: 8px 0 0;
    color: #475467;
}

.sop-empty {
    padding: 24px 0;
    text-align: center;
    color: #667085;
}

.sop-amended {
    font-weight: 600;
}

/* Which copy a purchasing sheet is - Supplier copy, File copy, Goods-in copy, Accounts copy. DEV-780. */
.sop-copy {
    display: inline-block;
    margin: 0.375rem 0 0;
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--cim360-text);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* The standard purchasing terms under a purchase order, as written - line breaks kept. DEV-780. */
.sop-terms {
    margin-top: 1rem;
    page-break-inside: auto;
}

.sop-terms h2 {
    margin: 0 0 0.375rem;
    font-size: 0.8125rem;
}

.sop-terms p {
    margin: 0;
    white-space: pre-wrap;
    font-size: 0.6875rem;
    line-height: 1.45;
}

/* A purchase order's comment line on its goods-received note - words across the row. DEV-780. */
.sop-comment-row .sop-desc {
    font-style: italic;
}

/* A draft invoice says so, loudly. One that reached a customer looking final is discovered when
   they pay against a number that later changed. */
.sop-draft {
    margin: 12px 0 0;
    padding: 8px 12px;
    border: 1px dashed #b42318;
    color: #b42318;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    text-align: center;
}

/* ---- signature block ---- */

.sop-sign {
    display: flex;
    gap: 32px;
    margin-top: 32px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.sop-sign div {
    flex: 1;
}

.sop-sign-rule {
    display: block;
    border-bottom: 1px solid #101828;
    height: 28px;
}

.sop-sign-label {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #667085;
}

.sop-foot {
    margin-top: 24px;
    padding-top: 8px;
    border-top: 1px solid #eaecf0;
    font-size: 10px;
    color: #667085;
    text-align: right;
}

/* Several sheets on one page - the batch of acknowledgements (DEV-490). Spaced on screen; each on
   its own sheet of paper, so a run of twenty prints as twenty acknowledgements, never run together. */
.sop-batch-item + .sop-batch-item {
    margin-top: 24px;
}

/* ---- paper ---- */

@media print {
    .sop-bar {
        display: none;
    }

    .sop-batch-item {
        break-after: page;
    }

    .sop-batch-item:last-child {
        break-after: auto;
    }

    .sop-batch-item + .sop-batch-item {
        margin-top: 0;
    }

    .sop-print {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    /* The printer supplies the margin, so the sheet gives up its own border and radius - both of
       which print as a visible box around the page. */
    .sop-sheet {
        border: 0;
        border-radius: 0;
        padding: 0;
        font-size: 11px;
    }

    /* Black on white whatever the theme. Without this a dark-theme sheet prints a full page of
       background and is unreadable. */
    .sop-sheet,
    .sop-sheet * {
        background: #fff !important;
        color: #101828 !important;
    }

    .sop-draft {
        border-color: #101828 !important;
        color: #101828 !important;
    }

    /* Repeat the column headings on every sheet of a long document. Without it page two of a
       forty-line order is a table of unlabelled numbers. */
    .sop-table thead {
        display: table-header-group;
    }
}

/* ── Carrier label (DEV-487) ─────────────────────────────────────────────────
   One label per despatch note, the size of a 100 x 150 mm thermal label so it prints onto one
   and still reads on plain paper. The address is the first and largest thing on it: a driver
   and a goods-in desk read that before anything else. */
.sop-label {
    width: 100mm;
    min-height: 150mm;
    margin: 0 auto;
    padding: 6mm;
    border: 0.4mm solid var(--cim360-text);
    box-sizing: border-box;
    background: var(--cim360-card);
    color: var(--cim360-text);
}

.sop-label-to {
    padding-bottom: 4mm;
    margin-bottom: 4mm;
    border-bottom: 0.6mm solid var(--cim360-text);
}

.sop-label-to h2 {
    margin: 0 0 2mm;
    font-size: 3mm;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sop-label-to p {
    margin: 0;
    font-size: 5mm;
    font-weight: 600;
    line-height: 1.25;
}

.sop-label-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3mm 4mm;
    margin: 0;
}

.sop-label-meta .is-wide {
    grid-column: 1 / -1;
}

.sop-label-meta dt {
    font-size: 2.6mm;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sop-label-meta dd {
    margin: 0.5mm 0 0;
    font-size: 3.8mm;
    font-weight: 600;
}

.sop-label-track {
    font-size: 5mm;
}

@media print {
    .sop-label {
        margin: 0;
        border: none;
        page-break-after: always;
    }
}

/* ---- BOM reports (DEV-560) ----

   The five reports of the BOM Print window - BomPrintSheet.razor - in the design's own print style
   (bom-export.jsx print()): Nunito at 11px, a header over a 3px blue rule, blue column heads in
   capitals, zebra rows, numbers right-aligned. Here rather than in the component so the Print window's
   preview and the print tab draw the same sheet, and because it is paper: literal colours, as above. */

.bomp-sheet {
    box-sizing: border-box;
    max-width: 210mm;
    margin: 0 auto;
    padding: 14mm;
    background: #fff;
    color: #1f2937;
    font-family: Nunito, "Segoe UI", Arial, sans-serif;
    font-size: 11px;
    line-height: 1.35;
}

.bomp-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    border-bottom: 3px solid #1D75BB;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.bomp-head b {
    display: block;
    font-size: 18px;
    color: #155389;
}

.bomp-head span {
    color: #6b7280;
    font-size: 11px;
}

.bomp-head em {
    flex: 0 0 auto;
    font-style: normal;
    color: #6b7280;
    text-align: right;
}

.bomp-sheet h2 {
    font-size: 12.5px;
    margin: 16px 0 6px;
    color: #1f2937;
}

.bomp-note {
    margin: 0 0 8px;
    color: #6b7280;
    font-style: italic;
}

.bomp-sheet table + .bomp-note {
    margin-top: 6px;
}

.bomp-empty {
    margin: 4px 0;
    color: #6b7280;
}

.bomp-sheet table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: auto;
}

.bomp-sheet th {
    background: #1D75BB;
    color: #fff;
    text-align: left;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 6px 8px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.bomp-sheet td {
    padding: 5px 8px;
    border-bottom: 1px solid #d6dbe1;
    vertical-align: top;
}

.bomp-sheet .bomp-n {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bomp-sheet td.bomp-c {
    font-weight: 600;
}

.bomp-sheet tr {
    page-break-inside: avoid;
    break-inside: avoid;
}

.bomp-sheet tbody tr:nth-child(even):not(.bomp-lane) td {
    background: #fcfcfd;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.bomp-sheet tr.bomp-lane td {
    background: #eef5fc;
    font-weight: 700;
    color: #155389;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* The details: label and value pairs, labels in muted capitals rather than blue heads. */
.bomp-sheet table.bomp-kv th {
    width: 16%;
    background: none;
    color: #6b7280;
    border-bottom: 1px solid #d6dbe1;
}

.bomp-sheet table.bomp-kv td {
    width: 34%;
}

.bomp-sheet tr.bomp-more td {
    padding-top: 0;
    color: #374151;
}

.bomp-k {
    display: inline-block;
    margin-right: 6px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #6b7280;
}

.bomp-text {
    white-space: pre-line;
}

.bomp-sub {
    display: block;
    color: #6b7280;
    font-size: 10px;
}

/* The design's row chips (bom-structure.jsx .bomw-chip): Phantom, Fixed qty, Bulk issue, {n}% scrap. */
.bomp-chip {
    display: inline-block;
    margin-left: 5px;
    padding: 0 5px;
    border: 1px solid #c9d3de;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    color: #475467;
    white-space: nowrap;
}

.bomp-chip.is-warn {
    border-color: #f2c48d;
    color: #b45309;
}

@media print {
    /* The page supplies the margin (@page, BomPrintPage), so the sheet gives up its own. */
    .bomp-sheet {
        max-width: none;
        margin: 0;
        padding: 0;
    }
}
