/* ASA OS Inventory (migration 082): stock, open items, receiving, returns, cores, credits, transfers, quick count, the
 * job's Parts panel and the stock marks in the estimate picker. Built only from shop.css tokens and components. */

.inv-skel { height: 320px; border-radius: var(--r-l); }
.inv-store { min-height: 36px; border-radius: 999px; padding: 0 14px; background: var(--surface); }
.inv-tabs { margin: -8px -8px 22px; border-bottom: 1px solid var(--hair); }
.inv-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 600; }
.inv-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.inv-strip div.today-stat { cursor: default; }
.inv-searchform { flex: 1; min-width: 240px; max-width: 560px; }
.inv-search { width: 100%; min-height: 40px; border-radius: 999px; padding: 0 16px; background: var(--surface); border: 1px solid var(--hair-strong); }
.inv-msg:empty { display: none; }
.inv-warn { color: var(--red); font-size: 14px; margin: 8px 0; }
.inv-note { color: var(--ink-2); font-size: 14px; margin: 8px 0; }
.inv-sec { margin: 0 0 24px; }
.inv-sec > h2 { font-size: 17px; margin: 0 0 10px; }

/* pills */
.inv-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 3px 9px 3px 8px; border-radius: 999px; background: var(--fill); color: var(--ink);
  white-space: nowrap; }
.inv-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.inv-pill.is-ok { background: var(--green-soft); } .inv-pill.is-ok::before { background: var(--green); }
.inv-pill.is-low { background: var(--amber-soft); } .inv-pill.is-low::before { background: var(--amber); }
.inv-pill.is-out { background: var(--red-soft); } .inv-pill.is-out::before { background: var(--red); }
.inv-pill.is-done { background: var(--accent-soft); } .inv-pill.is-done::before { background: var(--accent); }
.inv-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* lists and rows */
.inv-list, .inv-card { background: var(--surface); border-radius: var(--r-l); box-shadow: 0 0 0 .5px var(--hair); overflow: hidden; }
.inv-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 92px 92px 170px; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--hair); color: var(--ink); }
.inv-row:last-child { border-bottom: 0; }
a.inv-row:hover { background: var(--surface-2); text-decoration: none; }
.inv-row-job { grid-template-columns: minmax(0, 1fr) 92px; }
.inv-list > .inv-row:not(.inv-row-job):has(> .inv-pill) { grid-template-columns: minmax(0, 1fr) auto; }
.inv-row-main { min-width: 0; }
.inv-row-t { font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
.inv-row-s { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.inv-num { display: flex; flex-direction: column; align-items: flex-end; }
.inv-num-v { font: 600 16px/1.2 var(--font-display); letter-spacing: -0.01em; }
.inv-num-v.is-none { color: var(--ink-3); font-weight: 400; }
.inv-num-l { font-size: 11.5px; color: var(--ink-2); text-align: right; }
.inv-row-st { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.inv-row-mm { font-size: 12px; color: var(--ink-3); }

/* product page */
.inv-head .job-facts { gap: 18px 26px; }
.inv-head .inv-msg { padding-bottom: 12px; }
.inv-hist { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-l); box-shadow: 0 0 0 .5px var(--hair); }
.inv-hist li { padding: 12px 18px; border-bottom: 1px solid var(--hair); }
.inv-hist li:last-child { border-bottom: 0; }
.inv-hist-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.inv-hist-k { font-weight: 600; }
.inv-hist-q { font: 600 15px/1 var(--font-display); }
.inv-hist-q.is-in { color: var(--green); } .inv-hist-q.is-out { color: var(--red); }
.inv-hist-after { font-size: 13px; color: var(--ink-2); }
.inv-hist-s { font-size: 13.5px; margin-top: 3px; }
.inv-hist-by { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* open items */
.inv-open { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--hair); }
.inv-open:last-child { border-bottom: 0; }
.inv-open-k { font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.inv-open.is-short_credit .inv-open-k, .inv-open.is-transfer_missing .inv-open-k, .inv-open.is-statement_difference .inv-open-k { color: var(--red); }
.inv-open-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.inv-owner { color: var(--ink); font-weight: 500; }
.inv-owner-l { color: var(--ink-2); font-weight: 400; }
.inv-open-amt { display: flex; flex-direction: column; align-items: flex-end; }
.inv-open-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.inv-open > .inv-msg { grid-column: 1 / -1; }

/* cards (orders, returns, cores, credits, transfers) */
.inv-cards { display: flex; flex-direction: column; gap: 12px; }
.inv-card { padding: 16px 18px; overflow: visible; }
.inv-card.is-short { box-shadow: 0 0 0 1.5px var(--red); }
.inv-card + .inv-card { margin-top: 0; }
section.inv-card { margin-bottom: 0; }
.inv-card > h2 { font-size: 16px; }
.inv-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.inv-lines { display: flex; flex-direction: column; }
.inv-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--hair); }
.inv-line-pad { padding: 10px 18px; }
.inv-line-t { font-weight: 500; }
.inv-money { display: flex; gap: 6px 22px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); margin: 6px 0; }
.inv-money strong { color: var(--ink); font-weight: 600; }
.inv-money .is-open strong { color: var(--red); }

