/* ===============================
   BASE
================================ */
* {
    box-sizing: border-box;
}

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

.invoice-page {
    max-width: 148mm;       /* A5 width */
    min-height: 210mm;      /* A5 height */
    margin: auto;
    padding: 10mm;
}

/* ===============================
   HEADER
================================ */
.company-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid #000;
    padding: 6px;
    margin-bottom: 6px;
}

.company-logo img {
    max-width: 55px;
}

.logo-print {
    display: none;
}

.company-text h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 0.4px;
}

.tamil-name {
    font-size: 14px;
    font-weight: bold;
    margin: 1px 0;
}

.company-text p {
    margin: 2px 0;
    font-size: 11px;
    line-height: 1.35;
}

.invoice-status {
    font-size: 10px;
    color: #900;
    margin-bottom: 4px;
}

/* ===============================
   TABLES
================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

th, td {
    border: 1px solid #000;
    padding: 4px;
    font-size: 11px;
}

th {
    font-weight: bold;
}

.invoice-info td {
    border: none;
}

.qr-box {
    text-align: right;
}

.qr-box img {
    width: 80px;
}

/* ===============================
   ITEMS TABLE
================================ */
.items-table th,
.items-table td {
    text-align: center;
}

.items-table th:nth-child(2),
.items-table td:nth-child(2) {
    text-align: left;
}

.item-photo img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    display: block;
    margin: auto;
}

/* ===============================
   TOTALS
================================ */
.totals-table th {
    text-align: right;
}

/* ===============================
   BANK / SIGNATURE
================================ */
.bank-details {
    font-size: 9px;
    line-height: 1.4;
}

.pay-qr {
    text-align: right;
}

.signature-box td {
    height: 34px;
    vertical-align: bottom;
    font-size: 10px;
}

/* ===============================
   TERMS
================================ */
.invoice-terms {
    font-size: 9px;
    line-height: 1.3;
}

.invoice-terms h4 {
    margin: 4px 0;
    font-size: 10px;
    text-decoration: underline;
}

.invoice-terms li {
    margin-bottom: 2px;
}

/* ===============================
   FOOTER
================================ */
.footer-note {
    font-size: 9px;
    margin-top: 4px;
}

/* ===============================
   PRINT (A5 STRICT)
================================ */
@media print {
    @page {
        size: A5;
        margin: 0;
    }

    body {
        margin: 0;
    }

    .invoice-page {
        height: 210mm;
        overflow: hidden;
    }

    .logo-screen {
        display: none;
    }

    .logo-print {
        display: block;
        max-width: 45px;
    }

    button, a {
        display: none !important;
    }
}
