/* Invoices page and its pop-ups, in the Sales page family (iv4, 13 Nov 2026).
   The page is .ord2.sl4.iv4: the orders and sales kits (pages-business.css)
   with the table kept. A money card (Still to collect, with Invoiced,
   Collected, Overdue and Not sent yet), a strip naming the invoice to chase
   first, status tabs, then the .lt table with a Next step column. The
   invoice, Mark as paid, New / Edit invoice and Send pop-ups are not inside
   .iv4, so their rules are not scoped to the page. Built in
   assets/js/app/invoices-receipts.js (_iv4* helpers). */

/* Pop-up header tile in the invoice colour (teal), as the page's cyan card. */
.modal.mdl-tone-teal {
    --mdl-glow: rgba(13, 148, 136, .11);
    --mdl-ico: #0f766e; --mdl-ico-bg1: #f0fdfa; --mdl-ico-bg2: #ccfbf1; --mdl-ico-ring: rgba(15, 118, 110, .18);
}

/* ---- The money card ---- */
.iv4 .iv4-stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.iv4 .iv4-stats .ord2-hero-fig { font-size: clamp(.98rem, 2.6vw, 1.12rem); overflow-wrap: anywhere; line-height: 1.2; }
.iv4 .iv4-stats small { display: block; margin-top: 2px; font-size: .72rem; font-weight: 700; color: rgba(255, 255, 255, .9); }

/* ---- The strip: the invoice to chase first ----
   Amber while money is owed (red-tinted once it is late), green when all is
   collected, teal when there is nothing yet. The buttons sit on their own row. */