/* receive, order, apply */
.inv-recv { padding: 14px 0; border-top: 1px solid var(--hair); }
.inv-recv-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.inv-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.inv-field { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; min-width: 0; }
.inv-field-l { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.inv-field-h { font-size: 12px; color: var(--ink-3); }
.inv-field-h button { min-height: 0; padding: 2px 0; font-size: 12.5px; background: transparent; color: var(--accent); }
.inv-field input, .inv-field select { width: 100%; min-height: 40px; }
.inv-qty { max-width: 110px; }
.inv-orderlines { display: flex; flex-direction: column; gap: 4px; }
.inv-orderline { display: grid; grid-template-columns: minmax(0, 2.2fr) 90px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.inv-orderline:only-child { grid-template-columns: minmax(0, 2.2fr) 90px minmax(0, 1fr) minmax(0, 1fr); }
.inv-apply { display: flex; flex-direction: column; }
.inv-apply-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.inv-apply-row button { min-height: 0; padding: 2px 0; font-size: 12.5px; background: transparent; color: var(--accent); }
.inv-sheet-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* sheet */
.inv-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.32); display: grid; place-items: center; padding: 20px; }
.inv-sheet { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-pop); }
.inv-sheet-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--hair); }
.inv-sheet-head h2 { margin: 0; font-size: 17px; }
.inv-sheet-body { padding: 14px 20px 20px; }
.inv-sheet-body h3 { margin: 16px 0 4px; }

/* quick count (phone first) */
.inv-count { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.inv-count-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface); border-radius: var(--r-l); box-shadow: 0 0 0 .5px var(--hair); padding: 14px 16px; }
.inv-count-main { min-width: 0; }
.inv-count-why { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--amber); }
.inv-count-q { display: flex; align-items: center; gap: 6px; flex: none; }
.inv-count-q > span { min-width: 22px; font-size: 13px; color: var(--ink-2); }
.inv-count-in { width: 104px; min-height: 52px; font: 600 22px/1 var(--font-display); text-align: center; border-radius: var(--r-m); }
.inv-count-save { min-height: 48px; padding: 0 28px; font-size: 16px; }

/* job Parts panel */
.inv-jp-line { padding: 10px 0; border-top: 1px solid var(--hair); }
.inv-jp-line:first-of-type { border-top: 0; }
.inv-jp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.inv-jp-top .inv-pill { font-size: 11.5px; padding: 2px 8px 2px 7px; }
.inv-jp-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.inv-jp-acts select { flex: 1 1 100%; min-height: 36px; }
.inv-jp-acts .inv-qty { width: 76px; min-height: 36px; }
.inv-jp-acts button, .inv-jp-acts .btn { min-height: 34px; font-size: 13px; }
.inv-jp .cp-fine { margin-top: 10px; }

/* estimate picker */
.inv-stockmark { font-size: 11.5px; padding: 1px 8px 1px 7px; vertical-align: middle; }

