.invoiceOverlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: none;
    background: rgba(4,48,61,.78);
    backdrop-filter: blur(5px);
}

.invoiceOverlay.open {
    display: block;
}

.invoiceModal {
    width: min(1120px,100%);
    height: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto auto 1fr;
    background: #e9eef0;
}

.invoiceActionBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #fffaf5;
    border-bottom: 1px solid rgba(0,120,157,.14);
}

.invoiceActionBar > div:first-child {
    display: grid;
    gap: 2px;
}

.invoiceActionBar > div:first-child b {
    color: #00789d;
}

.invoiceActionBar > div:first-child span {
    color: #6b7280;
    font-size: 12px;
}

.invoiceActionButtons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.invoicePaymentEdit {
    border: 0;
    border-radius: 11px;
    padding: 13px 16px;
    background: #f6a30a;
    color: #171717;
    font-weight: 950;
}

.invoicePaymentEditor {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(190px, .8fr) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px 16px;
    background: #fff3d5;
    border-bottom: 1px solid rgba(0,120,157,.14);
}

.invoicePaymentEditor[hidden] {
    display: none;
}

.invoicePaymentEditor > div:first-child {
    display: grid;
    gap: 3px;
    align-self: center;
}

.invoicePaymentEditor > div:first-child b {
    color: #00789d;
}

.invoicePaymentEditor > div:first-child span,
.invoicePaymentEditor label > span {
    color: #6b7280;
    font-size: 10px;
    font-weight: 900;
}

.invoicePaymentEditor label {
    display: grid;
    gap: 5px;
}

.invoicePaymentEditor select,
.invoicePaymentEditor input {
    width: 100%;
    padding: 11px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
}

.invoicePaymentEditorActions {
    display: flex;
    gap: 7px;
}

#invoicePaymentNotice {
    grid-column: 1 / -1;
}

.invoiceWhatsApp {
    border: 0;
    border-radius: 11px;
    padding: 13px 16px;
    background: #25d366;
    color: #082e18;
    font-weight: 950;
}

.invoiceWhatsApp:disabled {
    opacity: .65;
    cursor: wait;
}

.invoiceClose {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #e9f4f6;
    color: #00789d;
    font-size: 25px;
    line-height: 1;
}

.invoiceViewport {
    overflow: auto;
    padding: 22px;
}

.invoiceLoading,
.invoiceError {
    width: min(420px,calc(100% - 30px));
    margin: 20vh auto 0;
    padding: 20px;
    border-radius: 16px;
    background: #fff;
    text-align: center;
}

.invoiceError {
    display: grid;
    gap: 10px;
}

.chantInvoicePaper {
    --invoice-teal: #00789d;
    --invoice-orange: #f6a30a;
    --invoice-cream: #ffe3c7;
    --invoice-ink: #11181c;
    width: min(930px,100%);
    margin: 0 auto 28px;
    overflow: hidden;
    background: #fffdf8;
    color: var(--invoice-ink);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(0,0,0,.18);
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
}

.invoiceHero {
    position: relative;
    min-height: 250px;
    overflow: hidden;
    padding: 38px 42px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: #fffdf8;
}

.invoiceBrandBlock {
    position: relative;
    z-index: 3;
}

.invoiceWordmark {
    color: var(--invoice-teal);
    font-family: "Arial Black",Impact,sans-serif;
    font-size: clamp(48px,7vw,78px);
    line-height: .78;
    letter-spacing: -.07em;
}

.invoiceWordmark span {
    color: var(--invoice-orange);
}

.invoiceTagline {
    display: inline-block;
    margin-top: 13px;
    padding: 7px 18px 8px;
    border-radius: 999px;
    background: var(--invoice-orange);
    color: #111;
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 17px;
    transform: rotate(-1deg);
}

.invoiceHeroPattern {
    position: absolute;
    right: -35px;
    top: -65px;
    width: 52%;
    height: 330px;
    overflow: hidden;
    background: var(--invoice-teal);
    border-radius: 0 0 0 120px;
}

.invoiceHeroPattern::before,
.invoiceHeroPattern::after,
.invoiceHeroPattern i {
    content: "";
    position: absolute;
    display: block;
    background: var(--invoice-orange);
    border-radius: 999px 999px 999px 100px;
    transform: rotate(28deg);
}

.invoiceHeroPattern::before {
    width: 250px;
    height: 95px;
    right: -40px;
    top: 28px;
}

.invoiceHeroPattern::after {
    width: 210px;
    height: 80px;
    left: 35px;
    bottom: 42px;
}

.invoiceHeroPattern i:nth-child(1) {
    width: 110px;
    height: 58px;
    left: -16px;
    top: 44px;
}

.invoiceHeroPattern i:nth-child(2) {
    width: 84px;
    height: 56px;
    right: 72px;
    bottom: 14px;
}