.iv4 .iv4-strip { flex-wrap: wrap; align-items: flex-start; align-content: space-between; row-gap: 12px; }
.iv4 .iv4-strip > div:not(.iv4-strip-acts) { flex: 1 1 0; min-width: 0; }
.iv4 .iv4-strip b { line-height: 1.3; overflow-wrap: anywhere; }
.iv4 .iv4-strip > div > span { display: block; margin-top: 2px; line-height: 1.45; }
.iv4 .iv4-strip-acts { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.iv4 .ord2-strip .iv4-strip-acts button { flex: 1 1 auto; }
.iv4 .ord2-strip .iv4-strip-acts button.is-ghost { background: #fff; color: #78350f; border: 1px solid #fcd34d; }
.iv4 .iv4-strip.is-late { background: #fff7ed; border-color: #fdba74; }
.iv4 .iv4-strip.is-late .ord2-strip-ic { background: #ffedd5; color: #9a3412; }
.iv4 .iv4-strip.is-late b { color: #7c2d12; }
.iv4 .iv4-strip.is-late span { color: #9a3412; }
.iv4 .ord2-strip.is-late .iv4-strip-acts button:not(.is-ghost) { background: #9a3412; }
.iv4 .ord2-strip.is-late .iv4-strip-acts button.is-ghost { color: #7c2d12; border-color: #fdba74; }
.iv4 .iv4-strip.is-done { background: #ecfdf5; border-color: #a7f3d0; }
.iv4 .iv4-strip.is-done .ord2-strip-ic { background: #d1fae5; color: #047857; }
.iv4 .iv4-strip.is-done b { color: #064e3b; }
.iv4 .iv4-strip.is-done span { color: #065f46; }
.iv4 .ord2-strip.is-done .iv4-strip-acts button { background: #047857; }
.iv4 .ord2-strip.is-done .iv4-strip-acts button:focus-visible { outline-color: #6ee7b7; }
.iv4 .iv4-strip.is-start { background: #f0fdfa; border-color: #99f6e4; }
.iv4 .iv4-strip.is-start .ord2-strip-ic { background: #ccfbf1; color: #0f766e; }
.iv4 .iv4-strip.is-start b { color: #134e4a; }
.iv4 .iv4-strip.is-start span { color: #115e59; }
.iv4 .ord2-strip.is-start .iv4-strip-acts button { background: #0f766e; }
.iv4 .ord2-strip.is-start .iv4-strip-acts button.is-ghost { background: #fff; color: #134e4a; border: 1px solid #5eead4; }
.iv4 .ord2-strip.is-start .iv4-strip-acts button:focus-visible { outline-color: #5eead4; }

/* ---- The table ---- */
/* Where each invoice stands (also used in the invoice pop-up) */
.iv4-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 900; white-space: nowrap; }
.iv4-chip.is-paid { background: #d1fae5; color: #064e3b; }
.iv4-chip.is-unpaid { background: #fef3c7; color: #78350f; }
.iv4-chip.is-overdue { background: #fee2e2; color: #991b1b; }
.iv4-chip.is-pending { background: #dbeafe; color: #1e3a8a; }
.iv4-chip.is-failed { background: #ffe4e6; color: #9f1239; }
.iv4-chip.is-cancelled { background: #f3f4f6; color: #374151; }
/* Next step: Mark paid is green (sl4-pay), Send is blue, Check status is outlined. */
.iv4 .sl4-pay.iv4-go.is-send { background: linear-gradient(180deg, #3b82f6, #1d4ed8); }
.iv4 .sl4-pay.iv4-go.is-send:focus-visible { outline-color: #93c5fd; }
.iv4 .sl4-pay.iv4-go.is-check { background: #fff; color: #1e3a8a; border: 1.5px solid #93c5fd; }
.iv4 .sl4-pay.iv4-go.is-check:focus-visible { outline-color: #93c5fd; }
.iv4 .sl4-pay.iv4-go .btn-loading i { color: inherit; }
.iv4 .lt-sub .iv4-tag-draft { white-space: nowrap; }
.iv4 .sl4-sum { margin-bottom: 12px; }

/* ---- One invoice ---- */
.iv4-det .sl4-moneybox.iv4-mb { gap: 10px; }
.iv4-det .sl4-moneybox.is-late { border-color: #fca5a5; }
.iv4-det .sl4-moneybox.is-late .sl4-mb-top span:first-child { color: #991b1b; }
.iv4-det .sl4-moneybox .ord2-note { margin: 0; }
.iv4-det .ord2-note.is-wait { background: #fffbeb; color: #78350f; }
.iv4-det .ord2-cust-h > div { min-width: 0; }
.iv4-det .ord2-cust-h span { overflow-wrap: anywhere; }
.iv4-det .ord2-line > div { min-width: 0; }
.iv4-det .ord2-line div span { overflow-wrap: anywhere; }
.iv4-det .iv4-docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.iv4-small { margin: 0; font-size: .78rem; font-weight: 700; color: #4b5563; }
.iv4-det .rec-by { margin: 0; }
/* The footer stays two rows on a phone: the next step (Check payment beside
   Mark as paid while an online payment is pending), then Send, Edit, Delete. */
body .modal-overlay .modal-actions.ord2-det-acts > .iv4-acts-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px; width: 100%; }
body .modal-overlay .modal-actions.ord2-det-acts > .iv4-acts-top > * { width: 100%; min-height: 48px; margin: 0; }
body .modal-overlay .modal-actions.ord2-det-acts > .ord2-two.iv4-acts3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body .modal-overlay .modal-actions.ord2-det-acts > .iv4-acts3 .ord2-btn { padding: 0 8px; white-space: nowrap; }

/* ---- New invoice / Edit invoice (.fm4) ---- */
.iv4-form .iv4-opt { font-weight: 700; color: #4b5563; }
.iv4-form .fm4-rows[hidden] { display: none; }
.iv4-form .iv4-line-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.iv4-form .fm4-tag.iv4-typed { margin: 4px 0 0; }
.iv4-form .iv4-line-row { align-items: end; }
.iv4-form .iv4-line-row .fm4-step { align-self: stretch; }
/* Save tapped with a question unanswered (App._fm4Need): a red ring on that card. */
.iv4-form .fm4-card.is-need { border-color: #dc2626; box-shadow: 0 0 0 2px #dc2626; animation: fm4-need .32s ease; }
@media (prefers-reduced-motion: reduce) { .iv4-form .fm4-card.is-need { animation: none; } }

/* ---- Send invoice ---- */
.iv4-send .fm4-chosen .ord2-av { flex: none; }
.iv4-send .fm4-chosen span { overflow-wrap: anywhere; }
/* Phone and email one under the other on a phone, so a long email stays readable. */
@media (max-width: 559.98px) { .iv4-send .fm4-two.iv4-stack { grid-template-columns: minmax(0, 1fr); } }
body .modal-overlay .modal .modal-actions.iv4-send-acts {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: stretch;
}
@media (min-width: 560px) {
    body .modal-overlay .modal .modal-actions.iv4-send-acts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
body .modal-overlay .iv4-send-acts .iv4-way {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; margin: 0; padding: 0 10px;
    border-radius: 13px; border: 1.5px solid #d5dae4; background: #fff; color: #000;
    font: inherit; font-size: .88rem; font-weight: 900; text-decoration: none; white-space: nowrap; cursor: pointer;
}
body .modal-overlay .iv4-send-acts .iv4-way .btn-text { display: inline-flex; align-items: center; gap: 7px; }
body .modal-overlay .iv4-send-acts .iv4-way:hover { background: #f7f8fb; }
body .modal-overlay .iv4-send-acts .iv4-way:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
body .modal-overlay .iv4-send-acts .iv4-way.is-sms { border: 0; background: linear-gradient(180deg, #22c55e, #15803d); color: #fff; }
body .modal-overlay .iv4-send-acts .iv4-way.is-sms:focus-visible { outline-color: #86efac; }
body .modal-overlay .iv4-send-acts .iv4-way.is-wa { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
body .modal-overlay .iv4-send-acts .iv4-way:disabled { opacity: .6; cursor: progress; }
