/* ═══════════════════════════════════════════════════════════════
   AK PRINT SEVA — 3 INVOICE & BILL TEMPLATES CSS (EXACT A4 SPECS)
   Clean PDF & Print Output · Zero Edge Artifacts · 100% Crisp Vector
   ═══════════════════════════════════════════════════════════════ */

/* ─── A4 PAPER SHEET BASE ─── */
.a4-invoice-sheet {
    width: 210mm;
    min-height: 297mm;
    background: #ffffff !important;
    color: #000000;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
    position: relative;
    box-shadow: none; /* No shadow to prevent black edge strips in canvas/PDF */
    margin: 0 auto;
    overflow: hidden;
    line-height: 1.35;
    padding: 18px 20px; /* Safe inset so outer borders never touch canvas boundary */
}

/* ═══════════════════════════════════════════════════════════════
   TEMPLATE 01: TAX INVOICE (Blue Strip Style)
   ═══════════════════════════════════════════════════════════════ */
.inv-t1-container {
    padding: 20px 24px;
    background: #ffffff;
    min-height: 275mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1.5px solid #000000;
    font-size: 13px;
    color: #000000;
}

.inv-t1-header {
    text-align: center;
    margin-bottom: 8px;
}
.inv-t1-company-name {
    font-family: 'Cinzel', 'Times New Roman', serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #000000;
    text-transform: uppercase;
    margin: 0 0 3px;
}
.inv-t1-company-address {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    margin-bottom: 2px;
}
.inv-t1-gst-pan-row {
    font-size: 12px;
    font-weight: 700;
    color: #111;
}

.inv-t1-blue-bar {
    background: #85B3E6;
    color: #000000;
    text-align: center;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 0;
    border: 1.5px solid #000000;
    border-bottom: none;
}

.inv-t1-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1.5px solid #000000;
    border-bottom: none;
}
.inv-t1-meta-cell {
    padding: 6px 10px;
    font-size: 12.5px;
    font-weight: 800;
}
.inv-t1-meta-cell:first-child {
    border-right: 1.5px solid #000000;
}

.inv-t1-party-box {
    border: 1.5px solid #000000;
    border-bottom: none;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
}
.inv-t1-party-title {
    font-weight: 900;
    margin-bottom: 3px;
}
.inv-t1-party-name {
    font-weight: 900;
    text-transform: uppercase;
}

/* T1 Table */
.inv-t1-table {
    width: 100%;
    border-collapse: collapse;
    border: 1.5px solid #000000;
}
.inv-t1-table th {
    border: 1.5px solid #000000;
    padding: 6px 8px;
    font-size: 12.5px;
    font-weight: 800;
    background: #f8fafc;
    text-align: center;
}
.inv-t1-table td {
    border-left: 1.5px solid #000000;
    border-right: 1.5px solid #000000;
    padding: 6px 8px;
    font-size: 12.5px;
    font-weight: 600;
    vertical-align: top;
}
.inv-t1-table .col-part { text-align: left; }
.inv-t1-table .col-hsn { text-align: center; width: 85px; }
.inv-t1-table .col-qty { text-align: center; width: 60px; }
.inv-t1-table .col-rate { text-align: right; width: 85px; }
.inv-t1-table .col-amt { text-align: right; width: 100px; }

.inv-t1-summary-row td {
    border-top: 1.5px solid #000000;
    border-bottom: 1.5px solid #000000;
    padding: 5px 8px;
    font-weight: 700;
}
.inv-t1-grand-total-row td {
    background: #000000;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 900;
    padding: 6px 8px;
    border-top: 1.5px solid #000000;
}

.inv-t1-words-box {
    border: 1.5px solid #000000;
    border-top: none;
    padding: 7px 10px;
    font-size: 12.5px;
    font-weight: 700;
    background: #fdfdfd;
}

.inv-t1-bank-qr-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    margin-top: 14px;
    align-items: center;
}
.inv-t1-bank-text {
    font-size: 12px;
    line-height: 1.45;
}
.inv-t1-upi-qr {
    text-align: center;
}
.inv-t1-upi-qr img {
    width: 80px;
    height: 80px;
    border: 1px solid #000;
}

