/* rx-inv.css - Inventory and Logistics. Builds on rx-system.css (list, record, controls) and rx-dtr.css (tables, pop-ups). */
.inv-sample { max-width: none; background: var(--tint-2); font-weight: 400; cursor: help; }
#invTools .ux-tools__pick { flex: 0 1 160px; }
#invTools .ux-tools__search { flex: 1 1 180px; }
#invTools .inv-export { flex: 0 1 112px; }
@media (min-width: 761px) {
  #invTools .ux-tools__search.inv-tight { flex: 1 1 110px; min-width: 110px; }
  #invTools .ux-tools__pick.inv-tight { flex: 0 1 126px; min-width: 0; }
  #invTools .ux-tools__pick.inv-export.inv-tight { flex: 0 1 96px; }
  #invTools .ux-tools__add.inv-tight, #invTools .inv-tool2.inv-tight { white-space: nowrap; }
}
.inv-dates { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; }
.inv-dates .ux-in { flex: 0 1 150px; width: 150px; }
.inv-on { background: var(--ac); border-color: var(--ac); color: #fff; font-weight: 500; }
.inv-on:hover, .inv-on:focus-visible { border-color: var(--ac); }

/* facts: label above value */
.inv-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; margin: 0; }
.inv-facts dt { font-size: 12px; font-weight: 500; }
.inv-facts dd { margin: 3px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.inv-facts .is-wide { grid-column: 1 / -1; }
.inv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-brand { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--ctl-line); background: var(--tint-2); color: var(--ink); font: 400 13px var(--font); cursor: pointer; }
.inv-brand:hover, .inv-brand:focus-visible { border-color: var(--line-hover); outline: none; }

/* cards with a title and buttons on one line */
.inv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.inv-head h3 { margin: 0; }
.inv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inv-sub { margin: 14px 0 8px; font-size: 13px; font-weight: 500; }
.inv-tablewrap { border-radius: 16px; border: 1px solid var(--line); overflow: auto; background: var(--card); flex: none !important; }

