
:root {
    --invoice-accent: #ff7900;
    --invoice-text: #262626;
    --invoice-muted: #4d4d4d;
    --invoice-soft: #f0f0f0;
    --invoice-line: #d8d8d8;
    --invoice-strong-line: #222222;
    --invoice-divider-thickness: 0.8mm;
}

@page {
    size: A4;
    margin: 22mm 18mm 16mm;

    @top-right {
        content: element(page-logo);
    }
}

@page :first {
    margin-top: 18mm;
    margin-bottom: 30mm;

    @top-right {
        content: none;
    }

    @bottom-left {
        content: element(invoice-footer-left);
        vertical-align: top;
    }

    @bottom-center {
        content: element(invoice-footer-center);
        vertical-align: top;
    }

    @bottom-right {
        content: element(invoice-footer-right);
        vertical-align: top;
    }
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Metropolis', sans-serif;
    font-size: 8.5pt;
    line-height: 1.24;
    color: var(--invoice-text);
}

img,
svg {
    display: block;
    max-width: 100%;
}

.invoice-shell {
    width: 100%;
}

.continuation-logo-shell {
    position: running(page-logo);
    width: 50mm;
    margin-left: auto;
}

.logo-mark svg,
.logo-mark img {
    width: 100%;
    height: auto;
    max-height: 18mm;
    object-fit: contain;
    object-position: right center;
}

.invoice-header,
.totals-box,
.invoice-footer,
.item-row {
    break-inside: avoid;
    page-break-inside: avoid;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12mm;
    margin-bottom: 10mm;
}

.invoice-title {
    font-size: 46pt;
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: -0.04em;
    color: var(--invoice-accent);
    margin: 0;
    padding: 0;
}

.header-logo {
    width: 58mm;
    flex: 0 0 58mm;
}

.header-columns {
    display: flex;
    align-items: flex-start;
    gap: 11mm;
}

.header-left {
    flex: 1 1 auto;
}

.header-right {
    flex: 0 0 62mm;
    margin-top: 0;
}

/* Split recipient-label out from company-name/customer-name so it reads
   as a small caption above the address block, not a peer heading. */
.company-name,
.customer-name {
    font-size: 11pt;
    font-weight: 700;
    margin: 0 0 1.2mm;
}

.recipient-label {
    font-size: 7.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--invoice-muted);
    margin: 0 0 1.4mm;
}

.address-lines {
    color: var(--invoice-muted);
    font-style: italic;
}

.address-line,
.footer-line,
.footer-pair {
    margin: 0 0 0.5mm;
}

.meta-table {
    width: 100%;
    margin-top: 3.8mm;
    border-collapse: separate;
    border-spacing: 0 0.5mm;
}

.meta-table th,
.meta-table td {
    background: var(--invoice-soft);
    padding: 1.1mm 2.1mm;
    color: var(--invoice-muted);
    font-size: 8.5pt;
}

.meta-table th {
    width: 43%;
    text-align: left;
    font-weight: 400;
}

.meta-table td {
    width: 57%;
}

.meta-box {
    max-width: 97mm;
}

.recipient-panel {
    background: var(--invoice-soft);
    padding: 2.4mm 2.8mm 2.6mm;
}

.receiver-card {
    margin: 0;
}

.line-items-shell {
    margin-top: 12mm;
    min-height: 88mm;
    border-top: var(--invoice-divider-thickness) solid var(--invoice-strong-line);
    padding-top: 3.8mm;
}

.item-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.col-description {
    width: 33%;
}

.col-quantity {
    width: 9%;
}

.col-unit {
    width: 7%;
}

.col-unit-price {
    width: 14%;
}

.col-vat-rate {
    width: 10%;
}

.col-vat-amount {
    width: 13.5%;
}

.col-line-total {
    width: 13.5%;
}

thead {
    display: table-header-group;
}