@media (max-width: 1100px) {
  .inv-row { grid-template-columns: minmax(0, 1fr) 80px 80px 80px 140px; }
}
@media (max-width: 860px) {
  .inv-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-searchform { min-width: 0; max-width: none; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .inv-tabs { margin: -4px -16px 16px; padding: 0 8px; }
  .inv-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; padding: 12px 16px; }
  .inv-row > .inv-row-main { grid-column: 1 / -1; }
  .inv-row > .inv-row-st { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .inv-row .inv-num { align-items: flex-start; }
  .inv-row .inv-num-l { text-align: left; }
  .inv-row-job, .inv-list > .inv-row:not(.inv-row-job):has(> .inv-pill) { grid-template-columns: minmax(0, 1fr) auto; }
  .inv-row-job > .inv-row-main, .inv-list > .inv-row:has(> .inv-pill) > .inv-row-main { grid-column: auto; }
  .inv-open { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; }
  .inv-open-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .inv-grid3 { grid-template-columns: 1fr; gap: 0; }
  .inv-orderline, .inv-orderline:only-child { grid-template-columns: minmax(0, 1fr) 90px; }
  .inv-orderline > :first-child { grid-column: 1 / -1; }
  .inv-apply-row { grid-template-columns: minmax(0, 1fr) 110px; }
  .inv-overlay { place-items: end stretch; padding: 0; }
  .inv-sheet { width: 100%; max-height: 92vh; border-radius: var(--r-l) var(--r-l) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .inv-card { padding: 14px 16px; }
  .inv-head .job-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .inv-head .job-side { align-items: flex-start; }
  .inv-count-card { padding: 12px 14px; }
  .inv-sheet-acts { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0 4px; }
  .inv-sheet-acts > button, .inv-sec > .inv-sheet-acts > button { flex: 1; min-height: 46px; }
}
.inv-more { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px 0; }
.inv-older { margin-top: 10px; }

/* FIN-18 A1 (147): parts cost evidence (cost-evidence.js) on the job's Parts panel and in Reports › Cost checks */
.ce-job { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--hair); }
.ce-cur { color: var(--ink-2); }
.ce-sub { margin-top: 14px; }
.ce-sub h4 { margin: 0 0 6px; font-size: 14px; }
.ce-flags, .ce-hist, .ce-trace, .ce-flags-inline, .ce-rules { list-style: none; margin: 6px 0 0; padding: 0; }
.ce-flag { padding: 10px 0; border-top: 1px solid var(--hair); }
.ce-flag:first-child { border-top: 0; }
.ce-flag-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ce-amt { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ce-flag-d { margin: 4px 0; color: var(--ink); overflow-wrap: anywhere; }
.ce-details { margin-top: 4px; }
.ce-details > summary { cursor: pointer; color: var(--ink-2); font-size: 14px; padding: 4px 0; }
.ce-trace li, .ce-hist li { margin: 4px 0 4px 4px; padding: 2px 0 2px 12px; border-left: 2px solid var(--hair); overflow-wrap: anywhere; }
.ce-flags-inline li { margin: 2px 0; }
.ce-opts { display: grid; gap: 8px; margin: 4px 0 10px; }
.ce-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--hair); border-radius: var(--r-l); }
.ce-opt input { margin-top: 3px; }
.ce-kinds { flex-wrap: wrap; margin: 10px 0 4px; max-width: 100%; box-sizing: border-box; }
.shop-on .ce-kinds button { white-space: normal; text-align: left; height: auto; }   /* a long kind label wraps at phone width (A2 walk) */
.ce-rules li { margin: 4px 0; color: var(--ink-2); }
/* FIN-18 B (162): corrections of a closed invoice's internal costs */
.ce-closed { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: var(--r-l); background: var(--fill); overflow-wrap: anywhere; }
.ce-closed p { margin: 0 0 4px; }
.ce-gated em { color: var(--ink-2); font-style: normal; }
.ce-corr { overflow-wrap: anywhere; }
.ce-corr .cp-fine { margin: 4px 0 0; }
.ce-effect { margin: 6px 0 10px; }
.ce-cases { border: 0; margin: 6px 0; padding: 0; display: grid; gap: 8px; }
.ce-cases legend { padding: 0 0 4px; font-size: 14px; color: var(--ink-2); }
.ce-corr-card { padding-top: 10px; border-top: 1px solid var(--hair); }
.ce-corr-card h3 { margin: 0 0 6px; font-size: 15px; }
/* FIN-18 A2 (156): reconciliation cases on Reports › Cost checks and the case sheet */
.rcase-flag-case { margin: 6px 0 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rcase-cases, .rcase-evs, .rcase-ats { list-style: none; margin: 8px 0 0; padding: 0; }
.rcase-case { border-top: 1px solid var(--hair); }
.rcase-case:first-child { border-top: 0; }
.rcase-case-link { display: grid; gap: 3px; padding: 10px 0; color: inherit; text-decoration: none; }
.rcase-case-link:hover .rcase-case-top strong, .rcase-case-link:focus-visible .rcase-case-top strong { text-decoration: underline; }
.rcase-case-top, .rcase-meta, .rcase-ev-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rcase-case-top strong { overflow-wrap: anywhere; }
.rcase-run { justify-content: flex-start; }
.rcase-head { display: grid; gap: 6px; margin-bottom: 10px; }
.rcase-title { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.rcase-meta { margin: 0; }
.rcase-why p { margin: 0 0 6px; }
.rcase-why p:last-child { margin: 0; }
.rcase-acts { justify-content: flex-start; flex-wrap: wrap; }
.rcase-forms { display: grid; gap: 4px; margin-top: 8px; }
.rcase-form .inv-sheet-acts { margin-top: 8px; }
.rcase-ev, .rcase-at { display: grid; gap: 3px; padding: 8px 0; border-top: 1px solid var(--hair); }
.rcase-ev:first-child, .rcase-at:first-child { border-top: 0; }
.rcase-ev.is-withdrawn .rcase-ev-l { text-decoration: line-through; color: var(--ink-2); }
.rcase-ev-l { overflow-wrap: anywhere; }
.rcase-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.rcase-check { font-size: 12.5px; padding: 2px 8px; border-radius: 999px; background: var(--fill); }
.rcase-check.is-ok { background: var(--green-soft); }
.rcase-check.is-no { background: var(--red-soft); }
.rcase-body { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--fill); border-radius: var(--r-m, 10px); padding: 10px 12px; margin: 6px 0; max-width: 100%; }
@media (max-width: 640px) { .rcase-acts > button { flex: 1 1 auto; } }

/* G3: value on a date */
.inv-valdate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.inv-valdate-l { font-weight: 500; color: var(--ink); }
.inv-valout { flex-basis: 100%; }

/* 174: customer core charges on the job */
.inv-cores:empty { display: none; }
.inv-cores { margin: 12px 0; }
.inv-h3 { font-size: 14px; margin: 6px 0; }
/* Gross profit per labor hour (Reports › Profit per hour): the sum, line by line */
.lp-math { display: grid; grid-template-columns: max-content max-content; gap: 4px 18px; margin: 10px 0 12px; font-variant-numeric: tabular-nums; }
.lp-math dt { color: var(--ink-2); }
.lp-math dd { margin: 0; text-align: right; }

/* Batch 32 (rendered audit): Inventory, purchasing, supplier invoices and Warranty sections are major sections, so each
   becomes a square panel under the shared band look (the accent, white heavy italic, 23 px as the shared .band-title
   renders). Markup unchanged: a section whose first child is its heading gets the band; its list sits inside the panel. */
body.shop-on .inv-sec:has(> h2:first-child) { background: var(--surface); border: 1px solid var(--hair); border-radius: 4px; padding: 0 0 12px; }
body.shop-on .inv-sec > h2:first-child { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 9px 18px; min-height: 44px;
  box-sizing: border-box; background: var(--accent); color: var(--accent-ink, #fff); border-radius: 3px 3px 0 0;
  font: italic 900 23px/1.08 var(--font-title); text-transform: uppercase; letter-spacing: -0.004em; }
body.shop-on .inv-sec > h2:first-child :is(span, small, .cp-n) { color: inherit; font: 600 17px/1 var(--font); font-style: normal; text-transform: none; opacity: .92; }
body.shop-on .inv-sec:has(> h2:first-child) > :not(h2:first-child) { margin-left: 12px; margin-right: 12px; }
@media (max-width: 860px) { body.shop-on .inv-sec > h2:first-child { padding: 8px 14px; font-size: 19px; } body.shop-on .inv-sec:has(> h2:first-child) > :not(h2:first-child) { margin-left: 8px; margin-right: 8px; } }
