:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #d9dde3;
    --text: #1b2430;
    --muted: #667085;
    --accent: #0b5cad;
    --accent-text: #ffffff;
    --ok: #1a7f4b;
    --warn: #b25e09;
    --bad: #b42318;
    --radius: 8px;
}

* { box-sizing: border-box; }

/* Hidden means hidden, whatever display a class gives the element. */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 20px;
    height: 52px;
    background: var(--text);
    color: #fff;
}
.topbar .brand { font-weight: 700; letter-spacing: .02em; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
    color: #cfd6e0;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
}
.topbar nav a.active, .topbar nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.topbar .who { color: #cfd6e0; font-size: 13px; text-align: right; }
.topbar .who a { color: #fff; }
.topbar form { margin: 0; }
.topbar button { background: none; border: 1px solid #5b6675; color: #fff; }

main { max-width: 1180px; margin: 24px auto; padding: 0 16px; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.head h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=file],
input[type=date], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }

button, .btn {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
.btn-primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button:disabled { opacity: .5; cursor: not-allowed; }

.flash, .errors { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash { background: #e7f5ec; color: var(--ok); }
.errors { background: #fdecea; color: var(--bad); }
.errors ul { margin: 0; padding-left: 18px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eceff3; color: var(--muted); }
.badge.fiscalized, .badge.ok { background: #e7f5ec; color: var(--ok); }
.badge.pending, .badge.needs_review, .badge.warn { background: #fdf1e0; color: var(--warn); }
.badge.rejected, .badge.bad { background: #fdecea; color: var(--bad); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { flex: 1; min-width: 140px; margin-bottom: 0; }

.not-fiscal { font-size: 2em; font-weight: 700; line-height: 1.2; }

.footer { max-width: 1180px; margin: 24px auto; padding: 0 16px; font-size: 13px; color: var(--muted); }
.footer a { color: var(--muted); }

.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Sign-in */
.login { max-width: 360px; margin: 12vh auto 0; }

/* Register */
.pos { display: grid; grid-template-columns: 1fr 420px; gap: 16px; align-items: start; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.pos-product { text-align: left; padding: 10px; min-height: 72px; }
.pos-product b { display: block; font-weight: 600; }
.pos-product span { color: var(--muted); font-size: 13px; }
.cart td input { width: 76px; text-align: right; }
.remove { border: 0; background: none; color: var(--bad); padding: 2px 6px; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 24px; font-weight: 700; margin: 14px 0; font-variant-numeric: tabular-nums; }

/* Buyer ID in two parts, and the customer picker above it */
.buyer-id { display: flex; gap: 8px; }
.buyer-id select { flex: 0 0 46%; min-width: 0; text-overflow: ellipsis; }
.buyer-id input { flex: 1; min-width: 0; }
.picker { position: relative; }
.picker-results {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(16, 24, 40, .12);
    overflow: hidden;
}
.picker-results button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.picker-results button:last-child { border-bottom: 0; }
.picker-results button:hover, .picker-results button:focus { background: var(--bg); }
.picker-results b { display: block; font-weight: 600; }
.picker-results span { color: var(--muted); font-size: 13px; }

.picker-results .picker-new b { color: var(--accent); }

.req { color: #b42318; }
.field small, .group > small { display: block; margin-top: 4px; font-size: 13px; }
.group { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px 12px; margin: 0 0 14px; }
.group legend { padding: 0 4px; font-size: 14px; color: var(--muted); }
.group .field { margin-bottom: 6px; }

.dialog { width: min(640px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; color: var(--text); }
.dialog::backdrop { background: rgba(16, 24, 40, .45); }
.dialog h2 { margin-bottom: 14px; }

.legend { max-width: 520px; font-size: 14px; }
.legend th, .legend td { padding: 5px 8px; }

/* Receipt */
.receipt {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border);
    overflow-x: auto;
}
.receipt pre { margin: 0; font: 13px/1.35 "Cascadia Mono", Consolas, "Courier New", monospace; }
.receipt img + pre, .receipt .signature { margin-top: 8px; }
.receipt .signature { margin-bottom: 8px; }
/* The QR code must print between 40 and 50 mm square. */
.receipt img { display: block; margin: 8px auto 0; width: 45mm; height: 45mm; image-rendering: pixelated; }

@media (max-width: 860px) {
    .pos, .grid-2 { grid-template-columns: 1fr; }
    .topbar { height: auto; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
}

.paper-choice { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.paper-choice select { width: auto; }

/* A4: one fiscal receipt laid out as a business invoice, under the company's own heading.
   The receipt text from V-PFR is not shown beside it; everything in it is on the sheet. */
.sheet-doc { display: none; }
.sheet[data-paper="a4"] {
    width: 210mm;
    max-width: 100%;
    margin: 0 auto;
    padding: 12mm;
    background: #fff;
    border: 1px solid var(--border);
    color: #000;
    font: 9.5pt/1.35 Arial, Helvetica, sans-serif;
    overflow-x: auto;
}
.sheet[data-paper="a4"] .sheet-doc { display: block; min-width: 150mm; }
.sheet[data-paper="a4"] .receipt { display: none; }

.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; font-size: 8.5pt; line-height: 1.5; color: #333; }
.sheet-seller { margin-bottom: 1mm; font-size: 15pt; font-weight: 700; line-height: 1.15; letter-spacing: .01em; color: #000; }
.sheet-accounts { text-align: right; white-space: nowrap; }
.sheet-account { font-size: 11pt; font-weight: 700; line-height: 1.35; color: #000; }
.sheet-label { margin-bottom: .8mm; font-size: 7pt; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #666; }
.sheet-small { font-size: 8pt; color: #333; }
.sheet-strong { font-weight: 700; }
.sheet-gtin { font-size: 7.5pt; color: #666; }

/* The opening and closing lines of the receipt, drawn across the sheet. */
.sheet-rule { display: flex; align-items: center; gap: 4mm; margin: 6mm 0 4mm; font-size: 11.5pt; font-weight: 700; letter-spacing: .14em; white-space: nowrap; }
.sheet-rule::before, .sheet-rule::after { content: ""; flex: 1; border-top: 1px solid #000; }
/* "This is not a fiscal receipt" must be at least twice the size of the rest. */
.sheet-rule-big { font-size: 19pt; letter-spacing: .04em; }

.sheet-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; align-items: start; }
.sheet-fiscal { font-size: 9.5pt; line-height: 1.5; overflow-wrap: anywhere; }
.sheet-buyer { justify-self: end; min-width: 60%; padding: 3mm 4mm; border-left: 2px solid #000; background: #f5f6f7; font-size: 9pt; line-height: 1.5; overflow-wrap: anywhere; }

.sheet-buyer .sheet-strong { font-size: 10.5pt; }
.sheet-kind { margin: 5mm 0 3mm; font-size: 11pt; font-weight: 700; letter-spacing: .08em; }

.sheet-doc table { width: 100%; border-collapse: collapse; }
.sheet-doc th, .sheet-doc td { padding: 1.4mm 2mm; border: 0; text-align: left; vertical-align: top; font-size: 9pt; font-weight: 400; color: #000; background: none; }
.sheet-doc th { font-size: 7pt; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #444; }
.sheet-doc .num { text-align: right; white-space: nowrap; }
.sheet-doc .c { text-align: center; }
.sheet-items thead th { border-top: 1px solid #000; border-bottom: 1px solid #000; background: #f5f6f7; }
.sheet-items tbody td { border-bottom: 1px solid #d9dce0; }
.sheet-items tbody tr:last-child td { border-bottom: 1px solid #000; }
.sheet-items tr { break-inside: avoid; }

.sheet-end { break-inside: avoid; }
.sheet-bottom { display: grid; grid-template-columns: 45mm 1fr; gap: 14mm; margin-top: 7mm; }
.sheet-bottom > div { min-width: 0; }
/* The QR code must print between 40 and 50 mm square. */
.sheet-qr img { display: block; width: 45mm; height: 45mm; image-rendering: pixelated; }
.sheet-box thead th { border-bottom: 1px solid #000; }
.sheet-box tbody td { border-bottom: 1px solid #d9dce0; }
.sheet-box tbody tr:last-child td { border-bottom: 0; font-weight: 700; }
.sheet-total { margin-top: 4mm; }
.sheet-total td { border-bottom: 0; }
.sheet-doc .sheet-grand td { padding: 2mm; border-top: 1.5px solid #000; border-bottom: 1.5px solid #000; font-size: 12pt; font-weight: 700; }
.sheet-pfr { margin-top: 3mm; font-size: 9pt; line-height: 1.6; color: #222; }
.sheet-signature { margin-top: 8mm; font-size: 10pt; }
.sheet-note { margin-top: -2mm; font-size: 9pt; text-align: center; white-space: pre-line; }

@media print {
    .sheet-buyer, .sheet-items thead th { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Thermal rolls. The receipt is 40 characters wide and a character of these fonts is 0.6 of
   the font size, so the size is what makes 40 of them fit the printable width: 72 mm of an
   80 mm roll, 48 mm of a 58 mm one. */
.sheet[data-paper="80"] .receipt, .sheet[data-paper="58"] .receipt { box-sizing: border-box; max-width: none; padding: 3mm 0; overflow: visible; }
.sheet[data-paper="80"] .receipt { width: 80mm; }
.sheet[data-paper="58"] .receipt { width: 58mm; }
.sheet[data-paper="80"] pre, .sheet[data-paper="58"] pre { width: fit-content; margin-left: auto; margin-right: auto; font-family: "Courier New", Consolas, monospace; line-height: 1.3; }
.sheet[data-paper="80"] pre { font-size: 2.9mm; }
.sheet[data-paper="58"] pre { font-size: 1.95mm; font-weight: bold; }
.sheet[data-paper="80"] .receipt img, .sheet[data-paper="58"] .receipt img { width: 40mm; height: 40mm; }

@media print {
    .topbar, .no-print, .flash, .errors { display: none !important; }
    body { background: #fff; }
    .receipt { border: 0; }
    body[data-paper] { margin: 0; }
    body[data-paper] main { max-width: none; margin: 0; padding: 0; }
    body[data-paper] .receipt { margin: 0; }
    .sheet[data-paper="a4"] { width: auto; max-width: none; padding: 0; border: 0; overflow: visible; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Phones. The register is used from a phone as well: everything fits the width of the
   screen, list tables turn into a card per row, and fields are large enough to tap. */
.pos-jump { display: none; }

@media (max-width: 640px) {
    main { margin: 12px auto; padding: 0 10px; }
    .footer { padding: 0 10px 64px; }
    h1 { font-size: 22px; }

    /* Name and sign-out on the first line, the menu under it across the whole width. */
    .topbar { padding: 8px 10px; gap: 6px 10px; }
    .topbar .brand { order: 1; flex: 1; }
    .topbar .who { order: 2; }
    .topbar form { order: 3; }
    .topbar nav { order: 4; flex: 0 0 100%; flex-wrap: wrap; gap: 2px; }
    .topbar nav a { padding: 8px 10px; }

    .head { flex-wrap: wrap; gap: 10px; }
    .head h1 { margin: 0; overflow-wrap: anywhere; }
    .actions { gap: 6px; }
    .card { padding: 14px 12px; overflow-x: auto; }

    /* 16 px keeps phones from zooming in on a field when it is tapped. */
    input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=file],
    input[type=date], input[type=datetime-local], select, textarea { font-size: 16px; min-height: 44px; }
    button, .btn { min-height: 44px; padding: 10px 14px; }
    .btn { display: inline-flex; align-items: center; }
    .remove { min-height: 0; }

    /* Fields that stood side by side wrap once they would be too narrow. */
    .row { flex-wrap: wrap; gap: 0 10px; }
    .row > * { flex: 1 1 140px; min-width: 0; }
    .row > .field:has(input[type=datetime-local]), .row > .field:has(textarea) { flex-basis: 100%; }
    .filters .field { min-width: 130px; }
    .filters .field:first-child { flex-basis: 100%; }
    .buyer-id { flex-wrap: wrap; }
    .buyer-id select { flex: 1 1 100%; }

    /* A table that is not a list keeps its shape and scrolls sideways inside its card. */
    th, td { padding: 8px 6px; }

    /* A list: one card per row, each value under its own label. */
    table.stack thead { display: none; }
    table.stack, table.stack tbody { display: block; }
    table.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
    table.stack tr:last-child { border-bottom: 0; }
    table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; border: 0; text-align: right; overflow-wrap: anywhere; }
    table.stack td::before { content: attr(data-text); flex: none; color: var(--muted); font-size: 13px; text-align: left; }
    table.stack td:nth-child(2) a, table.stack td:first-child a { font-weight: 600; }

    /* The register: products first, the receipt under them, and a bar that takes you to it. */
    .pos-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-product { min-height: 64px; overflow-wrap: anywhere; }
    .cart td input { width: 64px; }
    .total { font-size: 22px; }
    .pos-jump {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
        justify-content: space-between; align-items: center; gap: 12px;
        padding: 10px 14px; background: var(--text); color: #fff; text-decoration: none; font-weight: 600;
    }
    .pos-jump span:last-child { padding: 6px 12px; border-radius: 6px; background: var(--accent); }

    .dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); padding: 14px 12px; }
    .legend { font-size: 13px; }
    .paper-choice { flex-wrap: wrap; }

    /* The A4 sheet is wider than the screen: it scrolls sideways, as a sheet would. */
    .sheet[data-paper="a4"] { padding: 6mm; }
    .receipt { padding: 10px; }
}

@media print {
    .pos-jump { display: none !important; }
}

@media (max-width: 640px) {
    /* The name a row goes by stands first, on its own, without a label. */
    table.stack td[data-label="Naziv"], table.stack td[data-label="Kupac"] { order: -1; justify-content: flex-start; text-align: left; font-weight: 600; font-size: 16px; }
    table.stack td[data-label="Naziv"]::before, table.stack td[data-label="Kupac"]::before { content: none; }
    table.stack tr { display: flex; flex-direction: column; }

    /* Receipts are told apart at a glance and need no labels: number and amount on the
       first line, kind and state on the second, time and cashier in small print. */
    table.stack tr:has(td[data-label="Broj računa"]) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; }
    table.stack tr:has(td[data-label="Broj računa"]) td { display: block; padding: 0; text-align: left; }
    table.stack tr:has(td[data-label="Broj računa"]) td::before { content: none; }
    table.stack td[data-label="Broj računa"] { order: 1; font-weight: 600; }
    table.stack tr:has(td[data-label="Broj računa"]) td[data-label="Iznos"] { order: 2; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
    table.stack tr:has(td[data-label="Broj računa"]) td[data-label="Vrsta"] { order: 3; }
    table.stack tr:has(td[data-label="Broj računa"]) td[data-label="Stanje"] { order: 4; text-align: right; }
    table.stack tr:has(td[data-label="Broj računa"]) td[data-label="Vreme"] { order: 5; color: var(--muted); font-size: 13px; }
    table.stack tr:has(td[data-label="Broj računa"]) td[data-label="Kasir"] { order: 6; color: var(--muted); font-size: 13px; text-align: right; }
}

/* The line under the closing line may be longer than the receipt is wide: it wraps inside it. */
.receipt .note { width: 40ch; max-width: 100%; margin: 4px auto 0; white-space: pre-wrap; overflow-wrap: anywhere; text-align: center; }

@media (max-width: 640px) {
    /* A field made wider than its neighbours on a desktop takes the whole line on a phone. */
    .row > [style*="flex"] { flex: 1 1 100% !important; }
    .field[style*="max-width"] { max-width: none !important; }
}

/* Links between pages that belong together, e.g. the report and the tax rates. */
.tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; border-radius: 6px 6px 0 0; color: var(--muted); text-decoration: none; }
.tabs a.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

/* What must not be missed on the register: red for what is missing or wrong, green for the
   change to hand back. The change is green on the receipt as well. */
.change-amount { color: var(--bad); font-size: 17px; }
.change-amount.good { color: var(--ok); }
.receipt .change, .sheet-doc .change td { color: var(--ok); font-weight: 700; }

/* The register shows about ten products at a time; the rest are a scroll away, and the
   search narrows them down. */
.pos-products { max-height: calc(100vh - 230px); overflow-y: auto; padding-right: 2px; overscroll-behavior: contain; }

@media (max-width: 640px) {
    /* Five rows of two, with half of the next row showing so that it is clear there is more. */
    .pos-products { max-height: 396px; }

    /* The menu stays on one line; on a very narrow screen it scrolls sideways. */
    .topbar nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .topbar nav a { flex: none; padding: 8px 7px; white-space: nowrap; }

    /* The buttons of a page stay on one line, sharing its width. */
    .head .actions { flex: 1 1 100%; flex-wrap: nowrap; }
    .head .actions { gap: 4px; }
    .head .actions > * { flex: 1 1 auto; }
    .head .actions form { display: flex; }
    .head .actions button, .head .actions .btn { width: 100%; justify-content: center; padding: 10px 4px; font-size: 14px; white-space: nowrap; }
}

@media print {
    .receipt .change, .sheet-doc .change td { color: inherit; font-weight: inherit; }
}

/* Choice of language under the sign-in form. */
.language { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* Sign-in: the link for a forgotten password; setting up two-step sign-in. */
.forgot { margin-left: 12px; font-size: 14px; }
.qr { width: 220px; margin: 8px 0 12px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.qr svg { display: block; width: 100%; height: auto; }
.codes { columns: 2; max-width: 360px; margin: 0 0 14px; padding: 12px 14px; background: var(--bg); border-radius: 6px; font: 15px/1.9 "Cascadia Mono", Consolas, "Courier New", monospace; }

/* The A4 receipt in the house style of memodok.rs: navy and blue on white, light blue rules
   and panels, small spaced labels. Colours only; the layout above is unchanged. */
.sheet[data-paper="a4"] {
    --navy: #0a1f44;
    --blue: #1556b0;
    --ink: #1b2a44;
    --soft: #5b6f91;
    --line: #d3def0;
    --panel: #f4f7fc;
    color: var(--ink);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
.sheet[data-paper="a4"] .sheet-head { color: var(--soft); padding-bottom: 5mm; border-bottom: 1px solid var(--line); }
.sheet[data-paper="a4"] .sheet-seller,
.sheet[data-paper="a4"] .sheet-account,
.sheet[data-paper="a4"] .sheet-kind,
.sheet[data-paper="a4"] .sheet-rule { font-family: Montserrat, Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--navy); }
.sheet[data-paper="a4"] .sheet-seller { font-size: 16pt; font-weight: 700; letter-spacing: -.01em; }
.sheet[data-paper="a4"] .sheet-account { font-weight: 600; }
/* Small spaced labels with a short line in front, as section titles are on the site. */
.sheet[data-paper="a4"] .sheet-label { display: flex; align-items: center; gap: 2mm; color: var(--blue); font-weight: 600; }
.sheet[data-paper="a4"] .sheet-label::before { content: ""; width: 6mm; border-top: 1px solid var(--blue); }
.sheet[data-paper="a4"] .sheet-accounts .sheet-label { justify-content: flex-end; }
.sheet[data-paper="a4"] .sheet-rule { font-weight: 600; letter-spacing: .12em; }
.sheet[data-paper="a4"] .sheet-rule::before, .sheet[data-paper="a4"] .sheet-rule::after { border-top-color: var(--navy); }
.sheet[data-paper="a4"] .sheet-small, .sheet[data-paper="a4"] .sheet-gtin { color: var(--soft); }
.sheet[data-paper="a4"] .sheet-buyer { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 2mm; }
.sheet[data-paper="a4"] .sheet-buyer .sheet-strong { color: var(--navy); }
.sheet[data-paper="a4"] .sheet-kind { font-weight: 600; color: var(--blue); }
.sheet[data-paper="a4"] .sheet-doc th, .sheet[data-paper="a4"] .sheet-doc td { color: var(--ink); }
.sheet[data-paper="a4"] .sheet-doc th { color: var(--soft); font-weight: 600; }
.sheet[data-paper="a4"] .sheet-items thead th { background: var(--panel); border-top: 1px solid var(--navy); border-bottom: 1px solid var(--navy); color: var(--navy); }
.sheet[data-paper="a4"] .sheet-items tbody td { border-bottom-color: var(--line); }
.sheet[data-paper="a4"] .sheet-items tbody tr:last-child td { border-bottom-color: var(--navy); }
.sheet[data-paper="a4"] .sheet-box thead th { border-bottom-color: var(--line); }
.sheet[data-paper="a4"] .sheet-box tbody td { border-bottom-color: var(--line); }
.sheet[data-paper="a4"] .sheet-doc .sheet-grand td { background: var(--panel); border-top: 1.5px solid var(--navy); border-bottom: 1.5px solid var(--navy); color: var(--navy); font-family: Montserrat, Inter, "Segoe UI", system-ui, Arial, sans-serif; }
.sheet[data-paper="a4"] .sheet-pfr { color: var(--ink); }
.sheet[data-paper="a4"] .sheet-note { color: var(--soft); }

@media print {
    .sheet[data-paper="a4"] .sheet-doc .sheet-grand td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* A little tighter, so that a receipt of five or six items still ends on its first sheet. */
.sheet[data-paper="a4"] .sheet-doc th, .sheet[data-paper="a4"] .sheet-doc td { padding-top: 1.05mm; padding-bottom: 1.05mm; }
.sheet[data-paper="a4"] .sheet-fiscal { line-height: 1.4; }
.sheet[data-paper="a4"] .sheet-head { padding-bottom: 4mm; }
.sheet[data-paper="a4"] .sheet-rule { margin: 5mm 0 3.5mm; }
.sheet[data-paper="a4"] .sheet-kind { margin: 4mm 0 2.5mm; }
.sheet[data-paper="a4"] .sheet-bottom { margin-top: 5mm; }
.sheet[data-paper="a4"] .sheet-pfr { line-height: 1.5; }
.sheet[data-paper="a4"] .sheet-signature { margin-top: 5mm; }
