.inventory { min-width:0; color:#15345b; }
#adminJProjectPanel:has(.inventory) { grid-template-columns:minmax(0,1fr); }
#jProjectModule:has(.inventory) { min-width:0; max-width:100%; }
.inv-header,.inv-controls,.inv-tabs { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:14px; }
.inv-header>div { flex:1; min-width:240px; }
.inventory h2,.inventory h3 { color:#082d5f; margin:8px 0; }
.inv-tabs { border-bottom:1px solid #c7d9ee; padding-bottom:10px; }
.inventory label { display:flex; flex-direction:column; gap:5px; font-size:12px; font-weight:600; }
.inventory input,.inventory select { border:1px solid #b9cde4; border-radius:5px; background:white; color:#15345b; padding:9px; min-width:0; }
.inventory .inv-check { flex-direction:row; align-items:center; }
.inventory button { min-height:36px; cursor:pointer; }
.inventory-scroll { max-height:65vh; overflow:auto; border:1px solid #b4cbe5; position:relative; max-width:100%; overscroll-behavior:contain; }
.inv-table { width:100%; border-spacing:0; font-size:12px; }
.inv-table th,.inv-table td { padding:7px 5px; border-right:1px solid #c4d4e5; border-bottom:1px solid #c4d4e5; text-align:right; min-width:96px; }
.inv-table th { white-space:normal; }
.inv-table thead th { background:#103d70; color:white; position:sticky; top:0; z-index:3; max-width:112px; }
.inv-table tr>:first-child { position:sticky; left:0; background:#fff; min-width:260px; max-width:340px; text-align:left; z-index:2; }
.inv-table thead tr>:first-child { background:#103d70; z-index:4; }
.inv-table .balance { background:#edf5ff; }
.inv-table .transfer { background:#eee8fa; }
.inv-table .recycle { background:#e7f6ed; }
.inv-table .blending { background:#fff1dc; }
.inv-table thead .balance,.inv-table thead .transfer,.inv-table thead .recycle,.inv-table thead .blending { color:#15345b; }
.inv-table .inv-group>* { background:#e9f2ff; font-weight:700; border-top:2px solid #93b4d9; }
.inv-table .inv-subtotal>* { background:#e7f1fd; font-weight:700; border-top:1px solid #7395be; border-bottom:2px solid #7395be; }
.inv-table .inv-combined>* { background:#d7e9ff; font-weight:700; border-top:2px solid #547daa; border-bottom:2px solid #547daa; }
.inv-table .inv-combined>:first-child { border-left:2px solid #547daa; }
.inv-table .inv-combined>:last-child { border-right:2px solid #547daa; }
.inv-table tr.selected>* { background:#fff1b8!important; }
.inv-figure { border:0; background:none; color:inherit; font:inherit; width:100%; text-align:right; padding:0; }
.inv-process { border:1px solid #c3d6ed; border-radius:9px; padding:14px; margin:14px 0; }
.inv-flow { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:12px; }
.inv-flow>div { background:#f2f7ff; border:1px solid #c4d7ee; border-radius:8px; padding:12px; }
.inv-flow p { font-size:12px; }
.inv-flow b { display:block; color:#12689c; }
.inv-dialog { width:min(1100px,94vw); max-height:90vh; padding:20px; border:1px solid #b0c8e4; border-radius:12px; overflow:auto; }
.inv-dialog::backdrop { background:#0c244d77; }
.inv-dialog header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.inv-dialog form,.inv-dialog [data-inv-fields] { display:grid; gap:12px; }

.inv-dialog label.inv-picker { display:flex; }
.inv-picker { position:relative; }
.inv-picker>div { display:flex; }
.inv-picker [data-inv-pick-search] { flex:1; }
.inv-picker .inv-pick-options { display:flex; flex-direction:column; max-height:220px; overflow:auto; border:1px solid #9ebbe0; background:white; }
.inv-picker .inv-pick-options[hidden],.inv-picker button[hidden],[data-inv-rbdpo][hidden] { display:none; }
.inv-pick-options button { text-align:left; flex-shrink:0; }
.inv-outputs fieldset { display:grid; gap:10px; border:1px solid #bfd2ea; margin:10px 0; }
.inv-error { color:#b52c32; white-space:pre-wrap; }
.inv-catalog-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin:16px 0 22px; }
.inv-catalog-panel { min-width:0; padding:12px; border:1px solid #bfd2ea; border-radius:9px; background:#f7faff; }
.inv-catalog-panel header { display:flex; gap:8px; align-items:center; justify-content:space-between; margin-bottom:10px; }
.inv-catalog-panel h3 { font-size:16px; }
.inv-catalog-panel label { margin-bottom:10px; }
.inv-catalog-panel .inventory-scroll { max-height:280px; }
.inv-catalog-panel .inv-table { table-layout:fixed; }
.inv-catalog-panel .inv-table th,.inv-catalog-panel .inv-table td { min-width:0; overflow-wrap:anywhere; }
.inv-catalog-panel .inv-table tr>:first-child { min-width:0; max-width:none; width:60%; }
.inv-catalog-panel .inv-table tr>:nth-child(2) { width:16%; }
.inv-catalog-panel .inv-table tr>:last-child { width:24%; }
.inv-catalog-panel tr[hidden] { display:none; }
@media(max-width:1100px){.inv-catalog-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:700px){.inv-catalog-grid{grid-template-columns:1fr;}}
@media(max-width:900px){.inv-flow {grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:540px){.inv-flow {grid-template-columns:1fr;}.inventory button{min-height:44px}.inv-table tr>:first-child{min-width:180px;max-width:210px}.inv-controls>*{max-width:100%}}

.inventory .inv-flow-label { display:block; color:#607493; margin:3px 0 8px; }
/* Production overview: plant-level flows and a shared monthly valuation table. */
.inventory .inv-production-plant { margin:18px 0 24px; min-width:0; scroll-margin-top:20px; }
.inventory .inv-plant-heading { background:#e8f2fb; border-left:3px solid #0869bd; padding:11px 13px; margin:0 0 18px; font-size:16px; }
.inv-process-stack { border:1px solid #d1e2f5; border-radius:12px; background:#fff; padding:12px 14px; box-shadow:0 5px 15px #15345b08; }
.inv-production .inv-process { background:#f9fcff; padding:15px 17px; border:1px solid #c8dffc; border-radius:13px; margin:0 0 10px; }
.inv-production .inv-process:last-child { margin-bottom:0; }
.inv-process-heading { display:flex; align-items:center; gap:11px; padding-bottom:12px; border-bottom:1px solid #c7ddf8; margin-bottom:13px; }
.inv-process-heading h4 { margin:0; font-size:18px; color:#062e60; }
.inv-process-icon,.inv-flow-icon { display:flex; align-items:center; justify-content:center; flex-shrink:0; border-radius:50%; width:36px; height:36px; background:#e0efff; color:#086cc3; }
.inv-run-badge { margin-left:auto; border-radius:20px; background:#d7f7f0; color:#00746f; padding:8px 12px; font-size:11px; font-weight:700; white-space:nowrap; }
.inv-run-badge::before { content:''; display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:6px; background:#27b65f; box-shadow:0 0 0 3px #27b65f18; }
.inv-production .inv-flow { gap:38px; margin:0; }
.inv-production .inv-flow-card { position:relative; display:grid; grid-template-columns:36px minmax(55px,.9fr) minmax(160px,1.3fr); align-items:center; gap:9px; padding:22px 13px; min-height:124px; background:#fafdff; border:1px solid #b7d5ff; border-radius:8px; min-width:0; }
.inv-production .inv-flow-card:not(:last-child)::after { content:'→'; position:absolute; right:-29px; top:calc(50% - 14px); color:#398ad7; font-size:27px; }
.inv-flow-name strong { display:block; font-size:15px; color:#062d5c; overflow-wrap:anywhere; }
.inv-flow-name small { display:block; margin-top:6px; color:#6785aa; font-size:11px; }
.inv-flow-metrics { min-width:0; }
.inv-production .inv-flow-metrics p { display:grid; grid-template-columns:42px minmax(0,1fr) 56px; align-items:center; gap:4px; margin:0; padding:3px 0; font-size:12px; border-bottom:1px solid #e5eff8; }
.inv-flow-metrics p:last-child { border-bottom:0; }
.inv-flow-metrics p>span { color:#6887aa; font-size:11px; }
.inv-production .inv-flow-metrics b { color:#072e5e; text-align:right; font-size:12px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.inv-flow-metrics em { font-style:normal; font-size:10px; font-weight:750; padding:5px 2px; text-align:center; border-radius:15px; color:#0868ba; background:#e5f0ff; white-space:nowrap; }
.inv-production .inv-flow-loss { border-color:#ffbdc5; background:#fffdfd; }
.inv-flow-loss .inv-flow-icon,.inv-flow-loss em { color:#d82340; background:#ffe6eb; }
.inv-production .inv-flow-byproduct { border-color:#ffd276; background:#fffef9; }
.inv-flow-byproduct .inv-flow-icon,.inv-flow-byproduct em { color:#af7900; background:#fff1ca; }
.inv-production .inv-flow-main { border-color:#a3e2dc; background:#f9fffd; }
.inv-flow-main .inv-flow-icon,.inv-flow-main em { color:#008678; background:#ddf7f2; }
.inv-production-table-wrap { margin-top:8px; border-radius:6px; max-height:none; }
.inv-production-table { table-layout:fixed; min-width:1000px; }
.inv-production-table caption { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.inv-production-table .inv-process-name-col { width:16%; }
.inventory .inv-production-table th,.inventory .inv-production-table td { min-width:0; max-width:none; padding:8px; font-size:11px; font-weight:700; }
.inventory .inv-production-table thead th { background:#0969b1; text-align:left; }
.inventory .inv-production-table tr>:first-child { min-width:0; max-width:none; width:auto; }
.inventory .inv-production-table .inv-process-row>* { background:#e7f2fc; }
.inventory .inv-production-table .inv-process-row>:nth-child(3),.inventory .inv-production-table .inv-process-row>:nth-child(8) { background:#dcebfc; }
.inventory .inv-production-table .inv-process-v>* { background:#d9eaf9; }
.inv-process-history { margin-top:8px; }
.inv-process-history summary { cursor:pointer; color:#426b97; padding:8px 0; font-size:12px; }
@media(min-width:1101px) and (max-width:1650px){.inv-production .inv-flow{gap:25px}.inv-production .inv-flow-card{grid-template-columns:28px minmax(0,1fr);gap:7px;padding:12px 10px}.inv-flow-icon{width:28px;height:28px}.inv-flow-metrics{grid-column:1/-1}.inv-production .inv-flow-card:not(:last-child)::after{right:-22px}.inv-production .inv-flow-metrics p{grid-template-columns:50px minmax(0,1fr) 60px}}
@media(max-width:1100px){.inv-production .inv-flow{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.inv-production .inv-flow-card::after{display:none}.inv-production .inv-flow-card{grid-template-columns:30px minmax(50px,.8fr) minmax(155px,1.3fr);padding:16px 10px}.inv-flow-icon{width:30px;height:30px}}
@media(max-width:700px){.inv-production .inv-flow{grid-template-columns:minmax(0,1fr)}.inv-process-stack{padding:8px}.inv-production .inv-process{padding:10px}.inv-process-heading{flex-wrap:wrap;gap:7px}.inv-process-heading h4{font-size:15px;flex:1}.inv-run-badge{font-size:10px;padding:6px 9px}.inv-production .inv-flow-card{grid-template-columns:28px minmax(50px,.8fr) minmax(145px,1.3fr);gap:6px}.inv-flow-name strong{font-size:13px}.inv-production .inv-flow-metrics p{grid-template-columns:39px minmax(0,1fr) 51px;font-size:11px}.inv-production .inv-flow-metrics b{font-size:11px}}
/* Stock movement report: scoped to this tab, leaving other reports intact. */
.inv-movement-toolbar { display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:12px; margin:18px 0 10px; }
.inv-movement-toolbar .inv-tabs { margin:0; padding:0; border:0; gap:8px; flex-wrap:nowrap; }
.inv-movement-toolbar .inv-tabs button { padding:11px 14px; white-space:nowrap; }
.inv-movement-controls { margin:0; gap:10px; align-items:flex-end; }
.inv-movement-controls label { font-size:13px; }
.inv-movement-controls input,.inv-movement-controls select { height:36px; padding:7px 9px; font-size:12px; }
.inv-movement-controls input[name=search] { width:175px; }
.inv-movement-controls select { max-width:150px; }
.inv-movement-controls button { background:#627e9e; color:#fff; border-color:#627e9e; padding:9px 14px; }
.inv-display { border:0; padding:0 0 7px; margin:0; display:flex; gap:10px; }
.inv-display legend { padding:0; margin-bottom:7px; font-size:13px; font-weight:700; }
.inv-display .inv-check { flex-direction:row; gap:5px; white-space:nowrap; align-items:center; }
.inv-display input { height:auto; margin:0; accent-color:#0879ce; }
.inv-movement-summary { background:#eaf7f3; border-left:3px solid #169178; padding:13px 15px; margin-bottom:13px; font-size:13px; }
.inv-movement-scroll { max-height:calc(100vh - 330px); min-height:260px; border-radius:7px 7px 0 0; }
.inv-movement-table { table-layout:fixed; min-width:1300px; }
.inv-movement-table .inv-item-col { width:19%; }
.inventory .inv-movement-table th,.inventory .inv-movement-table td { min-width:0; max-width:none; padding:7px 6px; font-size:11px; }
.inventory .inv-movement-table tr>:first-child { min-width:0; max-width:none; background:#f6fbff; }
.inventory .inv-movement-table thead th { background:#096bb4; color:#fff; text-align:left; line-height:1.25; }
.inventory .inv-movement-table thead .transfer { background:#306699; }
.inventory .inv-movement-table thead .recycle { background:#227e68; }
.inventory .inv-movement-table thead .blending { background:#af641c; }
.inv-movement-table td { background:#f8fbff; font-variant-numeric:tabular-nums; }
.inv-movement-table td.balance { background:#e7f2ff; }
.inv-movement-table td.transfer { background:#d9e8fc; }
.inv-movement-table td.recycle { background:#daf0e5; }
.inv-movement-table td.blending { background:#fce8c9; }
.inventory .inv-movement-table .inv-group>* { background:#e6f1fb; border-top:1px solid #bbd6ed; font-weight:800; }
.inv-movement-table .inv-group button { min-height:24px; width:25px; padding:1px; margin-right:5px; border:1px solid #95bde7; border-radius:4px; background:#fff; color:#096bb4; }
.inv-movement-table tbody tr:not(.inv-group)>th { padding-left:38px; }
.inventory .inv-movement-table .inv-figure { min-height:16px; white-space:nowrap; font-size:inherit; }
.inventory .inv-movement-table .inv-subtotal>* { font-weight:800; background:#e1effb; border-top:0; border-bottom:1px solid #c4d4e5; }
.inventory .inv-movement-table .inv-subtotal>:first-child { border-left:2px solid #318fd6; background:#e8f4fc; }
.inventory .inv-movement-table .inv-subtotal>:last-child { border-right:2px solid #318fd6; }
.inventory .inv-movement-table tr:not(.inv-subtotal)+.inv-subtotal>* { border-top:2px solid #318fd6; }
.inventory .inv-movement-table .inv-subtotal:has(+tr:not(.inv-subtotal))>*,.inventory .inv-movement-table .inv-subtotal:last-child>* { border-bottom:2px solid #318fd6; }
.inventory .inv-movement-table .inv-subtotal>.transfer { background:#d6e6fa; }
.inventory .inv-movement-table .inv-subtotal>.recycle { background:#d7eee1; }
.inventory .inv-movement-table .inv-subtotal>.blending { background:#fae5c7; }
.inventory .inv-movement-table .inv-combined>* { background:#d9f0ee; font-weight:800; border-top:1px solid #9bd0cd; border-bottom:1px solid #9bd0cd; }
.inventory .inv-movement-table tr:not(.inv-combined)+.inv-combined>* { border-top:3px solid #128b83; }
.inventory .inv-movement-table .inv-combined>:first-child { border-left:2px solid #138b83; }
.inventory .inv-movement-table .inv-combined>:last-child { border-right:2px solid #138b83; }
.inventory .inv-movement-table .inv-combined:last-child>* { border-bottom:2px solid #138b83; }
@media(max-width:1400px){.inv-movement-controls{flex-wrap:wrap}.inv-movement-toolbar{gap:14px}.inv-movement-scroll{max-height:62vh}}
@media(max-width:700px){.inv-movement-toolbar .inv-tabs{overflow-x:auto;max-width:100%;padding-bottom:4px}.inv-movement-controls{width:100%}.inv-movement-controls>label{flex:1;min-width:135px}.inv-movement-controls input[name=search],.inv-movement-controls select{width:100%;max-width:none}.inv-display{flex-wrap:wrap}.inv-movement-table{min-width:1450px}.inventory .inv-movement-table .inv-figure{min-height:32px}.inv-movement-controls button{min-height:44px}}
.inventory .inv-movement-table thead tr>:first-child { background:#096bb4; color:#fff; }
/* Keep each In/Out pair distinct through detail, subtotal and combined rows. */
.inventory .inv-movement-table tbody td.transfer { background:#d9e8fc; }
.inventory .inv-movement-table tbody td.recycle { background:#daf0e5; }
.inventory .inv-movement-table tbody td.blending { background:#fce8c9; }
.inventory .inv-movement-table .inv-combined>td.transfer { background:#cbdff5; }
.inventory .inv-movement-table .inv-combined>td.recycle { background:#cce9db; }
.inventory .inv-movement-table .inv-combined>td.blending { background:#f7dfb9; }
.inv-closing-form { display:flex; align-items:center; gap:3px; }
.inventory .inv-closing-form input { width:100%; min-width:0; padding:5px 2px; text-align:right; font-size:11px; }
.inventory .inv-closing-form button { min-height:28px; padding:4px; font-size:10px; }
.inv-closing-export { display:none; }