.invoiceHeroPattern i:nth-child(3) {
    width: 55px;
    height: 55px;
    left: 120px;
    top: 148px;
}

.invoiceHeroCopy {
    position: relative;
    z-index: 3;
    width: 260px;
    margin-top: 26px;
    color: white;
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 22px;
    line-height: 1.08;
    text-align: center;
    letter-spacing: .02em;
}

.invoiceOrderBand {
    display: grid;
    grid-template-columns: 1.35fr repeat(3,1fr);
    gap: 0;
    margin: 0 38px;
    padding: 22px 0;
    border-top: 1px solid #b9c5ca;
    border-bottom: 1px solid #b9c5ca;
}

.invoiceOrderNumber {
    display: grid;
    gap: 2px;
    padding-right: 20px;
}

.invoiceOrderNumber small,
.invoiceQuickFact small {
    color: #6d777d;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .1em;
}

.invoiceOrderNumber strong {
    color: #111;
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 42px;
    line-height: 1;
}

.invoiceOrderNumber span {
    margin-top: 4px;
    font-size: 12px;
}

.invoiceQuickFact {
    display: grid;
    align-content: center;
    gap: 5px;
    min-width: 0;
    padding: 0 17px;
    border-left: 1px solid #c7cfd3;
}

.invoiceQuickFact b {
    color: #111;
    font-size: 15px;
    line-height: 1.12;
}

.invoiceInfoGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 20px 38px;
}

.invoiceInfoCard {
    padding: 18px;
    border: 1px solid #e2d7c9;
    border-radius: 16px;
    background: rgba(255,250,243,.8);
}

.invoiceSectionTitle {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 13px;
    color: var(--invoice-teal);
    font-family: "Arial Black",Impact,sans-serif;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.invoiceSectionTitle span {
    min-width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--invoice-teal);
    color: white;
    font-size: 10px;
}

.invoiceInfoCard dl {
    display: grid;
    grid-template-columns: 105px 1fr;
    gap: 8px 12px;
    margin: 0;
    font-size: 13px;
}

.invoiceInfoCard dt {
    font-weight: 850;
}

.invoiceInfoCard dd {
    margin: 0;
}

.invoiceMessageCard {
    position: relative;
    min-height: 170px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    background: linear-gradient(135deg,#f4f7f6,#fff7e9);
}

.invoiceMessageCard p {
    position: relative;
    z-index: 2;
    margin: 0;
    color: var(--invoice-teal);
    font-size: 17px;
    text-align: right;
}

.invoiceMessageMark {
    position: absolute;
    left: 18px;
    top: 14px;
    color: rgba(246,163,10,.15);
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 37px;
    line-height: .84;
    transform: rotate(-8deg);
}

.invoiceTableWrap {
    margin: 0 38px;
    overflow: hidden;
    border: 1px solid #dfd8cf;
    border-radius: 15px;
}

.invoiceTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.invoiceTable th {
    padding: 13px 12px;
    background: var(--invoice-teal);
    color: white;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    text-align: left;
}

.invoiceTable td {
    padding: 13px 12px;
    border-bottom: 1px solid #e8e3dc;
    vertical-align: top;
}

.invoiceTable tr:last-child td {
    border-bottom: 0;
}

.invoiceQty {
    width: 60px;
    text-align: center;
    font-size: 17px;
    font-weight: 900;
}

.invoiceDetails {
    color: #414d53;
}

.invoiceDetails small,
.invoiceMuted {
    color: #7b8489;
}

.invoiceBottomGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 20px 38px;
}

.invoiceNote,
.invoiceThanksMini,
.invoiceTotals {
    min-height: 145px;
    padding: 18px;
    border: 1px solid #e2d7c9;
    border-radius: 16px;
}

.invoiceNote {
    background: #f7faf9;
}

.invoiceNote p {
    margin: 0;
    white-space: pre-wrap;
}

.invoiceThanksMini {
    display: grid;
    align-content: center;
    gap: 7px;
    color: rgba(246,163,10,.68);
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 28px;
    transform: rotate(-3deg);
}

