/* The printed documents: purchase orders, registers, count sheets. On screen, a sheet of paper on a grey desk; on
   paper, the same sheet without the desk, in the margins PrintSetup sets. Sizes are in points and millimetres, as
   on paper. */
:root {
    --doc-ink: #1c1b1f;
    --doc-ink-2: #4b4a50;
    --doc-ink-3: #737278;
    --doc-rule: #9a99a0;
    --doc-rule-light: #d3d2d8;
    --doc-fill: #efeef2;
    --doc-fill-light: #f7f6f9;
    --doc-brand: #c2185b;
    --doc-brand-dark: #8c1043;
    --doc-desk: #e9e8ed;
    --doc-hatch: repeating-linear-gradient(135deg, #fff 0 1.1mm, #e4e3e8 1.1mm 1.5mm);
}

.doc-desk {
    background: var(--doc-desk);
    border-radius: 8px;
    padding: 24px;
    overflow-x: auto;
}

/* Below its width the desk scrolls, as a PDF does on a phone, rather than crushing the page. */
.doc-sheet {
    max-width: 8.5in;
    min-width: 7in;
    margin: 0 auto;
    padding: 14mm 16mm 18mm;
    background: #fff;
    color: var(--doc-ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 8px 24px rgba(0, 0, 0, .08);
    font-family: Roboto, "Segoe UI", Arial, sans-serif;
    font-size: 9.5pt;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    /* The backgrounds (table heads, hatched days) print even with the browser's background graphics unchecked. */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* A month of 31 days needs the width. */
.doc-sheet.landscape {
    max-width: 11in;
    min-width: 9.5in;
    padding: 10mm 11mm 13mm;
}

.doc-sheet p {
    margin: 0;
}

@media (max-width: 599.98px) {
    .doc-desk {
        padding: 8px;
    }
}

@media print {
    .doc-desk {
        background: none;
        border-radius: 0;
        padding: 0;
        overflow: visible;
    }

    .doc-sheet, .doc-sheet.landscape {
        max-width: none;
        min-width: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
}

.doc-label {
    display: block;
    font-size: 6.8pt;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--doc-ink-3);
    margin-bottom: .8mm;
}

.doc-muted {
    color: var(--doc-ink-2);
}

.doc-num {
    text-align: right;
    white-space: nowrap;
}

.doc-nowrap {
    white-space: nowrap;
}

.doc-pre {
    white-space: pre-line;
}

.doc-empty {
    color: var(--doc-ink-2);
    margin: 4mm 0;
}

.doc-section-title {
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--doc-brand);
    margin: 6mm 0 2.5mm;
}

/* The heading: the bar laitier on the left, the document on the right, over a line in the colour of the bar. */
.doc-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10mm;
    padding-bottom: 4mm;
    border-bottom: 1.5pt solid var(--doc-brand);
    margin-bottom: 6mm;
}

.landscape .doc-head {
    margin-bottom: 4mm;
}

.doc-brand {
    display: flex;
    align-items: center;
    gap: 3.5mm;
}

.doc-monogram {
    flex: none;
    width: 13mm;
    height: 13mm;
    border-radius: 50%;
    background: var(--doc-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12pt;
    font-weight: 700;
    letter-spacing: .03em;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.doc-brand-name {
    font-size: 14pt;
    font-weight: 700;
    line-height: 1.15;
}

.doc-brand-line {
    font-size: 8pt;
    color: var(--doc-ink-2);
    line-height: 1.45;
}

.doc-brand-name + .doc-brand-line {
    margin-top: .8mm;
}

.doc-id {
    text-align: right;
}

.doc-kind {
    font-size: 8.5pt;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--doc-brand);
}

.doc-ref {
    font-size: 21pt;
    font-weight: 300;
    line-height: 1.1;
    margin-top: .5mm;
}

.doc-sub {
    font-size: 8.5pt;
    color: var(--doc-ink-2);
    margin-top: .8mm;
}

/* A band of key facts: dates, numbers, people. Blank ones are filled in by hand. */
.doc-facts {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    border: .75pt solid var(--doc-rule-light);
    border-radius: 1.5mm;
    margin-bottom: 6mm;
}

.doc-facts > div {
    padding: 2.2mm 3mm;
    font-weight: 500;
}

.doc-facts > div + div {
    border-left: .75pt solid var(--doc-rule-light);
}

.doc-facts .doc-write {
    display: block;
    height: 6mm;
}

.doc-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10mm;
    margin-bottom: 7mm;
}

.doc-party-name {
    font-size: 10.5pt;
    font-weight: 700;
    margin-bottom: .6mm;
}

/* Lines of a document: thin rules, figures aligned on the right. */
table.doc-table {
    width: 100%;
    border-collapse: collapse;
}

table.doc-table th {
    font-size: 6.8pt;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--doc-ink-2);
    text-align: left;
    background: var(--doc-fill);
    padding: 2mm 2.5mm;
    border-bottom: .75pt solid var(--doc-rule);
}

table.doc-table td {
    padding: 2.3mm 2.5mm;
    border-bottom: .5pt solid var(--doc-rule-light);
    vertical-align: top;
}

table.doc-table th.doc-num, table.doc-table td.doc-num {
    text-align: right;
}

