/* Invoice document — screen preview & print base */
.billing-invoice-doc {
    position: relative;
    background: #fff;
    color: #111827;
    font-size: 11pt;
    line-height: 1.4;
    padding: 0;
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
}

.billing-invoice-doc[data-layout="a5"] {
    max-width: 148mm;
    font-size: 9.5pt;
}

.billing-invoice-doc__status-badge {
    position: absolute;
    top: 0;
    left: 0;
    padding: 0.35rem 1.25rem 0.35rem 0.65rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    letter-spacing: 0.06em;
    clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%);
    z-index: 2;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.billing-invoice-doc__status-badge--unpaid { background: #3577f1; }
.billing-invoice-doc__status-badge--overdue { background: #f06548; }
.billing-invoice-doc__status-badge--paid { background: #0ab39c; }

.billing-invoice-doc__logo {
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    display: block;
}

.billing-invoice-doc__company-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.2rem;
    line-height: 1.2;
}

.billing-invoice-doc__meta {
    font-size: 0.82rem;
    color: #374151;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

.billing-invoice-doc__doc-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0f172a;
    margin: 0 0 0.2rem;
}

.billing-invoice-doc__doc-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.15rem;
}

.billing-invoice-doc__copy-label {
    font-size: 0.78rem;
    color: #475569;
    margin: 0 0 0.5rem;
}

.billing-invoice-doc__amount-due {
    background: #3577f1;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.billing-invoice-doc__layout-table {
    width: 100%;
    border-collapse: collapse;
}

.billing-invoice-doc__layout-table td {
    vertical-align: top;
}

.billing-invoice-doc__title-block {
    text-align: right;
}

.billing-invoice-doc__dates {
    margin: 0 0 0 auto;
    font-size: 0.8rem;
    width: auto;
    border-collapse: separate;
    border-spacing: 1rem 0.2rem;
}

.billing-invoice-doc__dates td {
    padding: 0;
    vertical-align: baseline;
}

.billing-invoice-doc__dates-label {
    color: #374151;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    width: 1%;
}

.billing-invoice-doc__dates-gap {
    width: 1.25rem;
    min-width: 1.25rem;
    padding: 0;
    font-size: 0;
    line-height: 0;
}

.billing-invoice-doc__dates-value {
    font-weight: 600;
    color: #111827;
    text-align: right;
    white-space: nowrap;
}

.billing-invoice-doc__header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.billing-invoice-doc__addresses {
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.billing-invoice-doc__company .billing-invoice-doc__meta,
.billing-invoice-doc__addresses .billing-invoice-doc__meta {
    line-height: 1.2;
    margin: 0;
}

.billing-invoice-doc__section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1e293b;
    margin: 0 0 0.4rem;
}

.billing-invoice-doc__party-name {
    font-weight: 700;
    font-size: 0.92rem;
    margin: 0 0 0.15rem;
    line-height: 1.25;
    color: #0f172a;
}

.billing-invoice-doc__addresses p {
    color: #111827;
    font-size: 0.82rem;
    margin: 0;
    line-height: 1.2;
}

.billing-invoice-doc__items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.billing-invoice-doc__items thead th {
    background: #334155;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.35rem;
    border: 1px solid #1e293b;
    border-bottom: 2px solid #0f172a;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.billing-invoice-doc__items tbody td {
    padding: 0.5rem 0.4rem;
    border: 1px solid #cbd5e1;
    vertical-align: top;
    color: #111827;
}

.billing-invoice-doc__items .col-no { width: 28px; text-align: center; }
.billing-invoice-doc__items .col-qty-uom,
.billing-invoice-doc__items .col-qty-uom-cell { width: 72px; text-align: center; white-space: nowrap; }
.billing-invoice-doc__items .col-price,
.billing-invoice-doc__items .col-tax,
.billing-invoice-doc__items .col-disc,
.billing-invoice-doc__items .col-amt { text-align: right; white-space: nowrap; }

.billing-invoice-doc__items .item-name {
    display: block;
    font-weight: 700;
    color: #0f172a;
}

.billing-invoice-doc__items .item-desc {
    display: block;
    font-size: 0.75rem;
    color: #374151;
    margin-top: 0.1rem;
}

.billing-invoice-doc__items .tax-pct {
    display: block;
    font-size: 0.7rem;
    color: #475569;
    font-weight: 500;
}

.billing-invoice-doc__items td.num {
    text-align: center;
}

.billing-invoice-doc__items td.num.amount {
    text-align: right;
    font-weight: 600;
}

.billing-invoice-doc__items--gst .col-hsn { width: 56px; text-align: center; }
.billing-invoice-doc__items--gst .col-cgst,
.billing-invoice-doc__items--gst .col-sgst,
.billing-invoice-doc__items--gst .col-igst { text-align: right; white-space: nowrap; }

.billing-invoice-doc__items-total-row td {
    background: #f1f5f9;
    border-top: 2px solid #334155;
    font-size: 0.8rem;
}

.billing-invoice-doc__items-total-row td.num {
    text-align: right;
}

/* GST column widths — see billing-admin.css (.billing-line-items-table--gst) */

.billing-gst-client-panel .billing-gst-client-info {
    border-radius: 8px;
}

.billing-invoice-doc__bottom {
    margin-top: 0.5rem;
    align-items: flex-start;
}

.billing-invoice-doc__bank {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 1rem;
    font-size: 0.78rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.billing-invoice-doc__bank--side {
    margin-top: 0;
    margin-bottom: 1rem;
    max-width: 100%;
}

.billing-invoice-doc__bottom-left .billing-invoice-doc__bank-table {
    max-width: 100%;
}

.billing-invoice-doc__bank-table {
    width: 100%;
    max-width: 420px;
    font-size: 0.78rem;
}

.billing-invoice-doc__bank-table td {
    padding: 0.15rem 0;
    vertical-align: top;
    border: 0;
}

.billing-invoice-doc__bank-label {
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    padding-right: 0.5rem;
    width: 42%;
}

.billing-invoice-doc__bank-title,
.billing-invoice-doc__terms-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1e293b;
    margin: 0 0 0.35rem;
}

.billing-invoice-doc__bank p,
.billing-invoice-doc__terms p {
    margin: 0 0 0.2rem;
    font-size: 0.8rem;
    color: #111827;
}

.billing-invoice-doc__totals {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-bottom: 0.5rem;
}

.billing-invoice-doc__totals td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid #e2e8f0;
    color: #111827;
}

