/**
 * Stylesheet for: pay.php
 * Luxury Client Invoice & Razorpay Checkout Portal
 * Ajay Kumar Thakur
 */

:root {
    --inv-primary: #123126;
    --inv-primary-dark: #0b1f18;
    --inv-primary-light: #1c4536;
    --inv-accent-gold: #c8a86b;
    --inv-accent-gold-light: #f7dfa5;
    --inv-accent-gold-dark: #8c7247;
    --inv-bg-sand: #fdfbf7;
    --inv-border-sand: #eee7da;
    --inv-text-main: #112821;
    --inv-text-muted: #5e6f7d;
    --inv-text-sub: #64748b;
    --inv-green-box: #eef8f3;
    --inv-green-amount: #0d5c3f;
    --inv-border-light: #e6eaf0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f1f4f8;
    background-image: radial-gradient(at 0% 0%, rgba(200, 168, 107, 0.08) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(18, 49, 38, 0.08) 0, transparent 50%);
    color: #1e293b;
    min-height: 100vh;
    padding: 40px 16px 60px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.invoice-wrapper {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

.invoice-card {
    background: #ffffff;
    width: 100%;
    border-radius: 26px;
    box-shadow: 0 25px 60px -15px rgba(18, 49, 38, 0.12), 0 0 1px 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    position: relative;
}

/* ========================================================
   TOP CURVED EMERALD HEADER
======================================================== */
.inv-header {
    position: relative;
    background: linear-gradient(135deg, #0e2921 0%, #173d30 55%, #0f271f 100%);
    padding: 34px 44px 72px 44px;
    color: #ffffff;
    overflow: hidden;
}

.inv-header::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 168, 107, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.inv-header::after {
    content: "";
    position: absolute;
    bottom: 20px;
    left: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.inv-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    flex-wrap: nowrap;
    gap: 24px;
}

.inv-header-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
}

.inv-brand-logo {
    height: 48px;
    max-width: 160px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.inv-header-divider {
    height: 42px;
    width: 1.5px;
    background: rgba(255, 255, 255, 0.22);
    margin: 0 18px;
    flex-shrink: 0;
}

.inv-header-brand-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.inv-brand-name {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #ffffff;
    line-height: 1.2;
    margin: 0;
    font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
    white-space: nowrap;
}

.inv-brand-tagline {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.3px;
    color: #a7c5b9;
    text-transform: uppercase;
    margin-top: 4px;
    margin-bottom: 0;
    line-height: 1.35;
    max-width: 380px;
}

.inv-header-right {
    margin-left: auto;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 0 0 auto;
}

.inv-header-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.8px;
    color: #9cbdb1;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
    text-align: right;
}

.inv-number-pill {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Space Grotesk', monospace;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    text-align: right;
}

.inv-status-wrapper {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 8px;
}

.inv-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 0;
}

.status-due {
    background: linear-gradient(135deg, #f7dca1 0%, #e6be6d 100%);
    color: #3b2806;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.status-paid {
    background: #dcfce7;
    color: #14532d;
    box-shadow: 0 4px 12px rgba(20, 83, 45, 0.15);
}

/* Organic bottom wave shape */
.inv-header-wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 52px;
    pointer-events: none;
    z-index: 1;
}

.inv-header-wave svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ========================================================
   INVOICE BODY CONTENT
======================================================== */
.invoice-body {
    padding: 28px 44px 38px 44px;
    background: #ffffff;
}

/* Title & Date Bar */
.inv-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 26px;
    flex-wrap: wrap;
    gap: 15px;
}

.inv-title-group .inv-main-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 38px;
    font-weight: 900;
    color: #112821;
    letter-spacing: -0.5px;
    line-height: 1;
    margin: 0 0 6px 0;
}

.inv-title-group .inv-subtitle {
    font-size: 14.5px;
    color: #64748b;
    margin: 0;
    font-weight: 400;
}

.inv-dates-meta {
    text-align: right;
    font-size: 14px;
    color: #64748b;
    line-height: 1.7;
}

.inv-dates-meta .meta-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.inv-dates-meta .meta-label {
    color: #64748b;
}

.inv-dates-meta .meta-val {
    color: #0f172a;
    font-weight: 700;
    min-width: 95px;
}