table.doc-table .doc-code {
    font-family: "Roboto Condensed", Roboto, sans-serif;
    color: var(--doc-ink-2);
    white-space: nowrap;
}

.doc-sheet thead {
    display: table-header-group;
}

.doc-sheet tr {
    break-inside: avoid;
}

.doc-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 3mm;
}

.doc-totals-box {
    min-width: 72mm;
}

.doc-totals-row {
    display: flex;
    justify-content: space-between;
    gap: 8mm;
    padding: 1mm 2.5mm;
}

.doc-total {
    border-top: 1pt solid var(--doc-ink);
    margin-top: 1mm;
    padding-top: 2mm;
    font-size: 11.5pt;
    font-weight: 700;
}

.doc-notes {
    margin-top: 8mm;
    padding: 3mm 4mm;
    background: var(--doc-fill-light);
    border-left: 2pt solid var(--doc-brand);
    break-inside: avoid;
}

.doc-signatures {
    display: flex;
    gap: 12mm;
    margin-top: 14mm;
    break-inside: avoid;
}

.landscape .doc-signatures {
    margin-top: 6mm;
}

.doc-signature {
    flex: 1;
}

.doc-signature-date {
    flex: .45;
}

.doc-signature-line {
    border-bottom: .75pt solid var(--doc-ink);
    height: 8mm;
}

.doc-signature .doc-label {
    margin-top: 1.2mm;
}

/* Registers: a month on a sheet, a column a day. */
table.doc-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: "Roboto Condensed", Roboto, sans-serif;
}

table.doc-grid col.name {
    width: 36mm;
}

table.doc-grid th, table.doc-grid td {
    border: .5pt solid var(--doc-rule-light);
    text-align: center;
    padding: .5mm 0;
    font-size: 7.5pt;
    line-height: 1.15;
}

table.doc-grid thead th {
    background: var(--doc-fill);
    font-weight: 700;
    border-bottom: .75pt solid var(--doc-rule);
}

table.doc-grid .weekday {
    display: block;
    font-size: 6.3pt;
    font-weight: 400;
    color: var(--doc-ink-3);
}

table.doc-grid .weekend {
    background: var(--doc-fill-light);
}

table.doc-grid .name {
    text-align: left;
    padding: .5mm 1.5mm;
    font-family: Roboto, sans-serif;
}

table.doc-grid tr.group td {
    background: var(--doc-fill);
    text-align: left;
    padding: 1.2mm 2mm;
    font-family: Roboto, sans-serif;
    font-size: 8pt;
    border-top: .75pt solid var(--doc-rule);
}

table.doc-grid tr.group .range {
    color: var(--doc-ink-2);
    margin-left: 2mm;
}

table.doc-grid .reading {
    display: block;
    font-size: 8pt;
    font-weight: 500;
    white-space: nowrap;
}

table.doc-grid .detail {
    display: block;
    font-size: 6pt;
    color: var(--doc-ink-3);
}

table.doc-grid .name .detail {
    font-size: 6.5pt;
}

/* A day with nothing expected is hatched, so that it does not look like a day forgotten. */
table.doc-grid td.none, table.doc-grid th.none {
    background: var(--doc-hatch);
}

/* Out of range: framed and bold, which shows in black and white too. */
table.doc-grid td.out .reading {
    color: var(--doc-brand-dark);
    font-weight: 700;
    border: .9pt solid var(--doc-brand-dark);
    border-radius: 1mm;
    margin: 0 .5mm;
}

.doc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5mm 7mm;
    font-size: 7.5pt;
    color: var(--doc-ink-2);
    margin-top: 2.5mm;
}

.doc-swatch {
    display: inline-block;
    width: 5mm;
    height: 3.2mm;
    vertical-align: -.5mm;
    margin-right: 1.2mm;
    border: .5pt solid var(--doc-rule);
}

.doc-swatch.none {
    background: var(--doc-hatch);
}

.doc-swatch.weekend {
    background: var(--doc-fill-light);
}

.doc-sample-out {
    font-family: "Roboto Condensed", Roboto, sans-serif;
    font-weight: 700;
    color: var(--doc-brand-dark);
    border: .9pt solid var(--doc-brand-dark);
    border-radius: 1mm;
    padding: 0 .8mm;
    margin-right: 1.2mm;
}

/* Count sheets: rows high enough to write in, the units printed after the blanks. */
.doc-location {
    break-inside: avoid;
}

.doc-location h3 {
    font-size: 9pt;
    font-weight: 700;
    margin: 6mm 0 1.5mm;
    padding-left: 2.5mm;
    border-left: 2pt solid var(--doc-brand);
}

table.doc-count td {
    height: 9.5mm;
    vertical-align: middle;
}

table.doc-count .detail {
    display: block;
    font-size: 8pt;
    color: var(--doc-ink-2);
}

table.doc-count .quantity {
    white-space: nowrap;
}

table.doc-count .blank {
    display: inline-block;
    width: 14mm;
    border-bottom: .75pt solid var(--doc-ink);
    margin-right: 1mm;
}

table.doc-count .unit {
    color: var(--doc-ink-2);
    font-size: 8.5pt;
    margin-right: 4mm;
}

table.doc-count .check {
    display: inline-block;
    width: 3.8mm;
    height: 3.8mm;
    border: .75pt solid var(--doc-ink-2);
    border-radius: .6mm;
}
