.invoice-page {
    padding: 50px 20px 80px;
    background: #f7f3ef;
}

.invoice-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: min(100%, 1050px);
    margin: 0 auto 24px;
}

.invoice-back-link {
    color: #655b55;
    text-decoration: none;
    font-weight: 600;
}

.invoice-print-button {
    padding: 12px 20px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #a96358;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.invoice-document {
    width: min(100%, 1050px);
    margin: 0 auto;
    padding: 55px;
    background: #fff;
    border: 1px solid #eadfd9;
    box-shadow: 0 20px 60px rgba(47, 47, 47, 0.08);
}

.invoice-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    padding-bottom: 35px;
    border-bottom: 1px solid #e6dbd5;
}

.invoice-brand p,
.invoice-customer p {
    margin: 4px 0;
}

.invoice-brand-name {
    margin-bottom: 14px !important;
    color: #a96358;
    font-size: 1.5rem;
    font-weight: 800;
}

.invoice-identity {
    text-align: right;
}

.invoice-label {
    margin: 0;
    color: #a96358;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.invoice-identity h1 {
    margin: 8px 0 22px;
    font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.invoice-meta {
    margin: 0;
}

.invoice-meta div {
    display: flex;
    justify-content: flex-end;
    gap: 18px;
    margin-top: 8px;
}

.invoice-meta dt {
    color: #746a64;
}

.invoice-meta dd {
    min-width: 150px;
    margin: 0;
    font-weight: 700;
}

.invoice-customer {
    width: min(100%, 420px);
    margin: 35px 0;
    padding: 24px;
    background: #faf7f4;
    border-radius: 16px;
}

.invoice-customer h2 {
    margin-top: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.invoice-customer-name {
    font-weight: 800;
}

.invoice-table-wrapper {
    overflow-x: auto;
}

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

.invoice-table th,
.invoice-table td {
    padding: 16px 14px;
    border-bottom: 1px solid #e6dbd5;
    text-align: left;
    vertical-align: top;
}

.invoice-table th {
    color: #655b55;
    background: #faf7f4;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.invoice-table th:nth-child(n + 2),
.invoice-table td:nth-child(n + 2) {
    text-align: right;
}

.invoice-table td p {
    margin: 6px 0 0;
    color: #746a64;
    font-size: 0.9rem;
}

.invoice-summary {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
}

.invoice-summary-box {
    width: min(100%, 420px);
}

.invoice-summary-line {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    padding: 9px 0;
}

.invoice-total {
    margin-top: 12px;
    padding-top: 20px;
    border-top: 2px solid #2f2f2f;
    font-size: 1.25rem;
}

.invoice-total strong {
    color: #a96358;
    font-size: 1.4rem;
}

.invoice-footer {
    margin-top: 55px;
    padding-top: 25px;
    border-top: 1px solid #e6dbd5;
    color: #ffffff;
    font-size: 0.9rem;
}

.invoice-payment-status {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 700px) {
    .invoice-page {
        padding: 25px 12px 50px;
    }

    .invoice-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .invoice-print-button {
        width: 100%;
    }

    .invoice-document {
        padding: 25px 18px;
    }

    .invoice-header {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .invoice-identity {
        text-align: left;
    }

    .invoice-meta div {
        justify-content: space-between;
    }

    .invoice-meta dd {
        min-width: 0;
    }

    .invoice-table thead {
        display: none;
    }

    .invoice-table,
    .invoice-table tbody,
    .invoice-table tr,
    .invoice-table td {
        display: block;
        width: 100%;
    }

    .invoice-table tr {
        margin-bottom: 18px;
        padding: 14px;
        border: 1px solid #e6dbd5;
        border-radius: 14px;
    }

    .invoice-table td {
        display: flex;
        justify-content: space-between;
        gap: 18px;
        padding: 8px 0;
        border: 0;
        text-align: right !important;
    }

    .invoice-table td::before {
        content: attr(data-label);
        color: #746a64;
        font-weight: 700;
        text-align: left;
    }
}

@media print {
    @page {
        size: A4;
        margin: 8mm;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        background: #fff;
        font-size: 8.5pt;
        line-height: 1.25;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .no-print,
    body > header,
    .shop-nav-wrapper,
    .footer-values,
    .site-footer,
    #cookie-consent {
        display: none !important;
    }

    .invoice-page {
        min-height: 0;
        padding: 0 !important;
        background: #fff;
    }

    .invoice-document {
        display: flex;
        flex-direction: column;
        width: 100% !important;
        max-width: none;
        min-height: 281mm;
        margin: 0;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        box-sizing: border-box;
    }

    .invoice-header {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 12mm;
        padding-bottom: 4mm;
        border-bottom: 1px solid #d9cec8;
    }

    .invoice-brand p,
    .invoice-customer p {
        margin: 1mm 0;
    }

    .invoice-brand-name {
        margin-bottom: 2mm !important;
        font-size: 13pt;
    }

    .invoice-label {
        font-size: 7pt;
    }

    .invoice-identity {
        text-align: right;
    }

    .invoice-identity h1 {
        margin: 1.5mm 0 3mm;
        font-size: 18pt;
        line-height: 1;
    }

    .invoice-meta div {
        gap: 5mm;
        margin-top: 1.2mm;
    }

    .invoice-meta dd {
        min-width: 30mm;
    }

    .invoice-customer {
        width: 76mm;
        margin: 4mm 0;
        padding: 3mm 4mm;
        border-radius: 2mm;
    }

    .invoice-customer h2 {
        margin: 0 0 1.5mm;
        font-size: 8pt;
    }

    .invoice-table-wrapper {
        overflow: visible;
    }

    .invoice-table {
        font-size: 8pt;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 2.2mm 2mm;
    }

    .invoice-table th {
        font-size: 7pt;
    }

    .invoice-table td p {
        display: none;
    }

    .invoice-summary {
        margin-top: 4mm;
    }

    .invoice-summary-box {
        width: 76mm;
    }

    .invoice-summary-line {
        gap: 5mm;
        padding: 1.2mm 0;
    }

    .invoice-total {
        margin-top: 1.5mm;
        padding-top: 2.5mm;
        font-size: 10pt;
    }

    .invoice-total strong {
        font-size: 11pt;
    }

    .invoice-footer {
        display: block !important;
        margin-top: auto;
        padding-top: 3mm;
        font-size: 7.5pt;
    }

    .invoice-footer p {
        margin: 1mm 0;
    }

    .invoice-payment-status {
        font-size: 8.5pt;
    }

    .invoice-customer,
    .invoice-table th {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .invoice-header,
    .invoice-customer,
    .invoice-table tr,
    .invoice-summary,
    .invoice-footer {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    .invoice-table {
        page-break-before: avoid;
    }
}