/* Two-Column Dates Card (Matches Mobile & Desktop Mockup) */
.inv-dates-card {
    background: #ffffff;
    border: 1px solid #e5e9eb;
    border-radius: 14px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.inv-date-col {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.inv-date-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fdf6ea;
    border: 1px solid #f9e7c8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #926b27;
    font-size: 19px;
    flex-shrink: 0;
}

.inv-date-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.inv-date-label {
    font-size: 11.5px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 2px;
    line-height: 1.2;
}

.inv-date-val {
    font-size: 15.5px;
    color: #0f172a;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.inv-date-divider {
    width: 1px;
    height: 38px;
    background: #e2e8f0;
    flex-shrink: 0;
}

/* ========================================================
   BILLING INFORMATION (FROM / TO)
======================================================== */
.inv-billing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.billing-card {
    background: #fdfbf7;
    border: 1px solid #faebd7;
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.card-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #8c7043;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.chip-icon {
    background: #f5e8d3;
    color: #8c7043;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.entity-name {
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
    line-height: 1.3;
}

.entity-desc {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.entity-role {
    font-size: 13.5px;
    color: #52605b;
    line-height: 1.4;
}

.entity-address {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 13.5px;
    color: #52605b;
    line-height: 1.4;
    margin-top: 4px;
}

.entity-address i {
    color: #64748b;
    font-size: 13px;
    margin-top: 3px;
    flex-shrink: 0;
}

.entity-divider {
    border-top: 1px solid #ebd9c2;
    margin: 14px 0 12px 0;
    width: 100%;
}

.entity-contact-list {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}

.contact-icon-bubble {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #d1fae5;
    color: #065f46;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    flex-shrink: 0;
}

.contact-link {
    color: #0f172a;
    text-decoration: none;
    word-break: break-all;
    font-size: 13.5px;
}

.contact-item a[href^="tel:"] {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 600;
}

.contact-item a[href^="mailto:"] {
    color: #0f172a;
    font-weight: 500;
}

/* ========================================================
   PROJECT SCOPE & DATES ROW
======================================================== */
.inv-scope-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 22px;
    margin-bottom: 24px;
    padding: 0 4px;
}

.scope-chip,
.dates-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #8c7247;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.scope-title {
    font-size: 15px;
    font-weight: 700;
    color: #112821;
    line-height: 1.35;
}

.scope-code {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

.scope-dates-list {
    font-size: 13.5px;
    color: #475569;
    line-height: 1.6;
}

.scope-dates-list .dt-row {
    display: flex;
    gap: 6px;
}

.scope-dates-list .dt-lbl {
    color: #64748b;
}

.scope-dates-list .dt-val {
    color: #0f172a;
    font-weight: 700;
}

/* ========================================================
   MILESTONES / LINE ITEMS TABLE
======================================================== */
.inv-table-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 22px;
}

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

.inv-table thead tr {
    background: #123126;
    color: #ffffff;
}

.inv-table th {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 13px 18px;
}

.inv-table th.col-num {
    width: 48px;
    text-align: center;
}

.inv-table th.col-desc {
    text-align: left;
}

.inv-table th.col-amt {
    width: 160px;
    text-align: right;
}

.inv-table tbody tr {
    background: #ffffff;
}

.inv-table tbody td {
    padding: 16px 18px;
    font-size: 14px;
    vertical-align: top;
    border-bottom: 1px solid #edf2f7;
}

.inv-table td.col-num {
    text-align: center;
    color: #64748b;
    font-weight: 600;
}

.inv-table td.col-desc .item-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.inv-table td.col-desc .item-sub {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.inv-table td.col-amt {
    text-align: right;
    font-weight: 600;
    color: #0f172a;
    font-size: 15px;
}

/* ========================================================
   TOTALS SUMMARY
======================================================== */
.inv-summary-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 7px;
    margin-bottom: 26px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    width: 280px;
    font-size: 14px;
    color: #475569;
}

.summary-line .sum-val {
    font-weight: 600;
    color: #0f172a;
}

.total-payable-card {
    background: #eef8f3;
    border-radius: 12px;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 330px;
    margin-top: 4px;
}

.total-payable-card .payable-label {
    font-size: 18px;
    font-weight: 800;
    color: #112821;
}

.total-payable-card .payable-amount {
    font-size: 26px;
    font-weight: 800;
    color: #0d5c3f;
    font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
}

