@page {
    size: A4;
    margin: 12mm;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: 11px;
    color: #000;
}

.modern-invoice {
    width: 210mm;
    box-sizing: border-box;
    position: relative;
}

/* Watermark */
.mi-watermark {
    position: fixed;
    top: 40%;
    left: 20%;
    font-size: 90px;
    color: rgba(0,0,0,0.08);
    transform: rotate(-30deg);
    z-index: 0;
    pointer-events: none;
}

/* HEADER */
.mi-header {
    display: flex;
    justify-content: space-between;
    border: 1px solid #000;
    padding: 10px;
    gap: 10px;
}

.mi-left {
    display: flex;
    gap: 10px;
    width: 65%;
}

.mi-logo {
    width: 80px;
    max-height: 70px;
    object-fit: contain;
}

.mi-company {
    font-size: 20px;
    font-weight: bold;
}

.mi-small {
    font-size: 11px;
    line-height: 1.3;
}

.mi-right {
    width: 35%;
    text-align: center;
}

.mi-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 4px;
}

.mi-inv-meta {
    font-size: 11px;
    margin-bottom: 6px;
}

#barcode {
    display: block;
    max-width: 160px;
    height: 45px;
    margin: auto;
}

/* PARTY */
.mi-party {
    display: flex;
    border: 1px solid #000;
    border-top: none;
}

.mi-box {
    width: 50%;
    padding: 8px;
    border-right: 1px solid #000;
    line-height: 1.3;
}

.mi-box:last-child {
    border-right: none;
}

.mi-box-title {
    font-weight: bold;
    margin-bottom: 4px;
}

/* ITEMS */
.mi-items {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #000;
    border-top: none;
}

.mi-items th, .mi-items td {
    border: 1px solid #000;
    padding: 4px 5px;
}

.mi-items th {
    background: #f5f5f5;
    font-weight: bold;
    text-align: center;
}

.mi-desc {
    font-size: 9px;
    color: #444;
}

/* BOTTOM */
.mi-bottom {
    display: flex;
    border: 1px solid #000;
    border-top: none;
}

.mi-left-panel {
    width: 60%;
    border-right: 1px solid #000;
    padding: 8px;
}

.mi-right-panel {
    width: 40%;
    padding: 8px;
}

.mi-section-title {
    font-weight: bold;
    margin-bottom: 5px;
}

/* HSN */
.mi-hsn {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}

.mi-hsn th, .mi-hsn td {
    border: 1px solid #000;
    padding: 4px;
}

.mi-hsn th {
    background: #f5f5f5;
    text-align: center;
}

/* Words */
.mi-words {
    border: 1px solid #000;
    padding: 5px;
    margin-bottom: 8px;
}

/* Bank */
.mi-bank {
    border: 1px solid #000;
    padding: 6px;
    font-size: 10px;
}

/* Totals */
.mi-totals {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.mi-totals td {
    border: 1px solid #000;
    padding: 5px;
}

.mi-grand td {
    font-weight: bold;
    font-size: 12px;
}

/* QR */
.mi-qr-box {
    border: 1px solid #000;
    padding: 8px;
    text-align: center;
}

#upiQR {
    width: 110px;
    height: 110px;
    margin: auto;
}

.mi-qr-text {
    font-size: 10px;
    font-weight: bold;
    margin-top: 4px;
}

.mi-qr-amt {
    font-size: 11px;
    margin-top: 2px;
}

/* FOOTER */
.mi-footer {
    display: flex;
    border: 1px solid #000;
    border-top: none;
}

.mi-terms {
    width: 65%;
    padding: 8px;
    border-right: 1px solid #000;
    font-size: 10px;
    line-height: 1.3;
}

.mi-sign {
    width: 35%;
    padding: 8px;
    text-align: right;
}

/* ALIGN HELPERS */
.r { text-align: right; }
.c { text-align: center; }

@media print {
    body * {
        visibility: hidden;
    }

    .modern-invoice,
    .modern-invoice * {
        visibility: visible;

        max-width: 190mm;
left:-12%;
    }

    .modern-invoice {
        position: relative;
border: 1px solid #000;
    }
}