@page {
    size: A4 portrait;
    margin: 8mm;
}

* {
    box-sizing: border-box;
}

html {
    background: #d7d9dc;
}

body {
    margin: 0;
    color: #111;
    background: #d7d9dc;
    font-family: Arial, Helvetica, sans-serif;
}

.print-toolbar {
    display: flex;
    justify-content: space-between;
    width: 194mm;
    margin: 12px auto;
}

.print-toolbar a,
.print-toolbar button {
    padding: 9px 14px;
    border: 0;
    border-radius: 5px;
    color: #fff;
    background: #263244;
    font: 700 14px Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
}

.print-toolbar button {
    background: #167548;
}

.purchase-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 24px;
    padding: 8mm;
    background: #fff;
    box-shadow: 0 3px 18px rgba(0, 0, 0, .25);
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8mm;
    margin-bottom: 4mm;
    padding-bottom: 2.5mm;
    border-bottom: .5mm solid #111;
}

.sheet-header h1 {
    margin: 0 0 1mm;
    font-size: 17pt;
    line-height: 1;
}

.sheet-header p {
    margin: 0;
    color: #444;
    font-size: 8.5pt;
}

.buyer-field {
    min-width: 62mm;
    font-size: 8.5pt;
    white-space: nowrap;
}

.buyer-field span {
    display: inline-block;
    width: 42mm;
    border-bottom: .3mm solid #111;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.2pt;
}

.col-check {
    width: 6%;
}

.col-product {
    width: 46%;
}

.col-code {
    width: 15%;
}

.col-stock {
    width: 10%;
}

.col-buy {
    width: 13%;
}

.col-bought {
    width: 10%;
}

thead {
    display: table-header-group;
}

th {
    padding: 1.8mm 1.2mm;
    border: .25mm solid #777;
    background: #e9edf2;
    font-size: 7pt;
    line-height: 1.05;
    text-align: left;
    text-transform: uppercase;
}

td {
    padding: 1.7mm 1.2mm;
    border: .25mm solid #aaa;
    line-height: 1.12;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

.check-cell,
.stock,
.to-buy,
.bought {
    text-align: center;
}

.checkbox {
    display: inline-block;
    width: 4mm;
    height: 4mm;
    border: .45mm solid #111;
}

.product-name {
    font-weight: 600;
}

.code {
    color: #333;
    font-size: 7.5pt;
}

.stock {
    white-space: nowrap;
}

.stock span {
    color: #777;
}

.to-buy {
    font-size: 10pt;
    font-weight: 800;
    white-space: nowrap;
}

.bought span {
    display: block;
    height: 4mm;
    border-bottom: .3mm solid #111;
}

.empty {
    padding: 12mm;
    text-align: center;
}

@media print {
    html,
    body {
        background: #fff;
    }

    .print-toolbar {
        display: none;
    }

    .purchase-sheet {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
}
