/* Inventory > Stock and its pop-ups, in the Sales page family (inv4, 13 Nov 2026). Built in assets/js/app/reports.js. */
/* ==========================================================================
   The page is .ord2.sl4.inv4: the orders and sales kits (pages-business.css)
   with the table kept. A money card (Stock worth now, with Would sell for,
   In stock, Low and Out), a strip naming the one next step, the branch
   requests waiting for the owner, the All / Low / Out / In stock tabs, then
   the .lt table with a Next step column. The one-product pop-up (.inv4-det)
   and the Update stock pop-up (.fm4.inv4-stk) are not inside .inv4, so
   their rules are not scoped to the page. Branch staff see the same page
   (.inv4.inv4-staff) without the money columns.
   Primary text #000; secondary text no lighter than #4b5563.
   ========================================================================== */

/* ---- The Stock | Batches & expiry strip (App.invTabs, the .qt4-tabs look
   of pages-quotes.css). Two tabs, so a phone shares the width in two. ---- */
@media (max-width: 560px) {
    #page-content .qt4-tabs.inv4-tabs .qt4-tabs-in { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- The money card ---- */
.inv4 .inv4-hero { container: inv4hero / inline-size; }
.inv4 .inv4-stats {
    position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px; margin-top: 12px;
}
@container inv4hero (min-width: 620px) {
    .inv4 .inv4-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.inv4 .inv4-stat {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; margin: 0; padding: 9px 12px;
    border-radius: 14px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .12); color: #fff;
    font: inherit; text-align: left;
}
.inv4 button.inv4-stat { cursor: pointer; transition: background-color .15s ease; }
.inv4 button.inv4-stat:hover { background: rgba(255, 255, 255, .2); }
.inv4 .inv4-stat:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.inv4 .inv4-stat-l { max-width: 100%; font-size: .74rem; font-weight: 750; line-height: 1.25; color: rgba(255, 255, 255, .92); }
.inv4 .inv4-stat .inv4-fig {
    display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 1.1rem; font-weight: 900; line-height: 1.3; color: #fff; font-variant-numeric: tabular-nums;
}
.inv4 .inv4-stat .inv4-fig.sx-masked { letter-spacing: .1em; }
.inv4 .inv4-stat small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; font-weight: 700; color: rgba(255, 255, 255, .88); }
/* The count whose tab is open */
.inv4 .inv4-stat.is-on { background: #fff; border-color: #fff; }
.inv4 .inv4-stat.is-on .inv4-stat-l, .inv4 .inv4-stat.is-on small { color: #374151; }
.inv4 .inv4-stat.is-on .inv4-fig { color: #000; }
.inv4 .inv4-stat.is-out.is-on .inv4-fig { color: #b91c1c; }
.inv4 .inv4-stat.is-low.is-on .inv4-fig { color: #b45309; }
@media (prefers-reduced-motion: reduce) { .inv4 button.inv4-stat { transition: none; } }
.inv4 .inv4-hero-note {
    position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0;
    font-size: .78rem; font-weight: 700; line-height: 1.45; color: rgba(255, 255, 255, .95);
}
.inv4 .inv4-hero-note i { margin-top: 1px; }
.inv4 .inv4-units small { font-size: .5em; font-weight: 800; letter-spacing: 0; opacity: .92; }

/* ---- The strip: the one next step ----
   Amber for what is low or expires soon, red for what has expired or ran
   out, indigo while a branch (or the owner) is waiting, green when all is
   well, amber again for a first product. The buttons sit on their own row. */
.inv4 .inv4-strip { flex-wrap: wrap; align-items: flex-start; align-content: space-between; row-gap: 12px; }
.inv4 .inv4-strip > div:not(.inv4-strip-acts) { flex: 1 1 0; min-width: 0; }
.inv4 .inv4-strip b { line-height: 1.3; overflow-wrap: anywhere; }
.inv4 .inv4-strip > div > span { display: block; margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.inv4 .inv4-strip-acts { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.inv4 .ord2-strip .inv4-strip-acts button { flex: 1 1 auto; }
.inv4 .ord2-strip .inv4-strip-acts button.is-ghost { background: #fff; color: #78350f; border: 1px solid #fcd34d; }
.inv4 .inv4-strip.is-late { background: #fef2f2; border-color: #fecaca; }
.inv4 .inv4-strip.is-late .ord2-strip-ic { background: #fee2e2; color: #991b1b; }
.inv4 .inv4-strip.is-late b { color: #7f1d1d; }
.inv4 .inv4-strip.is-late span { color: #991b1b; }
.inv4 .ord2-strip.is-late .inv4-strip-acts button:not(.is-ghost) { background: #b91c1c; }
.inv4 .ord2-strip.is-late .inv4-strip-acts button.is-ghost { color: #7f1d1d; border-color: #fca5a5; }
.inv4 .ord2-strip.is-late .inv4-strip-acts button:focus-visible { outline-color: #fca5a5; }
.inv4 .inv4-strip.is-req { background: #eef2ff; border-color: #c7d2fe; }
.inv4 .inv4-strip.is-req .ord2-strip-ic { background: #e0e7ff; color: #3730a3; }
.inv4 .inv4-strip.is-req b { color: #1e1b4b; }
.inv4 .inv4-strip.is-req span { color: #3730a3; }
.inv4 .ord2-strip.is-req .inv4-strip-acts button { background: #4338ca; }
.inv4 .ord2-strip.is-req .inv4-strip-acts button:focus-visible { outline-color: #a5b4fc; }
.inv4 .inv4-strip.is-done { background: #ecfdf5; border-color: #a7f3d0; }
.inv4 .inv4-strip.is-done .ord2-strip-ic { background: #d1fae5; color: #047857; }
.inv4 .inv4-strip.is-done b { color: #064e3b; }
.inv4 .inv4-strip.is-done span { color: #065f46; }
.inv4 .ord2-strip.is-done .inv4-strip-acts button { background: #047857; }
.inv4 .ord2-strip.is-done .inv4-strip-acts button:focus-visible { outline-color: #6ee7b7; }

/* ---- Branch requests: waiting for the owner, answered, a branch's own ---- */
.inv4 .inv4-reqs { margin: 0 0 14px; padding: 12px; border-radius: 18px; background: #eef2ff; border: 1px solid #c7d2fe; }
.inv4 .inv4-reqs.is-mine { margin: 18px 0 0; background: #fff; border-color: #e3e7ef; }
.inv4 .inv4-cap {
    display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 0 2px;
    font-size: .76rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: #312e81;
}
.inv4 .inv4-reqs.is-mine .inv4-cap { color: #374151; }
.inv4 .inv4-cap em {
    min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; display: inline-grid; place-items: center;
    background: #4338ca; color: #fff; font-style: normal; font-size: .72rem; letter-spacing: 0;
}
.inv4 .inv4-reqs.is-mine .inv4-cap em { background: #eef1f6; color: #1f2937; }
.inv4 .inv4-req-list { display: flex; flex-direction: column; gap: 8px; }
.inv4 .inv4-req {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
    background: #fff; border: 1px solid #e0e7ff; cursor: pointer;
}
.inv4 .inv4-req:hover { border-color: #a5b4fc; }
.inv4 .inv4-req:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.inv4 .inv4-reqs.is-mine .inv4-req, .inv4 .inv4-hist .inv4-req { border-color: #e6e9f0; }
.inv4 .inv4-req .ord2-av { width: 40px; height: 40px; border-radius: 12px; }
.inv4 .inv4-req-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.inv4 .inv4-req-txt b { font-size: .94rem; font-weight: 900; color: #000; overflow-wrap: anywhere; }
.inv4 .inv4-req-txt span { font-size: .76rem; font-weight: 700; color: #4b5563; }
.inv4 .inv4-req-txt small {
    font-size: .8rem; font-weight: 700; color: #1f2937; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.inv4 .sl4-pay.inv4-review { flex: none; background: linear-gradient(180deg, #6366f1, #4338ca); }
.inv4 .sl4-pay.inv4-review:focus-visible { outline-color: #a5b4fc; }
.inv4-rchip { flex: none; display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 900; white-space: nowrap; }
.inv4-rchip.is-wait { background: #fef3c7; color: #78350f; }
.inv4-rchip.is-ok { background: #d1fae5; color: #064e3b; }
.inv4-rchip.is-no { background: #fee2e2; color: #991b1b; }
.inv4 .inv4-hist { margin-top: 18px; }
@media (max-width: 480px) {
    .inv4 .inv4-req { flex-wrap: wrap; }
    .inv4 .inv4-req-txt { flex: 1 1 calc(100% - 52px); }
    .inv4 .inv4-req > .sl4-pay, .inv4 .inv4-req > .inv4-rchip { margin-left: 52px; }
    .inv4 .inv4-req > .sl4-pay { flex: 1 1 auto; }
}

/* ---- The table ---- */
.inv4 #inventory-tools { scroll-margin-top: 84px; }
.inv4 .lt-sub { color: #4b5563; }
.inv4 .lt-sub .inv4-tag { white-space: nowrap; }
.inv4 .inv4-qty.is-out { color: #b91c1c; }
.inv4 .inv4-qty.is-low { color: #b45309; }
/* How much is left (also used in the product pop-up) */
.inv4-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 900; white-space: nowrap; }
.inv4-chip.is-out { background: #fee2e2; color: #991b1b; }
.inv4-chip.is-low { background: #fef3c7; color: #78350f; }
.inv4-chip.is-ok { background: #d1fae5; color: #064e3b; }
.inv4 .inv4-alert { display: block; margin-top: 3px; font-size: .72rem; font-weight: 800; color: #4b5563; white-space: nowrap; }
.inv4 .inv4-nocost { font-size: .78rem; font-weight: 700; color: #4b5563; white-space: nowrap; }
.inv4 .sl4-sum { margin-bottom: 12px; }
/* Buy more under a tapped row (and in the hover actions) on out and low rows */
.inv4 .sx-act.inv4-act-buy { background: #15803d; border-color: #15803d; color: #fff; }
.inv4 .sx-act.inv4-act-buy:hover { background: #166534; border-color: #166534; color: #fff; }

/* ---- One product (read first) ---- */
.inv4-det .ord2-note { margin: 0; }
.inv4-det .ord2-note.inv4-note-low { background: #fffbeb; color: #78350f; }
.inv4-det .inv4-now { gap: 10px; }
.inv4-det .inv4-now.is-out { border-color: #fecaca; }
.inv4-det .inv4-now.is-low { border-color: #fde68a; }
.inv4-now-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.inv4-now-top > div { min-width: 0; }
.inv4-now-top > div > span { display: block; font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #92400e; }
.inv4-now-top > div > b { display: block; font-size: 1.8rem; font-weight: 900; line-height: 1.15; color: #000; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.inv4-now.is-out .inv4-now-top > div > b { color: #b91c1c; }
.inv4-now.is-low .inv4-now-top > div > b { color: #b45309; }
.inv4-now-alert {
    display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 12px;
    background: #f7f8fb; font-size: .82rem; font-weight: 750; line-height: 1.4; color: #1f2937;
}
.inv4-now-alert i { margin-top: 1px; color: #92400e; }
.inv4-small { margin: 0; font-size: .8rem; font-weight: 700; line-height: 1.45; color: #4b5563; }
.inv4-sum { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.inv4-sum > span { min-width: 0; font-size: .88rem; font-weight: 800; color: #000; }
.inv4-sum small { display: block; margin-top: 1px; font-size: .76rem; font-weight: 700; line-height: 1.4; color: #4b5563; overflow-wrap: anywhere; }
.inv4-sum > b { flex: none; font-size: .98rem; font-weight: 900; color: #000; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv4-sum > b.inv4-nocost { font-size: .84rem; color: #4b5563; }
/* Batches of this product, with plain expiry words */
.inv4-bline { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid #eef0f5; }
.inv4-bsec h3 + .inv4-bline { padding-top: 0; border-top: 0; }
.inv4-bline > div { min-width: 0; }
.inv4-bline > div > b { display: block; font-size: .9rem; font-weight: 900; color: #000; overflow-wrap: anywhere; }
.inv4-bline > div > span { font-size: .78rem; font-weight: 700; color: #4b5563; }
.inv4-bwhen { flex: none; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 900; white-space: nowrap; background: #f3f4f6; color: #374151; }
.inv4-bline.is-expired .inv4-bwhen { background: #fee2e2; color: #991b1b; }
.inv4-bline.is-expiring .inv4-bwhen { background: #fef3c7; color: #78350f; }
.inv4-bline.is-ok .inv4-bwhen { background: #d1fae5; color: #064e3b; }
.inv4-det .inv4-blink { align-self: flex-start; min-height: 32px; }
/* Latest stock changes */
.inv4-det .inv4-chline > div { min-width: 0; }
.inv4-det .inv4-chline em { font-style: normal; font-weight: 700; color: #1f2937; }
.inv4-det .inv4-chline q {
    display: block; margin-top: 4px; padding: 6px 10px; border-radius: 10px; background: #f7f8fb; quotes: none;
    font-size: .8rem; font-weight: 700; color: #1f2937; overflow-wrap: anywhere;
}
.inv4-d { flex: none; font-size: .84rem; font-weight: 900; white-space: nowrap; color: #374151; }
.inv4-d.is-up { color: #047857; }
.inv4-d.is-down { color: #b91c1c; }
body .modal-overlay .modal-actions.ord2-det-acts > .ord2-two.inv4-acts2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body .modal-overlay .modal-actions.ord2-det-acts > .inv4-acts2 .ord2-btn { padding: 0 8px; white-space: nowrap; }
body .modal-overlay .modal-actions.ord2-det-acts > .ord2-go i { margin-right: 4px; }

/* ---- Update stock (.fm4) ---- */
.inv4-stk .inv4-stk-panel { display: flex; flex-direction: column; gap: 14px; }
.inv4-stk .inv4-stk-panel:empty, .inv4-stk #stock-var-section:empty { display: none; }
/* The stepper: the one number this pop-up asks for, so it is bigger. */
.inv4-stk .inv4-stk-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
body .modal-overlay .fm4.inv4-stk .inv4-step { border-radius: 14px; }
body .modal-overlay .fm4.inv4-stk .inv4-step button { width: 52px; height: 52px; font-size: 1.15rem; }
body .modal-overlay .modal .fm4.inv4-stk .inv4-step input.fm4-step-n { width: 104px; height: 52px; font-size: 1.35rem; }
.inv4-stk .inv4-stk-u { font-size: 1rem; font-weight: 900; color: #374151; }
.inv4-stk .inv4-chg { font-size: .86rem; font-weight: 800; color: #374151; }
.inv4-stk .inv4-chg.is-up { color: #047857; }
.inv4-stk .inv4-chg.is-down { color: #b91c1c; }
.inv4-stk .fm4-hint { margin: 0; }
body .modal-overlay .fm4.inv4-stk .inv4-stk-blink { display: block; margin-top: 4px; color: #78350f; }
/* Options (sizes, colours), each with its own count */
.inv4-stk .inv4-vars { display: flex; flex-direction: column; }
.inv4-stk .inv4-var {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0;
    border-top: 1px solid #eef0f5; font-size: .9rem; font-weight: 800; color: #000; cursor: pointer;
}
.inv4-stk .inv4-var:first-child { border-top: 0; padding-top: 0; }
.inv4-stk .inv4-var > span { min-width: 0; overflow-wrap: anywhere; }
body .modal-overlay .modal .fm4.inv4-stk .inv4-var .fm4-inp.fm4-inp { flex: none; width: 112px; height: 44px; text-align: center; }