.inv-t1-sign-section {
    margin-top: 20px;
    text-align: right;
    font-size: 13px;
    font-weight: 800;
}
.inv-t1-sign-space {
    height: 45px;
}


/* ═══════════════════════════════════════════════════════════════
   TEMPLATE 02: RETAIL / SERVICE CASH MEMO (Shree Motors Style)
   ═══════════════════════════════════════════════════════════════ */
.inv-t2-container {
    padding: 20px 24px;
    background: #ffffff;
    min-height: 275mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 2px solid #000000;
    border-radius: 6px;
    font-size: 13px;
    color: #000000;
}

.inv-t2-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.inv-t2-header-title {
    font-size: 16px;
    font-weight: 900;
    text-decoration: underline;
    letter-spacing: 0.5px;
}
.inv-t2-mobiles {
    font-size: 13px;
    font-weight: 800;
    text-align: right;
}

.inv-t2-branding-row {
    text-align: center;
    margin: 6px 0;
}
.inv-t2-brand-name {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-style: italic;
    margin: 2px 0;
}
.inv-t2-tagline-bar {
    background: #000000;
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 12px;
    border-radius: 4px;
    display: inline-block;
    margin: 3px 0 5px;
}
.inv-t2-address {
    font-size: 12.5px;
    font-weight: 700;
}

/* Dotted Fields */
.inv-t2-meta-grid {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
}
.inv-t2-dotted-line {
    border-bottom: 1.5px dotted #000000;
    flex: 1;
    display: inline-block;
    padding-left: 6px;
    font-weight: 600;
}
.inv-t2-row-flex {
    display: flex;
    align-items: flex-end;
}

/* T2 Table */
.inv-t2-table {
    width: 100%;
    border-collapse: collapse;
    border: 1.5px solid #000000;
    margin-top: 10px;
}
.inv-t2-table th {
    border: 1.5px solid #000000;
    padding: 6px 6px;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.5px;
}
.inv-t2-table td {
    border-left: 1.5px solid #000000;
    border-right: 1.5px solid #000000;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 600;
    vertical-align: top;
}
.inv-t2-table .t2-sno { width: 45px; text-align: center; }
.inv-t2-table .t2-part { text-align: left; }
.inv-t2-table .t2-rate { width: 85px; text-align: right; }
.inv-t2-table .t2-rs { width: 75px; text-align: right; }
.inv-t2-table .t2-p { width: 35px; text-align: center; }

.inv-t2-total-row td {
    border-top: 1.5px solid #000000;
    border-bottom: 1.5px solid #000000;
    font-size: 14px;
    font-weight: 900;
    padding: 6px 8px;
}

.inv-t2-footer {
    margin-top: 14px;
}
.inv-t2-amount-words {
    font-size: 13.5px;
    font-weight: 900;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-end;
}
.inv-t2-terms-sign-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 12px;
    line-height: 1.45;
}
.inv-t2-terms {
    font-weight: 600;
}
.inv-t2-sign-box {
    text-align: right;
    font-weight: 900;
    font-size: 13.5px;
}


/* ═══════════════════════════════════════════════════════════════
   TEMPLATE 03: COUNTER / CASH INVOICE (GST Pro Style)
   ═══════════════════════════════════════════════════════════════ */
.inv-t3-container {
    padding: 20px 24px;
    background: #ffffff;
    min-height: 275mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1.5px solid #000000;
    font-size: 12.5px;
    color: #000000;
}

.inv-t3-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 800;
}
.inv-t3-center-title {
    text-align: center;
}
.inv-t3-title-text {
    font-size: 17px;
    font-weight: 900;
    text-transform: uppercase;
}
.inv-t3-original-tag {
    font-size: 12px;
    letter-spacing: 1px;
}