/* ========================================================
   PAYMENT CALLOUT BOX (UNPAID / RAZORPAY)
======================================================== */
.inv-pay-box {
    background: #fdfbf7;
    border: 1.5px solid #ebd9bf;
    border-radius: 18px;
    padding: 24px 26px;
    margin-bottom: 26px;
    display: grid;
    grid-template-columns: 1fr 155px;
    gap: 22px;
    align-items: center;
}

.pay-box-left {
    display: flex;
    flex-direction: column;
}

.pay-header-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.pay-card-icon-box {
    background: linear-gradient(135deg, #f7dfa5 0%, #eac780 100%);
    width: 44px;
    height: 44px;
    border-radius: 11px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(184, 137, 43, 0.2);
    color: #3b2806;
    font-size: 20px;
}

.pay-header-info h3 {
    font-size: 18px;
    font-weight: 800;
    color: #112821;
    margin: 0 0 4px 0;
}

.pay-header-info p {
    font-size: 12.5px;
    color: #556760;
    margin: 0;
    line-height: 1.45;
}

.btn-razorpay-cta {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #132b23 0%, #1c3e32 100%);
    color: #ffffff;
    border: none;
    border-radius: 11px;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 8px 20px rgba(19, 43, 35, 0.28);
    transition: all 0.2s ease;
    margin-bottom: 14px;
}

.btn-razorpay-cta:hover {
    background: linear-gradient(135deg, #1a3c31 0%, #255343 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(19, 43, 35, 0.38);
}

.btn-razorpay-cta:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.pay-trust-badges {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    font-size: 12px;
    color: #556860;
    flex-wrap: wrap;
}

.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.trust-item i {
    color: #a07d3b;
    font-size: 12.5px;
}

/* Logos column */
.pay-box-right {
    border-left: 1px solid #ebd9bf;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo-upi-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.upi-logo-vector {
    height: 18px;
    width: auto;
}

.badge-gpay {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
    color: #3c4043;
}

.badge-phonepe {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13.5px;
    font-weight: 700;
    color: #5f259f;
}

.pe-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #5f259f;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.badge-paytm {
    display: inline-flex;
    align-items: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.paytm-pay {
    color: #002e6e;
}

.paytm-tm {
    color: #00b9f5;
}

.card-logos-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.card-chip-net {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    border: 1px solid #d0d7de;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
}

.net-visa {
    color: #1a1f71;
    font-style: italic;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.net-mc {
    display: inline-flex;
    align-items: center;
    gap: -4px;
    position: relative;
    width: 22px;
    height: 14px;
}

.mc-c1,
.mc-c2 {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    position: absolute;
}

.mc-c1 {
    background: #eb001b;
    left: 0;
}

.mc-c2 {
    background: #f79e1b;
    right: 0;
    opacity: 0.9;
}

.net-rupay {
    color: #183884;
    font-weight: 900;
    font-style: italic;
    font-size: 9px;
}

.net-rupay span {
    color: #008744;
}

/* ========================================================
   PAID BANNER (WHEN INVOICE IS COMPLETED)
======================================================== */
.paid-success-card {
    background: #ecfdf5;
    border: 1.5px solid #a7f3d0;
    border-radius: 16px;
    padding: 22px 24px;
    text-align: center;
    color: #065f46;
    margin-bottom: 24px;
}

.paid-success-card h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #065f46;
}

.paid-success-card p {
    font-size: 14px;
    margin-bottom: 6px;
}

.paid-success-card code {
    background: #d1fae5;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    color: #047857;
}

/* ========================================================
   FOOTER (SUPPORT & PRINT BUTTON)
======================================================== */
.inv-footer {
    padding: 20px 44px;
    background: #fafbfc;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-support {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #475569;
}

.footer-support-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eef2f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #112821;
    flex-shrink: 0;
}

.footer-support-text strong {
    color: #0f172a;
}

.btn-print {
    background: #ffffff;
    border: 1px solid #d0d7de;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #1f2328;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background 0.15s ease;
}

.btn-print:hover {
    background: #f6f8fa;
}

/* ========================================================
   RESPONSIVE DESIGN
======================================================== */
@media (max-width: 640px) {
    body {
        padding: 10px 6px;
    }

    .inv-header {
        padding: 20px 14px 44px 14px;
    }

    .inv-header-content {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .inv-header-left {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
    }

    .inv-brand-logo {
        height: 42px !important;
        max-width: 140px !important;
        object-fit: contain !important;
    }

    .inv-header-divider {
        display: block !important;
        height: 42px !important;
        width: 1.5px !important;
        background: rgba(255, 255, 255, 0.22) !important;
        margin: 0 8px !important;
        flex-shrink: 0 !important;
    }

    .inv-header-right {
        flex: 0 0 auto !important;
        width: auto !important;
        text-align: right !important;
        align-items: flex-end !important;
    }

    .inv-header-label {
        font-size: 11px !important;
        font-weight: 500 !important;
        letter-spacing: 0.2px !important;
        color: #bedcd0 !important;
        text-transform: capitalize !important;
        margin-bottom: 1px !important;
        text-align: right !important;
    }

    .inv-number-pill {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        font-size: 14.5px !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        font-family: inherit !important;
        letter-spacing: 0.3px !important;
        backdrop-filter: none !important;
        text-align: right !important;
    }

    .inv-status-wrapper {
        margin-top: 5px !important;
        justify-content: flex-end !important;
    }

    .inv-status-pill {
        padding: 5px 12px !important;
        font-size: 11px !important;
    }

    .invoice-body {
        padding: 20px 14px 28px 14px !important;
    }

    .inv-title-group .inv-main-title {
        font-size: 32px !important;
        margin: 0 0 3px 0 !important;
    }

    .inv-title-group .inv-subtitle {
        font-size: 13.5px !important;
        margin-bottom: 14px !important;
    }

    .inv-dates-card {
        padding: 10px 12px !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }

    .inv-date-icon-box {
        width: 38px !important;
        height: 38px !important;
        font-size: 16px !important;
        border-radius: 10px !important;
    }

    .inv-date-col {
        gap: 8px !important;
    }

    .inv-date-label {
        font-size: 10.5px !important;
    }

    .inv-date-val {
        font-size: 13.5px !important;
    }

    .billing-card {
        padding: 16px !important;
    }

    .entity-name {
        font-size: 18px !important;
    }

    .inv-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .inv-dates-meta {
        text-align: left;
    }

    .inv-dates-meta .meta-row {
        justify-content: flex-start;
    }

    .inv-billing-grid {
        grid-template-columns: 1fr;
    }

    .inv-scope-row {
        grid-template-columns: 1fr;
    }

    .inv-pay-box {
        grid-template-columns: 1fr;
    }

    .pay-box-right {
        border-left: none;
        border-top: 1px solid #ebd9bf;
        padding-left: 0;
        padding-top: 16px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .inv-footer {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
    }

    .inv-summary-wrap {
        align-items: stretch;
    }

    .summary-line,
    .total-payable-card {
        width: 100%;
    }
}

/* ========================================================
   PRINT STYLES FOR CRISP FULL-SIZE A4 PDF
======================================================== */
@page {
    size: A4 portrait;
    margin: 0;
}

@media print {

    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        box-sizing: border-box !important;
    }

    html,
    body {
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        background-image: none !important;
        display: block !important;
        color: #0f172a !important;
    }

    .invoice-wrapper {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .invoice-card {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 100vh !important;
    }

    /* Top Curved Header in Print - FULL EDGE-TO-EDGE WIDE SCREEN */
    .inv-header {
        width: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 38px 48px 65px 48px !important;
        background: #0e2921 !important;
        background: linear-gradient(135deg, #0e2921 0%, #173d30 55%, #0f271f 100%) !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .inv-header-content {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 24px !important;
    }

    .inv-header-left {
        display: flex !important;
        align-items: center !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .inv-header-left .inv-brand-logo {
        height: 48px !important;
        max-width: 160px !important;
    }

    .inv-header-divider {
        height: 44px !important;
        margin: 0 18px !important;
    }

    .inv-brand-name {
        font-size: 22px !important;
    }

    .inv-brand-tagline {
        font-size: 9.5px !important;
        letter-spacing: 1.4px !important;
        max-width: 380px !important;
    }

    .inv-header-right {
        margin-left: auto !important;
        text-align: right !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        flex: 0 0 auto !important;
    }

    .inv-header-label {
        font-size: 11px !important;
        letter-spacing: 1.8px !important;
        margin-bottom: 5px !important;
        display: block !important;
        text-align: right !important;
    }

    .inv-number-pill {
        padding: 4px 14px !important;
        font-size: 13.5px !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }

    .inv-status-wrapper {
        display: flex !important;
        justify-content: flex-end !important;
        margin-top: 8px !important;
    }

    .inv-status-pill {
        padding: 6px 14px !important;
        font-size: 11px !important;
    }

    .inv-header-wave {
        bottom: -1px !important;
        height: 48px !important;
        width: 100% !important;
    }

    /* Body in Print - FULL SIZE */
    .invoice-body {
        padding: 34px 48px 30px 48px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex: 1 0 auto !important;
    }

    .inv-title-row {
        margin-bottom: 24px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-end !important;
    }

    .inv-title-group .inv-main-title {
        font-size: 38px !important;
        margin-bottom: 4px !important;
        font-family: 'Playfair Display', Georgia, serif !important;
    }

    .inv-title-group .inv-subtitle {
        font-size: 14.5px !important;
    }

    .inv-dates-meta {
        font-size: 14px !important;
        line-height: 1.7 !important;
        text-align: right !important;
    }

    /* Billing info cards */
    .inv-billing-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 22px !important;
        margin-bottom: 24px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .billing-card {
        padding: 20px 22px !important;
        border-radius: 12px !important;
        border: 1px solid #eee7da !important;
        background: #fdfbf7 !important;
    }

    .card-chip {
        margin-bottom: 10px !important;
        font-size: 11px !important;
    }

    .entity-name {
        font-size: 16.5px !important;
        margin-bottom: 4px !important;
    }

    .entity-desc {
        font-size: 13.5px !important;
        line-height: 1.45 !important;
        margin-bottom: 12px !important;
    }

    .contact-item {
        font-size: 13px !important;
        margin-top: 4px !important;
    }

    /* Project Scope & Dates */
    .inv-scope-row {
        display: grid !important;
        grid-template-columns: 1.2fr 0.8fr !important;
        margin-bottom: 24px !important;
        gap: 22px !important;
        padding: 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .scope-chip,
    .dates-chip {
        margin-bottom: 6px !important;
        font-size: 11px !important;
    }

    .scope-title {
        font-size: 15px !important;
    }

    .scope-code {
        font-size: 13px !important;
    }

    .scope-dates-list {
        font-size: 13.5px !important;
        line-height: 1.6 !important;
    }

    /* Milestones Table */
    .inv-table-card {
        margin-bottom: 24px !important;
        border-radius: 10px !important;
        border: 1px solid #e2e8f0 !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .inv-table {
        width: 100% !important;
    }

    .inv-table th {
        padding: 13px 18px !important;
        font-size: 11px !important;
        background: #123126 !important;
        color: #ffffff !important;
    }

    .inv-table tbody td {
        padding: 16px 18px !important;
        font-size: 14px !important;
    }

    .inv-table td.col-desc .item-title {
        font-size: 14.5px !important;
        margin-bottom: 4px !important;
    }

    .inv-table td.col-desc .item-sub {
        font-size: 13px !important;
    }

    .inv-table td.col-amt {
        font-size: 15px !important;
        font-weight: 700 !important;
    }

    /* Summary & Totals */
    .inv-summary-wrap {
        margin-bottom: 28px !important;
        gap: 7px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .summary-line {
        font-size: 14px !important;
        width: 280px !important;
    }

    .total-payable-card {
        width: 330px !important;
        padding: 12px 22px !important;
        border-radius: 12px !important;
        background: #eef8f3 !important;
        margin-top: 4px !important;
    }

    .total-payable-card .payable-label {
        font-size: 18px !important;
    }

    .total-payable-card .payable-amount {
        font-size: 26px !important;
        color: #0d5c3f !important;
    }

    /* Hide Unpaid Payment Gateway Box & Action Buttons */
    .inv-pay-box,
    .btn-print,
    .paid-success-card,
    .alert {
        display: none !important;
    }

    /* Footer - Positioned gracefully at bottom */
    .inv-footer {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 22px 48px !important;
        border-top: 1px solid #e9ecef !important;
        background: #fafbfc !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-top: auto !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .footer-support {
        font-size: 13px !important;
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
    }

    .footer-support-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 15px !important;
    }
}