﻿.invoice-root {
    max-width: 210mm;
    margin: 0 auto;
    color: #000000
    /* if you really need scrolling on screen, fine: */
    /* height: 100vh;
       overflow: auto; */
}


/* Toolbar buttons */
.toolbar {
    margin: 10px 0;
    width: 210mm;
    display: flex;
    justify-content: flex-end;
}

.btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #888;
    background: #f3f3f3;
    cursor: pointer;
}

/* A4 page look */
.invoice-page {
    width: 210mm;
    /* height: 297mm;           remove or comment this */
    min-height: 297mm; /* optional: just for first-page look */
    margin: 0 auto;
    padding: 10mm;
    background: white;
    box-shadow: 0 0 5px rgba(0,0,0,.1);
    /* overflow: hidden;        remove this for printing */
}


/* Header layout */
.header {
    display: grid;
    grid-template-columns: 60px 1fr 30px;
    column-gap: 8px;
    align-items: center;
}

.header-left .logo {
    width: 50px;
    height: 90px;
    object-fit: contain;
}

.header-center {
    text-align: center;
}

.company-name {
    font-size: 22px;
    font-weight: 600;
}

.company-reg {
    font-size: 14px;
    font-weight: 600;
}

.company-line {
    font-size: 10px;
}

/* Top border + title */
.top-border {
    border-top: 1px solid #000;
    margin-top: 6px;
}

.invoice-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
}

/* Meta section */
.meta-block {
    margin-top: 4px;
    font-size: 11px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
}

    .meta-row .meta-left {
        flex: 1 1 auto;
        padding-right: 10px;
    }

    .meta-row .meta-right {
        min-width: 120px;
        text-align: right;
    }

    .meta-row.top-bordered {
        border-top: 1px solid #000;
    }

    .meta-row.bottom-bordered {
        border-bottom: 1px solid #000;
    }

    .meta-row .label {
        font-weight: 600;
    }

/* Details table */
.details-block {
    margin-top: 8px;
}

/* Only outer frame + header separator */
.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    border-top: 1px solid #000; /* top line like your sample */
    border-bottom: 1px solid #000; /* bottom line */
}

    .details-table thead th,
    .details-table tbody td {
        padding: 2px 4px;
        vertical-align: middle;
    }

    /* header line under column captions */
    .details-table thead tr {
        border-bottom: 1px solid #000;
    }

    /* vertical borders only on left + right edges, not between every column */
    .details-table thead th:first-child,
    .details-table tbody td:first-child {
        border-left: 1px solid #000;
    }

    .details-table thead th:last-child,
    .details-table tbody td:last-child {
        border-right: 1px solid #000;
    }



/* column widths / alignment */
.col-no {
    width: 5%;
}

.col-desc {
    width: 40%;
}

.col-qty,
.col-unit,
.col-discount,
.col-amount {
    width: 13.75%;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}


/* Totals section */
.totals-block {
    margin-top: 10px;
    font-size: 11px;
}

.totals-top-border,
.totals-bottom-border {
    border-top: 1px solid #000;
    margin: 4px 0;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
}

.totals-left {
    flex: 1;
}

.totals-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.totals-label {
    white-space: nowrap;
}

.totals-box {
    display: inline-block;
    min-width: 70px;
    border: 1px solid #000;
    padding: 2px 4px;
    text-align: right;
}

/* Notes */
.notes {
    margin-top: 8px;
    font-size: 8px;
}

.notes-title {
    font-size: 8px;
    font-weight: 600;
}

.note-line {
    margin-top: 2px;
}

    .note-line.strong {
        font-weight: 700;
    }
.meta-left-box {
    position: relative;
    padding: 6px 10px;
    display: inline-block;
    min-width: 220px; /* adjust width as you like */
    line-height: 1.2;
}

    /* generic corner span */
    .meta-left-box .corner {
        position: absolute;
        width: 14px; /* length of corner lines */
        height: 14px;
        border-color: #000;
    }

        /* top-left corner */
        .meta-left-box .corner.tl {
            top: 0;
            left: 0;
            border-top: 1px solid #000;
            border-left: 1px solid #000;
        }

        /* top-right corner */
        .meta-left-box .corner.tr {
            top: 0;
            right: 0;
            border-top: 1px solid #000;
            border-right: 1px solid #000;
        }

        /* bottom-left corner */
        .meta-left-box .corner.bl {
            bottom: 0;
            left: 0;
            border-bottom: 1px solid #000;
            border-left: 1px solid #000;
        }

        /* bottom-right corner */
        .meta-left-box .corner.br {
            bottom: 0;
            right: 0;
            border-bottom: 1px solid #000;
            border-right: 1px solid #000;
        }

/* Print styles */
@page {
    size: A4 portrait;
    margin: 10mm;
}

@media print {

    /* Hide toolbar and any other elements you don’t want printed */
    .no-print,
    .toolbar {
        display: none !important;
    }

    /* Let the invoice use full width and normal flow */
    .invoice-root {
        max-width: none;
        width: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
        overflow: visible !important;
        position: static; /* important: NOT absolute */
    }

    .invoice-page {
        width: auto;
        min-height: 0; /* don’t force a min height for print */
        height: auto;
        margin: 0;
        padding: 10mm;
        box-shadow: none;
        overflow: visible;
        page-break-after: auto;
    }

    /* Allow table to break across pages */
    .details-block {
        page-break-inside: auto;
    }

    /* Try to avoid splitting totals/notes in the middle */
    .totals-block,
    .notes {
        page-break-inside: avoid;
    }
}