.billing-invoice-doc__totals td:first-child {
    font-weight: 600;
    color: #1e293b;
}

.billing-invoice-doc__totals td:last-child {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.billing-invoice-doc__totals .text-minus {
    color: #dc3545;
}

.billing-invoice-doc__totals .total-row td {
    background: rgba(10, 179, 156, 0.12);
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    border-top: 2px solid rgba(10, 179, 156, 0.35);
    padding: 0.45rem 0.4rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.billing-invoice-doc__totals .due-row td {
    font-weight: 700;
    color: #1d4ed8;
}

.billing-invoice-doc__words {
    font-size: 0.8rem;
    color: #374151;
    margin: 0.5rem 0 1rem;
    line-height: 1.4;
}

.billing-invoice-doc__words strong {
    color: #111827;
}

.billing-invoice-doc__signatures {
    text-align: right;
}

.billing-invoice-doc__signature {
    display: inline-block;
    min-width: 160px;
    margin-top: 0.5rem;
    text-align: center;
}

.billing-invoice-doc__signature-line {
    border-top: 1px solid #94a3b8;
    margin: 2.5rem 0 0.35rem;
}

.billing-invoice-doc__signature-img {
    max-width: 200px;
    max-height: 70px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.35rem;
}

.billing-invoice-doc__signature p {
    font-size: 0.75rem;
    color: #374151;
    font-weight: 500;
    margin: 0;
}

/* Preview wrapper (admin show page) */
.billing-invoice-preview__canvas .billing-invoice-doc {
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.1);
    padding: 2rem 2.25rem;
    min-height: 280mm;
}

.billing-invoice-preview__canvas .billing-invoice-doc[data-layout="a5"] {
    min-height: 200mm;
    padding: 1.25rem 1.5rem;
}

/* PDF: hide status ribbon (screen preview keeps it) */
.billing-invoice-doc--pdf .billing-invoice-doc__status-badge {
    display: none;
}