.item-table thead th {
    padding: 0.4mm 1.1mm 2.4mm;
    border-bottom: 1.1px solid var(--invoice-strong-line);
    font-size: 9pt;
    font-weight: 700;
    text-align: left;
}

.item-table tbody td {
    padding: 3mm 1.1mm 3mm;
    border-bottom: 1px solid var(--invoice-line);
    vertical-align: top;
    font-size: 8.5pt;
}

.item-table .description {
    padding-right: 4mm;
    color: var(--invoice-muted);
    white-space: pre-line;
}

.item-table .numeric {
    text-align: right;
    white-space: nowrap;
}

.summary-row {
    display: flex;
    align-items: flex-start;
    gap: 9mm;
    margin-top: 8mm;
    border-bottom: var(--invoice-divider-thickness) solid var(--invoice-strong-line);
    padding-bottom: 2.5mm;
}

.notes-box {
    flex: 1 1 auto;
    min-height: 20mm;
}

.notes-title {
    margin: 0 0 2mm;
    font-weight: 700;
}

.note-line {
    margin: 0 0 1.5mm;
    color: var(--invoice-muted);
}

.totals-box {
    width: 94mm;
    margin-left: auto;
}

.totals-table {
    width: 100%;
    border-collapse: collapse;
}

.totals-table th,
.totals-table td {
    padding: 2.3mm 0;
    text-align: right;
    font-size: 8.5pt;
}

.totals-table th {
    width: 58%;
    padding-right: 5.2mm;
    font-weight: 700;
    text-align: left;
}

.totals-table td {
    width: 42%;
    min-width: 28mm;
}

.totals-table tr.grand-total th,
.totals-table tr.grand-total td {
    padding-top: 2.4mm;
    border-top: 1.1px solid var(--invoice-strong-line);
    color: var(--invoice-accent);
    font-size: 12pt;
    font-weight: 700;
}

.invoice-footer {
    width: 100%;
}

.footer-column {
    width: 100%;
    padding-top: 2.5mm;
    padding-bottom: 5mm;
    text-align: left;
    font-size: 7pt;
    color: var(--invoice-muted);
}

.footer-left {
    position: running(invoice-footer-left);
}

.footer-center {
    position: running(invoice-footer-center);
    padding-right: 1.5mm;
}

.footer-right {
    position: running(invoice-footer-right);
}

.footer-heading {
    margin: 0 0 1.4mm;
    font-size: 7pt;
    font-weight: 700;
    color: var(--invoice-text);
}

.footer-key {
    display: inline-block;
    min-width: 16mm;
    color: var(--invoice-text);
}

.empty-row td {
    color: transparent;
}

.details-section {
    break-before: page;
    page-break-before: always;
    margin-top: 2mm;
}

.details-title {
    margin: 0 0 2mm;
    font-size: 13pt;
}

.details-customer {
    margin: 0 0 4mm;
    font-weight: 700;
}

.details-group {
    margin-bottom: 5mm;
}

.details-project {
    margin: 0 0 1.8mm;
    font-size: 10pt;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.details-table thead th {
    padding: 0.5mm 1mm 1.8mm;
    border-bottom: 1px solid var(--invoice-strong-line);
    text-align: left;
    font-size: 8.5pt;
}

.details-table tbody td {
    padding: 1.8mm 1mm;
    border-bottom: 1px solid var(--invoice-line);
    color: var(--invoice-muted);
    vertical-align: top;
}

.details-table .numeric {
    text-align: right;
    white-space: nowrap;
}

.details-table th:nth-child(1),
.details-table td:nth-child(1) {
    width: 36%;
}

.details-table th:nth-child(2),
.details-table td:nth-child(2),
.details-table th:nth-child(3),
.details-table td:nth-child(3) {
    width: 18%;
}

.details-table th:nth-child(4),
.details-table td:nth-child(4) {
    width: 12%;
}

.details-table th:nth-child(5),
.details-table td:nth-child(5) {
    width: 16%;
}

