.material-inventory-page .mr-panel{background:#fff;border:1px solid #d4e9e1;border-radius:12px;padding:20px;margin:18px 0;color:#29483e;min-width:0}
.material-inventory-page .mr-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px;flex-wrap:wrap}
.material-inventory-page .mr-heading h3{margin:0;font-size:18px;color:#194f40}
.material-inventory-page .mr-badges{display:flex;gap:8px;flex-wrap:wrap;font-size:12px}
.material-inventory-page .mr-badges span,.material-inventory-page .mr-row-tags span{background:#e6f5ee;border:1px solid #d1e9dd;color:#32604e;border-radius:6px;padding:4px 8px}
.material-inventory-page .mr-description,.material-inventory-page .mr-notice{font-size:13px;line-height:1.7;margin:8px 0;color:#687d73}
.material-inventory-page .mr-form{display:grid;grid-template-columns:minmax(200px,2fr) minmax(160px,1.3fr) 145px auto;gap:12px;align-items:end;margin-top:16px}
.material-inventory-page .mr-form label{display:flex;flex-direction:column;gap:6px;font-size:13px;color:#365c4d;min-width:0}
.material-inventory-page .mr-form input[type=search],.material-inventory-page .mr-form select{width:100%;min-width:0;height:38px;background:#fff;border:1px solid #c9ded4;border-radius:7px;padding:0 10px;font-size:13px;color:#29483e}
.material-inventory-page .mr-form .mr-stock{flex-direction:row;align-items:center;gap:6px;font-size:13px;white-space:nowrap;margin-bottom:9px}
.material-inventory-page .mr-stock input{width:16px;height:16px;margin:0;accent-color:#238666}
.material-inventory-page .mr-form-actions{display:flex;flex-wrap:wrap;gap:8px;grid-column:1/-1;align-items:center}
.material-inventory-page .mr-form-actions button{margin:0}
.material-inventory-page .mr-history{border-top:1px dashed #d9e7df;margin-top:16px;padding-top:12px;font-size:13px}
.material-inventory-page .mr-history summary{cursor:pointer;color:#3f6554;font-weight:600}
.material-inventory-page .mr-history p{margin:8px 0;color:#708278;line-height:1.7}
.material-inventory-page .mr-result{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 0;border-top:1px solid #e3ece6}
.material-inventory-page .mr-result div{min-width:0;overflow-wrap:anywhere}.material-inventory-page .mr-result button{flex-shrink:0}
.material-inventory-page .mr-result p{font-size:13px;margin:5px 0;color:#456454;line-height:1.6}.material-inventory-page .mr-result small{font-size:12px;color:#728378}
.material-inventory-page .mr-empty{padding:18px;background:#f4f9f6;border-radius:8px;color:#6a8072;font-size:13px}
.material-inventory-page .material-inventory-table{min-width:1410px}.material-inventory-page .material-inventory-table th:nth-child(10){width:240px}
.material-inventory-page .mr-row-tags{display:flex;flex-wrap:wrap;gap:4px;font-size:12px;margin-bottom:5px}
.material-inventory-page .mr-row-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.material-inventory-page .mr-error,.mr-dialog .mr-error{color:#b24635!important}
.mr-dialog{box-sizing:border-box;width:min(820px,calc(100vw - 32px));max-height:calc(100dvh - 40px);border:1px solid #cee1d5;border-radius:14px;padding:24px;color:#294b3a;overflow:auto;background:#fff}
.mr-dialog::backdrop{background:rgba(22,49,35,.42)}
.mr-dialog .mr-dialog-heading{display:flex;justify-content:space-between;align-items:start;gap:16px}.mr-dialog h3{font-size:19px;margin:0;overflow-wrap:anywhere}.mr-dialog .mr-close{background:#f0f6f2;color:#3c5d49;border:0;border-radius:7px;padding:5px 12px;font-size:22px;cursor:pointer;line-height:1.3}
.mr-dialog .mr-detail-layout{display:grid;grid-template-columns:170px minmax(0,1fr);gap:22px;margin:20px 0}
.mr-dialog .mr-detail-image{height:190px;display:flex;justify-content:center;align-items:center;border:1px solid #e0e9e2;border-radius:10px;background:#f6f9f7;font-size:13px;color:#819085}.mr-dialog .mr-detail-image img{width:100%;height:100%;object-fit:contain;border-radius:9px}
.mr-dialog .mr-meta{font-size:12px;color:#76857b;line-height:1.8;margin-top:10px;overflow-wrap:anywhere}
.mr-dialog dl{margin:0;display:grid;gap:12px}.mr-dialog .mr-feature{display:grid;grid-template-columns:70px minmax(0,1fr);gap:12px;padding-bottom:10px;border-bottom:1px solid #edf2ee}.mr-dialog dt{color:#748578;font-size:13px}.mr-dialog dd{margin:0;overflow-wrap:anywhere}.mr-dialog dd strong{font-size:15px}.mr-dialog dd span{display:block;font-size:11px;color:#89917b;margin-top:3px}.mr-dialog dd p{font-size:13px;color:#637565;line-height:1.6;margin:5px 0 0}
.mr-dialog .mr-history-placeholder{padding:16px;background:#f2f8f4;border:1px dashed #cbded1;border-radius:9px;margin:18px 0}.mr-dialog .mr-history-placeholder h4{margin:0 0 8px;font-size:14px}.mr-dialog .mr-history-placeholder p,.mr-dialog .mr-caution{font-size:13px;line-height:1.8;color:#738073;margin:5px 0}.mr-dialog #materialRecommendationDetailSummary{white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:1100px){.material-inventory-page .mr-form{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.material-inventory-page .mr-form .mr-stock{margin-bottom:9px}}
@media(max-width:600px){.material-inventory-page .mr-panel{padding:16px}.material-inventory-page .mr-form{grid-template-columns:minmax(0,1fr)}.mr-dialog{padding:18px}.mr-dialog .mr-detail-layout{grid-template-columns:minmax(0,1fr);gap:15px}.mr-dialog .mr-detail-image{height:160px}.material-inventory-page .mr-result{align-items:start;flex-direction:column}}

.material-inventory-page .mr-batch-progress{padding:10px 12px;background:#e9f6ef;border:1px solid #c6e3d2;border-radius:8px;color:#244d3b;line-height:1.6}
.material-inventory-page .mr-batch-progress[hidden]{display:none}

/* One finished product per full-width row; scrolling stays in the dialog. */
.mr-bom-history { border:1px solid #cce6df; border-radius:9px; padding:16px; margin:18px 0; background:#f8fcfa; min-width:0; }
.mr-bom-history h4 { margin:0 0 10px; color:#185249; font-size:15px; }
.mr-history-material { display:flex; align-items:center; gap:10px; margin:12px 0; }
.mr-history-material[hidden] { display:none; }
.mr-history-material select { min-width:0; max-width:100%; flex:1; }
.mr-history-status { color:#41605b; font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
.mr-history-rows { display:grid; gap:10px; }
.mr-history-row { display:grid; grid-template-columns:104px minmax(0,1fr); gap:16px; align-items:center; width:100%; box-sizing:border-box; border:1px solid #dbe8e3; border-radius:8px; padding:12px; background:#fff; }
.mr-history-picture { width:104px; height:96px; display:flex; align-items:center; justify-content:center; border-radius:6px; background:#f1f6f4; overflow:hidden; }
.mr-history-picture img { width:100%; height:100%; object-fit:contain; }
.mr-history-picture span { color:#718580; font-size:12px; text-align:center; padding:8px; }
.mr-history-product { min-width:0; }
.mr-history-product strong { font-size:15px; color:#124e46; overflow-wrap:anywhere; }
.mr-history-product p { margin:8px 0; font-size:14px; line-height:1.6; overflow-wrap:anywhere; }
.mr-history-product small { color:#6c817b; font-size:12px; }
.mr-history-pagination { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; padding-top:14px; font-size:13px; }
.mr-history-pagination[hidden] { display:none; }
.mr-history-pagination label { display:flex; align-items:center; gap:6px; }
.mr-history-pagination select { width:auto; }
@media (max-width:520px) {
 .mr-bom-history { padding:12px; }
 .mr-history-row { grid-template-columns:80px minmax(0,1fr); gap:12px; padding:10px; }
 .mr-history-picture { width:80px; height:80px; }
 .mr-history-material { align-items:flex-start; flex-direction:column; }
 .mr-history-material select { width:100%; }
}

.mr-history-search { display:flex; align-items:center; gap:8px; margin:14px 0 10px; }
.mr-history-search[hidden] { display:none; }
.mr-history-search input { flex:1; min-width:0; width:auto; }
.mr-history-search button { flex:none; white-space:nowrap; }
@media (max-width:520px) {
 .mr-history-search { flex-wrap:wrap; }
 .mr-history-search input { flex-basis:100%; }
}

.material-inventory-page .mr-result { display:grid; grid-template-columns:96px minmax(0,1fr) auto; align-items:center; }
.material-inventory-page .mr-result-picture { width:96px; display:flex; flex-direction:column; align-items:center; gap:4px; text-align:center; }
.material-inventory-page .mr-result-picture .material-inventory-image-link { width:96px; height:96px; box-sizing:border-box; background:#f4f9f6; border-color:#d7e7de; }
.material-inventory-page .mr-result-picture .material-inventory-image-empty { min-height:96px; }
.material-inventory-page .mr-result-picture small { display:block; }
.material-inventory-page .mr-result-copy { min-width:0; }
@media (max-width:600px) {
 .material-inventory-page .mr-result { grid-template-columns:80px minmax(0,1fr); align-items:start; gap:10px 12px; }
 .material-inventory-page .mr-result-picture { width:80px; grid-row:1 / span 2; }
 .material-inventory-page .mr-result-picture .material-inventory-image-link { width:80px; height:80px; }
 .material-inventory-page .mr-result-picture .material-inventory-image-empty { min-height:80px; }
 .material-inventory-page .mr-result > button { grid-column:2; justify-self:start; }
}

.material-inventory-page .mr-reference-field { display:flex; flex-direction:column; gap:6px; min-width:0; }
.material-inventory-page .mr-reference-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:4px 8px; }
.material-inventory-page .mr-reference-heading label { margin:0; }
.material-inventory-page .mr-reference-status { font-size:11px; color:#687d73; white-space:nowrap; }
.material-inventory-page .mr-reference-status[hidden] { display:none; }
.material-inventory-page .mr-reference-controls { display:grid; grid-template-columns:minmax(0,.8fr) minmax(0,1.3fr); gap:8px; }

.material-inventory-page .mr-filter-row{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) 160px;gap:16px;align-items:start}
.material-inventory-page .mr-similarity-fields{min-width:0;border:1px solid #d4e9e1;border-radius:8px;padding:10px 12px;margin:0;background:#f6fbf8}
.material-inventory-page .mr-similarity-fields legend{font-size:13px;font-weight:600;color:#365c4d;padding:0 4px}
.material-inventory-page .mr-similarity-options{display:flex;flex-wrap:wrap;gap:10px 18px}
.material-inventory-page .mr-similarity-options label{flex-direction:row;align-items:center;gap:6px;white-space:nowrap;cursor:pointer}
.material-inventory-page .mr-similarity-options input{width:16px;height:16px;margin:0;accent-color:#238666;flex-shrink:0}
.material-inventory-page .mr-similarity-fields small{display:block;font-size:12px;line-height:1.6;color:#687d73;margin-top:8px}
.material-inventory-page .mr-sort{padding-top:7px}
@media(max-width:600px){.material-inventory-page .mr-filter-row{grid-template-columns:minmax(0,1fr);gap:8px}.material-inventory-page .mr-sort{padding-top:0}}