/* number tiles and the score */
.inv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.inv-stat { padding: 11px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); min-width: 0; }
.inv-stat span { display: block; font-size: 11.5px; }
.inv-stat b { display: block; margin-top: 2px; font-size: 20px; font-weight: 300; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-stat small { display: block; margin-top: 1px; font-size: 11px; color: var(--ink2); }
.inv-stat.is-bad { border-color: var(--bad); }
.inv-stat.is-bad b { color: var(--bad); }
td.is-bad { color: var(--bad); font-weight: 500; }
.inv-score { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.inv-grade { flex: none; width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--ac); color: #fff; font-size: 26px; font-weight: 300; }
.inv-score p { margin: 0; font-size: 13px; }
.inv-score b { display: block; font-size: 14px; font-weight: 500; }
.inv-alerts { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; }
.inv-alerts li { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--bad); color: var(--bad); background: var(--tint); }
.inv-alerts li.is-quiet { border-color: var(--line); color: var(--ink); }

/* agreement viewer */
.inv-lg { width: min(1040px, 100%) !important; }
.inv-md { width: min(720px, 100%) !important; }
.inv-doc { display: flex; flex-direction: column; gap: 10px; max-height: 52dvh; overflow-y: auto; padding: 12px; border-radius: 16px; background: var(--solid-2); border: 1px solid var(--line); }
.inv-page { padding: 26px 30px; background: #fff; box-shadow: 0 2px 10px rgba(46,46,50,.16); font: 400 12.5px/1.55 var(--font); }
.inv-page h4 { margin: 0 0 8px; font-size: 15px; font-weight: 500; }
.inv-page p { margin: 0 0 8px; }
.inv-page footer { margin-top: 12px; font-size: 11px; color: var(--ink2); text-align: right; }
.inv-page mark { padding: 0 2px; border-radius: 3px; background: var(--ac); color: #fff; }
.inv-frame { width: 100%; height: 52dvh; border: 0; border-radius: 12px; background: var(--solid-2); }
.inv-older { display: flex; flex-wrap: wrap; gap: 8px; }
.inv-older .ux-file { flex: 0 1 190px; }

/* purchase order pop-up */
.inv-po-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.inv-po-top h3 { margin: 0; font-size: 24px; font-weight: 300; letter-spacing: -.01em; }
.inv-note { padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--tint); font-size: 13px; }
.inv-note.is-bad { border-color: var(--bad); color: var(--bad); background: none; }
.inv-tot td { font-weight: 500; background: var(--solid-2); }
.inv-batch { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 18px; border: 1px solid var(--line); }
.inv-batch__h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.inv-batch__h b { font-size: 14px; font-weight: 500; }
.inv-batch__h small { font-size: 12px; color: var(--ink2); }
.inv-batch__h .inv-acts { margin-left: auto; }
.inv-stack { display: flex; flex-direction: column; gap: 10px; }
.inv-stack > * { flex: none; }

/* adding items: one row per specification */
.inv-chain { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.inv-specs { display: flex; flex-direction: column; gap: 8px; }
.inv-spec { display: grid; grid-template-columns: minmax(150px, 2.4fr) minmax(70px, .8fr) minmax(90px, 1fr) minmax(120px, 1.2fr) 38px; align-items: end; gap: 8px; }
.inv-rcv { display: grid; grid-template-columns: minmax(150px, 2.2fr) 70px minmax(140px, 1.2fr) minmax(80px, .8fr) 70px; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.inv-rcv--h { padding-top: 0; border-top: 0; font-size: 12px; font-weight: 500; }
.inv-rcv small { display: block; font-size: 12px; color: var(--ink2); }
.inv-num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-x { width: 42px; min-width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 1px solid var(--ctl-line); background: none; color: var(--ink); font: 400 16px var(--font); cursor: pointer; }
.inv-x:hover, .inv-x:focus-visible { border-color: var(--line-hover); outline: none; }
.inv-photo { max-width: 100%; max-height: 180px; border-radius: 12px; border: 1px solid var(--line); }
.inv-thumb { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* a box that suggests names while you type; the list must not be cut off by the pop-up */
.inv-combo__add { font-weight: 500; }

@media (orientation: portrait), (max-width: 760px) {
  #invPage .sm-perm__head { flex-wrap: wrap; row-gap: 6px; }
  .inv-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #invTools .ux-tools__pick { flex: 1 1 40%; }
  #invTools .ux-btn { flex: 1 1 40%; }
  #invTools .inv-export { flex: 1 1 40%; }
  .inv-dates { flex: 1 1 100%; }
  .inv-dates .ux-in { flex: 1 1 40%; width: auto; }
  .inv-doc { max-height: 58dvh; padding: 6px; }
  .inv-page { padding: 16px; }
  .inv-spec { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .inv-spec > :first-child { grid-column: 1 / -1; }
  .inv-x { width: 100%; border-radius: 999px; font-size: 13px; }
  .inv-x::after { content: " Remove"; }
  .inv-rcv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-rcv > :first-child { grid-column: 1 / -1; }
  .inv-rcv--h { display: none; }
  .inv-num { text-align: left; }
  .inv-tablewrap { border: 0; background: none; overflow: visible; }
  .inv-tablewrap .dtr-t, .inv-tablewrap .dtr-t tbody { display: block; }
  .inv-tablewrap .dtr-t thead { display: none; }
  .inv-tablewrap .dtr-t tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-bottom: 8px; padding: 12px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--tint); }
  .inv-tablewrap .dtr-t td { display: block; padding: 0; border: 0; background: none; text-align: left; font-size: 13.5px; min-width: 0; }
  .inv-tablewrap .dtr-t td:empty { display: none; }
  .inv-tablewrap .dtr-t td::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 500; color: var(--ink2); }
  .inv-tablewrap .dtr-t td.dtr-name { grid-column: 1 / -1; order: -1; font-size: 15px; white-space: normal; }
  .inv-tablewrap .dtr-t td.dtr-name::before { display: none; }
  .inv-batch__h .inv-acts { margin-left: 0; width: 100%; }
}

/* 037: delivery map, photos, address boxes */
.inv-map { display: block; width: 100%; height: min(70vh, 640px); border: 0; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.inv-photo--big { max-height: 70vh; display: block; margin: 0 auto; }
.inv-photo-view { min-height: 120px; display: grid; place-items: center; }
.inv-addr { display: flex; align-items: center; min-height: 40px; white-space: normal; }
.inv-route { display: grid; gap: 10px; margin: 10px 0; }.inv-spec--wide { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.inv-spec--wide > .inv-x { justify-self: start; }
@media (max-width: 760px) { .inv-spec--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Asset Transfers: the list of tags to tick */
.inv-checks { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; margin: 10px 0; padding: 4px 2px; }
.inv-check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; font-size: 13px; }
.inv-check input { width: 18px; height: 18px; flex: none; accent-color: var(--ac); }

/* Stock Planning: quantity boxes inside a table */
.inv-qty { width: 96px; min-height: 36px; text-align: right; }

/* Deliveries: the receiver signs here */
.inv-sign { display: block; width: 100%; height: 180px; border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; margin: 6px 0 10px; }

/* a second tool button sits just before the main add button, on the same row */
#invTools .inv-tool2 { margin-left: auto; white-space: nowrap; }
#invTools .inv-tool2 ~ .ux-tools__add { margin-left: 0; }
@media (max-width: 760px) { #invTools .inv-tool2 { margin-left: 0; } }

/* Receiving: lot and expiry under each item */
.inv-rcv-lot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -2px 0 10px; }
.inv-rcv-lot .ux-in { flex: 1 1 140px; min-height: 36px; }
.inv-rcv-lot .ux-note { flex: 0 0 auto; margin: 0; }

/* Receiving on a phone: the column headings are hidden, so each value carries its own label */
@media (max-width: 760px) {
  .inv-rcv:not(.inv-rcv--h) > :nth-child(2)::before { content: 'To receive '; font-size: 12px; color: var(--ink2); }
  .inv-rcv:not(.inv-rcv--h) > :nth-child(5)::before { content: 'Variance '; font-size: 12px; color: var(--ink2); }
  .inv-rcv:not(.inv-rcv--h) > :nth-child(2), .inv-rcv:not(.inv-rcv--h) > :nth-child(5) { text-align: left; }
  .inv-rcv-lot > .ux-note:first-child { flex-basis: 100%; }
  .inv-rcv-lot textarea { flex-basis: 100%; }
}
/* Physical Count > Scan to count: made for a phone held in one hand */
.pc-scan { display: flex; flex-direction: column; gap: 10px; }
.pc-scan__where { margin: 0; font-size: 13px; color: var(--muted, inherit); }
.pc-scan__cam { position: relative; width: 100%; max-height: 42vh; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; background: #000; }
.pc-scan__cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-scan__cam::after { content: ''; position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: var(--ac); box-shadow: 0 0 10px var(--ac); opacity: .85; }
.pc-scan__item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--solid-2); }
.pc-scan__item b { font-size: 15px; font-weight: 500; }
.pc-scan__item small { grid-column: 1; opacity: .75; }
.pc-scan__n { grid-column: 2; grid-row: 1 / span 2; font-size: 40px; font-weight: 300; line-height: 1; color: var(--ac-text); }
.pc-scan__acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pc-scan__acts:empty { display: none; }
.pc-scan__btn { min-width: 64px; min-height: 44px; font-size: 18px; }
.pc-scan__recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pc-scan__recent li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.pc-scan__recent li small { grid-column: 1; opacity: .7; }
.pc-scan__recent li b { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 500; }
.pc-scan__recent li.is-quiet { display: block; opacity: .7; }
.pc-scan-go { min-height: 44px; }
@media (max-width: 760px) { .pc-scan__cam { aspect-ratio: 1 / 1; } .pc-scan-go { width: 100%; } }

/* Deliveries > Dispatch board: waiting deliveries, then one column per driver */
.dp { display: flex; flex-direction: column; gap: 10px; }
.dp__body { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.dp__col { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 18px; border: 1px solid var(--line); background: var(--solid-2); min-width: 0; }
.dp__col h4 { margin: 0; }
.dp__head small { display: block; opacity: .75; font-size: 12px; }
.dp__card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--tint-2, transparent); }
.dp__card small { opacity: .75; font-size: 12px; }
.dp__h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dp__route { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.dp__n { position: absolute; top: 8px; right: 10px; font-size: 20px; font-weight: 300; color: var(--ac-text); }
.dp__card .inv-acts { gap: 6px; }
.dp__card .ux-in { flex: 1 1 120px; min-width: 0; }
.dp__plan:empty { display: none; }
.dp > .inv-acts input[type="date"] { flex: 0 0 180px; width: 180px; }
@media (min-width: 761px) { .inv-win.dtr-form--two { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dp__win { font-weight: 500; }
.dp__win.is-bad { color: var(--bad); }
/* first expiry first out hints and lot trails */
.inv-fefo { grid-column: 1 / -1; display: block; margin-top: 2px; }
.inv-fefo:empty { display: none; }
.inv-fefo.is-bad { color: var(--bad); }
.inv-lots { margin: 4px 0 0; }
/* Stock Planning > Make purchase orders: one block per preferred supplier */
.inv-reo { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line); }
.inv-reo .inv-check { flex-wrap: wrap; gap: 6px; }
/* Dispatch board > Plan route: arrival times */
.dp__etas { margin: 4px 0 6px; padding-left: 20px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.dp__etas li.is-bad, .dp__plan .is-bad { color: var(--bad); }

/* 103: a PO line priced above the alert limit */
.inv-price-up { color: #ff8a80; font-weight: 600; }
/* the Physical Count hint sits on its own line under the two count buttons */
.pc-tools-hint { flex-basis: 100%; order: 99; margin: 2px 0 0; }

/* 115: Stock Planning > Forecast */
.pl-spark { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; color: var(--ac-text); white-space: nowrap; }
.pl-diff { color: var(--ac-text); }

/* camera scanning outside counts: the last item read */
.pc-scan__last { margin: 4px 0 0; font-weight: 600; min-height: 1.4em; }
.inv-sup small { display: block; opacity: .7; font-size: 12px; }
/* 124: the lowest quote in an RFQ row */
.inv-best { color: var(--ac-text); font-weight: 600; }

/* 137: Inventory > Insights */
.inv-ins-kpis { margin: 0 0 16px; }
.inv-ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; margin: 0 0 16px; }
.inv-ins-tables { display: grid; gap: 16px; }
.inv-ins-table .ux__msg { margin: 0; }