.inv-t3-from-to-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1.5px solid #000000;
    border-bottom: none;
}
.inv-t3-box {
    padding: 8px 10px;
    line-height: 1.4;
}
.inv-t3-box:first-child {
    border-right: 1.5px solid #000000;
}
.inv-t3-seller-name {
    font-size: 15px;
    font-weight: 900;
}
.inv-t3-to-label {
    font-size: 15px;
    font-weight: 900;
}

/* T3 Table */
.inv-t3-table {
    width: 100%;
    border-collapse: collapse;
    border: 1.5px solid #000000;
}
.inv-t3-table th {
    border: 1.5px solid #000000;
    padding: 6px 8px;
    font-size: 12.5px;
    font-weight: 900;
    text-align: center;
    background: #f8fafc;
}
.inv-t3-table td {
    border-left: 1.5px solid #000000;
    border-right: 1.5px solid #000000;
    padding: 5px 8px;
    font-size: 12.5px;
    font-weight: 600;
    vertical-align: top;
}
.inv-t3-table .t3-sl { width: 35px; text-align: center; }
.inv-t3-table .t3-prod { text-align: left; }
.inv-t3-table .t3-gst { width: 55px; text-align: center; }
.inv-t3-table .t3-rate { width: 75px; text-align: right; }
.inv-t3-table .t3-qty { width: 50px; text-align: center; }
.inv-t3-table .t3-tot { width: 90px; text-align: right; }

.inv-t3-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1.5px solid #000000;
    border-top: none;
}
.inv-t3-bot-left {
    padding: 8px 10px;
    border-right: 1.5px solid #000000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.inv-t3-bot-right {
    padding: 0;
}
.inv-t3-calc-table {
    width: 100%;
    border-collapse: collapse;
}
.inv-t3-calc-table td {
    padding: 5px 8px;
    font-weight: 700;
    border-bottom: 1px solid #ddd;
}
.inv-t3-calc-table .calc-val { text-align: right; }
.inv-t3-final-total-row td {
    border-top: 1.5px solid #000000 !important;
    border-bottom: none !important;
    font-size: 16px;
    font-weight: 900;
    background: #f1f5f9;
}

.inv-t3-words-line {
    padding: 6px 0;
    font-size: 13px;
    font-weight: 800;
}

.inv-t3-gst-breakup-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #000000;
    margin: 8px 0;
}
.inv-t3-gst-breakup-table th, .inv-t3-gst-breakup-table td {
    border: 1px solid #000000;
    padding: 4px 8px;
    font-size: 12px;
    text-align: center;
    font-weight: 600;
}
.inv-t3-gst-breakup-table th {
    font-weight: 800;
    background: #f8fafc;
}

.inv-t3-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 16px;
    font-size: 12.5px;
    font-weight: 800;
}


/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES FOR EXACT 1-PAGE VECTOR A4 PRINT & PDF
   ═══════════════════════════════════════════════════════════════ */
@media print {
    @page {
        size: A4 portrait;
        margin: 0mm !important;
    }
    *, *:before, *:after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
    }
    html, body, .invoice-app-page, main, .studio-main-container, .studio-2col-layout, .studio-right-deck, .preview-deck-card, .pdk-canvas-viewport, .a4-scale-stage {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        position: static !important;
    }
    header, nav, footer, .builder-hero, .studio-left-deck, .pdk-header, .pdk-footer-bar, .toast-container, .hero-bg-shapes {
        display: none !important;
    }
    .a4-scale-stage {
        transform: none !important;
    }
    .a4-invoice-sheet {
        width: 210mm !important;
        height: 296mm !important;
        max-height: 296mm !important;
        min-height: 296mm !important;
        margin: 0 auto !important;
        padding: 8mm 10mm !important;
        background: #ffffff !important;
        box-shadow: none !important;
        border: none !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        overflow: hidden !important;
    }
    .inv-t1-container, .inv-t2-container, .inv-t3-container {
        min-height: 278mm !important;
        height: 278mm !important;
        max-height: 278mm !important;
        padding: 16px 20px !important;
    }
}