.invoiceThanksMini span {
    color: #728087;
    font-family: inherit;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.invoiceTotals {
    display: grid;
    align-content: center;
    gap: 9px;
    background: #fffaf2;
}

.invoiceTotals > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.invoiceGrandTotal {
    margin: 7px -7px -7px;
    padding: 13px 14px;
    align-items: center;
    border-radius: 12px;
    background: var(--invoice-orange);
}

.invoiceGrandTotal span {
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 18px;
}

.invoiceGrandTotal strong {
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 28px;
}

.invoiceThankYou {
    display: grid;
    justify-items: center;
    gap: 4px;
    margin: 28px 38px 20px;
    text-align: center;
}

.invoiceThankYou strong {
    color: var(--invoice-teal);
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 25px;
    letter-spacing: .03em;
}

.invoiceThankYou span {
    font-size: 9px;
    letter-spacing: .28em;
}

.invoiceFooter {
    position: relative;
    min-height: 165px;
    display: grid;
    grid-template-columns: 1.2fr 1fr .8fr;
    gap: 20px;
    align-items: start;
    padding: 20px 38px 72px;
    border-top: 1px solid #d9d4cd;
}

.invoiceFooter > div:not(.invoiceFooterPattern) {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 4px;
    font-size: 12px;
}

.invoiceFooter span {
    color: #66747b;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.invoiceMenuBadge {
    text-align: right;
}

.invoiceFooterPattern {
    position: absolute;
    inset: auto 0 0;
    height: 58px;
    background:
        linear-gradient(165deg, transparent 0 18%, #00789d 18% 42%, transparent 42% 50%, #f6a30a 50% 75%, transparent 75%),
        linear-gradient(15deg, #f6a30a 0 22%, #00789d 22% 48%, #f6a30a 48% 72%, #00789d 72%);
    background-size: 170px 58px, 250px 58px;
}

.publicInvoicePage {
    min-height: 100vh;
    padding: 20px;
    background: #e9eef0;
}

.publicInvoiceTop {
    width: min(930px,100%);
    margin: 0 auto 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(0,120,157,.12);
    border-radius: 14px;
    background: #fffaf5;
}

.publicInvoiceTop > div {
    display: grid;
    gap: 2px;
}

.publicInvoiceTop b {
    color: #00789d;
}

.publicInvoiceTop span {
    color: #6b7280;
    font-size: 12px;
}

.publicInvoiceViewport {
    width: 100%;
}

.publicInvoiceLoading,
.publicInvoiceError {
    width: min(520px,100%);
    margin: 18vh auto 0;
    padding: 26px;
    border-radius: 20px;
    background: #fffaf5;
    text-align: center;
}

.publicInvoiceError h1 {
    margin: 10px 0 6px;
    color: #00789d;
}

.publicInvoiceError p {
    color: #6b7280;
}

.publicInvoiceError span {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f6a30a;
    color: #111;
    font-weight: 900;
}

.invoicePublicBrand {
    color: #00789d;
    font-family: "Arial Black",Impact,sans-serif;
    font-size: 34px;
}

@media (max-width:760px) {
    .invoicePaymentEditor {
        grid-template-columns: 1fr;
    }

    .invoicePaymentEditorActions {
        flex-direction: column;
    }

    .invoiceActionButtons .invoicePaymentEdit {
        flex: 1;
        min-width: 140px;
    }

    .invoiceViewport {
        padding: 10px;
    }

    .publicInvoicePage {
        padding: 8px;
    }

    .publicInvoiceTop {
        align-items: stretch;
        flex-direction: column;
    }

    .publicInvoiceTop button {
        width: 100%;
    }

    .invoiceActionBar {
        align-items: flex-start;
        flex-direction: column;
    }

    .invoiceActionButtons {
        width: 100%;
        flex-wrap: wrap;
    }

    .invoiceActionButtons .blue,
    .invoiceActionButtons .dark,
    .invoiceActionButtons .invoiceWhatsApp {
        flex: 1;
        min-width: 140px;
    }

    .chantInvoicePaper {
        border-radius: 15px;
    }

    .invoiceHero {
        min-height: 200px;
        padding: 27px 22px;
    }

    .invoiceHeroPattern {
        width: 60%;
        height: 240px;
    }

    .invoiceHeroCopy {
        width: 150px;
        margin-top: 20px;
        font-size: 14px;
    }

    .invoiceWordmark {
        font-size: 48px;
    }

    .invoiceTagline {
        font-size: 12px;
    }

    .invoiceOrderBand {
        grid-template-columns: 1fr 1fr;
        margin: 0 18px;
    }

    .invoiceOrderNumber {
        grid-column: 1 / -1;
        padding: 0 0 14px;
    }

    .invoiceQuickFact {
        padding: 10px 8px;
        border-left: 0;
        border-top: 1px solid #d6dadd;
    }

    .invoiceQuickFact:nth-of-type(3) {
        grid-column: 1 / -1;
    }

    .invoiceInfoGrid,
    .invoiceBottomGrid {
        grid-template-columns: 1fr;
        margin-left: 18px;
        margin-right: 18px;
    }

    .invoiceTableWrap {
        margin-left: 18px;
        margin-right: 18px;
        overflow-x: auto;
    }

    .invoiceTable {
        min-width: 680px;
    }

    .invoiceThankYou {
        margin-left: 18px;
        margin-right: 18px;
    }

    .invoiceFooter {
        grid-template-columns: 1fr;
        padding-left: 20px;
        padding-right: 20px;
        padding-bottom: 82px;
    }

    .invoiceMenuBadge {
        text-align: left;
    }
}

@media print {
    .invoiceOverlay,
    .invoiceActionBar {
        display: none !important;
    }

    .chantInvoicePaper {
        box-shadow: none;
    }
}